Projects
Multimedia
obs-studio
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 68
View file
obs-studio.changes
Changed
@@ -1,4 +1,253 @@ ------------------------------------------------------------------- +Thu Sep 19 02:55:09 UTC 2019 - jimmy@boombatower.com + +- Update to version 24.0.0: + * obs-browser: Update translations from crowdin + * Update translations from Crowdin + * libobs: Update version to 24.0.0 + * libobs: Check to swap BGRX/BGRA in async filters + * obs-browser: Map absolute to file URLs + * UI: Fix extra browser panels always creating on startup + * obs-browser: Fix panels not remembering last URL set + * UI: Fix browser docks being unchecked when created + * win-dshow: Fix color range when using FFmpeg decode + * Revert "UI: Various screen reader fixes" + * UI: Fix pause hotkey not working properly + * obs-browser: Fix portable mode not saving cookies + * obs-browser: Fix minor bug when using older CEF versions + * UI: Disable NVENC lookahead if dynamic bitrate on + * obs-browser: Fix browser panel visibility bug + * CI: Update CEF on osx to 3770 + * obs-browser: Fix large local media file access + * Revert "image-source: Set default size of color source to canvas size" + * obs-browser: Fix build error on macOS + * obs-browser: Fix browser panel crash + * UI: Shut down browsers when browser docks hidden + * UI: Refactor all browser dock classes in to one + * UI: Various screen reader fixes + * obs-browser: Allow users to use CEF audio instead of OBS + * UI/updater: Fix variable type to format specifier + * graphics-hook: Fix format specifier + * obs-browser: Do not use WasHidden() for visibility on 3507+ + * obs-browser: Fix browser panel crash + * libobs: Remove redundant function param and for loop + * libobs: Make sure to offset unpause audio data + * libobs: Fix pause cutting out video data prematurely + * libobs: Fail pause/unpause if still waiting for them + * libobs: Give a little extra time for pause to start/stop + * libobs: Fix Area shaders missing for RGB output + * obs-qsv11: Remove leftover stack variable + * obs-ffmpeg: Fix video warnings + * libobs: Fix video warnings + * CI: Update Windows CEF version + * libobs: Use correct pointer + * libobs: Call debug marker after null check, not before + * libobs: Don't render scene item texture if it's null + * obs-browser: Do not process Qt events for browser source + * libobs: Add graphics API to get graphics object pointer + * deps/media-playback: Remove cuda for hardware decoding + * deps/media-playback: Fix hw decode dropping last few frames + * libobs-d3d11: Print feature level as %x for readability + * libobs-d3d11: Consistent exception catch parameters + * rtmp-services: Update GameTips.TV + * deps/media-playback: Use hwaccel with non-alpha WebM files + * obs-browser: Ensure FPS always matches OBS + * obs-browser: Don't signal frame begin if feature disabled + * obs-browser: Actually fix browsers sometimes not rendering + * libobs: Fix default mixer values + * obs-qsv11: Do not enable b-frames on sandy/ivy bridge + * obs-browser: Fix browser source sometimes not rendering + * libobs: Insert sources to linked lists after creation + * libobs: Add missing static to function + * libobs: Fix null potential pointer dereference + * libobs: Fix Lanczos calculations + * libobs: Simplify bicubic weight calculations + * obs-ffmpeg: Use NV_FAILED() instead of FAILED() + * obs-ffmpeg: Force I-Frame when reconfiguring jim-nvenc + * deps/media-playback: Fix memory leak + * deps/media-playback: Fix hw accel decode crash + * libobs: add pointer check in reset_raw_output + * UI: Clarify dynamic bitrate support in tooltip + * obs-x264: Do not display log messages every update + * UI: Move "area" scale below bilinear, above bicubic + * UI: Fix bug where FTL was using AAC instead of opus + * obs-browser: Fix audio cutting out + * libobs: Add audio lines + * UI: Simplify toggle pause code + * UI: Update tooltip when paused + * UI: Fix inconsistency with spaces + * UI: Add dynamic bitrate support to the UI + * obs-outputs: Add dynamic bitrate to RTMP output + * libobs: Mark encoders that support dynamic bitrate + * obs-outputs: Allow changing bitrate test limit on the fly + * obs-x264: Do not show reconfigure details in log + * obs-ffmpeg: Allow FFmpeg NVENC to be reconfigured + * linux-capture: Texture unbound after GS_GL_DUMMYTEX changes + * Revert "win-capture: Don't leak dynamic library references" + * libobs-opengl: Fix Clang warnings + * UI: Redundant/bad casts + * libobs-opengl: Redundant cast + * UI: Add box select to preview + * libobs: Fix browser source settings resetting pre-24 + * cmake: Fix SWIG deprecation warnings + * UI: Use "-inf" for muted volume level + * UI: Clarify extra browser dock text + * libobs-d3d11: Disable NV12 usage for Intel + * UI: Fix Area sample count text + * obs-text: Fix formatting + * libobs: Reset mixers for "monitoring only" sources + * libobs, obs-scripting, vlc-video: Fix compiler warnings + * UI: Fix compiler/Acri warnings + * win-wasapi: Fix typo with description + * libobs: UI: Add Area scaling for downscale output + * libobs: Remove unnecessary divides from Lanczos + * libobs: Fix dark lines using Lanczos + * UI: Change Connect Account to Recommended + * libobs: Merge obs_source_process_filter_(tech_)?end functions + * libobs: Fix apply_settings & remove_by_name for groups + * UI: Fix look of extra panels trash icon + * obs-browser: Update to 2.6.1 + * libobs-opengl: Fix gl_error_to_str + * libobs-opengl: Fix DUMMY textures left bound + * Revert "libobs-opengl: Add GS_RGBX format" + * linux-capture: Revert GS_RGBX usage + * deps/media-playback: Convert YUV alpha formats to RGB on GPU + * obs-ffmpeg: Add YUV alpha formats for completeness + * libobs: Add YUV alpha formats + * deps/media-playback: Add missing header to CMake + * UI: Rename Mixer to Audio Mixer + * libobs: Separate textures for YUV input + * obs-scripting: Use a recursive mutex for Lua scripting + * UI: Add the ability to create custom browser docks + * UI: Add LineEditChanged and LineEditCanceled + * obs-browser: Fix a few panel issues + * libobs: Fix stale format in async frame cache + * UI: Fix pause button checked color with Rachni theme + * obs-scripting: Add pause scene script + * UI: Remove Twitch from MultichannelWarning message + * libobs: Add missing pixel format to format_is_yuv and get_video_format_name + * win-dshow: Use unbuffered by default for MJPEG + * win-dshow: Clarify function name/purpose + * libobs, obs-ffmpeg, win-dshow: Fix FFmpeg 4.0 deprecation + * win-dshow, obs-ffmpeg: Add hardware decoding support + * libobs: Add GPU timestamp query support + * UI: Partially revert PR #1979 + * UI: Fix Lanczos label with correct sample count + * libobs: Separate textures for YUV output, fix chroma + * CI: Only download Qt if it doesn't exist already + * libobs: Optimize lanczos shader, remove scaling + * obs-browser: Update to 2.5.0 (audio capture support) + * libobs: Add "monitoring by default" source cap + * libobs: Optimize bicubic shader + * libobs: Default sampler sometimes unset for GL + * libobs: Fix benign typo + * win-dshow: Use FFmpeg for MJPEG decompression + * libobs: obs-ffmpeg: win-dshow: Planar 4:2:2 video + * UI: Pass QColor as reference + * win-capture: Don't leak dynamic library references + * libobs: Don't leak dynamic library references + * libobs: Return NULL if there is no get_properties callback + * win-wasapi: Catch by reference + * UI: Catch by reference + * libobs-d3d11: Catch be reference + * libobs: Supress clang-tidy warning clang-tidy-cert-flp30-c + * UI: Stop recording when disk space is low + * libobs-opengl: Remove unused VERTEXID code + * libobs-opengl: Support gl_FragCoord and cull unused interpolants + * libobs-opengl: Fix GS_R8G8 values + * UI: Add links for Facebook stream key + * obs-transitions: Fix suffix with stinger transition + * UI: Add ability to disable hotkeys when not in focus + * UI: Fix param logic of ResetHotkeyState calls + * libobs: Rework RGB to YUV conversion + * libobs: Remove YUV transformation on CPU + * UI: Fix hotkeys working even when disabled in focus + * UI: Add option to warn on stop recording + * UI: Improve look of adv audio control dialog + * UI: Add Restream.io link to stream key page + * UI: Add Restream.io bandwidth test stream key param + * UI: Add channels widget to Restream.io integration + * UI: Declare missing overrides + * cmake: Fix typo + * obs-text: Use array type for unique_ptr uint8_t[] + * rtmp-services: Remove redundant null checks + * libobs: Improve timing of unbuffered deinterlacing + * win-dshow: Update libdshowcapture to 0.6.1 + * UI: Display infinity symbol when volume is at 0 percent + * rtmp-services: Add Stripchat streaming service + * obs-qsv: Enable high profile for QSV H.264 + * obs-qsv: Remove check for AsyncDepth in InitParams + * libobs: UI: Remove DrawBackdrop() to save fullscreen pass + * UI: Set default maximum name length to 170 characters + * frontend-tools: Make start/stop buttons checkable + * UI, obs-plugins: Add spinbox suffixes where necessary + * libobs: obs-filters: Area upscale shader + * file-updater: Use transparent HTTP compression + * frontend-tools: Add option to pause output timer when rec is paused + * obs-qsv: Enable LA_CBR as QSV rate control + * libobs-opengl: Fix glGetError() infinite loop + * UI: Simplify resize output code + * obs-browser: Fix CEF 75.0.13 support + * libobs: Fix formatting + * UI: Add enable preview button + * rtmp-services: Add Steam + * obs-qsv: Enable Content Adaptive Quantization + * obs-qsv: Enable B-frames and B-pyramid for encoder + * CI: Run clang format on linux and osx CI and fail if changes are made + * libobs: Call both get_defaults and get_defaults2 + * UI: Fix toggled signal of property groups + * libobs: Fix formatting + * obs-qsv: Add newer platforms to CPU enum + * UI: Make Dark theme group box title bold + * linux-v4l2: Add "Default" color range setting + * win-dshow: Add "Default" color range setting + * UI: Change default recording format to MKV + * Apply clang-format to objective c code + * obs-ffmpeg: Separate logging code + * libobs: Clear module variable in case module reloaded + * linux-capture: Fix xcompcap robustness + * libobs-opengl: Fix GS_GL_DUMMY textures creation + * libobs-opengl: Add GS_RGBX format + * libobs-opengl: Add error enum to string function + * UI: Add pause support + * obs-ffmpeg: Add support for pausing + * libobs: Implement pausing of outputs + * obs-ffmpeg: Remove unnecessary function + * libobs: Correct raw output starting audio data + * libobs: Add obs_get_frame_interval_ns + * UI: Don't display MP4/MOV warning if lossless + * obs-ffmpeg: Check for replay buffer button press + * UI: Make adv. streaming audio encoder independent + * libobs: Buffer-smoothing enhancements + * win-dshow: Decouple audio from video + * rtmp-services: Update and prune services + * libobs-d3d11: Set texture using initializer list + * obs-outputs: Minor pointer fixes + * UI: Avoid ternary operator for mixed types + * libobs: Fix format selection + * libobs-d3d11: Unnecessary type conversions + * .git-blame-ignore-revs: Add file to handle mass reformatting + * clang-format: Remove redundant params + * rtmp-services: Update ingest list for Restream.io + * obs-text: fix text transform on updated file + * libobs-opengl: Empty VAO + * libobs-d3d11: Fix missing vertex buffer clear in NV12 check + * obs-ffmpeg: Move external headers to external dir + * clang-format: Apply formatting + * clang-format: Add clang-format files + * cmake: Install 'libobs.pc' under the correct 'libdir' + * libobs: Full-screen triangle format conversions + * UI: Use stream track if no tracks are selected + * Revert "UI: Use theme colors setting for Projectors too" + * libobs, UI: Implement item_locked event + * libobs-d3d11: Clean up device_projection_pop + * libobs: Area-resampling shader optimizations + * libobs: linux-v412: obs-ffmpeg: Add packed BGR3 video support + * libobs: Remove unnecessary frame pipelining + * libobs: Improve low-resolution bilinear sampling +- Upstream moved pkgconfig/libobs.pc to libdir for x86_64. + +------------------------------------------------------------------- Mon Jun 17 19:56:19 UTC 2019 - jimmy@boombatower.com - Update to version 23.2.1:
View file
obs-studio.spec
Changed
@@ -1,5 +1,5 @@ Name: obs-studio -Version: 23.2.1 +Version: 24.0.0 Release: 0 Summary: A recording/broadcasting program Group: Productivity/Multimedia/Video/Editors and Convertors @@ -109,7 +109,7 @@ %{_libexecdir}/libobs-frontend-api.so %{_libexecdir}/libobs-opengl.so %{_libexecdir}/libobsglad.so -%{_libexecdir}/pkgconfig/libobs.pc +%{_libdir}/pkgconfig/libobs.pc %{_includedir}/obs %changelog
View file
_service
Changed
@@ -1,7 +1,7 @@ <services> <service name="tar_scm" mode="disabled"> <param name="versionformat">@PARENT_TAG@</param> - <param name="revision">refs/tags/23.2.1</param> + <param name="revision">refs/tags/24.0.0</param> <param name="url">git://github.com/jp9000/obs-studio.git</param> <param name="scm">git</param> <param name="changesgenerate">enable</param>
View file
_servicedata
Changed
@@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/jp9000/obs-studio.git</param> - <param name="changesrevision">02e523c125e20291adc6118419a5c9e78115e75c</param> + <param name="changesrevision">5d95cfc3614d6d720d204be1a14ca90486e64498</param> </service> </servicedata>
View file
obs-studio-24.0.0.tar.xz/.clang-format
Added
@@ -0,0 +1,107 @@ +# please use clang-format version 8 or later + +Standard: Cpp11 +AccessModifierOffset: -8 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +#AllowAllArgumentsOnNextLine: false # requires clang-format 9 +#AllowAllConstructorInitializersOnNextLine: false # requires clang-format 9 +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: false +#AllowShortLambdasOnASingleLine: Inline # requires clang-format 9 +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Custom +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakStringLiterals: false # apparently unpredictable +ColumnLimit: 80 +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 8 +ContinuationIndentWidth: 8 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +FixNamespaceComments: false +ForEachMacros: + - 'json_object_foreach' + - 'json_object_foreach_safe' + - 'json_array_foreach' +IncludeBlocks: Preserve +IndentCaseLabels: false +IndentPPDirectives: None +IndentWidth: 8 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +#ObjCBinPackProtocolList: Auto # requires clang-format 7 +ObjCBlockIndentWidth: 8 +ObjCSpaceAfterProperty: true +ObjCSpaceBeforeProtocolList: true + +PenaltyBreakAssignment: 10 +PenaltyBreakBeforeFirstCallParameter: 30 +PenaltyBreakComment: 10 +PenaltyBreakFirstLessLess: 0 +PenaltyBreakString: 10 +PenaltyExcessCharacter: 100 +PenaltyReturnTypeOnItsOwnLine: 60 + +PointerAlignment: Right +ReflowComments: false +SortIncludes: false +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +#SpaceAfterLogicalNot: false # requires clang-format 9 +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +#SpaceBeforeCtorInitializerColon: true # requires clang-format 7 +#SpaceBeforeInheritanceColon: true # requires clang-format 7 +SpaceBeforeParens: ControlStatements +#SpaceBeforeRangeBasedForLoopColon: true # requires clang-format 7 +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +#StatementMacros: # requires clang-format 8 +# - 'Q_OBJECT' +TabWidth: 8 +#TypenameMacros: # requires clang-format 9 +# - 'DARRAY' +UseTab: ForContinuationAndIndentation +--- +Language: ObjC
View file
obs-studio-24.0.0.tar.xz/.git-blame-ignore-revs
Added
@@ -0,0 +1,1 @@ +f53df7da64d2dfc542c24656720b2f47c8957164
View file
obs-studio-23.2.1.tar.xz/.travis.yml -> obs-studio-24.0.0.tar.xz/.travis.yml
Changed
@@ -23,7 +23,7 @@ osx_image: xcode9.4 env: - CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake - - CEF_BUILD_VERSION=3.3282.1726.gc8368c8 + - CEF_BUILD_VERSION=3770 before_install: "./CI/install-dependencies-osx.sh" before_script: "./CI/before-script-osx.sh" before_deploy: "./CI/before-deploy-osx.sh"
View file
obs-studio-23.2.1.tar.xz/AUTHORS -> obs-studio-24.0.0.tar.xz/AUTHORS
Changed
@@ -271,6 +271,7 @@ Translators: Afrikaans: - Samuel Nthoroane (Samuel_Nthoroane) + - speedytechdev Albanian: - Albin Pllana (albinnpllanaa) - Aredio Vani (aredio.vani) @@ -283,15 +284,16 @@ - BWU Wheelman (Wheelman) - Saleh Luxmaroc (salehoukiki) - معتصم دعنا (rozana-media) - - Hani Sweileh (hno.sweileh) - Mustafa2018 - - Tensai - - Vainock (ivo.lemmert) + - Hani Sweileh (hno.sweileh) + - Vainock - Mnsor The-Ghost (mnsor1722011) + - Tensai - FC Barcelona HD (kurdnews) - Ndalabo Taema (hake_bsowq) - dodgepong - chaironeko + - Hadi Gamer (hadigamer3131) Azerbaijani: - Shahin Farzaliyev (Khan27) Basque: @@ -301,38 +303,40 @@ - txaro (txaro) - EG Gamer (eggamer131) - etxondoko - - Vainock (ivo.lemmert) + - Vainock - dodgepong Bengali: - shamuntohamd + - Vainock - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) - Nurul Huda (nurulhuda859) - Md Arafat (zonoiko) Bulgarian: - j3dy - - kalmarin + - Dremski - Zakxaev68 + - kalmarin - Seyhan Halil (yildirim17) - - Dremski - Martin Georgiev (DivideByNone) - Viktor Kitov (viktorkitov) - Stanislav_Evtimov - Stoyan Stoyanov (sstoyanov) + - Vainock - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) - Ivan (SKDown) - Warchamp7 + - dodgepong Catalan: - Jaime Muñoz Martín (jmmartin_5) - jmontane - - Nil Campamà (Soifam) - Benet R. i Camps (BennyBeat) (BennyBeat) + - Nil Campamà (Soifam) - Aleix Vidal i Gaya (leixet) - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) - - Pere O. (gotrunks) + - Vainock - Aniol Pagès (aniolpages) + - Pere O. (gotrunks) + - dodgepong Chinese Simplified: - Bob Liu (Akagi201) - AlexGuo1998 (AlexGuo1998) @@ -341,6 +345,7 @@ - Gol D. Ace (goldace) - Licardo (Licardo) - AthlonHD (AthlonHD) + - Forbidden (cptbl00dra1n) - Hexcolyte (Hexcolyte) - Sasasu (Sasasu) - cai_miao @@ -348,56 +353,58 @@ - David Kuo (s50407s) - 鲜童 (xiananjyzy) - Opportunity (OpportunityLiu) - - Forbidden (cptbl00dra1n) - yunluzhang - - Inku Xuan (inkuxuan) - copyliu + - Inku Xuan (inkuxuan) - Bing Feng (fengbing123) - - pan93412 - - WeiYuanStudio + - Yi-Jyun Pan (pan93412) + - fangzheng (fangzheng) + - Vainock - 科技小白堂 (lipeng0820) + - WeiYuanStudio - Richard Stanway (r1ch) - WaterOtaku - dodgepong - MarsYoung - sorayuki - cylin - - Vainock (ivo.lemmert) + - Bob Wei (BobWaver) - 赵杭灵 (h1679083640) + - FaZe Fakay (fazefakay) - wordlessWind (wordlesswind) - OYYZ - - FaZe Fakay (fazefakay) - - Bob Wei (BobWaver) + - Martinzzz Chinese Traditional: - TzeKei Lee (chikei) + - Yi-Jyun Pan (pan93412) - dodgepong - Julian_Lai - - Chien-Yu Lin (u900011) - - pan93412 + - Florid (u900011) - David Kuo (s50407s) - Michael Yeh (hinet60613) - You-Ruei Tzeng (e222et) - myjourney in Steemit (myjourney) - craftwar + - louis921222 - Gol D. Ace (goldace) - - Inndy.Lin (inndy) - Han-Jen Cheng (notexist) + - Inndy.Lin (inndy) - Watson Tsai (ashaneba) - Meng Hao Li (GazCore) + - Vainock - abc0922001 - Thomas (thomassth) - - louis921222 - ak-47root - - Jimmy Huang (f56112000) + - fangzheng (fangzheng) - cai_miao - Append Huang (append) + - Jimmy Huang (f56112000) - 曹恩逢 (nelson22768384) - - Vainock (ivo.lemmert) - xixiaofan (Hs0) - - tomoe-musashi + - JackYeah - FaZe Fakay (fazefakay) - chaironeko - - JackYeah + - tomoe-musashi Croatian: - medicmomcilo - srdjan_m @@ -406,7 +413,7 @@ - Gol D. Ace (goldace) - Wildrage - Maky (the.real.maky) - - Vainock (ivo.lemmert) + - Vainock - dodgepong Czech: - Jirka 'Venty' Michel (VentyCZ) @@ -414,8 +421,8 @@ - Sawanyo - Kiznoh - Gol D. Ace (goldace) + - Vainock - Erik Bročko (ericek111) - - Vainock (ivo.lemmert) - dodgepong Danish: - NCAA (NCAA) @@ -424,14 +431,15 @@ - MaltahlGaming (maltahlgaming) - Gol D. Ace (goldace) - Anders Urban (minikaliffen) + - Vainock - Richard Stanway (r1ch) - Johan Keller Jensen (JKeller) - Christian Henriksen (cnhenriksen) - - Vainock (ivo.lemmert) - Marque Ziqulr (lugtelort) - HeroGamers (Fido2603) - - Nicolai (Nicolai9852) + - Nicolai Skødt Holmgaard (Nicolai9852) - Daniel Aundal (aundal) + - dodgepong Dutch: - Eric Bataille (ThoNohT) - Michel Snippe (michelsnippe) @@ -443,19 +451,21 @@ - Danny (Dkamps18) - Gol D. Ace (goldace) - Albakham (albakham) - - Jasper J (JassieJ) + - Kjetil Verstrepen (kjetilv) - Bond-009 + - Jasper J (JassieJ) - b__dm - F_Producktions + - Jennifer Falco (JenTheBluePanda) - Harm van den Hoek (harm27) + - Vainock - markpc - JorRy - - Julian Meijboom (julianmeijboom) - Bo Alsemgeest (bo.alsemgeest.wausie) + - Julian Meijboom (julianmeijboom) - andymidside - JustMaffie (JustMaffie) - RyyzQ - - Vainock (ivo.lemmert) Estonian: - MartinEwing - AndresTraks @@ -466,8 +476,9 @@ - nyakayed (nyakayed) - Loyd Stephen Jayme (loydjayme25) - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) + - Vainock - Raylir + - vinzruzell Finnish: - Arkkis (j) - Jarska @@ -475,14 +486,15 @@ - Pyscowicz (Pyscowicz) - Gol D. Ace (goldace) - Obama (Obama44) + - Vainock - Tero Keso (tero.keso) - - Vainock (ivo.lemmert) - - chaironeko + - Arttu Ylhävuori (arttu.ylhavuori) - Ville Närhi (daimaah) + - chaironeko French: - radzaquiel - - pkviet - Stéphane Lepin (Palakis) + - pkviet - Yberion - Tocram2 (tocram2) - DoK_- @@ -502,38 +514,42 @@ - Theguiguix - Gabriel Dugny (Gabigabigo) - McGuygnol + - Vainock - Yolopix - - GANGAT Naeem (zboggum) + - Aime23 - kyllian (tardigradeus) + - GANGAT Naeem (zboggum) - BaguetteDePain_ - Richard Stanway (r1ch) - - Mathieu Hautebas (matteyeux) + - SkytAsul (skytasul) - Zalki + - Mathieu Hautebas (matteyeux) - dodgepong - - 🌠 DarK | #Hello 🌠 (DarKTV_FR) - - Vainock (ivo.lemmert) - - illusdidi - Adrien “GameZone Tv” de Decker (redcraft007) - - Warchamp7 - - Albakham (albakham) + - illusdidi + - 🌠 DarK | #Hello 🌠 (DarKTV_FR) - SkylixX - chaironeko - - Camille Nury (kamsdu30) - Alexis Brandner (Alexinfos) + - Warchamp7 + - Albakham (albakham) + - Camille Nury (kamsdu30) - tburette Galician: + - mbouzada - Xesús M. Mosquera Carregal (xesusmosquera) + - Iváns (Ivans_translator) - Gol D. Ace (goldace) + - Vainock - chaironeko - - Vainock (ivo.lemmert) Georgian: - georgianizator - EduCare Razmik Badalyan (badalyanrazmik) + - Vainock - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) German: - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) + - Vainock - Michael Fabian Dirks (Xaymar) - dodgepong - Dennis Giebert (Isegrim) (isegrimderwolf) @@ -541,22 +557,24 @@ - Gregor Bigalke (gregtcltk) - Sven Kirschbaum (fallobst22) (fallobst22) - Manuel (ElectronicWar) - - eZ_KrieG3R | Der Fabse (fabian.schwarz.26.06.1998) - Palana - Tim (robske_110) (robske110) - Jonas Otto (jottosmail) - mdod - Jonathan (macburgerjunior) - - Prince_of_Raop - Enderdrache LP (enderdrachelp) + - Prince_of_Raop - Robin Hielscher (Jack0r) - - lebaston100.de - Richard Stanway (r1ch) - Patrick Frings (Ragnos) + - lebaston100.de - WurstOnAir - BoJustus - AndreLeonardo (andreleonardoyt) - Tiim + - Hadi Gamer (hadigamer3131) + - Lord Aidan (BadSideofBright) + - Glocker | Felix L. (Haard22) Greek: - Scourgemcdak - Mepharees @@ -565,37 +583,38 @@ - George T. (tzikas97) - Alex Kalles (alexakis1997) - iosifidis + - Warmaster + - Vainock - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) - dodgepong - Themis T. (Deminho) - chaironeko Hebrew: - amirsher - lonelywolf11 + - djsavta - Chemi (Chemi) - epic_ziver_D (epic_ziver_D) - - Uri Ben Yossef (uribenyossef) - Gol D. Ace (goldace) - Light1c3 - ghsi - yair (5shekel) + - Vainock - TheOver (upmeboost) - - djsavta - אפיק רוזנר (afikr333) - - Vainock (ivo.lemmert) - Tal Machani (talmachani) Hindi: + - Saswata Banerjee (azure.saswata) - SneakyFish5 - shamuntohamd Hungarian: - Gige - Gol D. Ace (goldace) + - Vainock - Adam Liszkai (adamos42) - abydosan (abydoshun) - dodgepong - vargag159 - - Vainock (ivo.lemmert) Italian: - Manfre#9262 (manfre) - LordShadow95 @@ -611,58 +630,60 @@ - Edoardo “OfficialDJMela” Macrì (agersforum) - Martazza (Martazza) - Gol D. Ace (goldace) + - Alessandro Sarto (alesarto03) - gianni morandi (strabbioboy) - Fisherozzo - - Alessandro Sarto (alesarto03) - - Sergio Beneduce (sbeneduce) + - Vainock - Albakham (albakham) + - Sergio Beneduce (sbeneduce) - Andrea-M3 - SkyLion - - Vainock (ivo.lemmert) - - Federico Tensi (habby1337) - Silpheel + - Federico Tensi (habby1337) - Alessandro Iepure (alessandro_iepure) - riccardotornesello Japanese: - shousa - Kenta Takumi (kenta0644) - dodgepong - - SplatRT + - Bhanu Victor DiCara (SplatRT) + - 森の子リスのミーコの大冒険 (Phroneris) + - CKK COBALT (CKKCOBALT) - Gol D. Ace (goldace) - 神成フィルム (kami00nari) - - ato lash (hal_shu_sato) + - Vainock - Noi (Noi_noel2647) - - CKK COBALT (CKKCOBALT) + - ato lash (hal_shu_sato) - Yuki Yu (Yukiyu) - chaironeko - - Bob Liu (Akagi201) - Alex Shafer (enzanki-ars) - - Vainock (ivo.lemmert) + - Bob Liu (Akagi201) Khmer: - បងមាន តែអូន (cheaiphone267) Korean: - ynetwork (ynetwork) - Gol D. Ace (goldace) + - Vainock - RedditRook - Jong Kwon Choi (dailypro) + - Russell (crimeroyal) - antome Kurdish: - Omer Kurdish (OmerKurd) Lithuanian: - Justas Vilimas (tyntas) - xNaii (lyrikas5) - - Vainock (ivo.lemmert) - Gol D. Ace (goldace) + - Vainock Malay: - amsyar ZeRo (amsyarminer555) - WeingHong - Gol D. Ace (goldace) - dodgepong - - Vainock (ivo.lemmert) + - Vainock Mongolian: - begjan - - Vainock (ivo.lemmert) -Nigerian Pidgin: + - Vainock Norwegian Bokmal: - Taesh (magnusmbratteng) - Imre Kristoffer Eilertsen (DandelionSprout) @@ -679,15 +700,18 @@ - Sander Skjegstad (r530er) - Gol D. Ace (goldace) - Legend27 - - Vainock (ivo.lemmert) + - Vainock - chaironeko - Mats Andreassen (MatsA) Norwegian Nynorsk: - Imre Kristoffer Eilertsen (DandelionSprout) + - morden Persian: - MZ MAXIMUM (mahdigamermax) - Alireza Firouzi (pikhoshorg) - peymanr34 + - Berrely + - Gol D. Ace (goldace) Pirate English: - Matt Gajownik (WizardCM) - Uaiquqjwnsns @@ -696,10 +720,11 @@ - Emu-Phoenix - Coen (Trigstur) - Charlie W. (wallichc) - - Vainock (ivo.lemmert) + - Vainock - chaironeko - Gol D. Ace (goldace) - ncb + - Berrely Polish: - grocal (grocal) - Michał Durak (micechal) @@ -712,23 +737,26 @@ - Daniel Wieczorek (Kennyluz) - Albakham (albakham) - popek069 + - Vainock - sebek1pan - Mateusz (Silesianek) - - Julia Drewniak (ewagsi) - dodgepong - - Vainock (ivo.lemmert) - - Patryk Kunda (ner.i.ol) + - Julia Drewniak (ewagsi) - Michał Lewczak (michal200507) + - Patryk Kunda (ner.i.ol) Portuguese: - André Biscaia (LazP) - Ev1lbl0w - dodgepong + - Manuela Silva (mansil) - joaofvieira - Tomás Antunes (tomasantunes) - joaoboia - Albakham (albakham) - alexandre433 - Gol D. Ace (goldace) + - Gabriell (gabriellpt04) + - Vainock Portuguese, Brazilian: - Shaolin (admshao) - Ramon Mendes (rbrgameplays) @@ -736,16 +764,15 @@ - TFSThiagoBR98 - CaioWzy - clr0dr1g - - aalonsomb + - Emanoel Lopes (emanoelopes) - André Gama (ToeOficial) + - aalonsomb - Gol D. Ace (goldace) - - Emanoel Lopes (emanoelopes) - mizifih + - Vainock - DevilLorde - - flor.com (florretardada) - - Vainock (ivo.lemmert) - - dodgepong - Esdras Tarsis (esdrastarsis) + - dodgepong - Ramon Gonzalez (ramon200000) Punjabi: - manjotsingh0202 @@ -759,9 +786,9 @@ - Skellytone - Mihai G (babasghenciu) - Gol D. Ace (goldace) + - Vainock - dodgepong - chaironeko - - Vainock (ivo.lemmert) Russian: - Alek Nirov (dectanova) - Pavel (Shevalie) @@ -769,56 +796,62 @@ - VNGXR - Gol D. Ace (goldace) - Bugo (Bugo) + - Andrei Stepanov (adem4ik) + - Yaroslav (MrYadro) - Andy (anry025) + - Artem4ik - Strange Grey Cat (StrangeGreyCat) - - Yaroslav (MrYadro) - - Andrei Stepanov (adem4ik) - fromgate (fromgate) - - Vlad (KoTmaxHo) + - Vainock - Runoff Screen (glebpozbnakov62) - - Mixaill - - Vainock (ivo.lemmert) + - Vlad (KoTmaxHo) + - Әлмәт Ак Арыслан (19082004amir) - Sergei Fug1t1v3 (fug) + - Mixaill - Walt Gee (vovanych) + - Sirboys - Serge Sklyarov (sergesklyarov) + - Kuji Kitamura (KujiKita) + - TR1D - Yuri Mihaqlov (yurijmi) + - Vladimir (jeffors) - MUHADDIS MEDIA (muhaddismedia) - - TR1D - - Sigge Stjärnholm (Kladdy) - SandoBY - - Kuji Kitamura (KujiKita) + - Sigge Stjärnholm (Kladdy) Scottish Gaelic: - GunChleoc - - Vainock (ivo.lemmert) + - Vainock Serbian (Cyrillic): - medicmomcilo - Acamicamacaraca - Gol D. Ace (goldace) - - dodgepong + - Vainock - LittleGirl_WithPonyTail (alexs1320) - - Vainock (ivo.lemmert) + - dodgepong Serbian (Latin): - medicmomcilo - LittleGirl_WithPonyTail (alexs1320) - Gol D. Ace (goldace) - Rale Sarcevic (ralesarcevic) + - Vainock - dodgepong - - Vainock (ivo.lemmert) Slovak: - Luki (luki1412) - - Ján M (longmoped) - Erik Bročko (ericek111) + - Ján M (longmoped) - Anton Lokaj (anlo) - LoLLy Nka (lollynka279) - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) + - Vainock + - dodgepong Slovenian: + - Peter Klofutar (peter.klofutar) - kristjan.krusic (krusic22) - MG lolenstine (mglolenstine) - - Grimpy + - BirdCute + - Vainock - Gol D. Ace (goldace) - ArcaneWater - - Vainock (ivo.lemmert) - dodgepong Southern Sotho: - Samuel Nthoroane (Samuel_Nthoroane) @@ -827,30 +860,31 @@ - Jaime Martinez Rincon (mrjaime1999) - Marcos Vidal Martinez (M4RK22) - Jaime Muñoz Martín (jmmartin_5) + - Monsteer - EG Gamer (eggamer131) - Dalia Sofía Magallón Páramo (SweetSofiMC) - Gol D. Ace (goldace) - - Monsteer - Pilar G. (TheMadnessLady) - Maximiliano Schtroumpftech Pena-Roig (som2tokmynam) - Carlos Plata (carlosesgenial33) - Ruben Deig Ramos (rdeigramos) - Marcos Vidal (markitos.maki22) - - eskaidom (sergiomalagonmartin) - Alex E. D. B. (alexedb) + - Skiddome (sergiomalagonmartin) - Santiago Pereyra (SannttVIII) - - Eleazar Córcoles (MtrElee3) - eemiroj + - Eleazar (MtrElee3) - Ray (Ipsumry) + - Vainock - makiza1 (micosil_2) - Sigge Stjärnholm (Kladdy) - - henrycontreras - - Vainock (ivo.lemmert) - chaironeko - - dodgepong + - Jaire (corpi.98) + - henrycontreras - amssusgameplays (willifake052) - - Rodrigo Ipince (ipince) + - dodgepong - David Sonico (davidsubsonico) + - Rodrigo Ipince (ipince) Swedish: - Anton R (FirePhoenix) - Sigge Stjärnholm (Kladdy) @@ -859,12 +893,15 @@ - Gustav Ekner (ekner) - Gol D. Ace (goldace) - Jonatan Nyberg (sweuser) + - ArvidTheSwe + - 0x9fff00 + - Vainock - Henrik Mattsson-Mårn (rchk) - chaironeko - - Vainock (ivo.lemmert) - Jonas Svensson (jonassanojj99) - TacticalKebab - Hannes Blåman (thebluis) + - dodgepong Tagalog: - dandalion - philiparniebinag @@ -872,19 +909,20 @@ - jbeguna04 - Red Dayao (steemitph) - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) + - Vainock - Raylir Tamil: - anto27 - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) + - Vainock Thai: + - Nawin Somprasong (thaipirch98) - sakuhanachan* (sakuhanachanloli) - ธีรภัทร์ โยชนา (Gataro) - Sakia Normal Human (arcanaarcana5) - 盛凤阁 (execzero) - nongnoobjung (kitcharuk_4) - - Vainock (ivo.lemmert) + - Vainock - dodgepong - Gol D. Ace (goldace) Turkish: @@ -892,48 +930,50 @@ - omer.karagoz (mrkaragoz) - Cemal Dursun (cmldrs) - Savas Tokmak (Laserist) + - LeDoomerDoge (DoomerDoge) - Murat Karagöz (anemon_1994) - - BruhSoundeffect2 (DoomerDoge) - gecebekcisi1 - Gol D. Ace (goldace) - Umut kılıç (kilic190787) - berkcan uçan (ibnehayati) + - Vainock - Khedi + - Mustafa Arslan (mstfaa) - mustafaa - - Richard Stanway (r1ch) - Hydroboost (Hydroboost) - - Vainock (ivo.lemmert) + - Richard Stanway (r1ch) - Türker Yıldırım (turkeryildirim) + - Alican Gultekin (Vitaefinis) - chaironeko - basakbk - - Alican Gultekin (Vitaefinis) Ukrainian: - SuslikV - Юрій (Devinit) - Andy (anry025) - - Sergey (LegionAnon) + - Vainock - L1Q + - NoPressure - Gol D. Ace (goldace) - - Vainock (ivo.lemmert) - Maksym Tymoshyk (maximillian_) - - NoPressure - - powerdef - geimfis + - powerdef - បងមាន តែអូន (cheaiphone267) + - dodgepong Urdu (Pakistan): - Rana Awais (ehtisham) - tahirsada - shamuntohamd + - Gol D. Ace (goldace) Vietnamese: - Johnny “max20091” Utah (boostyourprogram) - Hưng Nguyễn (hoyostudio) - ngoisaosang (ngoisaosang) - Drake Strike (phjtieudoc) + - IoeCmcomc (hopdaigia2004) - Gol D. Ace (goldace) - - IoeCmcomc (Ioe2015) (hopdaigia2004) - BIGO - 지혜 (parkjihye96) - Hà Phi Hùng (haphihungcom) - - Vainock (ivo.lemmert) + - Vainock - Vũ Hải Tây (tayngungo1999) - - NCAA (NCAA) - dodgepong + - NCAA (NCAA)
View file
obs-studio-23.2.1.tar.xz/CI/before-deploy-osx.sh -> obs-studio-24.0.0.tar.xz/CI/before-deploy-osx.sh
Changed
@@ -41,9 +41,17 @@ ../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \ OBS.app/Contents/Resources/obs-plugins/obs-browser.so sudo install_name_tool -change \ + @executable_path/../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \ + ../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \ + OBS.app/Contents/Resources/obs-plugins/obs-browser.so +sudo install_name_tool -change \ @rpath/Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \ ../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \ OBS.app/Contents/Resources/obs-plugins/obs-browser-page +sudo install_name_tool -change \ + @executable_path/../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \ + ../../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework \ + OBS.app/Contents/Resources/obs-plugins/obs-browser-page # Package app hr "Generating .pkg"
View file
obs-studio-23.2.1.tar.xz/CI/before-script-linux.sh -> obs-studio-24.0.0.tar.xz/CI/before-script-linux.sh
Changed
@@ -1,6 +1,11 @@ -#!/bin/sh -set -ex +#!/bin/bash + +./formatcode.sh +if ! ./CI/check-format.sh; then + exit 1 +fi +set -ex ccache -s || echo "CCache is not available." mkdir build && cd build cmake ..
View file
obs-studio-23.2.1.tar.xz/CI/before-script-osx.sh -> obs-studio-24.0.0.tar.xz/CI/before-script-osx.sh
Changed
@@ -3,6 +3,11 @@ git fetch --tags +./formatcode.sh +if ! ./CI/check-format.sh; then + exit 1 +fi + mkdir build cd build cmake -DENABLE_SPARKLE_UPDATER=ON \
View file
obs-studio-24.0.0.tar.xz/CI/check-format.sh
Added
@@ -0,0 +1,11 @@ +#!/bin/bash +dirty=$(git ls-files --modified) + +set +x +if [[ $dirty ]]; then + echo "=================================" + echo "Files were not formatted properly" + echo "$dirty" + echo "=================================" + exit 1 +fi \ No newline at end of file
View file
obs-studio-23.2.1.tar.xz/CI/install-dependencies-linux.sh -> obs-studio-24.0.0.tar.xz/CI/install-dependencies-linux.sh
Changed
@@ -3,6 +3,16 @@ sudo add-apt-repository ppa:jonathonf/ffmpeg-3 -y curl -L https://packagecloud.io/github/git-lfs/gpgkey | sudo apt-key add - + +# gets us newer clang +sudo bash -c "cat >> /etc/apt/sources.list" << LLVMAPT +# 3.8 +deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main +deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main +LLVMAPT + +wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + sudo apt-get -qq update sudo apt-get install -y \ build-essential \ @@ -42,4 +52,5 @@ python3-dev \ qtbase5-dev \ libqt5svg5-dev \ - swig + swig \ + clang-format-8
View file
obs-studio-23.2.1.tar.xz/CI/install-dependencies-osx.sh -> obs-studio-24.0.0.tar.xz/CI/install-dependencies-osx.sh
Changed
@@ -12,6 +12,8 @@ if [[ $TRAVIS ]]; then git fetch --unshallow +else + /bin/bash -c "sudo xcode-select -s /Applications/Xcode_9.4.1.app/Contents/Developer" fi # Leave obs-studio folder @@ -26,7 +28,7 @@ brew update #Base OBS Deps and ccache -brew install jack speexdsp ccache mbedtls +brew install jack speexdsp ccache mbedtls clang-format brew install https://gist.githubusercontent.com/DDRBoxman/b3956fab6073335a4bf151db0dcbd4ad/raw/ed1342a8a86793ea8c10d8b4d712a654da121ace/qt.rb brew install https://gist.githubusercontent.com/DDRBoxman/4cada55c51803a2f963fa40ce55c9d3e/raw/572c67e908bfbc1bcb8c476ea77ea3935133f5b5/swig.rb
View file
obs-studio-23.2.1.tar.xz/CI/install-qt-win.cmd -> obs-studio-24.0.0.tar.xz/CI/install-qt-win.cmd
Changed
@@ -1,4 +1,4 @@ -curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_5.10.1.7z -f --retry 5 -C - +if exist Qt_5.10.1.7z (curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_5.10.1.7z -f --retry 5 -z Qt_5.10.1.7z) else (curl -kLO https://cdn-fastly.obsproject.com/downloads/Qt_5.10.1.7z -f --retry 5 -C -) 7z x Qt_5.10.1.7z -oQt mv Qt C:\QtDep dir C:\QtDep \ No newline at end of file
View file
obs-studio-23.2.1.tar.xz/CI/install-script-win.cmd -> obs-studio-24.0.0.tar.xz/CI/install-script-win.cmd
Changed
@@ -1,18 +1,18 @@ if exist dependencies2017.zip (curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies2017.zip -f --retry 5 -z dependencies2017.zip) else (curl -kLO https://cdn-fastly.obsproject.com/downloads/dependencies2017.zip -f --retry 5 -C -) if exist vlc.zip (curl -kLO https://cdn-fastly.obsproject.com/downloads/vlc.zip -f --retry 5 -z vlc.zip) else (curl -kLO https://cdn-fastly.obsproject.com/downloads/vlc.zip -f --retry 5 -C -) -if exist cef_binary_%CEF_VERSION%_windows32.zip (curl -kLO https://cdn-fastly.obsproject.com/downloads/cef_binary_%CEF_VERSION%_windows32.zip -f --retry 5 -z cef_binary_%CEF_VERSION%_windows32.zip) else (curl -kLO https://cdn-fastly.obsproject.com/downloads/cef_binary_%CEF_VERSION%_windows32.zip -f --retry 5 -C -) -if exist cef_binary_%CEF_VERSION%_windows64.zip (curl -kLO https://cdn-fastly.obsproject.com/downloads/cef_binary_%CEF_VERSION%_windows64.zip -f --retry 5 -z cef_binary_%CEF_VERSION%_windows64.zip) else (curl -kLO https://cdn-fastly.obsproject.com/downloads/cef_binary_%CEF_VERSION%_windows64.zip -f --retry 5 -C -) +if exist cef_binary_%CEF_VERSION%_windows32_minimal.zip (curl -kLO https://cdn-fastly.obsproject.com/downloads/cef_binary_%CEF_VERSION%_windows32_minimal.zip -f --retry 5 -z cef_binary_%CEF_VERSION%_windows32_minimal.zip) else (curl -kLO https://cdn-fastly.obsproject.com/downloads/cef_binary_%CEF_VERSION%_windows32_minimal.zip -f --retry 5 -C -) +if exist cef_binary_%CEF_VERSION%_windows64_minimal.zip (curl -kLO https://cdn-fastly.obsproject.com/downloads/cef_binary_%CEF_VERSION%_windows64_minimal.zip -f --retry 5 -z cef_binary_%CEF_VERSION%_windows64_minimal.zip) else (curl -kLO https://cdn-fastly.obsproject.com/downloads/cef_binary_%CEF_VERSION%_windows64_minimal.zip -f --retry 5 -C -) 7z x dependencies2017.zip -odependencies2017 7z x vlc.zip -ovlc -7z x cef_binary_%CEF_VERSION%_windows32.zip -oCEF_32 -7z x cef_binary_%CEF_VERSION%_windows64.zip -oCEF_64 +7z x cef_binary_%CEF_VERSION%_windows32_minimal.zip -oCEF_32 +7z x cef_binary_%CEF_VERSION%_windows64_minimal.zip -oCEF_64 set DepsPath32=%CD%\dependencies2017\win32 set DepsPath64=%CD%\dependencies2017\win64 set VLCPath=%CD%\vlc set QTDIR32=C:\QtDep\5.10.1\msvc2017 set QTDIR64=C:\QtDep\5.10.1\msvc2017_64 -set CEF_32=%CD%\CEF_32\cef_binary_%CEF_VERSION%_windows32 -set CEF_64=%CD%\CEF_64\cef_binary_%CEF_VERSION%_windows64 +set CEF_32=%CD%\CEF_32\cef_binary_%CEF_VERSION%_windows32_minimal +set CEF_64=%CD%\CEF_64\cef_binary_%CEF_VERSION%_windows64_minimal set build_config=RelWithDebInfo mkdir build build32 build64 if "%TWITCH-CLIENTID%"=="$(twitch_clientid)" (
View file
obs-studio-23.2.1.tar.xz/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/CMakeLists.txt
Changed
@@ -26,7 +26,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") set(ENABLE_SCRIPTING TRUE CACHE BOOL "Enables scripting") -set(SCRIPTING_ENABLED OFF CACHE BOOL "Interal global cmake variable" FORCE) +set(SCRIPTING_ENABLED OFF CACHE BOOL "Internal global cmake variable" FORCE) include(ObsHelpers) include(ObsCpack)
View file
obs-studio-23.2.1.tar.xz/UI/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/UI/CMakeLists.txt
Changed
@@ -146,10 +146,14 @@ list(APPEND obs_PLATFORM_SOURCES obf.c auth-oauth.cpp + window-dock-browser.cpp + window-extra-browsers.cpp ) list(APPEND obs_PLATFORM_HEADERS obf.h auth-oauth.hpp + window-dock-browser.hpp + window-extra-browsers.hpp ) if(TWITCH_ENABLED) @@ -192,6 +196,9 @@ ../deps/libff/libff/ff-util.c PROPERTIES COMPILE_FLAGS -Dinline=__inline ) + set(obs_PLATFORM_LIBRARIES + ${obs_PLATFORM_LIBRARIES} + w32-pthreads) endif() set(obs_SOURCES @@ -235,6 +242,7 @@ slider-ignorewheel.cpp combobox-ignorewheel.cpp spinbox-ignorewheel.cpp + record-button.cpp volume-control.cpp adv-audio-control.cpp item-widget-helpers.cpp @@ -289,6 +297,7 @@ focus-list.hpp menu-button.hpp mute-checkbox.hpp + record-button.hpp volume-control.hpp adv-audio-control.hpp item-widget-helpers.hpp @@ -322,6 +331,7 @@ forms/OBSBasicSettings.ui forms/OBSBasicSourceSelect.ui forms/OBSBasicInteraction.ui + forms/OBSExtraBrowsers.ui forms/OBSUpdate.ui forms/OBSRemux.ui forms/OBSAbout.ui)
View file
obs-studio-23.2.1.tar.xz/UI/adv-audio-control.cpp -> obs-studio-24.0.0.tar.xz/UI/adv-audio-control.cpp
Changed
@@ -26,34 +26,34 @@ uint32_t flags = obs_source_get_flags(source); uint32_t mixers = obs_source_get_audio_mixers(source); - forceMonoContainer = new QWidget(); - mixerContainer = new QWidget(); - balanceContainer = new QWidget(); - labelL = new QLabel(); - labelR = new QLabel(); - nameLabel = new QLabel(); - volume = new QDoubleSpinBox(); - forceMono = new QCheckBox(); - balance = new BalanceSlider(); + forceMonoContainer = new QWidget(); + mixerContainer = new QWidget(); + balanceContainer = new QWidget(); + labelL = new QLabel(); + labelR = new QLabel(); + nameLabel = new QLabel(); + volume = new QDoubleSpinBox(); + forceMono = new QCheckBox(); + balance = new BalanceSlider(); #if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO - monitoringType = new QComboBox(); + monitoringType = new QComboBox(); #endif - syncOffset = new QSpinBox(); - mixer1 = new QCheckBox(); - mixer2 = new QCheckBox(); - mixer3 = new QCheckBox(); - mixer4 = new QCheckBox(); - mixer5 = new QCheckBox(); - mixer6 = new QCheckBox(); + syncOffset = new QSpinBox(); + mixer1 = new QCheckBox(); + mixer2 = new QCheckBox(); + mixer3 = new QCheckBox(); + mixer4 = new QCheckBox(); + mixer5 = new QCheckBox(); + mixer6 = new QCheckBox(); volChangedSignal.Connect(handler, "volume", OBSSourceVolumeChanged, - this); + this); syncOffsetSignal.Connect(handler, "audio_sync", OBSSourceSyncChanged, - this); + this); flagsSignal.Connect(handler, "update_flags", OBSSourceFlagsChanged, - this); + this); mixersSignal.Connect(handler, "audio_mixers", OBSSourceMixersChanged, - this); + this); hlayout = new QHBoxLayout(); hlayout->setContentsMargins(0, 0, 0, 0); @@ -64,15 +64,14 @@ hlayout = new QHBoxLayout(); hlayout->setContentsMargins(0, 0, 0, 0); balanceContainer->setLayout(hlayout); - balanceContainer->setMinimumWidth(100); + balanceContainer->setFixedWidth(150); labelL->setText("L"); labelR->setText("R"); - nameLabel->setMinimumWidth(170); nameLabel->setText(QT_UTF8(sourceName)); - nameLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + nameLabel->setAlignment(Qt::AlignVCenter); volume->setMinimum(MIN_DB - 0.1); volume->setMaximum(MAX_DB); @@ -80,6 +79,7 @@ volume->setDecimals(1); volume->setSuffix(" dB"); volume->setValue(obs_mul_to_db(vol)); + volume->setFixedWidth(100); if (volume->value() < MIN_DB) volume->setSpecialValueText("-inf dB"); @@ -87,8 +87,8 @@ forceMono->setChecked((flags & OBS_SOURCE_FLAG_FORCE_MONO) != 0); forceMonoContainer->layout()->addWidget(forceMono); - forceMonoContainer->layout()->setAlignment(forceMono, - Qt::AlignHCenter | Qt::AlignVCenter); + forceMonoContainer->layout()->setAlignment(forceMono, Qt::AlignVCenter); + forceMonoContainer->setFixedWidth(50); balance->setOrientation(Qt::Horizontal); balance->setMinimum(0); @@ -96,10 +96,10 @@ balance->setTickPosition(QSlider::TicksAbove); balance->setTickInterval(50); - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); - const char *speakers = config_get_string(main->Config(), "Audio", - "ChannelSetup"); + const char *speakers = + config_get_string(main->Config(), "Audio", "ChannelSetup"); if (strcmp(speakers, "Mono") == 0) balance->setEnabled(false); @@ -112,36 +112,38 @@ int64_t cur_sync = obs_source_get_sync_offset(source); syncOffset->setMinimum(-950); syncOffset->setMaximum(20000); + syncOffset->setSuffix(" ms"); syncOffset->setValue(int(cur_sync / NSEC_PER_MSEC)); + syncOffset->setFixedWidth(100); int idx; #if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO monitoringType->addItem(QTStr("Basic.AdvAudio.Monitoring.None"), - (int)OBS_MONITORING_TYPE_NONE); + (int)OBS_MONITORING_TYPE_NONE); monitoringType->addItem(QTStr("Basic.AdvAudio.Monitoring.MonitorOnly"), - (int)OBS_MONITORING_TYPE_MONITOR_ONLY); + (int)OBS_MONITORING_TYPE_MONITOR_ONLY); monitoringType->addItem(QTStr("Basic.AdvAudio.Monitoring.Both"), - (int)OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT); + (int)OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT); int mt = (int)obs_source_get_monitoring_type(source); idx = monitoringType->findData(mt); monitoringType->setCurrentIndex(idx); #endif mixer1->setText("1"); - mixer1->setChecked(mixers & (1<<0)); + mixer1->setChecked(mixers & (1 << 0)); mixer2->setText("2"); - mixer2->setChecked(mixers & (1<<1)); + mixer2->setChecked(mixers & (1 << 1)); mixer3->setText("3"); - mixer3->setChecked(mixers & (1<<2)); + mixer3->setChecked(mixers & (1 << 2)); mixer4->setText("4"); - mixer4->setChecked(mixers & (1<<3)); + mixer4->setChecked(mixers & (1 << 3)); mixer5->setText("5"); - mixer5->setChecked(mixers & (1<<4)); + mixer5->setChecked(mixers & (1 << 4)); mixer6->setText("6"); - mixer6->setChecked(mixers & (1<<5)); + mixer6->setChecked(mixers & (1 << 5)); speaker_layout sl = obs_source_get_speaker_layout(source); - + if (sl == SPEAKERS_STEREO) { balanceContainer->layout()->addWidget(labelL); balanceContainer->layout()->addWidget(balance); @@ -156,32 +158,32 @@ mixerContainer->layout()->addWidget(mixer5); mixerContainer->layout()->addWidget(mixer6); - QWidget::connect(volume, SIGNAL(valueChanged(double)), - this, SLOT(volumeChanged(double))); - QWidget::connect(forceMono, SIGNAL(clicked(bool)), - this, SLOT(downmixMonoChanged(bool))); - QWidget::connect(balance, SIGNAL(valueChanged(int)), - this, SLOT(balanceChanged(int))); - QWidget::connect(balance, SIGNAL(doubleClicked()), - this, SLOT(ResetBalance())); - QWidget::connect(syncOffset, SIGNAL(valueChanged(int)), - this, SLOT(syncOffsetChanged(int))); + QWidget::connect(volume, SIGNAL(valueChanged(double)), this, + SLOT(volumeChanged(double))); + QWidget::connect(forceMono, SIGNAL(clicked(bool)), this, + SLOT(downmixMonoChanged(bool))); + QWidget::connect(balance, SIGNAL(valueChanged(int)), this, + SLOT(balanceChanged(int))); + QWidget::connect(balance, SIGNAL(doubleClicked()), this, + SLOT(ResetBalance())); + QWidget::connect(syncOffset, SIGNAL(valueChanged(int)), this, + SLOT(syncOffsetChanged(int))); #if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO - QWidget::connect(monitoringType, SIGNAL(currentIndexChanged(int)), - this, SLOT(monitoringTypeChanged(int))); + QWidget::connect(monitoringType, SIGNAL(currentIndexChanged(int)), this, + SLOT(monitoringTypeChanged(int))); #endif - QWidget::connect(mixer1, SIGNAL(clicked(bool)), - this, SLOT(mixer1Changed(bool))); - QWidget::connect(mixer2, SIGNAL(clicked(bool)), - this, SLOT(mixer2Changed(bool))); - QWidget::connect(mixer3, SIGNAL(clicked(bool)), - this, SLOT(mixer3Changed(bool))); - QWidget::connect(mixer4, SIGNAL(clicked(bool)), - this, SLOT(mixer4Changed(bool))); - QWidget::connect(mixer5, SIGNAL(clicked(bool)), - this, SLOT(mixer5Changed(bool))); - QWidget::connect(mixer6, SIGNAL(clicked(bool)), - this, SLOT(mixer6Changed(bool))); + QWidget::connect(mixer1, SIGNAL(clicked(bool)), this, + SLOT(mixer1Changed(bool))); + QWidget::connect(mixer2, SIGNAL(clicked(bool)), this, + SLOT(mixer2Changed(bool))); + QWidget::connect(mixer3, SIGNAL(clicked(bool)), this, + SLOT(mixer3Changed(bool))); + QWidget::connect(mixer4, SIGNAL(clicked(bool)), this, + SLOT(mixer4Changed(bool))); + QWidget::connect(mixer5, SIGNAL(clicked(bool)), this, + SLOT(mixer5Changed(bool))); + QWidget::connect(mixer6, SIGNAL(clicked(bool)), this, + SLOT(mixer6Changed(bool))); setObjectName(sourceName); } @@ -213,8 +215,8 @@ layout->addWidget(monitoringType, lastRow, idx++); #endif layout->addWidget(mixerContainer, lastRow, idx++); - layout->layout()->setAlignment(mixerContainer, - Qt::AlignHCenter | Qt::AlignVCenter); + layout->layout()->setAlignment(mixerContainer, Qt::AlignVCenter); + layout->setHorizontalSpacing(15); } /* ------------------------------------------------------------------------- */ @@ -223,30 +225,30 @@ void OBSAdvAudioCtrl::OBSSourceFlagsChanged(void *param, calldata_t *calldata) { uint32_t flags = (uint32_t)calldata_int(calldata, "flags"); - QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl*>(param), - "SourceFlagsChanged", Q_ARG(uint32_t, flags)); - + QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl *>(param), + "SourceFlagsChanged", Q_ARG(uint32_t, flags)); } void OBSAdvAudioCtrl::OBSSourceVolumeChanged(void *param, calldata_t *calldata) { float volume = (float)calldata_float(calldata, "volume"); - QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl*>(param), - "SourceVolumeChanged", Q_ARG(float, volume)); + QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl *>(param), + "SourceVolumeChanged", Q_ARG(float, volume)); } void OBSAdvAudioCtrl::OBSSourceSyncChanged(void *param, calldata_t *calldata) { int64_t offset = calldata_int(calldata, "offset"); - QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl*>(param), - "SourceSyncChanged", Q_ARG(int64_t, offset)); + QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl *>(param), + "SourceSyncChanged", Q_ARG(int64_t, offset)); } void OBSAdvAudioCtrl::OBSSourceMixersChanged(void *param, calldata_t *calldata) { uint32_t mixers = (uint32_t)calldata_int(calldata, "mixers"); - QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl*>(param), - "SourceMixersChanged", Q_ARG(uint32_t, mixers)); + QMetaObject::invokeMethod(reinterpret_cast<OBSAdvAudioCtrl *>(param), + "SourceMixersChanged", + Q_ARG(uint32_t, mixers)); } /* ------------------------------------------------------------------------- */ @@ -279,12 +281,12 @@ void OBSAdvAudioCtrl::SourceMixersChanged(uint32_t mixers) { - setCheckboxState(mixer1, mixers & (1<<0)); - setCheckboxState(mixer2, mixers & (1<<1)); - setCheckboxState(mixer3, mixers & (1<<2)); - setCheckboxState(mixer4, mixers & (1<<3)); - setCheckboxState(mixer5, mixers & (1<<4)); - setCheckboxState(mixer6, mixers & (1<<5)); + setCheckboxState(mixer1, mixers & (1 << 0)); + setCheckboxState(mixer2, mixers & (1 << 1)); + setCheckboxState(mixer3, mixers & (1 << 2)); + setCheckboxState(mixer4, mixers & (1 << 3)); + setCheckboxState(mixer5, mixers & (1 << 4)); + setCheckboxState(mixer6, mixers & (1 << 5)); } /* ------------------------------------------------------------------------- */ @@ -335,14 +337,13 @@ balance->setValue(50); } - void OBSAdvAudioCtrl::syncOffsetChanged(int milliseconds) { int64_t cur_val = obs_source_get_sync_offset(source); if (cur_val / NSEC_PER_MSEC != milliseconds) - obs_source_set_sync_offset(source, - int64_t(milliseconds) * NSEC_PER_MSEC); + obs_source_set_sync_offset(source, int64_t(milliseconds) * + NSEC_PER_MSEC); } void OBSAdvAudioCtrl::monitoringTypeChanged(int index) @@ -365,17 +366,19 @@ } blog(LOG_INFO, "User changed audio monitoring for source '%s' to: %s", - obs_source_get_name(source), type); + obs_source_get_name(source), type); } static inline void setMixer(obs_source_t *source, const int mixerIdx, - const bool checked) + const bool checked) { uint32_t mixers = obs_source_get_audio_mixers(source); uint32_t new_mixers = mixers; - if (checked) new_mixers |= (1<<mixerIdx); - else new_mixers &= ~(1<<mixerIdx); + if (checked) + new_mixers |= (1 << mixerIdx); + else + new_mixers &= ~(1 << mixerIdx); obs_source_set_audio_mixers(source, new_mixers); }
View file
obs-studio-23.2.1.tar.xz/UI/adv-audio-control.hpp -> obs-studio-24.0.0.tar.xz/UI/adv-audio-control.hpp
Changed
@@ -16,31 +16,31 @@ Q_OBJECT private: - OBSSource source; + OBSSource source; - QPointer<QWidget> forceMonoContainer; - QPointer<QWidget> mixerContainer; - QPointer<QWidget> balanceContainer; + QPointer<QWidget> forceMonoContainer; + QPointer<QWidget> mixerContainer; + QPointer<QWidget> balanceContainer; - QPointer<QLabel> nameLabel; + QPointer<QLabel> nameLabel; QPointer<QDoubleSpinBox> volume; - QPointer<QCheckBox> forceMono; - QPointer<BalanceSlider>balance; - QPointer<QLabel> labelL; - QPointer<QLabel> labelR; - QPointer<QSpinBox> syncOffset; - QPointer<QComboBox> monitoringType; - QPointer<QCheckBox> mixer1; - QPointer<QCheckBox> mixer2; - QPointer<QCheckBox> mixer3; - QPointer<QCheckBox> mixer4; - QPointer<QCheckBox> mixer5; - QPointer<QCheckBox> mixer6; + QPointer<QCheckBox> forceMono; + QPointer<BalanceSlider> balance; + QPointer<QLabel> labelL; + QPointer<QLabel> labelR; + QPointer<QSpinBox> syncOffset; + QPointer<QComboBox> monitoringType; + QPointer<QCheckBox> mixer1; + QPointer<QCheckBox> mixer2; + QPointer<QCheckBox> mixer3; + QPointer<QCheckBox> mixer4; + QPointer<QCheckBox> mixer5; + QPointer<QCheckBox> mixer6; - OBSSignal volChangedSignal; - OBSSignal syncOffsetSignal; - OBSSignal flagsSignal; - OBSSignal mixersSignal; + OBSSignal volChangedSignal; + OBSSignal syncOffsetSignal; + OBSSignal flagsSignal; + OBSSignal mixersSignal; static void OBSSourceFlagsChanged(void *param, calldata_t *calldata); static void OBSSourceVolumeChanged(void *param, calldata_t *calldata); @@ -51,7 +51,7 @@ OBSAdvAudioCtrl(QGridLayout *layout, obs_source_t *source_); virtual ~OBSAdvAudioCtrl(); - inline obs_source_t *GetSource() const {return source;} + inline obs_source_t *GetSource() const { return source; } void ShowAudioControl(QGridLayout *layout); public slots:
View file
obs-studio-23.2.1.tar.xz/UI/api-interface.cpp -> obs-studio-24.0.0.tar.xz/UI/api-interface.cpp
Changed
@@ -11,17 +11,17 @@ Q_DECLARE_METATYPE(OBSScene); Q_DECLARE_METATYPE(OBSSource); -template <typename T> -static T GetOBSRef(QListWidgetItem *item) +template<typename T> static T GetOBSRef(QListWidgetItem *item) { return item->data(static_cast<int>(QtDataRole::OBSRef)).value<T>(); } -void EnumProfiles(function<bool (const char *, const char *)> &&cb); -void EnumSceneCollections(function<bool (const char *, const char *)> &&cb); +void EnumProfiles(function<bool(const char *, const char *)> &&cb); +void EnumSceneCollections(function<bool(const char *, const char *)> &&cb); extern volatile bool streaming_active; extern volatile bool recording_active; +extern volatile bool recording_paused; extern volatile bool replaybuf_active; /* ------------------------------------------------------------------------- */ @@ -30,18 +30,18 @@ T callback; void *private_data; - inline OBSStudioCallback(T cb, void *p) : - callback(cb), private_data(p) - {} + inline OBSStudioCallback(T cb, void *p) : callback(cb), private_data(p) + { + } }; -template <typename T> inline size_t GetCallbackIdx( - vector<OBSStudioCallback<T>> &callbacks, - T callback, void *private_data) +template<typename T> +inline size_t GetCallbackIdx(vector<OBSStudioCallback<T>> &callbacks, + T callback, void *private_data) { for (size_t i = 0; i < callbacks.size(); i++) { OBSStudioCallback<T> curCB = callbacks[i]; - if (curCB.callback == callback && + if (curCB.callback == callback && curCB.private_data == private_data) return i; } @@ -59,21 +59,21 @@ void *obs_frontend_get_main_window(void) override { - return (void*)main; + return (void *)main; } void *obs_frontend_get_main_window_handle(void) override { - return (void*)main->winId(); + return (void *)main->winId(); } void *obs_frontend_get_system_tray(void) override { - return (void*)main->trayIcon.data(); + return (void *)main->trayIcon.data(); } void obs_frontend_get_scenes( - struct obs_frontend_source_list *sources) override + struct obs_frontend_source_list *sources) override { for (int i = 0; i < main->ui->scenes->count(); i++) { QListWidgetItem *item = main->ui->scenes->item(i); @@ -101,23 +101,23 @@ void obs_frontend_set_current_scene(obs_source_t *scene) override { if (main->IsPreviewProgramMode()) { - QMetaObject::invokeMethod(main, "TransitionToScene", - WaitConnection(), - Q_ARG(OBSSource, OBSSource(scene))); + QMetaObject::invokeMethod( + main, "TransitionToScene", WaitConnection(), + Q_ARG(OBSSource, OBSSource(scene))); } else { - QMetaObject::invokeMethod(main, "SetCurrentScene", - WaitConnection(), - Q_ARG(OBSSource, OBSSource(scene)), - Q_ARG(bool, false)); + QMetaObject::invokeMethod( + main, "SetCurrentScene", WaitConnection(), + Q_ARG(OBSSource, OBSSource(scene)), + Q_ARG(bool, false)); } } void obs_frontend_get_transitions( - struct obs_frontend_source_list *sources) override + struct obs_frontend_source_list *sources) override { for (int i = 0; i < main->ui->transitions->count(); i++) { OBSSource tr = main->ui->transitions->itemData(i) - .value<OBSSource>(); + .value<OBSSource>(); obs_source_addref(tr); da_push_back(sources->sources, &tr); @@ -132,11 +132,12 @@ return tr; } - void obs_frontend_set_current_transition( - obs_source_t *transition) override + void + obs_frontend_set_current_transition(obs_source_t *transition) override { QMetaObject::invokeMethod(main, "SetTransition", - Q_ARG(OBSSource, OBSSource(transition))); + Q_ARG(OBSSource, + OBSSource(transition))); } int obs_frontend_get_transition_duration(void) override @@ -146,15 +147,14 @@ void obs_frontend_set_transition_duration(int duration) override { - QMetaObject::invokeMethod(main->ui->transitionDuration, "setValue", - Q_ARG(int, duration)); + QMetaObject::invokeMethod(main->ui->transitionDuration, + "setValue", Q_ARG(int, duration)); } void obs_frontend_get_scene_collections( - std::vector<std::string> &strings) override + std::vector<std::string> &strings) override { - auto addCollection = [&](const char *name, const char *) - { + auto addCollection = [&](const char *name, const char *) { strings.emplace_back(name); return true; }; @@ -164,15 +164,15 @@ char *obs_frontend_get_current_scene_collection(void) override { - const char *cur_name = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollection"); + const char *cur_name = config_get_string( + App()->GlobalConfig(), "Basic", "SceneCollection"); return bstrdup(cur_name); } void obs_frontend_set_current_scene_collection( - const char *collection) override + const char *collection) override { - QList<QAction*> menuActions = + QList<QAction *> menuActions = main->ui->sceneCollectionMenu->actions(); QString qstrCollection = QT_UTF8(collection); @@ -189,24 +189,21 @@ } } - bool obs_frontend_add_scene_collection( - const char *name) override + bool obs_frontend_add_scene_collection(const char *name) override { bool success = false; - QMetaObject::invokeMethod(main, - "AddSceneCollection", - WaitConnection(), - Q_RETURN_ARG(bool, success), - Q_ARG(bool, true), - Q_ARG(QString, QT_UTF8(name))); + QMetaObject::invokeMethod(main, "AddSceneCollection", + WaitConnection(), + Q_RETURN_ARG(bool, success), + Q_ARG(bool, true), + Q_ARG(QString, QT_UTF8(name))); return success; } - void obs_frontend_get_profiles( - std::vector<std::string> &strings) override + void + obs_frontend_get_profiles(std::vector<std::string> &strings) override { - auto addProfile = [&](const char *name, const char *) - { + auto addProfile = [&](const char *name, const char *) { strings.emplace_back(name); return true; }; @@ -217,14 +214,13 @@ char *obs_frontend_get_current_profile(void) override { const char *name = config_get_string(App()->GlobalConfig(), - "Basic", "Profile"); + "Basic", "Profile"); return bstrdup(name); } void obs_frontend_set_current_profile(const char *profile) override { - QList<QAction*> menuActions = - main->ui->profileMenu->actions(); + QList<QAction *> menuActions = main->ui->profileMenu->actions(); QString qstrProfile = QT_UTF8(profile); for (int i = 0; i < menuActions.count(); i++) { @@ -270,6 +266,17 @@ return os_atomic_load_bool(&recording_active); } + void obs_frontend_recording_pause(bool pause) override + { + QMetaObject::invokeMethod(main, pause ? "PauseRecording" + : "UnpauseRecording"); + } + + bool obs_frontend_recording_paused(void) override + { + return os_atomic_load_bool(&recording_paused); + } + void obs_frontend_replay_buffer_start(void) override { QMetaObject::invokeMethod(main, "StartReplayBuffer"); @@ -293,16 +300,16 @@ void *obs_frontend_add_tools_menu_qaction(const char *name) override { main->ui->menuTools->setEnabled(true); - return (void*)main->ui->menuTools->addAction(QT_UTF8(name)); + return (void *)main->ui->menuTools->addAction(QT_UTF8(name)); } void obs_frontend_add_tools_menu_item(const char *name, - obs_frontend_cb callback, void *private_data) override + obs_frontend_cb callback, + void *private_data) override { main->ui->menuTools->setEnabled(true); - auto func = [private_data, callback] () - { + auto func = [private_data, callback]() { callback(private_data); }; @@ -312,11 +319,11 @@ void *obs_frontend_add_dock(void *dock) override { - return (void*)main->AddDockWidget((QDockWidget *)dock); + return (void *)main->AddDockWidget((QDockWidget *)dock); } void obs_frontend_add_event_callback(obs_frontend_event_cb callback, - void *private_data) override + void *private_data) override { size_t idx = GetCallbackIdx(callbacks, callback, private_data); if (idx == (size_t)-1) @@ -324,7 +331,7 @@ } void obs_frontend_remove_event_callback(obs_frontend_event_cb callback, - void *private_data) override + void *private_data) override { size_t idx = GetCallbackIdx(callbacks, callback, private_data); if (idx == (size_t)-1) @@ -364,10 +371,7 @@ return App()->GlobalConfig(); } - void obs_frontend_save(void) override - { - main->SaveProject(); - } + void obs_frontend_save(void) override { main->SaveProject(); } void obs_frontend_defer_save_begin(void) override { @@ -380,19 +384,19 @@ } void obs_frontend_add_save_callback(obs_frontend_save_cb callback, - void *private_data) override + void *private_data) override { - size_t idx = GetCallbackIdx(saveCallbacks, callback, - private_data); + size_t idx = + GetCallbackIdx(saveCallbacks, callback, private_data); if (idx == (size_t)-1) saveCallbacks.emplace_back(callback, private_data); } void obs_frontend_remove_save_callback(obs_frontend_save_cb callback, - void *private_data) override + void *private_data) override { - size_t idx = GetCallbackIdx(saveCallbacks, callback, - private_data); + size_t idx = + GetCallbackIdx(saveCallbacks, callback, private_data); if (idx == (size_t)-1) return; @@ -400,19 +404,19 @@ } void obs_frontend_add_preload_callback(obs_frontend_save_cb callback, - void *private_data) override + void *private_data) override { size_t idx = GetCallbackIdx(preloadCallbacks, callback, - private_data); + private_data); if (idx == (size_t)-1) preloadCallbacks.emplace_back(callback, private_data); } void obs_frontend_remove_preload_callback(obs_frontend_save_cb callback, - void *private_data) override + void *private_data) override { size_t idx = GetCallbackIdx(preloadCallbacks, callback, - private_data); + private_data); if (idx == (size_t)-1) return; @@ -420,7 +424,7 @@ } void obs_frontend_push_ui_translation( - obs_frontend_translate_ui_cb translate) override + obs_frontend_translate_ui_cb translate) override { App()->PushUITranslation(translate); } @@ -483,12 +487,14 @@ return source; } - void obs_frontend_set_current_preview_scene(obs_source_t *scene) override + void + obs_frontend_set_current_preview_scene(obs_source_t *scene) override { if (main->IsPreviewProgramMode()) { QMetaObject::invokeMethod(main, "SetCurrentScene", - Q_ARG(OBSSource, OBSSource(scene)), - Q_ARG(bool, false)); + Q_ARG(OBSSource, + OBSSource(scene)), + Q_ARG(bool, false)); } }
View file
obs-studio-23.2.1.tar.xz/UI/audio-encoders.cpp -> obs-studio-24.0.0.tar.xz/UI/audio-encoders.cpp
Changed
@@ -32,7 +32,7 @@ return NullToEmpty(obs_encoder_get_display_name(id)); } -static map<int, const char*> bitrateMap; +static map<int, const char *> bitrateMap; static once_flag populateBitrateMap; static void HandleIntProperty(obs_property_t *prop, const char *id) @@ -48,10 +48,11 @@ { obs_combo_format format = obs_property_list_format(prop); if (format != OBS_COMBO_FORMAT_INT) { - blog(LOG_ERROR, "Encoder '%s' (%s) returned bitrate " - "OBS_PROPERTY_LIST property of unhandled " - "format %d", - EncoderName(id), id, static_cast<int>(format)); + blog(LOG_ERROR, + "Encoder '%s' (%s) returned bitrate " + "OBS_PROPERTY_LIST property of unhandled " + "format %d", + EncoderName(id), id, static_cast<int>(format)); return; } @@ -60,38 +61,35 @@ if (obs_property_list_item_disabled(prop, i)) continue; - int bitrate = static_cast<int>( - obs_property_list_item_int(prop, i)); + int bitrate = + static_cast<int>(obs_property_list_item_int(prop, i)); bitrateMap[bitrate] = id; } } -static void HandleSampleRate(obs_property_t* prop, const char *id) +static void HandleSampleRate(obs_property_t *prop, const char *id) { - auto ReleaseData = [](obs_data_t *data) - { - obs_data_release(data); - }; + auto ReleaseData = [](obs_data_t *data) { obs_data_release(data); }; std::unique_ptr<obs_data_t, decltype(ReleaseData)> data{ - obs_encoder_defaults(id), - ReleaseData}; + obs_encoder_defaults(id), ReleaseData}; if (!data) { - blog(LOG_ERROR, "Failed to get defaults for encoder '%s' (%s) " - "while populating bitrate map", - EncoderName(id), id); + blog(LOG_ERROR, + "Failed to get defaults for encoder '%s' (%s) " + "while populating bitrate map", + EncoderName(id), id); return; } - auto main = reinterpret_cast<OBSMainWindow*>(App()->GetMainWindow()); + auto main = reinterpret_cast<OBSMainWindow *>(App()->GetMainWindow()); if (!main) { blog(LOG_ERROR, "Failed to get main window while populating " "bitrate map"); return; } - uint32_t sampleRate = config_get_uint(main->Config(), "Audio", - "SampleRate"); + uint32_t sampleRate = + config_get_uint(main->Config(), "Audio", "SampleRate"); obs_data_set_int(data.get(), "samplerate", sampleRate); @@ -100,23 +98,22 @@ static void HandleEncoderProperties(const char *id) { - auto DestroyProperties = [](obs_properties_t *props) - { + auto DestroyProperties = [](obs_properties_t *props) { obs_properties_destroy(props); }; std::unique_ptr<obs_properties_t, decltype(DestroyProperties)> props{ - obs_get_encoder_properties(id), - DestroyProperties}; + obs_get_encoder_properties(id), DestroyProperties}; if (!props) { - blog(LOG_ERROR, "Failed to get properties for encoder " - "'%s' (%s)", - EncoderName(id), id); + blog(LOG_ERROR, + "Failed to get properties for encoder " + "'%s' (%s)", + EncoderName(id), id); return; } - obs_property_t *samplerate = obs_properties_get(props.get(), - "samplerate"); + obs_property_t *samplerate = + obs_properties_get(props.get(), "samplerate"); if (samplerate) HandleSampleRate(samplerate, id); @@ -130,12 +127,14 @@ case OBS_PROPERTY_LIST: return HandleListProperty(bitrate, id); - default: break; + default: + break; } - blog(LOG_ERROR, "Encoder '%s' (%s) returned bitrate property " - "of unhandled type %d", EncoderName(id), id, - static_cast<int>(type)); + blog(LOG_ERROR, + "Encoder '%s' (%s) returned bitrate property " + "of unhandled type %d", + EncoderName(id), id, static_cast<int>(type)); } static const char *GetCodec(const char *id) @@ -146,8 +145,7 @@ static const string aac_ = "AAC"; static void PopulateBitrateMap() { - call_once(populateBitrateMap, []() - { + call_once(populateBitrateMap, []() { struct obs_audio_info aoi; obs_get_audio_info(&aoi); uint32_t output_channels = get_audio_channels(aoi.speakers); @@ -156,13 +154,12 @@ const char *id = nullptr; for (size_t i = 0; obs_enum_encoder_types(i, &id); i++) { - auto Compare = [=](const string &val) - { + auto Compare = [=](const string &val) { return val == NullToEmpty(id); }; if (find_if(begin(encoders), end(encoders), Compare) != - end(encoders)) + end(encoders)) continue; if (aac_ != GetCodec(id)) @@ -198,11 +195,11 @@ << entry.second << ')'; blog(LOG_DEBUG, "AAC encoder bitrate mapping:%s", - ss.str().c_str()); + ss.str().c_str()); }); } -const map<int, const char*> &GetAACEncoderBitrateMap() +const map<int, const char *> &GetAACEncoderBitrateMap() { PopulateBitrateMap(); return bitrateMap;
View file
obs-studio-23.2.1.tar.xz/UI/audio-encoders.hpp -> obs-studio-24.0.0.tar.xz/UI/audio-encoders.hpp
Changed
@@ -4,6 +4,6 @@ #include <map> -const std::map<int, const char*> &GetAACEncoderBitrateMap(); +const std::map<int, const char *> &GetAACEncoderBitrateMap(); const char *GetAACEncoderForBitrate(int bitrate); int FindClosestAvailableAACBitrate(int bitrate);
View file
obs-studio-23.2.1.tar.xz/UI/auth-base.cpp -> obs-studio-24.0.0.tar.xz/UI/auth-base.cpp
Changed
@@ -43,7 +43,8 @@ { OBSBasic *main = OBSBasic::Get(); const char *typeStr = config_get_string(main->Config(), "Auth", "Type"); - if (!typeStr) typeStr = ""; + if (!typeStr) + typeStr = ""; main->auth = Create(typeStr); if (main->auth) {
View file
obs-studio-23.2.1.tar.xz/UI/auth-base.hpp -> obs-studio-24.0.0.tar.xz/UI/auth-base.hpp
Changed
@@ -8,8 +8,8 @@ Q_OBJECT protected: - virtual void SaveInternal()=0; - virtual bool LoadInternal()=0; + virtual void SaveInternal() = 0; + virtual bool LoadInternal() = 0; bool firstLoad = true; @@ -19,13 +19,14 @@ ErrorInfo(std::string message_, std::string error_) : message(message_), error(error_) - {} + { + } }; public: enum class Type { None, - OAuth_StreamKey + OAuth_StreamKey, }; struct Def { @@ -33,13 +34,13 @@ Type type; }; - typedef std::function<std::shared_ptr<Auth> ()> create_cb; + typedef std::function<std::shared_ptr<Auth>()> create_cb; inline Auth(const Def &d) : def(d) {} virtual ~Auth() {} - inline Type type() const {return def.type;} - inline const char *service() const {return def.service.c_str();} + inline Type type() const { return def.type; } + inline const char *service() const { return def.service.c_str(); } virtual void LoadUI() {}
View file
obs-studio-23.2.1.tar.xz/UI/auth-mixer.cpp -> obs-studio-24.0.0.tar.xz/UI/auth-mixer.cpp
Changed
@@ -7,9 +7,9 @@ #include <qt-wrappers.hpp> #include <obs-app.hpp> +#include "window-dock-browser.hpp" #include "window-basic-main.hpp" #include "remote-text.hpp" -#include "window-dock.hpp" #include <json11.hpp> @@ -20,30 +20,18 @@ using namespace json11; -#include <browser-panel.hpp> -extern QCef *cef; -extern QCefCookieManager *panel_cookies; - /* ------------------------------------------------------------------------- */ -#define MIXER_AUTH_URL \ - "https://obsproject.com/app-auth/mixer?action=redirect" -#define MIXER_TOKEN_URL \ - "https://obsproject.com/app-auth/mixer-token" +#define MIXER_AUTH_URL "https://obsproject.com/app-auth/mixer?action=redirect" +#define MIXER_TOKEN_URL "https://obsproject.com/app-auth/mixer-token" #define MIXER_SCOPE_VERSION 1 -static Auth::Def mixerDef = { - "Mixer", - Auth::Type::OAuth_StreamKey -}; +static Auth::Def mixerDef = {"Mixer", Auth::Type::OAuth_StreamKey}; /* ------------------------------------------------------------------------- */ -MixerAuth::MixerAuth(const Def &d) - : OAuthStreamKey(d) -{ -} +MixerAuth::MixerAuth(const Def &d) : OAuthStreamKey(d) {} bool MixerAuth::GetChannelInfo(bool allow_retry) try { @@ -71,23 +59,16 @@ bool success; if (id.empty()) { - auto func = [&] () { + auto func = [&]() { success = GetRemoteFile( - "https://mixer.com/api/v1/users/current", - output, - error, - nullptr, - "application/json", - nullptr, - headers, - nullptr, - 5); + "https://mixer.com/api/v1/users/current", + output, error, nullptr, "application/json", + nullptr, headers, nullptr, 5); }; ExecThreadedWithoutBlocking( - func, - QTStr("Auth.LoadingChannel.Title"), - QTStr("Auth.LoadingChannel.Text").arg(service())); + func, QTStr("Auth.LoadingChannel.Title"), + QTStr("Auth.LoadingChannel.Text").arg(service())); if (!success || output.empty()) throw ErrorInfo("Failed to get user info from remote", error); @@ -98,11 +79,12 @@ error = json["error"].string_value(); if (!error.empty()) - throw ErrorInfo(error, - json["error_description"].string_value()); + throw ErrorInfo( + error, + json["error_description"].string_value()); - id = std::to_string(json["channel"]["id"].int_value()); - name = json["channel"]["token"].string_value(); + id = std::to_string(json["channel"]["id"].int_value()); + name = json["channel"]["token"].string_value(); } /* ------------------ */ @@ -114,23 +96,15 @@ output.clear(); - auto func = [&] () { - success = GetRemoteFile( - url.c_str(), - output, - error, - nullptr, - "application/json", - nullptr, - headers, - nullptr, - 5); + auto func = [&]() { + success = GetRemoteFile(url.c_str(), output, error, nullptr, + "application/json", nullptr, headers, + nullptr, 5); }; ExecThreadedWithoutBlocking( - func, - QTStr("Auth.LoadingChannel.Title"), - QTStr("Auth.LoadingChannel.Text").arg(service())); + func, QTStr("Auth.LoadingChannel.Title"), + QTStr("Auth.LoadingChannel.Text").arg(service())); if (!success || output.empty()) throw ErrorInfo("Failed to get stream key from remote", error); @@ -140,7 +114,8 @@ error = json["error"].string_value(); if (!error.empty()) - throw ErrorInfo(error, json["error_description"].string_value()); + throw ErrorInfo(error, + json["error_description"].string_value()); std::string key_suffix = json["streamKey"].string_value(); @@ -161,14 +136,13 @@ } catch (ErrorInfo info) { QString title = QTStr("Auth.ChannelFailure.Title"); QString text = QTStr("Auth.ChannelFailure.Text") - .arg(service(), info.message.c_str(), info.error.c_str()); + .arg(service(), info.message.c_str(), + info.error.c_str()); QMessageBox::warning(OBSBasic::Get(), title, text); - blog(LOG_WARNING, "%s: %s: %s", - __FUNCTION__, - info.message.c_str(), - info.error.c_str()); + blog(LOG_WARNING, "%s: %s: %s", __FUNCTION__, info.message.c_str(), + info.error.c_str()); return false; } @@ -179,15 +153,13 @@ config_set_string(main->Config(), service(), "Id", id.c_str()); if (uiLoaded) { config_set_string(main->Config(), service(), "DockState", - main->saveState().toBase64().constData()); + main->saveState().toBase64().constData()); } OAuthStreamKey::SaveInternal(); } -static inline std::string get_config_str( - OBSBasic *main, - const char *section, - const char *name) +static inline std::string get_config_str(OBSBasic *main, const char *section, + const char *name) { const char *val = config_get_string(main->Config(), section, name); return val ? val : ""; @@ -205,13 +177,6 @@ return OAuthStreamKey::LoadInternal(); } -class MixerChat : public OBSDock { -public: - inline MixerChat() : OBSDock() {} - - QScopedPointer<QCefWidget> widget; -}; - void MixerAuth::LoadUI() { if (!cef) @@ -231,7 +196,7 @@ QSize size = main->frameSize(); QPoint pos = main->pos(); - chat.reset(new MixerChat()); + chat.reset(new BrowserDock()); chat->setObjectName("mixerChat"); chat->resize(300, 600); chat->setMinimumSize(200, 300); @@ -252,8 +217,8 @@ if (firstLoad) { chat->setVisible(true); } else { - const char *dockStateStr = config_get_string(main->Config(), - service(), "DockState"); + const char *dockStateStr = config_get_string( + main->Config(), service(), "DockState"); QByteArray dockState = QByteArray::fromBase64(QByteArray(dockStateStr)); main->restoreState(dockState); @@ -301,7 +266,7 @@ deobfuscate_str(&client_id[0], MIXER_HASH); if (!auth->GetToken(MIXER_TOKEN_URL, client_id, MIXER_SCOPE_VERSION, - QT_TO_UTF8(login.GetCode()))) { + QT_TO_UTF8(login.GetCode()))) { return nullptr; } @@ -328,9 +293,6 @@ void RegisterMixerAuth() { - OAuth::RegisterOAuth( - mixerDef, - CreateMixerAuth, - MixerAuth::Login, - DeleteCookies); + OAuth::RegisterOAuth(mixerDef, CreateMixerAuth, MixerAuth::Login, + DeleteCookies); }
View file
obs-studio-23.2.1.tar.xz/UI/auth-mixer.hpp -> obs-studio-24.0.0.tar.xz/UI/auth-mixer.hpp
Changed
@@ -2,12 +2,12 @@ #include "auth-oauth.hpp" -class MixerChat; +class BrowserDock; class MixerAuth : public OAuthStreamKey { Q_OBJECT - QSharedPointer<MixerChat> chat; + QSharedPointer<BrowserDock> chat; QSharedPointer<QAction> chatMenu; bool uiLoaded = false;
View file
obs-studio-23.2.1.tar.xz/UI/auth-oauth.cpp -> obs-studio-24.0.0.tar.xz/UI/auth-oauth.cpp
Changed
@@ -23,8 +23,7 @@ /* ------------------------------------------------------------------------- */ OAuthLogin::OAuthLogin(QWidget *parent, const std::string &url, bool token) - : QDialog (parent), - get_token (token) + : QDialog(parent), get_token(token) { if (!cef) { return; @@ -46,14 +45,13 @@ return; } - connect(cefWidget, SIGNAL(titleChanged(const QString &)), - this, SLOT(setWindowTitle(const QString &))); - connect(cefWidget, SIGNAL(urlChanged(const QString &)), - this, SLOT(urlChanged(const QString &))); + connect(cefWidget, SIGNAL(titleChanged(const QString &)), this, + SLOT(setWindowTitle(const QString &))); + connect(cefWidget, SIGNAL(urlChanged(const QString &)), this, + SLOT(urlChanged(const QString &))); QPushButton *close = new QPushButton(QTStr("Cancel")); - connect(close, &QAbstractButton::clicked, - this, &QDialog::reject); + connect(close, &QAbstractButton::clicked, this, &QDialog::reject); QHBoxLayout *bottomLayout = new QHBoxLayout(); bottomLayout->addStretch(); @@ -111,7 +109,7 @@ static std::vector<OAuthInfo> loginCBs; void OAuth::RegisterOAuth(const Def &d, create_cb create, login_cb login, - delete_cookies_cb delete_cookies) + delete_cookies_cb delete_cookies) { OAuthInfo info = {d, login, delete_cookies}; loginCBs.push_back(info); @@ -142,16 +140,14 @@ { OBSBasic *main = OBSBasic::Get(); config_set_string(main->Config(), service(), "RefreshToken", - refresh_token.c_str()); + refresh_token.c_str()); config_set_string(main->Config(), service(), "Token", token.c_str()); config_set_uint(main->Config(), service(), "ExpireTime", expire_time); config_set_int(main->Config(), service(), "ScopeVer", currentScopeVer); } -static inline std::string get_config_str( - OBSBasic *main, - const char *section, - const char *name) +static inline std::string get_config_str(OBSBasic *main, const char *section, + const char *name) { const char *val = config_get_string(main->Config(), section, name); return val ? val : ""; @@ -163,11 +159,9 @@ refresh_token = get_config_str(main, service(), "RefreshToken"); token = get_config_str(main, service(), "Token"); expire_time = config_get_uint(main->Config(), service(), "ExpireTime"); - currentScopeVer = (int)config_get_int(main->Config(), service(), - "ScopeVer"); - return implicit - ? !token.empty() - : !refresh_token.empty(); + currentScopeVer = + (int)config_get_int(main->Config(), service(), "ScopeVer"); + return implicit ? !token.empty() : !refresh_token.empty(); } bool OAuth::TokenExpired() @@ -180,7 +174,7 @@ } bool OAuth::GetToken(const char *url, const std::string &client_id, - int scope_ver, const std::string &auth_code, bool retry) + int scope_ver, const std::string &auth_code, bool retry) try { std::string output; std::string error; @@ -191,8 +185,8 @@ return true; } else { QString title = QTStr("Auth.InvalidScope.Title"); - QString text = QTStr("Auth.InvalidScope.Text") - .arg(service()); + QString text = + QTStr("Auth.InvalidScope.Text").arg(service()); QMessageBox::warning(OBSBasic::Get(), title, text); } @@ -216,23 +210,15 @@ bool success = false; - auto func = [&] () { - success = GetRemoteFile( - url, - output, - error, - nullptr, - "application/x-www-form-urlencoded", - post_data.c_str(), - std::vector<std::string>(), - nullptr, - 5); + auto func = [&]() { + success = GetRemoteFile(url, output, error, nullptr, + "application/x-www-form-urlencoded", + post_data.c_str(), + std::vector<std::string>(), nullptr, 5); }; - ExecThreadedWithoutBlocking( - func, - QTStr("Auth.Authing.Title"), - QTStr("Auth.Authing.Text").arg(service())); + ExecThreadedWithoutBlocking(func, QTStr("Auth.Authing.Title"), + QTStr("Auth.Authing.Text").arg(service())); if (!success || output.empty()) throw ErrorInfo("Failed to get token from remote", error); @@ -250,13 +236,14 @@ } } if (!error.empty()) - throw ErrorInfo(error, json["error_description"].string_value()); + throw ErrorInfo(error, + json["error_description"].string_value()); /* -------------------------- */ /* success! */ expire_time = (uint64_t)time(nullptr) + json["expires_in"].int_value(); - token = json["access_token"].string_value(); + token = json["access_token"].string_value(); if (token.empty()) throw ErrorInfo("Failed to get token from remote", error); @@ -264,26 +251,26 @@ refresh_token = json["refresh_token"].string_value(); if (refresh_token.empty()) throw ErrorInfo("Failed to get refresh token from " - "remote", error); + "remote", + error); currentScopeVer = scope_ver; } return true; -} catch (ErrorInfo info) { +} catch (ErrorInfo &info) { if (!retry) { QString title = QTStr("Auth.AuthFailure.Title"); QString text = QTStr("Auth.AuthFailure.Text") - .arg(service(), info.message.c_str(), info.error.c_str()); + .arg(service(), info.message.c_str(), + info.error.c_str()); QMessageBox::warning(OBSBasic::Get(), title, text); } - blog(LOG_WARNING, "%s: %s: %s", - __FUNCTION__, - info.message.c_str(), - info.error.c_str()); + blog(LOG_WARNING, "%s: %s: %s", __FUNCTION__, info.message.c_str(), + info.error.c_str()); return false; } @@ -301,7 +288,7 @@ if (bwtest && strcmp(this->service(), "Twitch") == 0) obs_data_set_string(settings, "key", - (key_ + "?bandwidthtest=true").c_str()); + (key_ + "?bandwidthtest=true").c_str()); else obs_data_set_string(settings, "key", key_.c_str());
View file
obs-studio-23.2.1.tar.xz/UI/auth-oauth.hpp -> obs-studio-24.0.0.tar.xz/UI/auth-oauth.hpp
Changed
@@ -20,8 +20,8 @@ OAuthLogin(QWidget *parent, const std::string &url, bool token); ~OAuthLogin(); - inline QString GetCode() const {return code;} - inline bool LoadFail() const {return fail;} + inline QString GetCode() const { return code; } + inline bool LoadFail() const { return fail; } virtual int exec() override; @@ -35,15 +35,16 @@ public: inline OAuth(const Def &d) : Auth(d) {} - typedef std::function<std::shared_ptr<Auth> (QWidget *)> login_cb; + typedef std::function<std::shared_ptr<Auth>(QWidget *)> login_cb; typedef std::function<void()> delete_cookies_cb; static std::shared_ptr<Auth> Login(QWidget *parent, - const std::string &service); + const std::string &service); static void DeleteCookies(const std::string &service); static void RegisterOAuth(const Def &d, create_cb create, - login_cb login, delete_cookies_cb delete_cookies); + login_cb login, + delete_cookies_cb delete_cookies); protected: std::string refresh_token; @@ -55,12 +56,12 @@ virtual void SaveInternal() override; virtual bool LoadInternal() override; - virtual bool RetryLogin()=0; + virtual bool RetryLogin() = 0; bool TokenExpired(); bool GetToken(const char *url, const std::string &client_id, - int scope_ver, - const std::string &auth_code = std::string(), - bool retry = false); + int scope_ver, + const std::string &auth_code = std::string(), + bool retry = false); }; class OAuthStreamKey : public OAuth { @@ -72,7 +73,7 @@ public: inline OAuthStreamKey(const Def &d) : OAuth(d) {} - inline const std::string &key() const {return key_;} + inline const std::string &key() const { return key_; } virtual void OnStreamConfig() override; };
View file
obs-studio-23.2.1.tar.xz/UI/auth-restream.cpp -> obs-studio-24.0.0.tar.xz/UI/auth-restream.cpp
Changed
@@ -9,36 +9,27 @@ #include <sstream> #include <obs-app.hpp> +#include "window-dock-browser.hpp" #include "window-basic-main.hpp" #include "remote-text.hpp" #include "ui-config.h" #include "obf.h" -#include <browser-panel.hpp> using namespace json11; -extern QCef *cef; -extern QCefCookieManager *panel_cookies; - /* ------------------------------------------------------------------------- */ -#define RESTREAM_AUTH_URL "https://obsproject.com/app-auth/restream?action=redirect" +#define RESTREAM_AUTH_URL \ + "https://obsproject.com/app-auth/restream?action=redirect" #define RESTREAM_TOKEN_URL "https://obsproject.com/app-auth/restream-token" #define RESTREAM_STREAMKEY_URL "https://api.restream.io/v2/user/streamKey" #define RESTREAM_SCOPE_VERSION 1 - -static Auth::Def restreamDef = { - "Restream", - Auth::Type::OAuth_StreamKey -}; +static Auth::Def restreamDef = {"Restream", Auth::Type::OAuth_StreamKey}; /* ------------------------------------------------------------------------- */ -RestreamAuth::RestreamAuth(const Def &d) - : OAuthStreamKey(d) -{ -} +RestreamAuth::RestreamAuth(const Def &d) : OAuthStreamKey(d) {} bool RestreamAuth::GetChannelInfo() try { @@ -65,23 +56,15 @@ Json json; bool success; - auto func = [&] () { - success = GetRemoteFile( - RESTREAM_STREAMKEY_URL, - output, - error, - nullptr, - "application/json", - nullptr, - headers, - nullptr, - 5); + auto func = [&]() { + success = GetRemoteFile(RESTREAM_STREAMKEY_URL, output, error, + nullptr, "application/json", nullptr, + headers, nullptr, 5); }; ExecThreadedWithoutBlocking( - func, - QTStr("Auth.LoadingChannel.Title"), - QTStr("Auth.LoadingChannel.Text").arg(service())); + func, QTStr("Auth.LoadingChannel.Title"), + QTStr("Auth.LoadingChannel.Text").arg(service())); if (!success || output.empty()) throw ErrorInfo("Failed to get stream key from remote", error); @@ -91,7 +74,8 @@ error = json["error"].string_value(); if (!error.empty()) - throw ErrorInfo(error, json["error_description"].string_value()); + throw ErrorInfo(error, + json["error_description"].string_value()); key_ = json["streamKey"].string_value(); @@ -99,14 +83,13 @@ } catch (ErrorInfo info) { QString title = QTStr("Auth.ChannelFailure.Title"); QString text = QTStr("Auth.ChannelFailure.Text") - .arg(service(), info.message.c_str(), info.error.c_str()); + .arg(service(), info.message.c_str(), + info.error.c_str()); QMessageBox::warning(OBSBasic::Get(), title, text); - blog(LOG_WARNING, "%s: %s: %s", - __FUNCTION__, - info.message.c_str(), - info.error.c_str()); + blog(LOG_WARNING, "%s: %s: %s", __FUNCTION__, info.message.c_str(), + info.error.c_str()); return false; } @@ -114,14 +97,12 @@ { OBSBasic *main = OBSBasic::Get(); config_set_string(main->Config(), service(), "DockState", - main->saveState().toBase64().constData()); + main->saveState().toBase64().constData()); OAuthStreamKey::SaveInternal(); } -static inline std::string get_config_str( - OBSBasic *main, - const char *section, - const char *name) +static inline std::string get_config_str(OBSBasic *main, const char *section, + const char *name) { const char *val = config_get_string(main->Config(), section, name); return val ? val : ""; @@ -133,13 +114,6 @@ return OAuthStreamKey::LoadInternal(); } -class RestreamWidget : public QDockWidget { -public: - inline RestreamWidget() : QDockWidget() {} - - QScopedPointer<QCefWidget> widget; -}; - void RestreamAuth::LoadUI() { if (uiLoaded) @@ -161,7 +135,7 @@ QSize size = main->frameSize(); QPoint pos = main->pos(); - chat.reset(new RestreamWidget()); + chat.reset(new BrowserDock()); chat->setObjectName("restreamChat"); chat->resize(420, 600); chat->setMinimumSize(200, 300); @@ -169,7 +143,7 @@ chat->setAllowedAreas(Qt::AllDockWidgetAreas); browser = cef->create_widget(nullptr, url, panel_cookies); - chat->setWidget(browser); + chat->SetWidget(browser); main->addDockWidget(Qt::RightDockWidgetArea, chat.data()); chatMenu.reset(main->AddDockWidget(chat.data())); @@ -178,7 +152,7 @@ url = "https://restream.io/titles/embed"; - info.reset(new RestreamWidget()); + info.reset(new BrowserDock()); info->setObjectName("restreamInfo"); info->resize(410, 600); info->setMinimumSize(200, 150); @@ -186,25 +160,45 @@ info->setAllowedAreas(Qt::AllDockWidgetAreas); browser = cef->create_widget(nullptr, url, panel_cookies); - info->setWidget(browser); + info->SetWidget(browser); - main->addDockWidget(Qt::RightDockWidgetArea, info.data()); + main->addDockWidget(Qt::LeftDockWidgetArea, info.data()); infoMenu.reset(main->AddDockWidget(info.data())); /* ----------------------------------- */ + url = "https://restream.io/channel/embed"; + + channels.reset(new BrowserDock()); + channels->setObjectName("restreamChannel"); + channels->resize(410, 600); + channels->setMinimumSize(410, 300); + channels->setWindowTitle(QTStr("RestreamAuth.Channels")); + channels->setAllowedAreas(Qt::AllDockWidgetAreas); + + browser = cef->create_widget(nullptr, url, panel_cookies); + channels->SetWidget(browser); + + main->addDockWidget(Qt::LeftDockWidgetArea, channels.data()); + channelMenu.reset(main->AddDockWidget(channels.data())); + + /* ----------------------------------- */ + chat->setFloating(true); info->setFloating(true); - chat->move(pos.x() + size.width() - chat->width() - 50, pos.y() + 50); - info->move(pos.x() + 40, pos.y() + 50); + channels->setFloating(true); + + chat->move(pos.x() + size.width() - chat->width() - 30, pos.y() + 60); + info->move(pos.x() + 20, pos.y() + 60); + channels->move(pos.x() + 20 + info->width() + 10, pos.y() + 60); if (firstLoad) { chat->setVisible(true); info->setVisible(true); - } - else { - const char *dockStateStr = config_get_string(main->Config(), - service(), "DockState"); + channels->setVisible(true); + } else { + const char *dockStateStr = config_get_string( + main->Config(), service(), "DockState"); QByteArray dockState = QByteArray::fromBase64(QByteArray(dockStateStr)); main->restoreState(dockState); @@ -227,8 +221,7 @@ std::string client_id = RESTREAM_CLIENTID; deobfuscate_str(&client_id[0], RESTREAM_HASH); - return GetToken(RESTREAM_TOKEN_URL, client_id, - RESTREAM_SCOPE_VERSION, + return GetToken(RESTREAM_TOKEN_URL, client_id, RESTREAM_SCOPE_VERSION, QT_TO_UTF8(login.GetCode()), true); } @@ -248,8 +241,8 @@ deobfuscate_str(&client_id[0], RESTREAM_HASH); if (!auth->GetToken(RESTREAM_TOKEN_URL, client_id, - RESTREAM_SCOPE_VERSION, - QT_TO_UTF8(login.GetCode()))) { + RESTREAM_SCOPE_VERSION, + QT_TO_UTF8(login.GetCode()))) { return nullptr; } @@ -275,9 +268,6 @@ void RegisterRestreamAuth() { - OAuth::RegisterOAuth( - restreamDef, - CreateRestreamAuth, - RestreamAuth::Login, - DeleteCookies); + OAuth::RegisterOAuth(restreamDef, CreateRestreamAuth, + RestreamAuth::Login, DeleteCookies); }
View file
obs-studio-23.2.1.tar.xz/UI/auth-restream.hpp -> obs-studio-24.0.0.tar.xz/UI/auth-restream.hpp
Changed
@@ -2,15 +2,19 @@ #include "auth-oauth.hpp" -class RestreamWidget; +class BrowserDock; class RestreamAuth : public OAuthStreamKey { Q_OBJECT - QSharedPointer<RestreamWidget> chat; - QSharedPointer<RestreamWidget> info; + QSharedPointer<BrowserDock> chat; + QSharedPointer<BrowserDock> info; + QSharedPointer<BrowserDock> channels; + QSharedPointer<QAction> chatMenu; QSharedPointer<QAction> infoMenu; + QSharedPointer<QAction> channelMenu; + bool uiLoaded = false; virtual bool RetryLogin() override;
View file
obs-studio-23.2.1.tar.xz/UI/auth-twitch.cpp -> obs-studio-24.0.0.tar.xz/UI/auth-twitch.cpp
Changed
@@ -7,9 +7,9 @@ #include <qt-wrappers.hpp> #include <obs-app.hpp> +#include "window-dock-browser.hpp" #include "window-basic-main.hpp" #include "remote-text.hpp" -#include "window-dock.hpp" #include <json11.hpp> @@ -18,41 +18,30 @@ using namespace json11; -#include <browser-panel.hpp> -extern QCef *cef; -extern QCefCookieManager *panel_cookies; - /* ------------------------------------------------------------------------- */ -#define TWITCH_AUTH_URL \ - "https://obsproject.com/app-auth/twitch?action=redirect" -#define TWITCH_TOKEN_URL \ - "https://obsproject.com/app-auth/twitch-token" -#define ACCEPT_HEADER \ - "Accept: application/vnd.twitchtv.v5+json" +#define TWITCH_AUTH_URL "https://obsproject.com/app-auth/twitch?action=redirect" +#define TWITCH_TOKEN_URL "https://obsproject.com/app-auth/twitch-token" +#define ACCEPT_HEADER "Accept: application/vnd.twitchtv.v5+json" #define TWITCH_SCOPE_VERSION 1 -static Auth::Def twitchDef = { - "Twitch", - Auth::Type::OAuth_StreamKey -}; +static Auth::Def twitchDef = {"Twitch", Auth::Type::OAuth_StreamKey}; /* ------------------------------------------------------------------------- */ -TwitchAuth::TwitchAuth(const Def &d) - : OAuthStreamKey(d) +TwitchAuth::TwitchAuth(const Def &d) : OAuthStreamKey(d) { if (!cef) return; cef->add_popup_whitelist_url( - "https://twitch.tv/popout/frankerfacez/chat?ffz-settings", - this); + "https://twitch.tv/popout/frankerfacez/chat?ffz-settings", + this); uiLoadTimer.setSingleShot(true); uiLoadTimer.setInterval(500); - connect(&uiLoadTimer, &QTimer::timeout, - this, &TwitchAuth::TryLoadSecondaryUIPanes); + connect(&uiLoadTimer, &QTimer::timeout, this, + &TwitchAuth::TryLoadSecondaryUIPanes); } bool TwitchAuth::GetChannelInfo() @@ -82,33 +71,25 @@ bool success = false; - auto func = [&] () { - success = GetRemoteFile( - "https://api.twitch.tv/kraken/channel", - output, - error, - &error_code, - "application/json", - nullptr, - headers, - nullptr, - 5); + auto func = [&]() { + success = GetRemoteFile("https://api.twitch.tv/kraken/channel", + output, error, &error_code, + "application/json", nullptr, headers, + nullptr, 5); }; ExecThreadedWithoutBlocking( - func, - QTStr("Auth.LoadingChannel.Title"), - QTStr("Auth.LoadingChannel.Text").arg(service())); + func, QTStr("Auth.LoadingChannel.Title"), + QTStr("Auth.LoadingChannel.Text").arg(service())); if (error_code == 403) { OBSMessageBox::warning(OBSBasic::Get(), - Str("TwitchAuth.TwoFactorFail.Title"), - Str("TwitchAuth.TwoFactorFail.Text"), - true); - blog(LOG_WARNING, "%s: %s", - __FUNCTION__, - "Got 403 from Twitch, user probably does not " - "have two-factor authentication enabled on " - "their account"); + Str("TwitchAuth.TwoFactorFail.Title"), + Str("TwitchAuth.TwoFactorFail.Text"), + true); + blog(LOG_WARNING, "%s: %s", __FUNCTION__, + "Got 403 from Twitch, user probably does not " + "have two-factor authentication enabled on " + "their account"); return false; } @@ -125,10 +106,10 @@ if (RetryLogin()) { return GetChannelInfo(); } - throw ErrorInfo(error, - json["message"].string_value()); + throw ErrorInfo(error, json["message"].string_value()); } - throw ErrorInfo(error, json["error_description"].string_value()); + throw ErrorInfo(error, + json["error_description"].string_value()); } name = json["name"].string_value(); @@ -138,14 +119,13 @@ } catch (ErrorInfo info) { QString title = QTStr("Auth.ChannelFailure.Title"); QString text = QTStr("Auth.ChannelFailure.Text") - .arg(service(), info.message.c_str(), info.error.c_str()); + .arg(service(), info.message.c_str(), + info.error.c_str()); QMessageBox::warning(OBSBasic::Get(), title, text); - blog(LOG_WARNING, "%s: %s: %s", - __FUNCTION__, - info.message.c_str(), - info.error.c_str()); + blog(LOG_WARNING, "%s: %s: %s", __FUNCTION__, info.message.c_str(), + info.error.c_str()); return false; } @@ -155,15 +135,13 @@ config_set_string(main->Config(), service(), "Name", name.c_str()); if (uiLoaded) { config_set_string(main->Config(), service(), "DockState", - main->saveState().toBase64().constData()); + main->saveState().toBase64().constData()); } OAuthStreamKey::SaveInternal(); } -static inline std::string get_config_str( - OBSBasic *main, - const char *section, - const char *name) +static inline std::string get_config_str(OBSBasic *main, const char *section, + const char *name) { const char *val = config_get_string(main->Config(), section, name); return val ? val : ""; @@ -180,19 +158,6 @@ return OAuthStreamKey::LoadInternal(); } -class TwitchWidget : public OBSDock { -public: - inline TwitchWidget() : OBSDock() {} - - QScopedPointer<QCefWidget> widget; - - inline void SetWidget(QCefWidget *widget_) - { - setWidget(widget_); - widget.reset(widget_); - } -}; - static const char *ffz_script = "\ var ffz = document.createElement('script');\ ffz.setAttribute('src','https://cdn.frankerfacez.com/script/script.min.js');\ @@ -240,7 +205,7 @@ QSize size = main->frameSize(); QPoint pos = main->pos(); - chat.reset(new TwitchWidget()); + chat.reset(new BrowserDock()); chat->setObjectName("twitchChat"); chat->resize(300, 600); chat->setMinimumSize(200, 300); @@ -266,8 +231,8 @@ if (firstLoad) { chat->setVisible(true); } else { - const char *dockStateStr = config_get_string(main->Config(), - service(), "DockState"); + const char *dockStateStr = config_get_string( + main->Config(), service(), "DockState"); QByteArray dockState = QByteArray::fromBase64(QByteArray(dockStateStr)); main->restoreState(dockState); @@ -304,7 +269,7 @@ url += name; url += "/dashboard/live/stream-info"; - info.reset(new TwitchWidget()); + info.reset(new BrowserDock()); info->setObjectName("twitchInfo"); info->resize(300, 650); info->setMinimumSize(200, 300); @@ -324,7 +289,7 @@ url += name; url += "/dashboard/live/stats"; - stat.reset(new TwitchWidget()); + stat.reset(new BrowserDock()); stat->setObjectName("twitchStats"); stat->resize(200, 250); stat->setMinimumSize(200, 150); @@ -344,7 +309,7 @@ url += name; url += "/dashboard/live/activity-feed"; - feed.reset(new TwitchWidget()); + feed.reset(new BrowserDock()); feed->setObjectName("twitchFeed"); feed->resize(300, 650); feed->setMinimumSize(200, 300); @@ -367,8 +332,8 @@ QSize statSize = stat->frameSize(); info->move(pos.x() + 50, pos.y() + 50); - stat->move(pos.x() + size.width() / 2 - statSize.width() / 2, - pos.y() + size.height() / 2 - statSize.height() / 2); + stat->move(pos.x() + size.width() / 2 - statSize.width() / 2, + pos.y() + size.height() / 2 - statSize.height() / 2); feed->move(pos.x() + 100, pos.y() + 100); if (firstLoad) { @@ -376,15 +341,15 @@ stat->setVisible(false); feed->setVisible(false); } else { - uint32_t lastVersion = config_get_int(App()->GlobalConfig(), "General", - "LastVersion"); + uint32_t lastVersion = config_get_int(App()->GlobalConfig(), + "General", "LastVersion"); if (lastVersion <= MAKE_SEMANTIC_VERSION(23, 0, 2)) { feed->setVisible(false); } - const char *dockStateStr = config_get_string(main->Config(), - service(), "DockState"); + const char *dockStateStr = config_get_string( + main->Config(), service(), "DockState"); QByteArray dockState = QByteArray::fromBase64(QByteArray(dockStateStr)); main->restoreState(dockState); @@ -405,21 +370,21 @@ { QPointer<TwitchAuth> this_ = this; - auto cb = [this_] (bool found) - { + auto cb = [this_](bool found) { if (!this_) { return; } if (!found) { - QMetaObject::invokeMethod(&this_->uiLoadTimer, - "start"); + QMetaObject::invokeMethod(&this_->uiLoadTimer, "start"); } else { - QMetaObject::invokeMethod(this_, "LoadSecondaryUIPanes"); + QMetaObject::invokeMethod(this_, + "LoadSecondaryUIPanes"); } }; - panel_cookies->CheckForCookie("https://www.twitch.tv", "auth-token", cb); + panel_cookies->CheckForCookie("https://www.twitch.tv", "auth-token", + cb); } bool TwitchAuth::RetryLogin() @@ -429,7 +394,8 @@ return false; } - std::shared_ptr<TwitchAuth> auth = std::make_shared<TwitchAuth>(twitchDef); + std::shared_ptr<TwitchAuth> auth = + std::make_shared<TwitchAuth>(twitchDef); std::string client_id = TWITCH_CLIENTID; deobfuscate_str(&client_id[0], TWITCH_HASH); @@ -444,13 +410,14 @@ return nullptr; } - std::shared_ptr<TwitchAuth> auth = std::make_shared<TwitchAuth>(twitchDef); + std::shared_ptr<TwitchAuth> auth = + std::make_shared<TwitchAuth>(twitchDef); std::string client_id = TWITCH_CLIENTID; deobfuscate_str(&client_id[0], TWITCH_HASH); if (!auth->GetToken(TWITCH_TOKEN_URL, client_id, TWITCH_SCOPE_VERSION, - QT_TO_UTF8(login.GetCode()))) { + QT_TO_UTF8(login.GetCode()))) { return nullptr; } @@ -475,9 +442,6 @@ void RegisterTwitchAuth() { - OAuth::RegisterOAuth( - twitchDef, - CreateTwitchAuth, - TwitchAuth::Login, - DeleteCookies); + OAuth::RegisterOAuth(twitchDef, CreateTwitchAuth, TwitchAuth::Login, + DeleteCookies); }
View file
obs-studio-23.2.1.tar.xz/UI/auth-twitch.hpp -> obs-studio-24.0.0.tar.xz/UI/auth-twitch.hpp
Changed
@@ -7,17 +7,17 @@ #include "auth-oauth.hpp" -class TwitchWidget; +class BrowserDock; class TwitchAuth : public OAuthStreamKey { Q_OBJECT friend class TwitchLogin; - QSharedPointer<TwitchWidget> chat; - QSharedPointer<TwitchWidget> info; - QSharedPointer<TwitchWidget> stat; - QSharedPointer<TwitchWidget> feed; + QSharedPointer<BrowserDock> chat; + QSharedPointer<BrowserDock> info; + QSharedPointer<BrowserDock> stat; + QSharedPointer<BrowserDock> feed; QSharedPointer<QAction> chatMenu; QSharedPointer<QAction> infoMenu; QSharedPointer<QAction> statMenu;
View file
obs-studio-23.2.1.tar.xz/UI/clickable-label.hpp -> obs-studio-24.0.0.tar.xz/UI/clickable-label.hpp
Changed
@@ -4,7 +4,7 @@ #include <QMouseEvent> class ClickableLabel : public QLabel { - Q_OBJECT + Q_OBJECT public: inline ClickableLabel(QWidget *parent = 0) : QLabel(parent) {}
View file
obs-studio-23.2.1.tar.xz/UI/crash-report.cpp -> obs-studio-24.0.0.tar.xz/UI/crash-report.cpp
Changed
@@ -32,10 +32,10 @@ setLayout(mainLayout); - QWidget::connect(copyButton, SIGNAL(clicked()), - this, SLOT(CopyClicked())); - QWidget::connect(exitButton, SIGNAL(clicked()), - this, SLOT(ExitClicked())); + QWidget::connect(copyButton, SIGNAL(clicked()), this, + SLOT(CopyClicked())); + QWidget::connect(exitButton, SIGNAL(clicked()), this, + SLOT(ExitClicked())); resize(800, 600); setWindowTitle("Oops, OBS has crashed!");
View file
obs-studio-23.2.1.tar.xz/UI/data/locale.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale.ini
Changed
@@ -162,3 +162,6 @@ [pa-IN] Name=ਪੰਜਾਬੀ + +[az-Az] +Name=Azərbaycanca
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/af-ZA.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/af-ZA.ini
Changed
@@ -1,17 +1,23 @@ +Language="Engels" -OK="OK" -Apply="Pas veranderinge toe" -Cancel="Kanselleer" +OK="Ok" Close="Maak toe" Save="Stoor" -Discard="Gooi weg" -Disable="Deaktiveer" Yes="Ja" No="Nee" -Add="Voeg by" -Remove="Verwyder" -Rename="Hernoem" +Name="Naam" +New="Nuwe" +Left="Links" +Top="Bo" + + + + + + + +
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ar-SA.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ar-SA.ini
Changed
@@ -23,7 +23,7 @@ Display="شاشة العرض" Name="الاسم" Exit="خروج" -Mixer="مختلط" +Mixer="مِكْسَر الصوت" Browse="استعراض" Mono="صوت أحادي القناة \"مونو\"" Stereo="صوت ثنائي القناة \"ستيريو\"" @@ -84,13 +84,12 @@ Default="(الافتراضي)" Calculating="جاري حساب الوقت..." -AlreadyRunning.Title="البرنامج قيد التشغيل بالفعل" -AlreadyRunning.Text="أوبس قيد التشغيل بالفعل! إلا إذا كنت تريد القيام بذلك، يرجى إيقاف أية مثيلات موجودة من للبرنامج قبل محاولة تشغيله من جديد. إذا كان لديك أوبس تعيين لتقليل إلى علبة النظام، يرجى التحقق لمعرفة ما إذا كان لا يزال قيد التشغيل هناك." AlreadyRunning.LaunchAnyway="إطلاق على أي حال" DockCloseWarning.Title="إغلاق إطار قابل للإرساء" DockCloseWarning.Text="لقد قمت بإغلاق إطار قابل للإرساء. إذا كنت ترغب في إظهاره مرة أخرى، استخدم قائمة عرض ← أرصفة من شريط القوائم." + Auth.Authing.Title="جاري المصادقة..." Auth.Authing.Text="جارٍ المصادقة مع %1, الرجاء الانتظار..." Auth.AuthFailure.Title="فشل المصادقة" @@ -105,6 +104,8 @@ Auth.StreamInfo="معلومات البث" TwitchAuth.Stats="إحصائيات Twitch" TwitchAuth.TwoFactorFail.Title="لم نتمكن من الاستعلام عن مفتاح البث" +TwitchAuth.TwoFactorFail.Text="OBS غير قادر على الربط بحسابك التويتش. الرجاء التأكد من اعداد المصادقة الثنائية في <a href='https://www.twitch.tv/settings/security'>إعدادات أمان تويتش</a> لأنه أحد المتطلبات للتمكن من البث." +RestreamAuth.Channels="قنوات Restream" Copy.Filters="نسخ الفلتر" Paste.Filters="لصق الفلتر" @@ -137,7 +138,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="ملاحظة: قرار قاعدة (قاعدة) ليس بالضرورة يكون بنفس دقة البث أو التسجيل. قد يتم تصغير حجم تدفق البث/ دقة التسجيل أقل من دقة القاعدة لتقليل استخدام الموارد أو متطلبات معدل البت." Basic.AutoConfig.StreamPage="معلومات البث" Basic.AutoConfig.StreamPage.SubTitle="من فضلك ادخل معلومات الخادم أو السيرفر" -Basic.AutoConfig.StreamPage.ConnectAccount="تسجيل الدخول إلى قناتك (اختياري)" +Basic.AutoConfig.StreamPage.ConnectAccount="ربط الحساب (مستحسن)" Basic.AutoConfig.StreamPage.DisconnectAccount="إلغاء ربط الحساب" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="إلغاء ربط الحساب؟" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="هذا التغيير سيتم تطبيقه مباشرة. هل أنت متأكد من أنك تريد إلغاء ربط حسابك؟" @@ -238,6 +239,9 @@ ConfirmStop.Title="ايقاف البث؟" ConfirmStop.Text="هل أنت متأكد انك تريد ايقاف البث؟" +ConfirmStopRecord.Title="إيقاف التسجيل؟" +ConfirmStopRecord.Text="هل متأكد أنك تريد إيقاف التسجيل ؟" + ConfirmBWTest.Title="بدء فحص سرعة التدفق؟" ConfirmBWTest.Text="OBS لديك معد في وضع فحص تدفق السرعة. هذا الوضع يسمح لك بفحص الشبكة بدون ان تظهر في بث مباشر على قناتك. بمجرد انتهاء الفحص يجب عليك تعطيله لكي يستطيع مشاهدوك من رؤية البث.\n\nهل تريد الاستمرار ؟" @@ -253,6 +257,8 @@ Output.StartReplayFailed="فشل بدء التخزين المؤقت للإعادة" Output.StartFailedGeneric="فشل بدء الإخراج. الرجاء مراجعة السجل للتفاصيل.\n\nملاحظة: اذا كنت تستخدم مُرَمِز NVENC أو مُرَمِز AMD, تأكد من أن تعريف بطاقة الشاشة لديك محدَّث." +Output.ReplayBuffer.PauseWarning.Title="لا يمكن حفظ الإعادات اثناء التوقف المؤقت" +Output.ReplayBuffer.PauseWarning.Text="تحذير: لا يمكن حفظ الإعادات اثناء توقيف التسجيل مؤقتاً." Output.ConnectFail.Title="فشل في الاتصال" Output.ConnectFail.BadPath="مسار أو رابط الاتصال غير صالح. الرجاء التحقق من الإعدادات للتحقق من كونه صالح." @@ -290,6 +296,7 @@ Remux.FinishedTitle="انتهت عملية تحويل الصيغة" Remux.Finished="تسجيل عملية تحويل الصيغة" Remux.FinishedError="عملية التحويل قد تكون غير مكتملة" +Remux.SelectTarget="حدد الملف الوُّجهة..." Remux.FileExistsTitle="الملف الهدف موجود" Remux.FileExists="الملفات التالية موجودة فعليا. هل ترغب في استبدالها؟" Remux.ExitUnfinishedTitle="تقدم عملية التحويل" @@ -523,7 +530,6 @@ Basic.Settings.Output.VideoBitrate="معدل البت للفيديو" Basic.Settings.Output.AudioBitrate="معدل البت للصوت" Basic.Settings.Output.Reconnect="إعادة الاتصال تلقائياً" -Basic.Settings.Output.RetryDelay="إعادة محاولة تأخير (ثوان)" Basic.Settings.Output.MaxRetries="أقصى عدد للمحاولات"
View file
obs-studio-24.0.0.tar.xz/UI/data/locale/az-AZ.ini
Added
@@ -0,0 +1,150 @@ + +Language="Azərbaycanca" +Region="Azərbaycan" + +OK="Oldu" +Apply="Tətbiq et" +Cancel="İmtina" +Close="Bağla" +Save="Saxla" +Discard="Ləğv et" +Disable="Sıradan çıxart" +Yes="Bəli" +No="Xeyr" +Add="Əlavə et" +Remove="Çıxart" +Rename="Yenidən adlandır" +Interact="Qarşılıqlı təsir" +Filters="Filtrlər" +Properties="Xüsusiyyətlər" +MoveUp="Yuxarı Köçür" +MoveDown="Aşağı Köçür" +Settings="Tənzimləmələr" +Display="Ekran" +Name="Ad" +Exit="Çıxış" +Browse="Gözdən keçir" +Mono="Mono" +Stereo="Stereo" +DroppedFrames="Buraxılan Kadrlar %1 (%2%)" +StudioProgramProjector="Tam Ekran Projektoru (Proqram)" +PreviewProjector="Tam Ekran Projektoru (Önbaxış)" +SceneProjector="Tam Ekran Projektoru (Səhnə)" +SourceProjector="Tam Ekran Projektoru (Mənbə)" +StudioProgramWindow="Pəncərəli Projektor (Proqram)" +PreviewWindow="Pəncərəli Projektor (Önbaxış)" +SceneWindow="Pəncərəli Projektor (Səhnə)" +SourceWindow="Pəncərəli Projektor (Mənbə)" +MultiviewProjector="Çoxlu baxış (Tam ekran)" +MultiviewWindowed="Çoxlu baxış (Pəncərəli)" +Clear="Təmizlə" +Revert="Geri qaytar" +Show="Göstər" +Hide="Gizlət" +UnhideAll="Hamısını Göstər" +Untitled="Adsız" +New="Yeni" +Duplicate="Çoxalt" +Enable="Fəallaşdır" +DisableOSXVSync="OSX V-Sync-i sıradan çıxart" +ResetOSXVSyncOnExit="OSX V-Sync-i Çıxışda Sıfırla" +HighResourceUsage="Kodlama həddindən artıq yükləndi! Video tənzimləmələrini azaltmağı və ya daha sürətli kodlama ön tənzimini istifadə etməyi düşünün." + + + + +TwitchAuth.Feed="Twitch Fəaliyyət Axını" + +Copy.Filters="Filtrləri Kopyala" +Paste.Filters="Filtrləri Yapışdır" + +BrowserPanelInit.Title="Səyyah Başladılır..." + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/bg-BG.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/bg-BG.ini
Changed
@@ -23,7 +23,7 @@ Display="Дисплей" Name="Име" Exit="Изход" -Mixer="Миксер" +Mixer="Звуков смесител" Browse="Преглед" Mono="Моно" Stereo="Стерео" @@ -68,7 +68,7 @@ Paste="Постави" PasteReference="Постави (препратка)" PasteDuplicate="Постави (дубликат)" -RemuxRecordings="Конвертиране на запаиси" +RemuxRecordings="Ремултиплексирани записи" Next="Напред" Back="Назад" Defaults="По подразбиране" @@ -80,17 +80,25 @@ ShowInMultiview="Покажи във Множествен изглед" VerticalLayout="Вертикално разположение" Group="Група" +DoNotShowAgain="Без ново показване" +Default="(По подразбиране)" +Calculating="Калкулира се..." AlreadyRunning.Title="OBS вече се изпълнява" AlreadyRunning.Text="OBS вече е включен! Освен ако не е по желание, моля изключете другите работещи инстанции на OBS преди да включите нова. Ако сте настроили OBS да се минимизира във системната табла, моля проверете дали все още е включен там." AlreadyRunning.LaunchAnyway="Включи въпреки това" + Auth.Chat="Чат" +Auth.StreamInfo="Информация за потока" +TwitchAuth.Stats="Статистика за Twitch" +RestreamAuth.Channels="Канали Restream" Copy.Filters="Копирай Филтъри" Paste.Filters="Постави Филтъри" +BrowserPanelInit.Title="Установяване на първонач. състояние на браузъра..." BandwidthTest.Region="Регион" BandwidthTest.Region.US="САЩ" @@ -146,6 +154,7 @@ Basic.Stats="Статистика" Basic.Stats.CPUUsage="Използване на централния процесор" +Basic.Stats.HDDSpaceAvailable="Свободно място на диска" Basic.Stats.MemoryUsage="Използване на паметта" Basic.Stats.AverageTimeToRender="Средно време за рендиране на кадър" Basic.Stats.SkippedFrames="Изпуснати кадри заради забавяне във кодирането" @@ -160,6 +169,7 @@ Basic.Stats.DroppedFrames="Изпуснати Кадри (Мрежа)" Basic.Stats.MegabytesSent="Общо количество изпратени данни" Basic.Stats.Bitrate="Битрейт" +Basic.Stats.DiskFullIn="Дискът е пълен за (около)" Updater.Title="Има нова актуализация" @@ -207,6 +217,9 @@ ConfirmStop.Title="Спри излъчването?" ConfirmStop.Text="Сигурни ли сте че искате да спрете предаването?" +ConfirmStopRecord.Title="Спирате ли записването?" +ConfirmStopRecord.Text="Наистина ли искате да спрете записването?" + ConfirmExit.Title="Изход от OBS?" ConfirmExit.Text="OBS във момента е активен. Всички предавания/записи ще бъдат изключени. Сигурни ли сте че искате да излезнете от програмата?" @@ -247,18 +260,21 @@ Remux.SourceFile="OBS запис" Remux.TargetFile="Целеви файл" -Remux.Remux="Конвертиране" +Remux.Remux="Ремултиплексиране" +Remux.Stop="Стоп на ремултиплексирането" Remux.ClearFinished="Изчисти готовите елементи" Remux.ClearAll="Изчисти всички елементи" Remux.OBSRecording="OBS запис" -Remux.FinishedTitle="Конвертирането завърши" -Remux.Finished="Записът е конвертиран" -Remux.FinishedError="Записът е конвертиран, но файлът може да бъде незавършен" +Remux.FinishedTitle="Ремултиплексирането завърши" +Remux.Finished="Записването е ремултиплексирано" +Remux.FinishedError="Записването е ремултиплексирано, но файлът може да е непълен" +Remux.SelectRecording="Избиране на OBS запис..." +Remux.SelectTarget="Изберете целеви файл..." Remux.FileExistsTitle="Целевите файлове съществуват" Remux.FileExists="Следните целеви файлове вече съществуват. Желаете ли да ги замените?" -Remux.ExitUnfinishedTitle="Конвертиране в ход" -Remux.ExitUnfinished="Конвертирането не е завършено все още, ако го спрете сега файлът може да бъде неизползваем.\nСигурни ли сте, че искате да спрете конвертирането?" -Remux.HelpText="Пуснете файловете чрез влачене в този прозорец, за да ги преобразувате или изберете празна \"OBS Recording\" клетка, за да отворите прозореца за търсене на файл." +Remux.ExitUnfinishedTitle="Ремултиплексира се" +Remux.ExitUnfinished="Конвертирането не е завършено все още, ако го спрете сега файлът може да бъде неизползваем.\nНаистина ли искате да спрете ремултиплексирането?" +Remux.HelpText="Пуснете файловете чрез провлачване в този прозорец, за да ги ремултиплексирате или изберете празната клетка \"OBS запис\" за избор на файл." UpdateAvailable="Има нова актуализация" UpdateAvailable.Text="Версия %1.%2.%3 е налична. <a href='%4'> Щракнете тук, за да изтеглите</a>" @@ -415,7 +431,7 @@ Basic.MainMenu.File.Export="Експортиране (&E)" Basic.MainMenu.File.Import="Импортиране (&I)" Basic.MainMenu.File.ShowRecordings="Покажи Записите (&R)" -Basic.MainMenu.File.Remux="Прекодиране на Записите (&M)" +Basic.MainMenu.File.Remux="Ремултиплексирани записи" Basic.MainMenu.File.Settings="Настройки (&S)" Basic.MainMenu.File.ShowSettingsFolder="Покажи папката с Настройки" Basic.MainMenu.File.ShowProfileFolder="Покажи папката със Профили" @@ -545,7 +561,6 @@ Basic.Settings.Output.Mode.Adv="Допълнителни настройки" Basic.Settings.Output.Mode.FFmpeg="FFmpeg изходен формат" Basic.Settings.Output.UseReplayBuffer="Включване на Буферa за Повторение" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Максимално време на повторение (Секунди)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Максимална Памет (Мегабайти)" Basic.Settings.Output.ReplayBuffer.Estimate="Приблизително използвана памет: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Не може да се определи използваната памет. Моля нстройте максималния лимит за паметта." @@ -572,7 +587,6 @@ Basic.Settings.Output.VideoBitrate="Видео битрейт" Basic.Settings.Output.AudioBitrate="Аудио битрейт" Basic.Settings.Output.Reconnect="Автоматично повторно свързване" -Basic.Settings.Output.RetryDelay="Отлагане на повторно свързване (секунди)" Basic.Settings.Output.MaxRetries="Максимален брой повторни опити" Basic.Settings.Output.Advanced="Включи Допълнителни Настройки за Енкодера" Basic.Settings.Output.CustomEncoderSettings="Допълнителни Настройки на Енкодера" @@ -641,11 +655,12 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Двулинеен (Най-бърз, но замазан след усъразмеряване)" Basic.Settings.Video.DownscaleFilter.Bicubic="Двукубичен (Изострено при усъразмеряване, 16 семпли)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Изострено при усъразмеряване, 32 семпли)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Изострено при усъразмеряване, 36 семпли)" Basic.Settings.Audio="Аудио" Basic.Settings.Audio.SampleRate="Честота на дискретизацията" Basic.Settings.Audio.Channels="Канали" +Basic.Settings.Audio.Meters="Измерватели" Basic.Settings.Audio.MeterDecayRate.Fast="Бързо" Basic.Settings.Audio.MeterDecayRate.Medium="Средно (ТИП I PPM)" Basic.Settings.Audio.MeterDecayRate.Slow="Бавно (Type II PPM)" @@ -653,9 +668,10 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Образец на върха" Basic.Settings.Audio.PeakMeterType.TruePeak="Истински връх (По-високо използване на CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="ПРЕДУПРЕЖДЕНИЕ: Включен е Surround sound." -Basic.Settings.Audio.MultichannelWarning="Ако предавате, проверете дали вашата услуга за стрийминг поддържа едновременно приемане на съраунд звук и възпроизвеждане на съраунд звук. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast са примери, при които съраунд звукът е напълно поддържан. Въпреки че, Facebook Live и YouTube Live подържат и приемат съраунд, Facebook Live пемиксира към стерео звук, а YouTube Live възпроизвежда само два канала.\n\nЗвуковите филтъри на OBS подържат съраунд звук, въпреки това VST поддръжката не е гарантирана." +Basic.Settings.Audio.MultichannelWarning="Ако предавате, проверете дали вашата услуга за стрийминг поддържа едновременно приемане на съраунд звук и възпроизвеждане на съраунд звук. Facebook 360 Live, Mixer RTMP, Smashcast са примери, при които съраунд звукът е напълно поддържан. Въпреки че, Facebook Live и YouTube Live подържат и приемат съраунд, Facebook Live пемиксира към стерео звук, а YouTube Live възпроизвежда само два канала.\n\nЗвуковите филтъри на OBS подържат съраунд звук, въпреки това VST поддръжката не е гарантирана." Basic.Settings.Audio.MultichannelWarning.Title="Включи записването на съраунд звук?" Basic.Settings.Audio.MultichannelWarning.Confirm="Сигурни ли сте че искате да включите записването на съраунд звук?" +Basic.Settings.Audio.Devices="Устройства" Basic.Settings.Audio.EnablePushToMute="Включи Натисни-за-да-заглуши" Basic.Settings.Audio.PushToMuteDelay="Натисни-за-да-заглуши забавяне" Basic.Settings.Audio.EnablePushToTalk="Включи Натисни-за-говорене" @@ -673,12 +689,15 @@ Basic.Settings.Advanced.FormatWarning="Предупреждение: Цветните формати освен NV12 се ползват главно при записи и не са препоръчани при предаване. Предаването може да упражни завишено ползване на Процесора поради прекодиране на форматите." Basic.Settings.Advanced.Audio.BufferingTime="Време за буфериране на звук" Basic.Settings.Advanced.Video.ColorFormat="Формат на цвета" +Basic.Settings.Advanced.Video.ColorSpace="Цветово пространство" +Basic.Settings.Advanced.Video.ColorRange="Цветови обхват" Basic.Settings.Advanced.Video.ColorRange.Partial="Частично" Basic.Settings.Advanced.Video.ColorRange.Full="Пълен" +Basic.Settings.Advanced.Audio.MonitoringDevice="Устройство за наблюдение" Basic.Settings.Advanced.Audio.MonitoringDevice.Default="По подразбиране" Basic.Settings.Advanced.Audio.DisableAudioDucking="Изключи намалянето на звука при разговори" Basic.Settings.Advanced.StreamDelay="Забавяне на Предаването" -Basic.Settings.Advanced.StreamDelay.Duration="Продължителност (секунди)" +Basic.Settings.Advanced.StreamDelay.Duration="Времетраене" Basic.Settings.Advanced.StreamDelay.Preserve="Запази точката на прекъсване (увеличете забавянето) при повторно свързване" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Приблизително използвана памет: %1 MB" Basic.Settings.Advanced.Network="Мрежа" @@ -691,9 +710,10 @@ Basic.AdvAudio="Допълнителни Звукови Характеристики" Basic.AdvAudio.Name="Име" -Basic.AdvAudio.Mono="Премиксирай към Mono звук" +Basic.AdvAudio.Volume="Сила на звука" +Basic.AdvAudio.Mono="Моно" Basic.AdvAudio.Balance="Баланс" -Basic.AdvAudio.SyncOffset="Забавяне (мс)" +Basic.AdvAudio.SyncOffset="Синхронизиращо разклонение" Basic.AdvAudio.Monitoring="Звуков Мониториниг " Basic.AdvAudio.Monitoring.None="Мониторът Изключен" Basic.AdvAudio.Monitoring.MonitorOnly="Само на Монитора (заглуши изхода)" @@ -746,6 +766,7 @@ Hotkeys.AppleKeypadDecimal=". (Клавиатура)" Hotkeys.AppleKeypadEqual="= (Клавиатура)" Hotkeys.MouseButton="Мишка %1" +Hotkeys.Escape="Esc" Mute="Заглуши" Unmute="Включи звука" @@ -757,6 +778,7 @@ OutputWarnings.NoTracksSelected="Трябва да изберете поне една писта за звук" OutputWarnings.MultiTrackRecording="Предупреждение: Някои формати (като FLV) не подържат множествен брой на писти при запис" +OutputWarnings.MP4Recording="Предупреждение: Записи запаметени в MP4/MOV не могат да се възстановят, ако записът във файла не е приключил (в случай на спиране на програмата или при спиране на тока и т.н.). Ако искате да записвате на множество звукови писти ползвайте формат MKV и ремултиплексирайте записа в MP4/MOV след като приключи (от Файл->Ремултиплексирани записи)" FinalScene.Title="Изтрий Сцената" FinalScene.Text="Трябва да има поне една сцена във наличност." @@ -771,13 +793,16 @@ BrowserSource.EnableHardwareAcceleration="Позволи ускорение, чрез браузър" About="За програмата" -About.Info="OBS Studio е програма за видео запис и живи предавания с отворен код, разпространяваща се безплатно." +About.Info="OBS Studio е програма за видеозапис и видеопредаване на живо с отворен код, разпространяваща се безплатно." +About.Donate="Направете принос" About.GetInvolved="Включете се" About.Authors="Автори" About.License="Лиценз" +About.Contribute="Подкрепете проекта OBS" ResizeOutputSizeOfSource="Преоразмеряване изх. видео (по размер на източника)" ResizeOutputSizeOfSource.Text="Базата и изходната резолюция ще бъдат преоразмерени до размера на текущия източник." ResizeOutputSizeOfSource.Continue="Желаете ли да продължите?" +PreviewTransition="Предварителен преглед на прехода"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/bn-BD.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/bn-BD.ini
Changed
@@ -23,7 +23,6 @@ Display="প্রদর্শন" Name="নাম" Exit="প্রস্থান করুন" -Mixer="মিক্সার" Browse="ব্রাউজ" Mono="মোনো" Stereo="স্টিরিও" @@ -65,6 +64,7 @@ + Basic.AutoConfig.VideoPage="ভিডিও সেটিংস" @@ -116,6 +116,7 @@ ConfirmStop.Text="আপনি কি নিশ্চিত যে আপনি ধারা সূচনা করতে চান?" + ConfirmExit.Title="OBS প্রস্থান করুন?" ConfirmExit.Text="OBS বর্তমানে সক্রিয় আছে। সব নদী/রেকর্ডিং বন্ধ হয়ে যাবে। আপনি কি নিশ্চিত যে আপনি প্রস্থান করতে চান?" @@ -416,7 +417,6 @@ Basic.Settings.Output.Mode.Adv="অ্যাডভান্সড" Basic.Settings.Output.Mode.FFmpeg="FFmpeg উত্পাদন" Basic.Settings.Output.UseReplayBuffer="রিপ্লে বাফার সক্রিয় করা হবে" -Basic.Settings.Output.ReplayBuffer.SecondsMax="সর্বোচ্চ রিপ্লে সময় (সেকেন্ড)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="সর্বোচ্চ স্মৃতি (মেগাবাইট)" Basic.Settings.Output.ReplayBuffer.Estimate="ব্যবহার করা: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="স্মৃতি ব্যবহার অনুমান করতে পারে না। অনুগ্রহ করে স্মৃতি সর্বোচ্চ সীমা নির্ধারণ করুন." @@ -465,7 +465,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (সবচেয়ে দ্রুত, কিন্তু ঘোলাটে হলে স্কেল)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (Sharpened স্কেল, 16 নমুনা)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Sharpened স্কেল, 32 নমুনা)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Sharpened স্কেল, 36 নমুনা)" Basic.Settings.Audio="অডিও" Basic.Settings.Audio.SampleRate="নমুনা হার" @@ -489,7 +489,6 @@ Basic.Settings.Advanced.Video.ColorRange.Full="পূর্ণ" Basic.Settings.Advanced.Audio.MonitoringDevice.Default="পূর্ব-নির্ধারিত" Basic.Settings.Advanced.StreamDelay="স্ট্রিম বিলম্ব" -Basic.Settings.Advanced.StreamDelay.Duration="দৈর্ঘ্য (সেকেন্ড)" Basic.Settings.Advanced.StreamDelay.Preserve="বিরোধিতায় লিপ্ত পয়েন্ট (বাড়তে দেরি) সংরক্ষণের সময় পুনরায় সংযোগ করা হচ্ছে" Basic.AdvAudio.AudioTracks="ট্র্যাক"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ca-ES.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ca-ES.ini
Changed
@@ -23,7 +23,7 @@ Display="Pantalla" Name="Nom" Exit="Surt" -Mixer="Mesclador" +Mixer="Mesclador d'àudio" Browse="Navega" Mono="Mono" Stereo="Estèreo" @@ -91,6 +91,8 @@ DockCloseWarning.Title="Tancament de la finestra acoblada" DockCloseWarning.Text="Heu tancat una finestra acoblada. Si voleu que es mostri novament, utilitzeu l'opció Visualitza → Acoblador de la barra de menús." +ExtraBrowsers.Info="Afegiu contingut inserint un nom i l'URL i feu clic al botó Aplica o Tanca per obrir. Podeu afegir o suprimir contingut en qualsevol moment." + Auth.Authing.Title="S'està autenticant..." Auth.Authing.Text="S'està autenticant amb %1, espereu..." Auth.AuthFailure.Title="Error d'autenticació" @@ -107,6 +109,7 @@ TwitchAuth.Feed="Activitat del mur del Twitch" TwitchAuth.TwoFactorFail.Title="No s'ha pogut consultar la clau de la transmissió" TwitchAuth.TwoFactorFail.Text="L'OBS no ha pogut connectar amb el vostre compte del Twitch. Assegureu-vos que l'autenticació en 2 passos està habilitada a les <a href='https://www.twitch.tv/settings/security'>opcions de seguretat del Twitch</a>, atès que és un requeriment per retransmetre." +RestreamAuth.Channels="Canals al Restream" Copy.Filters="Copia els filtres" Paste.Filters="Enganxa els filtres" @@ -139,7 +142,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="La resolució del llenç (base) no és necessàriament la mateixa que la resolució de la transmissió o enregistrament. La resolució actual pot ser reduïda del llenç per reduir l'ús dels recursos o de la tassa de bits." Basic.AutoConfig.StreamPage="Informació de la transmissió" Basic.AutoConfig.StreamPage.SubTitle="Introduïu informació sobre la seva transmissió" -Basic.AutoConfig.StreamPage.ConnectAccount="Connecta un compte (opcional)" +Basic.AutoConfig.StreamPage.ConnectAccount="Connecteu-vos a un compte (recomanat)" Basic.AutoConfig.StreamPage.DisconnectAccount="Desconnecta el compte" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Voleu desconnectar el compte?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Aquest canvi s'aplicarà immediatament. Segur que voleu desconnectar el compte?" @@ -240,6 +243,9 @@ ConfirmStop.Title="Atura la transmissió?" ConfirmStop.Text="Està segur que desitja aturar la transmissió?" +ConfirmStopRecord.Title="Voleu aturar l'enregistrament?" +ConfirmStopRecord.Text="Segur que voleu aturar l'enregistrament?" + ConfirmBWTest.Title="Test d'amplada de banda" ConfirmBWTest.Text="Heu configurat l'OBS en mode Test d'amplada de banda. Aquest mode us permet analitzar la connexió sense cap retransmissió en directe. Una vegada finalitzada l'anàlisi, inhabiliteu aquest mode perquè el públic pugui veure la retransmissió.\n\nVoleu continuar?" @@ -255,6 +261,8 @@ Output.StartReplayFailed="No s'ha pogut iniciar la memòria intermèdia de reproducció" Output.StartFailedGeneric="Error en iniciar la sortida. Comproveu el registre per més detalls.\n\nAvís: Si utilitzeu els codificadors NVENC o AMD, assegureu-vos que els controladors de vídeo estan actualitzats." +Output.ReplayBuffer.PauseWarning.Title="No es poden desar les repeticions mentre estigui en pausa" +Output.ReplayBuffer.PauseWarning.Text="Advertència: No es poden desar les repeticions mentre la gravació estigui en pausa." Output.ConnectFail.Title="Error en connectar" Output.ConnectFail.BadPath="Ruta o adreça URL no vàlida. Si us plau, comproveu la configuració per confirmar que són vàlids." @@ -444,6 +452,8 @@ Basic.Main.StartReplayBuffer="Inicia la reproducció de la memòria intermèdia" Basic.Main.StartStreaming="Inicia la transmissió" Basic.Main.StopRecording="Atura l'enregistrament" +Basic.Main.PauseRecording="Pausa la gravació" +Basic.Main.UnpauseRecording="Reprèn la gravació" Basic.Main.StoppingRecording="Aturant l'enregistrament..." Basic.Main.StopReplayBuffer="Atura la reproducció de la memòria intermèdia" Basic.Main.StoppingReplayBuffer="S'està aturant la reproducció de la memòria intermèdia..." @@ -544,6 +554,7 @@ Basic.Settings.General.OpenStatsOnStartup="Obre el diàleg d'estadístiques a l'inici" Basic.Settings.General.WarnBeforeStartingStream="Mostra diàleg de confirmació quan s'iniciï una transmissió" Basic.Settings.General.WarnBeforeStoppingStream="Mostra diàleg de confirmació quan s'aturi una transmissió" +Basic.Settings.General.WarnBeforeStoppingRecord="Mostra un missatge de confirmació en aturar un enregistrament" Basic.Settings.General.Projectors="Projectors" Basic.Settings.General.HideProjectorCursor="Amaga el cursor sobre projectors" Basic.Settings.General.ProjectorAlwaysOnTop="Projectors sempre en la part superior" @@ -591,12 +602,15 @@ Basic.Settings.Output.SelectDirectory="Seleccioneu el directori de gravació" Basic.Settings.Output.SelectFile="Seleccioni l'arxiu de gravació" Basic.Settings.Output.EnforceBitrate="Forçar límits de tassa de bits al servei d'streaming" +Basic.Settings.Output.DynamicBitrate="Canvia dinàmicament la ràtio per manegar la saturació" +Basic.Settings.Output.DynamicBitrate.Beta="Canvia dinàmicament la ràtio per manegar la saturació (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="En comptes de perdre fotogrames per reduir la saturació, canvia dinàmicament la ràtio al vol.\n\nTingueu en compte que això pot incrementar el retard per als espectadors si hi ha cap saturació important.\nEn baixar la ràtio, pot trigar uns minuts a restaurar el valor original.\n\nActualment només suportat per a RTMP." Basic.Settings.Output.Mode="Mode de sortida" Basic.Settings.Output.Mode.Simple="Simple" Basic.Settings.Output.Mode.Adv="Avançat" Basic.Settings.Output.Mode.FFmpeg="Sortida FFmpeg" Basic.Settings.Output.UseReplayBuffer="Activa la reproducció de la memòria intermèdia" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Temps de reproducció màxim (segons)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Temps màxim de repetició" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Memòria màxima (MB)" Basic.Settings.Output.ReplayBuffer.Estimate="Ús aproximat de memòria: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="No es pot estimar l'ús de memòria. Establiu el límit màxim de memòria." @@ -611,6 +625,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Qualitat sense pèrdues, mida de l'arxiu molt gran" Basic.Settings.Output.Simple.Warn.VideoBitrate="ADVERTÈNCIA: La transmissió del vídeo s'establirà a %1, que és el límit superior per al servei de streaming actual. Si està segur que vol anar per sobre de %1, activi les opcions avançades del codificador i desactivi \"Forçar límits de tassa de bits al servei d'streaming\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="ADVERTÈNCIA: La transmissió d'àudio s'establirà a %1, que és el límit superior per al servei de streaming actual. Si està segur que vol anar per sobre de %1, activi les opcions avançades del codificador i desactivi \"Forçar límits de tassa de bits al servei d'streaming\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Atenció: No es poden pausar els enregistraments si la qualitat està configurada a «Mateixa que en directe»." Basic.Settings.Output.Simple.Warn.Encoder="Advertiment: Gravar amb un software codificador en una qualitat diferent que el directe requerirà ús de CPU addicional si el directe i la gravació es fan a la vegada." Basic.Settings.Output.Simple.Warn.Lossless="Advertiment: La qualitat sense pèrdues genera mides d'arxiu gegantines! La qualitat sense pèrdues pot utilitzar un total de 7 gigabytes d'espai de disc per minut a alta resolució i FPS. Aquesta qualitat no és recomanable per a enregistraments llargs llevat que tingui una gran quantitat d'espai de disc disponible." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Esteu segur que voleu utilitzar qualitat sense pèrdues?" @@ -623,7 +638,6 @@ Basic.Settings.Output.VideoBitrate="Bitrate de vídeo" Basic.Settings.Output.AudioBitrate="Bitrate d'àudio" Basic.Settings.Output.Reconnect="Torna a connectar automàticament" -Basic.Settings.Output.RetryDelay="Retard de tornar a provar (segons)" Basic.Settings.Output.MaxRetries="Nombre màxim de reintents" Basic.Settings.Output.Advanced="Activar configuració de codificador avançada" Basic.Settings.Output.EncoderPreset="Valors predefinits del codificador" @@ -694,7 +708,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilineal (més ràpida, però borrós si s'escala)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (escalat accentuat, 16 mostres)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (escalat accentuat, 32 mostres)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (escalat accentuat, 36 mostres)" +Basic.Settings.Video.DownscaleFilter.Area="Àrea (suma ponderada, 4/6/9 mostres)" Basic.Settings.Audio="Àudio" Basic.Settings.Audio.SampleRate="Frequència de mostreig" @@ -708,7 +723,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Pic de mostra" Basic.Settings.Audio.PeakMeterType.TruePeak="True Peak (ús elevat de la CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="ATENCIÓ: El so envoltant està habilitat." -Basic.Settings.Audio.MultichannelWarning="Si esteu retransmetent, verifiqueu que el servei triat suporta el so envoltant, tant a la reproducció d'entrada com de sortida. El Twitch, el Facebook 360 Live, el Mixer RTMP i el Smashcast són exemples on està completament suportat. Encara que el Facebook Live i el YouTube Live accepten l'entrada de so envoltant, el Facebook Live la converteix a estèreo i el YouTube Live la reprodueix només en 2 canals.\n\nEls filtres d'àudio de l'OBS són compatibles amb el so envoltant, encara que no es garanteix la compatibilitat amb connectors VST." +Basic.Settings.Audio.MultichannelWarning="Si esteu retransmetent, verifiqueu que el servei triat suporta el so envoltant, tant a la reproducció d'entrada com de sortida. El Facebook 360 Live, el Mixer RTMP i el Smashcast són exemples on està completament suportat. Encara que el Facebook Live i el YouTube Live accepten l'entrada de so envoltant, el Facebook Live la converteix a estèreo i el YouTube Live la reprodueix només en 2 canals.\n\nEls filtres d'àudio de l'OBS són compatibles amb el so envoltant, encara que no es garanteix la compatibilitat amb connectors VST." Basic.Settings.Audio.MultichannelWarning.Title="Voleu habilitar el so envoltant?" Basic.Settings.Audio.MultichannelWarning.Confirm="Segur que voleu habilitar el so envoltant?" Basic.Settings.Audio.Devices="Dispositius" @@ -743,23 +758,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Per defecte" Basic.Settings.Advanced.Audio.DisableAudioDucking="Desactiva la reducció d'àudio de Windows" Basic.Settings.Advanced.StreamDelay="Retard del directe" -Basic.Settings.Advanced.StreamDelay.Duration="Durada (en segons)" +Basic.Settings.Advanced.StreamDelay.Duration="Durada" Basic.Settings.Advanced.StreamDelay.Preserve="Preservar el punt de tall (augmenta retard) quan s'estigui reconnectant" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Ús de memòria estimat: %1 MB" Basic.Settings.Advanced.Network="Xarxa" Basic.Settings.Advanced.Network.BindToIP="Enllaçar amb" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Activa el nou codi de xarxa" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Mode de baixa latència" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Comportament del focus amb les dreceres" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="No inhabilitis les dreceres" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Inhabilita les tecles de drecera quan la finestra principal estigui en primer pla" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Inhabilita les dreceres si la pantalla principal no és el focus" Basic.Settings.Advanced.AutoRemux="Converteix automàticament a mp4" Basic.Settings.Advanced.AutoRemux.MP4="(enregistra com a mkv)" Basic.AdvAudio="&Propietats avançades d'àudio" Basic.AdvAudio.Name="Nom" Basic.AdvAudio.Volume="Volum" -Basic.AdvAudio.Mono="Mescla a Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balanç" -Basic.AdvAudio.SyncOffset="Correcció de sincronització (ms)" +Basic.AdvAudio.SyncOffset="Correcció de sincronització" Basic.AdvAudio.Monitoring="Monitorització d'àudio" Basic.AdvAudio.Monitoring.None="Monitorització desactivada" Basic.AdvAudio.Monitoring.MonitorOnly="Només monitorizació (silencia la sortida)" @@ -825,6 +843,7 @@ OutputWarnings.NoTracksSelected="Heu de seleccionar almenys una cançó" OutputWarnings.MultiTrackRecording="Advertiment: Alguns formats (com FLV) no suporten múltiples cançons per gravació" OutputWarnings.MP4Recording="Advertència: els enregistraments creats en MP4/MOV no es podran recuperar si el fitxer no es pot finalitzar (p. ex. degut a un mal funcionament del sistema o interrupcions, etc.) Si voleu enregistrar diverses pistes d'àudio, considereu utilitzar el format MKV i convertir l'enregistrament a MP4/MOV després d'haver finalitzat (Fitxer → Conversió de gravació)" +OutputWarnings.CannotPause="Advertència: les gravacions no es poden aturar si el codificador de gravació està configurat a «(Utilitza el codificador de flux)»" FinalScene.Title="Supressió de l'escena" FinalScene.Text="Cal que hi hagi almenys una escena."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/cs-CZ.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/cs-CZ.ini
Changed
@@ -23,7 +23,7 @@ Display="Obrazovka" Name="Název" Exit="Ukončit" -Mixer="Směšovač" +Mixer="Směšovač zvuku" Browse="Procházet" Mono="Mono" Stereo="Stereo" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Zavření dokovatelného okna" DockCloseWarning.Text="Právě jste zavřeli dokovatelné okno. Pokud byste ho chtěli zobrazit znovu, tak použijte menu Zobrazit → Doky." +ExtraBrowsers="Vlastní doky prohlížeče" +ExtraBrowsers.Info="Přidejte doky zadáním názvu a URL a poté klikněte Použít nebo Zavřít pro otevření doků. Doky můžete přidat či odebrat kdykoliv." +ExtraBrowsers.DockName="Název doku" + Auth.Authing.Title="Přihlašování ..." Auth.Authing.Text="Přihlašování ke službě %1 ..." Auth.AuthFailure.Title="Přihlášení se nezdařilo" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Informační kanál služby Twitch" TwitchAuth.TwoFactorFail.Title="Nepovedlo se získat vysílací klíč" TwitchAuth.TwoFactorFail.Text="OBS se nemohl připojit k vašemu Twitch účtu. Zkontrolujte, zda máte nastaveno dvoufázové ověření ve vašem <a href='https://www.twitch.tv/settings/security'>nastavení bezpečnosti</a>, jelikož je to pro vysílání nutné." +RestreamAuth.Channels="Restream kanály" Copy.Filters="Kopírovat filtry" Paste.Filters="Vložit filtry" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Poznámka: Základní rozlišení není nutně stejné jako rozlišení, ve kterém budete vysílat či nahrávat. Vaše opravdové rozlišení může být několikrát zmenšeno oproti základnímu rozlišení, aby bylo sníženo využití prostředků nebo požadavků na bitrate." Basic.AutoConfig.StreamPage="Informace o vysílání" Basic.AutoConfig.StreamPage.SubTitle="Prosím zadejte své informace o vysílání" -Basic.AutoConfig.StreamPage.ConnectAccount="Připojit účet (volitelné)" +Basic.AutoConfig.StreamPage.ConnectAccount="Připojit účet (doporučeno)" Basic.AutoConfig.StreamPage.DisconnectAccount="Odpojit účet" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Odpojení účtu" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Tato změna proběhne okamžitě. Opravdu si přejete odpojit účet ?" @@ -240,11 +245,14 @@ ConfirmStop.Title="Zastavit vysílání ?" ConfirmStop.Text="Opravdu si přejete zastavit vysílání ?" +ConfirmStopRecord.Title="Zastavit nahrávání?" +ConfirmStopRecord.Text="Opravdu si přejete zastavit nahrávání ?" + ConfirmBWTest.Title="Spuštění testu rychlosti připojení" ConfirmBWTest.Text="Nastavili jste OBS do režimu testování připojení. Tento režim vám umožňuje otestovat vaše připojení bez toho, abyste vysílali. Poté co skončíte s testováním jej budete muset vypnout, aby vaše vysílání viděli vaši diváci.\n\nChcete začít s testováním ?" ConfirmExit.Title="Ukončit OBS ?" -ConfirmExit.Text="Ukončením budou všechna vysílání/záznamy zastavena. Jste si jisti skončit ?" +ConfirmExit.Text="OBS je stále aktivní. Ukončením budou všechna vysílání/záznamy zastavena. Jste si jisti skončit ?" ConfirmRemove.Title="Potvrzení odebrání" ConfirmRemove.Text="Opravdu si přejete odebrat '$1'?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="Chyba při spouštění nahrávání do paměti" Output.StartFailedGeneric="Nastala chyba při začátku nahrávání. Zkontrolujte, prosím, textový záznam pro další podrobnosti.\n\nPoznámka: Pokud používáte enkodér NVENC či AMD, zkontrolujte zda používáte aktuální verzi grafického ovladače." +Output.ReplayBuffer.PauseWarning.Title="Při pozastavení nelze ukládat záznamy" +Output.ReplayBuffer.PauseWarning.Text="Varování: Záznamy nelze ukládat, pokud je nahrávání pozastaveno." Output.ConnectFail.Title="Spojení se nezdařilo" Output.ConnectFail.BadPath="Chybná cesta nebo adresa připojení. Zkontrolujte, prosím, správnost svých nastavení." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Spustit záznam do paměti" Basic.Main.StartStreaming="Začít vysílat" Basic.Main.StopRecording="Zastavit nahrávání" +Basic.Main.PauseRecording="Pozastavit nahrávání" +Basic.Main.UnpauseRecording="Pokračovat v nahrávání" Basic.Main.StoppingRecording="Zastavuji nahrávání..." Basic.Main.StopReplayBuffer="Zastavit záznam do paměti" Basic.Main.StoppingReplayBuffer="Zastavuji záznam do paměti..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="Doky" Basic.MainMenu.View.Docks.ResetUI="Resetovat rozhraní" Basic.MainMenu.View.Docks.LockUI="Zamknout rozhraní" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Vlastní doky prohlížeče..." Basic.MainMenu.View.Toolbars.Listboxes="Seznamy (&L)" Basic.MainMenu.View.SceneTransitions="Pře&chody scény" Basic.MainMenu.View.StatusBar="&Stavový řádek" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Otevřít okno statistik při spuštění" Basic.Settings.General.WarnBeforeStartingStream="Vyžadovat potvrzení pro spuštění vysílání" Basic.Settings.General.WarnBeforeStoppingStream="Vyžadovat potvrzení pro ukončení vysílání" +Basic.Settings.General.WarnBeforeStoppingRecord="Vyžadovat potvrzení pro ukončení nahrávání" Basic.Settings.General.Projectors="Projektory" Basic.Settings.General.HideProjectorCursor="Skrýt kurzor přes projektor" Basic.Settings.General.ProjectorAlwaysOnTop="Zobrazovat projektory tak, aby vždy byly navrchu" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Vyberte složku pro nahrávání" Basic.Settings.Output.SelectFile="Vyberte soubor pro nahrávání" Basic.Settings.Output.EnforceBitrate="Vynutit omezení bitratu streamovací služby" +Basic.Settings.Output.DynamicBitrate="Dynamicky měnit bitrate v závislosti na zahlcení sítě" +Basic.Settings.Output.DynamicBitrate.Beta="Dynamicky měnit bitrate v závislosti na zahlcení sítě (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="Místo zahazování snímků, pro snížení zahlcení sítě, bude průběžně měněn bitrate.\n\nMějte na vědomí, že se může zvýšit odezva pro diváky, pokud dojde k náhlému zahlcení sítě.\nPo snížení bitratu to může trvat pár minut, než se zase navýší.\n\nZatím je podporováno pouze RTMP." Basic.Settings.Output.Mode="Režim výstupu" Basic.Settings.Output.Mode.Simple="Jednoduché" Basic.Settings.Output.Mode.Adv="Rozšířené" Basic.Settings.Output.Mode.FFmpeg="Výstup FFmpeg" Basic.Settings.Output.UseReplayBuffer="Povolit záznam do paměti" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximální čas záznamu (s)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximální čas na opakování" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maximální využití paměti (MB)" Basic.Settings.Output.ReplayBuffer.Estimate="Přibližné využití paměti: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Nedokáži odhadnout využití paměti. Nastavte, prosím, maximální využití paměti." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Lossless, obrovské soubory" Basic.Settings.Output.Simple.Warn.VideoBitrate="Varování: Bitrate videa bude nastaven %1, což je maximum, které tato streamovací služba umožňuje. Pokud si jste jisti, že chcete tento limit překročit, povolte rožšířené možnosti enkodéru a odškrtněte \"Vynutit omezení bitratu streamovací služby\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Varování: Bitrate zvuku bude nastaven %1, což je maximum, které tato streamovací služba umožňuje. Pokud si jste jisti, že chcete tento limit překročit, povolte rožšířené možnosti enkodéru a odškrtněte \"Vynutit omezení bitratu streamovací služby\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Varování: Nahrávání není možné pozastavit, pokud je nahrávací kvalita nastavena na \"Stejná jako vysílaná\"." Basic.Settings.Output.Simple.Warn.Encoder="Varování: Nahrávání se softwarovým enkodérem v jiné kvalitě než je vysílaná bude CPU využívat více, pokud budete vysílat a nahrávat současně." Basic.Settings.Output.Simple.Warn.Lossless="Varování: Při použití této kvality budou výsledné nahrávky obrovské! Při použití vysokého rozlišení a snímkování mohou využít až 7 GB diskového prostoru za minutu nahrávky. Tato kvalita není doporučena pro dlouhé nahrávky, pokud nemáte opravdu velký volný prostor na disku." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Opravdu chcete použít tuto kvalitu ?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Bitrate videa" Basic.Settings.Output.AudioBitrate="Bitrate zvuku" Basic.Settings.Output.Reconnect="Automaticky obnovit spojení" -Basic.Settings.Output.RetryDelay="Čas do pokusu (vteřiny)" +Basic.Settings.Output.RetryDelay="Doba opakování" Basic.Settings.Output.MaxRetries="Maximální počet pokusů" Basic.Settings.Output.Advanced="Povolit rozšířené nastavení enkodéru" Basic.Settings.Output.EncoderPreset="Předvolba enkodéru" @@ -688,13 +706,14 @@ Basic.Settings.Video.Numerator="Čitatel" Basic.Settings.Video.Denominator="Jmenovatel" Basic.Settings.Video.Renderer="Vykreslovač" -Basic.Settings.Video.InvalidResolution="Chybná hodnota rozlišení. Správný formát je [width]x[height] (např. 1920x1080)" +Basic.Settings.Video.InvalidResolution="Chybná hodnota rozlišení. Správný formát je [šířka]x[výška] (např. 1920x1080)" Basic.Settings.Video.CurrentlyActive="Obrazový výstup je zapnutý. Pro změnu nastavení vypněte všechny výstupy." Basic.Settings.Video.DisableAero="Zakázat Aero" Basic.Settings.Video.DownscaleFilter.Bilinear="Bilineární (Nejrychlejší, ale rozmazané při škálování)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bikubické (Ostré při škálování, 16 vzorků)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Ostré při škálování, 32 vzorků)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Ostré při škálování, 36 vzorků)" +Basic.Settings.Video.DownscaleFilter.Area="Oblast (vážený součet, 4/6/9 vzorků)" Basic.Settings.Audio="Zvuk" Basic.Settings.Audio.SampleRate="Vzorkovací frekvence" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Špička vzorky" Basic.Settings.Audio.PeakMeterType.TruePeak="Pravá špička (Vyšší využití CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="VAROVÁNÍ: Prostorový zvuk je zapnut." -Basic.Settings.Audio.MultichannelWarning="Předtím než začnete vysílat si zkontrolujte, zda vaše vysílací služba podporuje příjem a přehrávání prostorového zvuku. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast jsou příklady služeb, které jej plně podporují. I když Facebook Live a YouTube Live oba podporují příjem prostorového zvuku, Facebook Live jej převede na stereo a YouTube Live přehrává pouze dva kanály.\n\nOBS filtry zvuku jej plně podporují, ale podpora u pluginu VST není garantována." +Basic.Settings.Audio.MultichannelWarning="Předtím než začnete vysílat si zkontrolujte, zda vaše vysílací služba podporuje příjem a přehrávání prostorového zvuku. Facebook 360 Live, Mixer RTMP, Smashcast jsou příklady služeb, které jej plně podporují. I když Facebook Live a YouTube Live oba podporují příjem prostorového zvuku, Facebook Live jej převede na stereo a YouTube Live přehrává pouze dva kanály.\n\nOBS filtry zvuku jej plně podporují, ale podpora u pluginu VST není garantována." Basic.Settings.Audio.MultichannelWarning.Title="Povolit prostorový zvuk?" Basic.Settings.Audio.MultichannelWarning.Confirm="Jste si jisti, že chcete povolit prostorový zvuk?" Basic.Settings.Audio.Devices="Zařízení" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Výchozí" Basic.Settings.Advanced.Audio.DisableAudioDucking="Zakázat Windows výchozí utlumování zvuku" Basic.Settings.Advanced.StreamDelay="Zpoždění vysílání" -Basic.Settings.Advanced.StreamDelay.Duration="Délka (vteřiny)" +Basic.Settings.Advanced.StreamDelay.Duration="Délka" Basic.Settings.Advanced.StreamDelay.Preserve="Zachovat zpoždění při obnovení spojení (zvýšení zpoždění)" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Přibližné využití paměti: %1 MB" Basic.Settings.Advanced.Network="Síť" Basic.Settings.Advanced.Network.BindToIP="Svázat s adresou" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Použít nový síťový kód" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Režim nízké odezvy" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Chování klávesových zkratek" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Nikdy nezakazovat klávesové zkratky" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Zakázat klávesové zkratky, když je hlavní okno aktivní" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Zakázat klávesové zkratky, když je hlavní okno neaktivní" Basic.Settings.Advanced.AutoRemux="Automaticky převést do mp4" Basic.Settings.Advanced.AutoRemux.MP4="(nahrávat jako mkv)" Basic.AdvAudio="Rozšířené vlastnosti zvuku" Basic.AdvAudio.Name="Název" Basic.AdvAudio.Volume="Hlasitost" -Basic.AdvAudio.Mono="Převést na Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Vyvážení" -Basic.AdvAudio.SyncOffset="Zpoždění synchronizace (ms)" +Basic.AdvAudio.SyncOffset="Zpoždění synchronizace" Basic.AdvAudio.Monitoring="Monitorování zvuku" Basic.AdvAudio.Monitoring.None="Monitorování vypnuto" Basic.AdvAudio.Monitoring.MonitorOnly="Pouhé monitorování (ztlumit výstup)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="Musíte vybrat alespoň jednu stopu" OutputWarnings.MultiTrackRecording="Varování: Některé formáty (např. FLV) nepodporují více zvukových stop na nahrávku" OutputWarnings.MP4Recording="Varování: Nahrávky uložené v MP4/MOV nebude možné obnovit, pokud soubor nemohl být dokončen (např. po BSOD, výpadku napájení atp.). Pokud chcete nahrávat více zvukových stop, promyslete použití MKV a poté převedení do MP4/MOV (Soubor → Převést nahrávky)" +OutputWarnings.CannotPause="Varování: Nahrávání není možné pozastavit, pokud je kodér pro nahrávání nastaven na \"(Použít enkodér vysílání)\"" FinalScene.Title="Odstranění scény" FinalScene.Text="Musí existovat alespoň jedna scéna, proto tuto není možno odstranit."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/da-DK.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/da-DK.ini
Changed
@@ -23,7 +23,7 @@ Display="Skærm" Name="Navn" Exit="Afslut" -Mixer="Mixer" +Mixer="Lydmixer" Browse="Gennemse" Mono="Mono" Stereo="Stereo" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Lukker dokbart vindue" DockCloseWarning.Text="Du har netop lukket et dokbart vindue. Hvis du vil vise det igen, skal du benytte menuen Vis → Doks på menulinjen." +ExtraBrowsers="Tilpassede Browserdokker" +ExtraBrowsers.Info="Tilføj en dok ved at give den et navn og URL, og klik derefter på Anvend/Luk for at åbne den. Du kan tilføje/fjerne dokker efter behov." +ExtraBrowsers.DockName="Doknavn" + Auth.Authing.Title="Godkender..." Auth.Authing.Text="Godkender med %1, afvent venligst..." Auth.AuthFailure.Title="Godkendelsesfejl" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Twitch-aktivitetsfeed" TwitchAuth.TwoFactorFail.Title="Stream-nøgle kunne ikke forespørges" TwitchAuth.TwoFactorFail.Text="OBS kunne ikke forbinde til din Twitch-konto. Tjek, at tofaktorgodkendelse er opsat i dine <a href='https://www.twitch.tv/settings/security'>Twitch-sikkerhedsindstillinger</a>, da dette er nødvendigt for at streame." +RestreamAuth.Channels="Restream Kanaler" Copy.Filters="Kopiér filtre" Paste.Filters="Indsæt filtre" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Bemærk: Lærredets (basis-) opløsning er ikke nødvendigvis identisk med den opløsning, du vil streame med eller optage i. Din aktuelle stream-/optagelsesopløsning kan blive nedskaleret fra lærredsopløsningen for at reducere ressourceforbrug eller bit-hastighedskrav." Basic.AutoConfig.StreamPage="Streamoplysninger" Basic.AutoConfig.StreamPage.SubTitle="Angiv dine streamoplysninger" -Basic.AutoConfig.StreamPage.ConnectAccount="Forbind konto (valfrit)" +Basic.AutoConfig.StreamPage.ConnectAccount="Forbind konto (anbefalet)" Basic.AutoConfig.StreamPage.DisconnectAccount="Afbryd konto" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Afbryde konto?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Denne ændring effektueres straks. Sikker på, at du vil afbryde din konto?" @@ -240,6 +245,9 @@ ConfirmStop.Title="Stop stream?" ConfirmStop.Text="Sikker på, at du vil stoppe streamen?" +ConfirmStopRecord.Title="Stop optagelse?" +ConfirmStopRecord.Text="Sikker på, at du vil stoppe optagelsen?" + ConfirmBWTest.Title="Start båndbreddetest?" ConfirmBWTest.Text="Du har OBS opsat i tilstanden båndbreddetest. Denne tilstand muliggør netværksaftestning, uden at din kanal er online. Når aftestningen er gennemført, så deaktivér tilstanden, så seerne vil kunne se din stream.\n\nVil du fortsætte?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="Mislykkedes at starte genafspilnings-buffer" Output.StartFailedGeneric="Start af output mislykkedes. Tjek loggen for oplysninger.\n\nBemærk: Benytter du NVENC- eller AMD-encodere, så sørg for at dine videodrivere er opdaterede." +Output.ReplayBuffer.PauseWarning.Title="Kan ikke gemme genafspilninger under pause" +Output.ReplayBuffer.PauseWarning.Text="Advarsel: Genafspilninger kan ikke gemmes, mens optagelsen er pauset." Output.ConnectFail.Title="Mislykkedes at forbinde" Output.ConnectFail.BadPath="Ugyldig sti eller forbindelses-URL. Tjek dine indstillinger for at bekræfte, at de er gyldige." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Start Genafspilnings-buffer" Basic.Main.StartStreaming="Start streaming" Basic.Main.StopRecording="Stop optagelse" +Basic.Main.PauseRecording="Sæt optagelse på pause" +Basic.Main.UnpauseRecording="Genoptag optagelse" Basic.Main.StoppingRecording="Stopper optagelse..." Basic.Main.StopReplayBuffer="Stop Genafspilnings-buffer" Basic.Main.StoppingReplayBuffer="Stopper Genafspilnings-buffer..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="Dok'er" Basic.MainMenu.View.Docks.ResetUI="Nulstil UI" Basic.MainMenu.View.Docks.LockUI="Lås UI" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Tilpassede Browserdokker..." Basic.MainMenu.View.Toolbars.Listboxes="&Listebokse" Basic.MainMenu.View.SceneTransitions="S&ceneovergange" Basic.MainMenu.View.StatusBar="&Statusbjælke" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Åbn statistikdialogen ved opstart" Basic.Settings.General.WarnBeforeStartingStream="Vis bekræftelsesdialog ved opstart af stream" Basic.Settings.General.WarnBeforeStoppingStream="Vis bekræftelsesdialog ved afslutning af stream" +Basic.Settings.General.WarnBeforeStoppingRecord="Vis bekræftelsesdialog ved stop af optagelse" Basic.Settings.General.Projectors="Projektorer" Basic.Settings.General.HideProjectorCursor="Skjul markør over projektorer" Basic.Settings.General.ProjectorAlwaysOnTop="Projektorer altid øverst" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Vælg optagelsesmappe" Basic.Settings.Output.SelectFile="Vælg optagelsesfil" Basic.Settings.Output.EnforceBitrate="Håndhæv streamingtjenestes bit-hastighedsbegrænsninger" +Basic.Settings.Output.DynamicBitrate="Skift bithastighed dynamisk for at håndtere overbelastning" +Basic.Settings.Output.DynamicBitrate.Beta="Skift bithastighed dynamisk for at håndtere overbelastning (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="I stedet for at droppe billeder for at reducere overbelastning, ændrer dette dynamisk bithastigheden løbende.\n\nBemærk at dette kan øge forsinkelsen, som seerne oplever, hvis der opstår betydelig pludselig overbelastning.\nNår bithastigheden falder, kan det tage op til et par få minutter for at gendanne den.\n\nKun RTMP understøttet pt." Basic.Settings.Output.Mode="Outputtilstand" Basic.Settings.Output.Mode.Simple="Simpel" Basic.Settings.Output.Mode.Adv="Avanceret" Basic.Settings.Output.Mode.FFmpeg="FFmpeg-output" Basic.Settings.Output.UseReplayBuffer="Aktivér Genafspilnings-buffer" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maksimal genafspilningstid (sek.)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maks. genafspilningstid" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maksimal hukommelse (MB)" Basic.Settings.Output.ReplayBuffer.Estimate="Estimeret hukommelsesforbrug: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Ikke kan estimere hukommelsesforbrug. Angiv en maks. hukommelsesgrænse." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Tabsfri kvalitet, enorm stor filstørrelse" Basic.Settings.Output.Simple.Warn.VideoBitrate="Advarsel: Videostreamingbit-hastigheden sættes til %1, som er den øvre grænse for den aktuelle streamingtjeneste. Er du sikker på, at du vil at gå over %1, så aktivér avancerede encoder-valg og afmarkér \"Gennemtving streamingtjenestes bit-hastighedsbegrænsninger\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Advarsel: Audiostreamingbit-hastigheden sættes til %1, som er den øvre grænse for den aktuelle streamingtjeneste. Er du sikker på, at du vil at gå over %1, så aktivér avancerede encoder-valg og afmarkér \"Gennemtving streamingtjenestes bit-hastighedsbegrænsninger\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Advarsel: Optagelser kan ikke pauses, hvis optagekvaliteten er sat til \"Samme som strream\"." Basic.Settings.Output.Simple.Warn.Encoder="Advarsel: Optagelse med en software-encoder i en anden kvalitet end den streamede vil medføre ekstra CPU-forbrug, hvis du streamer og optager samtidigt." Basic.Settings.Output.Simple.Warn.Lossless="Advarsel: Tabsfri kvalitet genererer gevaldigt store filstørrelser! Tabsfri kvalitet kan forbruge op til 7 GB diskplads pr. minut ved høje opløsninger og billedhastigheder. Tabsfri tilstand anbefales ikke til lange optagelser, medmindre du har masser af tilgængelig diskplads." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Sikker på, at du vil benytte tabsfri kvalitet?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Videobit-hastighed" Basic.Settings.Output.AudioBitrate="Audiobit-hastighed" Basic.Settings.Output.Reconnect="Automatisk gentilslutning" -Basic.Settings.Output.RetryDelay="Forsøg igen-forsinkelse (sek.)" +Basic.Settings.Output.RetryDelay="Prøv igen-forsinkelse" Basic.Settings.Output.MaxRetries="Maks. antal forsøg" Basic.Settings.Output.Advanced="Aktivér avancerede Encoder-indstillinger" Basic.Settings.Output.EncoderPreset="Encoder-forvalg" @@ -688,13 +706,14 @@ Basic.Settings.Video.Numerator="Tæller" Basic.Settings.Video.Denominator="Nævner" Basic.Settings.Video.Renderer="Gengiver" -Basic.Settings.Video.InvalidResolution="Ugyldig opløsningsværdi. Skal være [width]x[height] (f.eks. 1.920x1.080)" +Basic.Settings.Video.InvalidResolution="Ugyldig opløsning. Skal være [bredde]x[højde] (dvs. 1.920x1.080)" Basic.Settings.Video.CurrentlyActive="Videooutput erpt. aktivt. Afbryd evt. outputs fra for at ændre videoindstillinger." Basic.Settings.Video.DisableAero="Deaktivér Aero" Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinær (hurtigst, men sløret ved skalering)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bikubisk (skarp skalering, 16 samples)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (skarp skalering, 32 samples)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (skarp skalering, 36 samples)" +Basic.Settings.Video.DownscaleFilter.Area="Område (vægtet sum, 4/6/9 eksempler)" Basic.Settings.Audio="Lyd" Basic.Settings.Audio.SampleRate="Samplingshastighed" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Samplingsspidsværdi" Basic.Settings.Audio.PeakMeterType.TruePeak="Sand spidsværdi (højere CPU-belastning)" Basic.Settings.Audio.MultiChannelWarning.Enabled="ADVARSEL: Surround Sound-lyd er aktiveret." -Basic.Settings.Audio.MultichannelWarning="Tjek ifm. streaming om din streamingtjeneste understøtter både Surround Sound-input og -afspilning. Twitch, Facebook 360 Live, Mixer RTMP og Smashcast er eksempler, hvor surroundlyd understøttes fuldt ud. Selvom Facebook Live og YouTube Live begge accepterer surround input, nedmikser Facebook Live til stereo, og YouTube Live afspiller kun to kanaler.\n\nOBS-lydfiltre er kompatible med surroundlyd, dog er VST-pluginsupport ikke garanteret." +Basic.Settings.Audio.MultichannelWarning="Tjek ifm. streaming om din streamingtjeneste understøtter både Surround Sound-input og -afspilning. Facebook 360 Live, Mixer RTMP og Smashcast er eksempler, hvor surroundlyd understøttes fuldt ud. Selvom Facebook Live og YouTube Live begge accepterer surround input, nedmikser Facebook Live til stereo, og YouTube Live afspiller kun to kanaler.\n\nOBS-lydfiltre er kompatible med surroundlyd, dog er VST-pluginsupport ikke garanteret." Basic.Settings.Audio.MultichannelWarning.Title="Aktivér Surround Sound-lyd?" Basic.Settings.Audio.MultichannelWarning.Confirm="Sikker på, at du vil aktivere Surround Sound-lyd?" Basic.Settings.Audio.Devices="Enheder" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Standard" Basic.Settings.Advanced.Audio.DisableAudioDucking="Deaktivér Windows-lyddæmpning" Basic.Settings.Advanced.StreamDelay="Streamforsinkelse" -Basic.Settings.Advanced.StreamDelay.Duration="Varighed (sek.)" +Basic.Settings.Advanced.StreamDelay.Duration="Varighed" Basic.Settings.Advanced.StreamDelay.Preserve="Bevar afskæringspunkt (forøg forsinkelse) ved gentilslutning" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Estimeret hukommelsesforbrug: %1 MB" Basic.Settings.Advanced.Network="Netværk" Basic.Settings.Advanced.Network.BindToIP="Bind til IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Aktivér ny netværkskode" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Lav forsinkelsestilstand" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Genvejstast-fokusadfærd" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Deaktivér aldrig genvejstaster" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Deaktivér genvejstaster, når hovedvinduet er i fokus" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Deaktivér genvejstaster, når vindue ikke er i fokus" Basic.Settings.Advanced.AutoRemux="Remux automatisk til mp4" Basic.Settings.Advanced.AutoRemux.MP4="(optag som mkv)" Basic.AdvAudio="Avancerede lydegenskaber" Basic.AdvAudio.Name="Navn" Basic.AdvAudio.Volume="Lydstyrke" -Basic.AdvAudio.Mono="Nedmix til Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balance" -Basic.AdvAudio.SyncOffset="Synkr-forskydning (ms)" +Basic.AdvAudio.SyncOffset="Synk-forskydning" Basic.AdvAudio.Monitoring="Lydovervågning" Basic.AdvAudio.Monitoring.None="Overvågning Fra" Basic.AdvAudio.Monitoring.MonitorOnly="Kun overvågning (gør output tavs)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="Du skal vælge minimum ét spor" OutputWarnings.MultiTrackRecording="Advarsel: Visse formater (såsom FLV) understøtter ikke flere spor pr. optagelse" OutputWarnings.MP4Recording="Advarsel: MP4-/MOV-optagelser vil ikke kunne genoprettes, såfremt filen ikke kan færdiggøres (grundet f.eks. BSOD'er, strømafbrydelse mv.). Vil du optage flere lydspor, så overvej at benytte MKV, og remuxe optagelsen til MP4, efter at den er færdiggjort (Fil → Remux optagelser)" +OutputWarnings.CannotPause="Advarsel: Optagelser kan ikke pauses, hvis optagelsesencoderen er sat til \"(Brug strreamenccoder)\"" FinalScene.Title="Slet scene" FinalScene.Text="Mindst én scene kræves."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/de-DE.ini
Changed
@@ -23,11 +23,11 @@ Display="Bildschirm" Name="Name" Exit="Beenden" -Mixer="Mixer" +Mixer="Audio‐Mixer" Browse="Durchsuchen" Mono="Mono" Stereo="Stereo" -DroppedFrames="Ausgelassene Frames %1 (%2 %)" +DroppedFrames="Ausgelassene Frames %1 (%2 %)" StudioProgramProjector="Vollbildprojektor (Programm)" PreviewProjector="Vollbildprojektor (Vorschau)" SceneProjector="Vollbildprojektor (Szene)" @@ -47,8 +47,8 @@ New="Neu" Duplicate="Duplizieren" Enable="Aktivieren" -DisableOSXVSync="OSX V-Sync deaktivieren" -ResetOSXVSyncOnExit="OSX V-Sync beim Beenden zurücksetzen" +DisableOSXVSync="OSX V‐Sync deaktivieren" +ResetOSXVSyncOnExit="OSX V‐Sync beim Beenden zurücksetzen" HighResourceUsage="Kodierung überlastet! Erwägen Sie Ihre Videoeinstellungen zu verringern oder benutzen Sie eine schnellere Kodierervoreinstellung." Transition="Übergang" QuickTransitions="Schnellübergänge" @@ -61,7 +61,7 @@ Minutes="Minute(n)" Seconds="Sekunde(n)" Deprecated="Veraltet" -ReplayBuffer="Replay-Puffer" +ReplayBuffer="Replay‐Puffer" Import="Importieren" Export="Exportieren" Copy="Kopieren" @@ -82,37 +82,42 @@ Group="Gruppe" DoNotShowAgain="Nicht nochmal anzeigen" Default="(Standard)" -Calculating="Berechne …" +Calculating="Berechne …" AlreadyRunning.Title="OBS wird bereits ausgeführt" -AlreadyRunning.Text="OBS wird bereits ausgeführt! Bitte beenden Sie alle vorhandenen OBS-Instanzen, bevor Sie eine neue Instanz starten, außer Sie tun dies absichtlich. Wenn Sie OBS so eingestellt haben, dass es sich zum Infobereich minimiert, überprüfen Sie bitte, ob es dort läuft." +AlreadyRunning.Text="OBS wird bereits ausgeführt! Bitte beenden Sie alle vorhandenen OBS‐Instanzen, bevor Sie eine neue Instanz starten, außer Sie tun dies absichtlich. Wenn Sie OBS so eingestellt haben, dass es sich zum Benachrichtigungsbereich minimiert, überprüfen Sie bitte, ob es dort läuft." AlreadyRunning.LaunchAnyway="Trotzdem starten" DockCloseWarning.Title="Dockbares Fenster schließen" DockCloseWarning.Text="Sie haben gerade ein dockbares Fenster geschlossen. Wenn Sie es erneut anzeigen möchten, verwenden Sie das Menü „Ansicht” → „Docks” in der Menüleiste." -Auth.Authing.Title="Authentifizierung …" -Auth.Authing.Text="Authentifizierung mit %1, bitte warten …" +ExtraBrowsers="Benutzerdefinierte Browser‐Docks" +ExtraBrowsers.Info="Fügen Sie Docks hinzu, indem Sie ihnen einen Namen und eine URL geben und dann auf „Anwenden“ oder „Schließen“ klicken, um diese zu öffnen. Sie können jederzeit Docks hinzufügen oder entfernen." +ExtraBrowsers.DockName="Dock‐Name" + +Auth.Authing.Title="Authentifizierung …" +Auth.Authing.Text="Authentifizierung mit %1, bitte warten …" Auth.AuthFailure.Title="Authentifizierungsfehler" Auth.AuthFailure.Text="Fehler beim Authentifizieren mit %1:\n\n%2: %3" Auth.InvalidScope.Title="Authentifizierung erforderlich" Auth.InvalidScope.Text="Die Authentifizierungsanforderungen für %1 haben sich geändert. Einige Funktionen sind möglicherweise nicht verfügbar." -Auth.LoadingChannel.Title="Kanalinformationen werden geladen …" -Auth.LoadingChannel.Text="Kanalinformationen werden für %1 geladen, bitte warten …" +Auth.LoadingChannel.Title="Kanalinformationen werden geladen …" +Auth.LoadingChannel.Text="Kanalinformationen werden für %1 geladen, bitte warten …" Auth.ChannelFailure.Title="Fehler beim Laden des Kanals" Auth.ChannelFailure.Text="Fehler beim Laden der Kanalinformationen für %1\n\n%2: %3" Auth.Chat="Chat" Auth.StreamInfo="Streaminformation" -TwitchAuth.Stats="Twitch-Statistiken" -TwitchAuth.Feed="Twitch-Aktivitätsfeed" +TwitchAuth.Stats="Twitch‐Statistiken" +TwitchAuth.Feed="Twitch‐Aktivitätsfeed" TwitchAuth.TwoFactorFail.Title="Streamschlüssel konnte nicht abgefragt werden" -TwitchAuth.TwoFactorFail.Text="OBS konnte sich nicht mit Ihrem Twitch-Konto verbinden. Bitte stellen Sie sicher, dass die Zwei-Faktor-Authentifizierung in Ihren <a href='https://www.twitch.tv/settings/security'>Twitch-Sicherheitseinstellungen</a> eingerichtet ist, da diese für das Sreamen benötigt wird." +TwitchAuth.TwoFactorFail.Text="OBS konnte sich nicht mit Ihrem Twitch‐Konto verbinden. Bitte stellen Sie sicher, dass die Zwei‐Faktor‐Authentifizierung in Ihren <a href='https://www.twitch.tv/settings/security'>Twitch‐Sicherheitseinstellungen</a> eingerichtet ist, da diese für das Sreamen benötigt wird." +RestreamAuth.Channels="Restream‐Kanäle" Copy.Filters="Filter kopieren" Paste.Filters="Filter einfügen" -BrowserPanelInit.Title="Initialisiere Browser …" -BrowserPanelInit.Text="Initialisiere Browser, bitte warten …" +BrowserPanelInit.Title="Initialisiere Browser …" +BrowserPanelInit.Text="Initialisiere Browser, bitte warten …" BandwidthTest.Region="Region" BandwidthTest.Region.US="USA" @@ -120,7 +125,7 @@ BandwidthTest.Region.Asia="Asien" BandwidthTest.Region.Other="Andere" -Basic.FirstStartup.RunWizard="Möchten Sie den Autokonfigurationsassistent ausführen? Sie können Ihre Einstellungen auch manuell konfigurieren, indem Sie die „Einstellungen“-Schaltfläche im Hauptfenster anklicken." +Basic.FirstStartup.RunWizard="Möchten Sie den Autokonfigurationsassistent ausführen? Sie können Ihre Einstellungen auch manuell konfigurieren, indem Sie die „Einstellungen“‐Schaltfläche im Hauptfenster anklicken." Basic.FirstStartup.RunWizard.NoClicked="Wenn Sie sich umentscheiden, können Sie den Autokonfigurationsassistent jederzeit aus dem Menü „Werkzeuge“ erneut ausführen." Basic.AutoConfig="Autokonfigurationsassistent" @@ -131,49 +136,49 @@ Basic.AutoConfig.StartPage.PrioritizeRecording="Für das Aufnehmen optimieren, Streamen ist zweitrangig" Basic.AutoConfig.VideoPage="Videoeinstellungen" Basic.AutoConfig.VideoPage.SubTitle="Geben Sie die gewünschten Videoeinstellungen an, die Sie verwenden möchten" -Basic.AutoConfig.VideoPage.BaseResolution.UseCurrent="Aktuelle verwenden (%1×%2)" -Basic.AutoConfig.VideoPage.BaseResolution.Display="Bildschirm %1 (%2×%3)" +Basic.AutoConfig.VideoPage.BaseResolution.UseCurrent="Aktuelle verwenden (%1 × %2)" +Basic.AutoConfig.VideoPage.BaseResolution.Display="Bildschirm %1 (%2 × %3)" Basic.AutoConfig.VideoPage.FPS.UseCurrent="Aktuelle verwenden (%1)" Basic.AutoConfig.VideoPage.FPS.PreferHighFPS="Entweder 60 oder 30, aber wenn möglich 60 bevorzugen" Basic.AutoConfig.VideoPage.FPS.PreferHighRes="Entweder 60 oder 30, aber hohe Auflösung bevorzugen" -Basic.AutoConfig.VideoPage.CanvasExplanation="Hinweis: Die Basis-(Leinwand-)Auflösung ist nicht unbedingt die gleiche Auflösung, mit der Sie streamen oder aufnehmen. Ihre tatsächliche Stream-/Aufnahmeauflösung kann ausgehend von der Leinwandauflösung herunterskaliert werden, um die Ressourcennutzung oder die Bitratenanforderungen zu reduzieren." +Basic.AutoConfig.VideoPage.CanvasExplanation="Hinweis: Die Basis‐(Leinwand‐)Auflösung ist nicht unbedingt die gleiche Auflösung, mit der Sie streamen oder aufnehmen. Ihre tatsächliche Stream‐/Aufnahmeauflösung kann ausgehend von der Leinwandauflösung herunterskaliert werden, um die Ressourcennutzung oder die Bitratenanforderungen zu reduzieren." Basic.AutoConfig.StreamPage="Streaminformationen" Basic.AutoConfig.StreamPage.SubTitle="Bitte geben Sie Ihre Streaminformationen ein" -Basic.AutoConfig.StreamPage.ConnectAccount="Konto verbinden (optional)" +Basic.AutoConfig.StreamPage.ConnectAccount="Konto verbinden (empfohlen)" Basic.AutoConfig.StreamPage.DisconnectAccount="Konto trennen" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Konto trennen?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Diese Änderung wird sofort angewendet. Sind Sie sicher, dass Sie Ihr Konto trennen möchten?" Basic.AutoConfig.StreamPage.UseStreamKey="Streamschlüssel verwenden" Basic.AutoConfig.StreamPage.Service="Plattform" -Basic.AutoConfig.StreamPage.Service.ShowAll="Alle anzeigen …" -Basic.AutoConfig.StreamPage.Service.Custom="Benutzerdefiniert …" +Basic.AutoConfig.StreamPage.Service.ShowAll="Alle anzeigen …" +Basic.AutoConfig.StreamPage.Service.Custom="Benutzerdefiniert …" Basic.AutoConfig.StreamPage.Server="Server" Basic.AutoConfig.StreamPage.StreamKey="Streamschlüssel" Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(Link)" Basic.AutoConfig.StreamPage.PerformBandwidthTest="Bitrate mit Bandbreitentest schätzen (kann einige Minuten dauern)" Basic.AutoConfig.StreamPage.PreferHardwareEncoding="Hardwarekodierung bevorzugen" -Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="Hardwarekodierung beseitigt die meiste CPU-Auslastung, kann aber mehr Bitrate erfordern, um das gleiche Maß an Qualität zu erhalten." +Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="Hardwarekodierung beseitigt die meiste CPU‐Auslastung, kann aber mehr Bitrate erfordern, um das gleiche Maß an Qualität zu erhalten." Basic.AutoConfig.StreamPage.StreamWarning.Title="Streamwarnung" -Basic.AutoConfig.StreamPage.StreamWarning.Text="Der Bandbreitentest streamt randomisierte Videodaten ohne Ton zu Ihrem Kanal. Wenn Sie in der Lage sind, empfiehlt es sich, vorübergehend das Speichern von Videos zu deaktivieren und den Stream privat zu schalten, bis der Test abgeschlossen ist. Fortfahren?" +Basic.AutoConfig.StreamPage.StreamWarning.Text="Der Bandbreitentest streamt zufällige Videodaten ohne Ton zu Ihrem Kanal. Wenn Sie in der Lage sind, empfiehlt es sich, das Speichern von Videos vorrübergehend zu deaktivieren und den Stream privat zu schalten, bis der Test abgeschlossen ist. Fortfahren?" Basic.AutoConfig.TestPage="Endergebnisse" Basic.AutoConfig.TestPage.SubTitle.Testing="Das Programm führt nun eine Reihe von Tests durch, um die besten Einstellungen für Ihr System zu finden" Basic.AutoConfig.TestPage.SubTitle.Complete="Tests abgeschlossen" -Basic.AutoConfig.TestPage.TestingBandwidth="Führe Bandbreitentests durch, dies kann einige Minuten dauern …" -Basic.AutoConfig.TestPage.TestingBandwidth.Connecting="Verbinde zu: %1 …" +Basic.AutoConfig.TestPage.TestingBandwidth="Führe Bandbreitentests durch, dies kann einige Minuten dauern …" +Basic.AutoConfig.TestPage.TestingBandwidth.Connecting="Verbinde zu: %1 …" Basic.AutoConfig.TestPage.TestingBandwidth.ConnectFailed="Keine Verbindung zu den Servern möglich, bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut." Basic.AutoConfig.TestPage.TestingBandwidth.Server="Teste Bandbreite für: %1" -Basic.AutoConfig.TestPage.TestingStreamEncoder="Teste Streamkodierer, dies kann einige Minuten dauern …" -Basic.AutoConfig.TestPage.TestingRecordingEncoder="Teste Aufnahmekodierer, dies kann einige Minuten dauern …" -Basic.AutoConfig.TestPage.TestingRes="Teste Auflösungen, dies kann einige Minuten dauern …" +Basic.AutoConfig.TestPage.TestingStreamEncoder="Teste Streamkodierer, dies kann einige Minuten dauern …" +Basic.AutoConfig.TestPage.TestingRecordingEncoder="Teste Aufnahmekodierer, dies kann einige Minuten dauern …" +Basic.AutoConfig.TestPage.TestingRes="Teste Auflösungen, dies kann einige Minuten dauern …" Basic.AutoConfig.TestPage.TestingRes.Fail="Fehler beim Starten des Kodierers" -Basic.AutoConfig.TestPage.TestingRes.Resolution="Teste Auflösung %1×%2 mit %3 FPS …" +Basic.AutoConfig.TestPage.TestingRes.Resolution="Teste Auflösung %1 × %2 mit %3 FPS …" Basic.AutoConfig.TestPage.Result.StreamingEncoder="Streamkodierer" Basic.AutoConfig.TestPage.Result.RecordingEncoder="Aufnahmekodierer" Basic.AutoConfig.TestPage.Result.Header="Das Programm hat festgestellt, dass diese geschätzten Einstellungen für Sie am besten sind:" Basic.AutoConfig.TestPage.Result.Footer="Um den Assistenten neu zu konfigurieren und es erneut zu versuchen, klicken Sie auf „Zurück“. Um die Einstellungen selbst anzupassen, klicken Sie auf „Abbrechen“ und öffnen Sie die Einstellungen." Basic.Stats="Statistiken" -Basic.Stats.CPUUsage="CPU-Auslastung" +Basic.Stats.CPUUsage="CPU‐Auslastung" Basic.Stats.HDDSpaceAvailable="Speicherplatz verfügbar" Basic.Stats.MemoryUsage="Speicherauslastung" Basic.Stats.AverageTimeToRender="Durchschnittliche Zeit, um Frame zu rendern" @@ -192,11 +197,11 @@ Basic.Stats.DiskFullIn="Datenträger voll in ugf." ResetUIWarning.Title="Sind Sie sicher, dass Sie die Benutzeroberfläche zurücksetzen möchten?" -ResetUIWarning.Text="Das Zurücksetzen der Benutzeroberfläche wird zusätzliche Docks ausblenden. Sie müssen diese Docks im „Ansicht“-Menü wieder aktivieren, wenn sie sichtbar sein sollen.\n\nSind Sie sicher, dass Sie die Benutzeroberfläche zurücksetzen möchten?" +ResetUIWarning.Text="Das Zurücksetzen der Benutzeroberfläche wird zusätzliche Docks ausblenden. Sie müssen diese Docks im „Ansicht“‐Menü wieder aktivieren, wenn sie sichtbar sein sollen.\n\nSind Sie sicher, dass Sie die Benutzeroberfläche zurücksetzen möchten?" Updater.Title="Neues Update verfügbar" Updater.Text="Es ist ein neues Update verfügbar:" -Updater.UpdateNow="Jetzt updaten" +Updater.UpdateNow="Jetzt aktualisieren" Updater.RemindMeLater="Später erinnern" Updater.Skip="Version überspringen" Updater.Running.Title="Programm derzeit aktiv" @@ -205,14 +210,14 @@ Updater.NoUpdatesAvailable.Text="Zurzeit sind keine Updates verfügbar" Updater.FailedToLaunch="Konnte den Updater nicht starten" Updater.GameCaptureActive.Title="Spielaufnahme aktiv" -Updater.GameCaptureActive.Text="Die Spielaufnahmen-Hook-Bibliothek wird zurzeit verwendet. Bitte schließen Sie alle derzeit aufgenommenen Programme und Spiele (oder starten Sie Windows neu) und versuchen Sie es erneut." +Updater.GameCaptureActive.Text="Die Spielaufnahmen‐Hook‐Bibliothek wird zurzeit verwendet. Bitte schließen Sie alle derzeit aufgenommenen Programme und Spiele (oder starten Sie Windows neu) und versuchen Sie es erneut." -QuickTransitions.SwapScenes="Vorschau-/Ausgabeszene nach Übergang tauschen" -QuickTransitions.SwapScenesTT="Vertauscht die Vorschau- und Ausgabeszenen nach dem Übergang (falls die ursprüngliche Ausgabeszene noch vorhanden ist).\nEventuelle Änderungen an der originalen Ausgabeszene werden nicht rückgängig gemacht." +QuickTransitions.SwapScenes="Vorschau‐/Ausgabeszene nach Übergang tauschen" +QuickTransitions.SwapScenesTT="Vertauscht die Vorschau‐ und Ausgabeszenen nach dem Übergang (falls die ursprüngliche Ausgabeszene noch vorhanden ist).\nEventuelle Änderungen an der originalen Ausgabeszene werden nicht rückgängig gemacht." QuickTransitions.DuplicateScene="Szene duplizieren" QuickTransitions.DuplicateSceneTT="Ermöglicht das Bearbeiten von Transformationen und der Sichtbarkeit von Quellen, ohne die Ausgabe zu verändern, wenn dieselbe Szene bearbeitet wird.\nAktivieren Sie „Szene duplizieren“, um die Eigenschaften von Quellen zu bearbeiten, ohne die Ausgabe zu verändern.\nDas Ändern dieses Wertes wird die derzeitige Ausgabeszene zurücksetzen (falls sie noch existiert)." QuickTransitions.EditProperties="Quellen duplizieren" -QuickTransitions.EditPropertiesTT="Ermöglicht das Bearbeiten der Eigenschaften von Quellen, ohne die Ausgabe zu verändern, wenn dieselbe Szene bearbeitet wird.\nDies kann nur verwendet werden, wenn „Szene duplizieren“ aktiviert ist.\nBestimmte Quellen (wie Aufnahme- oder Medienquellen) unterstützen dies nicht und können nicht separat bearbeitet werden.\nDas Ändern dieses Wertes wird die derzeitige Ausgabeszene zurücksetzen (falls sie noch existiert).\n\nWarnung: Da Quellen dupliziert werden, könnte dies zusätzliche System- oder Videoressourcen verbrauchen." +QuickTransitions.EditPropertiesTT="Ermöglicht das Bearbeiten der Eigenschaften von Quellen, ohne die Ausgabe zu verändern, wenn dieselbe Szene bearbeitet wird.\nDies kann nur verwendet werden, wenn „Szene duplizieren“ aktiviert ist.\nBestimmte Quellen (wie Aufnahme‐ oder Medienquellen) unterstützen dies nicht und können nicht separat bearbeitet werden.\nDas Ändern dieses Wertes wird die derzeitige Ausgabeszene zurücksetzen (falls sie noch existiert).\n\nWarnung: Da Quellen dupliziert werden, könnte dies zusätzliche System‐ oder Videoressourcen verbrauchen." QuickTransitions.HotkeyName="Schnellübergang: %1" Basic.AddTransition="Konfigurierbaren Übergang hinzufügen" @@ -220,7 +225,7 @@ Basic.TransitionProperties="Übergangseigenschaften" Basic.SceneTransitions="Szenenübergänge" Basic.TransitionDuration="Dauer" -Basic.TogglePreviewProgramMode="Studio-Modus" +Basic.TogglePreviewProgramMode="Studio‐Modus" TransitionNameDlg.Text="Bitte geben Sie den Namen des Übergangs ein" TransitionNameDlg.Title="Übergangsname" @@ -240,6 +245,9 @@ ConfirmStop.Title="Stream stoppen?" ConfirmStop.Text="Sind Sie sicher, dass Sie den Stream stoppen möchten?" +ConfirmStopRecord.Title="Aufnahme stoppen?" +ConfirmStopRecord.Text="Sind Sie sicher, dass Sie die Aufnahme stoppen möchten?" + ConfirmBWTest.Title="Bandbreitentest starten?" ConfirmBWTest.Text="Sie haben OBS im Bandbreitentestmodus konfiguriert. In diesem Modus können Sie Netzwerktests durchführen, ohne dass Ihr Kanal live geschaltet wird. Sobald Sie fertig mit dem Testen sind, müssen Sie ihn deaktivieren, damit die Zuschauer Ihren Stream sehen können.\n\nMöchten Sie fortfahren?" @@ -252,12 +260,14 @@ Output.StartStreamFailed="Fehler beim Starten des Streams" Output.StartRecordingFailed="Fehler beim Starten der Aufnahme" -Output.StartReplayFailed="Fehler beim Starten des Replaypuffers" -Output.StartFailedGeneric="Start der Ausgabe fehlgeschlagen. Bitte überprüfen Sie die Protokolldatei für Details.\n\nHinweis: Wenn Sie die NVENC- oder AMD-Kodierer verwenden, stellen Sie sicher, dass Ihre Videotreiber aktuell sind." +Output.StartReplayFailed="Fehler beim Starten des Replay‐Puffers" +Output.StartFailedGeneric="Start der Ausgabe fehlgeschlagen. Bitte überprüfen Sie die Protokolldatei für Details.\n\nHinweis: Wenn Sie die NVENC‐ oder AMD‐Kodierer verwenden, stellen Sie sicher, dass Ihre Videotreiber aktuell sind." +Output.ReplayBuffer.PauseWarning.Title="Kann beim Pausieren keine Replays speichern" +Output.ReplayBuffer.PauseWarning.Text="Warnung: Replays können beim Pausieren der Aufnahme nicht gespeichert werden." Output.ConnectFail.Title="Verbindung fehlgeschlagen" -Output.ConnectFail.BadPath="Ungültiger Pfad oder Verbindungs-URL. Bitte überprüfen Sie Ihre Einstellungen und stellen Sie sicher, dass diese korrekt sind." +Output.ConnectFail.BadPath="Ungültiger Pfad oder Verbindungs‐URL. Bitte überprüfen Sie Ihre Einstellungen und stellen Sie sicher, dass diese korrekt sind." Output.ConnectFail.ConnectFailed="Verbindung zum Server fehlgeschlagen" Output.ConnectFail.InvalidStream="Konnte nicht auf den angegebenen Kanal oder Streamschlüssel zugreifen. Bitte überprüfen Sie den eingegebenen Streamschlüssel. Wenn er richtig ist, kann es ein Problem beim Verbinden mit dem Server gegeben haben." Output.ConnectFail.Error="Ein unerwarteter Fehler ist beim Verbindungsversuch zum Server aufgetreten. Mehr Informationen finden Sie in der Protokolldatei." @@ -274,7 +284,7 @@ Output.RecordError.Msg="Während der Aufnahme ist ein unbekannter Fehler aufgetreten." Output.RecordError.EncodeErrorMsg="Ein Kodierungsfehler ist beim Aufnehmen aufgetreten." Output.ReplayBuffer.NoHotkey.Title="Kein Hotkey festgelegt" -Output.ReplayBuffer.NoHotkey.Msg="Kein „Replay speichern“-Hotkey für Replaypuffer festgelegt. Legen Sie bitte den „Speichern“-Hotkey fest, der zum Speichern der Replayaufnahmen verwendet werden soll." +Output.ReplayBuffer.NoHotkey.Msg="Kein „Replay speichern“‐Hotkey für den Replay‐Puffer festgelegt. Legen Sie bitte den Speichern‐Hotkey fest, der zum Speichern der Replay‐Aufnahmen verwendet werden soll." Output.BadPath.Title="Ungültiger Dateipfad" Output.BadPath.Text="Der konfigurierte Ausgabepfad ist ungültig. Bitte überprüfen Sie Ihre Einstellungen und stellen Sie sicher, dass ein gültiger Pfad angegeben wurde." @@ -283,29 +293,29 @@ LogReturnDialog.CopyURL="URL kopieren" LogReturnDialog.ErrorUploadingLog="Fehler beim Hochladen der Protokolldatei" -Remux.SourceFile="OBS-Aufnahme" +Remux.SourceFile="OBS‐Aufnahme" Remux.TargetFile="Zieldatei" Remux.Remux="Remuxen" Remux.Stop="Remuxen stoppen" Remux.ClearFinished="Fertiggestellte Objekte entfernen" Remux.ClearAll="Alle Objekte entfernen" -Remux.OBSRecording="OBS-Aufnahme" +Remux.OBSRecording="OBS‐Aufnahme" Remux.FinishedTitle="Remuxen beendet" Remux.Finished="Aufnahme remuxed" Remux.FinishedError="Aufnahme remuxed, aber die Datei könnte unvollständig sein" -Remux.SelectRecording="OBS-Aufnahme auswählen …" +Remux.SelectRecording="OBS‐Aufnahme auswählen …" Remux.SelectTarget="Zieldatei auswählen" Remux.FileExistsTitle="Zieldateien existieren bereits" Remux.FileExists="Die folgenden Zieldateien existieren bereits. Möchten Sie diese ersetzen?" Remux.ExitUnfinishedTitle="Remuxen in Bearbeitung" Remux.ExitUnfinished="Das Remuxen ist noch nicht beendet. Wenn Sie jetzt stoppen, kann die Zieldatei unbrauchbar werden.\nSind Sie sicher, dass Sie das Remuxen beenden möchten?" -Remux.HelpText="Legen Sie Dateien in diesem Fenster ab, um sie zu remuxen oder wählen Sie eine leere „OBS-Aufnahme“-Zelle aus, um nach einer Datei zu suchen." +Remux.HelpText="Legen Sie Dateien in diesem Fenster ab, um sie zu remuxen oder wählen Sie eine leere „OBS‐Aufnahme“‐Zelle aus, um nach einer Datei zu suchen." UpdateAvailable="Neues Update verfügbar" UpdateAvailable.Text="Version %1.%2.%3 ist nun verfügbar. <a href='%4'>Hier klicken zum Herunterladen</a>" -Basic.DesktopDevice1="Desktop-Audio" -Basic.DesktopDevice2="Desktop-Audio 2" +Basic.DesktopDevice1="Desktop‐Audio" +Basic.DesktopDevice2="Desktop‐Audio 2" Basic.AuxDevice1="Mic/Aux" Basic.AuxDevice2="Mic/Aux 2" Basic.AuxDevice3="Mic/Aux 3" @@ -383,35 +393,35 @@ Basic.PropertiesWindow.AddEditableListEntry="Eintrag zu „%1“ hinzufügen" Basic.PropertiesWindow.EditEditableListEntry="Eintrag aus „%1“ bearbeiten" -Basic.PropertiesView.FPS.Simple="Einfache FPS-Werte" -Basic.PropertiesView.FPS.Rational="Rationale FPS-Werte" -Basic.PropertiesView.FPS.ValidFPSRanges="Gültige FPS-Bereiche:" +Basic.PropertiesView.FPS.Simple="Einfache FPS‐Werte" +Basic.PropertiesView.FPS.Rational="Rationale FPS‐Werte" +Basic.PropertiesView.FPS.ValidFPSRanges="Gültige FPS‐Bereiche:" Basic.InteractionWindow="Mit „%1“ interagieren" Basic.StatusBar.Reconnecting="Verbindung getrennt; Verbindungsversuch %1 in %2 Sekunde(n)" Basic.StatusBar.AttemptingReconnect="Versuche die Verbindung wiederherzustellen … (Versuch %1)" Basic.StatusBar.ReconnectSuccessful="Wiederverbinden erfolgreich" -Basic.StatusBar.Delay="Verzögerung (%1 s)" -Basic.StatusBar.DelayStartingIn="Verzögerung (starte in %1 s)" -Basic.StatusBar.DelayStoppingIn="Verzögerung (stoppe in %1 s)" -Basic.StatusBar.DelayStartingStoppingIn="Verzögerung (stoppe in %1 s, beginne in %2 s)" +Basic.StatusBar.Delay="Verzögerung (%1 s)" +Basic.StatusBar.DelayStartingIn="Verzögerung (starte in %1 s)" +Basic.StatusBar.DelayStoppingIn="Verzögerung (stoppe in %1 s)" +Basic.StatusBar.DelayStartingStoppingIn="Verzögerung (stoppe in %1 s, starte in %2 s)" Basic.Filters="Filter" -Basic.Filters.AsyncFilters="Audio-/Videofilter" +Basic.Filters.AsyncFilters="Audio‐/Videofilter" Basic.Filters.AudioFilters="Audiofilter" Basic.Filters.EffectFilters="Effektfilter" Basic.Filters.Title="Filter für „%1“" Basic.Filters.AddFilter.Title="Filtername" Basic.Filters.AddFilter.Text="Bitte geben Sie einen Namen für den Filter ein" -Basic.TransformWindow="Szenen-Elementtransformation" +Basic.TransformWindow="Szenen‐Elementtransformation" Basic.TransformWindow.Position="Position" Basic.TransformWindow.Rotation="Drehung" Basic.TransformWindow.Size="Größe" Basic.TransformWindow.Alignment="Ausrichtung" -Basic.TransformWindow.BoundsType="Bounding Box Typ" -Basic.TransformWindow.BoundsAlignment="Ausrichtung in Bounding Box" +Basic.TransformWindow.BoundsType="Begrenzungsrahmentyp" +Basic.TransformWindow.BoundsAlignment="Ausrichtung in Begrenzungsrahmen" Basic.TransformWindow.Bounds="BoundingBox Größe" Basic.TransformWindow.Crop="Zuschneiden" @@ -425,31 +435,33 @@ Basic.TransformWindow.Alignment.BottomCenter="Unten in der Mitte" Basic.TransformWindow.Alignment.BottomRight="Unten rechts" -Basic.TransformWindow.BoundsType.None="Keine Grenzen" +Basic.TransformWindow.BoundsType.None="Keine Begrenzungen" Basic.TransformWindow.BoundsType.MaxOnly="Nur maximale Größe" Basic.TransformWindow.BoundsType.ScaleInner="Auf innere Begrenzungen skalieren" Basic.TransformWindow.BoundsType.ScaleOuter="Auf äußere Begrenzungen skalieren" -Basic.TransformWindow.BoundsType.ScaleToWidth="Auf die Breite der Begrenzungen skalieren" -Basic.TransformWindow.BoundsType.ScaleToHeight="Auf die Höhe der Begrenzungen skalieren" -Basic.TransformWindow.BoundsType.Stretch="Bis zu den Begrenzungen strecken" +Basic.TransformWindow.BoundsType.ScaleToWidth="Auf Breite der Begrenzungen skalieren" +Basic.TransformWindow.BoundsType.ScaleToHeight="Auf Höhe der Begrenzungen skalieren" +Basic.TransformWindow.BoundsType.Stretch="Bis zu Begrenzungen strecken" Basic.Main.AddSourceHelp.Title="Quelle konnte nicht hinzugefügt werden" -Basic.Main.AddSourceHelp.Text="Sie müssen mindestens 1 Szene besitzen, um eine Quelle hinzuzufügen." +Basic.Main.AddSourceHelp.Text="Sie müssen mindestens eine Szene besitzen, um eine Quelle hinzuzufügen." Basic.Main.Scenes="Szenen" Basic.Main.Sources="Quellen" Basic.Main.Controls="Steuerung" -Basic.Main.Connecting="Verbinden …" +Basic.Main.Connecting="Verbinde …" Basic.Main.StartRecording="Aufnahme starten" -Basic.Main.StartReplayBuffer="Replaypuffer starten" +Basic.Main.StartReplayBuffer="Replay‐Puffer starten" Basic.Main.StartStreaming="Streaming starten" Basic.Main.StopRecording="Aufnahme stoppen" +Basic.Main.PauseRecording="Aufnahme pausieren" +Basic.Main.UnpauseRecording="Aufnahme fortsetzen" Basic.Main.StoppingRecording="Stoppe Aufnahme ..." -Basic.Main.StopReplayBuffer="Replaypuffer stoppen" -Basic.Main.StoppingReplayBuffer="Stoppe Replaypuffer …" -Basic.Main.StopStreaming="Streaming stoppen" -Basic.Main.StoppingStreaming="Stoppe Stream …" -Basic.Main.ForceStopStreaming="Streaming stoppen (Verzögerung missachten)" +Basic.Main.StopReplayBuffer="Replay‐Puffer stoppen" +Basic.Main.StoppingReplayBuffer="Stoppe Replay‐Puffer …" +Basic.Main.StopStreaming="Stream stoppen" +Basic.Main.StoppingStreaming="Stoppe Stream …" +Basic.Main.ForceStopStreaming="Stream stoppen (Verzögerung missachten)" Basic.Main.Group="Gruppe %1" Basic.Main.GroupItems="Ausgewählte Elemente gruppieren" Basic.Main.Ungroup="Gruppierung aufheben" @@ -460,7 +472,7 @@ Basic.MainMenu.File.ShowRecordings="Aufnahmen anzeigen (&R)" Basic.MainMenu.File.Remux="Aufnahmen re&muxen" Basic.MainMenu.File.Settings="Ein&stellungen" -Basic.MainMenu.File.ShowSettingsFolder="Einstellungenordner anzeigen" +Basic.MainMenu.File.ShowSettingsFolder="Einstellungsordner anzeigen" Basic.MainMenu.File.ShowProfileFolder="Profilordner anzeigen" Basic.MainMenu.AlwaysOnTop="Immer im Vordergrund (&A)" Basic.MainMenu.File.Exit="Beenden (&X)" @@ -473,10 +485,10 @@ Basic.MainMenu.Edit.LockPreview="Vorschau sperren (&L)" Basic.MainMenu.Edit.Scale="Vorschau&skalierung" Basic.MainMenu.Edit.Scale.Window="An Fenstergröße anpassen" -Basic.MainMenu.Edit.Scale.Canvas="Leinwand (%1×%2)" -Basic.MainMenu.Edit.Scale.Output="Ausgabe (%1×%2)" +Basic.MainMenu.Edit.Scale.Canvas="Leinwand (%1 × %2)" +Basic.MainMenu.Edit.Scale.Output="Ausgabe (%1 × %2)" Basic.MainMenu.Edit.Transform="&Transformieren" -Basic.MainMenu.Edit.Transform.EditTransform="Transformation b&earbeiten …" +Basic.MainMenu.Edit.Transform.EditTransform="Transformation b&earbeiten …" Basic.MainMenu.Edit.Transform.CopyTransform="Transformation kopieren" Basic.MainMenu.Edit.Transform.PasteTransform="Transformation einfügen" Basic.MainMenu.Edit.Transform.ResetTransform="Transformation zu&rücksetzen" @@ -502,10 +514,11 @@ Basic.MainMenu.View.Docks="Docks" Basic.MainMenu.View.Docks.ResetUI="GUI zurücksetzen" Basic.MainMenu.View.Docks.LockUI="GUI sperren" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Benutzerdefinierte Browser‐Docks …" Basic.MainMenu.View.Toolbars.Listboxes="&Listenfelder" -Basic.MainMenu.View.SceneTransitions="Szenenübergänge (&c)" +Basic.MainMenu.View.SceneTransitions="Szenenübergänge (&C)" Basic.MainMenu.View.StatusBar="&Statusleiste" -Basic.MainMenu.View.Fullscreen.Interface="Vollbildbenutzeroberfläche" +Basic.MainMenu.View.Fullscreen.Interface="Vollbild" Basic.MainMenu.SceneCollection="&Szenensammlung" Basic.MainMenu.Profile="&Profil" @@ -521,17 +534,17 @@ Basic.MainMenu.Help="&Hilfe" Basic.MainMenu.Help.HelpPortal="Hilfe&portal" Basic.MainMenu.Help.Website="&Webseite besuchen" -Basic.MainMenu.Help.Discord="Unserem &Discord-Server beitreten" +Basic.MainMenu.Help.Discord="&Discord‐Server beitreten" Basic.MainMenu.Help.Logs="Protoko&lldateien" Basic.MainMenu.Help.Logs.ShowLogs="Protokolldateien anzeigen (&S)" -Basic.MainMenu.Help.Logs.UploadCurrentLog="Aktuelle Protokolldatei hochladen (&C)" -Basic.MainMenu.Help.Logs.UploadLastLog="Neuste Protoko&lldatei hochladen" +Basic.MainMenu.Help.Logs.UploadCurrentLog="Derzeitige Protokolldatei hochladen (&C)" +Basic.MainMenu.Help.Logs.UploadLastLog="Letzte Protoko&lldatei hochladen" Basic.MainMenu.Help.Logs.ViewCurrentLog="Aktuelles Protokoll anzeigen (&V)" Basic.MainMenu.Help.CheckForUpdates="Nach Updates suchen" Basic.MainMenu.Help.CrashLogs="Abstu&rzberichte" Basic.MainMenu.Help.CrashLogs.ShowLogs="Ab&sturzberichte anzeigen" Basic.MainMenu.Help.CrashLogs.UploadLastLog="Neusten Absturzbericht hoch&laden" -Basic.MainMenu.Help.About="Über OBS Studio (&A)" +Basic.MainMenu.Help.About="Über (&A)" Basic.Settings.ProgramRestart="Das Programm muss neugestartet werden, damit die Änderungen wirksam werden." Basic.Settings.ConfirmTitle="Änderungen bestätigen" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Statistikenfenster beim Start öffnen" Basic.Settings.General.WarnBeforeStartingStream="Bestätigungsdialog beim Streamstart anzeigen" Basic.Settings.General.WarnBeforeStoppingStream="Bestätigungsdialog beim Streamstop anzeigen" +Basic.Settings.General.WarnBeforeStoppingRecord="Bestätigungsdialog beim Aufnahmestopp anzeigen" Basic.Settings.General.Projectors="Projektoren" Basic.Settings.General.HideProjectorCursor="Mauszeiger über Projektoren verstecken" Basic.Settings.General.ProjectorAlwaysOnTop="Projektoren immer im Vordergrund anzeigen" @@ -554,8 +568,8 @@ Basic.Settings.General.SnapDistance="Ausrichtungsempfindlichkeit" Basic.Settings.General.RecordWhenStreaming="Stream automatisch aufnehmen" Basic.Settings.General.KeepRecordingWhenStreamStops="Weiter aufnehmen, wenn der Stream stoppt" -Basic.Settings.General.ReplayBufferWhileStreaming="Replaypuffer automatisch beim Streamen starten" -Basic.Settings.General.KeepReplayBufferStreamStops="Replaypuffer weiter aktiv lassen, wenn der Stream stoppt" +Basic.Settings.General.ReplayBufferWhileStreaming="Replay‐Puffer automatisch beim Streamen starten" +Basic.Settings.General.KeepReplayBufferStreamStops="Replay‐Puffer weiter aktiv lassen, wenn der Stream stoppt" Basic.Settings.General.SysTray="Infobereich" Basic.Settings.General.SysTrayWhenStarted="Beim Start zum Infobereich minimieren" Basic.Settings.General.SystemTrayHideMinimize="Immer zum Infobereich anstatt zur Taskleiste minimieren" @@ -564,9 +578,9 @@ Basic.Settings.General.OverflowHidden="Überlauf verstecken" Basic.Settings.General.OverflowAlwaysVisible="Überlauf immer anzeigen" Basic.Settings.General.OverflowSelectionHidden="Überlauf trotz unsichtbarer Quelle anzeigen" -Basic.Settings.General.SwitchOnDoubleClick="Übergang zur Szene beim Doppelklicken" -Basic.Settings.General.StudioPortraitLayout="Porträt/Vertikales Layout aktivieren" -Basic.Settings.General.TogglePreviewProgramLabels="Vorschau-/Programmbeschriftung anzeigen" +Basic.Settings.General.SwitchOnDoubleClick="Übergang zur Szene beim Doppelklick" +Basic.Settings.General.StudioPortraitLayout="Porträt‐/Vertikales Layout aktivieren" +Basic.Settings.General.TogglePreviewProgramLabels="Vorschau‐/Programmbeschriftung anzeigen" Basic.Settings.General.Multiview="Multiview" Basic.Settings.General.Multiview.MouseSwitch="Klicken, um zwischen den Szenen umzuschalten" Basic.Settings.General.Multiview.DrawSourceNames="Szenennamen anzeigen" @@ -591,50 +605,54 @@ Basic.Settings.Output.SelectDirectory="Aufnahmeordner auswählen" Basic.Settings.Output.SelectFile="Aufnahmedatei auswählen" Basic.Settings.Output.EnforceBitrate="Bitratenlimit des Streamingdienstes erzwingen" +Basic.Settings.Output.DynamicBitrate="Bitrate dynamisch verändern, um Überlastung zu kontrollieren" +Basic.Settings.Output.DynamicBitrate.Beta="Bitrate dynamisch verändern, um Überlastung zu kontrollieren (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="Anstatt Frames wegfallen zu lassen, um Überlastung zu verringern, wird die Bitrate dynamisch verändert.\n\nBeachten Sie, dass dies die Verzögerung zu den Zuschauern bei erheblich unerwartet hoher Überlastung erhöhen kann.\nWenn die Bitrate fällt, kann der Wiederherstellungsvorgang ein paar Minuten dauern.\n\nDerzeit nur für RTMP unterstützt." Basic.Settings.Output.Mode="Ausgabemodus" Basic.Settings.Output.Mode.Simple="Einfach" Basic.Settings.Output.Mode.Adv="Erweitert" -Basic.Settings.Output.Mode.FFmpeg="FFmpeg-Ausgabe" -Basic.Settings.Output.UseReplayBuffer="Replaypuffer aktivieren" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximale Replayzeit (Sekunden)" -Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maximale Speichernutzung (RAM) in Megabyte" -Basic.Settings.Output.ReplayBuffer.Estimate="Geschätzte Speichernutzung (RAM): %1 MB" -Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Speichernutzung kann nicht geschätzt werden. Stellen Sie bitte die maximale Speichergrenze ein." -Basic.Settings.Output.ReplayBuffer.HotkeyMessage="(Hinweis: Achten Sie darauf, einen Hotkey für den Replaypuffer im Abschnitt „Hotkeys“ festzulegen)" -Basic.Settings.Output.ReplayBuffer.Prefix="Replaypuffer-Dateiname-Präfix" +Basic.Settings.Output.Mode.FFmpeg="FFmpeg‐Ausgabe" +Basic.Settings.Output.UseReplayBuffer="Replay‐Puffer aktivieren" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximale Replay‐Zeit" +Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maximale RAM‐Nutzung in MB" +Basic.Settings.Output.ReplayBuffer.Estimate="Geschätzte RAM‐Nutzung: %1 MB" +Basic.Settings.Output.ReplayBuffer.EstimateUnknown="RAM‐Nutzung kann nicht geschätzt werden. Stellen Sie diese bitte ein." +Basic.Settings.Output.ReplayBuffer.HotkeyMessage="(Hinweis: Achten Sie darauf, einen Hotkey für den Replay‐Puffer im Abschnitt Hotkeys festzulegen)" +Basic.Settings.Output.ReplayBuffer.Prefix="Replay‐Puffer‐Dateinamen‐Präfix" Basic.Settings.Output.ReplayBuffer.Suffix="Suffix" Basic.Settings.Output.Simple.SavePath="Aufnahmepfad" Basic.Settings.Output.Simple.RecordingQuality="Aufnahmequalität" -Basic.Settings.Output.Simple.RecordingQuality.Stream="Gleiche wie Stream" +Basic.Settings.Output.Simple.RecordingQuality.Stream="Gleich wie Stream" Basic.Settings.Output.Simple.RecordingQuality.Small="Hohe Qualität, mittelgroße Dateien" Basic.Settings.Output.Simple.RecordingQuality.HQ="Ununterscheidbare Qualität, große Dateien" Basic.Settings.Output.Simple.RecordingQuality.Lossless="Verlustfreie Qualität, enorm große Dateien" Basic.Settings.Output.Simple.Warn.VideoBitrate="Warnung: Die Videobitrate beim Streamen wird auf %1 festgelegt, was der Obergrenze des aktuellen Streamingdienstes entspricht. Falls Sie sicher sind, dass Sie %1 überschreiten wollen, deaktivieren Sie „Bitratenlimit des Streamingdienstes erzwingen“ in den erweiterten Kodierereinstellungen." Basic.Settings.Output.Simple.Warn.AudioBitrate="Warnung: Die Audiobitrate beim Streamen wird auf %1 festgelegt, was der Obergrenze des aktuellen Streamingdienstes entspricht. Falls Sie sicher sind, dass Sie %1 überschreiten wollen, deaktivieren Sie „Bitratenlimit des Streamingdienstes erzwingen“ in den erweiterten Kodierereinstellungen." -Basic.Settings.Output.Simple.Warn.Encoder="Warnung: Mit einem Software-Kodierer in einer anderen Qualität als der des Streams aufzunehmen erfordert zusätzliche CPU-Auslastung, wenn Sie gleichzeitig streamen und aufnehmen." -Basic.Settings.Output.Simple.Warn.Lossless="Warnung: Verlustfreie Qualität erzeugt enorm große Dateien! Verlustfreie Qualität kann mehr als 7 Gigabyte Speicherplatz pro Minute bei hohen Auflösungen und Frameraten in Anspruch nehmen. Verlustfrei ist für lange Aufnahmen nicht empfohlen, es sei denn, Sie haben eine sehr große Menge an Speicherplatz zur Verfügung." +Basic.Settings.Output.Simple.Warn.CannotPause="Warnung: Aufnahmen können nicht pausiert werden, wenn die Aufnahmequalität „Gleich wie Stream” ist." +Basic.Settings.Output.Simple.Warn.Encoder="Warnung: Mit einem Software‐Kodierer in einer anderen Qualität als der des Streams aufzunehmen erfordert zusätzliche CPU‐Auslastung, wenn Sie gleichzeitig streamen und aufnehmen." +Basic.Settings.Output.Simple.Warn.Lossless="Warnung: Verlustfreie Qualität erzeugt enorm große Dateien! Bei dieser Einstellung kann mehr als 7 Gigabyte Speicherplatz pro Minute bei hohen Auflösungen und Frameraten in Anspruch genommen werden. Sie ist für lange Aufnahmen daher nicht empfohlen, es sei denn, Sie haben eine sehr große Menge an Speicherplatz zur Verfügung." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Sind Sie sicher, dass Sie verlustfreie Qualität verwenden möchten?" -Basic.Settings.Output.Simple.Warn.Lossless.Title="Verlustfreie Qualitäts-Warnung" +Basic.Settings.Output.Simple.Warn.Lossless.Title="Warnung zur verlustfreien Qualität" Basic.Settings.Output.Simple.Encoder.Software="Software (x264)" Basic.Settings.Output.Simple.Encoder.Hardware.QSV="Hardware (QSV)" Basic.Settings.Output.Simple.Encoder.Hardware.AMD="Hardware (AMD)" Basic.Settings.Output.Simple.Encoder.Hardware.NVENC="Hardware (NVENC)" -Basic.Settings.Output.Simple.Encoder.SoftwareLowCPU="Software (x264 niedrige CPU-Auslastungsvoreinstellung, erhöht die Dateigröße)" +Basic.Settings.Output.Simple.Encoder.SoftwareLowCPU="Software (x264 niedrige CPU‐Auslastungsvoreinstellung, erhöht die Dateigröße)" Basic.Settings.Output.VideoBitrate="Videobitrate" Basic.Settings.Output.AudioBitrate="Audiobitrate" Basic.Settings.Output.Reconnect="Automatisch wiederverbinden" -Basic.Settings.Output.RetryDelay="Wiederverbindungsverzögerung (Sekunden)" +Basic.Settings.Output.RetryDelay="Wiederholungsverzögerung" Basic.Settings.Output.MaxRetries="Maximale Wiederholungsversuche" Basic.Settings.Output.Advanced="Erweiterte Kodierereinstellungen aktivieren" Basic.Settings.Output.EncoderPreset="Kodierervoreinstellung" -Basic.Settings.Output.CustomEncoderSettings="Benutzerdefinierte Kodierer-Einstellungen" +Basic.Settings.Output.CustomEncoderSettings="Benutzerdefinierte Kodierereinstellungen" Basic.Settings.Output.CustomMuxerSettings="Benutzerdefinierte Muxereinstellungen" Basic.Settings.Output.NoSpaceFileName="Dateinamen ohne Leerzeichen generieren" Basic.Settings.Output.Adv.Rescale="Ausgabe umskalieren" Basic.Settings.Output.Adv.AudioTrack="Audiospur" Basic.Settings.Output.Adv.Streaming="Streaming" -Basic.Settings.Output.Adv.ApplyServiceSettings="Streamingdienst-Kodierereinstellungen erzwingen" +Basic.Settings.Output.Adv.ApplyServiceSettings="Streamingdienst‐Kodierereinstellungen erzwingen" Basic.Settings.Output.Adv.Audio.Track1="Spur 1" Basic.Settings.Output.Adv.Audio.Track2="Spur 2" Basic.Settings.Output.Adv.Audio.Track3="Spur 3" @@ -647,54 +665,55 @@ Basic.Settings.Output.Adv.Recording.Type.Standard="Normal" Basic.Settings.Output.Adv.Recording.Type.FFmpegOutput="Benutzerdefinierte Ausgabe (FFmpeg)" Basic.Settings.Output.Adv.Recording.UseStreamEncoder="(Streamkodierer verwenden)" -Basic.Settings.Output.Adv.Recording.Filename="Dateinameformatierung" -Basic.Settings.Output.Adv.Recording.OverwriteIfExists="Überschreiben, wenn die Datei vorhanden ist" -Basic.Settings.Output.Adv.FFmpeg.Type="FFmpeg-Ausgabetyp" +Basic.Settings.Output.Adv.Recording.Filename="Dateinamenformatierung" +Basic.Settings.Output.Adv.Recording.OverwriteIfExists="Überschreiben, wenn Datei vorhanden" +Basic.Settings.Output.Adv.FFmpeg.Type="FFmpeg‐Ausgabetyp" Basic.Settings.Output.Adv.FFmpeg.Type.URL="Ausgabe zu URL" Basic.Settings.Output.Adv.FFmpeg.Type.RecordToFile="Ausgabe in Datei" Basic.Settings.Output.Adv.FFmpeg.SaveFilter.Common="Häufige Aufnahmeformate" Basic.Settings.Output.Adv.FFmpeg.SaveFilter.All="Alle Dateien" Basic.Settings.Output.Adv.FFmpeg.SavePathURL="Dateipfad oder URL" -Basic.Settings.Output.Adv.FFmpeg.Format="Container-Format" +Basic.Settings.Output.Adv.FFmpeg.Format="Container‐Format" Basic.Settings.Output.Adv.FFmpeg.FormatAudio="Audio" Basic.Settings.Output.Adv.FFmpeg.FormatVideo="Video" Basic.Settings.Output.Adv.FFmpeg.FormatDefault="Standardformat" -Basic.Settings.Output.Adv.FFmpeg.FormatDesc="Container-Formatbeschreibung" -Basic.Settings.Output.Adv.FFmpeg.FormatDescDef="Audio-/Videocodec wird aus Dateipfad oder URL gebildet" +Basic.Settings.Output.Adv.FFmpeg.FormatDesc="Container‐Formatbeschreibung" +Basic.Settings.Output.Adv.FFmpeg.FormatDescDef="Audio‐/Videocodec wird aus Dateipfad oder URL gebildet" Basic.Settings.Output.Adv.FFmpeg.AVEncoderDefault="Standardkodierer" Basic.Settings.Output.Adv.FFmpeg.AVEncoderDisable="Kodierer deaktivieren" Basic.Settings.Output.Adv.FFmpeg.VEncoder="Videokodierer" Basic.Settings.Output.Adv.FFmpeg.VEncoderSettings="Videokodierereinstellungen (falls angegeben)" Basic.Settings.Output.Adv.FFmpeg.AEncoder="Audiokodierer" Basic.Settings.Output.Adv.FFmpeg.AEncoderSettings="Audiokodierereinstellungen (falls angegeben)" -Basic.Settings.Output.Adv.FFmpeg.MuxerSettings="Muxer-Einstellungen (falls angegeben)" +Basic.Settings.Output.Adv.FFmpeg.MuxerSettings="Muxer‐Einstellungen (falls angegeben)" Basic.Settings.Output.Adv.FFmpeg.GOPSize="Keyframeintervall (Frames)" Basic.Settings.Output.Adv.FFmpeg.IgnoreCodecCompat="Zeige alle Codecs (auch wenn möglicherweise inkompatibel)" -FilenameFormatting.completer="%DD. %MM. %CCYY %hh-%mm-%ss\n%DD. %MM. %YY %hh-%mm-%ss\n%d. %m. %Y %H-%M-%S\n%d. %m. %y %H-%M-%S" +FilenameFormatting.completer="%DD. %MM. %CCYY %hh‐%mm‐%ss\n%DD. %MM. %YY %hh‐%mm‐%ss\n%d. %m. %Y %H‐%M‐%S\n%d. %m. %y %H‐%M‐%S" -FilenameFormatting.TT="%CCYY Jahr, vier Ziffern\n%YY Jahr, letzte zwei Ziffern (00–99)\n%MM Monat als Dezimalzahl (01–12)\n%DD Tag des Monats, mit Nullen aufgefüllt (01–31)\n%hh Stunden im 24-Stunden-Format (00–23)\n%mm Minute (00–59)\n%ss Sekunde (00–61)\n%% Ein %-Zeichen\n%a Abgekürzter Wochentagsname\n%A Voller Wochentagsname\n%b Abgekürzer Monatsname\n%B Voller Monatsname\n%d Tag des Monats, mit Nullen aufgefüllt (01–31)\n%H Stunden im 24-Stunden-Format (00–23)\n%I Stunden im 12-Stunden-Format (01–12)\n%m Monat als Dezimalzahl (01–12)\n%M Minute (00–59)\n%p Vormittags- oder nachmittags-Angabe\n%S Sekunde (00–61)\n%y Jahr, letzte zwei Ziffern (00–99)\n%Y Jahr\n%z ISO-8601-Verschiebung von UTC oder Zeitzone\n%Z Zeitzonenname oder Abkürzung" +FilenameFormatting.TT="%CCYY Jahr, vier Ziffern\n%YY Jahr, letzte zwei Ziffern (00–99)\n%MM Monat als Dezimalzahl (01–12)\n%DD Tag des Monats mit Nullen aufgefüllt (01–31)\n%hh Stunden im 24‐Stunden‐Format (00–23)\n%mm Minute (00–59)\n%ss Sekunde (00–61)\n%% Ein %‐Zeichen\n%a Abgekürzter Wochentagsname (Englisch)\n%A Voller Wochentagsname (Englisch)\n%b Abgekürzer Monatsname (Englisch)\n%B Voller Monatsname (Englisch)\n%d Tag des Monats, mit Nullen aufgefüllt (01–31)\n%H Stunden im 24‐Stunden‐Format (00–23)\n%I Stunden im 12‐Stunden‐Format (01–12)\n%m Monat als Dezimalzahl (01–12)\n%M Minute (00–59)\n%p Vormittags‐ oder nachmittags‐Angabe\n%S Sekunde (00–61)\n%y Jahr, letzte zwei Ziffern (00–99)\n%Y Jahr\n%z ISO‐8601‐Verschiebung von UTC oder Zeitzone\n%Z Zeitzonenname oder Abkürzung" Basic.Settings.Video="Video" Basic.Settings.Video.Adapter="Grafikkarte" -Basic.Settings.Video.BaseResolution="Basis-(Leinwand-)Auflösung" +Basic.Settings.Video.BaseResolution="Basis‐(Leinwand‐)Auflösung" Basic.Settings.Video.ScaledResolution="(Skalierte) Ausgabeauflösung" Basic.Settings.Video.DownscaleFilter="Skalierungsfilter" Basic.Settings.Video.DisableAeroWindows="Aero deaktivieren (nur Windows)" Basic.Settings.Video.FPS="FPS" -Basic.Settings.Video.FPSCommon="Übliche FPS-Werte" -Basic.Settings.Video.FPSInteger="Ganzzahl-FPS-Wert" -Basic.Settings.Video.FPSFraction="Bruch-FPS-Wert" +Basic.Settings.Video.FPSCommon="Übliche FPS‐Werte" +Basic.Settings.Video.FPSInteger="Ganzzahl‐FPS‐Wert" +Basic.Settings.Video.FPSFraction="Bruch‐FPS‐Wert" Basic.Settings.Video.Numerator="Zähler" Basic.Settings.Video.Denominator="Nenner" Basic.Settings.Video.Renderer="Renderer" -Basic.Settings.Video.InvalidResolution="Ungültige Auflösung. Korrekte Formatierung: [Breite]x[Höhe] (z. B. 1920x1080)" +Basic.Settings.Video.InvalidResolution="Ungültige Auflösung. Korrekte Formatierung: [Breite] × [Höhe] (z. B. 1920 × 1080)" Basic.Settings.Video.CurrentlyActive="Videoausgabe ist derzeit aktiv. Bitte schalten Sie alle Ausgaben ab, um die Videoeinstellungen zu ändern." Basic.Settings.Video.DisableAero="Aero deaktivieren" Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (am schnellsten, aber Unscharf bei Skalierung)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (geschärfte Skalierung, 16 Stichproben)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (geschärfte Skalierung, 32 Stichproben)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (geschärfte Skalierung, 36 Stichproben)" +Basic.Settings.Video.DownscaleFilter.Area="Bereich (gewichtete Summe, 4/6/9 Stichproben)" Basic.Settings.Audio="Audio" Basic.Settings.Audio.SampleRate="Abtastrate" @@ -706,22 +725,22 @@ Basic.Settings.Audio.MeterDecayRate.Slow="Langsam (Type II PPM)" Basic.Settings.Audio.PeakMeterType="Spitzenmessertyp" Basic.Settings.Audio.PeakMeterType.SamplePeak="Sample Peak" -Basic.Settings.Audio.PeakMeterType.TruePeak="True Peak (höhere CPU-Auslastung)" -Basic.Settings.Audio.MultiChannelWarning.Enabled="WARNUNG: Surround-Sound-Audio ist aktiviert." -Basic.Settings.Audio.MultichannelWarning="Überprüfen Sie beim Streaming, ob Ihr Streamingdienst sowohl die Einspeisung von Surround-Sound als auch die Surround-Sound-Wiedergabe unterstützt. Twitch, Facebook 360 Live, Mixer RTMP und Smashcast sind Beispiele, bei denen Surround-Sound voll unterstützt wird. Obwohl Facebook Live und YouTube Live beide die Surround-Einspeisung akzeptieren, wird Facebook Live auf Stereo heruntergemischt und YouTube Live spielt nur zwei Kanäle ab.\n\nOBS-Audiofilter sind mit Surround-Sound kompatibel, obwohl die VST-Pluginunterstützung nicht garantiert ist." -Basic.Settings.Audio.MultichannelWarning.Title="Surround-Sound-Audio aktivieren?" -Basic.Settings.Audio.MultichannelWarning.Confirm="Sind Sie sicher, dass Sie Surround-Sound-Audio wirklich aktivieren möchten?" +Basic.Settings.Audio.PeakMeterType.TruePeak="True Peak (höhere CPU‐Auslastung)" +Basic.Settings.Audio.MultiChannelWarning.Enabled="WARNUNG: Surround‐Sound‐Audio ist aktiviert." +Basic.Settings.Audio.MultichannelWarning="Überprüfen Sie beim Streaming, ob Ihr Streamingdienst sowohl die Einspeisung von Surround‐Sound als auch die Surround‐Sound‐Wiedergabe unterstützt. Facebook 360 Live, Mixer RTMP und Smashcast sind Beispiele, bei denen Surround‐Sound voll unterstützt wird. Obwohl Facebook Live und YouTube Live beide die Surround‐Einspeisung akzeptieren, wird Facebook Live auf Stereo heruntergemischt und YouTube Live spielt nur zwei Kanäle ab.\n\nOBS‐Audiofilter sind mit Surround‐Sound kompatibel, obwohl die VST‐Pluginunterstützung nicht garantiert ist." +Basic.Settings.Audio.MultichannelWarning.Title="Surround‐Sound‐Audio aktivieren?" +Basic.Settings.Audio.MultichannelWarning.Confirm="Sind Sie sicher, dass Sie Surround‐Sound‐Audio wirklich aktivieren möchten?" Basic.Settings.Audio.Devices="Geräte" -Basic.Settings.Audio.DesktopDevice="Desktop-Audio" -Basic.Settings.Audio.DesktopDevice2="Desktop-Audio 2" +Basic.Settings.Audio.DesktopDevice="Desktop‐Audio" +Basic.Settings.Audio.DesktopDevice2="Desktop‐Audio 2" Basic.Settings.Audio.AuxDevice="Mikrofon/Audiogerät" Basic.Settings.Audio.AuxDevice2="Mikrofon/Audiogerät 2" Basic.Settings.Audio.AuxDevice3="Mikrofon/Audiogerät 3" Basic.Settings.Audio.AuxDevice4="Mikrofon/Audiogerät 4" -Basic.Settings.Audio.EnablePushToMute="Push-To-Mute aktivieren" -Basic.Settings.Audio.PushToMuteDelay="Push-To-Mute-Verzögerung" -Basic.Settings.Audio.EnablePushToTalk="Push-To-Talk aktivieren" -Basic.Settings.Audio.PushToTalkDelay="Push-To-Talk-Verzögerung" +Basic.Settings.Audio.EnablePushToMute="Push‐To‐Mute aktivieren" +Basic.Settings.Audio.PushToMuteDelay="Push‐To‐Mute‐Verzögerung" +Basic.Settings.Audio.EnablePushToTalk="Push‐To‐Talk aktivieren" +Basic.Settings.Audio.PushToTalkDelay="Push‐To‐Talk‐Verzögerung" Basic.Settings.Audio.UnknownAudioDevice="[Gerät nicht angeschlossen oder nicht verfügbar]" Basic.Settings.Audio.Disabled="Deaktiviert" @@ -732,35 +751,38 @@ Basic.Settings.Advanced.General.ProcessPriority.Normal="Normal" Basic.Settings.Advanced.General.ProcessPriority.BelowNormal="Niedriger als normal" Basic.Settings.Advanced.General.ProcessPriority.Idle="Niedrig" -Basic.Settings.Advanced.FormatWarning="Warnung: Andere Farbformate als NV12 sind in erster Linie für die Aufnahme bestimmt und sind für Streaming nicht zu empfehlen. Die erforderliche Farbformatkonvertierung kann eine erhöhte CPU-Auslastung hervorrufen." +Basic.Settings.Advanced.FormatWarning="Warnung: Andere Farbformate als NV12 sind in erster Linie für die Aufnahme bestimmt und sind für Streaming nicht zu empfehlen. Die erforderliche Farbformatkonvertierung kann eine erhöhte CPU‐Auslastung hervorrufen." Basic.Settings.Advanced.Audio.BufferingTime="Audiopufferungszeit" Basic.Settings.Advanced.Video.ColorFormat="Farbformat" Basic.Settings.Advanced.Video.ColorSpace="Farbraum" Basic.Settings.Advanced.Video.ColorRange="Farbbereich" Basic.Settings.Advanced.Video.ColorRange.Partial="Begrenzt" Basic.Settings.Advanced.Video.ColorRange.Full="Voll" -Basic.Settings.Advanced.Audio.MonitoringDevice="Monitoring-Gerät" +Basic.Settings.Advanced.Audio.MonitoringDevice="Monitoring‐Gerät" Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Standard" -Basic.Settings.Advanced.Audio.DisableAudioDucking="Windows-Audioducking deaktivieren" +Basic.Settings.Advanced.Audio.DisableAudioDucking="Windows‐Audioducking deaktivieren" Basic.Settings.Advanced.StreamDelay="Streamverzögerung" -Basic.Settings.Advanced.StreamDelay.Duration="Dauer (Sekunden)" +Basic.Settings.Advanced.StreamDelay.Duration="Dauer" Basic.Settings.Advanced.StreamDelay.Preserve="Lückenloses Wiederverbinden (erhöht Verzögerung, um Videoverlust zu vermeiden)" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Geschätzte Speichernutzung: %1 MB" Basic.Settings.Advanced.Network="Netzwerk" Basic.Settings.Advanced.Network.BindToIP="Interface" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Neuen Netzwerkcode aktivieren" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Niedriger Latenzmodus" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Hotkeyfokusverhalten" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Hotkeys nie deaktivieren" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Hotkeys deaktivieren, wenn das Hauptfenster im Fokus ist" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Hotkeys deaktivieren, wenn Hauptfenster nicht im Fokus" Basic.Settings.Advanced.AutoRemux="Automatisch zu mp4 remuxen" Basic.Settings.Advanced.AutoRemux.MP4="(als mkv aufnehmen)" Basic.AdvAudio="Erweiterte Audioeigenschaften" Basic.AdvAudio.Name="Name" Basic.AdvAudio.Volume="Lautstärke" -Basic.AdvAudio.Mono="Heruntermischen zu Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balance" -Basic.AdvAudio.SyncOffset="Sync-Verschiebung (ms)" -Basic.AdvAudio.Monitoring="Audio-Monitoring" +Basic.AdvAudio.SyncOffset="Synchronisationsausgleich" +Basic.AdvAudio.Monitoring="Audio‐Monitoring" Basic.AdvAudio.Monitoring.None="Monitor aus" Basic.AdvAudio.Monitoring.MonitorOnly="Nur Monitor (Ausgabe stummschalten)" Basic.AdvAudio.Monitoring.Both="Monitor und Ausgabe" @@ -775,16 +797,16 @@ Basic.SystemTray.Show="Anzeigen" Basic.SystemTray.Hide="Ausblenden" -Basic.SystemTray.Message.Reconnecting="Verbindung verloren. Verbinde erneut …" +Basic.SystemTray.Message.Reconnecting="Verbindung verloren. Verbinde erneut …" Hotkeys.Insert="Einfügen" Hotkeys.Delete="Entfernen" Hotkeys.Home="Pos1" Hotkeys.End="Ende" -Hotkeys.PageUp="Bild-auf" -Hotkeys.PageDown="Bild-ab" -Hotkeys.NumLock="Num-Taste" -Hotkeys.ScrollLock="Rollen-Taste" +Hotkeys.PageUp="Bild‐auf" +Hotkeys.PageDown="Bild‐ab" +Hotkeys.NumLock="Num‐Taste" +Hotkeys.ScrollLock="Rollen‐Taste" Hotkeys.CapsLock="Feststelltaste" Hotkeys.Backspace="Rücktaste" Hotkeys.Tab="Tabulator" @@ -816,39 +838,40 @@ Mute="Stumm" Unmute="Stumm aus" -Push-to-mute="Push-To-Mute" -Push-to-talk="Push-To-Talk" +Push-to-mute="Push‐To‐Mute" +Push-to-talk="Push‐To‐Talk" SceneItemShow="„%1“ anzeigen" SceneItemHide="„%1“ verstecken" OutputWarnings.NoTracksSelected="Sie müssen mindestens eine Spur auswählen" -OutputWarnings.MultiTrackRecording="Warnung: Bestimmte Formate (z. B. FLV) unterstüzen nicht mehrere Spuren pro Aufnahme" -OutputWarnings.MP4Recording="Warnung: Aufnahmen, die in MP4/MOV gespeichert werden, sind nicht wiederherstellbar, wenn die Datei nicht abgeschlossen werden konnte (z. B. als Folge von BSODs, Stromausfällen, etc.). Wenn Sie mehrere Audiospuren aufnehmen möchten, sollten Sie MKV verwenden und die Aufnahme zu MP4/MOV remuxen, nachdem sie fertig ist (Datei → Aufnahmen remuxen)." +OutputWarnings.MultiTrackRecording="Warnung: Bestimmte Formate (wie FLV) unterstützen nicht mehrere Spuren pro Aufnahme" +OutputWarnings.MP4Recording="Warnung: Aufnahmen, die in MP4/MOV gespeichert werden, sind nicht wiederherstellbar, wenn die Datei nicht abgeschlossen werden konnte (z. B. als Folge von BSODs, Stromausfällen, etc.). Wenn Sie mehrere Audiospuren aufnehmen möchten, sollten Sie MKV verwenden und die Aufnahme zu MP4/MOV remuxen, nachdem sie fertig ist (Datei → Aufnahmen remuxen)." +OutputWarnings.CannotPause="Warnung: Aufnahmen können nicht pausiert werden, wenn der Aufnahmekodierer auf „(Streamkodierer verwenden)” gesetzt ist" FinalScene.Title="Szene löschen" FinalScene.Text="Es muss mindestens eine Szene vorhanden sein." NoSources.Title="Keine Quellen" NoSources.Text="Offenbar haben Sie noch keine Videoquellen hinzugefügt, sodass nur ein leerer Bildschirm ausgegeben wird. Sind Sie sicher, dass Sie das wollen?" -NoSources.Text.AddSource="Sie können jederzeit Quellen hinzufügen, indem Sie auf das +-Symbol unter dem Quellenfeld im Hauptfenster klicken." -NoSources.Label="Sie haben bis jetzt keine Quellen hinzugefügt.\nKlicken Sie auf das +-Symbol oder\nrechtsklicken Sie hier, um eine hinzuzufügen." +NoSources.Text.AddSource="Sie können jederzeit Quellen hinzufügen, indem Sie auf das +‐Symbol unter dem Quellenfeld im Hauptfenster klicken." +NoSources.Label="Sie haben bis jetzt keine Quellen hinzugefügt.\nKlicken Sie auf das +‐Symbol oder\nrechtsklicken Sie hier, um eine hinzuzufügen." ChangeBG="Farbe auswählen" CustomColor="Benutzerdefinierte Farbe" -BrowserSource.EnableHardwareAcceleration="Browser-Hardwarebeschleunigung aktivieren" +BrowserSource.EnableHardwareAcceleration="Browser‐Hardwarebeschleunigung aktivieren" About="Über OBS Studio" -About.Info="OBS Studio ist eine freie und Open-Source-Videoaufnahme- und Livestreaming-Software." +About.Info="OBS Studio ist eine freie und Open‐Source‐Videoaufnahme‐ und Livestreaming‐Software." About.Donate="Beitrag leisten" About.GetInvolved="Mitwirken" About.Authors="Autoren" About.License="Lizenzvereinbarung" -About.Contribute="Das OBS-Projekt unterstützen" +About.Contribute="Das OBS‐Projekt unterstützen" ResizeOutputSizeOfSource="Ausgabeauflösung anpassen (Quellgröße)" -ResizeOutputSizeOfSource.Text="Die Basis- und Ausgabeauflösung wird auf die Größe der aktuellen Quelle geändert." +ResizeOutputSizeOfSource.Text="Die Basis‐ und Ausgabeauflösung wird auf die Größe der aktuellen Quelle geändert." ResizeOutputSizeOfSource.Continue="Möchten Sie fortfahren?" PreviewTransition="Übergangsvorschau"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/el-GR.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/el-GR.ini
Changed
@@ -5,7 +5,7 @@ OK="ΟΚ" Apply="Εφαρμογή" Cancel="Ακύρωση" -Close="Κλείσιμο" +Close="Κλείσε" Save="Αποθήκευση" Discard="Απόρριψη" Disable="Απενεργοποίηση" @@ -23,7 +23,6 @@ Display="Οθόνη" Name="Όνομα" Exit="Έξοδος" -Mixer="Μίκτης" Browse="Αναζήτηση" Mono="Μονοφωνικό" Stereo="Στερεοφωνικό" @@ -54,7 +53,7 @@ QuickTransitions="Γρήγορες Μεταβάσεις" Left="Αριστερά" Right="Δεξιά" -Top="Επάνω" +Top="Πάνω" Bottom="Κάτω" Reset="Επαναφορά" Hours="Ώρες" @@ -87,6 +86,7 @@ + Copy.Filters="Αντιγραφή Φίλτρων" Paste.Filters="Επικόλληση Φίλτρων" @@ -208,6 +208,7 @@ ConfirmStop.Text="Είστε σίγουροι οτι θέλετε να διακόψετε τη ροή;" + ConfirmExit.Title="Έξοδος από το OBS;" ConfirmExit.Text="Το OBS είναι προσωρινά ενεργό. Όλες οι ροές/καταγραφές θα τερματιστούν. Είστε σίγουροι ότι επιθυμείτε να το κλείσετε;" @@ -542,7 +543,6 @@ Basic.Settings.Output.Mode.Adv="Για Προχωρημένους" Basic.Settings.Output.Mode.FFmpeg="Έξοδος FFmpeg" Basic.Settings.Output.UseReplayBuffer="Ενεργοποίηση Επανάληψης Προσωρινής Μνήμης" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Μέγιστος Χρόνος Επανάληψης (Δευτερόλεπτα)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Μέγιστη Μνήμη (Megabytes)" Basic.Settings.Output.ReplayBuffer.Estimate="Εκτιμώμενη χρήση μνήμης: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Δεν είναι δυνατή η εκτίμηση της χρήσης μνήμης. Ορίστε μέγιστο όριο μνήμης." @@ -569,7 +569,6 @@ Basic.Settings.Output.VideoBitrate="Ρυθμός Μετάδοσης Bit του Βίντεο" Basic.Settings.Output.AudioBitrate="Ρυθμός Μετάδοσης Bit του Ήχου" Basic.Settings.Output.Reconnect="Αυτόματη Επανασύνδεση" -Basic.Settings.Output.RetryDelay="Καθυστέρηση Επανάληψης (δευτερόλεπτα)" Basic.Settings.Output.MaxRetries="Μέγιστος Αριθμός Επαναλήψεων" Basic.Settings.Output.Advanced="Ενεργοποίηση Ρυθμίσεων Κωδικοποιητή Για Προχωρημένους" Basic.Settings.Output.CustomEncoderSettings="Προσαρμοσμένες Ρυθμίσεις Κωδικοποιητή" @@ -638,7 +637,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Διγραμμικό (Πιο γρήγορο, αλλά θολό στην κλιμάκωση)" Basic.Settings.Video.DownscaleFilter.Bicubic="Δικυβικό (Οξυμμένη κλιμάκωση, 16 δείγματα)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Οξυμμένη κλιμάκωση, 32 δείγματα)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Οξυμμένη κλιμάκωση, 36 δείγματα)" Basic.Settings.Audio="Ήχος" Basic.Settings.Audio.SampleRate="Ρυθμός Δειγματοληψίας" @@ -650,7 +649,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Δείγμα Αιχμής" Basic.Settings.Audio.PeakMeterType.TruePeak="Πραγματική Αιχμή (Υψηλότερη χρήση της CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="Προειδοποίηση: Ο ήχος Surround είναι ενεργοποιημένος." -Basic.Settings.Audio.MultichannelWarning="Κατά τη ροή, ελέγξτε αν η υπηρεσία ροής υποστηρίζει ήχο surround και ήχο surround αναπαραγωγής. Το Twitch, το Facebook 360 Live, το Mixer RTMP καί το Smashcast αποτελούν παραδείγματα όπου ο surround ήχος υποστηρίζεται πλήρως. Αν και το Facebook Live και το YouTube Live αποδέχονται τον ήχο surround, το Facebook Live τον υποβιβάζει σε stereo, και το YouTube Live παίζει μόνο σε δύο κανάλια.\n\nΤα φίλτρα ήχου του OBS είναι συμβατά με ήχο surround, αν καί δεν είναι εγγυημένη η υποστήριξη για plugins VST." +Basic.Settings.Audio.MultichannelWarning="Κατά τη ροή, ελέγξτε αν η υπηρεσία ροής υποστηρίζει ήχο surround και ήχο surround αναπαραγωγής. Το Facebook 360 Live, το Mixer RTMP καί το Smashcast αποτελούν παραδείγματα όπου ο surround ήχος υποστηρίζεται πλήρως. Αν και το Facebook Live και το YouTube Live αποδέχονται τον ήχο surround, το Facebook Live τον υποβιβάζει σε stereo, και το YouTube Live παίζει μόνο σε δύο κανάλια.\n\nΤα φίλτρα ήχου του OBS είναι συμβατά με ήχο surround, αν καί δεν είναι εγγυημένη η υποστήριξη για plugins VST." Basic.Settings.Audio.MultichannelWarning.Title="Ενεργοποίηση ήχου surround;" Basic.Settings.Audio.MultichannelWarning.Confirm="Είστε βέβαιοι ότι θέλετε να ενεργοποιήσετε τον ήχο surround;" Basic.Settings.Audio.EnablePushToMute="Ενεργοποίηση της Πίεσης-για-σίγαση" @@ -674,7 +673,6 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Προεπιλεγμένη" Basic.Settings.Advanced.Audio.DisableAudioDucking="Απενεργοποίηση Σίγασης Ήχου Windows" Basic.Settings.Advanced.StreamDelay="Καθυστέρηση Ροής" -Basic.Settings.Advanced.StreamDelay.Duration="Διάρκεια (δευτερόλεπτα)" Basic.Settings.Advanced.StreamDelay.Preserve="Διατήρηση σημείου αποκοπής (αύξηση καθυστέρησης) κατά την επανασύνδεση" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Εκτιμώμενη Χρήση Μνήμης: %1 MB" Basic.Settings.Advanced.Network="Δίκτυο" @@ -687,9 +685,7 @@ Basic.AdvAudio="Ιδιότητες Ήχου για Προχωρημένους" Basic.AdvAudio.Name="Όνομα" -Basic.AdvAudio.Mono="Υποβίβαση σε Μονοφωνικό" Basic.AdvAudio.Balance="Εξισορρόπηση" -Basic.AdvAudio.SyncOffset="Μετατόπιση Συγχρονισμού (ms)" Basic.AdvAudio.Monitoring="Ηχητική Παρακολούθηση" Basic.AdvAudio.Monitoring.None="Τερματισμός Παρακολούθησης" Basic.AdvAudio.Monitoring.MonitorOnly="Παρακολούθηση Μόνο (σίγαση εξόδου)"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/en-US.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/en-US.ini
Changed
@@ -28,7 +28,7 @@ Display="Display" Name="Name" Exit="Exit" -Mixer="Mixer" +Mixer="Audio Mixer" Browse="Browse" Mono="Mono" Stereo="Stereo" @@ -98,6 +98,11 @@ DockCloseWarning.Title="Closing Dockable Window" DockCloseWarning.Text="You just closed a dockable window. If you'd like to show it again, use the View → Docks menu on the menu bar." +# extra browser panels dialog +ExtraBrowsers="Custom Browser Docks" +ExtraBrowsers.Info="Add docks by giving them a name and URL, then click Apply or Close to open the docks. You can add or remove docks at any time." +ExtraBrowsers.DockName="Dock Name" + # Auth Auth.Authing.Title="Authenticating..." Auth.Authing.Text="Authenticating with %1, please wait..." @@ -115,6 +120,7 @@ TwitchAuth.Feed="Twitch Activity Feed" TwitchAuth.TwoFactorFail.Title="Could not query stream key" TwitchAuth.TwoFactorFail.Text="OBS was unable to connect to your Twitch account. Please make sure two-factor authentication is set up in your <a href='https://www.twitch.tv/settings/security'>Twitch security settings</a> as this is required to stream." +RestreamAuth.Channels="Restream Channels" # copy filters Copy.Filters="Copy Filters" @@ -152,7 +158,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Note: The canvas (base) resolution is not necessarily the same as the resolution you will stream or record with. Your actual stream/recording resolution may be scaled down from the canvas resolution to reduce resource usage or bitrate requirements." Basic.AutoConfig.StreamPage="Stream Information" Basic.AutoConfig.StreamPage.SubTitle="Please enter your stream information" -Basic.AutoConfig.StreamPage.ConnectAccount="Connect Account (optional)" +Basic.AutoConfig.StreamPage.ConnectAccount="Connect Account (recommended)" Basic.AutoConfig.StreamPage.DisconnectAccount="Disconnect Account" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Disconnect Account?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="This change will apply immediately. Are you sure you want to disconnect your account?" @@ -262,6 +268,10 @@ ConfirmStop.Title="Stop Stream?" ConfirmStop.Text="Are you sure you want to stop the stream?" +# confirm stop record dialog box +ConfirmStopRecord.Title="Stop Recording?" +ConfirmStopRecord.Text="Are you sure you want to stop recording?" + # confirm bandwidth test dialog box ConfirmBWTest.Title="Start Bandwidth Test?" ConfirmBWTest.Text="You have OBS configured in bandwidth test mode. This mode allows for network testing without your channel going live. Once you are done testing, you will need to disable it in order for viewers to be able to see your stream.\n\nDo you want to continue?" @@ -281,6 +291,9 @@ Output.StartReplayFailed="Failed to start replay buffer" Output.StartFailedGeneric="Starting the output failed. Please check the log for details.\n\nNote: If you are using the NVENC or AMD encoders, make sure your video drivers are up to date." +# replay buffer + pause warning message +Output.ReplayBuffer.PauseWarning.Title="Cannot save replays while paused" +Output.ReplayBuffer.PauseWarning.Text="Warning: Replays cannot be saved while recording is paused." # output connect messages Output.ConnectFail.Title="Failed to connect" @@ -501,6 +514,8 @@ Basic.Main.StartReplayBuffer="Start Replay Buffer" Basic.Main.StartStreaming="Start Streaming" Basic.Main.StopRecording="Stop Recording" +Basic.Main.PauseRecording="Pause Recording" +Basic.Main.UnpauseRecording="Unpause Recording" Basic.Main.StoppingRecording="Stopping Recording..." Basic.Main.StopReplayBuffer="Stop Replay Buffer" Basic.Main.StoppingReplayBuffer="Stopping Replay Buffer..." @@ -562,6 +577,7 @@ Basic.MainMenu.View.Docks="Docks" Basic.MainMenu.View.Docks.ResetUI="Reset UI" Basic.MainMenu.View.Docks.LockUI="Lock UI" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Custom Browser Docks..." Basic.MainMenu.View.Toolbars.Listboxes="&Listboxes" Basic.MainMenu.View.SceneTransitions="S&cene Transitions" Basic.MainMenu.View.StatusBar="&Status Bar" @@ -609,6 +625,7 @@ Basic.Settings.General.OpenStatsOnStartup="Open stats dialog on startup" Basic.Settings.General.WarnBeforeStartingStream="Show confirmation dialog when starting streams" Basic.Settings.General.WarnBeforeStoppingStream="Show confirmation dialog when stopping streams" +Basic.Settings.General.WarnBeforeStoppingRecord="Show confirmation dialog when stopping recording" Basic.Settings.General.Projectors="Projectors" Basic.Settings.General.HideProjectorCursor="Hide cursor over projectors" Basic.Settings.General.ProjectorAlwaysOnTop="Make projectors always on top" @@ -658,12 +675,15 @@ Basic.Settings.Output.SelectDirectory="Select Recording Directory" Basic.Settings.Output.SelectFile="Select Recording File" Basic.Settings.Output.EnforceBitrate="Enforce streaming service bitrate limits" +Basic.Settings.Output.DynamicBitrate="Dynamically change bitrate to manage congestion" +Basic.Settings.Output.DynamicBitrate.Beta="Dynamically change bitrate to manage congestion (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="Instead of dropping frames to reduce congestion, dynamically changes bitrate on the fly.\n\nNote that this can increase delay to viewers if there is significant sudden congestion.\nWhen the bitrate drops, it can take up to a few minutes to restore.\n\nCurrently only supported for RTMP." Basic.Settings.Output.Mode="Output Mode" Basic.Settings.Output.Mode.Simple="Simple" Basic.Settings.Output.Mode.Adv="Advanced" Basic.Settings.Output.Mode.FFmpeg="FFmpeg Output" Basic.Settings.Output.UseReplayBuffer="Enable Replay Buffer" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximum Replay Time (Seconds)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximum Replay Time" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maximum Memory (Megabytes)" Basic.Settings.Output.ReplayBuffer.Estimate="Estimated memory usage: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Cannot estimate memory usage. Please set maximum memory limit." @@ -678,6 +698,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Lossless Quality, Tremendously Large File Size" Basic.Settings.Output.Simple.Warn.VideoBitrate="Warning: The streaming video bitrate will be set to %1, which is the upper limit for the current streaming service. If you're sure you want to go above %1, enable advanced encoder options and uncheck \"Enforce streaming service bitrate limits\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Warning: The streaming audio bitrate will be set to %1, which is the upper limit for the current streaming service. If you're sure you want to go above %1, enable advanced encoder options and uncheck \"Enforce streaming service bitrate limits\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Warning: Recordings cannot be paused if the recording quality is set to \"Same as stream\"." Basic.Settings.Output.Simple.Warn.Encoder="Warning: Recording with a software encoder at a different quality than the stream will require extra CPU usage if you stream and record at the same time." Basic.Settings.Output.Simple.Warn.Lossless="Warning: Lossless quality generates tremendously large file sizes! Lossless quality can use upward of 7 gigabytes of disk space per minute at high resolutions and framerates. Lossless is not recommended for long recordings unless you have a very large amount of disk space available." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Are you sure you want to use lossless quality?" @@ -690,7 +711,7 @@ Basic.Settings.Output.VideoBitrate="Video Bitrate" Basic.Settings.Output.AudioBitrate="Audio Bitrate" Basic.Settings.Output.Reconnect="Automatically Reconnect" -Basic.Settings.Output.RetryDelay="Retry Delay (seconds)" +Basic.Settings.Output.RetryDelay="Retry Delay" Basic.Settings.Output.MaxRetries="Maximum Retries" Basic.Settings.Output.Advanced="Enable Advanced Encoder Settings" Basic.Settings.Output.EncoderPreset="Encoder Preset" @@ -767,7 +788,8 @@ # scale filters Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (Fastest, but blurry if scaling)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (Sharpened scaling, 16 samples)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Sharpened scaling, 32 samples)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Sharpened scaling, 36 samples)" +Basic.Settings.Video.DownscaleFilter.Area="Area (Weighted sum, 4/6/9 samples)" # basic mode 'audio' settings Basic.Settings.Audio="Audio" @@ -782,7 +804,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Sample Peak" Basic.Settings.Audio.PeakMeterType.TruePeak="True Peak (Higher CPU usage)" Basic.Settings.Audio.MultiChannelWarning.Enabled="WARNING: Surround sound audio is enabled." -Basic.Settings.Audio.MultichannelWarning="If streaming, check to see if your streaming service supports both surround sound ingest and surround sound playback. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast are examples where surround sound is fully supported. Although Facebook Live and YouTube Live both accept surround ingest, Facebook Live downmixes to stereo, and YouTube Live plays only two channels.\n\nOBS audio filters are compatible with surround sound, though VST plugin support isn't guaranteed." +Basic.Settings.Audio.MultichannelWarning="If streaming, check to see if your streaming service supports both surround sound ingest and surround sound playback. Facebook 360 Live, Mixer RTMP, Smashcast are examples where surround sound is fully supported. Although Facebook Live and YouTube Live both accept surround ingest, Facebook Live downmixes to stereo, and YouTube Live plays only two channels.\n\nOBS audio filters are compatible with surround sound, though VST plugin support isn't guaranteed." Basic.Settings.Audio.MultichannelWarning.Title="Enable surround sound audio?" Basic.Settings.Audio.MultichannelWarning.Confirm="Are you sure you want to enable surround sound audio?" Basic.Settings.Audio.Devices="Devices" @@ -818,14 +840,17 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Default" Basic.Settings.Advanced.Audio.DisableAudioDucking="Disable Windows audio ducking" Basic.Settings.Advanced.StreamDelay="Stream Delay" -Basic.Settings.Advanced.StreamDelay.Duration="Duration (seconds)" +Basic.Settings.Advanced.StreamDelay.Duration="Duration" Basic.Settings.Advanced.StreamDelay.Preserve="Preserve cutoff point (increase delay) when reconnecting" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Estimated Memory Usage: %1 MB" Basic.Settings.Advanced.Network="Network" Basic.Settings.Advanced.Network.BindToIP="Bind to IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Enable new networking code" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Low latency mode" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Hotkey Focus Behavior" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Never disable hotkeys" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Disable hotkeys when main window is in focus" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Disable hotkeys when main window is not in focus" Basic.Settings.Advanced.AutoRemux="Automatically remux to mp4" Basic.Settings.Advanced.AutoRemux.MP4="(record as mkv)" @@ -833,9 +858,9 @@ Basic.AdvAudio="Advanced Audio Properties" Basic.AdvAudio.Name="Name" Basic.AdvAudio.Volume="Volume" -Basic.AdvAudio.Mono="Downmix to Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balance" -Basic.AdvAudio.SyncOffset="Sync Offset (ms)" +Basic.AdvAudio.SyncOffset="Sync Offset" Basic.AdvAudio.Monitoring="Audio Monitoring" Basic.AdvAudio.Monitoring.None="Monitor Off" Basic.AdvAudio.Monitoring.MonitorOnly="Monitor Only (mute output)" @@ -909,6 +934,7 @@ OutputWarnings.NoTracksSelected="You must select at least one track" OutputWarnings.MultiTrackRecording="Warning: Certain formats (such as FLV) do not support multiple tracks per recording" OutputWarnings.MP4Recording="Warning: Recordings saved to MP4/MOV will be unrecoverable if the file cannot be finalized (e.g. as a result of BSODs, power losses, etc.). If you want to record multiple audio tracks consider using MKV and remux the recording to MP4/MOV after it is finished (File → Remux Recordings)" +OutputWarnings.CannotPause="Warning: Recordings cannot be paused if the recording encoder is set to \"(Use stream encoder)\"" # deleting final scene FinalScene.Title="Delete Scene"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/es-ES.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/es-ES.ini
Changed
@@ -23,7 +23,7 @@ Display="Pantalla" Name="Nombre" Exit="Salir" -Mixer="Mezclador" +Mixer="Mezclador de audio" Browse="Examinar" Mono="Mono" Stereo="Estéreo" @@ -89,7 +89,11 @@ AlreadyRunning.LaunchAnyway="Lanzar de todas maneras" DockCloseWarning.Title="Cerrando ventana acoplable" -DockCloseWarning.Text="Acabas de cerrar una ventana acoplable. Si quieres mostrarla de nuevo, usa Vista → Acoplar en la barra de menús." +DockCloseWarning.Text="Acabas de cerrar una ventana acoplable. Si quieres mostrarla de nuevo, usa Vista → Paneles en la barra de menús." + +ExtraBrowsers="Paneles de navegador personalizados" +ExtraBrowsers.Info="Añade paneles dándoles un nombre y una URL, luego haz clic en Aplicar o Cerrar para abrir los paneles. Puedes añadir o eliminar los paneles en cualquier momento." +ExtraBrowsers.DockName="Nombre del Panel" Auth.Authing.Title="Autentificando..." Auth.Authing.Text="Autentificando con %1, por favor espera..." @@ -107,6 +111,7 @@ TwitchAuth.Feed="Fuente de actividades de Twitch" TwitchAuth.TwoFactorFail.Title="No se pudo obtener la clave de transmisión" TwitchAuth.TwoFactorFail.Text="OBS no pudo conectarse a su cuenta de Twitch. Por favor, asegúrese de que la autenticación en dos pasos está configurada en su configuración de seguridad <a href='https://www.twitch.tv/settings/security'>Configuración de seguridad de Twitch</a> ya que esto es necesario para transmitir." +RestreamAuth.Channels="Canales Restream" Copy.Filters="Copiar filtros" Paste.Filters="Pegar filtros" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Nota: La resolución del lienzo (base) no es necesariamente la misma que la resolución de la transmisión o grabación. La resolución actual puede ser reducida del lienzo para reducir el uso de los recursos o del bitrate." Basic.AutoConfig.StreamPage="Información de servicio de Stream" Basic.AutoConfig.StreamPage.SubTitle="Por favor, introduce información sobre tu servicio de stream" -Basic.AutoConfig.StreamPage.ConnectAccount="Conectar cuenta (opcional)" +Basic.AutoConfig.StreamPage.ConnectAccount="Conectar cuenta (recomendado)" Basic.AutoConfig.StreamPage.DisconnectAccount="Desconectar cuenta" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="¿Desconectar cuenta?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Este cambio se aplicará inmediatamente. ¿Está seguro de que desea desconectar su cuenta?" @@ -191,8 +196,8 @@ Basic.Stats.Bitrate="Bitrate" Basic.Stats.DiskFullIn="Disco lleno en (aprox.)" -ResetUIWarning.Title="¿Está seguro de que desea restablecer la interfáz?" -ResetUIWarning.Text="Restablecer la interfaz ocultará los docks adicionales. Necesitarás eliminar estos docks del menú de vista si quieres que sean visibles.\n\n¿Estás seguro de que quieres restablecer la interfaz?" +ResetUIWarning.Title="¿Está seguro de que desea restablecer la interfaz?" +ResetUIWarning.Text="Restablecer la interfaz ocultará los paneles adicionales. Necesitarás desocultar estos paneles del menú de vista si quieres que sean visibles.\n\n¿Estás seguro de que quieres restablecer la interfaz?" Updater.Title="Nueva actualización disponible" Updater.Text="Hay una nueva versión disponible:" @@ -240,6 +245,9 @@ ConfirmStop.Title="¿Parar Transmisión?" ConfirmStop.Text="¿Está seguro que desea parar la transmisión?" +ConfirmStopRecord.Title="¿Detener la grabación?" +ConfirmStopRecord.Text="¿Estás seguro de que deseas parar la grabación?" + ConfirmBWTest.Title="¿Iniciar prueba de ancho de banda?" ConfirmBWTest.Text="Tienes OBS configurado en modo de prueba de ancho de banda. Este modo permite pruebas de red sin que tu canal esté en vivo. Una vez que hayas terminado de probar, necesitarás desactivarlo para que los espectadores puedan ver tu stream.\n\n¿Quieres continuar?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="No se pudo iniciar el buffer de replay" Output.StartFailedGeneric="No se pudo iniciar la salida. Por favor compruebe los logs para mas detalles. \n\nNota: Si estas usando los codificadores de NVENC o AMD, asegúrate que tus drivers de vídeo están actualizados." +Output.ReplayBuffer.PauseWarning.Title="No se pueden guardar repeticiones mientras está pausado" +Output.ReplayBuffer.PauseWarning.Text="Advertencia: No se pueden guardar repeticiones mientras la grabación está pausada." Output.ConnectFail.Title="Error al conectarse" Output.ConnectFail.BadPath="URL ruta de acceso o conexión no válida. Por favor, compruebe su configuración para confirmar que está correcta." @@ -291,7 +301,7 @@ Remux.ClearAll="Borrar todos los elementos" Remux.OBSRecording="Grabación OBS" Remux.FinishedTitle="Conversión finalizada" -Remux.Finished="Grabando conversión" +Remux.Finished="Grabación convertida" Remux.FinishedError="Grabación convertida, pero el archivo podría estar incompleto" Remux.SelectRecording="Seleccione grabación de OBS..." Remux.SelectTarget="Seleccione archivo de destino..." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Iniciar la reproducción del búfer" Basic.Main.StartStreaming="Iniciar Transmisión" Basic.Main.StopRecording="Detener grabación" +Basic.Main.PauseRecording="Pausar la grabación" +Basic.Main.UnpauseRecording="Reanudar la grabación" Basic.Main.StoppingRecording="Deteniendo la grabación..." Basic.Main.StopReplayBuffer="Detener la reproducción del búfer" Basic.Main.StoppingReplayBuffer="Deteniendo la reproducción del búfer..." @@ -499,9 +511,10 @@ Basic.MainMenu.View="&Vista" Basic.MainMenu.View.Toolbars="Barra de Herramien&tas" -Basic.MainMenu.View.Docks="Acoplar" +Basic.MainMenu.View.Docks="Paneles" Basic.MainMenu.View.Docks.ResetUI="Reestablecer Interfaz de Usuario" Basic.MainMenu.View.Docks.LockUI="Bloquear Interfaz de Usuario" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Paneles de navegador personalizados..." Basic.MainMenu.View.Toolbars.Listboxes="Cuadro de &Lista" Basic.MainMenu.View.SceneTransitions="Transi&ción de Escenas" Basic.MainMenu.View.StatusBar="Barra de E&stado" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Abrir dialogo de estadísticas al inicio" Basic.Settings.General.WarnBeforeStartingStream="Mostrar diálogo de confirmación cuando se inicia una transmisión" Basic.Settings.General.WarnBeforeStoppingStream="Mostrar diálogo de confirmación cuando se para una transmisión" +Basic.Settings.General.WarnBeforeStoppingRecord="Mostrar diálogo de confirmación al detener la grabación" Basic.Settings.General.Projectors="Proyectores" Basic.Settings.General.HideProjectorCursor="Ocultar el cursor sobre proyectores" Basic.Settings.General.ProjectorAlwaysOnTop="Proyectores siempre en la parte superior" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Seleccione Directorio de grabación" Basic.Settings.Output.SelectFile="Seleccione archivo de grabación" Basic.Settings.Output.EnforceBitrate="Aplicar los límites de bitrate del servicio de streaming" +Basic.Settings.Output.DynamicBitrate="Cambia dinámicamente la tasa de bits para gestionar la congestión" +Basic.Settings.Output.DynamicBitrate.Beta="Cambia dinámicamente la tasa de bits para gestionar la congestión (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="En lugar de saltar fotogramas para reducir la congestión, cambia dinámicamente el bitrate sobre la marcha.\n\nTen en cuenta que esto puede aumentar el retardo de la transmisión si hay una congestión repentina significativa.\nCuando el bitrate baja, puede tardar unos minutos en restaurarse.\n\nActualmente sólo es compatible con RTMP." Basic.Settings.Output.Mode="Modo de salida" Basic.Settings.Output.Mode.Simple="Sencillo" Basic.Settings.Output.Mode.Adv="Avanzado" Basic.Settings.Output.Mode.FFmpeg="Salida de FFmpeg" Basic.Settings.Output.UseReplayBuffer="Activar la reproducción del búfer" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Tiempo de reproducción máximo (segundos)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Tiempo Máximo para Repeticiones" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Memoria máxima (MB)" Basic.Settings.Output.ReplayBuffer.Estimate="Uso estimado de memoria: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="No se puede estimar el uso de memoria. Establezca el límite máximo de memoria." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Tamaño del archivo sin pérdida de calidad, tremendamente grande" Basic.Settings.Output.Simple.Warn.VideoBitrate="ADVERTENCIA: El streaming de vídeo se establecerá a %1, que es el límite superior para el servicio de streaming actual. Si estás seguro que quieres ir por encima de %1, active las opciones avanzadas del codificador y desactive \"Forzar limites de bitrate en el servicio de streaming\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="ADVERTENCIA: El streaming de audio se establecerá a %1, que es el límite superior para el servicio de streaming actual. Si estás seguro que quieres ir por encima de %1, active las opciones avanzadas del codificador y desactive \"Forzar limites de bitrate en el servicio de streaming\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Advertencia: Las grabaciones no se pueden pausar si la calidad de grabación se establece en \"Igual al stream\"." Basic.Settings.Output.Simple.Warn.Encoder="ADVERTENCIA: Grabar con un codificador de software de una calidad diferente a la de la transmisión requerirá un uso adicional de la CPU si transmite y graba al mismo tiempo." Basic.Settings.Output.Simple.Warn.Lossless="ADVERTENCIA: ¡La calidad sin perdidas genera tamaños de archivo muy grandes! La calidad sin pérdidas puede utilizar más de 7 gigabytes de espacio en disco por minuto en alta resolución y con alta tasa de fotogramas. La calidad sin pérdidas no se recomienda para grabaciones largas, a menos que tenga una gran cantidad de espacio en disco disponible." Basic.Settings.Output.Simple.Warn.Lossless.Msg="¿Confirma que desea utilizar calidad sin perdidas?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Bitrate de vídeo" Basic.Settings.Output.AudioBitrate="Bitrate de audio" Basic.Settings.Output.Reconnect="Reconectar automáticamente" -Basic.Settings.Output.RetryDelay="Retardo al re-intentar (segundos)" +Basic.Settings.Output.RetryDelay="Retraso para reintentar" Basic.Settings.Output.MaxRetries="Reintentos máximos" Basic.Settings.Output.Advanced="Habilitar la configuración de codificador avanzada" Basic.Settings.Output.EncoderPreset="Preajuste del codificador" @@ -694,13 +712,14 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilineal (más rápido, pero borroso si se escala la imagen)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicúbico (Escalado fino, 16 muestras)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Escalado fino, 32 muestras)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Escalado fino, 36 muestras)" +Basic.Settings.Video.DownscaleFilter.Area="Área (Suma ponderada, 4/6/9 muestras)" Basic.Settings.Audio="Audio" Basic.Settings.Audio.SampleRate="Frecuencia de muestreo" Basic.Settings.Audio.Channels="Canales" Basic.Settings.Audio.Meters="Medidores" -Basic.Settings.Audio.MeterDecayRate="Velocidad de descomposición" +Basic.Settings.Audio.MeterDecayRate="Velocidad de decaimiento" Basic.Settings.Audio.MeterDecayRate.Fast="Rápida" Basic.Settings.Audio.MeterDecayRate.Medium="Media (PPM de tipo I)" Basic.Settings.Audio.MeterDecayRate.Slow="Lenta (PPM de tipo II)" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Pico de muestra" Basic.Settings.Audio.PeakMeterType.TruePeak="True Peak (mayor uso de CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="ADVERTENCIA: el audio de sonido envolvente está habilitado." -Basic.Settings.Audio.MultichannelWarning="Si se está transmitiendo, compruebe si su servicio de transmisión admite la ingesta de sonido envolvente y la reproducción de sonido envolvente. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast son ejemplos en los que el sonido envolvente es totalmente compatible. Aunque Facebook Live y YouTube Live aceptan la ingesta surround, Facebook Live mezcla a estéreo y YouTube Live solo reproduce dos canales.\n\nLos filtros de audio OBS son compatibles con sonido envolvente, aunque no se garantiza el soporte de complementos VST." +Basic.Settings.Audio.MultichannelWarning="Si se está transmitiendo, compruebe si su servicio de transmisión admite la ingesta de sonido envolvente y la reproducción de sonido envolvente. Facebook 360 Live, Mixer RTMP, Smashcast son ejemplos en los que el sonido envolvente es totalmente compatible. Aunque Facebook Live y YouTube Live aceptan la ingesta surround, Facebook Live mezcla a estéreo y YouTube Live solo reproduce dos canales.\n\nLos filtros de audio OBS son compatibles con sonido envolvente, aunque no se garantiza el soporte de complementos VST." Basic.Settings.Audio.MultichannelWarning.Title="¿Habilitar el audio de sonido envolvente?" Basic.Settings.Audio.MultichannelWarning.Confirm="¿Seguro que quiere habilitar el audio de sonido envolvente?" Basic.Settings.Audio.Devices="Dispositivos" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Por defecto" Basic.Settings.Advanced.Audio.DisableAudioDucking="Desactivar reducción de audio de Windows" Basic.Settings.Advanced.StreamDelay="Retardo de la transmisión" -Basic.Settings.Advanced.StreamDelay.Duration="Duración (segundos)" +Basic.Settings.Advanced.StreamDelay.Duration="Duración" Basic.Settings.Advanced.StreamDelay.Preserve="Preservar el punto de corte (aumento de retardo) al volver a conectar" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Uso estimado de memoria: %1 MB" Basic.Settings.Advanced.Network="Red" Basic.Settings.Advanced.Network.BindToIP="Enlazar con IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Habilitar el nuevo código de red" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Modo de baja latencia" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Comportamiento de las teclas rápidas" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Nunca desactivar las teclas rápidas" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Deshabilitar teclas de acceso rápido cuando la ventana principal se encuentre activa" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Deshabilitar teclas rápidas cuando la ventana principal no esté en primer plano" Basic.Settings.Advanced.AutoRemux="Convertir automáticamente a mp4" Basic.Settings.Advanced.AutoRemux.MP4="(grabar como mkv)" Basic.AdvAudio="Propiedades de Audio avanzadas" Basic.AdvAudio.Name="Nombre" Basic.AdvAudio.Volume="Volumen" -Basic.AdvAudio.Mono="Remezclar a Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balance" -Basic.AdvAudio.SyncOffset="Sincronización Offset (ms)" +Basic.AdvAudio.SyncOffset="Intervalo de sincronización" Basic.AdvAudio.Monitoring="Monitorización de audio" Basic.AdvAudio.Monitoring.None="Monitorización desactivada" Basic.AdvAudio.Monitoring.MonitorOnly="Solo monitorización (silenciar la salida)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="Debe seleccionar al menos una pista" OutputWarnings.MultiTrackRecording="ADVERTENCIA: Ciertos formatos (como FLV) no admiten varias pistas por grabación" OutputWarnings.MP4Recording="Advertencia: Las grabaciones guardadas en MP4/MOV serán irrecuperables si el archivo no puede finalizarse (e.g. como resultado de BSODs, cortes eléctricos, etc.). Si quieres grabar múltiples pistas de audio considera usar MKV y convierte la grabación a MP4/MOV después de finalizar (Archivo → Convertir Grabaciones)" +OutputWarnings.CannotPause="Advertencia: Las grabaciones no se pueden pausar si el codificador de grabación se establece en \"(Usar codificador de transmisión)\"" FinalScene.Title="Eliminar escena" FinalScene.Text="Debe haber al menos una escena."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/et-EE.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/et-EE.ini
Changed
@@ -23,7 +23,6 @@ Display="Kuva" Name="Nimi" Exit="Välju" -Mixer="Mikser" Browse="Sirvi" Mono="Mono" Stereo="Stereo" @@ -71,6 +70,7 @@ + BandwidthTest.Region.US="Ameerika Ühendriigid" BandwidthTest.Region.EU="Euroopa" BandwidthTest.Region.Asia="Aasia" @@ -133,6 +133,7 @@ ConfirmStop.Text="Kas soovid kindlasti voogedastust lõpetada?" + ConfirmExit.Title="Kas väljuda OBS-ist?" ConfirmExit.Text="OBS on hetkel aktiivne. Kõik voogedastused ja salvestused peatatakse. Kas soovid kindlasti väljuda?" @@ -430,7 +431,6 @@ Basic.Settings.Advanced.Video.ColorRange.Full="Täielik" Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Vaikeseade" Basic.Settings.Advanced.StreamDelay="Voogedastuse Viivitus" -Basic.Settings.Advanced.StreamDelay.Duration="Kestvus (sekundit)" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Hinnanguline mälu hõivatus: %1 MB" Basic.Settings.Advanced.Network="Võrk" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Madal-viivitus režiim"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/eu-ES.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/eu-ES.ini
Changed
@@ -23,7 +23,7 @@ Display="Pantaila" Name="Izena" Exit="Irten" -Mixer="Nahastailea" +Mixer="Audio nahastailea" Browse="Arakatu" Mono="Monoa" Stereo="Estereoa" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Leiho moldagarria ixten" DockCloseWarning.Text="Leiho moldagarri bat itxi berri duzu. Berriro bistaratu nahi baduzu, erabili menu barrako Ikusi → Leiho moldagarriak menua." +ExtraBrowsers="Nabigatzailearen atrake pertsonalizatuak" +ExtraBrowsers.Info="Gehitu atrakeak izena eta URLa emanda, orduan egin klik Aplikatu-n edo Itxi atrakeak irekitzeko. Edozein unean gehitu edo kendu ditzakezu atrakeak." +ExtraBrowsers.DockName="Atrakearen izena" + Auth.Authing.Title="Egiaztatzen..." Auth.Authing.Text="%1(r) ekin egiaztatzen, itxaron..." Auth.AuthFailure.Title="Autentifikazioak huts egin du" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Twich aktibitateen jarioa" TwitchAuth.TwoFactorFail.Title="Ezin izan da transmisioaren gakoa galdetu" TwitchAuth.TwoFactorFail.Text="OBS-ek ez du lortu konektatzea zure Twitch kontuarekin. Egiazta ezazu bi urratsetako identifikazioa ezarrita dagoela zure <a href='https://www.twitch.tv/settings/security'>Twitch-eko segurtasun ezarpenetan</a> transmisiorako beharrezkoa da eta." +RestreamAuth.Channels="Bir-trasmisio kanalak" Copy.Filters="Kopiatu iragazkiak" Paste.Filters="Itsatsi iragazkiak" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Oharra: grabaziorako erabiliko duzun bereizmena ez du zertan oihalaren (oinarriaren) bereizmen berdina. Uneko transmisioaren/grabazioaren bereizmena behera eskalatu daiteke txikiagotzeko baliabideen erabilera edo bit emariaren eskakizuna." Basic.AutoConfig.StreamPage="Transmisioaren informazioa" Basic.AutoConfig.StreamPage.SubTitle="Sartu transmisioaren informazioa" -Basic.AutoConfig.StreamPage.ConnectAccount="Konektatu kontua (aukerazkoa)" +Basic.AutoConfig.StreamPage.ConnectAccount="Konektatu kontua (gomendatua)" Basic.AutoConfig.StreamPage.DisconnectAccount="Deskonektatu kontua" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Kontua deskonektatu?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Aldaketa hau berehalakoan aplika daiteke. Ziur zaude kontua deskonektatu nahi duzula?" @@ -240,6 +245,9 @@ ConfirmStop.Title="Gelditu transmisioa?" ConfirmStop.Text="Ziur zaude transmisioa gelditu nahi duzula?" +ConfirmStopRecord.Title="Gelditu grabazioa?" +ConfirmStopRecord.Text="Ziur zaude grabazioa gelditu nahi duzula?" + ConfirmBWTest.Title="Banda zabaleraren azterketa hasi?" ConfirmBWTest.Text="OBS banda zabalera azterketa moduan duzu konfiguratua. Modu honek sareko azterketak egiteko aukera ematen du zure kanala aktibatu gabe. Behin azterketa egin ondoren, desaktibatu behar duzu ikusleek zure transmisioa ikus dezaten.\n\nJarraitu nahi duzu?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="Huts egin du erreprodukzio bufferrak" Output.StartFailedGeneric="Huts egin du irteeraren abioak. Begiratu erregistroa zehaztasunak ikusteko.\n\nOharra: NVENC edo AMD kodetzaileak erabiltzen ari bazara segurtatu haien kontrolatzaileak eguneratuta daudela." +Output.ReplayBuffer.PauseWarning.Title="Ezin dira errepikapenak dauden pausatuta dagoenean" +Output.ReplayBuffer.PauseWarning.Text="Kontuz: errepikapenak ezin dira gorde grabaketa pausatuta dagoenean." Output.ConnectFail.Title="Huts egin du konektatzean" Output.ConnectFail.BadPath="Helburu edo konexio-URL okerra. Egiaztatu zure ezarpenak baliozkoak direla baieztatzeko." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Abiatu erreprodukzio bufferra" Basic.Main.StartStreaming="Hasi transmisioa" Basic.Main.StopRecording="Gelditu grabazioa" +Basic.Main.PauseRecording="Pausatu grabazioa" +Basic.Main.UnpauseRecording="Amaitu grabazioaren pausa" Basic.Main.StoppingRecording="Grabazioa gelditzen..." Basic.Main.StopReplayBuffer="Gelditu erreprodukzio bufferra" Basic.Main.StoppingReplayBuffer="Erreprodukzio bufferra gelditzen..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="Leiho moldagarriak" Basic.MainMenu.View.Docks.ResetUI="Berrabiarazi erabiltzaile-interfazea" Basic.MainMenu.View.Docks.LockUI="Blokeatu erabiltzaile-interfazea" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Nabigatzailearen atrake pertsonalizatuak..." Basic.MainMenu.View.Toolbars.Listboxes="Zerrenda-kutxak (&L)" Basic.MainMenu.View.SceneTransitions="Eszenen trantsizioak (&C)" Basic.MainMenu.View.StatusBar="Egoera-barra (&S)" @@ -542,8 +555,9 @@ Basic.Settings.General.Language="Hizkuntza" Basic.Settings.General.EnableAutoUpdates="Abiaraztean begiratu automatikoki eguneraketarik ba ote dagoen" Basic.Settings.General.OpenStatsOnStartup="Ireki estatistikak abiatzean" -Basic.Settings.General.WarnBeforeStartingStream="Erakutsi baieztapen elkarrizketa transmisioak hasterakoan" -Basic.Settings.General.WarnBeforeStoppingStream="Erakutsi baieztapen elkarrizketa transmisioak gelditzerakoan" +Basic.Settings.General.WarnBeforeStartingStream="Erakutsi berrespen elkarrizketa transmisioak hasterakoan" +Basic.Settings.General.WarnBeforeStoppingStream="Erakutsi berrespen elkarrizketa transmisioak gelditzerakoan" +Basic.Settings.General.WarnBeforeStoppingRecord="Erakutsi berrespen elkarrizketa grabazioa gelditzerakoan" Basic.Settings.General.Projectors="Proiektoreak" Basic.Settings.General.HideProjectorCursor="Ezkutatu kurtsorea proiekzioetan" Basic.Settings.General.ProjectorAlwaysOnTop="Proiektoreak beti gainean" @@ -591,12 +605,14 @@ Basic.Settings.Output.SelectDirectory="Hautatu grabazioaren karpeta" Basic.Settings.Output.SelectFile="Hautatu grabazioaren fitxategia" Basic.Settings.Output.EnforceBitrate="Behartu transmisio zerbitzuaren bit-tasaren mugak" +Basic.Settings.Output.DynamicBitrate="Aldatu bit-emaria dinamikoki pilaketa kudeatzeko" +Basic.Settings.Output.DynamicBitrate.Beta="Aldatu bit-emaria dinamikoki pilaketa kudeatzeko (Beta)" Basic.Settings.Output.Mode="Irteera-modua" Basic.Settings.Output.Mode.Simple="Sinplea" Basic.Settings.Output.Mode.Adv="Aurreratua" Basic.Settings.Output.Mode.FFmpeg="FFmpeg irteera" Basic.Settings.Output.UseReplayBuffer="Gaitu erreprodukzio bufferra" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Erreprodukzioaren gehienezko denbora (segundotan)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Erantzuteko gehienezko epea" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Gehienezko memoria (megabytetan)" Basic.Settings.Output.ReplayBuffer.Estimate="Ustezko memoria erabilera: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Ezin da kalkulatu memoria erabilera. Ezarri gehienezko memoria." @@ -611,6 +627,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Galerarik gabeko kalitatea. Fitxategi-tamaina izugarri handia" Basic.Settings.Output.Simple.Warn.VideoBitrate="Kontuz: transmisioaren bideoaren bit-tasa %1 ean ezarriko da; hau izango da oraingo transmisio zerbitzuaren goiko muga. Seguru bazaude %1 aren gainetik nahi duzula, gaitu kodetze aukera aurreratuak eta desautatu \"Behartu transmisio zerbitzuaren bit-tasaren mugak\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Kontuz: transmisioaren audioaren bit-tasa %1 ean ezarriko da; hau izango da oraingo transmisio zerbitzuaren goiko muga. Seguru bazaude %1 aren gainetik nahi duzula, gaitu kodetze aukera aurreratuak eta desautatu \"Behartu transmisio zerbitzuaren bit-tasaren mugak\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Kontuz: Grabazioa ezin da pausatu grabazioaren kalitatearen konfigurazioa \"jarioaren berdina\" bada." Basic.Settings.Output.Simple.Warn.Encoder="Oharra: Transmisioak duen kalitatea ez bestelako kalitate batez grabatzeak PUZ-ren aparteko erabilera eskatzen du une berean transmititzen eta grabatzen baduzu." Basic.Settings.Output.Simple.Warn.Lossless="Oharra: Galerarik gabeko kalitateak neurri izugarri handiko fitxategiak sortzen ditu! Galerarik gabeko kalitateak minutuko 7 gigabytetik gorako tokia erabili dezake diskoan bereizmen eta fotograma-emari handietan. Galerarik gabeko kalitatea ez dago gomendatua grabazio luzeetarako disko toki eskuragarri oso handi bat ez baduzu." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Ziur zaude galerarik gabeko kalitatea erabili nahi duzula?" @@ -623,7 +640,7 @@ Basic.Settings.Output.VideoBitrate="Bideo bit-emaria" Basic.Settings.Output.AudioBitrate="Audio bit-emaria" Basic.Settings.Output.Reconnect="Automatikoki birkonektatu" -Basic.Settings.Output.RetryDelay="Saiakera-atzerapena (segundoak)" +Basic.Settings.Output.RetryDelay="Berriro saiatzeko atzerapena" Basic.Settings.Output.MaxRetries="Gehienezko saiakerak" Basic.Settings.Output.Advanced="Gaitu Kodetzaile aurreratuaren ezarpenak" Basic.Settings.Output.EncoderPreset="Aurrez ezarritako kodetzea" @@ -694,7 +711,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilineala (Azkarrena, baina lausoa eskalatuz gero)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bikubikoa (enfokatutako eskalatzea, 16 lagin)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (eskalatze zorrotza, 32 lagin)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (eskalatze zorrotza, 36 lagin)" +Basic.Settings.Video.DownscaleFilter.Area="Area (Batura ponderatua, 4/6/9 lagin)" Basic.Settings.Audio="Audioa" Basic.Settings.Audio.SampleRate="Lagin-maiztasuna" @@ -708,7 +726,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Lagin-gailurra" Basic.Settings.Audio.PeakMeterType.TruePeak="Benetako gailurra (CPUaren erabilera handiagoa)" Basic.Settings.Audio.MultiChannelWarning.Enabled="Kontu: soinu inguratzailea aktibatuta dago." -Basic.Settings.Audio.MultichannelWarning="Transmititzen ari bazara, begiratu ea zure transmisio zerbitzuak onartzen duen soinu inguratzailea sarrerako soinuan zein irteerakoan. Twitch, Facebook 360 LIve, Mixer RTMP, Samashcast esate baterako guztiz onartzen dute soinu inguratzailea. Facebook Live eta Youtube Live sarrerako soinu inguratzailea onartzen badute ere, Facebook Livek estereo bihurtzen du, eta Youtube Livek bakarrik bi kanal erreproduzitzen ditu.\n\nOBS audio iragazkiak soinu inguratzailearekin bateragarriak badira ere, ezin da bermatu VST pluginaren bateragarritasuna." +Basic.Settings.Audio.MultichannelWarning="Transmititzen ari bazara, begiratu ea zure transmisio zerbitzuak onartzen duen soinu inguratzailea sarrerako soinuan zein irteerakoan. Facebook 360 LIve, Mixer RTMP, Samashcast esate baterako guztiz onartzen dute soinu inguratzailea. Facebook Live eta Youtube Live sarrerako soinu inguratzailea onartzen badute ere, Facebook Livek estereo bihurtzen du, eta Youtube Livek bakarrik bi kanal erreproduzitzen ditu.\n\nOBS audio iragazkiak soinu inguratzailearekin bateragarriak badira ere, ezin da bermatu VST pluginaren bateragarritasuna." Basic.Settings.Audio.MultichannelWarning.Title="Nahi duzu soinu inguratzailea aktibatzea?" Basic.Settings.Audio.MultichannelWarning.Confirm="Seguru zaude soinu inguratzailea aktibatu nahi duzula?" Basic.Settings.Audio.Devices="Gailuak" @@ -743,23 +761,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Lehenetsia" Basic.Settings.Advanced.Audio.DisableAudioDucking="Ezgaitu Windows audio ducking" Basic.Settings.Advanced.StreamDelay="Transmisio-atzerapena" -Basic.Settings.Advanced.StreamDelay.Duration="Iraupena (segundoak)" +Basic.Settings.Advanced.StreamDelay.Duration="Iraupena" Basic.Settings.Advanced.StreamDelay.Preserve="Mantendu ebaketa puntua (handitu atzerapena) birkonektatzean" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Estimatutako memoria erabilpena: %1 MB" Basic.Settings.Advanced.Network="Sarea" Basic.Settings.Advanced.Network.BindToIP="IP bidez lotu" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Gaitu sare kode berria" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Latentzia txikiko modua" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Laster tekletan fokuratutako portaera" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Ez desaktibatu laster-teklak inoiz" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Ezgaitu laster-teklak leiho nagusia fokuan dagoenean" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Desaktibatu laster-teklak leiho nagusia fokuan ez dagoenean" Basic.Settings.Advanced.AutoRemux="Bihurtu automatikoki mp4-ra" Basic.Settings.Advanced.AutoRemux.MP4="(grabatu mkv bezala)" Basic.AdvAudio="Audio propietate aurreratuak" Basic.AdvAudio.Name="Izena" Basic.AdvAudio.Volume="Bolumena" -Basic.AdvAudio.Mono="Nahasketa monora murriztu" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balantzea" -Basic.AdvAudio.SyncOffset="Sinkronizazioaren desplazamendua (ms)" +Basic.AdvAudio.SyncOffset="Sinkronizazioaren desplazamendua" Basic.AdvAudio.Monitoring="Adioaren monitorizazioa" Basic.AdvAudio.Monitoring.None="Ez monitorizatu" Basic.AdvAudio.Monitoring.MonitorOnly="Monitorea bakarrik (irteera mututua)" @@ -825,6 +846,7 @@ OutputWarnings.NoTracksSelected="Gutxienez pista bat hautatu behar duzu" OutputWarnings.MultiTrackRecording="Oharra: Zenbait formatuk (esaterako FLV-k) ez ditu pista anitzak onartzen grabazioan" OutputWarnings.MP4Recording="Kontuz: MP4 formatuz gordetako grabazioak izan daitezke berreskuraezinak fitxategia ezin bada bukatu (esate baterako BSODs-ren emaitza bat, energia etenak eta abar). Hainbat audio pista grabatu nahi baduzu erabil dezakezu MKV formatua eta mp4 bihurtu grabazioa bukatu ondoren (Fitxategia->Bihurtu grabazioak)" +OutputWarnings.CannotPause="Kontuz: Grabazioak ezin dira pausatu grabazioaren kodetzailea \"(Erabili transmisioaren kodetzailea)\" konfigurazioa badu" FinalScene.Title="Ezabatu eszena" FinalScene.Text="Gutxienez eszena bat egon behar du."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/fa-IR.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/fa-IR.ini
Changed
@@ -23,7 +23,7 @@ Display="صفحه نمایش" Name="نام" Exit="خروج" -Mixer="میکسر" +Mixer="میکسرِسدا" Browse="تغییر" Mono="مونو" Stereo="استریو" @@ -61,10 +61,13 @@ Minutes="دقیقه" Seconds="ثانیه" Deprecated="منسوخ شده" +ReplayBuffer="بازپخشِ فوری" Import="وارد کردن" Export="خروجی گرفتن" Copy="کپی" Paste="جای گذاری" +PasteReference="چسبا (مرجع)" +PasteDuplicate="چسبا (تکرار)" Next="بعدی" Back="قبلی" Defaults="پیش فرض ها" @@ -81,6 +84,7 @@ AlreadyRunning.LaunchAnyway="در هر حال اجرا کن" + Auth.Chat="چت" Auth.StreamInfo="اطلاعات پخش زنده" TwitchAuth.Stats="وضعیت توییچ" @@ -162,6 +166,7 @@ ConfirmStop.Text="آیا مطمئنید که میخواهید استریم را قطع کنید؟" + ConfirmExit.Title="خروج از OBS؟" ConfirmExit.Text="OBS در حال حاظر فعال است. تمامی استریم/ضبط ها قطع خاموش خواهند شد. آیا مطمئنید که میخواهید خارج شوید؟"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/fi-FI.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/fi-FI.ini
Changed
@@ -23,7 +23,7 @@ Display="Monitori" Name="Nimi" Exit="Poistu" -Mixer="Mikseri" +Mixer="Äänimikseri" Browse="Selaa" Mono="Mono" Stereo="Stereo" @@ -91,6 +91,7 @@ DockCloseWarning.Title="Telakoitu ikkuna suljettu" DockCloseWarning.Text="Suljit juuri telakoidun ikkunan. Jos haluat sen takaisin näkyviin, löydät sen Näkymät → Telakat -valikosta työkaluriviltä." + Auth.Authing.Title="Todennetaan..." Auth.Authing.Text="Todennetaan %1, ole hyvä ja odota..." Auth.AuthFailure.Title="Varmennusvirhe" @@ -105,6 +106,8 @@ Auth.StreamInfo="Lähetyksen tiedot" TwitchAuth.Stats="Twitch-tilastot" TwitchAuth.Feed="Twitch tapahtumasyöte" +TwitchAuth.TwoFactorFail.Title="Striimiavainta ei saatu noudettua" +TwitchAuth.TwoFactorFail.Text="OBS ei pystynyt yhdistämään Twitch-tiliin. Varmista että kaksivaiheinen tunnistus on käytössä <a href='https://www.twitch.tv/settings/security'>Twitchin turvallisuusasetuksissa</a>, koska se vaaditaan lähetystä varten." Copy.Filters="Kopioi suodattimet" Paste.Filters="Liitä suodattimet" @@ -137,7 +140,6 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Huomautus: Piirtoalueen resoluutio ei välttämättä ole sama kuin resoluutio jolla lähetetään tai tallennetaan. Lähetyksen/tallennuksen resoluutio saatetaan skaalata piirtoalueesta pienemmäksi resurssien käytön vähentämiseksi tai bitrate vaatimusten vuoksi." Basic.AutoConfig.StreamPage="Lähetyksen tiedot" Basic.AutoConfig.StreamPage.SubTitle="Ole hyvä ja syötä lähetyksen tiedot" -Basic.AutoConfig.StreamPage.ConnectAccount="Yhdistä tili (valinnainen)" Basic.AutoConfig.StreamPage.DisconnectAccount="Katkaise yhteys tiliin" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Katkaise yhteys tiliin?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Tämä muutos tulee voimaan välittömästi. Oletko varma että haluat katkaista yhteyden tiliin?" @@ -238,6 +240,7 @@ ConfirmStop.Title="Pysäytä lähetys?" ConfirmStop.Text="Haluatko varmasti pysäyttää lähetyksen?" + ConfirmBWTest.Title="Aloita kaistan nopeustesti?" ConfirmBWTest.Text="OBS on asetettu kaistan nopeustestitilaan. Tämä tila antaa sinun testata verkkoa ilman että kanava menee Live-tilaan. Kun olet valmis testauksen kanssa, sinun täytyy ottaa se pois käytöstä, jotta muut voivat nähdä lähetyksesi.\n\nHaluatko jatkaa?" @@ -253,6 +256,8 @@ Output.StartReplayFailed="Toistopuskurin käynnistäminen epäonnistui" Output.StartFailedGeneric="Ulostulon käynnistäminen epäonnistui. Tarkista loki lisätietoja varten.\n\nHuomio: Jos käytät NVENC tai AMD -enkoodereita, varmista, että näytönohjaimen ajurit on päivitetty ajantasalle." +Output.ReplayBuffer.PauseWarning.Title="Uusintoja ei voi tallentaa pysäytettynä" +Output.ReplayBuffer.PauseWarning.Text="Varoitus: Uusintoja ei voi tallentaa kun tallennus on pysäytetty." Output.ConnectFail.Title="Yhdistäminen epäonnistui" Output.ConnectFail.BadPath="Viallinen polku tai yhteysosoite. Tarkista, että asetuksesi ovat kunnossa." @@ -261,6 +266,8 @@ Output.ConnectFail.Error="Odottamaton virhe ilmeni palvelimeen yhdistäessä. Lisää tietoa saat lokitiedostosta." Output.ConnectFail.Disconnected="Yhteys palvelimeen katkaistiin." +Output.StreamEncodeError.Title="Enkoodausvirhe" +Output.StreamEncodeError.Msg="Lähetyksen aikana tapahtui enkoodausvirhe." Output.RecordFail.Title="Tallennuksen aloittaminen epäonnistui" Output.RecordFail.Unsupported="Ulostulon muoto ei ole tuettu tai se ei tue useampaa kuin yhtä ääniraitaa. Tarkista asetuksesi ja yritä uudelleen." @@ -268,6 +275,7 @@ Output.RecordNoSpace.Msg="Levytilaa ei ole riittävästi tallennuksen jatkamiseen." Output.RecordError.Title="Tallennusvirhe" Output.RecordError.Msg="Tallennuksen aikana tapahtui määrittelemätön virhe." +Output.RecordError.EncodeErrorMsg="Tallennuksen aikana tapahtui enkoodausvirhe." Output.ReplayBuffer.NoHotkey.Title="Pikanäppäintä ei ole asetettu!" Output.ReplayBuffer.NoHotkey.Msg="Tallennuksen pikanäppäintä ei ole asetettu toistopuskurille. Aseta \"Tallenna\"-pikanäppäin tallentaaksesi uusinnat." @@ -439,6 +447,8 @@ Basic.Main.StartReplayBuffer="Käynnistä toistopuskuri" Basic.Main.StartStreaming="Aloita lähetys" Basic.Main.StopRecording="Pysäytä tallennus" +Basic.Main.PauseRecording="Pysäytä tallennus" +Basic.Main.UnpauseRecording="Jatka tallennusta" Basic.Main.StoppingRecording="Pysäytetään tallennusta..." Basic.Main.StopReplayBuffer="Pysäytä toistopuskuri" Basic.Main.StoppingReplayBuffer="Pysäytetään toistopuskuri..." @@ -591,7 +601,6 @@ Basic.Settings.Output.Mode.Adv="Kehittynyt" Basic.Settings.Output.Mode.FFmpeg="FFmpeg ulostulo" Basic.Settings.Output.UseReplayBuffer="Ota toistopuskuri käyttöön" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Uusinnan pisin aika (Sekunteina)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Muistiraja (Megatavuja)" Basic.Settings.Output.ReplayBuffer.Estimate="Arvioitu muistinkäyttö: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Muistin käyttöä ei voida arvioida. Valitse muistiraja." @@ -606,6 +615,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Häviötön laatu, valtava tiedostokoko" Basic.Settings.Output.Simple.Warn.VideoBitrate="Varoitus: Kuvan bitrate asetetaan arvoon %1, joka on yläraja valitsemassasi palvelussa. Jos haluat varmasti mennä %1:n yli, poista valinta lisäasetuksista kohdasta \"Rajoita bitrate lähetyspalvelun suosituksiin\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Varoitus: Äänen bitrate asetetaan arvoon %1, joka on yläraja valitsemassasi palvelussa. Jos haluat varmasti mennä %1:n yli, poista valinta lisäasetuksista kohdasta \"Rajoita bitrate lähetyspalvelun suosituksiin\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Varoitus: Tallennusta ei voi pysäyttää jos laatu on asetettu \"Sama kuin lähetyksessä\"." Basic.Settings.Output.Simple.Warn.Encoder="Varoitus: Tallentaminen lähetyksestä eroavalla laadulla vaatii prosessorilta lisätyötä jos lähetät ja tallennat samanaikaisesti." Basic.Settings.Output.Simple.Warn.Lossless="Varoitus: Häviötön laatu luo järjettömän kokoisia tiedostoja! Häviötön laatu saattaa käyttää jopa 7 gigatavua levytilastasi minuutissa, mikäli käytät suuria resoluutioita ja korkeita FPS-arvoja. Häviötöntä pakkausta ei suositella pitkiin tallennuksiin ellei sinulla ole todella paljon tallennustilaa käytettävissäsi." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Haluatko varmasti käyttää häviötöntä laatua?" @@ -618,7 +628,6 @@ Basic.Settings.Output.VideoBitrate="Kuvan bitrate" Basic.Settings.Output.AudioBitrate="Äänen bitrate" Basic.Settings.Output.Reconnect="Automaattinen uudelleenyhdistys" -Basic.Settings.Output.RetryDelay="Uudelleenyrityksen viive (sekunteja)" Basic.Settings.Output.MaxRetries="Uudelleenyhdistyksien määrä" Basic.Settings.Output.Advanced="Käytä enkooderin lisäasetuksia" Basic.Settings.Output.EncoderPreset="Enkooderin esiasetus" @@ -689,7 +698,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (nopein, mutta epätarkka skaalattaessa)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (Terävöity skaalaus, 16 näytettä)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Terävöity skaalaus, 32 näytettä)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Terävöity skaalaus, 36 näytettä)" Basic.Settings.Audio="Ääni" Basic.Settings.Audio.SampleRate="Näytteenottotaajuus" @@ -703,7 +712,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Huippuarvon näyte" Basic.Settings.Audio.PeakMeterType.TruePeak="Todellinen huippuarvo (Korkeampi CPU:n käyttö)" Basic.Settings.Audio.MultiChannelWarning.Enabled="VAROITUS: Monikanavaääni on käytössä." -Basic.Settings.Audio.MultichannelWarning="Varmista lähettäessä että palvelu tukee sekä monikanavaäänen lähettämistä, että toistamista. Twitch, Facebook 360 Live, Mixer RTMP ja Smashcast ovat esimerkkejä palveluista joissa monikanavaääni on täysin tuettu. Vaikka Facebook Live ja YouTube Live hyväksyvät monikanavaäänen lähettämisen, Facebook Live miksaa äänen stereoksi ja YouTube Live toistaa vain kaksi kanavaa.\n\nOBS:n äänisuodattimet tukevat monikanavaääntä, mutta VST-liitännäiset eivät välttämättä tue." +Basic.Settings.Audio.MultichannelWarning="Varmista lähettäessä että palvelu tukee sekä monikanavaäänen lähettämistä, että toistamista. Facebook 360 Live, Mixer RTMP ja Smashcast ovat esimerkkejä palveluista joissa monikanavaääni on täysin tuettu. Vaikka Facebook Live ja YouTube Live hyväksyvät monikanavaäänen lähettämisen, Facebook Live miksaa äänen stereoksi ja YouTube Live toistaa vain kaksi kanavaa.\n\nOBS:n äänisuodattimet tukevat monikanavaääntä, mutta VST-liitännäiset eivät välttämättä tue." Basic.Settings.Audio.MultichannelWarning.Title="Käytä monikanava-ääntä?" Basic.Settings.Audio.MultichannelWarning.Confirm="Haluatko varmasti käyttää monikanavaista ääntä?" Basic.Settings.Audio.Devices="Laitteet" @@ -738,7 +747,6 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Oletusarvo" Basic.Settings.Advanced.Audio.DisableAudioDucking="Poista Windowsin äänien hiljennys käytöstä (Audio Ducking)" Basic.Settings.Advanced.StreamDelay="Lähetyksen viive" -Basic.Settings.Advanced.StreamDelay.Duration="Kesto (sekunteina)" Basic.Settings.Advanced.StreamDelay.Preserve="Säilytä katkaisupiste (lisää viivettä) uudelleenyhdistettäessä" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Arvioitu muistinkäyttö: %1 MB" Basic.Settings.Advanced.Network="Verkko" @@ -751,9 +759,8 @@ Basic.AdvAudio="Äänen lisäominaisuudet" Basic.AdvAudio.Name="Nimi" -Basic.AdvAudio.Mono="Miksaa yksikanavaiseksi" +Basic.AdvAudio.Volume="Äänenvoimakkuus" Basic.AdvAudio.Balance="Balanssi" -Basic.AdvAudio.SyncOffset="Synkronoinnin viivästys (ms)" Basic.AdvAudio.Monitoring="Äänen monitorointi" Basic.AdvAudio.Monitoring.None="Monitorointi pois" Basic.AdvAudio.Monitoring.MonitorOnly="Vain monitorointi (hiljennä ulostulo)" @@ -819,6 +826,7 @@ OutputWarnings.NoTracksSelected="Sinun täytyy valita ainakin yksi raita" OutputWarnings.MultiTrackRecording="Varoitus: Jotkin muodot (kuten FLV), eivät tue useampaa raitaa per tallennus" OutputWarnings.MP4Recording="Varoitus: MP4/MOV-muotoon tallentaessa tiedostoista tulee lukukelvottomia, mikäli niitä ei voi viimeistellä. (esim. johtuen BSOD:sta, sähkökatkosta jne.) Jos haluat tallentaa useampaa ääniraitaa, kannattaa käyttää MKV-muotoa ja muuntaa jälkikäteen MP4/MOV-muotoon. (Tiedosto → Muunna tallenteita)" +OutputWarnings.CannotPause="Varoitus: Tallennusta ei voi pysäyttää jos tallennusenkooderi on asetettu \"(Käytä lähetysenkooderia)\"" FinalScene.Title="Poista skene" FinalScene.Text="Ainakin yksi skene pitää olla olemassa." @@ -845,4 +853,5 @@ ResizeOutputSizeOfSource.Text="Piirtoalueen ja ulostulon resoluutio muutetaan valitun lähteen kokoiseksi." ResizeOutputSizeOfSource.Continue="Haluatko jatkaa?" +PreviewTransition="Esikatsele siirtymä"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/fil-PH.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/fil-PH.ini
Changed
@@ -21,7 +21,6 @@ Display="Ipamalas" Name="Pangalan" Exit="Labasan" -Mixer="Panghalo" Browse="Supling" Mono="Mono" Stereo="Stereo" @@ -85,6 +84,7 @@ + Copy.Filters="Kopyahin ang mga panala" Paste.Filters="I-paste ang mga panala" @@ -205,6 +205,7 @@ ConfirmStop.Text="Sigurado ka itigil ang pag i-stream?" + ConfirmExit.Title="Lumabas sa OBS?" ConfirmExit.Text="Ang OBS ay kasulukuyang aktibo. Lahat ng streams/recordings ay magsasara. Sigurado ka ba gusto mong mag exit?" @@ -520,7 +521,6 @@ Basic.Settings.Output.Mode.Adv="Pagsulong" Basic.Settings.Output.Mode.FFmpeg="FFmpeg Awput" Basic.Settings.Output.UseReplayBuffer="Simulan ang pag replay ng buffer" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Pinakamataas na oras ng replay (segundos)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Pinakamataas na memorya (Megabytes)" Basic.Settings.Output.ReplayBuffer.Estimate="Ang na estimang nagamit na memorya: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Hindi ma-estima ang nagamit na memorya. Pakilagay ng pinakamataas na limitasyon ng memorya." @@ -547,7 +547,6 @@ Basic.Settings.Output.VideoBitrate="Bitrate ng Video" Basic.Settings.Output.AudioBitrate="Bitrate ng Audio" Basic.Settings.Output.Reconnect="Awtomatikong mag-reconnect" -Basic.Settings.Output.RetryDelay="Retry Delay (segundo)" Basic.Settings.Output.MaxRetries="Pinakamataas na Retries" Basic.Settings.Output.Advanced="Paganahin ang Mga Setting ng Advanced Encoder" Basic.Settings.Output.CustomEncoderSettings="Mga Setting ng Custom Encoder" @@ -617,7 +616,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (Pinakamabilis, pero malabo pag mag i-scaling)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (Sharpened scaling, 16 mga halimbawa)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Sharpened scaling, 32 mga halimbawa)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Sharpened scaling, 36 mga halimbawa)" Basic.Settings.Audio="Tunog" Basic.Settings.Audio.SampleRate="Halimbawa ng Antas" @@ -626,7 +625,7 @@ Basic.Settings.Audio.MeterDecayRate.Medium="Katamtaman (Tipo I PPM)" Basic.Settings.Audio.MeterDecayRate.Slow="Mabagal (Tipo II PPM)" Basic.Settings.Audio.MultiChannelWarning.Enabled="Babala: Ang Surround sound audio ay naka andar." -Basic.Settings.Audio.MultichannelWarning="Kung nag streaming, paki tignan kung ang iyong streaming service ay parehong supportado ang surround sound ingest at surround sound playback. Twitch, Facebook, 360 Live, Mixer RTMP, Smashcast ay ang mga halimbawa kung saan ang surround sound ay ganap na suportado, pati YouTube Live umaandar lamang sa dawalang channels.\n\nOBS audio filters ay kompatibol lamang sa surround sound, pero hindi siguradong supportado ang VST plugin." +Basic.Settings.Audio.MultichannelWarning="Kung nag streaming, paki tignan kung ang iyong streaming service ay parehong supportado ang surround sound ingest at surround sound playback. Facebook, 360 Live, Mixer RTMP, Smashcast ay ang mga halimbawa kung saan ang surround sound ay ganap na suportado, pati YouTube Live umaandar lamang sa dawalang channels.\n\nOBS audio filters ay kompatibol lamang sa surround sound, pero hindi siguradong supportado ang VST plugin." Basic.Settings.Audio.MultichannelWarning.Title="Paganahin ang surround sound audio?" Basic.Settings.Audio.MultichannelWarning.Confirm="Sigurado ka ba gusto mong paganahin ang surround sound audio?" Basic.Settings.Audio.EnablePushToMute="Paganahin ang Push-to-mute" @@ -650,7 +649,6 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="I-Default" Basic.Settings.Advanced.Audio.DisableAudioDucking="Huwag paganahin ang Windows audio ducking" Basic.Settings.Advanced.StreamDelay="Ang Antala ng Stream" -Basic.Settings.Advanced.StreamDelay.Duration="Ang Katagalan (segundo)" Basic.Settings.Advanced.StreamDelay.Preserve="Ingatang ang cutoff point (pataas ng antala) kapang kumokonekta" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Ang na estimang nagamit na memorya: %1 MB" Basic.Settings.Advanced.Network="Network" @@ -660,8 +658,6 @@ Basic.AdvAudio="Ang aria-arian ng Advanced Audio" Basic.AdvAudio.Name="Pangalan" -Basic.AdvAudio.Mono="Downmix ito sa Mono" -Basic.AdvAudio.SyncOffset="Ang Sync Offset (ms)" Basic.AdvAudio.Monitoring="Ang subaybay ng Audio" Basic.AdvAudio.Monitoring.None="I-Off ang Monitor" Basic.AdvAudio.Monitoring.MonitorOnly="Monitor lamang (i-mute ang output)"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/fr-FR.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/fr-FR.ini
Changed
@@ -20,10 +20,10 @@ MoveUp="Déplacer vers le haut" MoveDown="Déplacer vers le bas" Settings="Paramètres" -Display="Affichage" +Display="Moniteur" Name="Nom" Exit="Quitter OBS" -Mixer="Mixeur audio" +Mixer="Mélangeur audio" Browse="Parcourir" Mono="Mono" Stereo="Stéréo" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Fermer une fenêtre dockable" DockCloseWarning.Text="Vous venez de fermer une fenêtre dockable. Si vous souhaitez l'afficher à nouveau, utilisez le menu Afficher → Docks dans la barre de menus." +ExtraBrowsers="Docks Internet personnalisés" +ExtraBrowsers.Info="Ajoutez des docks en leur donnant un nom et une URL, puis cliquez sur Appliquer or Fermer pour les ouvrir. Vous pouvez en ajouter d'autres ou en supprimer plus tard à votre guise." +ExtraBrowsers.DockName="Nom du dock" + Auth.Authing.Title="Connexion en cours ..." Auth.Authing.Text="Connexion sur %1 en cours, veuillez patienter ..." Auth.AuthFailure.Title="Échec d'authentification" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Flux d'activité Twitch" TwitchAuth.TwoFactorFail.Title="Impossible de trouver la clé de stream" TwitchAuth.TwoFactorFail.Text="OBS n'a pas pu se connecter à votre compte Twitch. Veuillez vous assurer que l'authentification à deux facteurs est configurée dans vos <a href='https://www.twitch.tv/settings/security'>paramètres de sécurité Twitch</a> car cela est nécessaire pour lancer un stream." +RestreamAuth.Channels="Chaînes Restream" Copy.Filters="Copier les filtres" Paste.Filters="Coller les filtres" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Remarque : la résolution (de base) du canevas n'est pas nécessairement la même que la résolution avec laquelle vous allez diffuser (stream) ou enregistrer. La résolution actuelle de stream/enregistrement peut être réduite à partir de la résolution du canevas afin de diminuer l'utilisation des ressources et de la bande passante." Basic.AutoConfig.StreamPage="Informations de flux" Basic.AutoConfig.StreamPage.SubTitle="Entrez vos informations de stream" -Basic.AutoConfig.StreamPage.ConnectAccount="Connecter un compte (optionnel)" +Basic.AutoConfig.StreamPage.ConnectAccount="Lier un compte (recommandé)" Basic.AutoConfig.StreamPage.DisconnectAccount="Déconnecter le compte" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Déconnecter le compte ?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Cette modification s'appliquera immédiatement. Êtes-vous sûr de vouloir déconnecter votre compte ?" @@ -240,6 +245,9 @@ ConfirmStop.Title="Arrêter le stream ?" ConfirmStop.Text="Êtes-vous sûr de vouloir arrêter le stream ?" +ConfirmStopRecord.Title="Arrêter l'enregistrement ?" +ConfirmStopRecord.Text="Êtes-vous certain de vouloir arrêter l'enregistrement ?" + ConfirmBWTest.Title="Démarrer le test de bande passante ?" ConfirmBWTest.Text="Vous avez configuré OBS en mode \"test de bande passante\". Ce mode permet de tester le réseau sans que votre chaîne ne soit en direct. Une fois que vous aurez effectué les tests, vous devrez le désactiver afin que les spectateurs puissent voir votre stream.\n\nVoulez-vous continuer ?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="Impossible de démarrer le tampon de relecture" Output.StartFailedGeneric="Le démarrage de la sortie a échoué. Veuillez consulter le journal pour plus de détails.\n\nRemarque : si vous utilisez les encodeurs NVENC ou AMD, assurez-vous que vos pilotes vidéo soient à jour." +Output.ReplayBuffer.PauseWarning.Title="Impossible d'enregistrer des replays quand l'enregistrement est en pause" +Output.ReplayBuffer.PauseWarning.Text="Attention : les replays ne peuvent pas être enregistrés lorsque l'enregistrement est en pause." Output.ConnectFail.Title="Échec de la connexion" Output.ConnectFail.BadPath="Adresse de connexion ou chemin invalide. Veuillez vérifier vos paramètres afin de confirmer leur validité." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Démarrer le tampon de relecture" Basic.Main.StartStreaming="Commencer le streaming" Basic.Main.StopRecording="Arrêter l'enregistrement" +Basic.Main.PauseRecording="Mettre en pause l'enregistrement" +Basic.Main.UnpauseRecording="Reprendre l'enregistrement" Basic.Main.StoppingRecording="Arrêt de l'enregistrement..." Basic.Main.StopReplayBuffer="Arrêter le tampon de relecture" Basic.Main.StoppingReplayBuffer="Arrêt du tampon de relecture..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="Docks" Basic.MainMenu.View.Docks.ResetUI="Réinitialiser l'Interface" Basic.MainMenu.View.Docks.LockUI="Verrouiller l'Interface" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Docks Internet personnalisés..." Basic.MainMenu.View.Toolbars.Listboxes="&Listes" Basic.MainMenu.View.SceneTransitions="Transition de s&cènes" Basic.MainMenu.View.StatusBar="Barre d'état (&S)" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Ouvrir la boîte de dialogue des statistiques au démarrage" Basic.Settings.General.WarnBeforeStartingStream="Afficher une boîte de dialogue de confirmation au démarrage d'un stream" Basic.Settings.General.WarnBeforeStoppingStream="Afficher une boîte de dialogue de confirmation à l'arrêt d'un stream" +Basic.Settings.General.WarnBeforeStoppingRecord="Demander confirmation avant d'arrêter un enregistrement" Basic.Settings.General.Projectors="Projecteurs" Basic.Settings.General.HideProjectorCursor="Cacher le curseur sur les projecteurs" Basic.Settings.General.ProjectorAlwaysOnTop="Projecteurs toujours au premier plan" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Sélectionnez le répertoire d'enregistrement" Basic.Settings.Output.SelectFile="Sélectionnez le fichier cible" Basic.Settings.Output.EnforceBitrate="Imposer les limites de débit du service de streaming" +Basic.Settings.Output.DynamicBitrate="Ajuster dynamiquement le débit de streaming en cas de congestion réseau" +Basic.Settings.Output.DynamicBitrate.Beta="Ajuster dynamiquement le débit de streaming en cas de congestion réseau (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="Ajuste automatiquement le débit de streaming pour éviter les pertes d'images en cas de congestion ou de surcharge réseau.\n\nCela peut augmenter le délai entre vous et vos spectateurs si la congestion est significative.\nQuand le débit est réduit automatiquement, plusieurs minutes peuvent s'écouler avant qu'il ne revienne à la normale.\n\nN'est supporté que pour RTMP pour l'instant." Basic.Settings.Output.Mode="Mode de Sortie" Basic.Settings.Output.Mode.Simple="Simple" Basic.Settings.Output.Mode.Adv="Avancé" Basic.Settings.Output.Mode.FFmpeg="Sortie FFmpeg" Basic.Settings.Output.UseReplayBuffer="Activer le tampon de relecture" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Temps de relecture maximal (secondes)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Durée maximale d'un replay" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Mémoire maximum (mégaoctets)" Basic.Settings.Output.ReplayBuffer.Estimate="Estimation de la mémoire utilisée : %1 Mo" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Impossible d'estimer l'utilisation de la mémoire. Veuillez définir une limite de mémoire maximale." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Qualité sans perte, énorme taille de fichier" Basic.Settings.Output.Simple.Warn.VideoBitrate="Attention: le débit vidéo de streaming va être fixé à %1, qui est la limite maximale pour le service de streaming actuel. Si vous êtes surs de vouloir aller au delà de %1, activez les options avancées de l'encodeur & décochez \"Imposer les limites de débit du service de streaming\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Attention: le débit audio de streaming va être fixé à %1, qui est la limite maximale pour le service de streaming actuel. Si vous êtes surs de vouloir aller au delà de %1, activez les options avancées de l'encodeur & décochez \"Imposer les limites de débit du service de streaming\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Attention : l'enregistrement ne peut pas être mis en pause si la qualité d'enregistrement est configurée sur \"Identique au stream\"." Basic.Settings.Output.Simple.Warn.Encoder="Attention : enregistrer via un encodeur logiciel avec une qualité autre que celle du stream sollicitera encore plus le CPU si vous streamez et enregistrez simultanément." Basic.Settings.Output.Simple.Warn.Lossless="Attention: la qualité sans perte génère des fichiers de taille énorme ! Elle peut utiliser jusqu'à 7 gigaoctets d'espace disque par minute pour de hautes résolutions et fréquences d'image. Cette qualité n'est pas recommandée pour de longs enregistrements à moins d'avoir énormément d'espace disque disponible." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Êtes-vous certain de vouloir utiliser la qualité sans perte ?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Débit vidéo" Basic.Settings.Output.AudioBitrate="Débit audio" Basic.Settings.Output.Reconnect="Reconnexion automatique" -Basic.Settings.Output.RetryDelay="Délai avant la tentative de reconnexion (en secondes)" +Basic.Settings.Output.RetryDelay="Délai avant nouvelle tentative" Basic.Settings.Output.MaxRetries="Nombres de tentatives maximales" Basic.Settings.Output.Advanced="Activer les paramètres avancés d'encodage" Basic.Settings.Output.EncoderPreset="Pré-réglage d'encodeur" @@ -694,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinéaire (plus rapide, mais flou en cas de mise à l'échelle)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubique (mise à l'échelle avec netteté accentuée, 16 échantillons)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (mise à l'échelle avec netteté accentuée, 32 échantillons)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (mise à l'échelle avec netteté accentuée, 36 échantillons)" +Basic.Settings.Video.DownscaleFilter.Area="Zone (somme pondérée, 4/6/9 échantillons)" Basic.Settings.Audio="Audio" Basic.Settings.Audio.SampleRate="Fréquence d'échantillonnage" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Pic d'échantillon audio" Basic.Settings.Audio.PeakMeterType.TruePeak="Crête exacte (plus grande utilisation du CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="ATTENTION : le son multicanal est activé." -Basic.Settings.Audio.MultichannelWarning="Pour de besoins de diffusion, vérifiez que votre service de diffusion supporte l'intégration et la lecture du son multicanal. Twitch, Facebook 360 Live, Mixer RTMP ou Smashcast sont des exemples de services où le son multicanal est entièrement supporté. Bien que Facebook Live et YouTube Live acceptent l'intégration de son multicanal, Facebook Live transcode en stéréo, et YouTube Live ne lit que deux canaux.\n\nLes filtres audio d'OBS sont compatibles avec le son multicanal, toutefois le support des plugins VST n'est pas garanti." +Basic.Settings.Audio.MultichannelWarning="Pour de besoins de diffusion, vérifiez que votre service de diffusion supporte l'intégration et la lecture du son multicanal. Facebook 360 Live, Mixer RTMP ou Smashcast sont des exemples de services où le son multicanal est entièrement supporté. Bien que Facebook Live et YouTube Live acceptent l'intégration de son multicanal, Facebook Live transcode en stéréo, et YouTube Live ne lit que deux canaux.\n\nLes filtres audio d'OBS sont compatibles avec le son multicanal, toutefois le support des plugins VST n'est pas garanti." Basic.Settings.Audio.MultichannelWarning.Title="Activer le son multicanal ?" Basic.Settings.Audio.MultichannelWarning.Confirm="Êtes vous sûr de vouloir activer le son multicanal ?" Basic.Settings.Audio.Devices="Périphériques" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Par défaut" Basic.Settings.Advanced.Audio.DisableAudioDucking="Désactiver l'atténuation audio de Windows (ducking)" Basic.Settings.Advanced.StreamDelay="Retard du stream" -Basic.Settings.Advanced.StreamDelay.Duration="Durée (en secondes)" +Basic.Settings.Advanced.StreamDelay.Duration="Durée" Basic.Settings.Advanced.StreamDelay.Preserve="Préserver le point de coupure (augmente le retard) lors d'une reconnexion" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Utilisation estimée de la mémoire : %1 Mo" Basic.Settings.Advanced.Network="Carte réseau (adresse IP source du flux)" Basic.Settings.Advanced.Network.BindToIP="Lier à :" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Activer le nouveau code réseau" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Mode faible latence" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Comportement selon le focus" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Ne jamais désactiver les raccourcis clavier" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Désactiver les raccourcis clavier lorsque la fenêtre principale est au premier plan" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Désactiver les raccourcis clavier quand la fenêtre principale est en arrière-plan" Basic.Settings.Advanced.AutoRemux="Convertir automatiquement en MP4" Basic.Settings.Advanced.AutoRemux.MP4="(enregistrer en MKV)" Basic.AdvAudio="Propriétés Audio Avancées" Basic.AdvAudio.Name="Nom" Basic.AdvAudio.Volume="Volume" -Basic.AdvAudio.Mono="Convertir en mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balance" -Basic.AdvAudio.SyncOffset="Décalage de la synchronisation (ms)" +Basic.AdvAudio.SyncOffset="Décalage de synchronisation" Basic.AdvAudio.Monitoring="Monitoring Audio" Basic.AdvAudio.Monitoring.None="Monitoring Désactivé" Basic.AdvAudio.Monitoring.MonitorOnly="Monitoring uniquement (couper la sortie)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="Vous devez sélectionner au moins une piste" OutputWarnings.MultiTrackRecording="Attention : Certains formats (comme FLV) ne supportent pas les pistes multiples pour un même enregistrement" OutputWarnings.MP4Recording="Avertissement : les enregistrements sauvegardés en MP4/MOV seront irrécupérables si le fichier ne peut pas être finalisé (ex. : à cause des BSOD, pannes de l'alimentation, etc...). Si vous voulez enregistrer plusieurs pistes audio, pensez à utiliser le format MKV et à convertir l'enregistrement en MP4/MOV après avoir terminé (Fichier → Convertir un enregistrement)" +OutputWarnings.CannotPause="Attention : l'enregistrement ne peut pas être mis en pause si l'encodeur d'enregistrement est configuré sur \"(Utiliser le même encodeur que pour le stream)\"" FinalScene.Title="Supprimer la scène" FinalScene.Text="Il doit y avoir au moins une scène."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/gd-GB.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/gd-GB.ini
Changed
@@ -23,7 +23,6 @@ Display="Uidheam-taisbeanaidh" Name="Ainm" Exit="Fàg an-seo" -Mixer="Measgadair" Browse="Rùraich" Mono="Mono" Stereo="Stereo" @@ -89,6 +88,7 @@ DockCloseWarning.Title="A’ dùnadh uinneag doca" DockCloseWarning.Text="Tha thu air uinneag doca a dhùnadh. Nam gu toigh leat a sealltainn a-rithist, cleachd clàr-taice “Seall” → “Docaichean” air bàr a’ chlàir-thaice." + Auth.Authing.Title="’Gad dhearbhadh…" Auth.Authing.Text="’Gad dhearbhadh le %1, fuirich greiseag…" Auth.AuthFailure.Title="Dh’fhàillig an dearbhadh" @@ -134,7 +134,6 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="An aire: Cha bhi dùmhlachd-bhreacaidh bhunasach (a’ chanabhais) co-ionnan ris an dùmhlachd-bhreacaidh a thèid a chlàradh no a shruthadh an-còmhnaidh. Dh’fhaoidte gun dèid an dùmhlachd-bhreacaidh air sruthadh no clàradh ìsleachadh o dhùmhlachd-bhreacaidh a’ chanabhais airson freagairt ri feumalachdan cleachdaidh no reat bhiotaichean." Basic.AutoConfig.StreamPage="Fiosrachadh an t-sruthaidh" Basic.AutoConfig.StreamPage.SubTitle="Cuid a-steach fiosrachadh an t-sruthaidh agad" -Basic.AutoConfig.StreamPage.ConnectAccount="Dèan ceangal ri cunntas (roghainneil)" Basic.AutoConfig.StreamPage.DisconnectAccount="Bris an ceangal ris a’ chunntas" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="A bheil thu airson an ceangal ris a’ chunntas a bhriseadh?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Thèid an t-atharradh seo a chur an sàs sa bhad. A bheil thu cinnteach gu bheil thu airson an ceangal ris a’ chunntas agad a bhriseadh?" @@ -234,6 +233,7 @@ ConfirmStop.Text="A bheil thu cinnteach gu bheil thu airson stad a chur air an t-sruthadh?" + ConfirmExit.Title="A bheil thu airson OBS fhàgail?" ConfirmExit.Text="Tha OBS gnìomhach an-dràsta. Thèid gach sruthadh no clàradh a chur gu crìch. A bheil thu cinnteach gu bheil thu airson fhàgail?" @@ -577,7 +577,6 @@ Basic.Settings.Output.Mode.Adv="Adhartach" Basic.Settings.Output.Mode.FFmpeg="Às-chur FFmpeg" Basic.Settings.Output.UseReplayBuffer="Cuir an comas bufair ath-chluiche" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Ùine as motha nan ath-chluichean (diog)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="A’ chuimhne as motha (meaga-baidht)" Basic.Settings.Output.ReplayBuffer.Estimate="Tuairmse air cleachdadh na cuimhne: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Chan urrainn dhuinn tuairmse a dhèanamh air cleachdadh na cuimhne. Suidhich crìoch as motha na cuimhne." @@ -604,7 +603,6 @@ Basic.Settings.Output.VideoBitrate="Reat bhiotaichean a’ video" Basic.Settings.Output.AudioBitrate="Reat bhiotaichean na fuaime" Basic.Settings.Output.Reconnect="Ath-cheangail gu fèin-obrachail" -Basic.Settings.Output.RetryDelay="Dàil na feuchainn a-rithist (diog)" Basic.Settings.Output.MaxRetries="Oidhirpean as motha" Basic.Settings.Output.Advanced="Cuir an comas roghainnean adhartach an inneil-chòdachaidh" Basic.Settings.Output.EncoderPreset="Ro-sheata an inneil-chòdachaidh" @@ -675,7 +673,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Dà-loidhneach (as luaithe ach sgleò air le sgèilachadh)" Basic.Settings.Video.DownscaleFilter.Bicubic="Dà-chiùbach (sgèileachadh geuraichte, 16 sampallan)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (sgèileachadh geuraichte, 32 sampall)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (sgèileachadh geuraichte, 36 sampall)" Basic.Settings.Audio="Fuaim" Basic.Settings.Audio.SampleRate="Reat shampallan" @@ -687,7 +685,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Ball-sampaill de bharr" Basic.Settings.Audio.PeakMeterType.TruePeak="Barr fìrinneach (cleachdadh nas àirde a’ CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="RABHADH: Tha fuaim cuairteachaidh an comas." -Basic.Settings.Audio.MultichannelWarning="Ma tha thu a’ dèanamh sruthadh, dearbh gun doir an t-seirbheis sruthaidh agad taic an dà chuid ri ion-chur is cluich fuaime cuairteachaidh. Mar eisimpleir, cuiridh Twitch, Facebook 360 Live, Mixer RTMP is Smashcast làn-taic ri fuaim cuairteachaidh. Ged a ghabhas Facebook Live is youTube Live ri sruthan fuaime cuairteachaidh, nì Facebook Live measgachadh sìos stereo dheth agus cha chluich YouTube live ach dà sheanail.\n\nTha criathragan fuaime OBS co-chòrdail ri fuaim cuairteachaidh ged nach doir sinn barantas gun obraich plugain VST." +Basic.Settings.Audio.MultichannelWarning="Ma tha thu a’ dèanamh sruthadh, dearbh gun doir an t-seirbheis sruthaidh agad taic an dà chuid ri ion-chur is cluich fuaime cuairteachaidh. Mar eisimpleir, cuiridh Facebook 360 Live, Mixer RTMP is Smashcast làn-taic ri fuaim cuairteachaidh. Ged a ghabhas Facebook Live is youTube Live ri sruthan fuaime cuairteachaidh, nì Facebook Live measgachadh sìos stereo dheth agus cha chluich YouTube live ach dà sheanail.\n\nTha criathragan fuaime OBS co-chòrdail ri fuaim cuairteachaidh ged nach doir sinn barantas gun obraich plugain VST." Basic.Settings.Audio.MultichannelWarning.Title="A bheil thu airson fuaim cuairteachaidh a chur an comas?" Basic.Settings.Audio.MultichannelWarning.Confirm="A bheil thu cinnteach gu bheil thu airson fuaim cuairteachaidh a chur an comas?" Basic.Settings.Audio.EnablePushToMute="Cuir an comas brùth-airson-mùchadh" @@ -712,7 +710,6 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Tùsail" Basic.Settings.Advanced.Audio.DisableAudioDucking="Cuir à comas tumadh fuaime Windows" Basic.Settings.Advanced.StreamDelay="Dàil an t-sruthaidh" -Basic.Settings.Advanced.StreamDelay.Duration="Faide (diog)" Basic.Settings.Advanced.StreamDelay.Preserve="Glèidh puing a’ ghearraidh (meudaich an dàil) nuair a nithear ath-cheangal" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Tuairmse air cleachdadh na cuimhne: %1 MB" Basic.Settings.Advanced.Network="Lìonra" @@ -725,9 +722,7 @@ Basic.AdvAudio="Roghainnean adhartach na fuaime" Basic.AdvAudio.Name="Ainm" -Basic.AdvAudio.Mono="Measgaich sìos gu mono" Basic.AdvAudio.Balance="Balans" -Basic.AdvAudio.SyncOffset="Frìth-àireamh an t-sioncronachaidh (ms)" Basic.AdvAudio.Monitoring="Sgrùdadh fuaime" Basic.AdvAudio.Monitoring.None="Gun sgrùdadh" Basic.AdvAudio.Monitoring.MonitorOnly="Sgrùdadh a-mhàin (mùch an t-às-chur)"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/gl-ES.ini
Changed
@@ -7,64 +7,227 @@ Cancel="Cancelar" Close="Pechar" Save="Gardar" -Discard="Descartar" +Discard="Desbotar" Disable="Desactivar" Yes="Si" No="Non" Add="Engadir" -Remove="Eliminar" +Remove="Retirar" Rename="Renomear" Interact="Interactuar" Filters="Filtros" Properties="Propiedades" -MoveUp="Subir" -MoveDown="Baixar" +MoveUp="Mover cara arriba" +MoveDown="Mover cara abaixo" Settings="Axustes" Display="Pantalla" Name="Nome" Exit="Saír" -Mixer="Mesturador" -Browse="Explorar" +Mixer="Mesturador de son" +Browse="Examinar" Mono="Mono" Stereo="Estéreo" DroppedFrames="Fotogramas perdidos %1 (%2%)" +StudioProgramProjector="Proxector de pantalla completa (programa)" PreviewProjector="Proxector de pantalla completa (vista previa)" SceneProjector="Proxector de pantalla completa (escena)" SourceProjector="Proxector de pantalla completa (fonte)" -Revert="Anular" -Show="Mostrar" +StudioProgramWindow="Proxector de xanelas (programa)" +PreviewWindow="Proxector de xanelas (vista previa)" +SceneWindow="Proxector de xanelas (escena)" +SourceWindow="Proxector de xanelas (fonte)" +MultiviewProjector="Vista múltiple (pantalla completa)" +MultiviewWindowed="Vista múltiple (en xanelas)" +Clear="Limpar" +Revert="Reverter" +Show="Amosar" Hide="Agochar" +UnhideAll="Amosar todo" Untitled="Sen título" New="Novo" Duplicate="Duplicar" Enable="Activar" DisableOSXVSync="Desactivar V-Sync en OSX" +ResetOSXVSyncOnExit="Restablecer V-Sync en OSX ao saír" +HighResourceUsage="Codificación sobrecargada! Considere rexeitar a configuración de vídeo ou usar un preaxuste de codificación máis rápido." Transition="Transición" QuickTransitions="Transicións rápidas" Left="Esquerda" Right="Dereita" Top="Arriba" Bottom="Abaixo" - - - - - - - - - - - - - -Basic.AddTransition="Engadir transición configurable" -Basic.RemoveTransition="Eliminar transición configurable" +Reset="Restablecer" +Hours="Horas" +Minutes="Minutos" +Seconds="Segundos" +Deprecated="Obsoleto" +ReplayBuffer="Memoria temporal de reprodución" +Import="Importar" +Export="Exportar" +Copy="Copiar" +Paste="Pegar" +PasteReference="Pegar (referencia)" +PasteDuplicate="Pegar (duplicado)" +RemuxRecordings="Gravacións de conversións" +Next="Seguinte" +Back="Atrás" +Defaults="Predeterminados" +HideMixer="Agochar no mesturador" +TransitionOverride="Substitución da transición" +None="Ningunha" +StudioMode.Preview="Vista previa" +StudioMode.Program="Programa" +ShowInMultiview="Amosar en vista múltiple" +VerticalLayout="Disposición vertical" +Group="Grupo" +DoNotShowAgain="Non volver amosar" +Default="(Predeterminado)" +Calculating="Calculando..." + +AlreadyRunning.Title="OBS xa está en execución" +AlreadyRunning.Text="OBS xa está en execución. A non ser que quixese facer isto, apague as instancias existentes de OBS antes de tentar executar unha nova instancia. Se ten OBS configurado para minimizar na bandexa do sistema, comprobe se aínda está en execución alí." +AlreadyRunning.LaunchAnyway="Iniciar de todos os xeitos" + +DockCloseWarning.Title="Pechar a xanela ancorábel" +DockCloseWarning.Text="Acaba de pechar unha xanela ancorábel. Se quere amosalo de novo, use o menú Ver → Docas na barra de menú." + +ExtraBrowsers="Docas personalizadas do navegador" +ExtraBrowsers.Info="Engada docas dándolles un nome e URL, após prema en Aplicar ou en Pechar para abrir as docas. Pode engadir ou retirar docas en calquera momento." +ExtraBrowsers.DockName="Nome da doca" + +Auth.Authing.Title="Autenticando..." +Auth.Authing.Text="Autenticando con %1, agarde..." +Auth.AuthFailure.Title="Produciuse un fallo de autenticación" +Auth.AuthFailure.Text="Produciuse un fallo de autenticación con %1:\n\n%2: %3" +Auth.InvalidScope.Title="É necesaria a autenticación" +Auth.InvalidScope.Text="Cambiaron os requisitos de autenticación para %1. É posíbel que algunhas funcións non estean dispoñíbeis." +Auth.LoadingChannel.Title="Cargando a información da canle..." +Auth.LoadingChannel.Text="Cargando a información da canle para %1, agarde..." +Auth.ChannelFailure.Title="Produciuse un fallo ao cargar a canle" +Auth.ChannelFailure.Text="Produciuse un fallo ao cargar a información da canle para %1\n\n%2: %3" +Auth.Chat="Conversa" +Auth.StreamInfo="Información da emisión" +TwitchAuth.Stats="Estatísticas do Twitch" +TwitchAuth.Feed="Fonte de actividades do Twitch" +TwitchAuth.TwoFactorFail.Title="Non foi posíbel consultar a clave da emisión" +TwitchAuth.TwoFactorFail.Text="OBS non foi quen de conectarse á súa conta Twitch. Asegúrese de que a autenticación de dous factores estea configurada na súa <a href='https://www.twitch.tv/settings/security'>Configuración de seguranza do Twitch</a> porque é necesaria para facer a emisión." +RestreamAuth.Channels="Volver facer emisión nas canles" + +Copy.Filters="Copiar os filtros" +Paste.Filters="Pegar filtros" + +BrowserPanelInit.Title="Inicializando o navegador..." +BrowserPanelInit.Text="Inicializando o navegador, agarde..." + +BandwidthTest.Region="Zona" +BandwidthTest.Region.US="Estados Unidos" +BandwidthTest.Region.EU="Europa" +BandwidthTest.Region.Asia="Asia" +BandwidthTest.Region.Other="Outra" + +Basic.FirstStartup.RunWizard="Quere executar o asistente de configuración automática? Tamén pode configurar manualmente os seus axustes premendo no botón Axustes na xanela principal." +Basic.FirstStartup.RunWizard.NoClicked="Se cambia de opinión, pode executar o asistente de configuración automática de novo dende o menú Ferramentas." + +Basic.AutoConfig="Asistente de configuración automática" +Basic.AutoConfig.ApplySettings="Aplicar os axustes" +Basic.AutoConfig.StartPage="Información de uso" +Basic.AutoConfig.StartPage.SubTitle="Especifique para que quere empregar o programa" +Basic.AutoConfig.StartPage.PrioritizeStreaming="Optimizar para distribución de emisións, a gravación é secundaria" +Basic.AutoConfig.StartPage.PrioritizeRecording="Optimizar só para gravar, non imos facer distribución de emisións" +Basic.AutoConfig.VideoPage="Axustes de vídeo" +Basic.AutoConfig.VideoPage.SubTitle="Especifique os axustes de vídeo que quere empregar" +Basic.AutoConfig.VideoPage.BaseResolution.UseCurrent="Usar a actual (%1x%2)" +Basic.AutoConfig.VideoPage.BaseResolution.Display="Pantalla %1 (%2x%3)" +Basic.AutoConfig.VideoPage.FPS.UseCurrent="Usar a actual (%1)" +Basic.AutoConfig.VideoPage.FPS.PreferHighFPS="60 ou 30, pero prefírese 60 cando é posíbel" +Basic.AutoConfig.VideoPage.FPS.PreferHighRes="60 ou 30, pero prefírese alta resolución" +Basic.AutoConfig.VideoPage.CanvasExplanation="Nota: a resolución do lenzo (base) non é necesariamente a mesma que a resolución coa que se vai emitir ou gravar. A resolución real da emisión/gravación pode reducirse a partires da resolución do lenzo para atenuar o consumo de recursos ou os requirimentos da taxa de bits." +Basic.AutoConfig.StreamPage="Información da emisión" +Basic.AutoConfig.StreamPage.SubTitle="Insira a información da súa emisión" +Basic.AutoConfig.StreamPage.ConnectAccount="Conectar a conta (recomendado)" +Basic.AutoConfig.StreamPage.DisconnectAccount="Desconectar a conta" +Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Desconectar a conta?" +Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Este cambio aplicarase de inmediato. Está seguro de que quere desconectar a súa conta?" +Basic.AutoConfig.StreamPage.UseStreamKey="Usar a clave da emisión" +Basic.AutoConfig.StreamPage.Service="Servizo" +Basic.AutoConfig.StreamPage.Service.ShowAll="Amosar todo..." +Basic.AutoConfig.StreamPage.Service.Custom="Personalizado..." +Basic.AutoConfig.StreamPage.Server="Servidor" +Basic.AutoConfig.StreamPage.StreamKey="Clave da emisión" +Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(Ligazón)" +Basic.AutoConfig.StreamPage.PerformBandwidthTest="Estimar a taxa de bits coa proba de largo de banda (pode levar uns minutos)" +Basic.AutoConfig.StreamPage.PreferHardwareEncoding="Prefírese a codificación por hardware" +Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="A codificación por hardware elimina a maior parte do uso da CPU, pero pode requirir unha maior taxa de bits para obter o mesmo nivel de calidade." +Basic.AutoConfig.StreamPage.StreamWarning.Title="Aviso da emisión" +Basic.AutoConfig.StreamPage.StreamWarning.Text="A proba de largo de banda está a piques de emitir datos de vídeo ao chou sen son á súa canle. Se é posíbel, recoméndase desactivar temporalmente o gardado dos vídeos das emisións e estabelecer a emisión coma privada até que remate a proba. Continuar?" +Basic.AutoConfig.TestPage="Resultados finais" +Basic.AutoConfig.TestPage.SubTitle.Testing="O programa está executando agora un conxunto de probas para estimar os axustes ideais" +Basic.AutoConfig.TestPage.SubTitle.Complete="Proba completa" +Basic.AutoConfig.TestPage.TestingBandwidth="Realizando a proba de largo de banda, isto pode levar uns minutos..." +Basic.AutoConfig.TestPage.TestingBandwidth.Connecting="Conectando a: %1..." +Basic.AutoConfig.TestPage.TestingBandwidth.ConnectFailed="Produciuse un fallo ao conectarse a calquera servidor, comprobe a conexión a Internet e ténteo de novo." +Basic.AutoConfig.TestPage.TestingBandwidth.Server="Probando o largo de banda para: %1" +Basic.AutoConfig.TestPage.TestingStreamEncoder="Probando o codificador da emisión, isto pode levar un minuto..." +Basic.AutoConfig.TestPage.TestingRecordingEncoder="Probando o codificador da gravación, isto pode levar un minuto..." +Basic.AutoConfig.TestPage.TestingRes="Probando as resolucións, isto pode levar uns minutos..." +Basic.AutoConfig.TestPage.TestingRes.Fail="Produciuse un erro ao iniciar o codificador" +Basic.AutoConfig.TestPage.TestingRes.Resolution="Probando %1x%2 %3 FPS..." +Basic.AutoConfig.TestPage.Result.StreamingEncoder="Codificador da emisión" +Basic.AutoConfig.TestPage.Result.RecordingEncoder="Codificador da gravación" +Basic.AutoConfig.TestPage.Result.Header="O programa determinou que estes axustes estimados son os máis idóneos para vostede:" +Basic.AutoConfig.TestPage.Result.Footer="Para usar estes axustes, prema en Aplicar os axustes. Para volver configurar o asistente e téntalo de novo, prema en Atrás. Para configurar manualmente os axustes, prema en Cancelar e abra Axustes." + +Basic.Stats="Estatísticas" +Basic.Stats.CPUUsage="Uso da CPU" +Basic.Stats.HDDSpaceAvailable="Dispoñíbel espazo no disco" +Basic.Stats.MemoryUsage="Uso da memoria" +Basic.Stats.AverageTimeToRender="Tempo de media para xerar os cadros" +Basic.Stats.SkippedFrames="Fotogramas omitidos pola demora na codificación" +Basic.Stats.MissedFrames="Fotogramas perdidos pola demora na xeración" +Basic.Stats.Output.Stream="Emisión" +Basic.Stats.Output.Recording="Gravando" +Basic.Stats.Status="Estado" +Basic.Stats.Status.Recording="Gravando" +Basic.Stats.Status.Live="EN DIRECTO" +Basic.Stats.Status.Reconnecting="Volvendo conectar" +Basic.Stats.Status.Inactive="Inactivo" +Basic.Stats.DroppedFrames="Fotogramas perdidos (rede)" +Basic.Stats.MegabytesSent="Saída total de datos" +Basic.Stats.Bitrate="Taxa de bits" +Basic.Stats.DiskFullIn="Disco cheo en (aprox.)" + +ResetUIWarning.Title="Confirma que quere restabelecer a interface de usuario?" +ResetUIWarning.Text="Se restabelece a interface de usuario agochará as docas adicionais. Deberá agochar estas docas no menú Ver se quere que sexan visíbeis.\n\nConfirma que quere restabelecer a interface de usuario?" + +Updater.Title="Dispoñíbel unha nova actualización" +Updater.Text="Hai unha nova actualización dispoñíbel:" +Updater.UpdateNow="Actualizar agora" +Updater.RemindMeLater="Lembrarmo máis tarde" +Updater.Skip="Omitir a versión" +Updater.Running.Title="Programa activo actualmente" +Updater.Running.Text="As saídas están activas neste momento. Peche todas as saídas activas antes de tentar actualizar" +Updater.NoUpdatesAvailable.Title="Non hai actualizacións dispoñíbeis" +Updater.NoUpdatesAvailable.Text="Non hai actualizacións dispoñíbeis actualmente" +Updater.FailedToLaunch="Produciuse un fallo ao iniciar o actualizador" +Updater.GameCaptureActive.Title="Captura de xogo activa" +Updater.GameCaptureActive.Text="A biblioteca de captura de xogos está activa neste momento. Peche todos os xogos/programas que estean a se capturar (ou reinicie Windows) e ténteo de novo." + +QuickTransitions.SwapScenes="Cambiar as escenas Vista previa/Programa após a transición" +QuickTransitions.SwapScenesTT="Intercambia as escenas de vista previa e saída após a transición (se aínda existe a escena orixinal da saída).\nIsto non desfará os cambios que puidesen terse feito na escena orixinal de saída." +QuickTransitions.DuplicateScene="Escena duplicada" +QuickTransitions.DuplicateSceneTT="Ao editar a mesma escena, permite editar a transformación/visibilidade das fontes sen modificar a saída.\nPara editar as propiedades das fontes sen modificar a saída, active «Fontes duplicadas».\nCambiar este valor restablecerá a escena de saída actual (se aínda existe)." +QuickTransitions.EditProperties="Fontes duplicadas" +QuickTransitions.EditPropertiesTT="Ao editar a mesma escena, permite editar as propiedades das fontes sen modificar a saída.\nIsto só se pode empregar se está activada a opción «Escena duplicada».\nAlgunhas fontes (como as de captura ou as multimedia) non admiten isto e non se poden editar por separado.\nCambiar este valor restablecerá a escena de saída actual (se aínda existe).\n\nAviso: dado que as fontes se duplicarán, isto pode requirir recursos adicionais do sistema ou de vídeo." +QuickTransitions.HotkeyName="Transición rápida: %1" + +Basic.AddTransition="Engadir transición configurábel" +Basic.RemoveTransition="Eliminar transición configurábel" Basic.TransitionProperties="Propiedades da transición" Basic.SceneTransitions="Transicións de escena" Basic.TransitionDuration="Duración" Basic.TogglePreviewProgramMode="Modo de estudio" +TransitionNameDlg.Text="Insira o nome da transición" TransitionNameDlg.Title="Nome da transición" TitleBar.Profile="Perfil" @@ -73,52 +236,86 @@ NameExists.Title="O nome xa existe" NameExists.Text="O nome xa está en uso." -NoNameEntered.Title="Por favor, insire un nome válido" -NoNameEntered.Text="Non podes empregar nomes baleiros." +NoNameEntered.Title="Insira un nome válido" +NoNameEntered.Text="Non é posíbel empregar nomes baleiros." + +ConfirmStart.Title="Comezar a emisión?" +ConfirmStart.Text="Confirma que quere iniciar a emisión?" -ConfirmStart.Title="Iniciar transmisión?" +ConfirmStop.Title="Deter a emisión?" +ConfirmStop.Text="Confirma que quere deter a emisión?" -ConfirmStop.Title="Deter transmisión?" -ConfirmStop.Text="Tes a certeza de querer deter a transmisión?" +ConfirmStopRecord.Title="Deter a gravación?" +ConfirmStopRecord.Text="Confirma que quere deter a gravación?" +ConfirmBWTest.Title="Iniciar a proba do largo de banda?" +ConfirmBWTest.Text="Ten o OBS configurado no modo de proba de largo de banda. Este modo permite probar a rede sen que a súa canle entre en directo. Unha vez rematada a proba, terá que desactivalo para que os espectadores poidan ver a súa emisión.\n\nQuere continuar?" -ConfirmExit.Title="Saír de OBS?" +ConfirmExit.Title="Saír do OBS?" +ConfirmExit.Text="OBS está activo neste momento. Deteranse todas as emisións/gravacións. Confirma que quere saír?" -ConfirmRemove.Title="Confirmar a eliminación" -ConfirmRemove.Text="Tes a certeza de querer eliminar '$1'?" +ConfirmRemove.Title="Confirmar a retirada" +ConfirmRemove.Text="Confirma que quere retirar «$1»?" +ConfirmRemove.TextMultiple="Confirma que quere retirar %1 elementos?" +Output.StartStreamFailed="Produciuse un fallo ao iniciar a emisión" +Output.StartRecordingFailed="Produciuse un fallo ao iniciar a gravación" +Output.StartReplayFailed="Produciuse un fallo ao iniciar a reprodución da memoria temporal" +Output.StartFailedGeneric="Produciuse un fallo na saída. Comprobe o rexistro para ver os detalles.\n\nNota: Se está a usar codificadores NVENC ou AMD, asegúrese de que os controladores de vídeo estean actualizados." +Output.ReplayBuffer.PauseWarning.Title="Non é posíbel gardar as reproducións mentres estea en pausa" +Output.ReplayBuffer.PauseWarning.Text="Aviso: non é posíbel gardar as reproducións mentres a gravación estea en pausa." -Output.ConnectFail.Title="Erro ao se conectar" -Output.ConnectFail.BadPath="Camiño ou URL de conexión non válidos. Por favor, comproba a configuración para confirmar de que son correctos." -Output.ConnectFail.ConnectFailed="Erro ao conectar co servidor" +Output.ConnectFail.Title="Produciuse un erro ao se conectar" +Output.ConnectFail.BadPath="Ruta ou URL de conexión non válidos. Comprobe os axustes para confirmar que son correctos." +Output.ConnectFail.ConnectFailed="Produciuse un fallo ao conectar co servidor" +Output.ConnectFail.InvalidStream="Non foi posíbel acceder á canle ou clave da emisión especificada, faga a dobre comprobación da clave da emisión. Se é correcta, pode haber un problema na conexión ao servidor." Output.ConnectFail.Error="Produciuse un erro inesperado ao tentar conectar co servidor. Máis información no ficheiro de rexistro." Output.ConnectFail.Disconnected="Desconectado do servidor." +Output.StreamEncodeError.Title="Produciuse un erro de codificación" +Output.StreamEncodeError.Msg="Produciuse un erro de codificación durante a emisión." -Output.RecordFail.Title="Erro ao iniciar a gravación" +Output.RecordFail.Title="Produciuse un erro ao iniciar a gravación" +Output.RecordFail.Unsupported="O formato de saída non é compatíbel ou non admite máis dunha pista de son. Verifique a súa configuración e ténteo de novo." +Output.RecordNoSpace.Title="Non hai espazo abondo no disco" +Output.RecordNoSpace.Msg="Non hai espazo abondo no disco para continuar coa gravación." +Output.RecordError.Title="Produciuse un erro de gravación" +Output.RecordError.Msg="Produciuse un erro non especificado durante a gravación." +Output.RecordError.EncodeErrorMsg="Produciuse un erro de codificación durante a gravación." +Output.ReplayBuffer.NoHotkey.Title="Non hai estabelecida ningunha tecla rápida!" +Output.ReplayBuffer.NoHotkey.Msg="Non hai estabelecida ningunha tecla rápida para a memoria temporal de reprodución. Estabeleza a tecla rápida «Gardar» para utilizala para gardar as gravacións de reproducións." -Output.BadPath.Title="Camiño do ficheiro incorrecto" -Output.BadPath.Text="O camiño de ficheiros establecido non é válido. Por favor, comproba a configuración para confirmar que se estableceu un camiño válido." +Output.BadPath.Title="Ruta do ficheiro incorrecta" +Output.BadPath.Text="A ruta dos ficheiros establecida non é válida. Comprobe os axustes para confirmar que foi estabelecida unha ruta válida." -LogReturnDialog="Carga de rexistro satisfactoria" -LogReturnDialog.CopyURL="Copiar URL" -LogReturnDialog.ErrorUploadingLog="Erro ao cargar o ficheiro de rexistro" +LogReturnDialog="Carga satisfactoria do rexistro" +LogReturnDialog.CopyURL="Copiar o URL" +LogReturnDialog.ErrorUploadingLog="Produciuse un erro ao cargar o ficheiro de rexistro" Remux.SourceFile="Gravación OBS" Remux.TargetFile="Ficheiro de destino" Remux.Remux="Converter" +Remux.Stop="Deter a conversión" +Remux.ClearFinished="Limpar os elementos rematados" +Remux.ClearAll="Limpar todos os elementos" +Remux.OBSRecording="Gravación OBS" Remux.FinishedTitle="Conversión rematada" -Remux.Finished="Gravando conversión" +Remux.Finished="Gravando a conversión" Remux.FinishedError="Gravación convertida, mais o ficheiro podería estar incompleto" -Remux.ExitUnfinishedTitle="Conversión en marcha" -Remux.ExitUnfinished="A conversión non rematou, detela agora podería provocar que o ficheiro final fose inutilizable.\nTes a certeza de querer deter a conversión?" - -UpdateAvailable="Nova actualización dispoñible" -UpdateAvailable.Text="Versión %1.%2.%3 xa dispoñible. <a href='%4'>Preme aquí para descargala</a>" - -Basic.DesktopDevice1="Audio do escritorio" -Basic.DesktopDevice2="Audio do escritorio 2" +Remux.SelectRecording="Seleccionar a gravación OBS..." +Remux.SelectTarget="Seleccionar o ficheiro de destino..." +Remux.FileExistsTitle="Xa existen ficheiros de destino" +Remux.FileExists="Os ficheiros de destino seguintes xa existen. Quere substituílos?" +Remux.ExitUnfinishedTitle="Conversión en proceso" +Remux.ExitUnfinished="A conversión aínda non rematou, detela agora podería provocar que o ficheiro final fose inutilizábel.\nConfirma que quere deter a conversión?" +Remux.HelpText="Solte os ficheiros para converter nesta xanela ou seleccione unha cela «Gravación OBS» baleira para buscar un ficheiro." + +UpdateAvailable="Hai dispoñíbel unha nova actualización" +UpdateAvailable.Text="A versión %1.%2.%3 xa está dispoñíbel. <a href='%4'>Prema aquí para descargala</a>" + +Basic.DesktopDevice1="Son do escritorio" +Basic.DesktopDevice2="Son do escritorio 2" Basic.AuxDevice1="Mic/Aux" Basic.AuxDevice2="Mic/Aux 2" Basic.AuxDevice3="Mic/Aux 3" @@ -127,70 +324,106 @@ Basic.Scene="Escena" Basic.DisplayCapture="Captura de pantalla" -Basic.Main.PreviewConextMenu.Enable="Habilitar vista previa" - - - - +Basic.Main.PreviewConextMenu.Enable="Activar a vista previa" + +Basic.Main.Preview.Disable="Desactivar a vista previa" + +ScaleFiltering="Filtrado de escala" +ScaleFiltering.Point="Punto" +ScaleFiltering.Bilinear="Bilineal" +ScaleFiltering.Bicubic="Bicúbico" +ScaleFiltering.Lanczos="Lanczos" +ScaleFiltering.Area="Área" + +Deinterlacing="Desentrelazado" +Deinterlacing.Discard="Desbotar" +Deinterlacing.Retro="Retroactivo" +Deinterlacing.Blend="Mestura" +Deinterlacing.Blend2x="Mestura 2x" +Deinterlacing.Linear="Lineal" +Deinterlacing.Linear2x="Lineal 2x" +Deinterlacing.Yadif="Yadif" +Deinterlacing.Yadif2x="Yadif 2x" +Deinterlacing.TopFieldFirst="Primeiro o campo superior" +Deinterlacing.BottomFieldFirst="Primeiro o campo inferior" + +VolControl.SliderUnmuted="Potenciómetro de volume para «%1»: %2" +VolControl.SliderMuted="Potenciómetro de volume para «%1»: %2 (actualmente silenciado)" +VolControl.Mute="Silenciar «%1»" +VolControl.Properties="Propiedades para «%1»" Basic.Main.AddSceneDlg.Title="Engadir escena" -Basic.Main.AddSceneDlg.Text="Por favor, insire un nome para a escena" +Basic.Main.AddSceneDlg.Text="Insira un nome para a escena" Basic.Main.DefaultSceneName.Text="Escena %1" Basic.Main.AddSceneCollection.Title="Engadir colección de escenas" -Basic.Main.AddSceneCollection.Text="Por favor, insire o nome da colección de escenas" +Basic.Main.AddSceneCollection.Text="Insira o nome da colección de escenas" -Basic.Main.RenameSceneCollection.Title="Renomear colección de escenas" +Basic.Main.RenameSceneCollection.Title="Renomear a colección de escenas" AddProfile.Title="Engadir perfil" -AddProfile.Text="Por favor, insire o nome do perfil" +AddProfile.Text="Insira o nome do perfil" -RenameProfile.Title="Renomear perfil" +RenameProfile.Title="Renomear o perfil" +Basic.Main.MixerRename.Title="Renomear a fonte de son" +Basic.Main.MixerRename.Text="Insira un nome para a fonte de son" -Basic.Main.PreviewDisabled="A vista previa está actualmente deshabilitada" +Basic.Main.PreviewDisabled="A vista previa está desactivada actualmente" Basic.SourceSelect="Crear/seleccionar fonte" Basic.SourceSelect.CreateNew="Crear nova" Basic.SourceSelect.AddExisting="Engadir existente" +Basic.SourceSelect.AddVisible="Facer visíbel a fonte" -Basic.PropertiesWindow="Propiedades para '%1'" +Basic.PropertiesWindow="Propiedades para «%1»" +Basic.PropertiesWindow.AutoSelectFormat="%1 (seleccionar automaticamente: %2)" Basic.PropertiesWindow.SelectColor="Seleccionar cor" -Basic.PropertiesWindow.SelectFont="Seleccionar fonte" +Basic.PropertiesWindow.SelectFont="Seleccionar o tipo de letra" Basic.PropertiesWindow.ConfirmTitle="Axustes cambiados" -Basic.PropertiesWindow.Confirm="Hai cambios sen gardar. Queres conservalos?" -Basic.PropertiesWindow.NoProperties="Ningunha propiedade dispoñible" +Basic.PropertiesWindow.Confirm="Hai cambios sen gardar. Quere conservalos?" +Basic.PropertiesWindow.NoProperties="Non hai ningunha propiedade dispoñíbel" Basic.PropertiesWindow.AddFiles="Engadir ficheiros" -Basic.PropertiesWindow.AddURL="Engadir camiño/URL" -Basic.PropertiesWindow.AddEditableListFiles="Engadir ficheiros a '%1'" -Basic.PropertiesWindow.AddEditableListEntry="Engadir entrada a '%1'" -Basic.PropertiesWindow.EditEditableListEntry="Egnadir entrada desde '%1'" +Basic.PropertiesWindow.AddDir="Engadir directorio" +Basic.PropertiesWindow.AddURL="Engadir ruta/URL" +Basic.PropertiesWindow.AddEditableListDir="Engadir directorio a «%1»" +Basic.PropertiesWindow.AddEditableListFiles="Engadir ficheiros a «%1»" +Basic.PropertiesWindow.AddEditableListEntry="Engadir entrada a «%1»" +Basic.PropertiesWindow.EditEditableListEntry="Editar entrada dende «%1»" +Basic.PropertiesView.FPS.Simple="Valores FPS sinxelos" +Basic.PropertiesView.FPS.Rational="Valores racionais FPS" +Basic.PropertiesView.FPS.ValidFPSRanges="Intervalos FPS válidos:" -Basic.InteractionWindow="Interactuando con '%1'" +Basic.InteractionWindow="Interactuando con «%1»" Basic.StatusBar.Reconnecting="Desconectado, reconectando en %2 segundo(s) (tentativa número %1)" Basic.StatusBar.AttemptingReconnect="Tentando reconectar... (tentativa número %1)" Basic.StatusBar.ReconnectSuccessful="Reconexión satisfactoria" +Basic.StatusBar.Delay="Atraso (%1 seg)" +Basic.StatusBar.DelayStartingIn="Atraso (iniciando en %1 seg)" +Basic.StatusBar.DelayStoppingIn="Atraso (detendo en %1 seg)" +Basic.StatusBar.DelayStartingStoppingIn="Atraso (detendo en %1 seg, iniciando en %2 seg)" Basic.Filters="Filtros" -Basic.Filters.AsyncFilters="Filtros de audio/vídeo" -Basic.Filters.AudioFilters="Filtros de audio" +Basic.Filters.AsyncFilters="Filtros de son/vídeo" +Basic.Filters.AudioFilters="Filtros de son" Basic.Filters.EffectFilters="Filtros de efectos" -Basic.Filters.Title="Filtros para '%1'" +Basic.Filters.Title="Filtros para «%1»" Basic.Filters.AddFilter.Title="Nome do filtro" -Basic.Filters.AddFilter.Text="Especifica, por favor, o nome do filtro" +Basic.Filters.AddFilter.Text="Especifique o nome do filtro" Basic.TransformWindow="Axustes de escena" Basic.TransformWindow.Position="Posición" Basic.TransformWindow.Rotation="Rotación" Basic.TransformWindow.Size="Tamaño" Basic.TransformWindow.Alignment="Aliñamento" -Basic.TransformWindow.BoundsType="Tipo de caixa dependente" -Basic.TransformWindow.BoundsAlignment="Aliñamento na caixa dependente" -Basic.TransformWindow.Bounds="Tamaño da caixa dependente" +Basic.TransformWindow.BoundsType="Tipo de caixa contedora" +Basic.TransformWindow.BoundsAlignment="Aliñamento na caixa contedora" +Basic.TransformWindow.Bounds="Tamaño da caixa contedora" +Basic.TransformWindow.Crop="Recortar" Basic.TransformWindow.Alignment.TopLeft="Arriba á esquerda" Basic.TransformWindow.Alignment.TopCenter="Arriba no centro" @@ -210,23 +443,38 @@ Basic.TransformWindow.BoundsType.ScaleToHeight="Escalar á altura dos límites" Basic.TransformWindow.BoundsType.Stretch="Estricar ata os límites" -Basic.Main.AddSourceHelp.Title="Non se pode engadir a fonte" -Basic.Main.AddSourceHelp.Text="Tes que ter cando menos 1 escena para engadir unha fonte." +Basic.Main.AddSourceHelp.Title="Non é posíbel engadir a fonte" +Basic.Main.AddSourceHelp.Text="Ten que ter cando menos 1 escena para engadir unha fonte." Basic.Main.Scenes="Escenas" Basic.Main.Sources="Fontes" -Basic.Main.Connecting="A conectar..." -Basic.Main.StartRecording="Iniciar gravación" -Basic.Main.StartStreaming="Iniciar retransmisión" -Basic.Main.StopRecording="Deter gravación" -Basic.Main.StopStreaming="Deter retransmisión" +Basic.Main.Controls="Controis" +Basic.Main.Connecting="Conectando..." +Basic.Main.StartRecording="Iniciar a gravación" +Basic.Main.StartReplayBuffer="Iniciar a reprodución da memoria temporal" +Basic.Main.StartStreaming="Comezar a emisión" +Basic.Main.StopRecording="Deter a gravación" +Basic.Main.PauseRecording="Pór en pausa a gravación" +Basic.Main.UnpauseRecording="Reiniciar a gravación" +Basic.Main.StoppingRecording="Detendo a gravación..." +Basic.Main.StopReplayBuffer="Deter a reprodución da memoria temporal" +Basic.Main.StoppingReplayBuffer="Detendo a reprodución da memoria temporal..." +Basic.Main.StopStreaming="Deter a emisión" +Basic.Main.StoppingStreaming="Detendo a emisión..." +Basic.Main.ForceStopStreaming="Deter a emisión (desbotar o atraso)" +Basic.Main.Group="Grupo %1" +Basic.Main.GroupItems="Agrupar os elementos seleccionados" +Basic.Main.Ungroup="Desagrupar" Basic.MainMenu.File="&Ficheiro" Basic.MainMenu.File.Export="&Exportar" Basic.MainMenu.File.Import="&Importar" -Basic.MainMenu.File.ShowRecordings="Most&rar gravacións" -Basic.MainMenu.File.Remux="Conversións gardadas (&M)" +Basic.MainMenu.File.ShowRecordings="Amosa&r as gravacións" +Basic.MainMenu.File.Remux="Gravacións de conversións (&M)" Basic.MainMenu.File.Settings="Axu&stes" +Basic.MainMenu.File.ShowSettingsFolder="Amosar o cartafol dos axustes" +Basic.MainMenu.File.ShowProfileFolder="Amosar o cartafol deo perfil" +Basic.MainMenu.AlwaysOnTop="Sempre enriba" Basic.MainMenu.File.Exit="Saír (&X)" Basic.MainMenu.Edit="&Editar" @@ -234,146 +482,342 @@ Basic.MainMenu.Edit.Redo="&Refacer" Basic.MainMenu.Edit.UndoAction="Desfacer $1 (&U)" Basic.MainMenu.Edit.RedoAction="&Refacer $1" +Basic.MainMenu.Edit.LockPreview="Vista previa do b&loqueo" +Basic.MainMenu.Edit.Scale="E&scalado da vista previa" +Basic.MainMenu.Edit.Scale.Window="Escalar á xanela" +Basic.MainMenu.Edit.Scale.Canvas="Lenzo (%1x%2)" +Basic.MainMenu.Edit.Scale.Output="Saída (%1x%2)" Basic.MainMenu.Edit.Transform="&Transformar" -Basic.MainMenu.Edit.Transform.EditTransform="&Editar transformación..." -Basic.MainMenu.Edit.Transform.ResetTransform="&Restablecer transformación" -Basic.MainMenu.Edit.Transform.Rotate90CW="Rotar 90 graos no sentido das agullas" -Basic.MainMenu.Edit.Transform.Rotate90CCW="Rotar 90 graos contra o sentido das agullas" +Basic.MainMenu.Edit.Transform.EditTransform="&Editar a transformación..." +Basic.MainMenu.Edit.Transform.CopyTransform="Copiar a transformación" +Basic.MainMenu.Edit.Transform.PasteTransform="Pegar a transformación" +Basic.MainMenu.Edit.Transform.ResetTransform="&Restabelecer a transformación" +Basic.MainMenu.Edit.Transform.Rotate90CW="Rotar 90 graos no sentido das agullas do reloxo" +Basic.MainMenu.Edit.Transform.Rotate90CCW="Rotar 90 graos contra o sentido das agullas do relox" Basic.MainMenu.Edit.Transform.Rotate180="Rotar 180 graos" -Basic.MainMenu.Edit.Transform.FlipHorizontal="Virar &horizontalmente" -Basic.MainMenu.Edit.Transform.FlipVertical="Virar &verticalmente" +Basic.MainMenu.Edit.Transform.FlipHorizontal="Inverter &horizontalmente" +Basic.MainMenu.Edit.Transform.FlipVertical="Inverter &verticalmente" Basic.MainMenu.Edit.Transform.FitToScreen="Axustar á pantalla (&F)" Basic.MainMenu.Edit.Transform.StretchToScreen="E&stricar á pantalla" Basic.MainMenu.Edit.Transform.CenterToScreen="&Centrar na pantalla" +Basic.MainMenu.Edit.Transform.VerticalCenter="Centrar verticalmente" +Basic.MainMenu.Edit.Transform.HorizontalCenter="Centrar horizontalmente" Basic.MainMenu.Edit.Order="&Ordenar" Basic.MainMenu.Edit.Order.MoveUp="S&ubir" Basic.MainMenu.Edit.Order.MoveDown="Baixar (&D)" Basic.MainMenu.Edit.Order.MoveToTop="Levar para a cima (&T)" Basic.MainMenu.Edit.Order.MoveToBottom="Levar para a&baixo" -Basic.MainMenu.Edit.AdvAudio="Propiedades de audio &avanzadas" - +Basic.MainMenu.Edit.AdvAudio="Propiedades &avanzadas de son" + +Basic.MainMenu.View="&Ver" +Basic.MainMenu.View.Toolbars="Barras de ferramentas (&T)" +Basic.MainMenu.View.Docks="Docas" +Basic.MainMenu.View.Docks.ResetUI="Restabelecer a interface de usuario" +Basic.MainMenu.View.Docks.LockUI="Bloquear a interface de usuario" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Docas personalizadas do navegador..." +Basic.MainMenu.View.Toolbars.Listboxes="Caixas de &listas" +Basic.MainMenu.View.SceneTransitions="Transicións de e&scena" +Basic.MainMenu.View.StatusBar="Barra de e&stado" +Basic.MainMenu.View.Fullscreen.Interface="Interface de pantalla completa" Basic.MainMenu.SceneCollection="Colección de e&scenas" Basic.MainMenu.Profile="&Perfil" +Basic.MainMenu.Profile.Import="Importar perfil" +Basic.MainMenu.Profile.Export="Exportar perfil" +Basic.MainMenu.SceneCollection.Import="Importar colección de escenas" +Basic.MainMenu.SceneCollection.Export="Exportar colección de escenas" +Basic.MainMenu.Profile.Exists="O perfil xa existe" +Basic.MainMenu.SceneCollection.Exists="A colección de escenas xa existe" +Basic.MainMenu.Tools="Ferramen&tas" Basic.MainMenu.Help="Axuda (&H)" +Basic.MainMenu.Help.HelpPortal="&Portal de axuda" Basic.MainMenu.Help.Website="Visitar sitio &web" +Basic.MainMenu.Help.Discord="Unirse ao servidor de &Discord" Basic.MainMenu.Help.Logs="Ficheiros de rexistro (&L)" -Basic.MainMenu.Help.Logs.ShowLogs="Mostrar ficheiro&s de rexistro" -Basic.MainMenu.Help.Logs.UploadCurrentLog="Subir fi&cheiro de rexistro actual" -Basic.MainMenu.Help.Logs.UploadLastLog="Subir o ú<imo ficheiro de rexistro" -Basic.MainMenu.Help.Logs.ViewCurrentLog="&Ver rexistro actual" +Basic.MainMenu.Help.Logs.ShowLogs="Amo&sar os ficheiros de rexistro" +Basic.MainMenu.Help.Logs.UploadCurrentLog="Enviar o ficheiro de rexistro a&ctual" +Basic.MainMenu.Help.Logs.UploadLastLog="Enviar o ú<imo ficheiro de rexistro" +Basic.MainMenu.Help.Logs.ViewCurrentLog="&Ver o rexistro actual" Basic.MainMenu.Help.CheckForUpdates="Comprobar se hai actualizacións" +Basic.MainMenu.Help.CrashLogs="Info&rmes de fallos" +Basic.MainMenu.Help.CrashLogs.ShowLogs="Amo&sar os informes de fallos" +Basic.MainMenu.Help.CrashLogs.UploadLastLog="Enviar o ú<imo informe de fallo" +Basic.MainMenu.Help.About="Sobre (&A)" Basic.Settings.ProgramRestart="Debe reiniciarse o programa para que se aplique a nova configuración." -Basic.Settings.ConfirmTitle="Confirmar cambios" -Basic.Settings.Confirm="Hai cambios sen gardar. Desexas gardalos?" +Basic.Settings.ConfirmTitle="Confirmar os cambios" +Basic.Settings.Confirm="Hai cambios sen gardar. Quere gardalos?" Basic.Settings.General="Xeral" Basic.Settings.General.Theme="Tema" Basic.Settings.General.Language="Idioma" - -Basic.Settings.Stream="Reprodución" -Basic.Settings.Stream.StreamType="Tipo de retransmisión" +Basic.Settings.General.EnableAutoUpdates="Comprobar automaticamente no inicio se hai actualizacións" +Basic.Settings.General.OpenStatsOnStartup="Abrir o diálogo de estatísticas ao iniciar" +Basic.Settings.General.WarnBeforeStartingStream="Amosar o diálogo de confirmación ao iniciar as emisións" +Basic.Settings.General.WarnBeforeStoppingStream="Amosar o diálogo de confirmación ao deter as emisións" +Basic.Settings.General.WarnBeforeStoppingRecord="Amosar o diálogo de confirmación ao deter a gravación" +Basic.Settings.General.Projectors="Proxectores" +Basic.Settings.General.HideProjectorCursor="Agochar o cursor nos proxectores" +Basic.Settings.General.ProjectorAlwaysOnTop="Poñer os proxectores sempre na parte superior" +Basic.Settings.General.Snapping="Axuste do aliñamento da fonte" +Basic.Settings.General.ScreenSnapping="Axustar as fontes ao bordo da pantalla" +Basic.Settings.General.CenterSnapping="Axustar as fontes ao centro horizontal e vertical" +Basic.Settings.General.SourceSnapping="Axustar as fontes a outras fontes" +Basic.Settings.General.SnapDistance="Axustar a sensibilidade" +Basic.Settings.General.RecordWhenStreaming="Gravar automáticamente cando se está a emitir" +Basic.Settings.General.KeepRecordingWhenStreamStops="Seguir gravando cando se detén a emisión" +Basic.Settings.General.ReplayBufferWhileStreaming="Iniciar automáticamente a memoria temporal de reprodución cando se está a emitir" +Basic.Settings.General.KeepReplayBufferStreamStops="Manter a memoria temporal de reprodución activa cando se detén a emisión" +Basic.Settings.General.SysTray="Área de notificación" +Basic.Settings.General.SysTrayWhenStarted="Minimizar á área de notificación cando se inicia" +Basic.Settings.General.SystemTrayHideMinimize="Minimizar sempre na área de notificación no canto de na barra de tarefas" +Basic.Settings.General.SaveProjectors="Gardar os proxectores ao saír" +Basic.Settings.General.Preview="Vista previa" +Basic.Settings.General.OverflowHidden="Agochar o desbordamento" +Basic.Settings.General.OverflowAlwaysVisible="Desbordamento sempre visíbel" +Basic.Settings.General.OverflowSelectionHidden="Amosar o desbordamento incluso cando a fonte sexa invisíbel" +Basic.Settings.General.SwitchOnDoubleClick="Transición á escena cando faga dobre clic" +Basic.Settings.General.StudioPortraitLayout="Activar a disposición de retrato/vertical" +Basic.Settings.General.TogglePreviewProgramLabels="Amosar as etiquetas de vista previa/programa" +Basic.Settings.General.Multiview="Vista múltiple" +Basic.Settings.General.Multiview.MouseSwitch="Prema para cambiar entre escenas" +Basic.Settings.General.Multiview.DrawSourceNames="Amosar o nome das esceas" +Basic.Settings.General.Multiview.DrawSafeAreas="Debuxar áreas seguras (EBU R 95)" +Basic.Settings.General.MultiviewLayout="Disposición de vista múltiple" +Basic.Settings.General.MultiviewLayout.Horizontal.Top="Horizontal, arriba (8 escenas)" +Basic.Settings.General.MultiviewLayout.Horizontal.Bottom="Horizontal, abaixo (8 escenas)" +Basic.Settings.General.MultiviewLayout.Vertical.Left="Vertical, esquerda (8 escenas)" +Basic.Settings.General.MultiviewLayout.Vertical.Right="Vertical, dereita (8 escenas)" +Basic.Settings.General.MultiviewLayout.Horizontal.Extended.Top="Horizontal, arriba (24 escenas)" + +Basic.Settings.Stream="Emisión" +Basic.Settings.Stream.StreamType="Tipo de emisión" +Basic.Settings.Stream.Custom.UseAuthentication="Usar a autenticación" +Basic.Settings.Stream.Custom.Username="Nome de usuario" +Basic.Settings.Stream.Custom.Password="Contrasinal" +Basic.Settings.Stream.BandwidthTestMode="Activar o modo de proba de largo de banda" Basic.Settings.Output="Saída" Basic.Settings.Output.Format="Formato de gravación" Basic.Settings.Output.Encoder="Codificador" -Basic.Settings.Output.SelectDirectory="Seleccionar directorio de gravación" -Basic.Settings.Output.SelectFile="Seleccionar ficheiro de gravación" +Basic.Settings.Output.SelectDirectory="Seleccionar o directorio de gravación" +Basic.Settings.Output.SelectFile="Seleccionar o ficheiro de gravación" +Basic.Settings.Output.EnforceBitrate="Aplicar os límites de taxa de bits do servizo de emisión" +Basic.Settings.Output.DynamicBitrate="Cambiar dinamicamente a taxa de bits para xestionar a conxestión" +Basic.Settings.Output.DynamicBitrate.Beta="Cambiar dinamicamente a taxa de bits para xestionar a conxestión (beta)" +Basic.Settings.Output.DynamicBitrate.TT="No canto de deixar perder cadros para reducir a conxestión, cambia dinamicamente a taxa de bits.\n\nTeña en conta que isto pode aumentar o atraso para os espectadores se hai unha conxestión súbita importante.\n\n Cando a taxa de bits cae, pode tardar uns minutos en restaurarse.\n\nActualmente só é compatible con RTMP." Basic.Settings.Output.Mode="Modo de saída" Basic.Settings.Output.Mode.Simple="Sinxelo" Basic.Settings.Output.Mode.Adv="Avanzado" Basic.Settings.Output.Mode.FFmpeg="Saída de FFmpeg" -Basic.Settings.Output.Simple.SavePath="Camiño da gravación" -Basic.Settings.Output.VideoBitrate="Velocidade de bits de vídeo" -Basic.Settings.Output.AudioBitrate="Velocidade de bits de audio" -Basic.Settings.Output.Reconnect="Reconectar automaticamente" -Basic.Settings.Output.RetryDelay="Retardo da nova tentativa (segundos)" +Basic.Settings.Output.UseReplayBuffer="Activar a reprodución da memoria temporal" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Tempo máximo de reprodución" +Basic.Settings.Output.ReplayBuffer.MegabytesMax="Memoria máxima (megabytes)" +Basic.Settings.Output.ReplayBuffer.Estimate="Uso estimado da memoria: %1 MB" +Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Non é posíbel estimar o uso de memoria. Estabeleza o límite máximo de memoria." +Basic.Settings.Output.ReplayBuffer.HotkeyMessage="(Nota: Asegúrese de establecer unha tecla rápida para a memoria temporal de reprodución na sección de teclas rápidas)" +Basic.Settings.Output.ReplayBuffer.Prefix="Prefixo do nome de ficheiro de reprodución da memoria temporal" +Basic.Settings.Output.ReplayBuffer.Suffix="Sufixo" +Basic.Settings.Output.Simple.SavePath="Ruta da gravación" +Basic.Settings.Output.Simple.RecordingQuality="Calidade da gravación" +Basic.Settings.Output.Simple.RecordingQuality.Stream="A mesma da emisión" +Basic.Settings.Output.Simple.RecordingQuality.Small="Alta calidade, tamaño medio do ficheiro" +Basic.Settings.Output.Simple.RecordingQuality.HQ="Calidade indistinguíbel, tamaño de ficheiro grande" +Basic.Settings.Output.Simple.RecordingQuality.Lossless="Calidade sen perda, tamaño inmenso de ficheiro" +Basic.Settings.Output.Simple.Warn.VideoBitrate="Aviso: A taxa de bits do vídeo en emisión estabelecerase en %1, que é o límite superior para o servizo de emisión actual. Se está seguro de que quere superar %1, active as opcións avanzadas do codificador e desmarque «Aplicar os límites de taxa de bits do servizo de emisión»." +Basic.Settings.Output.Simple.Warn.AudioBitrate="Aviso: A taxa de bits do son en emisión estabelecerase en %1, que é o límite superior para o servizo deemisión actual. Se está seguro de que quere superar %1, active as opcións avanzadas do codificador e desmarque «Aplicar os límites de taxa de bits do servizo de emisión»." +Basic.Settings.Output.Simple.Warn.CannotPause="Aviso: Non é posíbel deter as gravacións se a calidade da gravación está estabelecida como «A mesma da emisión»." +Basic.Settings.Output.Simple.Warn.Encoder="Aviso: a gravación cun codificador de software cunha calidade diferente á da emisión requirirá un uso de CPU adicional se se emite e grava ao mesmo tempo." +Basic.Settings.Output.Simple.Warn.Lossless="Aviso: A calidade sen perda xera tamaños de ficheiro inmensamente grandes. A calidade sen perdas pode empregar á alza de 7 xigabytes de espazo de disco por minuto a altas resolucións e taxa de cadros. Non se recomenda «sen perdas» para gravacións longas a menos que dispoña dunha cantidade moi grande de espazo no disco." +Basic.Settings.Output.Simple.Warn.Lossless.Msg="Confirma que quere empregar unha calidade sen perda?" +Basic.Settings.Output.Simple.Warn.Lossless.Title="Aviso de calidade sen perda!" +Basic.Settings.Output.Simple.Encoder.Software="Software (x264)" +Basic.Settings.Output.Simple.Encoder.Hardware.QSV="Hardware (QSV)" +Basic.Settings.Output.Simple.Encoder.Hardware.AMD="Hardware (AMD)" +Basic.Settings.Output.Simple.Encoder.Hardware.NVENC="Hardware (NVENC)" +Basic.Settings.Output.Simple.Encoder.SoftwareLowCPU="Software (x264 preaxustado o uso de CPU baixo, aumenta o tamaño do ficheiro)" +Basic.Settings.Output.VideoBitrate="Taxa de bits de vídeo" +Basic.Settings.Output.AudioBitrate="Taxa de bits de son" +Basic.Settings.Output.Reconnect="Volver conectar automaticamente" +Basic.Settings.Output.RetryDelay="Atraso dos novos intentos" Basic.Settings.Output.MaxRetries="Número máximo de tentativas" -Basic.Settings.Output.Advanced="Activar a configuración do codificador avanzada" -Basic.Settings.Output.CustomEncoderSettings="Axustes do codificador personalizados" - -Basic.Settings.Output.Adv.Rescale="Cambiar a escala de saída" -Basic.Settings.Output.Adv.AudioTrack="Pista de audio" -Basic.Settings.Output.Adv.Streaming="En tempo real" -Basic.Settings.Output.Adv.ApplyServiceSettings="Aplicar axustes de codificador de servizo en tempo real (streaming)" +Basic.Settings.Output.Advanced="Activar os axustes avanzados do codificador" +Basic.Settings.Output.EncoderPreset="Preaxuste do codificador" +Basic.Settings.Output.CustomEncoderSettings="Axustes personalizados do codificador" +Basic.Settings.Output.CustomMuxerSettings="Axustes personalizados do Muxer" +Basic.Settings.Output.NoSpaceFileName="Xerar o nome do ficheiro sen espazos" + +Basic.Settings.Output.Adv.Rescale="Cambiar a escala da saída" +Basic.Settings.Output.Adv.AudioTrack="Pista de son" +Basic.Settings.Output.Adv.Streaming="Emisión" +Basic.Settings.Output.Adv.ApplyServiceSettings="Aplicar os axustes de codificador do servizo de emisión" Basic.Settings.Output.Adv.Audio.Track1="Pista 1" Basic.Settings.Output.Adv.Audio.Track2="Pista 2" Basic.Settings.Output.Adv.Audio.Track3="Pista 3" Basic.Settings.Output.Adv.Audio.Track4="Pista 4" +Basic.Settings.Output.Adv.Audio.Track5="Pista 5" +Basic.Settings.Output.Adv.Audio.Track6="Pista 6" Basic.Settings.Output.Adv.Recording="Gravando" Basic.Settings.Output.Adv.Recording.Type="Tipo" Basic.Settings.Output.Adv.Recording.Type.Standard="Estándar" Basic.Settings.Output.Adv.Recording.Type.FFmpegOutput="Saída personalizada (FFmpeg)" -Basic.Settings.Output.Adv.Recording.UseStreamEncoder="(Utilizar fluxo do codificador)" +Basic.Settings.Output.Adv.Recording.UseStreamEncoder="(Empregar o codificador da emisión)" +Basic.Settings.Output.Adv.Recording.Filename="Formato do nome de ficheiro" +Basic.Settings.Output.Adv.Recording.OverwriteIfExists="Sobrescribir se existe o ficheiro" +Basic.Settings.Output.Adv.FFmpeg.Type="Tipo de saída FFmpeg" +Basic.Settings.Output.Adv.FFmpeg.Type.URL="Saída a URL" +Basic.Settings.Output.Adv.FFmpeg.Type.RecordToFile="Saída a ficheiro" Basic.Settings.Output.Adv.FFmpeg.SaveFilter.Common="Formatos comúns de gravación" Basic.Settings.Output.Adv.FFmpeg.SaveFilter.All="Todos os ficheiros" -Basic.Settings.Output.Adv.FFmpeg.SavePathURL="Camiño do ficheiro ou URL" +Basic.Settings.Output.Adv.FFmpeg.SavePathURL="Ruta ou URL do ficheiro" Basic.Settings.Output.Adv.FFmpeg.Format="Formato do contedor" -Basic.Settings.Output.Adv.FFmpeg.FormatAudio="Audio" +Basic.Settings.Output.Adv.FFmpeg.FormatAudio="Son" Basic.Settings.Output.Adv.FFmpeg.FormatVideo="Vídeo" -Basic.Settings.Output.Adv.FFmpeg.FormatDefault="Formato predefinido" +Basic.Settings.Output.Adv.FFmpeg.FormatDefault="Formato predeterminado" Basic.Settings.Output.Adv.FFmpeg.FormatDesc="Descrición do formato do contedor" -Basic.Settings.Output.Adv.FFmpeg.AVEncoderDefault="Codificador predefinido" -Basic.Settings.Output.Adv.FFmpeg.AVEncoderDisable="Desactivar codificador" +Basic.Settings.Output.Adv.FFmpeg.FormatDescDef="Códec de son/vídeo suposto a partires da ruta do ficheiro ou do URL" +Basic.Settings.Output.Adv.FFmpeg.AVEncoderDefault="Codificador predeterminado" +Basic.Settings.Output.Adv.FFmpeg.AVEncoderDisable="Desactivar o codificador" Basic.Settings.Output.Adv.FFmpeg.VEncoder="Codificador de vídeo" Basic.Settings.Output.Adv.FFmpeg.VEncoderSettings="Axustes do codificador de vídeo (se existe)" -Basic.Settings.Output.Adv.FFmpeg.AEncoder="Codificador de audio" -Basic.Settings.Output.Adv.FFmpeg.AEncoderSettings="Axustes do codificador de audio (se existe)" +Basic.Settings.Output.Adv.FFmpeg.AEncoder="Codificador de son" +Basic.Settings.Output.Adv.FFmpeg.AEncoderSettings="Axustes do codificador de son (se existe)" +Basic.Settings.Output.Adv.FFmpeg.MuxerSettings="Axustes do Muxer (se existe)" +Basic.Settings.Output.Adv.FFmpeg.GOPSize="Intervalo de fotogramas clave (en fotogramas)" +Basic.Settings.Output.Adv.FFmpeg.IgnoreCodecCompat="Amosar todos os códecs (aínda que poidan ser incompatíbeis)" +FilenameFormatting.completer="%DD-%MM-%CCYY %hh-%mm-%ss\n%DD-%MM-%YY %hh-%mm-%ss\n%d-%m-%Y %H-%M-%S\n%d-%m-%y %H-%M-%S\n%a %d-%m-%Y %H-%M-%S\n%A %d-%m-%Y %H-%M-%S\n%d-%b-%Y %H-%M-%S\n%d-%B-%Y %H-%M-%S\n%d-%m-%Y %I-%M-%S-%p\n%d-%m-%Y %H-%M-%S-%z\n%d-%m-%Y %H-%M-%S-%Z\n%CCYY-%MM-%DD %hh-%mm-%ss\n%YY-%MM-%DD %hh-%mm-%ss\n%Y-%m-%d %H-%M-%S\n%y-%m-%d %H-%M-%S\n%a %Y-%m-%d %H-%M-%S\n%A %Y-%m-%d %H-%M-%S\n%Y-%b-%d %H-%M-%S\n%Y-%B-%d %H-%M-%S\n%Y-%m-%d %I-%M-%S-%p\n%Y-%m-%d %H-%M-%S-%z\n%Y-%m-%d %H-%M-%S-%Z" +FilenameFormatting.TT="%CCYY Ano, catro díxitos\n%YY Ano, dous últimos díxitos (00-99)\n%MM Mes como número decimal (01-12)\n%DD Día do mes, recheo co cero (01-31)\n%hh Hora en formato 24h (00-23)\n%mm Minuto (00-59)\n%ss Segundo (00-61)\n%% Un signo %\n%a Nome abreviado do día da semana\n%A Nome completo do día da semana\n%b Nome abreviado do mes\n%B Nome completo do mes\n%d Día do mes, recheo co cero (01-31)\n%H Hora en formato 24h (00-23)\n%I Hora en formato 12h (01-12)\n%m Mes como número decimal (01-12)\n%M Minuto (00-59)\n%p Designación AM ou PM\n%S Segundo (00-61)\n%y Ano, dous últimos díxitos (00-99)\n%Y Ano\n%z Desviación ISO 8601 de UTC no fuso horario\n%Z Fuso horario ou abreviatura\n" Basic.Settings.Video="Vídeo" Basic.Settings.Video.Adapter="Adaptador de vídeo" +Basic.Settings.Video.BaseResolution="Resolución da base (lenzo)" +Basic.Settings.Video.ScaledResolution="Resolución de saída (escalada)" Basic.Settings.Video.DownscaleFilter="Filtro de redución" Basic.Settings.Video.DisableAeroWindows="Desactivar Aero (só Windows)" Basic.Settings.Video.FPS="FPS" Basic.Settings.Video.FPSCommon="Valores comúns de FPS" Basic.Settings.Video.FPSInteger="Valor enteiro de FPS" -Basic.Settings.Video.FPSFraction="Valor fraccional de FPS" +Basic.Settings.Video.FPSFraction="Valor fraccionario de FPS" Basic.Settings.Video.Numerator="Numerador" Basic.Settings.Video.Denominator="Denominador" -Basic.Settings.Video.Renderer="Procesador" +Basic.Settings.Video.Renderer="Xerador" Basic.Settings.Video.InvalidResolution="Valor da resolución non válido. Debe ser [width] x [height] (por exemplo, 1920 x 1080)" -Basic.Settings.Video.CurrentlyActive="A saída de vídeo está actualmente activa. Por favor, apaga calquera saída para cambiar a configuración de vídeo." +Basic.Settings.Video.CurrentlyActive="A saída de vídeo está activa neste momento. Apaga calquera saída para cambiar a configuración de vídeo." +Basic.Settings.Video.DisableAero="Desactivar Aero" -Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (máis rápido, pero borroso de se escalar a imaxe)" -Basic.Settings.Video.DownscaleFilter.Bicubic="Bicúbico (escalamento fino, 16 mostras)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (escalamento fino, 32 mostras)" +Basic.Settings.Video.DownscaleFilter.Bilinear="Bilineal (máis rápido, mais borroso ao se escalar a imaxe)" +Basic.Settings.Video.DownscaleFilter.Bicubic="Bicúbico (escalado fino, 16 mostraxes)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (escalado fino, 36 mostraxes)" +Basic.Settings.Video.DownscaleFilter.Area="Superficie (suma ponderada, 4/6/9 mostraxes)" -Basic.Settings.Audio="Audio" -Basic.Settings.Audio.SampleRate="Intervalo da mostra" +Basic.Settings.Audio="Son" +Basic.Settings.Audio.SampleRate="Frecuencia da mostraxe" Basic.Settings.Audio.Channels="Canles" +Basic.Settings.Audio.Meters="Medidores" +Basic.Settings.Audio.MeterDecayRate="Taxa de decaemento" +Basic.Settings.Audio.MeterDecayRate.Fast="Rápido" +Basic.Settings.Audio.MeterDecayRate.Medium="Medio (tipo I PPM)" +Basic.Settings.Audio.MeterDecayRate.Slow="Lento (tipo II PPM)" +Basic.Settings.Audio.PeakMeterType="Tipo de medidor de pico" +Basic.Settings.Audio.PeakMeterType.SamplePeak="Pico da mostraxe" +Basic.Settings.Audio.PeakMeterType.TruePeak="Pico verdadeiro (maior uso de CPU)" +Basic.Settings.Audio.MultiChannelWarning.Enabled="AVISO: O son envolvente está activado." +Basic.Settings.Audio.MultichannelWarning="Se se emite, comprobe se o servizo de emisión admite a inxección e a reprodución de son envolvente. Facebook 360 Live, Mixer RTMP, Smashcast son exemplos onde o son envolvente é totalmente compatíbel. Aínda que Facebook Live e YouTube Live aceptan a inxección de son envolvente, Facebook Live remestura a estéreo e YouTube Live reproduce só dúas canles.\n\nOs filtros de son do OBS son compatíbeis co son envolvente, aínda que non está garantida a compatibilidade co engadido VST." +Basic.Settings.Audio.MultichannelWarning.Title="Activar o son envolvente?" +Basic.Settings.Audio.MultichannelWarning.Confirm="Confirma que quere activar o son envolvente?" +Basic.Settings.Audio.Devices="Dispositivos" +Basic.Settings.Audio.DesktopDevice="Son do escritorio" +Basic.Settings.Audio.DesktopDevice2="Son do escritorio 2" +Basic.Settings.Audio.AuxDevice="Son micro/auxiliar" +Basic.Settings.Audio.AuxDevice2="Son micro/auxiliar 2" +Basic.Settings.Audio.AuxDevice3="Son micro/auxiliar 3" +Basic.Settings.Audio.AuxDevice4="Son micro/auxiliar 4" +Basic.Settings.Audio.EnablePushToMute="Activar Premer para silenciar" +Basic.Settings.Audio.PushToMuteDelay="Atraso de Premer para falar" +Basic.Settings.Audio.EnablePushToTalk="Activar Premer para falar" +Basic.Settings.Audio.PushToTalkDelay="Atraso de Premer para falar" +Basic.Settings.Audio.UnknownAudioDevice="[Dispositivo sen conectar ou non dispoñíbel]" +Basic.Settings.Audio.Disabled="Desactivado" Basic.Settings.Advanced="Avanzado" -Basic.Settings.Advanced.Audio.BufferingTime="Tempo do búfer de audio" +Basic.Settings.Advanced.General.ProcessPriority="Prioridade do proceso" +Basic.Settings.Advanced.General.ProcessPriority.High="Alta" +Basic.Settings.Advanced.General.ProcessPriority.AboveNormal="Por riba do normal" +Basic.Settings.Advanced.General.ProcessPriority.Normal="Normal" +Basic.Settings.Advanced.General.ProcessPriority.BelowNormal="Por baixo do normal" +Basic.Settings.Advanced.General.ProcessPriority.Idle="Inactivo" +Basic.Settings.Advanced.FormatWarning="Aviso: Os formatos de cor distintos de NV12 están destinados principalmente á gravación e non se recomendan durante unha emisión. A emisión pode sufrir un maior uso da CPU debido á conversión do formato da cor." +Basic.Settings.Advanced.Audio.BufferingTime="Tempo da memoria temporal de son" Basic.Settings.Advanced.Video.ColorFormat="Formato da cor" +Basic.Settings.Advanced.Video.ColorSpace="Espazo de cor" +Basic.Settings.Advanced.Video.ColorRange="Gama de cores" Basic.Settings.Advanced.Video.ColorRange.Partial="Parcial" -Basic.Settings.Advanced.Video.ColorRange.Full="Completo" - -Basic.AdvAudio="Propiedades de audio avanzadas" +Basic.Settings.Advanced.Video.ColorRange.Full="Total" +Basic.Settings.Advanced.Audio.MonitoringDevice="Dispositivo de monitorización" +Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Predeterminado" +Basic.Settings.Advanced.Audio.DisableAudioDucking="Desactivar a atenuación de son en Windows" +Basic.Settings.Advanced.StreamDelay="Atraso da emisión" +Basic.Settings.Advanced.StreamDelay.Duration="Duración" +Basic.Settings.Advanced.StreamDelay.Preserve="Preservar o punto de corte (aumento do atraso) ao volver conectar" +Basic.Settings.Advanced.StreamDelay.MemoryUsage="Uso estimado da memoria: %1 MB" +Basic.Settings.Advanced.Network="Rede" +Basic.Settings.Advanced.Network.BindToIP="Ligar co IP" +Basic.Settings.Advanced.Network.EnableNewSocketLoop="Activar o novo código de rede" +Basic.Settings.Advanced.Network.EnableLowLatencyMode="Modo de baixa latencia" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Comportamento das teclas rápidas en foco" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Non desactivar nunca as teclas rápidas" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Desactivar as teclas rápidas cando a xanela principal estea en foco" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Desactivar as teclas rápidas cando a xanela principal non estea en foco" +Basic.Settings.Advanced.AutoRemux="Converter automaticamente a mp4" +Basic.Settings.Advanced.AutoRemux.MP4="(gravar como mkv)" + +Basic.AdvAudio="Propiedades de son avanzadas" Basic.AdvAudio.Name="Nome" -Basic.AdvAudio.Mono="Remesturar a mono" -Basic.AdvAudio.SyncOffset="Sincronización Offset (ms)" +Basic.AdvAudio.Volume="Volume" +Basic.AdvAudio.Mono="Mono" +Basic.AdvAudio.Balance="Balance" +Basic.AdvAudio.SyncOffset="Desprazamento da sincronización" +Basic.AdvAudio.Monitoring="Monitorización do son" +Basic.AdvAudio.Monitoring.None="Monitor apagado" +Basic.AdvAudio.Monitoring.MonitorOnly="Só o monitor (silenciar a saída)" +Basic.AdvAudio.Monitoring.Both="Monitor e saída" Basic.AdvAudio.AudioTracks="Pistas" +Basic.Settings.Hotkeys="Teclas rápidas" +Basic.Settings.Hotkeys.Pair="As combinacións de teclas compartidas con «%1» actúan como conmutadores" +Basic.Settings.Hotkeys.Filter="Filtro" +Basic.Hotkeys.SelectScene="Cambiar á escena" +Basic.SystemTray.Show="Amosar" +Basic.SystemTray.Hide="Agochar" +Basic.SystemTray.Message.Reconnecting="Sen conexión, reconectando..." Hotkeys.Insert="Inserir" Hotkeys.Delete="Eliminar" Hotkeys.Home="Inicio" -Hotkeys.NumLock="BLOQ NÚM" -Hotkeys.ScrollLock="BLOQ DESPR" -Hotkeys.CapsLock="BLOQ MAIÚS" +Hotkeys.End="Fin" +Hotkeys.PageUp="Re Páx" +Hotkeys.PageDown="Av Páx" +Hotkeys.NumLock="Block Num" +Hotkeys.ScrollLock="Bloq Despr" +Hotkeys.CapsLock="Bloq Maiús" Hotkeys.Backspace="Retroceso" -Hotkeys.Tab="Tabulación" +Hotkeys.Tab="Tab" Hotkeys.Print="Imprimir" +Hotkeys.Pause="Pausa" +Hotkeys.Left="Esquerda" +Hotkeys.Right="Dereita" +Hotkeys.Up="Arriba" +Hotkeys.Down="Abaixo" Hotkeys.Windows="Windows" +Hotkeys.Super="Súper" Hotkeys.Menu="Menú" Hotkeys.Space="Espazo" Hotkeys.NumpadNum="Teclado numérico %1" @@ -390,20 +834,45 @@ Hotkeys.AppleKeypadDecimal=". (teclado numérico)" Hotkeys.AppleKeypadEqual="= (teclado numérico)" Hotkeys.MouseButton="Rato %1" +Hotkeys.Escape="Esc" Mute="Silenciar" Unmute="Activar son" +Push-to-mute="Premer para silenciar" +Push-to-talk="Premer para falar" -SceneItemShow="Mostrar '%1'" -SceneItemHide="Agochar '%1'" +SceneItemShow="Amosar «%1»" +SceneItemHide="Agochar «%1»" -OutputWarnings.NoTracksSelected="Debes seleccionar, cando menos, unha pista" +OutputWarnings.NoTracksSelected="Debe seleccionar, cando menos, unha pista" OutputWarnings.MultiTrackRecording="Aviso: certos formatos (caso de FLV) non admiten múltiples pistas para gravar" +OutputWarnings.MP4Recording="Aviso: as gravacións gardadas en MP4/MOV non serán recuperábeis se non se pode rematar o ficheiro (por exemplo, como resultado de BSOD, perdas de enerxía, etc.). Se quere gravar varias pistas de son, considere empregar MKV e converter a gravación a MP4/MOV unha vez rematada (Ficheiro → Gravacións de conversións)" +OutputWarnings.CannotPause="Aviso: Non é posíbel deter as gravacións se está estabelecido o codificador da gravación «(Utilizar o codificador da emisión)»" +FinalScene.Title="Eliminar escena" +FinalScene.Text="Debe haber polo menos unha escena." +NoSources.Title="Non hai fontes" +NoSources.Text="Parece que aínda non engadiu ningunha fonte de vídeo, polo que a saída será unha pantalla en branco. É iso o que quere facer?" +NoSources.Text.AddSource="Pode engadir fontes premendo na icona + baixo a caixa Fontes na xanela principal en calquera momento." +NoSources.Label="Non ten ningunha fonte.\nPrema no botón + de embaixo,\nou prema co botón dereito do rato para engadir unha." +ChangeBG="Establecer a cor" +CustomColor="Cor personalizada" +BrowserSource.EnableHardwareAcceleration="Activar a aceleración do hardware de fontes no navegador" +About="Sobre" +About.Info="OBS Studio é un software libre para gravación e emisión ao vivo." +About.Donate="Fai a túa achega" +About.GetInvolved="Colabora" +About.Authors="Autoría" +About.License="Licenza" +About.Contribute="Apoia o Proxecto OBS" +ResizeOutputSizeOfSource="Axustar o tamaño da saída (tamaño da fonte)" +ResizeOutputSizeOfSource.Text="As resolucións de base e saída redimensionaranse ao tamaño da fonte actual." +ResizeOutputSizeOfSource.Continue="Quere continuar?" +PreviewTransition="Vista previa da transición"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/he-IL.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/he-IL.ini
Changed
@@ -23,7 +23,7 @@ Display="תצוגה" Name="שם" Exit="יציאה" -Mixer="מיקסר" +Mixer="מערבל שמע" Browse="עיון" Mono="מונו" Stereo="סטריאו" @@ -78,22 +78,46 @@ StudioMode.Preview="תצוגה מקדימה" StudioMode.Program="תוכנה" ShowInMultiview="הראה בתצוגה מרובה" +VerticalLayout="פריסה אנכית" Group="קבוצה" +DoNotShowAgain="אל תציג שוב" +Default="(ברירת מחדל)" +Calculating="מחשב..." AlreadyRunning.Title="OBS פועל כבר" AlreadyRunning.Text="OBS פועל כבר! אלא אם התכוונת לעשות את זה, אנא סגור כל מופע קיים לפני נסיון להפעיל מופע חדש. אנא בדוק אם קיים מופע הגדר ממוזער במגש המערכת." AlreadyRunning.LaunchAnyway="הפעל בכל מקרה" +DockCloseWarning.Title="סגירת חלון ניתן להצמדה" +DockCloseWarning.Text="סגרת עכשיו חלון הניתן להצמדה. אם ברצונך להציג אותו שוב, השתמש בתפריט תצוגה -> הצמדות בשורת התפריט." +ExtraBrowsers="חלונות הצמדה מותאמים אישית של דפדפן" +ExtraBrowsers.Info="הוסף חלונות הצמדה על ידי שם ו-URL, ואז לחץ אישור או סגור כדי לפתוח את חלונות ההצמדה. תוכל להוסיף או להסיר חלונות הצמדה בכל זמן." +ExtraBrowsers.DockName="שם חלון ההצמדה" + +Auth.Authing.Title="מאמת..." +Auth.Authing.Text="מאמת עם %1, אנא המתן..." Auth.AuthFailure.Title="האימות נכשל" +Auth.AuthFailure.Text="נכשל באימות עם %1:\n\n%2: %3" Auth.InvalidScope.Title="דרושה הזדהות" +Auth.InvalidScope.Text="דרישות האימות עבור %1 השתנו. חלק מהתכונות לא יהיו זמינות." +Auth.LoadingChannel.Title="טוען מידע על הערוץ..." +Auth.LoadingChannel.Text="טוען מידע על הערוץ עבור %1, אנא המתן..." Auth.ChannelFailure.Title="נכשל בטעינת הערוצים" +Auth.ChannelFailure.Text="נכשל בטעינת המידע עבור %1\n\n%2: %3" Auth.Chat="צ'אט" Auth.StreamInfo="מידע על הזרם" +TwitchAuth.Stats="סטטיסטיקות Twitch" +TwitchAuth.Feed="אירועי Twitch אחרונים" +TwitchAuth.TwoFactorFail.Title="לא ניתן לשלוף מפתח שידור" +TwitchAuth.TwoFactorFail.Text="OBS לא הצליחה להתחבר לחשבון ה-Twitch שלך. אנא ודא/י כי אימות דו-שלבי מוגדר ב-<a href='https://www.twitch.tv/settings/security'>הגדרות האבטחה שלך ב-Twitch</a> מכיוון וזוהי דרישה לשידור." +RestreamAuth.Channels="ערוצי Restream" Copy.Filters="העתק מסננים" Paste.Filters="הדבק מסננים" +BrowserPanelInit.Title="מאתחל דפדפן..." +BrowserPanelInit.Text="מאתחל דפדפן, אנא המתן..." BandwidthTest.Region="אזור" BandwidthTest.Region.US="ארצות הברית" @@ -120,13 +144,14 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="הערה: רזוליית הבד (בסיס) הוא לא בהכרח זהה לרזולוצי ההזרמה או הקלטה. ייתכן שרזולוציית הזרמה/הקלטה תוקטן בכדי להפחית את דרישות קצב הנתונים או המשאבים." Basic.AutoConfig.StreamPage="מידע על הזרם" Basic.AutoConfig.StreamPage.SubTitle="אנא הזן את פרטי הזרם" -Basic.AutoConfig.StreamPage.ConnectAccount="התחבר לחשבון (אופציונלי)" +Basic.AutoConfig.StreamPage.ConnectAccount="התחבר לחשבון (מומלץ)" Basic.AutoConfig.StreamPage.DisconnectAccount="נתק את חשבון" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="נתק את חשבון?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="שינוי זה יחול באופן מיידי. האם אתה בטוח שברצונך לנתק את החשבון שלך?" Basic.AutoConfig.StreamPage.UseStreamKey="השתמש במפתח הזרמת נתונים" Basic.AutoConfig.StreamPage.Service="שירות" Basic.AutoConfig.StreamPage.Service.ShowAll="הצג הכל..." +Basic.AutoConfig.StreamPage.Service.Custom="מותאם אישית..." Basic.AutoConfig.StreamPage.Server="שרת" Basic.AutoConfig.StreamPage.StreamKey="מפתח הזרמת נתונים" Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(קישור)" @@ -154,6 +179,7 @@ Basic.Stats="סטטיסטיקות" Basic.Stats.CPUUsage="שימוש במעבד" +Basic.Stats.HDDSpaceAvailable="שטח דיסק פנוי" Basic.Stats.MemoryUsage="שימוש בזיכרון" Basic.Stats.AverageTimeToRender="הזמן הממוצע לעיבוד מסגרת" Basic.Stats.SkippedFrames="המערכת דילגה על מסגרות עקב השהית קידוד" @@ -168,7 +194,10 @@ Basic.Stats.DroppedFrames="השמטת מסגרות (רשת)" Basic.Stats.MegabytesSent="פלט נתונים כולל" Basic.Stats.Bitrate="קצב נתונים" +Basic.Stats.DiskFullIn="דיסק מלא בעוד (לערך)" +ResetUIWarning.Title="האם את/ה בטוח/ה שברצונך לאפס את התצוגה?" +ResetUIWarning.Text="איפוס התצוגה יחביא חלונות הצמדה נוספים. תוכל לחשוף את חלונות ההצמדה מתפריט התצוגה אם ברצונך להציג אותם.\n\nהאם את/ה בטוח/ה שברצונך לאפס את התצוגה?" Updater.Title="עידכון חדש זמין" Updater.Text="יש עדכון חדש זמין:" @@ -181,6 +210,7 @@ Updater.NoUpdatesAvailable.Text="אין עדכונים זמינים כעת" Updater.FailedToLaunch="נכשלה הפעלת העידכון" Updater.GameCaptureActive.Title="לכידת משחק פעיל" +Updater.GameCaptureActive.Text="ספריית לכידת משחק נמצאת בשימוש כרגע. יש לסגור משחקים/תוכנות בלכידה (או לבצע הפעלה מחדש ל-Windows) ולנסות שוב." QuickTransitions.SwapScenes="החלף סצינות תצוגה מקדימה/פלט לאחר המעבר" QuickTransitions.SwapScenesTT="החלף הסצינות של התצוגה המקדימה ושל הפלט לאחר המעבר (באם הסצינה המקורית של הפלט עדיין קיימת). \n פעולה זו לא תבטל כל שינוי שייתכן ובוצע לסצינה המקורית של הפלט." @@ -215,6 +245,11 @@ ConfirmStop.Title="עצור את הזרמת הנתונים?" ConfirmStop.Text="האם אתה בטוח שברצונך להפסיק את הזרמת הנתונים?" +ConfirmStopRecord.Title="עצור הקלטה?" +ConfirmStopRecord.Text="האם את/ה בטוח/ה שברצונך לעצור את ההקלטה?" + +ConfirmBWTest.Title="האם ברצונך להתחיל בדיקת רוחב פס?" +ConfirmBWTest.Text="הגדרת את OBS למצב בדיקת רוחב פס. מצב זה מאפשר בדיקת רשת בלי שהערוץ שלך ישדר. כאשר תסיים את הבדיקה, עליך לבטל מצב זה על מנת שצופיך יוכלו לצפות בשידור.\n\nהאם ברצונך להמשיך?" ConfirmExit.Title="יציאה מ-OBS?" ConfirmExit.Text="תוכנת OBS פעילה כעת. כל הזרמת נתונים/הקלטות ייסגרו. האם אתה בטוח שאתה רוצה לצאת?" @@ -228,6 +263,8 @@ Output.StartReplayFailed="נכשלה הפעלת מאגר החוזר" Output.StartFailedGeneric="הפלט נכשל. בבקשה בדוק את הרישומים עבור. \n\nNote: אם אתה משתמש בNVNEC או AMD מקודדים, הקפד שמנהלי ההתקן של הכרטיס מסך מעודכנים." +Output.ReplayBuffer.PauseWarning.Title="לא ניתן לשמור הילוכים חוזרים בזמן השהיה" +Output.ReplayBuffer.PauseWarning.Text="אזהרה: הילוכים חוזרים לא ניתנים לשמירה כאשר ההקלטה מושהית." Output.ConnectFail.Title="ההתחברות נכשלה" Output.ConnectFail.BadPath="URL לא חוקי של נתיב או חיבור. נא בדוק את ההגדרות שלך כדי לוודא כי הם נכונים." @@ -236,6 +273,8 @@ Output.ConnectFail.Error="אירעה שגיאה בלתי צפויה בעת ניסיון להתחבר לשרת. מידע נוסף בקובץ יומן הרישום." Output.ConnectFail.Disconnected="התנתקת מהשרת." +Output.StreamEncodeError.Title="שגיאת קידוד" +Output.StreamEncodeError.Msg="התרחשה שגיאת מקודד בזמן שידור." Output.RecordFail.Title="התחלת ההקלטה נכשלה" Output.RecordFail.Unsupported="תבנית הפלט לא נתמכת או לא תומכת ביותר מרצועת שמע אחת. נא בדוק את ההגדרות ונסה שוב." @@ -243,6 +282,7 @@ Output.RecordNoSpace.Msg="אין די שטח דיסק כדי להמשיך הקלטה." Output.RecordError.Title="שגיאה הקלטה" Output.RecordError.Msg="אירעה שגיאה לא מוגדרת בזמן ההקלטה." +Output.RecordError.EncodeErrorMsg="התרחשה שגיאת מקודד בזמן הקלטה." Output.ReplayBuffer.NoHotkey.Title="אין מקש קיצור שנבחר!" Output.ReplayBuffer.NoHotkey.Msg="אין hotkey שמור למאגר החוזר. בבקשה הגדר את \"שמור\" hotkey לשימוש עבור שמירת מאגר חוזר להקלטות." @@ -256,12 +296,20 @@ Remux.SourceFile="הקלטת OBS" Remux.TargetFile="קובץ היעד" Remux.Remux="המרה" +Remux.Stop="עצור המרה" +Remux.ClearFinished="רוקן פריטים שהסתיימו" +Remux.ClearAll="רוקן את כל הפריטים" Remux.OBSRecording="הקלטת OBS" Remux.FinishedTitle="המרה הסתיימה" Remux.Finished="הקלטה הומרה" Remux.FinishedError="הקלטה הומרה, אבל הקובץ עשוי להיות לא שלם" +Remux.SelectRecording="בחר הקלטת OBS..." +Remux.SelectTarget="בחר קובץ יעד..." +Remux.FileExistsTitle="קבצי יעד קיימים כבר" +Remux.FileExists="קבצי היעד שלהלן כבר קיימים. האם ברצונך להחליפם?" Remux.ExitUnfinishedTitle="המרה בתהליך" Remux.ExitUnfinished="ההמרה לא הסתיימה, עצירה עכשיו עלולה להפוך את קובץ היעד לא שמיש. \n אתה בטוח שאתה רוצה לעצור את ההמרה?" +Remux.HelpText="גרור קבצים להמרה לחלון זה, או בחר בתא \"הקלטת OBS\" בכדי לבחור קובץ ידנית." UpdateAvailable="עידכון חדש זמין" UpdateAvailable.Text="גירסה %1.%2.%3 זמין כעת. <a href='%4'> לחץ כאן כדי להוריד</a>" @@ -278,12 +326,14 @@ Basic.Main.PreviewConextMenu.Enable="אפשר תצוגה מקדימה" +Basic.Main.Preview.Disable="בטל תצוגה מקדימה" ScaleFiltering="מסנן קנה מידה" ScaleFiltering.Point="נקודה" ScaleFiltering.Bilinear="ביליניארי" ScaleFiltering.Bicubic="ביקיוביק" ScaleFiltering.Lanczos="לנזוס" +ScaleFiltering.Area="אזור" Deinterlacing="ביטול שזירה" Deinterlacing.Discard="אל תשמור" @@ -535,7 +585,6 @@ Basic.Settings.Output.Mode.Adv="מתקדם" Basic.Settings.Output.Mode.FFmpeg="פלט FFmpeg" Basic.Settings.Output.UseReplayBuffer="הפעלת מאגר החוזר" -Basic.Settings.Output.ReplayBuffer.SecondsMax="זמן החוזר המרבי (בשניות)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="זיכרון מרבי (מגה-בתים)" Basic.Settings.Output.ReplayBuffer.Estimate="הערך שימוש בזיכרון: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="אין אפשרות להעריך את השימוש בזיכרון. נא הגדר מגבלת זיכרון מירבי." @@ -562,7 +611,6 @@ Basic.Settings.Output.VideoBitrate="קצב סיביות וידאו" Basic.Settings.Output.AudioBitrate="קצב סיביות שמע" Basic.Settings.Output.Reconnect="חיבור מחדש באופן אוטומטי" -Basic.Settings.Output.RetryDelay="נסה שנית השהייה (שניות)" Basic.Settings.Output.MaxRetries="מרב נסינות" Basic.Settings.Output.Advanced="אפשר הגדרות מקודד מתקדמות" Basic.Settings.Output.CustomEncoderSettings="הגדרות מקודד מותאמות אישית" @@ -632,7 +680,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="דו-ליניארי (מהיר ביותר, מטושטש בשינוי קנה מידה)" Basic.Settings.Video.DownscaleFilter.Bicubic="ממוצע משוקלל (חד בשינוי קנה המידה, 16 דגימות)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (חד בשינוי קנה המידה, 32 דגימות)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (חד בשינוי קנה המידה, 36 דגימות)" Basic.Settings.Audio="אודיו" Basic.Settings.Audio.SampleRate="קצב דגימה" @@ -641,7 +689,6 @@ Basic.Settings.Audio.MeterDecayRate.Medium="בינוני (סוג I PPM)" Basic.Settings.Audio.MeterDecayRate.Slow="איטי (סוג II PPM)" Basic.Settings.Audio.MultiChannelWarning.Enabled="אזהרה: שמע צליל היקפי מאופשר." -Basic.Settings.Audio.MultichannelWarning="אם הזרימה, בדוק את הזרמת השירות תומך בסראונד סאונד להבלע ואת היקפי הסראונד פלייבק. טוויץ',פייסבוק,360 Liev, מיקסר RTMP, Smashcast דוגמאות לאיפה שסראונד סאונד הוא נתמך. למרות פייסבוק לייב ויוטיוב לייב שניהם מאפשרים סראונד להבלע, פייסבוק לייב משנה לסטריאו ויוטיוב לייב מפעיל בשני ערוצים. \n\nOBS Studio מסנן עם הסראונד סאונד, למרות תמיכת תוסף VST אינו מאובטח." Basic.Settings.Audio.MultichannelWarning.Title="האם להפעיל שמע צליל היקפי?" Basic.Settings.Audio.MultichannelWarning.Confirm="אתה בטוח שאתה רוצה לאפשר קול שמע מקיף?" Basic.Settings.Audio.EnablePushToMute="אפשר לחץ-להשתקה" @@ -665,7 +712,7 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="ברירת מחדל" Basic.Settings.Advanced.Audio.DisableAudioDucking="בטל צימוד השמע של Windows" Basic.Settings.Advanced.StreamDelay="השהיית זרם נתונים" -Basic.Settings.Advanced.StreamDelay.Duration="משך זמן (בשניות)" +Basic.Settings.Advanced.StreamDelay.Duration="משך זמן" Basic.Settings.Advanced.StreamDelay.Preserve="שמר נקודת חיתוך (השהייה מוגדלת) בעת חיבור מחדש" Basic.Settings.Advanced.StreamDelay.MemoryUsage="שימוש זיכרון משוער: %1 MB" Basic.Settings.Advanced.Network="רשת" @@ -675,9 +722,7 @@ Basic.AdvAudio="מאפייני קול מתקדמים" Basic.AdvAudio.Name="שם" -Basic.AdvAudio.Mono="הפוך למונו" Basic.AdvAudio.Balance="איזון" -Basic.AdvAudio.SyncOffset="היסט סינכרון (מילישניות)" Basic.AdvAudio.Monitoring="ניטור אודיו" Basic.AdvAudio.Monitoring.None="בטל ניתור" Basic.AdvAudio.Monitoring.MonitorOnly="ניתור בלבד (השתק פלט)"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/hi-IN.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/hi-IN.ini
Changed
@@ -8,45 +8,102 @@ Close="बंद करें" Save="सहेजें" Discard="छोड़ें" +Disable="अक्षम" Yes="हां" No="नहीं" Add="जोड़ें" Remove="निकालें" Rename="नाम बदलें" Interact="बातचीत" +Filters="फिल्टर" +Properties="विशेषताएं" MoveUp="ऊपर ले जाएँ" MoveDown="नीचे ले जाएँ" Settings="सेटिंग्स" Display="प्रदर्शन" Name="नाम" Exit="निकास" +Mixer="मिक्सर" +Browse="ब्राउज करें" +Mono="मोनो" +Stereo="स्टीरियो" +DroppedFrames="हटाए गए फ़्रेम %1 (%2%)" +StudioProgramProjector="फुलस्क्रीन प्रोजेक्टर (कार्यक्रम)" +PreviewProjector="फुलस्क्रीन प्रोजेक्टर (प्राभ्यास)" +SceneProjector="फुलस्क्रीन प्रोजेक्टर (दृश्य)" +SourceProjector="फुलस्क्रीन प्रोजेक्टर (स्रोत)" +StudioProgramWindow="विंडो प्रोजेक्टर (कार्यक्रम)" +PreviewWindow="विंडो प्रोजेक्टर (प्राभ्यास)" +SceneWindow="विंडो प्रोजेक्टर (दृश्य)" +SourceWindow="विंडो प्रोजेक्टर (स्रोत)" +MultiviewProjector="मल्टीव्यू (फुलस्क्रीन)" +MultiviewWindowed="मल्टीव्यू (विंडो)" Clear="साफ़ करें" Revert="पहले जैसा करें" Show="दिखाएँ" Hide="छुपायें" UnhideAll="कुछ ना छिपाएं" +Untitled="अनामांकित" New="नया" Duplicate="दोहरा" +Enable="सक्षम करें" +DisableOSXVSync="OSX V-Sync अक्षम करें" +Transition="संक्रमण" +QuickTransitions="त्वरित संक्रमण" Left="बाएं" Right="दाएँ" Top="शीर्ष" Bottom="नीचे" +Reset="रीसेट" Hours="घंटे" Minutes="मिनट" Seconds="सेकंड" +Deprecated="पदावनत" +ReplayBuffer="फिर से बफर चलाएं" +Import="आयात" +Export="निर्यात करें" Copy="प्रतिलिपि" Paste="चिपकाएँ" Next="अगले" Back="वापस" +VerticalLayout="लंबरूप लेआउट" +Group="एकत्रित करना" +DoNotShowAgain="फिर से मत दिखाना" +Default="(डिफ़ॉल्ट)" +Calculating="गणना जारी है" +AlreadyRunning.Title="OBS चल रहा है" +AlreadyRunning.Text="OBS पहले से ही चल रहा है! अगर आप ऐसा नहीं करना चाहते हैं, कृपया एक नया उदाहरण चलाने की कोशिश करने से पहले OBS के किसी भी मौजूदा उदाहरण को बंद कर दें। यदि आपके पास सिस्टम ट्रे को कम करने के लिए OBS सेट है, तो कृपया जांचें कि क्या यह अभी भी वहां चल रहा है।" +AlreadyRunning.LaunchAnyway="फिर भी लॉन्च करें" + +BandwidthTest.Region="क्षेत्र" +BandwidthTest.Region.US="संयुक्त राज्य अमेरिका" +BandwidthTest.Region.EU="यूरोप" BandwidthTest.Region.Asia="एशिया" +BandwidthTest.Region.Other="अन्य" + +Basic.FirstStartup.RunWizard.NoClicked="यदि आप अपनी पसंद बदलते हैं, तो आप किसी भी समय टूल मेनू से ऑटो-कॉन्फ़िगरेशन विज़ार्ड चला सकते हैं।" +Basic.AutoConfig="ऑटो-कॉन्फ़िगरेशन विज़ार्ड" +Basic.AutoConfig.ApplySettings="सेटिंग लागू करें" +Basic.AutoConfig.StartPage="उपयोग की जानकारी" +Basic.AutoConfig.StartPage.SubTitle="किस प्रोग्राम के लिए उपयोग करना चाहते हैं निर्दिष्ट करें" +Basic.AutoConfig.StartPage.PrioritizeStreaming="स्ट्रीमिंग के लिए ऑप्टिमाइज़ करना, रिकॉर्डिंग अप्रधान है" +Basic.AutoConfig.StartPage.PrioritizeRecording="केवल रिकॉर्डिंग के लिए ऑप्टिमाइज़ करें, मैं स्ट्रीमिंग नहीं करूंगा" +Basic.AutoConfig.StreamPage.Service="सेवा" +Basic.AutoConfig.StreamPage.Service.ShowAll="सब दिखाओ" +Basic.AutoConfig.StreamPage.Service.Custom="अनुकूलित करें" +Basic.AutoConfig.StreamPage.Server="सर्वर" +Basic.AutoConfig.StreamPage.StreamKey="स्ट्रीमिंग चाबी" +Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(लिंक)" +Basic.Stats.CPUUsage="सि पि यु का उपयोग" +Basic.Stats.HDDSpaceAvailable="डिस्क में जगह उपलब्ध है" @@ -97,9 +154,13 @@ +Basic.Main.PauseRecording="रिकॉर्डिंग रोकें" +Basic.MainMenu.View="दृश्य" +Basic.MainMenu.View.Toolbars="टूलबार" +Basic.MainMenu.View.Docks="डॉक"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/hr-HR.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/hr-HR.ini
Changed
@@ -23,7 +23,6 @@ Display="Zaslon" Name="Ime" Exit="Izlaz" -Mixer="Mikseta" Browse="Pretraži" Mono="Mono" Stereo="Stereo" @@ -84,6 +83,7 @@ AlreadyRunning.LaunchAnyway="Svejedno pokreni" + Auth.Authing.Title="Autentikacija..." Auth.Authing.Text="Autentikacija na %1, molimo pričekajte..." Auth.AuthFailure.Title="Greška kod autentikacije" @@ -175,6 +175,7 @@ ConfirmStop.Text="Jeste li sigurni da želite zaustaviti stream?" + ConfirmExit.Title="Napustiti OBS?" ConfirmExit.Text="OBS je trenutačno aktivan. Svi streamovi/snimanja bit će ugašeni. Jeste li sigurni da želite izaći?" @@ -486,7 +487,6 @@ Basic.Settings.Output.VideoBitrate="Protok videa" Basic.Settings.Output.AudioBitrate="Protok zvuka" Basic.Settings.Output.Reconnect="Automatski poveži ponovo" -Basic.Settings.Output.RetryDelay="Pauza pre ponovnog pokušaja (sekunde)" Basic.Settings.Output.MaxRetries="Maksimalan broj ponovnih pokušaja" Basic.Settings.Output.Advanced="Omogući napredna podešavanja kompresora" Basic.Settings.Output.CustomEncoderSettings="Prilagođena enkoder podešavanja" @@ -552,7 +552,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (najbrže, ali mutno pri skaliranju)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (oštrije skaliranje, 16 uzoraka)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (oštrije skaliranje, 32 uzorka)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (oštrije skaliranje, 36 uzorka)" Basic.Settings.Audio="Zvuk" Basic.Settings.Audio.SampleRate="Protok" @@ -575,7 +575,6 @@ Basic.Settings.Advanced.Video.ColorRange.Partial="Delimično" Basic.Settings.Advanced.Video.ColorRange.Full="Potpuno" Basic.Settings.Advanced.StreamDelay="Odlaganje strima" -Basic.Settings.Advanced.StreamDelay.Duration="Trajanje (sekunde)" Basic.Settings.Advanced.StreamDelay.Preserve="Očuvaj tačku prekidanja (povećava odlaganje) kada se ponovo povezuje" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Procenjena upotreba memorije: %1 MB" Basic.Settings.Advanced.Network="Mreža" @@ -583,8 +582,6 @@ Basic.AdvAudio="Napredna podešavanja zvuka" Basic.AdvAudio.Name="Ime" -Basic.AdvAudio.Mono="Spoji u mono" -Basic.AdvAudio.SyncOffset="Razlika u sinhronizaciji (ms)" Basic.AdvAudio.AudioTracks="Izvori" Basic.Settings.Hotkeys="Prečice"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/hu-HU.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/hu-HU.ini
Changed
@@ -23,7 +23,7 @@ Display="Kijelző" Name="Név" Exit="Kilépés" -Mixer="Keverő" +Mixer="Hangkeverő" Browse="Tallózás" Mono="Mono" Stereo="Sztereó" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Dokkolható ablak bezárása" DockCloseWarning.Text="Most zárt be egy dokkolható ablakot. Ha szeretné újra felfedni, akkor használja a Nézet -> Dokkolás menüt." +ExtraBrowsers="Egyedi tallózó dokkoló" +ExtraBrowsers.Info="Dokkolók hozzáadása egy név és URL megadásával, utána kattintson az Alkalmaz vagy Bezárás gombra a szerkesztéshez. Bármikor tud hozzáadni vagy eltávolítani dokkolókat." +ExtraBrowsers.DockName="Dokkoló neve" + Auth.Authing.Title="Hitelesítés..." Auth.Authing.Text="Hitelesítés %1 platformmal, kérjük várjon..." Auth.AuthFailure.Title="Hitelesítési hiba" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Twitch Tevékenységnapló" TwitchAuth.TwoFactorFail.Title="Nem lehetett a stream kulcsot lekérni" TwitchAuth.TwoFactorFail.Text="Az OBS nem tudott kapcsolódni a Twitch felhasználódhoz. Kérem ellenőrizze, hogy a kétfaktoros authentikációja be van állítva a <a href='https://www.twitch.tv/settings/security'>Twitch biztonsági beállítások</a> között, hiszen az szükséges az adáshoz." +RestreamAuth.Channels="Restream Csatornák" Copy.Filters="Szűrők másolása" Paste.Filters="Szűrők beillesztése" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Megjegyzés: A vászon (alap) felbontása nem feltétlenül ugyanaz, mint a stream vagy felvétel felbontása. A tényleges stream/felvétel felbontása esetlegesen lefele lesz skálázva az erőforrások leterheltsége vagy a bitsebesség követelmények elérése érdekében." Basic.AutoConfig.StreamPage="Stream információ" Basic.AutoConfig.StreamPage.SubTitle="Adja meg a stream információit" -Basic.AutoConfig.StreamPage.ConnectAccount="Felhasználó csatlakoztatása (Opcionális)" +Basic.AutoConfig.StreamPage.ConnectAccount="Felhasználó hozzákapcsolás (Ajánlott)" Basic.AutoConfig.StreamPage.DisconnectAccount="Felhasználó szétkapcsolása" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Felhasználó szétkapcsolása?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Ez a változtatás azonnal érvénybe lép. Biztosan megszakítja a kapcsolatot a fiókjával?" @@ -240,10 +245,13 @@ ConfirmStop.Title="Stream megállítása?" ConfirmStop.Text="Biztos benne, hogy leállítja a streamet?" +ConfirmStopRecord.Title="Felvétel leállítása?" +ConfirmStopRecord.Text="Biztosan le kívánja állítani a felvételt?" + ConfirmBWTest.Title="Sávszélesség teszt indítása?" ConfirmBWTest.Text="Az OBS sávszélességteszt módra van konfigurálva. Ez a mód hálózattesztelésre van, anélkül működik, hogy élő adást kezdeményezne. Amint a vizsgálat lezajlott, úgy kikapcsolásra van szükség, hogy az adás a nézők számára is megjelenjen.\n\nSzeretné folytatni?" -ConfirmExit.Title="Kilép a programból?" +ConfirmExit.Title="Kilép az OBS-ből?" ConfirmExit.Text="Az OBS jelenleg aktív. Minden stream és/vagy felvétel le fog állni. Biztosan kilép?" ConfirmRemove.Title="Eltávolítás megerősítése" @@ -255,6 +263,8 @@ Output.StartReplayFailed="Visszajátszás puffer indítása sikertelen" Output.StartFailedGeneric="Kimenet indítása sikertelen. Kérem ellenőrizze az eseménynaplóban a részleteket.\n\nMegjegyzés: NVENC vagy AMD kódoló használata esetén, győződjön meg róla, hogy az illesztőprogramok naprakészek!" +Output.ReplayBuffer.PauseWarning.Title="Szünet esetén nem lehet visszajátszást menteni" +Output.ReplayBuffer.PauseWarning.Text="Figyelmeztetés: Visszajátszást nem lehet menteni, amíg a felvétel szünetel." Output.ConnectFail.Title="Csatlakozás sikertelen" Output.ConnectFail.BadPath="Érvénytelen elérési út vagy kapcsolati URL cím. Kérem, ellenőrizze a beállításokat és győződjön meg az érvényességükről." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Visszajátszás puffer indítása" Basic.Main.StartStreaming="Stream indítása" Basic.Main.StopRecording="Felvétel leállítása" +Basic.Main.PauseRecording="Felvétel szüneteltetése" +Basic.Main.UnpauseRecording="Felvétel folytatása" Basic.Main.StoppingRecording="Felvétel leállítása..." Basic.Main.StopReplayBuffer="Visszajátszás puffer megállítása" Basic.Main.StoppingReplayBuffer="Visszajátszás puffer leáll..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="Dokkolás" Basic.MainMenu.View.Docks.ResetUI="Felület újraindítása" Basic.MainMenu.View.Docks.LockUI="Felület zárása" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Egyedi tallózó dokkoló..." Basic.MainMenu.View.Toolbars.Listboxes="Gombsor (&L)" Basic.MainMenu.View.SceneTransitions="Jelenet átmenetek (&C)" Basic.MainMenu.View.StatusBar="Állapot&sor" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Statisztikai párbeszédpanel megnyitása indításkor" Basic.Settings.General.WarnBeforeStartingStream="Megerősítő párbeszédpanel megjelenítése stream indításakor" Basic.Settings.General.WarnBeforeStoppingStream="Megerősítő párbeszédpanel megjelenítése stream leállításakor" +Basic.Settings.General.WarnBeforeStoppingRecord="Megerősítő párbeszédpanel megjelenítése felvétel leállításakor" Basic.Settings.General.Projectors="Projektorok" Basic.Settings.General.HideProjectorCursor="Projektor nézetben a kurzor elrejtése" Basic.Settings.General.ProjectorAlwaysOnTop="Projektorok mindig legfelül" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Felvételi könyvtár kiválasztása" Basic.Settings.Output.SelectFile="Felvétel fájljának kiválasztása" Basic.Settings.Output.EnforceBitrate="Stream kiszolgáló bitsebesség korlátainak kényszerítése" +Basic.Settings.Output.DynamicBitrate="Dinamikus bitráta változtatás a hálózati terheléssel való megbirkózás érdekében" +Basic.Settings.Output.DynamicBitrate.Beta="Dinamikus bitráta változtatás a hálózati terheléssel való megbirkózás érdekében (Béta)" +Basic.Settings.Output.DynamicBitrate.TT="Hálózati terhelés esetén a képkockák eldobása helyett, dinamikusan változik a bitráta menet közben.\n\nTartsa észben, hogy ez növelheti a késleltetést ön és a nézők között, hogyha hirtelen megnövekszik a terhelés.\nAmikor a bitráta lezuhan, akár percekig is eltarthat, amíg helyreáll.\n\nAktuálisan csak RTMP használata esetén támogatott." Basic.Settings.Output.Mode="Kimeneti mód" Basic.Settings.Output.Mode.Simple="Egyszerű" Basic.Settings.Output.Mode.Adv="Haladó" Basic.Settings.Output.Mode.FFmpeg="FFmpeg kimenet" Basic.Settings.Output.UseReplayBuffer="Visszajátszás puffer engedélyezése" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximális visszajátszási idő (Másodperc)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximális Visszajátszási Idő" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maximális memória (Megabájt)" Basic.Settings.Output.ReplayBuffer.Estimate="Becsült memóriaigény: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Nem lehet megbecsülni a memóriaigényt. Kérem állítson be egy maximális memória limitet." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Veszteségmentes minőség, hatalmas fájlméret" Basic.Settings.Output.Simple.Warn.VideoBitrate="Figyelem: Az adás videó bitsebessége %1 értéken áll, ami a kiválasztott kiszolgáló felső határértéke. Amennyiben túl kívánja lépni a megadott %1 értéket, úgy engedélyezze a haladó kódolási opciókat és törölje a \"stream kiszolgáló bitsebesség korlátainak kényszerítése\" opciót." Basic.Settings.Output.Simple.Warn.AudioBitrate="Figyelem: Az adás audio bitsebessége %1 értéken áll, ami a kiválasztott kiszolgáló felső határértéke. Amennyiben túl kívánja lépni a megadott %1 értéket, úgy engedélyezze a haladó kódolási opciókat és törölje a \"stream kiszolgáló bitsebesség korlátainak kényszerítése\" opciót." +Basic.Settings.Output.Simple.Warn.CannotPause="Figyelmeztetés: A felvételeket nem lehet szüneteltetni, ha a felvétel minősége \"Ugyanaz mint a stream\"-re van állítva." Basic.Settings.Output.Simple.Warn.Encoder="Figyelem: A streamtől eltérő minőséggel történő rögzítés, további CPU erőforrásokat igényel, ha egyidejűleg használja mindkettőt." Basic.Settings.Output.Simple.Warn.Lossless="Figyelem: A veszteségmentes minőséggel történő felvétel hatalmas fájlméretet generál. Ezzel a minőséggel percenként akár 7 gigabájt adatot is generálhat nagy felbontáson és képkockasebességen. Ez az eljárás nem ajánlott hosszú felvételekhez, kivéve ha hatalmas lemezterület áll rendelkezésre." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Biztos benne, hogy veszteségmentes minőséget kíván használni?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Videó bitsebesség" Basic.Settings.Output.AudioBitrate="Audio bitsebesség" Basic.Settings.Output.Reconnect="Automatikus újracsatlakozás" -Basic.Settings.Output.RetryDelay="Újrapróbálkozás késleltetése (másodperc)" +Basic.Settings.Output.RetryDelay="Újrapróbálási késleltetés" Basic.Settings.Output.MaxRetries="Újrapróbálkozások maximális száma" Basic.Settings.Output.Advanced="Speciális kódoló beállítások engedélyezése" Basic.Settings.Output.EncoderPreset="Kódoló készlet" @@ -694,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilineáris (leggyorsabb, homályos lehet méretezésnél)" Basic.Settings.Video.DownscaleFilter.Bicubic="Kettős köbös (élesített méretezés, 16 minta)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (élesített méretezés, 32 minta)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (élesített méretezés, 36 minta)" +Basic.Settings.Video.DownscaleFilter.Area="Terület (Átlagolt, 4/6/9 minta)" Basic.Settings.Audio="Hang" Basic.Settings.Audio.SampleRate="Mintavételezés" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Csúcsminta" Basic.Settings.Audio.PeakMeterType.TruePeak="Valós Csúcs (Magasabb CPU használat)" Basic.Settings.Audio.MultiChannelWarning.Enabled="Figyelmeztetés: Surround sound hang engedélyezve van." -Basic.Settings.Audio.MultichannelWarning="Ha közvetít, ellenőrizze, hogy a stream szolgáltatója támogatja mind a surround sound kezelést, mind pedig a surround sound lejátszást. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast a legjobb példa, hogy mely platformokon van teljes támogatás. Ellenben a Facebook Live és a YouTube Live minden elfogadja a térhangzású hangot, a Facebook Live lekeveri stereora és a YouTube Live csak két csatornát játszik le.\n\nOBS audio szűrők kompatibilisek a térhangzású hanggal, viszont a VST bővítmények támogatása nem garantált." +Basic.Settings.Audio.MultichannelWarning="Ha közvetít, ellenőrizze, hogy a stream szolgáltatója támogatja mind a surround sound kezelést, mind pedig a surround sound lejátszást. Facebook 360 Live, Mixer RTMP, Smashcast a legjobb példa, hogy mely platformokon van teljes támogatás. Ellenben a Facebook Live és a YouTube Live minden elfogadja a térhangzású hangot, a Facebook Live lekeveri stereora és a YouTube Live csak két csatornát játszik le.\n\nOBS audio szűrők kompatibilisek a térhangzású hanggal, viszont a VST bővítmények támogatása nem garantált." Basic.Settings.Audio.MultichannelWarning.Title="Engedélyezi a surround hangzást?" Basic.Settings.Audio.MultichannelWarning.Confirm="Biztos benne, hogy engedélyezi a surround hangzást?" Basic.Settings.Audio.Devices="Eszközök" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Alapértelmezett" Basic.Settings.Advanced.Audio.DisableAudioDucking="Windows hangerőcsökkentés lekapcsolása" Basic.Settings.Advanced.StreamDelay="Stream késleltetés" -Basic.Settings.Advanced.StreamDelay.Duration="Időtartam (másodperc)" +Basic.Settings.Advanced.StreamDelay.Duration="Időtartam" Basic.Settings.Advanced.StreamDelay.Preserve="Töréspont megőrzése (Késleltetés növeléssel) újrakapcsolódás esetén" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Becsült memóriahasználat: %1 MB" Basic.Settings.Advanced.Network="Hálózat" Basic.Settings.Advanced.Network.BindToIP="IP-hez rendelés" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Új hálózatkezelő kód engedélyezése" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Alacsony késleltetésű mód" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Gyorsbillentyű Fókuszműködés" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Sohase tiltson le billentyűparancsot" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Gyorsbillentyűk letiltása, ha a fő ablak fókuszban van" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Gyorsbillentyűk letiltása, ha a fő ablak nincs fókuszban" Basic.Settings.Advanced.AutoRemux="Automatikus remux MP4-re" Basic.Settings.Advanced.AutoRemux.MP4="(mkv-ként mentés)" Basic.AdvAudio="Speciális hangtulajdonságok" Basic.AdvAudio.Name="Név" Basic.AdvAudio.Volume="Hangerő" -Basic.AdvAudio.Mono="Monora lekeverés" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Egyensúly" -Basic.AdvAudio.SyncOffset="Szinkron eltolás (ms)" +Basic.AdvAudio.SyncOffset="Szinkron eltolás" Basic.AdvAudio.Monitoring="Hangfigyelés" Basic.AdvAudio.Monitoring.None="Figyelés kikapcsolása" Basic.AdvAudio.Monitoring.MonitorOnly="Csak figyelés (kimenet némítása)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="Ki kell jelölnie legalább egy sávot!" OutputWarnings.MultiTrackRecording="Figyelem: Bizonyos formátumok (mint az FLV) nem támogatják a több sávot felvételenként" OutputWarnings.MP4Recording="Figyelem: Az MP4/MOV-ban mentett állományok javíthatatlanok, ha a fájl nem kerül lezárásra (pl: BSOD vagy áramkimaradás esetén, stb.). Ha mindenképpen több hangsávval kíván felvételt készíteni, akkor használja az MKV állományt és remuxolja a felvételt MP4/MOV-ba, miután elkészült. (Fájl -> Felvételek remuxolása)" +OutputWarnings.CannotPause="Figyelmeztetés: A felvételeket nem lehet szüneteltetni, ha a felvétel kódolója: \"(Stream kódolójának használatára)\" van állítva." FinalScene.Title="Jelenet törlése" FinalScene.Text="Legalább egy jelenetnek lennie kell."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/it-IT.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/it-IT.ini
Changed
@@ -23,7 +23,7 @@ Display="Schermo" Name="Nome" Exit="Esci" -Mixer="Mixer" +Mixer="Mixer audio" Browse="Sfoglia" Mono="Mono" Stereo="Stereo" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Hai chiuso la finestra di un pannello" DockCloseWarning.Text="Hai appena chiuso la finestra di un pannello. Se vuoi mostrarlo di nuovo, vai sul menù Visualizza → Pannelli, nella barra multifunzione in alto." +ExtraBrowsers="Pannelli Browser Personalizzati" +ExtraBrowsers.Info="Aggiungi pannelli dando loro un nome e un URL, quindi clicca su Applica o Chiudi per aprire i pannelli. Puoi aggiungere o rimuovere pannelli in qualsiasi momento." +ExtraBrowsers.DockName="Nome del Pannello" + Auth.Authing.Title="Accesso in corso..." Auth.Authing.Text="Accesso in corso con %1, attendi..." Auth.AuthFailure.Title="Accesso fallito" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Feed attività di Twitch" TwitchAuth.TwoFactorFail.Title="Impossibile interrogare il codice della diretta" TwitchAuth.TwoFactorFail.Text="OBS non è stato in grado di connettersi al tuo account di Twitch. Assicurati che l'autenticazione a due fattori sia impostata nelle tue <a href='https://www.twitch.tv/settings/security'>impostazioni di sicurezza di Twitch</a> perché è necessaria per lo stream." +RestreamAuth.Channels="Ripristina i Canali" Copy.Filters="Copia i filtri" Paste.Filters="Incolla i filtri" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Nota: la risoluzione (di base) dell'inquadratura non sarà necessariamente la stessa risoluzione per le dirette o per le registrazioni. La risoluzione delle dirette/registrazioni effettiva potrebbe essere scalata dalla risoluzione dell'inquadratura per ridurre le risorse utilizzate o i requisiti di velocità in bit." Basic.AutoConfig.StreamPage="Informazioni per le dirette" Basic.AutoConfig.StreamPage.SubTitle="Per favore inserisci le informazioni per le dirette" -Basic.AutoConfig.StreamPage.ConnectAccount="Collega l'account (facoltativo)" +Basic.AutoConfig.StreamPage.ConnectAccount="Connetti account (consigliato)" Basic.AutoConfig.StreamPage.DisconnectAccount="Disconnetti l'account" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Vuoi disconnettere l'account?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Questa modifica verrà applicata immediatamente. Sei sicuro di voler disconnettere il tuo account?" @@ -240,6 +245,9 @@ ConfirmStop.Title="Vuoi interrompere la diretta?" ConfirmStop.Text="Sei sicuro di voler interrompere questa diretta?" +ConfirmStopRecord.Title="Interrompere la registrazione?" +ConfirmStopRecord.Text="Sei sicuro di voler interrompere la registrazione?" + ConfirmBWTest.Title="Vuoi avviare il test della larghezza di banda?" ConfirmBWTest.Text="Hai configurato OBS in modalità di test di larghezza di banda. Questa modalità ti permette di eseguire i test della rete senza dover avviare una diretta. Quando hai finito di eseguire i test, ricordati di disattivare la modalità per permettere ai tuoi spettatori di guardare la diretta.\n\nVuoi continuare?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="Impossibile avviare il buffer di replay" Output.StartFailedGeneric="Impossibile creare il file di uscita. Controlla il log per i dettagli.\n\nNota: se utilizzi la codifica NVENC o AMD, assicurati che i driver video siano aggiornati all'ultima versione." +Output.ReplayBuffer.PauseWarning.Title="Impossibile salvare i replay in pausa" +Output.ReplayBuffer.PauseWarning.Text="Attenzione: i Replay non possono essere salvati mentre la registrazione è in pausa." Output.ConnectFail.Title="Impossibile connettersi" Output.ConnectFail.BadPath="Percorso o URL di connessione non valido. Controlla le tue impostazioni per confermare che siano valide." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Avvia il buffer di replay" Basic.Main.StartStreaming="Avvia la diretta" Basic.Main.StopRecording="Termina la registrazione" +Basic.Main.PauseRecording="Registrazione in pausa" +Basic.Main.UnpauseRecording="Riprendi la registrazione" Basic.Main.StoppingRecording="Terminazione della registrazione in corso..." Basic.Main.StopReplayBuffer="Termina il buffer di replay" Basic.Main.StoppingReplayBuffer="Terminazione del buffer di replay in corso..." @@ -479,7 +491,7 @@ Basic.MainMenu.Edit.Transform.EditTransform="Modifica &e trasforma..." Basic.MainMenu.Edit.Transform.CopyTransform="Copia e trasforma" Basic.MainMenu.Edit.Transform.PasteTransform="Incolla e trasforma" -Basic.MainMenu.Edit.Transform.ResetTransform="&Ripristina e trasforma" +Basic.MainMenu.Edit.Transform.ResetTransform="&Ripristina la trasformazione originale" Basic.MainMenu.Edit.Transform.Rotate90CW="Ruota di 90 gradi in senso orario" Basic.MainMenu.Edit.Transform.Rotate90CCW="Ruota di 90 gradi in senso antiorario" Basic.MainMenu.Edit.Transform.Rotate180="Ruota di 180 gradi" @@ -490,18 +502,19 @@ Basic.MainMenu.Edit.Transform.CenterToScreen="&Centra nello schermo" Basic.MainMenu.Edit.Transform.VerticalCenter="Centra verticalmente" Basic.MainMenu.Edit.Transform.HorizontalCenter="Centra orizzontalmente" -Basic.MainMenu.Edit.Order="&Ordine" +Basic.MainMenu.Edit.Order="&Ordina" Basic.MainMenu.Edit.Order.MoveUp="Sposta s&u" Basic.MainMenu.Edit.Order.MoveDown="Sposta giù (&D)" Basic.MainMenu.Edit.Order.MoveToTop="Spos&ta in cima" Basic.MainMenu.Edit.Order.MoveToBottom="Sposta in fondo (&B)" -Basic.MainMenu.Edit.AdvAudio="Proprietà audio &avanzate" +Basic.MainMenu.Edit.AdvAudio="Proprietà &audio avanzate" Basic.MainMenu.View="&Visualizza" Basic.MainMenu.View.Toolbars="Barre degli s&trumenti" Basic.MainMenu.View.Docks="Pannelli" Basic.MainMenu.View.Docks.ResetUI="Ripristina l'interfaccia" Basic.MainMenu.View.Docks.LockUI="Blocca l'interfaccia" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Pannelli Browser Personalizzati..." Basic.MainMenu.View.Toolbars.Listboxes="Pu&lsanti di navigazione" Basic.MainMenu.View.SceneTransitions="Transizioni di s&cena" Basic.MainMenu.View.StatusBar="Barra di &stato" @@ -523,8 +536,8 @@ Basic.MainMenu.Help.Website="Visita il sito &web" Basic.MainMenu.Help.Discord="Unisciti al server di &Discord" Basic.MainMenu.Help.Logs="File di &log" -Basic.MainMenu.Help.Logs.ShowLogs="Vi&sualizza i file di Log" -Basic.MainMenu.Help.Logs.UploadCurrentLog="Carica file di log &corrente" +Basic.MainMenu.Help.Logs.ShowLogs="Mo&stra i file di log" +Basic.MainMenu.Help.Logs.UploadCurrentLog="&Carica il file di log attuale" Basic.MainMenu.Help.Logs.UploadLastLog="Carica &l'ultimo file di log" Basic.MainMenu.Help.Logs.ViewCurrentLog="&Visualizza il file di log attuale" Basic.MainMenu.Help.CheckForUpdates="Controlla gli aggiornamenti" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Apri la finestra delle statistiche all'avvio" Basic.Settings.General.WarnBeforeStartingStream="Mostra una finestra di conferma quando avvii una diretta" Basic.Settings.General.WarnBeforeStoppingStream="Mostra una finestra di conferma quando vuoi terminare una diretta" +Basic.Settings.General.WarnBeforeStoppingRecord="Mostra finestra di conferma quando si interrompe la registrazione" Basic.Settings.General.Projectors="Proiettori" Basic.Settings.General.HideProjectorCursor="Nascondi il cursore sopra i proiettori" Basic.Settings.General.ProjectorAlwaysOnTop="I proiettori devono essere sempre in primo piano?" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Seleziona la cartella di registrazione" Basic.Settings.Output.SelectFile="Seleziona il file di registrazione" Basic.Settings.Output.EnforceBitrate="Non superare i limiti di velocità in bit del servizio di dirette" +Basic.Settings.Output.DynamicBitrate="Cambia in modo dinamico il bitrate per gestire la congestione" +Basic.Settings.Output.DynamicBitrate.Beta="Cambia in modo dinamico il bitrate per gestire la congestione (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="Invece di saltare fotogrammi per ridurre la congestione, cambia dinamicamente il bitrate al volo.\n\nNota che questo potrebbe aumentare il ritardo agli spettatori se c'è una significante congestione improvvisa.\nQuando il bitrate diminuisce, potrebbero volerci fino ad alcuni minuti per ripristinarlo.\n\nAttualmente è solo supportato per RTMP." Basic.Settings.Output.Mode="Modalità di uscita" Basic.Settings.Output.Mode.Simple="Semplice" Basic.Settings.Output.Mode.Adv="Avanzate" Basic.Settings.Output.Mode.FFmpeg="Uscita FFmpeg" Basic.Settings.Output.UseReplayBuffer="Attiva il buffer di replay" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Tempo massimo di replay (in secondi)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Tempo massimo di Replay" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Memoria massima (in megabyte)" Basic.Settings.Output.ReplayBuffer.Estimate="Uso della memoria stimato: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Impossibile stimare la memoria utilizzata. Imposta un limite massimo di memoria." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Senza perdita di qualità (lossless), dimensioni dei file enormi" Basic.Settings.Output.Simple.Warn.VideoBitrate="Attenzione: la velocità in bit video della diretta verrà impostata a %1, che è il limite più alto per il servizio di dirette attuale. Se sei sicuro di voler superare il valore %1, attiva le impostazioni avanzate della codifica e deseleziona «Non superare i limiti di velocità in bit del servizio di dirette»." Basic.Settings.Output.Simple.Warn.AudioBitrate="Attenzione: la velocità in bit audio della diretta verrà impostata a %1, che è il limite più alto per il servizio di dirette attuale. Se sei sicuro di voler superare il valore %1, attiva le impostazioni avanzate della codifica e deseleziona «Non superare i limiti di velocità in bit del servizio di dirette»." +Basic.Settings.Output.Simple.Warn.CannotPause="Attenzione: Le registrazioni non possono essere sospese se la qualità di registrazione è impostata su \"Lo stesso del flusso\"." Basic.Settings.Output.Simple.Warn.Encoder="Attenzione: registrare con una codifica software a una qualità diversa dalla diretta richiederà un utilizzo aggiuntivo della CPU se esegui dirette e registri allo stesso tempo." Basic.Settings.Output.Simple.Warn.Lossless="Attenzione: la qualità lossless genera file estremamente grandi! Può occupare fino a 7 gigabyte di spazio al minuto con alte risoluzioni e framerate. Non è consigliata per lunghe registrazioni a meno che tu non abbia molto spazio disponibile sul disco rigido." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Sei sicuro di volere utilizzare la qualità lossless?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Velocità in bit video" Basic.Settings.Output.AudioBitrate="Velocità in bit audio" Basic.Settings.Output.Reconnect="Riconnessione automatica" -Basic.Settings.Output.RetryDelay="Ritardo dei tentativi (in secondi)" +Basic.Settings.Output.RetryDelay="Ritardo dei tentativi" Basic.Settings.Output.MaxRetries="Tentativi massimi" Basic.Settings.Output.Advanced="Attiva le impostazioni avanzate di codifica" Basic.Settings.Output.EncoderPreset="Preset della codifica" @@ -694,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilineare (il più veloce, ma sfocato se ridimensionato)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubica (scalatura accentuata, 16 campioni)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (scalatura accentuata, 32 campioni)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (scalatura accentuata, 36 campioni)" +Basic.Settings.Video.DownscaleFilter.Area="Area (importo peso, 4/6/9 campioni)" Basic.Settings.Audio="Audio" Basic.Settings.Audio.SampleRate="Frequenza di campionamento" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Picco a campionamento" Basic.Settings.Audio.PeakMeterType.TruePeak="Picco esatto (alto utilizzo della CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="ATTENZIONE: L'audio surround è attivato." -Basic.Settings.Audio.MultichannelWarning="Se stai effettuando le modifiche per le dirette, controlla che il servizio di dirette offra l'integrazione e la riproduzione di audio surround. Twitch, Facebook 360 Live, Mixer RTMP e Smashcast sono esempi di servizi che offrono l'audio surround. Le dirette su Facebook e YouTube accettano l'audio surround, ma Facebook lo converte in stereo e YouTube riproduce solo due canali.\n\nI filtri audio di OBS sono compatibili con l'audio surround, ma il supporto al plugin VST non è garantito." +Basic.Settings.Audio.MultichannelWarning="Se stai effettuando le modifiche per le dirette, controlla che il servizio di dirette offra l'integrazione e la riproduzione di audio surround. Facebook 360 Live, Mixer RTMP e Smashcast sono esempi di servizi che offrono l'audio surround. Le dirette su Facebook e YouTube accettano l'audio surround, ma Facebook lo converte in stereo e YouTube riproduce solo due canali.\n\nI filtri audio di OBS sono compatibili con l'audio surround, ma il supporto al plugin VST non è garantito." Basic.Settings.Audio.MultichannelWarning.Title="Vuoi attivare l'audio surround?" Basic.Settings.Audio.MultichannelWarning.Confirm="Sei sicuro di voler attivare l'audio surround?" Basic.Settings.Audio.Devices="Dispositivi" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Predefinito" Basic.Settings.Advanced.Audio.DisableAudioDucking="Disattiva la riduzione del volume di Windows" Basic.Settings.Advanced.StreamDelay="Ritardo delle dirette" -Basic.Settings.Advanced.StreamDelay.Duration="Durata (in secondi)" +Basic.Settings.Advanced.StreamDelay.Duration="Durata" Basic.Settings.Advanced.StreamDelay.Preserve="Mantieni il punto di taglio (aumenta il ritardo) durante la riconnessione" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Utilizzo della memoria stimato: %1 MB" Basic.Settings.Advanced.Network="Rete" Basic.Settings.Advanced.Network.BindToIP="Associa all'indirizzo IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Attiva il nuovo codice di rete" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Modalità a bassa latenza" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Comportamento Focus Scorciatoie" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Non disabilitare mai le scorciatoie" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Disattiva le scorciatoie quando la finestra principale è in primo piano" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Disattiva le scorciatoie quando la finestra principale non è in primo piano" Basic.Settings.Advanced.AutoRemux="Converti automaticamente in MP4" Basic.Settings.Advanced.AutoRemux.MP4="(registra in MKV)" Basic.AdvAudio="Proprietà audio avanzate" Basic.AdvAudio.Name="Nome" Basic.AdvAudio.Volume="Volume" -Basic.AdvAudio.Mono="Trasforma in mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Bilanciamento" -Basic.AdvAudio.SyncOffset="Ritardo per la sincronizzazione (ms)" +Basic.AdvAudio.SyncOffset="Ritardo per la sincronizzazione" Basic.AdvAudio.Monitoring="Monitoraggio audio" Basic.AdvAudio.Monitoring.None="Disattivato" Basic.AdvAudio.Monitoring.MonitorOnly="Solo monitoraggio (uscita audio nel file disattivata)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="Devi selezionare almeno una traccia" OutputWarnings.MultiTrackRecording="Attenzione: alcuni formati (come FLV) supportano solo una traccia" OutputWarnings.MP4Recording="Attenzione: le registrazioni salvate in MP4/MOV non saranno recuperabili se il file non può essere completato (ad es. a seguito di un BSOD, perdite di corrente, ecc.). Se desideri registrare più tracce audio, consigliamo l'utilizzo di MKV e, una volta terminato, eseguire la conversione della registrazione in MP4/MOV (File → Converti le registrazioni)" +OutputWarnings.CannotPause="Attenzione: Le registrazioni non possono essere sospese se il codificatore di registrazione è impostato su \"(Utilizza codifica flusso)\"" FinalScene.Title="Eliminazione della scena" FinalScene.Text="Deve esserci almeno una scena."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ja-JP.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ja-JP.ini
Changed
@@ -23,7 +23,7 @@ Display="ディスプレイ" Name="名称" Exit="終了" -Mixer="ミキサー" +Mixer="音声ミキサー" Browse="参照" Mono="モノラル" Stereo="ステレオ" @@ -91,6 +91,10 @@ DockCloseWarning.Title="ドッキング可能ウィンドウを閉じる" DockCloseWarning.Text="ドッキング可能なウィンドウを閉じました。もう一度表示したい場合は、メニューバーの表示 → ドックメニューを使用してください。" +ExtraBrowsers="カスタムブラウザドック" +ExtraBrowsers.Info="名前とURLを指定してドックを追加し、「適用」または「閉じる」をクリックすることでドックが開きます。 ドックはいつでも追加または削除できます。" +ExtraBrowsers.DockName="ドック名" + Auth.Authing.Title="認証中..." Auth.Authing.Text="%1で認証中、お待ちください..." Auth.AuthFailure.Title="認証失敗" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Twitch アクティビティフィード" TwitchAuth.TwoFactorFail.Title="ストリームキーを照会できませんでした" TwitchAuth.TwoFactorFail.Text="OBSはあなたのTwitchアカウントに接続できませんでした。 これは配信に必要なので、<a href='https://www.twitch.tv/settings/security'>Twitchセキュリティ設定</a>で2要素認証が設定されていることを確認してください。" +RestreamAuth.Channels="Restream Channels" Copy.Filters="フィルタをコピーする" Paste.Filters="フィルタを貼り付ける" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="注: キャンバス (基本) 解像度は配信や録画の解像度と必ずしも同じではありません。 実際の配信/録画の解像度はリソース使用量やビットレート要求を減らすためにキャンバス解像度から縮小されたものを使用できます。" Basic.AutoConfig.StreamPage="配信情報" Basic.AutoConfig.StreamPage.SubTitle="配信情報を入力してください" -Basic.AutoConfig.StreamPage.ConnectAccount="アカウント接続 (オプション)" +Basic.AutoConfig.StreamPage.ConnectAccount="アカウント接続 (推奨)" Basic.AutoConfig.StreamPage.DisconnectAccount="アカウントを切断" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="アカウントを切断しますか?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="この変更はすぐに適用されます。 アカウントを切断してもよろしいですか?" @@ -189,7 +194,7 @@ Basic.Stats.DroppedFrames="ドロップフレーム (ネットワーク)" Basic.Stats.MegabytesSent="出力データの合計" Basic.Stats.Bitrate="ビットレート" -Basic.Stats.DiskFullIn="ディスクがいっぱいになるまで後(約)" +Basic.Stats.DiskFullIn="ディスク空き容量残り時間(約)" ResetUIWarning.Title="UIをリセットしてもよろしいですか?" ResetUIWarning.Text="UIをリセットすると追加のドックは非表示になります。表示したい場合表示メニューからこれらのドックを表示する必要があります。\n\nUIをリセットしてもよろしいですか?" @@ -240,6 +245,9 @@ ConfirmStop.Title="配信を停止しますか?" ConfirmStop.Text="配信を停止しますか?" +ConfirmStopRecord.Title="録画停止?" +ConfirmStopRecord.Text="録画を停止しますか?" + ConfirmBWTest.Title="帯域幅テストを開始しますか?" ConfirmBWTest.Text="OBSが帯域幅テストモードに設定されています。 このモードではチャンネルを配信中にしなくてもネットワークテストが可能です。 テストが終了したら、視聴者があなたの配信を見ることができるようにするために無効にする必要があります。\n\n続行しますか?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="リプレイバッファの開始に失敗しました" Output.StartFailedGeneric="出力開始に失敗しました。詳細はログを確認してください。\n\n注: NVENCまたはAMDエンコーダを使用している場合は、ビデオドライバが最新のものであるかを確認してください。" +Output.ReplayBuffer.PauseWarning.Title="一時停止中はリプレイを保存できません" +Output.ReplayBuffer.PauseWarning.Text="警告:録画の一時停止中はリプレイを保存できません。" Output.ConnectFail.Title="接続失敗" Output.ConnectFail.BadPath="パスかURLが無効です。再確認して下さい。" @@ -337,8 +347,8 @@ Deinterlacing.TopFieldFirst="トップフィールドが先" Deinterlacing.BottomFieldFirst="ボトムフィールドが先" -VolControl.SliderUnmuted="'%1' の音量スライダー: %2" -VolControl.SliderMuted="'%1' の音量スライダー: %2 (現在ミュート)" +VolControl.SliderUnmuted="「%1」の音量スライダー: %2" +VolControl.SliderMuted="「%1」の音量スライダー: %2 (現在ミュート)" VolControl.Mute="'%1' をミュート" VolControl.Properties="'%1' のプロパティ" @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="リプレイバッファ開始" Basic.Main.StartStreaming="配信開始" Basic.Main.StopRecording="録画終了" +Basic.Main.PauseRecording="録画一時停止" +Basic.Main.UnpauseRecording="録画再開" Basic.Main.StoppingRecording="録画停止処理中..." Basic.Main.StopReplayBuffer="リプレイバッファ停止" Basic.Main.StoppingReplayBuffer="リプレイバッファ停止処理中..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="ドック" Basic.MainMenu.View.Docks.ResetUI="UIをリセット" Basic.MainMenu.View.Docks.LockUI="UIをロック" +Basic.MainMenu.View.Docks.CustomBrowserDocks="カスタムブラウザドック..." Basic.MainMenu.View.Toolbars.Listboxes="リストボックス(&L)" Basic.MainMenu.View.SceneTransitions="シーントランジション(&C)" Basic.MainMenu.View.StatusBar="ステータスバー(&S)" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="起動時に統計ダイアログを開く" Basic.Settings.General.WarnBeforeStartingStream="配信を開始するときに確認ダイアログを表示する" Basic.Settings.General.WarnBeforeStoppingStream="配信を停止するときに確認ダイアログを表示する" +Basic.Settings.General.WarnBeforeStoppingRecord="録画を停止するときに確認ダイアログを表示する" Basic.Settings.General.Projectors="プロジェクター" Basic.Settings.General.HideProjectorCursor="プロジェクター上のカーソルを非表示にする" Basic.Settings.General.ProjectorAlwaysOnTop="プロジェクターを常に手前に表示させる" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="録画ディレクトリを選択" Basic.Settings.Output.SelectFile="録画ファイルを選択" Basic.Settings.Output.EnforceBitrate="配信サービスのビットレートを制限する" +Basic.Settings.Output.DynamicBitrate="輻輳を管理するためにビットレートを動的に変更する" +Basic.Settings.Output.DynamicBitrate.Beta="輻輳を管理するためにビットレートを動的に変更する (ベータ版)" +Basic.Settings.Output.DynamicBitrate.TT="フレームをドロップして輻輳を減らす代わりに、ビットレートを動的に変更します。\n\n突然の大幅な輻輳が発生した場合には視聴者の遅延が増大する可能性があることに注意してください。\nビットレートが低下すると、復元に数分かかることがあります。\n\n現時点ではRTMPでのみサポートされています。" Basic.Settings.Output.Mode="出力モード" Basic.Settings.Output.Mode.Simple="基本" Basic.Settings.Output.Mode.Adv="詳細" Basic.Settings.Output.Mode.FFmpeg="FFmpeg の出力" Basic.Settings.Output.UseReplayBuffer="リプレイバッファを有効にする" -Basic.Settings.Output.ReplayBuffer.SecondsMax="最大リプレイ時間 (秒)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="最大リプレイ時間" Basic.Settings.Output.ReplayBuffer.MegabytesMax="最大メモリ (メガバイト)" Basic.Settings.Output.ReplayBuffer.Estimate="概算メモリ使用量: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="メモリ使用量を見積もることができません。 最大メモリ制限を設定してください。" @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="無損失品質、ファイルサイズ特大" Basic.Settings.Output.Simple.Warn.VideoBitrate="警告: 配信の映像ビットレートは %1 に設定され、これは現在の配信サービスの上限です。 %1 より大きい値に設定する場合、高度なエンコーダオプションを有効にして「配信サービスのビットレートを制限する」のチェックをオフにしてください。" Basic.Settings.Output.Simple.Warn.AudioBitrate="警告: 配信の音声ビットレートは %1 に設定され、これは現在の配信サービスの上限です。 %1 より大きい値に設定する場合、高度なエンコーダオプションを有効にして「配信サービスのビットレートを制限する」のチェックをオフにしてください。" +Basic.Settings.Output.Simple.Warn.CannotPause="警告:録画品質が「配信と同品質」に設定されている場合は録画を一時停止することはできません。" Basic.Settings.Output.Simple.Warn.Encoder="警告: 配信と録画を同時に行う場合に配信と異なる品質でソフトウェアエンコーダで録画する場合にはさらなるCPU 使用率が必要になります。" Basic.Settings.Output.Simple.Warn.Lossless="警告: 無損失品質は途方もなく大きなファイルサイズになります!無損失品質は高解像度と高フレーム レートで 1 分あたり7 ギガバイト以上のディスク容量を使用します。 非常に大量のディスクの空き容量がない場合の長時間録画には無損失設定の使用はお勧めしません。" Basic.Settings.Output.Simple.Warn.Lossless.Msg="無損失品質を使用してもよろしいですか?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="映像ビットレート" Basic.Settings.Output.AudioBitrate="音声ビットレート" Basic.Settings.Output.Reconnect="自動的に再接続" -Basic.Settings.Output.RetryDelay="再試行の遅延 (秒)" +Basic.Settings.Output.RetryDelay="再試行の遅延" Basic.Settings.Output.MaxRetries="最大再試行回数" Basic.Settings.Output.Advanced="高度なエンコーダの設定を有効にする" Basic.Settings.Output.EncoderPreset="エンコーダプリセット" @@ -673,7 +691,7 @@ FilenameFormatting.completer="%CCYY-%MM-%DD %hh-%mm-%ss\n%YY-%MM-%DD %hh-%mm-%ss\n%Y-%m-%d %H-%M-%S\n%y-%m-%d %H-%M-%S\n%a %Y-%m-%d %H-%M-%S\n%A %Y-%m-%d %H-%M-%S\n%Y-%b-%d %H-%M-%S\n%Y-%B-%d %H-%M-%S\n%Y-%m-%d %I-%M-%S-%p\n%Y-%m-%d %H-%M-%S-%z\n%Y-%m-%d %H-%M-%S-%Z" -FilenameFormatting.TT="%CCYY 年, 4桁\n%YY 年, 下2桁 (00-99)\n%MM 月 数値 (01-12)\n%DD 日, 0埋め (01-31)\n%hh 時 24時間形式 (00-23)\n%mm 分 (00-59)\n%ss 秒 (00-61)\n%% A % 記号\n%a 曜日 省略名\n%A 曜日 完全名\n%b 月 省略名\n%B 月 完全名\n%d 日, 0埋め (01-31)\n%H 時 24時間形式 (00-23)\n%I 時 12時間形式 (01-12)\n%m 月 数値 (01-12)\n%M 分 (00-59)\n%p 午前または午後の指定\n%S 秒 (00-61)\n%y 年, 下2桁 (00-99)\n%Y 年\n%z ISO 8601 UTCからのオフセット\n%Z タイムゾーン名または略称\n" +FilenameFormatting.TT="%CCYY 年, 4桁\n%YY 年, 下2桁 (00-99)\n%MM 月, 数値 (01-12)\n%DD 日, 0埋め (01-31)\n%hh 時, 24時間形式 (00-23)\n%mm 分 (00-59)\n%ss 秒 (00-61)\n%% % (パーセント) 記号そのもの\n%a 曜日, 略記\n%A 曜日, 完全名\n%b 月, 略記\n%B 月, 完全名\n%d 日, 0埋め (01-31)\n%H 時, 24時間形式 (00-23)\n%I 時, 12時間形式 (01-12)\n%m 月, 数値 (01-12)\n%M 分 (00-59)\n%p 午前または午後の指定\n%S 秒 (00-61)\n%y 年, 下2桁 (00-99)\n%Y 年\n%z UTCからのISO 8601式オフセット\n%Z タイムゾーンの名称または略称\n" Basic.Settings.Video="映像" Basic.Settings.Video.Adapter="ビデオアダプター" @@ -694,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="バイリニア (スケーリングする場合ぼやけているが最速)" Basic.Settings.Video.DownscaleFilter.Bicubic="バイキュービック (先鋭化スケーリング、16 のサンプル)" -Basic.Settings.Video.DownscaleFilter.Lanczos="ランチョス (先鋭化スケーリング、32 のサンプル)" +Basic.Settings.Video.DownscaleFilter.Lanczos="ランチョス (先鋭化スケーリング、36 のサンプル)" +Basic.Settings.Video.DownscaleFilter.Area="面積 (加重合計, 4/6/9 サンプル)" Basic.Settings.Audio="音声" Basic.Settings.Audio.SampleRate="サンプリングレート" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="サンプル ピーク" Basic.Settings.Audio.PeakMeterType.TruePeak="真のピーク (CPU使用率高い)" Basic.Settings.Audio.MultiChannelWarning.Enabled="警告: サラウンド音声が有効です。" -Basic.Settings.Audio.MultichannelWarning="配信する場合、配信サービスがサラウンド音声の取り込みと再生の両方をサポートしているかどうかを確認してください。Twitch、Facebook 360 Live、Mixer RTMP、Smashcastは、サラウンド音声が完全にサポートされている例です。しかしFacebook LiveとYouTube Liveはどちらもサラウンド取り込みを受信しますが、Facebook Liveはステレオにダウンミックスし、YouTube Liveは2チャンネルのみしか再生できません。\n\nVSTプラグインのサポートは保証されていませんが、OBS音声フィルタはサラウンド音声と互換性があります。" +Basic.Settings.Audio.MultichannelWarning="配信する場合、配信サービスがサラウンド音声の取り込みと再生の両方をサポートしているかどうかを確認してください。Facebook 360 Live、Mixer RTMP、Smashcastは、サラウンド音声が完全にサポートされている例です。しかしFacebook LiveとYouTube Liveはどちらもサラウンド取り込みを受信しますが、Facebook Liveはステレオにダウンミックスし、YouTube Liveは2チャンネルのみしか再生できません。\n\nVSTプラグインのサポートは保証されていませんが、OBS音声フィルタはサラウンド音声と互換性があります。" Basic.Settings.Audio.MultichannelWarning.Title="サラウンド音声を有効にしますか?" Basic.Settings.Audio.MultichannelWarning.Confirm="サラウンド音声を有効にしてもよろしいですか?" Basic.Settings.Audio.Devices="デバイス" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="既定" Basic.Settings.Advanced.Audio.DisableAudioDucking="Windowsの音量を自動で下げる機能を無効にする" Basic.Settings.Advanced.StreamDelay="遅延配信" -Basic.Settings.Advanced.StreamDelay.Duration="継続時間 (秒)" +Basic.Settings.Advanced.StreamDelay.Duration="期間" Basic.Settings.Advanced.StreamDelay.Preserve="再接続時にカットオフポイントを保持する (増加遅延)" Basic.Settings.Advanced.StreamDelay.MemoryUsage="概算メモリ使用量: %1 MB" Basic.Settings.Advanced.Network="ネットワーク" Basic.Settings.Advanced.Network.BindToIP="IP選択" Basic.Settings.Advanced.Network.EnableNewSocketLoop="新しいネットワークコードを有効にする" Basic.Settings.Advanced.Network.EnableLowLatencyMode="低遅延モード" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="ホットキーフォーカスの動作" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="ホットキーを無効にしない" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="メインウィンドウにフォーカスがあるときはホットキーを無効にする" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="メインウィンドウにフォーカスがないときはホットキーを無効にする" Basic.Settings.Advanced.AutoRemux="自動的にmp4に再多重化" Basic.Settings.Advanced.AutoRemux.MP4="(mkvとして録画)" Basic.AdvAudio="オーディオの詳細プロパティ" Basic.AdvAudio.Name="名称" Basic.AdvAudio.Volume="音量" -Basic.AdvAudio.Mono="モノラルにダウンミックス" +Basic.AdvAudio.Mono="モノラル" Basic.AdvAudio.Balance="バランス" -Basic.AdvAudio.SyncOffset="同期オフセット (ミリ秒)" +Basic.AdvAudio.SyncOffset="同期オフセット" Basic.AdvAudio.Monitoring="音声モニタリング" Basic.AdvAudio.Monitoring.None="モニターオフ" Basic.AdvAudio.Monitoring.MonitorOnly="モニターのみ (出力はミュート)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="少なくとも 1 つのトラックを選択する必要があります" OutputWarnings.MultiTrackRecording="警告: 特定のフォーマット (FLVなど) は1つの録画で複数のトラックをサポートしていません" OutputWarnings.MP4Recording="警告: (例えば、ブルースクリーン、電力損失などの結果として)ファイルをファイナライズ出来ない場合はMP4/MOVに保存された録画は回復不能になります。 複数の音声トラックを録画する場合はMKVの利用を検討して録画の終了後にMP4/MOVに再多重化してください。(ファイル → 録画の再多重化)" +OutputWarnings.CannotPause="警告:録画エンコーダが「(ストリームエンコーダを使用)」に設定されている場合は録画を一時停止することはできません。" FinalScene.Title="シーンを削除する" FinalScene.Text="1つ以上のシーンが必要です。"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ka-GE.ini
Changed
@@ -23,7 +23,7 @@ Display="ეკრანი" Name="სახელი" Exit="გასვლა" -Mixer="მიქშერი" +Mixer="ხმის მიქშერი" Browse="მოძიება" Mono="მონო" Stereo="სტერეო" @@ -91,6 +91,10 @@ DockCloseWarning.Title="იერსახის ნაწილის დამალვა" DockCloseWarning.Text="თქვენ ახლახან დამალეთ იერსახის ნაწილი. თუ გსურთ მისი კვლავ გამოჩენა, მენიუს ზოლიდან გამოიყენეთ ხედი → იერსახის ნაწილები." +ExtraBrowsers="ბრაუზერის მორგებული ნაწილები" +ExtraBrowsers.Info="დაამატეთ იერსახის ცალკეული ნაწილები სახელისა და URL-ბმულის მითითებით, შემდეგ კი დაწკაპეთ მიღებასა და დახურვაზე, მათ განსათავსებლად. იერსახის ნაწილების დამატება და მოცილება, ნებისმიერ დროს შეგიძლიათ." +ExtraBrowsers.DockName="ნაწილის სახელი" + Auth.Authing.Title="ანგარიშზე შესვლა..." Auth.Authing.Text="მიმდინარეობს შესვლა %1-ზე, გთხოვთ, მოითმინოთ..." Auth.AuthFailure.Title="შესვლა ვერ მოხერხდა" @@ -106,6 +110,8 @@ TwitchAuth.Stats="Twitch-ის სტატისტიკა" TwitchAuth.Feed="Twitch მოქმედებების არხი" TwitchAuth.TwoFactorFail.Title="ნაკადის გასაღების მოთხოვნა ვერ მოხერხდა" +TwitchAuth.TwoFactorFail.Text="OBS ვერ უკავშირდება თქვენს Twitch-ანგარიშს. გთხოვთ გადაამოწმოთ, ნამდვილად ჩართული გაქვთ თუ არა ორსაფეხურიანი დადასტურება შესვლისას, თქვენი <a href='https://www.twitch.tv/settings/security'>Twitch-ის უსაფრთხოების პარამეტრებიდან</a>, რაც მოითხოვება ნაკადის გასაშვებად." +RestreamAuth.Channels="Restream‐არხები" Copy.Filters="ფილტრების ასლი" Paste.Filters="ფილტრების ჩასმა" @@ -138,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="შენიშვნა: ეკრანის ფონის (ძირითადი) გაფართოება არაა აუცილებელი გაშვებული ნაკადის ან გადაღებული ვიდეოს გაფართოებას ემთხვეოდეს. ცალკეული ნაკადის/ვიდეოს ზომები შეიძლება შემცირდეს, რესურსების მოხმარების ან ბიტური სიხშირის შესამცირებლად." Basic.AutoConfig.StreamPage="ნაკადის მონაცემები" Basic.AutoConfig.StreamPage.SubTitle="გთხოვთ მიუთითოთ ნაკადის მონაცემები" -Basic.AutoConfig.StreamPage.ConnectAccount="ანგარიშის დაკავშირება (არასავალდებულო)" +Basic.AutoConfig.StreamPage.ConnectAccount="ანგარიშთან დაკავშირება (სასურველია)" Basic.AutoConfig.StreamPage.DisconnectAccount="ანგარიშიდან გამოერთება" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="გსურთ ანგარიშიდან გამოერთება?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="ცვლილება დაუყოვნებლივ აისახება. ნამდვილად გსურთ, ანგარიშიდან გამოერთება?" @@ -239,6 +245,9 @@ ConfirmStop.Title="შეწყდეს ნაკადი?" ConfirmStop.Text="ნამდვილად გსურთ პირდაპირი ეთერის შეწყვეტა?" +ConfirmStopRecord.Title="შეწყდეს ჩაწერა?" +ConfirmStopRecord.Text="ნამდვილად გსურთ ჩაწერის შეწყვეტა?" + ConfirmBWTest.Title="შემოწმდეს ქსელის გამტარუნარიანობა?" ConfirmBWTest.Text="OBS-ისთვის მითითებული გაქვთ ქსელის გამტარუნარიანობის რეჟიმი. ეს რეჟიმი საშუალებას გაძლევთ, შეამოწმოთ ქსელის მუშაობა, თქვენს არხზე პირდაპირ ეთერში გასვლის გარეშე. შემოწმების დასრულებისთანავე, საჭიროა მისი გათიშვა, რომ მაყურებლებმა შეძლონ გაშვებული ნაკადის ხილვა\n\nგსურთ, განაგრძოთ?" @@ -254,6 +263,8 @@ Output.StartReplayFailed="გადახვევის ჩართვა ვერ მოხერხდა" Output.StartFailedGeneric="სიგნალის გაშვება ვერ მოხერხდა. გთხოვთ, შეამოწმეთ აღრიცხვის ფაილი, დამატებითი ინფორმაციისთვის.\n\nშენიშვნა: თუ იყენებთ NVENC ან AMD დამშიფრავებს, დარწმუნდით რომ თქვენი ვიდეოდაფის პროგრამა განახლებულია." +Output.ReplayBuffer.PauseWarning.Title="როცა შეჩერებულია, გადასახვევი მასალა ვერ შეინახება" +Output.ReplayBuffer.PauseWarning.Text="შენიშვნა: უკან გადასახვევი მასალა ვერ შეინახება, როცა ჩაწერა შეჩერებულია." Output.ConnectFail.Title="დაკავშირება ვერ მოხერხდა" Output.ConnectFail.BadPath="არამართებული მისამართი ან დასაკავშირებელი URL ბმული. გთხოვთ, გადაამოწმოთ თქვენი პარამეტრების სისწორე." @@ -322,7 +333,7 @@ ScaleFiltering.Bilinear="ორხაზოვანი" ScaleFiltering.Bicubic="ბიკუბური" ScaleFiltering.Lanczos="Lanczos" -ScaleFiltering.Area="სივრცე" +ScaleFiltering.Area="სივრცითი" Deinterlacing="Deinterlacing" Deinterlacing.Discard="გაუქმება" @@ -443,7 +454,9 @@ Basic.Main.StartReplayBuffer="გადახვევის ჩართვა" Basic.Main.StartStreaming="ნაკადის გაშვება" Basic.Main.StopRecording="ჩაწერის შეწყვეტა" -Basic.Main.StoppingRecording="ჩაწერის შეწყვეტა..." +Basic.Main.PauseRecording="ჩანაწერის შეჩერება" +Basic.Main.UnpauseRecording="ჩანაწერის გაგრძელება" +Basic.Main.StoppingRecording="ჩაწერა წყდება..." Basic.Main.StopReplayBuffer="გადახვევის გამორთვა" Basic.Main.StoppingReplayBuffer="გადახვევა გამოირთვება..." Basic.Main.StopStreaming="ნაკადის შეწყვეტა" @@ -456,7 +469,7 @@ Basic.MainMenu.File="ფაილი (&F)" Basic.MainMenu.File.Export="შენახვა (&E)" Basic.MainMenu.File.Import="შემოტანა (&I)" -Basic.MainMenu.File.ShowRecordings="ჩანაწერების ჩვენება (&R)" +Basic.MainMenu.File.ShowRecordings="ჩანაწერების ნახვა (&R)" Basic.MainMenu.File.Remux="ჩანაწერების გადაფუთვა (&M)" Basic.MainMenu.File.Settings="პარამეტრები (&S)" Basic.MainMenu.File.ShowSettingsFolder="პარამეტრების საქაღალდის ჩვენება" @@ -479,8 +492,8 @@ Basic.MainMenu.Edit.Transform.CopyTransform="გარდაქმნის ასლი" Basic.MainMenu.Edit.Transform.PasteTransform="გარდაქმნის ჩასმა" Basic.MainMenu.Edit.Transform.ResetTransform="გარდაქმნის გაუქმება (&R)" -Basic.MainMenu.Edit.Transform.Rotate90CW="მობრუნება 90 გრადუსით საათის ისრის მიმართ." -Basic.MainMenu.Edit.Transform.Rotate90CCW="მობრუნება 90 გრადუსით საათის ისრის საწ. მიმართ." +Basic.MainMenu.Edit.Transform.Rotate90CW="მობრუნება 90 გრადუსით საათის მიმართ." +Basic.MainMenu.Edit.Transform.Rotate90CCW="მობრუნება 90 გრადუსით საათის საპირ." Basic.MainMenu.Edit.Transform.Rotate180="მობრუნება 180 გრადუსით" Basic.MainMenu.Edit.Transform.FlipHorizontal="თარაზულად შეტრიალება (&H)" Basic.MainMenu.Edit.Transform.FlipVertical="შვეულად შეტრიალება (&V)" @@ -501,6 +514,7 @@ Basic.MainMenu.View.Docks="იერსახის ნაწილები" Basic.MainMenu.View.Docks.ResetUI="იერსახის აღდგენა" Basic.MainMenu.View.Docks.LockUI="იერსახის ჩაკეტვა" +Basic.MainMenu.View.Docks.CustomBrowserDocks="ბრაუზერის მორგებული ნაწილები..." Basic.MainMenu.View.Toolbars.Listboxes="სიები (&L)" Basic.MainMenu.View.SceneTransitions="სცენებს შორის გადასვლები (&C)" Basic.MainMenu.View.StatusBar="მდგომარეობის ზოლი (&S)" @@ -543,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="სტატისტიკის ფანჯრის გახსნა ჩართვისას" Basic.Settings.General.WarnBeforeStartingStream="დადასტურების ფანჯრის ჩვენება ნაკადის გაშვებისას" Basic.Settings.General.WarnBeforeStoppingStream="დადასტურების ფანჯრის ჩვენება ნაკადის შეწყვეტისას" +Basic.Settings.General.WarnBeforeStoppingRecord="დადასტურების ფანჯრის ჩვენება ჩაწერის შეწყვეტისას" Basic.Settings.General.Projectors="გამოსახულების ჩვენება" Basic.Settings.General.HideProjectorCursor="მაჩვენებლის დამალვა ჩვენებებზე" Basic.Settings.General.ProjectorAlwaysOnTop="მიღებული გამოსახულებების სხვა ფანჯრების ზემოთ დატოვება" @@ -590,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="საქაღალდის არჩევა ჩანაწერისთვის" Basic.Settings.Output.SelectFile="ფაილის არჩევა ჩანაწერისთვის" Basic.Settings.Output.EnforceBitrate="ნაკადის გაშვების მომსახურების ბიტური სიხშირის ზღვრების დადგენა" +Basic.Settings.Output.DynamicBitrate="ბიტური სიხშირის ცვალებადობა, ქსელის გადატვირთულობის ასარიდებლად" +Basic.Settings.Output.DynamicBitrate.Beta="ბიტური სიხშირის ცვალებადობა, ქსელის გადატვირთულობის ასარიდებლად (საცდელი)" +Basic.Settings.Output.DynamicBitrate.TT="ქსელის გადატვირთულობის შესამცირებლად კადრების გამოტოვების ნაცვლად, მიმდინარე ბიტური სიხშირის ცვალებადობა.\n\nგაითვალისწინეთ, რომ შედეგად შესაძლოა გაიზარდოს დაყოვნება მაყურებლებისთვის, დატვირთვის უეცარი მატებისას.\nბიტური სიხშირის ვარდნის შემდეგ, აღდგენა რამდენიმე წუთს გასტანს.\n\nამჟამად მხარდაჭერილია მხოლოდ RTMP." Basic.Settings.Output.Mode="გამოტანის რეჟიმი" Basic.Settings.Output.Mode.Simple="მარტივი" Basic.Settings.Output.Mode.Adv="გაფართოებული" Basic.Settings.Output.Mode.FFmpeg="FFmpeg-გამოტანა" Basic.Settings.Output.UseReplayBuffer="გადახვევის შესაძლებლობა" -Basic.Settings.Output.ReplayBuffer.SecondsMax="გადახვევის დასაშვები დრო (წამი)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="გადახვევის დასაშვები დრო" Basic.Settings.Output.ReplayBuffer.MegabytesMax="მეხსიერების დასაშვები მოცულობა (მეგაბაიტებში)" Basic.Settings.Output.ReplayBuffer.Estimate="მეხსიერების მიახლოებითი მოხმარება: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="შეუძლებელია მეხსიერების მიახლოებითი მოხმარების დადგენა. გთხოვთ, მიუთითოთ მეხსიერების დასაშვები ზღვარი." @@ -610,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="უდანაკარგო ხარისხი, მეტისმეტად დიდი ზომის ფაილი" Basic.Settings.Output.Simple.Warn.VideoBitrate="გაფრთხილება: ვიდეონაკადის ბიტურ სიხშირედ მიეთითება %1, რაც წარმოადგენს უმაღლეს დაშვებულ ზღვარს, ნაკადის გაშვების მოცემული მომსახურებისთვის. თუ ნამდვილად გსურთ %1 ბიტურ სიხშირეზე მეტის მიღება, ჩართეთ დაშიფვრის გაფართოებული პარამეტრები და მოხსენით მონიშვნა \"ნაკადის გაშვების მომსახურების ბიტური სიხშირის ზღვრების დადგენას\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="გაფრთხილება: ხმოვანი ნაკადის ბიტურ სიხშირედ მიეთითება %1, რაც წარმოადგენს უმაღლეს დაშვებულ ზღვარს, ნაკადის გაშვების მოცემული მომსახურებისთვის. თუ ნამდვილად გსურთ %1 ბიტურ სიხშირეზე მეტის მიღება, ჩართეთ დაშიფვრის გაფართოებული პარამეტრები და მოხსენით მონიშვნა \"ნაკადის გაშვების მომსახურების ბიტური სიხშირის ზღვრების დადგენას\"." +Basic.Settings.Output.Simple.Warn.CannotPause="შენიშვნა: ჩანაწერის შეჩერება შეუძლებელია, თუ ჩაწერის ხარისხად მითითებულია „გაშვებული ნაკადის შესაბამისი“." Basic.Settings.Output.Simple.Warn.Encoder="გაფრთხილება: გაშვებული ნაკადისგან განსხვავებულ ხარისხში ჩანაწერის დაშიფვრა, ზრდის პროცესორის დატვირთვას, როცა ნაკადის გაშვება და ჩაწერა, ერთდროულად მიმდინარეობს." Basic.Settings.Output.Simple.Warn.Lossless="გაფრთხილება: უდანაკარგო ხარისხის მითითების შემთხვევაში, შეიქმნება მეტისმეტად დიდი ზომის ფაილები! უდანაკარგო ხარისხის ვიდეოს თითოეული წუთის მოცულობამ დისკზე, შესაძლოა 7 გიგაბაიტს გადააჭარბოს, მაღალი გარჩევადობისა და კადრის სიხშირის პირობებში. ხანგრძლივი ჩანაწერებისთვის, უდანაკარგოს არჩევა არაა მიზანშეწონილი, თუ არ გაქვთ საკმარისად დიდი მოცულობის თავისუფალი ადგილი დისკზე." Basic.Settings.Output.Simple.Warn.Lossless.Msg="ნამდვილად გსურთ უდანაკარგო ხარისხის მითითება?" @@ -622,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="ვიდეოს ბიტური სიხშირე" Basic.Settings.Output.AudioBitrate="ხმის ბიტური სიხშირე" Basic.Settings.Output.Reconnect="ხელახლა დაკავშირება ავტომატურად" -Basic.Settings.Output.RetryDelay="გამეორების დაყოვნება (წამი)" +Basic.Settings.Output.RetryDelay="დაყოვნება გამეორებისას" Basic.Settings.Output.MaxRetries="გამეორების დასაშვები რაოდენობა" Basic.Settings.Output.Advanced="დამშიფრავის გაფართოებული პარამეტრების ჩართვა" Basic.Settings.Output.EncoderPreset="დამშიფრავის მზა პარამეტრები" @@ -693,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="ორხაზოვანი (უსწრაფესი, მაგრამ ბუნდოვანი მასშტაბირება)" Basic.Settings.Video.DownscaleFilter.Bicubic="ბიკუბური (მკვეთრი მასშტაბირება, 16 შერჩევა)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (მკვეთრი მასშტაბირება, 32 შერჩევა)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (მკვეთრი მასშტაბირება, 36 შერჩევა)" +Basic.Settings.Video.DownscaleFilter.Area="სივრცე (შეწონილი ჯამი, 4/6/9 შერჩევა)" Basic.Settings.Audio="ხმა" Basic.Settings.Audio.SampleRate="სიხშირე" @@ -707,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="უბრალო" Basic.Settings.Audio.PeakMeterType.TruePeak="ზუსტი (პროცესორის მაღალი მოხმარებით)" Basic.Settings.Audio.MultiChannelWarning.Enabled="ყურადღება: ჩართულია მოცულობითი ხმა." -Basic.Settings.Audio.MultichannelWarning="ნაკადის გაშვებისას გადაამოწმეთ, მომსახურების მომწოდებელი, იძლევა თუ არა მოცულობითი ხმოვანი სიგნალის როგორც მიღების, ასევე მოსმენის შესაძლებლობას. მაგალითად მომსახურებებზე, როგორიცაა Twitch, Facebook 360 Live, Mixer RTMP და Smashcast, სრულადაა მხარდაჭერილი მოცულობითი ხმოვანი სიგნალი. ხოლო Facebook Live და YouTube Live, მიუხედავად იმისა, რომ ორივე იღებს მოცულობით ხმოვან სიგნალს, Facebook Live გარდაქმნის მას სტერეო-სიგნალად, ხოლო YouTube Live უშვებს მხოლოდ ორი არხით.\n\nOBS-ის ხმოვანი ფილტრები თავსებადია მოცულობით ხმოვან სიგნალთან, მაგრამ VST-მოდულის მხარდაჭერა, შესაძლოა არ იყოს უზრუნველყოფილი." +Basic.Settings.Audio.MultichannelWarning="ნაკადის გაშვებისას გადაამოწმეთ, მომსახურების მომწოდებელი, იძლევა თუ არა მოცულობითი ხმოვანი სიგნალის როგორც მიღების, ასევე მოსმენის შესაძლებლობას. მაგალითად მომსახურებებზე, როგორიცაა Facebook 360 Live, Mixer RTMP და Smashcast, სრულადაა მხარდაჭერილი მოცულობითი ხმოვანი სიგნალი. ხოლო Facebook Live და YouTube Live, მიუხედავად იმისა, რომ ორივე იღებს მოცულობით ხმოვან სიგნალს, Facebook Live გარდაქმნის მას სტერეო-სიგნალად, ხოლო YouTube Live უშვებს მხოლოდ ორი არხით.\n\nOBS-ის ხმოვანი ფილტრები თავსებადია მოცულობით ხმოვან სიგნალთან, მაგრამ VST-მოდულის მხარდაჭერა, შესაძლოა არ იყოს უზრუნველყოფილი." Basic.Settings.Audio.MultichannelWarning.Title="ჩაირთოს მოცულობითი ხმოვანი სიგნალი?" Basic.Settings.Audio.MultichannelWarning.Confirm="ნამდვილად გსურთ, ჩართოთ მოცულობითი ხმოვანი სიგნალი?" Basic.Settings.Audio.Devices="მოწყობილობები" @@ -724,7 +744,7 @@ Basic.Settings.Audio.UnknownAudioDevice="[მოწყობილობა არაა დაკავშირებული ან მიუწვდომელია]" Basic.Settings.Audio.Disabled="გამორთული" -Basic.Settings.Advanced="დამატებით" +Basic.Settings.Advanced="დამატებითი" Basic.Settings.Advanced.General.ProcessPriority="უპირატესობა დამუშავებისას" Basic.Settings.Advanced.General.ProcessPriority.High="მაღალი" Basic.Settings.Advanced.General.ProcessPriority.AboveNormal="საშუალოზე მაღალი" @@ -742,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="ნაგულისხმევი" Basic.Settings.Advanced.Audio.DisableAudioDucking="Windows-ის მიერ ხმის დონის დადაბლების არიდება" Basic.Settings.Advanced.StreamDelay="ნაკადის დაყოვნება" -Basic.Settings.Advanced.StreamDelay.Duration="ხანგრძლივობა (წამი)" +Basic.Settings.Advanced.StreamDelay.Duration="ხანგრძლივობა" Basic.Settings.Advanced.StreamDelay.Preserve="მოსაჭრელი წერტილის მომარაგება (დაყოვნების გაზრდა) ხელახლა დაკავშირებისას" Basic.Settings.Advanced.StreamDelay.MemoryUsage="მეხსიერების მიახლოებითი მოხმარება: %1 MB" Basic.Settings.Advanced.Network="ქსელი" Basic.Settings.Advanced.Network.BindToIP="დაკავშირება IP-მისამართზე" Basic.Settings.Advanced.Network.EnableNewSocketLoop="ქსელის ახალი კოდის ჩართვა" Basic.Settings.Advanced.Network.EnableLowLatencyMode="დაყოვნების შემცირება" -Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="სწრაფი ღილაკების გათიშვა, მთავარ ფანჯარაზე გადასვლისას" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="სწრაფი ღილაკების მოქმედება" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="არასდროს გაითიშოს" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="გაითიშოს, მთავარ ფანჯარაზე გადასვლისას" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="გაითიშოს, მთავარი ფანჯრიდან გადასვლისას" Basic.Settings.Advanced.AutoRemux="თვითშეფუთვა mp4-ფაილად" Basic.Settings.Advanced.AutoRemux.MP4="(ჩაწერა mkv-ფაილად)" Basic.AdvAudio="ხმის გაფართოებული პარამეტრები" Basic.AdvAudio.Name="სახელი" Basic.AdvAudio.Volume="ხმის დონე" -Basic.AdvAudio.Mono="ერთ არხში გაერთიანება" +Basic.AdvAudio.Mono="მონო" Basic.AdvAudio.Balance="წონასწორობა" -Basic.AdvAudio.SyncOffset="სინქრონიზაციის გასწორება (მწ)" +Basic.AdvAudio.SyncOffset="სინქრონიზაციის გასწორება" Basic.AdvAudio.Monitoring="ხმის მოსმენა" Basic.AdvAudio.Monitoring.None="მოსმენის გარეშე" Basic.AdvAudio.Monitoring.MonitorOnly="მხოლოდ მოსმენა (უხმო გამოტანა)" @@ -824,6 +847,7 @@ OutputWarnings.NoTracksSelected="უნდა მიუთითოთ ერთი ხმოვანი ბილიკი მაინც" OutputWarnings.MultiTrackRecording="გაფრთხილება: ცალკეული სახის ფაილებში (როგორიცაა FLV), არაა მხარდაჭერილი რამდენიმე ბილიკი, თითოეული ჩაწერისას" OutputWarnings.MP4Recording="გაფრთხილება: MP4/MOV სახით შენახული ჩანაწერები ვეღარ აღდგება, მუშაობის შეწყვეტის შემთხვევაში (მაგ. ლურჯი ეკრანის ამოგდებისას, ძაბვის ვარდნისას და ა.შ.). თუ გსურთ რამდენიმე ხმოვანი ფაილის ჩაწერა, სასურველია ამისთვის გამოიყენოთ MKV და დასრულების შემდეგ გადაფუთოთ MP4/MOV-ფაილად. (ფაილი → ჩანაწერების გადაფუთვა)" +OutputWarnings.CannotPause="შენიშვნა: ჩანაწერის შეჩერება შეუძლებელია, თუ ჩაწერისთვის მითითებულია „(გაშვებული ნაკადის დამშიფრავის გამოყენება)“" FinalScene.Title="სცენის წაშლა" FinalScene.Text="აუცილებელია სულ მცირე ერთ სცენა."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ko-KR.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ko-KR.ini
Changed
@@ -23,7 +23,7 @@ Display="디스플레이" Name="이름" Exit="끝내기" -Mixer="믹서" +Mixer="오디오 믹서" Browse="찾아보기" Mono="모노" Stereo="스테레오" @@ -91,6 +91,10 @@ DockCloseWarning.Title="도킹 가능한 창을 닫는 중입니다" DockCloseWarning.Text="도킹 가능한 창을 닫았습니다. 이 창을 다시 보려면 상단 메뉴에서 보기 -> 독을 확인하세요." +ExtraBrowsers="사용자 임의 브라우저 독" +ExtraBrowsers.Info="이름과 URL을 부여하여 독을 추가할 수 있으며, 작업 후 적용 혹은 닫기 단추를 누르면 됩니다. 언제든지 독을 추가하거나 제거할 수 있습니다." +ExtraBrowsers.DockName="독 이름" + Auth.Authing.Title="인증 처리 중..." Auth.Authing.Text="%1 인증 처리 중, 잠시만 기다려 주세요..." Auth.AuthFailure.Title="인증 실패" @@ -107,6 +111,7 @@ TwitchAuth.Feed="트위치 활동 피드" TwitchAuth.TwoFactorFail.Title="스트림 키를 질의할 수 없었습니다" TwitchAuth.TwoFactorFail.Text="OBS가 사용자의 트위치 계정에 접속할 수 없었습니다. <a href='https://www.twitch.tv/settings/security'>트위치 보안 설정</a> 에서 이중 인증을 거쳐야 방송이 가능합니다." +RestreamAuth.Channels="Restream 채널" Copy.Filters="필터를 복사" Paste.Filters="필터를 붙여넣기" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="참고: 캔버스 (기본) 해상도는 방송 혹은 녹화하려는 해상도와 반드시 같을 필요는 없습니다. 실제 방송/녹화 해상도는 Pc 사양을 낮추거나 비트레이트 제한에 맞추기 위해 이 캔버스 해상도를 기준으로 축소할 수 있습니다." Basic.AutoConfig.StreamPage="방송 정보" Basic.AutoConfig.StreamPage.SubTitle="방송 정보를 입력하세요" -Basic.AutoConfig.StreamPage.ConnectAccount="계정 연결 (필수 아님)" +Basic.AutoConfig.StreamPage.ConnectAccount="계정 연결 (권장)" Basic.AutoConfig.StreamPage.DisconnectAccount="계정 연결끊기" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="해당 계정과 연결을 끊겠습니까?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="이 변경 사항은 즉시 적용됩니다. 정말로 계정과 연결을 중단하겠습니까?" @@ -240,6 +245,9 @@ ConfirmStop.Title="방송 중지?" ConfirmStop.Text="정말로 방송을 중단할까요?" +ConfirmStopRecord.Title="녹화를 중단할까요?" +ConfirmStopRecord.Text="정말로 녹화를 중단하시겠습니까?" + ConfirmBWTest.Title="대역폭을 점검하겠습니까?" ConfirmBWTest.Text="OBS가 대역폭 시험 상태입니다. 방송을 송출하지 않고 네트워크를 점검할 수 있습니다. 시험을 종료해야 시청자가 방송을 볼 수 있습니다.\n\n계속하겠습니까?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="리플레이 버퍼를 시작하지 못했습니다" Output.StartFailedGeneric="출력을 시작하지 못했습니다. 기록 파일을 확인하십시오.\n\n참고: NVENC 혹은 AMD 인코더를 사용하고 있다면 드라이버를 최신 버전으로 유지하십시오." +Output.ReplayBuffer.PauseWarning.Title="일시정지 상태에서는 리플레이를 저장할 수 없습니다" +Output.ReplayBuffer.PauseWarning.Text="경고: 녹화가 일시정지되어 있는 상태에서는 리플레이를 저장할 수 없습니다." Output.ConnectFail.Title="연결에 실패했음" Output.ConnectFail.BadPath="잘못된 경로 혹은 연결 주소입니다. 유효한 값인지 설정을 확인하시기 바랍니다. " @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="리플레이 버퍼 시작" Basic.Main.StartStreaming="방송 시작" Basic.Main.StopRecording="녹화 중단" +Basic.Main.PauseRecording="녹화 일시정지" +Basic.Main.UnpauseRecording="녹화 일시정지 해제" Basic.Main.StoppingRecording="녹화를 중단합니다...." Basic.Main.StopReplayBuffer="리플레이 버퍼 중단" Basic.Main.StoppingReplayBuffer="리플레이 버퍼를 멈추고 있습니다..," @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="독" Basic.MainMenu.View.Docks.ResetUI="사용자 인터페이스 초기화" Basic.MainMenu.View.Docks.LockUI="사용자 인터페이스 잠금" +Basic.MainMenu.View.Docks.CustomBrowserDocks="사용자 임의 브라우저 독..." Basic.MainMenu.View.Toolbars.Listboxes="목록 상자(&L)" Basic.MainMenu.View.SceneTransitions="장면 전환(&C)" Basic.MainMenu.View.StatusBar="상태 표시줄(&S)" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="시작 시 통계 창을 열기" Basic.Settings.General.WarnBeforeStartingStream="방송을 시작할 때 확인 대화 상자 표시" Basic.Settings.General.WarnBeforeStoppingStream="방송을 중단할 때 확인 대화 상자 표시" +Basic.Settings.General.WarnBeforeStoppingRecord="녹화를 중단할 때 확인 대화 상자 표시" Basic.Settings.General.Projectors="프로젝터" Basic.Settings.General.HideProjectorCursor="프로젝터 위 커서 숨기기" Basic.Settings.General.ProjectorAlwaysOnTop="프로젝터를 항상 위로" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="녹화 경로 선택" Basic.Settings.Output.SelectFile="녹화 파일 선택" Basic.Settings.Output.EnforceBitrate="방송 서비스의 비트레이트 제한 적용" +Basic.Settings.Output.DynamicBitrate="네트워크 혼잡 상태를 관리하기 위해서 비트레이트를 유동적으로 변경합니다" +Basic.Settings.Output.DynamicBitrate.Beta="네트워크 혼잡 상태를 관리하기 위해서 비트레이트를 유동적으로 변경합니다 (베타)" +Basic.Settings.Output.DynamicBitrate.TT="혼잡을 줄이기 위해 프레임을 떨어뜨리는 대신 적용 중인 비트레이트를 유동적으로 조절합니다.\n\n중대한 혼잡 상태가 급작스럽게 발생할 때 시청자들이 접하는 화면이 어느정도 지체될 수 있습니다.\n비트레이트가 감소하면 복구하는데 수 분이 걸릴 수 있습니다.\n\n이 기능은 현재 RTMP에서만 지원합니다." Basic.Settings.Output.Mode="출력 방식" Basic.Settings.Output.Mode.Simple="단순" Basic.Settings.Output.Mode.Adv="고급" Basic.Settings.Output.Mode.FFmpeg="FFmpeg 출력" Basic.Settings.Output.UseReplayBuffer="리플레이 버퍼 활성화" -Basic.Settings.Output.ReplayBuffer.SecondsMax="최대 리플레이 시간 (초 단위)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="최대 리플레이 시간" Basic.Settings.Output.ReplayBuffer.MegabytesMax="최대 메모리 (메가바이트 단위)" Basic.Settings.Output.ReplayBuffer.Estimate="예상되는 메모리 사용량: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="메모리 사용량을 계산할 수 없습니다. 최대 메모리 사용량을 설정하세요." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="무손실 품질, 아주 큰 파일 크기" Basic.Settings.Output.Simple.Warn.VideoBitrate="경고: 비디오 비트레이트가 선택한 스트리밍 서비스의 상한선인 %1으로 적용됩니다. %1이상으로 설정하려면 인코더 설정을 고급으로 전환한 다음 \"방송 서비스의 비트레이트 제한 적용\" 설정을 끄십시오." Basic.Settings.Output.Simple.Warn.AudioBitrate="경고: 오디오 비트레이트가 선택한 스트리밍 서비스의 상한선인 %1으로 적용됩니다. %1이상으로 설정하려면 인코더 설정을 고급으로 전환한 다음 \"방송 서비스의 비트레이트 제한 적용\" 설정을 끄십시오." +Basic.Settings.Output.Simple.Warn.CannotPause="경고: 녹화 품질이 \"방송과 동일\"로 설정되어 있으면 녹화를 일시정지할 수 없습니다." Basic.Settings.Output.Simple.Warn.Encoder="경고: 방송과 녹화를 동시에 진행할 때 다음을 주의하십시오. 소프트웨어 인코더로 방송과 다른 품질로 녹화하면 더 많은 CPU 부담이 발생합니다." Basic.Settings.Output.Simple.Warn.Lossless="경고: 무손실 품질로 녹화하면 파일 크기가 엄청나게 커집니다! 해당 설정은 높은 해상도 및 프레임에서 분당 7기가바이트 이상 필요합니다. 따라서 디스크에 아주 큰 공간을 확보하지 않는 이상 장시간 녹화에는 추천하지 않습니다." Basic.Settings.Output.Simple.Warn.Lossless.Msg="정말로 무손실 품질로 녹화하겠습니까?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="비디오 비트레이트" Basic.Settings.Output.AudioBitrate="오디오 비트레이트" Basic.Settings.Output.Reconnect="자동으로 다시 연결" -Basic.Settings.Output.RetryDelay="재접속 간격 (초 단위)" +Basic.Settings.Output.RetryDelay="재시도 지연" Basic.Settings.Output.MaxRetries="최대 재시도 횟수" Basic.Settings.Output.Advanced="고급 인코더 설정 활성화" Basic.Settings.Output.EncoderPreset="인코더 사전설정" @@ -694,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (가장 빠르지만 크기가 변경 시 영상이 흐려짐 )" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (영상 크기 변경을 좀 더 날카롭게 처리, 16 샘플)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (영상 크기 변경을 좀 더 날카롭게 처리, 32 샘플)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (영상 크기 변경을 좀 더 날카롭게 처리, 36 샘플)" +Basic.Settings.Video.DownscaleFilter.Area="영역 (가중치 합, 4/6/9 견본)" Basic.Settings.Audio="오디오" Basic.Settings.Audio.SampleRate="샘플 레이트" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="샘플 피크" Basic.Settings.Audio.PeakMeterType.TruePeak="트루 피크 (더 높은 CPU 자원 요구)" Basic.Settings.Audio.MultiChannelWarning.Enabled="경고: 서라운드 음향이 켜져 있습니다." -Basic.Settings.Audio.MultichannelWarning="방송 중이라면 서비스에서 서라운드 음향에 대한 입력 및 재생을 지원하는지 확인하세요. 트위치, 페이스북 360 라이브, Mixer RTMP, Smashcast 는 해당 기능을 사용할 수 있습니다. 페이스북 Live와 유튜브 Live 서비스는 입력은 할 수 있지만 스테레오로 전환하며 유튜브 Live는 오로지 2채널로만 재생합니다.\n\nOBS 오디오 필터는 서라운드 음향을 지원하지만 VST 플러그인 지원은 보장하지 않습니다." +Basic.Settings.Audio.MultichannelWarning="방송 중이라면 서비스에서 서라운드 음향에 대한 입력 및 재생을 지원하는지 확인하세요. 페이스북 360 라이브, Mixer RTMP, Smashcast 는 해당 기능을 사용할 수 있습니다. 페이스북 Live와 유튜브 Live 서비스는 입력은 할 수 있지만 스테레오로 전환하며 유튜브 Live는 오로지 2채널로만 재생합니다.\n\nOBS 오디오 필터는 서라운드 음향을 지원하지만 VST 플러그인 지원은 보장하지 않습니다." Basic.Settings.Audio.MultichannelWarning.Title="서라운드 음향을 활성화할까요?" Basic.Settings.Audio.MultichannelWarning.Confirm="정말로 서라운드 음향을 사용하겠습니까?" Basic.Settings.Audio.Devices="장치" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="기본값" Basic.Settings.Advanced.Audio.DisableAudioDucking="윈도우 오디오 더킹 비활성화" Basic.Settings.Advanced.StreamDelay="방송 지연" -Basic.Settings.Advanced.StreamDelay.Duration="기간 (초)" +Basic.Settings.Advanced.StreamDelay.Duration="지속 시간" Basic.Settings.Advanced.StreamDelay.Preserve="재접속 시 잘려나간 지점 보관 (지연시간 증가)" Basic.Settings.Advanced.StreamDelay.MemoryUsage="예상되는 메모리 사용량: %1 MB" Basic.Settings.Advanced.Network="네트워크" Basic.Settings.Advanced.Network.BindToIP="IP에 고정" Basic.Settings.Advanced.Network.EnableNewSocketLoop="새로운 네트워크 코드 활성화" Basic.Settings.Advanced.Network.EnableLowLatencyMode="짧은 지연시간 방식 사용" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="단축키 작동 방식" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="단축키를 절대로 비활성화하지 말 것" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="주요 창을 초점으로 둘 때 단축키를 비활성화" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="주요 창을 보고있지 않으면 단축키를 비활성화" Basic.Settings.Advanced.AutoRemux="mp4 형식으로 재다중화" Basic.Settings.Advanced.AutoRemux.MP4="(녹화는 mkv 형식)" Basic.AdvAudio="오디오 고급 설정" Basic.AdvAudio.Name="이름" Basic.AdvAudio.Volume="음량" -Basic.AdvAudio.Mono="모노로 강제 송출" +Basic.AdvAudio.Mono="모노" Basic.AdvAudio.Balance="균형" -Basic.AdvAudio.SyncOffset="싱크 오프셋 (ms)" +Basic.AdvAudio.SyncOffset="싱크 오프셋" Basic.AdvAudio.Monitoring="오디오 모니터링" Basic.AdvAudio.Monitoring.None="모니터링 끔" Basic.AdvAudio.Monitoring.MonitorOnly="모니터링만 (출력은 제거)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="최소 하나의 트랙을 선택해야 합니다" OutputWarnings.MultiTrackRecording="경고: 일부 형식(예를 들어 FLV)은 녹화 하나에 여러 개의 트랙을 지원하지 않습니다" OutputWarnings.MP4Recording="경고: MP4로 녹화를 하면 파일이 마무리가 되지 않았을 때 (예를 들어, 컴퓨터가 급작스럽게 꺼지거나 블루 스크린 오류가 일어나는 경우) 복구할 수 없습니다. 여러 개의 오디오 트랙을 녹음하고 싶다면 MKV 확장자로 녹화 한 뒤 재다중화 작업을 통해 MP4/MOV로 변환하십시오. (파일 → 재다중화 녹화)" +OutputWarnings.CannotPause="경고: 녹화 인코더가 \"(스트림 인코더 사용)\"으로 설정되어 있으면 녹화를 일시정지할 수 없습니다." FinalScene.Title="장면 삭제" FinalScene.Text="적어도 하나의 장면은 존재해야 합니다."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ku-TR.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ku-TR.ini
Changed
@@ -23,7 +23,6 @@ Display="پیشاندراو" Name="ناو" Exit="دهرچوون" -Mixer="میکسەر" Browse="هێنان" Mono="یەک بڵندگۆ" Stereo="دوو بڵندگۆ" @@ -55,6 +54,7 @@ + Auth.Chat="گفتوگۆکردن" Copy.Filters="لەبەرگرتنەوەی فلتەرەکان" @@ -89,6 +89,7 @@ + ConfirmExit.Title="دهرچوون لە OBS"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/lt-LT.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/lt-LT.ini
Changed
@@ -23,7 +23,6 @@ Display="Ekranas" Name="Vardas" Exit="Išeiti" -Mixer="Mikseris" Browse="Naršyti" Mono="Mono" Stereo="Stereo" @@ -66,6 +65,7 @@ + QuickTransitions.SwapScenes="Sukeisti Peržiūros/Išvesties scenas po Perėjimo" QuickTransitions.SwapScenesTT="Sukeičia peržiūros ir išvesties scenas po perėjimo įvykdymo (jei originali išvesties scena vis dar egzistuoja).\nTai neatšauks jokių pakeitimų kurie galima buvo atlikti originalioje išvesties scenoje." QuickTransitions.DuplicateScene="Dubliuoti Sceną" @@ -98,6 +98,7 @@ ConfirmStop.Text="Ar esate įsitikinęs, kad norite stabdyti transliavimą?" + ConfirmExit.Title="Išeiti iš OBS?" ConfirmExit.Text="OBS metu yra aktyvus. Visos transliacijos/įrašymai bus išjungti. Ar tikrai norite išeiti?" @@ -294,7 +295,6 @@ Basic.Settings.Advanced.Video.ColorRange.Full="Pilnas" Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Numatytas" Basic.Settings.Advanced.StreamDelay="Srauto Vėlavimas" -Basic.Settings.Advanced.StreamDelay.Duration="Trukmė (sekundėmis)" Basic.Settings.Advanced.StreamDelay.Preserve="Išsaugoti apkarpymo tašką (padidina vėlavimą) įrašinėjant" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Numatomas atminties naudojimas: %1 MB" Basic.Settings.Advanced.Network="Tinklas"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/mn-MN.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/mn-MN.ini
Changed
@@ -23,7 +23,6 @@ Display="Харагдах байдал" Name="Нэр" Exit="Гарах" -Mixer="Холигч" Browse="Хайх" Mono="Моно" Stereo="Стерео" @@ -66,6 +65,7 @@ + BandwidthTest.Region="Бүс нутаг" BandwidthTest.Region.US="Нэгдсэн Улс" BandwidthTest.Region.EU="Европ" @@ -119,6 +119,7 @@ ConfirmStop.Title="Цацалтыг зогсоох?" + ConfirmExit.Title="OBS-ийг хаах" ConfirmRemove.Title="Хасалтыг батлах"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ms-MY.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ms-MY.ini
Changed
@@ -23,7 +23,6 @@ Display="Paparan" Name="Nama" Exit="Keluar" -Mixer="Pengadun suara" Browse="Cari" Mono="Mono" Stereo="Stereo" @@ -66,6 +65,7 @@ + BandwidthTest.Region.EU="Eropah" BandwidthTest.Region.Asia="Asia" BandwidthTest.Region.Other="Lain-lain" @@ -121,6 +121,7 @@ ConfirmStop.Text="Adakah anda pasti anda mahu menghentikan 'stream'?" + ConfirmExit.Title="Tutup OBS?" ConfirmExit.Text="OBS kini sedang aktif. Semua 'stream'/rakaman akan ditutup. Adakah anda pasti anda mahu tutup(OBS)?" @@ -367,7 +368,6 @@ Basic.Settings.Output.VideoBitrate="Nilai Bit Video" Basic.Settings.Output.AudioBitrate="Nilai Bit Audio" Basic.Settings.Output.Reconnect="Sambung semula secara automatik" -Basic.Settings.Output.RetryDelay="Kelewatan Percubaan (saat)" Basic.Settings.Output.MaxRetries="Cubaan Maksimum" Basic.Settings.Output.Adv.AudioTrack="Trek Audio"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/nb-NO.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/nb-NO.ini
Changed
@@ -23,7 +23,7 @@ Display="Skjerm" Name="Navn" Exit="Avslutt" -Mixer="Mikser" +Mixer="Lydmikser" Browse="Bla gjennom" Mono="Mono" Stereo="Stereo" @@ -91,6 +91,7 @@ DockCloseWarning.Title="Lukker festbart vindu" DockCloseWarning.Text="Du stengte nettopp et festbart vindu. Hvis du vil vise det igjen, kan du gå til Vis → Festede elementer i menylinjen." + Auth.Authing.Title="Autentiserer..." Auth.Authing.Text="Autentiserer med %1, vennligst vent..." Auth.AuthFailure.Title="Autentiseringsfeil" @@ -139,7 +140,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="NB: Oppløsningen på lerretet er ikke nødvendigvis den samme oppløsningen som du vil kringkaste eller ta opp med. Den faktiske kringkastings- eller opptaks-oppløsningen kan bli nedskalert fra størrelsen på lerretet for å redusere ressursbruken eller bitfrekvensen." Basic.AutoConfig.StreamPage="Strømmens informasjon" Basic.AutoConfig.StreamPage.SubTitle="Vennligst skriv inn strømmens informasjon" -Basic.AutoConfig.StreamPage.ConnectAccount="Koble til med konto (valgfritt)" +Basic.AutoConfig.StreamPage.ConnectAccount="Koble til med konto (anbefalt)" Basic.AutoConfig.StreamPage.DisconnectAccount="Koble fra kontoen" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Vil du koble fra kontoen?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Endringen vil bli benyttet umiddelbart. Er du sikker på at du vil koble fra kontoen din?" @@ -240,6 +241,8 @@ ConfirmStop.Title="Vil du avslutte sendingen?" ConfirmStop.Text="Er du sikker på at du vil avslutte sendingen?" +ConfirmStopRecord.Title="Vil du stoppe opptaket?" + ConfirmBWTest.Title="Start bredbåndstest?" ConfirmBWTest.Text="Du har konfigurert OBS i bredbåndstest-modus. Denne modusen tillater nettverkstesting uten at din kanal går live. Du må deaktivere modusen når du er ferdig å teste for at seere vil kunne se din strøm. \n\nVil du fortsette?" @@ -444,6 +447,8 @@ Basic.Main.StartReplayBuffer="Start omspillingsbuffer" Basic.Main.StartStreaming="Start Strømming" Basic.Main.StopRecording="Stopp Opptak" +Basic.Main.PauseRecording="Sett opptaket på pause" +Basic.Main.UnpauseRecording="Fortsett opptaket" Basic.Main.StoppingRecording="Stanser innspilling…" Basic.Main.StopReplayBuffer="Stopp omspillingsbufferen" Basic.Main.StoppingReplayBuffer="Stopper omspillingsbufferen..." @@ -596,7 +601,6 @@ Basic.Settings.Output.Mode.Adv="Avansert" Basic.Settings.Output.Mode.FFmpeg="FFmpeg-utgang" Basic.Settings.Output.UseReplayBuffer="Aktiver omspillingsbufferen" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maksimal omspillingstid (i sekunder)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maksimal minnebruk (Megabytes)" Basic.Settings.Output.ReplayBuffer.Estimate="Anslått minnebruk: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Kan ikke beregne minnebruk. Vennligst sett maksimalt minnebrukgrense." @@ -623,7 +627,6 @@ Basic.Settings.Output.VideoBitrate="Bilde-bitfrekvens" Basic.Settings.Output.AudioBitrate="Lyd-bitfrekvens" Basic.Settings.Output.Reconnect="Koble automatisk til på nytt" -Basic.Settings.Output.RetryDelay="Opphold mellom tilkoblingsforsøk (sekunder)" Basic.Settings.Output.MaxRetries="Høyst antall tilkoblingsforsøk" Basic.Settings.Output.Advanced="Aktiver avanserte koderinnstillinger" Basic.Settings.Output.EncoderPreset="Kodingsinstillinger" @@ -694,7 +697,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilineær (raskest, men uskarp ved skalering)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bikubisk (skjerpet skalering, 16 prøver)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (skjerpet skalering, 32 prøver)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (skjerpet skalering, 36 prøver)" Basic.Settings.Audio="Lyd" Basic.Settings.Audio.SampleRate="Samplingsfrekvens" @@ -708,7 +711,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Samplingstoppunkt" Basic.Settings.Audio.PeakMeterType.TruePeak="Ekte toppunkt (Høyere CPU-bruk)" Basic.Settings.Audio.MultiChannelWarning.Enabled="Advarsel: Surroundlyd er aktivert." -Basic.Settings.Audio.MultichannelWarning="Hvis du strømmer, sjekk om strømmetjenesten din støtter både surround-lydinnføring og surround-lydavspilling. Twitch, Facebook 360 Live, Mixer RTMP, og Smashcast er eksempler hvor surroundlyd er full støttet. Selv om Facebook Live og YouTube Live begge støtter surround-innføring, nedmikser Facebook Live det ned til Stereo, og YouTube Live spiller bare av to kanaler.\n\nOBS-lydfiltre er kompatible med surroundlyd, selv om VST-tilleggsstøtte ikke er garantert." +Basic.Settings.Audio.MultichannelWarning="Hvis du strømmer, sjekk om strømmetjenesten din støtter både surround-lydinnføring og surround-lydavspilling. Facebook 360 Live, Mixer RTMP, og Smashcast er eksempler hvor surroundlyd er full støttet. Selv om Facebook Live og YouTube Live begge støtter surround-innføring, nedmikser Facebook Live det ned til Stereo, og YouTube Live spiller bare av to kanaler.\n\nOBS-lydfiltre er kompatible med surroundlyd, selv om VST-tilleggsstøtte ikke er garantert." Basic.Settings.Audio.MultichannelWarning.Title="Vil du aktivere surround-lyd?" Basic.Settings.Audio.MultichannelWarning.Confirm="Er du sikker på at du vil aktivere surround-lyd?" Basic.Settings.Audio.Devices="Enheter" @@ -743,7 +746,7 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Standard" Basic.Settings.Advanced.Audio.DisableAudioDucking="Deaktiver Windows-lyddukking" Basic.Settings.Advanced.StreamDelay="Direktesendingsforsinkelse" -Basic.Settings.Advanced.StreamDelay.Duration="Varighet (sekunder)" +Basic.Settings.Advanced.StreamDelay.Duration="Varighet" Basic.Settings.Advanced.StreamDelay.Preserve="Bevar avkuttingspunktet (øk forsinkelse) ved tilbakekobling" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Anslått minnebruk: %1 MB" Basic.Settings.Advanced.Network="Nettverk" @@ -757,9 +760,9 @@ Basic.AdvAudio="Avanserte lydinnstillinger" Basic.AdvAudio.Name="Navn" Basic.AdvAudio.Volume="Volum" -Basic.AdvAudio.Mono="Nedmiks til mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balanse" -Basic.AdvAudio.SyncOffset="Synkroniseringsforskyvning (ms)" +Basic.AdvAudio.SyncOffset="Synkroniser avvik" Basic.AdvAudio.Monitoring="Hør på kilde" Basic.AdvAudio.Monitoring.None="Ikke hør kilden" Basic.AdvAudio.Monitoring.MonitorOnly="Kun hør kilden (Demp utdataen)"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/nl-NL.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/nl-NL.ini
Changed
@@ -23,7 +23,7 @@ Display="Beeldscherm" Name="Naam" Exit="Afsluiten" -Mixer="Mixer" +Mixer="Audio Mixer" Browse="Bladeren" Mono="Mono" Stereo="Stereo" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Dokbaar Venster Sluiten" DockCloseWarning.Text="Je hebt net een dokbaar venster gesloten. Als je het opnieuw wilt zien, gebruik dan het menu Beeld → Docks in de menubalk." +ExtraBrowsers="Aangepaste Browser Docks" +ExtraBrowsers.Info="Voeg docks toe door ze een naam en URL te geven, klik vervolgens op Toepassen of Sluiten om de docks te openen. U kunt op elk moment docks toevoegen of verwijderen." +ExtraBrowsers.DockName="Dock Naam" + Auth.Authing.Title="Authenticeren..." Auth.Authing.Text="Authenticeren met %1, even geduld a.u.b..." Auth.AuthFailure.Title="Verificatiefout" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Twitch activiteitenfeed" TwitchAuth.TwoFactorFail.Title="Kon stream key niet opvragen" TwitchAuth.TwoFactorFail.Text="OBS kon geen verbinding maken met uw Twitch account. Zorg ervoor dat er twee-factor authenticatie is ingesteld in uw <a href='https://www.twitch.tv/settings/security'>Twitch beveiligingsinstellingen</a>, omdat dit nodig is om te streamen." +RestreamAuth.Channels="Restream Kanalen" Copy.Filters="Kopieer Filters" Paste.Filters="Plak filters" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Let op: de basisresolutie (canvas) hoeft niet gelijk te zijn als de resolutie waarmee je streamt of opneemt. Je stream/opnameresolutie kan omlaag bijgeschaald worden vanaf de basisresolutie om de belasting op de computer of de benodigde bitrate te verlagen." Basic.AutoConfig.StreamPage="Stream-informatie" Basic.AutoConfig.StreamPage.SubTitle="Voer alstublieft uw stream-informatie in" -Basic.AutoConfig.StreamPage.ConnectAccount="Account verbinden (optioneel)" +Basic.AutoConfig.StreamPage.ConnectAccount="Verbind Account (aanbevolen)" Basic.AutoConfig.StreamPage.DisconnectAccount="Account loskoppelen" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Account loskoppelen?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Deze wijziging zal onmiddellijk van toepassing zijn. Weet u zeker dat u uw account wilt loskoppelen?" @@ -240,6 +245,9 @@ ConfirmStop.Title="Stop de Stream?" ConfirmStop.Text="Weet je zeker dat je de stream wil stoppen?" +ConfirmStopRecord.Title="Opname Stoppen?" +ConfirmStopRecord.Text="Bent u zeker dat u de opname wilt stoppen?" + ConfirmBWTest.Title="Bandbreedte test starten?" ConfirmBWTest.Text="U heeft OBS geconfigureerd in bandbreedte test modus. Deze modus maakt het mogelijk om netwerk te testen zonder live te gaan. Zodra u klaar bent met testen, moet u deze uitschakelen om de kijkers in staat te stellen uw stream te zien.\n\nWilt u doorgaan?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="Het starten van de replay buffer is mislukt" Output.StartFailedGeneric="Het starten van de uitvoer is mislukt. Controleer de logbestanden voor meer informatie.\n\nLet op: Als je gebruik maakt van de NVENC of AMD encoders, controleer of de drivers up to date zijn." +Output.ReplayBuffer.PauseWarning.Title="Herhalingen kunnen niet worden opgeslagen tijdens het pauzeren" +Output.ReplayBuffer.PauseWarning.Text="Waarschuwing: Herhalingen kunnen niet worden opgeslagen tijdens het pauzeren van de opname." Output.ConnectFail.Title="Kan geen verbinding maken" Output.ConnectFail.BadPath="Ongeldig pad of verbindings-url. Controleer a.u.b. of je instellingen geldig zijn." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Start Replay Buffer" Basic.Main.StartStreaming="Stream Starten" Basic.Main.StopRecording="Opname Stoppen" +Basic.Main.PauseRecording="Opname pauzeren" +Basic.Main.UnpauseRecording="Opname vervolgen" Basic.Main.StoppingRecording="Opname Stoppen..." Basic.Main.StopReplayBuffer="Stop Replay Buffer" Basic.Main.StoppingReplayBuffer="Replay Buffer aan het stoppen..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="Docks" Basic.MainMenu.View.Docks.ResetUI="Herstel UI" Basic.MainMenu.View.Docks.LockUI="Zet UI Vast" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Aangepaste Browser Docks..." Basic.MainMenu.View.Toolbars.Listboxes="&Lijsten" Basic.MainMenu.View.SceneTransitions="S&cène-overgangen" Basic.MainMenu.View.StatusBar="&Statusbalk" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Open statistieken bij het opstarten" Basic.Settings.General.WarnBeforeStartingStream="Laat bevestigingsvenster zien bij het starten van streams" Basic.Settings.General.WarnBeforeStoppingStream="Laat bevestiginsvenster zien bij het stoppen van streams" +Basic.Settings.General.WarnBeforeStoppingRecord="Laat bevestigingsvenster zien bij het stoppen van opnames" Basic.Settings.General.Projectors="Projectoren" Basic.Settings.General.HideProjectorCursor="Verberg cursor boven projectors" Basic.Settings.General.ProjectorAlwaysOnTop="Houd projectoren altijd bovenaan" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Selecteer Opnamemap" Basic.Settings.Output.SelectFile="Selecteer Opnamebestand" Basic.Settings.Output.EnforceBitrate="Forceer bandbreedtelimieten van streaming dienst" +Basic.Settings.Output.DynamicBitrate="Dynamisch wijzigen van de bitrate om congestie te beheren" +Basic.Settings.Output.DynamicBitrate.Beta="Dynamisch wijzigen van de bitrate om congestie te beheren (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="In plaats van frames te laten vallen om congestie te verminderen, verandert de bitrate dynamisch à la minute.\n\nMerk op dat dit de vertraging voor kijkers kan verhogen als er significante plotselinge congestie optreedt.\nAls de bitrate daalt, kan het tot een paar minuten duren om het te herstellen.\n\nMomenteel wordt het alleen ondersteund voor RTMP." Basic.Settings.Output.Mode="Uitvoermodus" Basic.Settings.Output.Mode.Simple="Simpel" Basic.Settings.Output.Mode.Adv="Geavanceerd" Basic.Settings.Output.Mode.FFmpeg="FFmpeg-uitvoer" Basic.Settings.Output.UseReplayBuffer="Replay Buffer Inschakelen" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximale Replay-tijd (Seconden)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximale herhalingstijd" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maximale hoeveelheid geheugen (Megabytes)" Basic.Settings.Output.ReplayBuffer.Estimate="Geschat geheugengebruik: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Kan geheugengebruik niet inschatten. Stel een limiet in op het geheugengebruik." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Lossless Kwaliteit, Enorm Grote Bestandsgrootte" Basic.Settings.Output.Simple.Warn.VideoBitrate="Waaschuwing: De video bitrate zal worden ingesteld op %1, dit is de bovengrens van de huidige streaming dienst. Als je zeker weet dat je hoger wil gaan dan %1, schakel dan de geavanceerde encoder-opties in en vink de optie \"Forceer bandbreedtelimieten van streaming dienst\" uit." Basic.Settings.Output.Simple.Warn.AudioBitrate="Waaschuwing: De audio bitrate zal worden ingesteld op %1, dit is de bovengrens van de huidige streaming dienst. Als je zeker weet dat je hoger wil gaan dan %1, schakel dan de geavanceerde encoder-opties in en vink de optie \"Forceer bandbreedtelimieten van streaming dienst\" uit." +Basic.Settings.Output.Simple.Warn.CannotPause="Waarschuwing: Opnames kunnen niet worden onderbroken als de opnamekwaliteit is ingesteld op \"Hetzelfde als stream\"." Basic.Settings.Output.Simple.Warn.Encoder="Waarschuwing: Opname met een software-encoder op een andere kwaliteit dan de stream vergt extra cpu-gebruik als je zowel aan het streamen en aan het opnemen bent." Basic.Settings.Output.Simple.Warn.Lossless="Waarschuwing: Lossless kwaliteit genereert erg grote bestanden! Lossless kwaliteit kan tot wel 7 GB aan schijfruimte per minuut gebruiken bij hoge resoluties en framerates. Lossless kwaliteit is niet aanbevolen voor lange opnames tenzij er een grote hoeveelheid schijfruimte beschikbaar is." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Weet je zeker dat je lossless kwaliteit wilt gebruiken?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Video Bitrate" Basic.Settings.Output.AudioBitrate="Audio Bitrate" Basic.Settings.Output.Reconnect="Automatisch Opnieuw Verbinden" -Basic.Settings.Output.RetryDelay="Opnieuw proberen na (seconden)" +Basic.Settings.Output.RetryDelay="Vertraging nieuwe poging" Basic.Settings.Output.MaxRetries="Maximaal aantal pogingen" Basic.Settings.Output.Advanced="Geavanceerde Encoderinstellingen Inschakelen" Basic.Settings.Output.EncoderPreset="Encoder Preset" @@ -694,7 +712,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (Snelste, maar wazig bij schalen)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (Scherper schalen, 16 samples)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Scherper schalen, 32 samples)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Scherper schalen, 36 samples)" Basic.Settings.Audio="Audio" Basic.Settings.Audio.SampleRate="Sample Rate" @@ -708,7 +726,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Sample piek" Basic.Settings.Audio.PeakMeterType.TruePeak="True piek (hogere CPU-gebruik)" Basic.Settings.Audio.MultiChannelWarning.Enabled="Waarschuwing: Surround sound audio is ingeschakeld." -Basic.Settings.Audio.MultichannelWarning="Als je streamt, controleer dan of je streaming service zowel surround sound ingest als surround sound afspelen ondersteunt. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast zijn voorbeelden waar surround sound volledig ondersteund is. Alhoewel Facebook Live en Youtube Live beide surround ingest ondersteunen, downmixt Facebook Live het naar stereo, terwijl Youtube Live slechts twee kanalen afspeelt.\n\nOBS audio filters kunnen overweg met surround sound, maar ondersteuning bij VST plugins is niet gegarandeerd." +Basic.Settings.Audio.MultichannelWarning="Als je streamt, controleer dan of je streaming service zowel surround sound ingest als surround sound afspelen ondersteunt. Facebook 360 Live, Mixer RTMP, Smashcast zijn voorbeelden waar surround sound volledig ondersteund is. Alhoewel Facebook Live en Youtube Live beide surround ingest ondersteunen, downmixt Facebook Live het naar stereo, terwijl Youtube Live slechts twee kanalen afspeelt.\n\nOBS audio filters kunnen overweg met surround sound, maar ondersteuning bij VST plugins is niet gegarandeerd." Basic.Settings.Audio.MultichannelWarning.Title="Surround sound audio inschakelen?" Basic.Settings.Audio.MultichannelWarning.Confirm="Weet je zeker dat je surround sound audio wil inschakelen?" Basic.Settings.Audio.Devices="Apparaten" @@ -743,23 +761,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Standaard" Basic.Settings.Advanced.Audio.DisableAudioDucking="Schakel Windows audio ducking uit" Basic.Settings.Advanced.StreamDelay="Streamvertraging" -Basic.Settings.Advanced.StreamDelay.Duration="Duur (seconden)" +Basic.Settings.Advanced.StreamDelay.Duration="Duur" Basic.Settings.Advanced.StreamDelay.Preserve="Hervat op het eindpunt (verhoog vertraging) bij opnieuw verbinden" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Geschat Geheugengebruik: %1 MB" Basic.Settings.Advanced.Network="Netwerk" Basic.Settings.Advanced.Network.BindToIP="Bind aan IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Schakel nieuwe netwerkcode in" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Lage latency modus" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Sneltoets Focus Gedrag" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Nooit sneltoetsen uitschakelen" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Hotkeys uitschakelen wanneer hoofdvenster in focus is" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Schakel sneltoetsen uit wanneer hoofdvenster niet in focus is" Basic.Settings.Advanced.AutoRemux="Remux automatisch naar mp4" Basic.Settings.Advanced.AutoRemux.MP4="(neem op als mvk)" Basic.AdvAudio="Geavanceerde Audioinstellingen" Basic.AdvAudio.Name="Naam" Basic.AdvAudio.Volume="Volume" -Basic.AdvAudio.Mono="Downmixen naar Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balans" -Basic.AdvAudio.SyncOffset="Sync Offset (ms)" +Basic.AdvAudio.SyncOffset="Sync Offset" Basic.AdvAudio.Monitoring="Audio monitoring" Basic.AdvAudio.Monitoring.None="Niet monitoren" Basic.AdvAudio.Monitoring.MonitorOnly="Alleen monitoren (uitvoer gedempt)" @@ -825,6 +846,7 @@ OutputWarnings.NoTracksSelected="Selecteer a.u.b. ten minste een track" OutputWarnings.MultiTrackRecording="Waarschuwing: Sommige formaten (zoals FLV) bieden geen ondersteuning voor meerdere tracks per opname" OutputWarnings.MP4Recording="Waarschuwing: Opnames opgeslagen als MP4/MOV zijn niet te herstellen als de opname niet correct afgerond kan worden (bijvoorbeeld door BSOD's, stroomuitval). Als je wil opnemen met meerdere audiotracks gebruik dan bij voorkeur MKV en remux de opname naar MP4/MOV (Bestand → Remux opnames)" +OutputWarnings.CannotPause="Waarschuwing: Opnames kunnen niet worden gepauzeerd als de opname encoder is ingesteld op \"(Gebruik stream encoder)\"" FinalScene.Title="Verwijder scène" FinalScene.Text="Er moet tenminste één scène zijn."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/nn-NO.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/nn-NO.ini
Changed
@@ -23,21 +23,25 @@ Display="Skjerm" Name="Namn" Exit="Avslutt" -Mixer="Blandar" Browse="Bla gjennom" Mono="Mono" Stereo="Stereo" DroppedFrames="Slopne bilete %1 (%2%)" StudioProgramProjector="Fullskjermframvisar (program)" PreviewProjector="Fullskjermframvisar (førehandsvising)" +SceneProjector="Fullskjermframvisar (Scene)" +SourceProjector="Fullskjermframvisar (Kjelde)" MultiviewProjector="Fleirvising (Fullskjerm)" MultiviewWindowed="Fleirvising (i vindauge)" Clear="Tøm" Show="Vis" Hide="Skjul" +UnhideAll="Vis alle" Untitled="Utan namn" New="Ny" Enable="Aktiver" +DisableOSXVSync="Slå av OSX V-Sync" +ResetOSXVSyncOnExit="Tilbakestill OSX V-Sync når du avsluttar" Left="Venstre" Right="Høgre" Top="Topp" @@ -62,6 +66,7 @@ + BandwidthTest.Region="Region" BandwidthTest.Region.EU="Europa" BandwidthTest.Region.Asia="Asia" @@ -109,6 +114,7 @@ ConfirmStop.Title="Stoppe straumen?" + ConfirmExit.Title="Avslutt OBS?"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/pa-IN.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/pa-IN.ini
Changed
@@ -21,7 +21,6 @@ Display="ਸਕ੍ਰੀਨ" Name="ਨਾਮ" Exit="ਬੰਦ ਕਰੋ" -Mixer="ਆਡੀਓ ਮਿਲਾਓ" Browse="ਖੋਜ ਕਰੋ" @@ -116,3 +115,5 @@ + +
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/pl-PL.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/pl-PL.ini
Changed
@@ -23,7 +23,7 @@ Display="Ekran" Name="Nazwa" Exit="Wyjście" -Mixer="Mikser" +Mixer="Mikser dźwięku" Browse="Przeglądaj" Mono="Mono" Stereo="Stereo" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Zamykanie dokowalnego okna" DockCloseWarning.Text="Zostało zamknięte dokowalne okno/panel. Jeżeli chcesz ponownie je pokazać, wybierz Widok → Panele z głównego menu." +ExtraBrowsers="Panele przeglądarki" +ExtraBrowsers.Info="Dodaj panele określając ich nazwę oraz adres URL a następnie kliknij Zastosuj lub Zamknij by otworzyć je. Panele można dodawać i usuwać w każdej chwili." +ExtraBrowsers.DockName="Nazwa panelu" + Auth.Authing.Title="Uwierzytelnianie..." Auth.Authing.Text="Proszę czekać. Trwa uwierzytelnianie w %1..." Auth.AuthFailure.Title="Błąd uwierzytelnienia" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Lista aktywności Twitch" TwitchAuth.TwoFactorFail.Title="Nie można pobrać klucza strumienia" TwitchAuth.TwoFactorFail.Text="Powiązanie Twojego konta Twitch w OBS nie udało się. Sprawdź, czy masz włączone uwierzytelnianie dwuskładnikowe w <a href='https://www.twitch.tv/settings/security'>ustawieniach bezpieczeństwa Twitcha</a>. Wymagane jest to do streamowania przez tę platformę." +RestreamAuth.Channels="Kanały Restream" Copy.Filters="Kopiuj filtry" Paste.Filters="Wklej filtry" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Rozdzielczość bazowa niekoniecznie musi być rozdzielczością wynikowego nagrania lub streamu. Ta druga może być efektem skalowania w dół w celu zmniejszenia wymagań poziomu przepływności lub dostępności zasobów potrzebnych do kompresji." Basic.AutoConfig.StreamPage="Informacja o streamie" Basic.AutoConfig.StreamPage.SubTitle="Podaj informacje o streamie" -Basic.AutoConfig.StreamPage.ConnectAccount="Połącz konto (opcjonalne)" +Basic.AutoConfig.StreamPage.ConnectAccount="Podłącz konto (zalecane)" Basic.AutoConfig.StreamPage.DisconnectAccount="Odłącz konto" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Odłączyć konto?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Ta zmiana zostanie zastosowana natychmiast. Czy na pewno chcesz odłączyć konto?" @@ -240,6 +245,9 @@ ConfirmStop.Title="Zatrzymać streamowanie?" ConfirmStop.Text="Czy na pewno chcesz uruchomić streamowanie?" +ConfirmStopRecord.Title="Zatrzymać nagrywanie?" +ConfirmStopRecord.Text="Czy na pewno chcesz zatrzymać nagrywanie?" + ConfirmBWTest.Title="Nadawanie w trybie testu przepustowości" ConfirmBWTest.Text="OBS skonfigurowany jest w trybie testu przepustowości. Tryb ten pozwala na test połączenia sieciowego bez streamowania \"na żywo\". Po zakończeniu testów wyłącz tryb, aby móc streamować \"na żywo\".\n\nCzy chcesz kontynuować?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="Nie udało się rozpocząć nagrywania powtórek" Output.StartFailedGeneric="Nie udało się uruchomić wyjścia. Sprawdź szczegóły w plikach dziennika.\n\nUwaga: Sprawdź, czy posiadasz aktualne sterowniki karty graficznej, jeżeli używasz enkodera NVENC lub AMD." +Output.ReplayBuffer.PauseWarning.Title="Nie można zapisać powtórek podczas pauzy nagrywania" +Output.ReplayBuffer.PauseWarning.Text="Ostrzeżenie: Powtórki nie mogą być zapisane, gdy nagrywanie jest spauzowane." Output.ConnectFail.Title="Nie udało się połączyć" Output.ConnectFail.BadPath="Nieprawidłowa ścieżka lub adres URL połączenia. Sprawdź poprawność ustawień." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Rozpocznij nagrywanie powtórek" Basic.Main.StartStreaming="Rozpocznij stream" Basic.Main.StopRecording="Zatrzymaj nagrywanie" +Basic.Main.PauseRecording="Pauzuj nagrywanie" +Basic.Main.UnpauseRecording="Wznów nagrywanie" Basic.Main.StoppingRecording="Zatrzymywanie nagrywania..." Basic.Main.StopReplayBuffer="Zatrzymaj nagrywanie powtórek" Basic.Main.StoppingReplayBuffer="Zatrzymywanie nagrywania powtórek..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="Panele" Basic.MainMenu.View.Docks.ResetUI="Przywróć domyślny interfejs" Basic.MainMenu.View.Docks.LockUI="Zablokuj interfejs" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Panele przeglądarki..." Basic.MainMenu.View.Toolbars.Listboxes="Panele kontrolne &list elementów" Basic.MainMenu.View.SceneTransitions="Efekty przejś&cia scen" Basic.MainMenu.View.StatusBar="Pasek &stanu" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Otwórz statystyki przy starcie aplikacji" Basic.Settings.General.WarnBeforeStartingStream="Pokaż komunikat potwierdzenia uruchomienia streamowania" Basic.Settings.General.WarnBeforeStoppingStream="Pokaż komunikat potwierdzenia zatrzymania streamowania" +Basic.Settings.General.WarnBeforeStoppingRecord="Pokaż komunikat potwierdzenia zatrzymania nagrywania" Basic.Settings.General.Projectors="Projektory" Basic.Settings.General.HideProjectorCursor="Ukryj kursor podglądu na pełnym ekranie" Basic.Settings.General.ProjectorAlwaysOnTop="Podgląd na pełnym ekranie zawsze na wierzchu" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Wybierz katalog nagrywania" Basic.Settings.Output.SelectFile="Wybierz plik nagrania" Basic.Settings.Output.EnforceBitrate="Wymuś limity przepływności wybranego serwisu" +Basic.Settings.Output.DynamicBitrate="Dynamicznie zmień bitrate by zapobiec zapychaniu łącza" +Basic.Settings.Output.DynamicBitrate.Beta="Dynamicznie zmień bitrate by zapobiec zapychaniu łącza (beta)" +Basic.Settings.Output.DynamicBitrate.TT="Zamiast odrzucać klatki przy zapchanym łączu dynamicznie zmienia bitrate enkodowania.\n\nW przypadku dużego i nagłego przytkania łącza zwiększa to opóźnienie streamu dla oglądających.\nPo zmniejszeniu bitrate, jego powrót do normalnych wartości może potrwać kilka minut.\n\nMechanizm obsługiwany jest obecnie jedynie przy protokole RTMP." Basic.Settings.Output.Mode="Tryb wyjścia" Basic.Settings.Output.Mode.Simple="Proste" Basic.Settings.Output.Mode.Adv="Zaawansowane" Basic.Settings.Output.Mode.FFmpeg="Wyjście FFmpeg" Basic.Settings.Output.UseReplayBuffer="Włącz nagrywanie powtórek" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maksymalny czas nagrania (w sekundach)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maksymalny czas nagrania" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maksymalna ilość pamięci (w megabajtach)" Basic.Settings.Output.ReplayBuffer.Estimate="Szacowane użycie pamięci: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Nie można oszacować użycia pamięci. Należy ustawić limit maksymalnej pamięci." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Jakość bezstratna, ogromna wielkość pliku" Basic.Settings.Output.Simple.Warn.VideoBitrate="Ostrzeżenie: Przepływność (bitrate) obrazu ustawiona jest na wartość %1. Jest to górna granica wartości dozwolonych dla wybranej usługi streamingowej. Aby ustawić wartość przepływności większą niż %1 przejdź do zaawansowanych ustawień dekoder i odznacz opcję \"Wymuś limity przepływności wybranego serwisu\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Ostrzeżenie: Przepływność (bitrate) dźwięku ustawiona jest na wartość %1. Jest to górna granica wartości dozwolonych dla wybranej usługi streamingowej. Aby ustawić wartość przepływności większą niż %1, przejdź do zaawansowanych ustawień dekoder i odznacz opcję \"Wymuś limity przepływności wybranego serwisu\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Ostrzeżenie: Nagrywanie nie może być spauzowane, gdy jakość nagrywania ustawiona jest na \"Taka sama jak stream\"." Basic.Settings.Output.Simple.Warn.Encoder="Ostrzeżenie: Nagrywanie przy użyciu enkodera programowego z jakością inną niż stream wymagać będzie dodatkowej mocy procesora w przypadku jednoczesnego streamowania i nagrywania." Basic.Settings.Output.Simple.Warn.Lossless="Ostrzeżenie: Jakość bezstratna generuje bardzo duże pliki! Przy dużych rozdzielczościach i szybkości klatek rozmiar pliku może sięgać 7GB na minutę nagrania. Jakość ta nie jest zalecana w przypadku długich nagrań, chyba że masz bardzo dużo wolnego miejsca na dysku." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Czy na pewno chcesz użyć bezstratnej jakości?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Bitrate obrazu" Basic.Settings.Output.AudioBitrate="Bitrate dźwięku" Basic.Settings.Output.Reconnect="Ponowne łączenie" -Basic.Settings.Output.RetryDelay="Ponów połączenie (w sekundach)" +Basic.Settings.Output.RetryDelay="Próbuj połączyć co" Basic.Settings.Output.MaxRetries="Maksymalna liczba ponownych prób" Basic.Settings.Output.Advanced="Włącz zaawansowane ustawienia enkodera" Basic.Settings.Output.EncoderPreset="Ustawienia enkodera" @@ -694,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (najszybsze, obraz rozmazany w przypadku skalowania)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (skalowanie ostrzejsze, 16 próbek)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (skalowanie ostrzejsze, 32 próbki)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (skalowanie ostrzejsze, 36 próbki)" +Basic.Settings.Video.DownscaleFilter.Area="Area (suma ważona, 4/6/9 próbek)" Basic.Settings.Audio="Dźwięk" Basic.Settings.Audio.SampleRate="Częstotliwość próbkowania" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Poziom szczytowy próbkowany" Basic.Settings.Audio.PeakMeterType.TruePeak="Rzeczywisty szczytowy poziom (większe użycie procesora)" Basic.Settings.Audio.MultiChannelWarning.Enabled="Uwaga: Dźwięk przestrzenny jest włączony." -Basic.Settings.Audio.MultichannelWarning="W przypadku streamowania sprawdź, czy docelowa usługa obsługuje wielokanałowe wejście oraz odtwarzanie dźwięku surround. Twitch, Facebook, 360 Live, Mixer RTMP, Smashcast to przykłady usług obsługujących dźwięk wielokanałowy. O ile Facebook Live i Youtube Live obsługują wejście dźwięku wielokanałowego, to w przypadku odtwarzania Facebook miksuje kanału do stereo a Youtube Live odtwarza tylko dwa kanały.\n\nFiltry dźwiękowe OBS są w pełni kompatybilne z dźwiękiem kanałowym, natomiast wsparcie pluginów VST nie jest gwarantowane." +Basic.Settings.Audio.MultichannelWarning="W przypadku streamowania sprawdź, czy docelowa usługa obsługuje wielokanałowe wejście oraz odtwarzanie dźwięku surround. Facebook, 360 Live, Mixer RTMP, Smashcast to przykłady usług obsługujących dźwięk wielokanałowy. O ile Facebook Live i Youtube Live obsługują wejście dźwięku wielokanałowego, to w przypadku odtwarzania Facebook miksuje kanału do stereo a Youtube Live odtwarza tylko dwa kanały.\n\nFiltry dźwiękowe OBS są w pełni kompatybilne z dźwiękiem kanałowym, natomiast wsparcie pluginów VST nie jest gwarantowane." Basic.Settings.Audio.MultichannelWarning.Title="Włączyć dźwięk przestrzenny?" Basic.Settings.Audio.MultichannelWarning.Confirm="Czy na pewno chcesz włączyć dźwięk przestrzenny?" Basic.Settings.Audio.Devices="Urządzenia" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Domyślne" Basic.Settings.Advanced.Audio.DisableAudioDucking="Wyłącz systemowe obniżanie głośności innych źródeł dźwięków" Basic.Settings.Advanced.StreamDelay="Opóźnienie streamu" -Basic.Settings.Advanced.StreamDelay.Duration="Czas trwania (s)" +Basic.Settings.Advanced.StreamDelay.Duration="Opóźnienie" Basic.Settings.Advanced.StreamDelay.Preserve="Zachowuj punkt przerwania (zwiększ opóźnienie) podczas ponownego łączenia" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Szacowane zużycie pamięci: %1 MB" Basic.Settings.Advanced.Network="Sieć" Basic.Settings.Advanced.Network.BindToIP="Przypisane IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Aktywuj nowy kod sieciowy" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Tryb niskich opóźnień" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Skróty klawiszowe w aktywnym oknie" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Nigdy nie deaktywuj skrótów klawiszowych" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Wyłącz skróty klawiszowe, gdy główne okno programu jest aktywne na pierwszym planie" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Deaktywuj skróty klawiszowe, gdy okno nie jest aktywne na pierwszym planie" Basic.Settings.Advanced.AutoRemux="Automatycznie przepakuj (remux) do mp4" Basic.Settings.Advanced.AutoRemux.MP4="(nagrywaj jako mkv)" Basic.AdvAudio="Zaawansowane ustawienia dźwięku" Basic.AdvAudio.Name="Nazwa" Basic.AdvAudio.Volume="Głośność" -Basic.AdvAudio.Mono="Downmix do Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balans" -Basic.AdvAudio.SyncOffset="Przesunięcie dźwięku (ms)" +Basic.AdvAudio.SyncOffset="Przesunięcie dźwięku" Basic.AdvAudio.Monitoring="Monitorowanie urządzenia audio" Basic.AdvAudio.Monitoring.None="Wyłączone" Basic.AdvAudio.Monitoring.MonitorOnly="Tylko monitorowanie (wyjście wyłączone)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="Musisz wybrać przynajmniej jedną ścieżkę" OutputWarnings.MultiTrackRecording="Ostrzeżenie: Pewne formaty plików (np. FLV) nie obsługują wielu ścieżek dźwiękowych" OutputWarnings.MP4Recording="Ostrzeżenie: Nagrania zapisanego w formacie MP4/MOV nie będzie można odzyskać, jeśli plik nie zostanie zakończony poprawnie (np. w wyniku BSOD, braku prądu, itp.). Jeśli chcesz nagrać wiele ścieżek audio należy rozważyć użycie formatu MKV i remux nagrania do MP4/MOV po zakończeniu (Plik → Przepakuj nagrania)." +OutputWarnings.CannotPause="Ostrzeżenie: Nagrywanie nie może być spauzowane, gdy enkoder nagrywania ustawiony jest na \"(użyj enkodera streamu)\"" FinalScene.Title="Usuń scenę" FinalScene.Text="Musi być co najmniej jedna scena."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/pt-BR.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/pt-BR.ini
Changed
@@ -1,6 +1,6 @@ Language="Português" -Region="Brasil" +Region="Estados Unidos" OK="Ok" Apply="Aplicar" @@ -23,7 +23,7 @@ Display="Monitor" Name="Nome" Exit="Sair" -Mixer="Mixer" +Mixer="Mixer de Áudio" Browse="Localizar" Mono="Mono" Stereo="Estéreo" @@ -89,7 +89,11 @@ AlreadyRunning.LaunchAnyway="Executar mesmo assim" DockCloseWarning.Title="Fechar janela ancorável" -DockCloseWarning.Text="Você acabou de fechar uma janela ancorável. Se você gostaria de abri-la novamente, use o menu Mostrar → Âncoras." +DockCloseWarning.Text="Você acabou de fechar uma janela ancorável. Se você gostaria de abri-la novamente, use o menu Mostrar → Docas." + +ExtraBrowsers="Docas para Navegador Personalizado" +ExtraBrowsers.Info="Adicione docas dando-lhes um nome e URL, então clique em Aplicar ou Fechar para abrir as docas. Você pode adicionar ou remover as docas a qualquer momento." +ExtraBrowsers.DockName="Nome da Doca" Auth.Authing.Title="Autenticando..." Auth.Authing.Text="Autenticando com a(o) %1, aguarde..." @@ -107,6 +111,7 @@ TwitchAuth.Feed="Feed de Atividade do Twitch" TwitchAuth.TwoFactorFail.Title="Não foi possível consultar a chave de transmissão" TwitchAuth.TwoFactorFail.Text="O OBS não foi capaz de se conectar à sua conta do Twitch. Por favor, certifique-se de que a autenticação de dois fatores está configurada em suas <a href='https://www.twitch.tv/settings/security'>Configurações de segurança do Twitch</a> pois isso é necessário para transmitir." +RestreamAuth.Channels="Canais de reatribuição" Copy.Filters="Copiar Filtros" Paste.Filters="Colar Filtros" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Nota: A resolução da tela (base) não é necessariamente a mesma resolução que você transmitirá ou gravará. Sua resolução final da transmissão/gravação pode ser redimencionada da resolução da tela para reduzir o uso de recursos ou bitrate necessário." Basic.AutoConfig.StreamPage="Informações da transmissão" Basic.AutoConfig.StreamPage.SubTitle="Por favor, digite suas informações para a transmissão" -Basic.AutoConfig.StreamPage.ConnectAccount="Conectar Conta (opcional)" +Basic.AutoConfig.StreamPage.ConnectAccount="Conectar Conta (recomendado)" Basic.AutoConfig.StreamPage.DisconnectAccount="Desconectar conta" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Desconectar conta?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Esta mudança será aplicada imediatamente. Tem certeza de que deseja desconectar sua conta?" @@ -192,7 +197,7 @@ Basic.Stats.DiskFullIn="Disco completo em (aprox.)" ResetUIWarning.Title="Tem certeza de que deseja redefinir a interface do usuário?" -ResetUIWarning.Text="Redefinir a interface irá ocultar as âncoras adicionais. Você precisará mostra-las indo no menu de visualização se quiser que elas se tornem visíveis novamente.\n\nTem certeza de que deseja redefinir a interface do usuário?" +ResetUIWarning.Text="Redefinir a interface irá ocultar as docas adicionais. Você precisará mostra-las indo no menu de visualização se quiser que elas se tornem visíveis novamente.\n\nTem certeza de que deseja redefinir a interface do usuário?" Updater.Title="Nova atualização disponível" Updater.Text="Há uma nova atualização disponível:" @@ -240,6 +245,9 @@ ConfirmStop.Title="Interromper transmissão?" ConfirmStop.Text="Deseja mesmo interromper a transmissão?" +ConfirmStopRecord.Title="Parar Gravação?" +ConfirmStopRecord.Text="Tem certeza que deseja parar a gravação?" + ConfirmBWTest.Title="Iniciar teste de largura de banda?" ConfirmBWTest.Text="Você com o OBS configurado no modo de teste de largura de banda. Este modo permite o teste de rede sem que o seu canal entre em funcionamento. Uma vez terminado o teste, você precisará desativá-lo para que os espectadores possam ver sua transmissão.\n\nVocê quer continuar?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="Falha ao iniciar o buffer de repetição" Output.StartFailedGeneric="Impossível criar o arquivo de saída. Verifique o registro para mais detalhes do erro.\n\nAviso: se estiver utilizando os codificadores NVENC ou AMD, certifique-se de que os seus drivers estão atualizados." +Output.ReplayBuffer.PauseWarning.Title="Não é possível salvar replays enquanto pausado" +Output.ReplayBuffer.PauseWarning.Text="Aviso: Replays não podem ser salvos enquanto a gravação estiver pausada." Output.ConnectFail.Title="Falha ao conectar" Output.ConnectFail.BadPath="Caminho ou URL inválida. Por favor, verifique suas configurações para confirmar que estão válidas." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Iniciar Buffer do Replay" Basic.Main.StartStreaming="Iniciar transmissão" Basic.Main.StopRecording="Parar Gravação" +Basic.Main.PauseRecording="Pausar Gravação" +Basic.Main.UnpauseRecording="Continuar Gravação" Basic.Main.StoppingRecording="Parando de Gravar..." Basic.Main.StopReplayBuffer="Parar Buffer do Replay" Basic.Main.StoppingReplayBuffer="Parando Buffer do Replay..." @@ -499,9 +511,10 @@ Basic.MainMenu.View="Mostrar (&V)" Basic.MainMenu.View.Toolbars="Barras de Ferramen&tas" -Basic.MainMenu.View.Docks="Ancorar" +Basic.MainMenu.View.Docks="Docas" Basic.MainMenu.View.Docks.ResetUI="Redefinir IU" Basic.MainMenu.View.Docks.LockUI="Travar IU" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Docas para Navegador Personalizado..." Basic.MainMenu.View.Toolbars.Listboxes="Caixa de &Listagem" Basic.MainMenu.View.SceneTransitions="Transições de &Cena" Basic.MainMenu.View.StatusBar="Barra de &Status" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Abrir janela de estatísticas na inicialização" Basic.Settings.General.WarnBeforeStartingStream="Mostrar diálogo de confirmação quando iniciar transmissões" Basic.Settings.General.WarnBeforeStoppingStream="Mostrar diálogo de confirmação quando terminar transmissões" +Basic.Settings.General.WarnBeforeStoppingRecord="Mostrar diálogo de confirmação ao parar a gravação" Basic.Settings.General.Projectors="Projetores" Basic.Settings.General.HideProjectorCursor="Ocultar o cursor sobre projetores" Basic.Settings.General.ProjectorAlwaysOnTop="Colocar projetores sempre no topo" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Selecione o diretório de gravação" Basic.Settings.Output.SelectFile="Selecione o arquivo de gravação" Basic.Settings.Output.EnforceBitrate="Impor limites de bitrate do serviço de transmissão" +Basic.Settings.Output.DynamicBitrate="Alterar taxa de bits dinamicamente para gerenciar o congestionamento" +Basic.Settings.Output.DynamicBitrate.Beta="Alterar taxa de bits dinamicamente para gerenciar o congestionamento (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="Em vez de derrubar os quadros para reduzir o congestionamento, mudanças dinâmicas na taxa de bits durante o processo.\n\nNote que isso pode aumentar o atraso para os espectadores se houver um congestionamento repentino significativo.\nQuando a taxa de bits cair, pode levar até alguns minutos para restaurar.\n\nAtualmente suportado apenas para RTMP." Basic.Settings.Output.Mode="Modo de Saída" Basic.Settings.Output.Mode.Simple="Simples" Basic.Settings.Output.Mode.Adv="Avançado" Basic.Settings.Output.Mode.FFmpeg="Saída de FFmpeg" Basic.Settings.Output.UseReplayBuffer="Habilitar Buffer de Repetição" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Tempo de Replay máximo (Segundos)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Tempo máximo de repetição" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Memória Máxima (Megabytes)" Basic.Settings.Output.ReplayBuffer.Estimate="Uso de memória estimado: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Impossível estimar o uso de memória. Por favor, defina o limite máximo de memória." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Qualidade Lossless, tremendamente grande" Basic.Settings.Output.Simple.Warn.VideoBitrate="Aviso: O bitrate de vídeo da transmissão será definido para %1, que é o limite superior para o serviço de transmissão atual. Se você tem certeza que quer ir acima de %1, habilite opções de codificação avançadas e desmarque \"Impor limites de bitrate do serviço de transmissão\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Aviso: O bitrate de áudio da transmissão será definido para %1, que é o limite superior para o serviço de transmissão atual. Se você tem certeza que quer ir acima de %1, habilite opções de codificação avançadas e desmarque \"Impor limites de bitrate do serviço de transmissão\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Aviso: Gravações não podem ser pausadas se a qualidade da gravação estiver definida como \"A mesma da transmissão\"." Basic.Settings.Output.Simple.Warn.Encoder="Aviso: Gravar com um codificador de software em uma qualidade diferente do que a stream vai exigir mais da CPU se você transmitir e gravar ao mesmo tempo." Basic.Settings.Output.Simple.Warn.Lossless="Aviso: Qualidade Lossless gera arquivos muito grandes! A qualidade Lossless pode usar mais de 7 gigabytes de espaço em disco por minuto em altas resoluções e framerates. Lossless não é recomendada para gravações longas, a menos que se tenha uma grande quantidade de espaço em disco disponível." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Tem certeza que deseja usar qualidade lossless?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Taxa de Bits do Vídeo" Basic.Settings.Output.AudioBitrate="Taxa de Bits do Áudio" Basic.Settings.Output.Reconnect="Reconectar automaticamente" -Basic.Settings.Output.RetryDelay="Espera para reconectar-se (segundos)" +Basic.Settings.Output.RetryDelay="Atraso de repetição" Basic.Settings.Output.MaxRetries="Número Máximo de Tentativas" Basic.Settings.Output.Advanced="Ativar as configurações avançadas do encoder" Basic.Settings.Output.EncoderPreset="Padrão de Codificação" @@ -694,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear(rápido, mas embaçado se redimensionando)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicúbico (escalamento nítido, 16 amostras)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (escalamento nítido, 32 amostras)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (escalamento nítido, 36 amostras)" +Basic.Settings.Video.DownscaleFilter.Area="Área (soma ponderada, 4/6/9 amostras)" Basic.Settings.Audio="Áudio" Basic.Settings.Audio.SampleRate="Taxa de Amostragem" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Exemplo de pico" Basic.Settings.Audio.PeakMeterType.TruePeak="True Peak (Uso elevado de CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="AVISO: Áudio Surround está habilitado." -Basic.Settings.Audio.MultichannelWarning="Antes de transmitir, verifique se o seu serviço de transmissão suporta tanto receber como reproduzir som surround. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast são exemplos onde o som surround é totalmente suportado. Embora o Facebook Live e o YouTube Live ambos aceitem receber som surround, o Facebook Live transformará para estéreo e o YouTube Live reproduz apenas dois canais.\n\nOs filtros de áudio do OBS são compatíveis com o som surround, embora o suporte do plugin VST não seja garantido." +Basic.Settings.Audio.MultichannelWarning="Antes de transmitir, verifique se o seu serviço de transmissão suporta tanto receber como reproduzir som surround. Facebook 360 Live, Mixer RTMP, Smashcast são exemplos onde o som surround é totalmente suportado. Embora o Facebook Live e o YouTube Live ambos aceitem receber som surround, o Facebook Live transformará para estéreo e o YouTube Live reproduz apenas dois canais.\n\nOs filtros de áudio do OBS são compatíveis com o som surround, embora o suporte do plugin VST não seja garantido." Basic.Settings.Audio.MultichannelWarning.Title="Ativar o som surround?" Basic.Settings.Audio.MultichannelWarning.Confirm="Você tem certeza de que deseja habilitar o som surround?" Basic.Settings.Audio.Devices="Dispositivos" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Padrão" Basic.Settings.Advanced.Audio.DisableAudioDucking="Desativar a Oscilação de Áudio do Windows" Basic.Settings.Advanced.StreamDelay="Atraso da transmissão" -Basic.Settings.Advanced.StreamDelay.Duration="Duração (segundos)" +Basic.Settings.Advanced.StreamDelay.Duration="Duração" Basic.Settings.Advanced.StreamDelay.Preserve="Preservar o ponto de corte (aumento de atraso) quando reconectar" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Uso de memória estimado: %1 MB" Basic.Settings.Advanced.Network="Rede" Basic.Settings.Advanced.Network.BindToIP="Transmitir pelo IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Habilitar o novo código de rede" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Modo de baixa latência" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Comportamento de Foco de tecla de atalho" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Nunca desativar teclas de atalho" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Desativar teclas de atalho quando a janela principal estiver em foco" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Desativar teclas de atalho quando a janela principal não estiver em foco" Basic.Settings.Advanced.AutoRemux="Converter automaticamente para mp4" Basic.Settings.Advanced.AutoRemux.MP4="(gravar como mkv)" Basic.AdvAudio="Propriedades de áudio avançadas" Basic.AdvAudio.Name="Nome" Basic.AdvAudio.Volume="Volume" -Basic.AdvAudio.Mono="Downmix para Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balanço" -Basic.AdvAudio.SyncOffset="Atraso de sincronização (ms)" +Basic.AdvAudio.SyncOffset="Sincronizar Offset" Basic.AdvAudio.Monitoring="Monitoramento de Áudio" Basic.AdvAudio.Monitoring.None="Não monitorar" Basic.AdvAudio.Monitoring.MonitorOnly="Apenas monitorar (saída muda)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="Você deve selecionar pelo menos uma faixa" OutputWarnings.MultiTrackRecording="Aviso: Alguns formatos (como FLV) não suportam várias faixas por gravação" OutputWarnings.MP4Recording="Atenção: as gravações salvas em MP4/MOV não serão recuperáveis se o arquivo não puder ser concluído (por exemplo, como resultado de um BSOD, perdas de energia, etc.). Se você quiser gravar várias faixas de áudio, aconselhamos utilizar o MKV e, uma vez terminado, converter a gravação para MP4/MOV (Arquivo → Converter gravações)" +OutputWarnings.CannotPause="Aviso: As gravações não podem ser pausadas se o codificador de gravação estiver definido para \"(Utilizar o codificador da transmissão)\"" FinalScene.Title="Excluir cena" FinalScene.Text="É preciso haver pelo menos uma cena."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/pt-PT.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/pt-PT.ini
Changed
@@ -19,12 +19,12 @@ Properties="Propriedades" MoveUp="Mover para Cima" MoveDown="Mover para Baixo" -Settings="Definições" +Settings="Configurações" Display="Ecrã" Name="Nome" Exit="Sair" -Mixer="Misturador" -Browse="Localizar" +Mixer="Misturador de Áudio" +Browse="Explorar" Mono="Mono" Stereo="Estéreo" DroppedFrames="Quadros Perdidos %1 (%2%)" @@ -47,14 +47,14 @@ New="Novo" Duplicate="Duplicar" Enable="Ativar" -DisableOSXVSync="Desabilitar o OSX V-Sync" -ResetOSXVSyncOnExit="Redefinir o OSX V-Sync na saída" +DisableOSXVSync="Desativar OSX V-Sync" +ResetOSXVSyncOnExit="Redefinir OSX V-Sync ao Sair" HighResourceUsage="Codificação sobrecarregado! Considere diminuir a configurações de vídeo ou usar uma predefinição mais rápido de codificação." Transition="Transição" -QuickTransitions="Transições rápidas" +QuickTransitions="Transições Rápidas" Left="Esquerda" Right="Direita" -Top="Cima" +Top="Topo" Bottom="Baixo" Reset="Repor" Hours="Horas" @@ -72,7 +72,7 @@ Next="Continuar" Back="Anterior" Defaults="Predefinições" -HideMixer="Esconder no Mixer" +HideMixer="Ocultar no Misturador" TransitionOverride="Substituir Transição" None="Nenhum" StudioMode.Preview="Pré-visualização" @@ -80,7 +80,9 @@ ShowInMultiview="Mostrar no Multiview" VerticalLayout="Vista Vertical" Group="Grupo" -DoNotShowAgain="Não mostrar novamente" +DoNotShowAgain="Não voltar a mostrar" +Default="(Predefinição)" +Calculating="A calcular..." AlreadyRunning.Title="O OBS já está em execução" AlreadyRunning.Text="O OBS já está em execução! Tem de desligar a instância existente do OBS antes de iniciar uma nova. Se o OBS estiver definido para correr na bandeja do sistema, por favor verifique se está aberto lá." @@ -89,17 +91,18 @@ DockCloseWarning.Title="Janela Fechar dockável" DockCloseWarning.Text="Acabaste de fechar uma janela acoplável. Se você quiser mostrá-la novamente, use o menu Exibir → Docks na barra de menus." -Auth.Authing.Title="Autenticação..." -Auth.Authing.Text="Autenticando com %1, por favor espere..." -Auth.AuthFailure.Title="Falha na autenticação" -Auth.AuthFailure.Text="Falha na autenticação com %1:\n\n%2: %3" + +Auth.Authing.Title="A autenticar..." +Auth.Authing.Text="A autenticar com %1, por favor, aguarde..." +Auth.AuthFailure.Title="Falha na Autenticação" +Auth.AuthFailure.Text="Falhou a autenticação com %1:\n\n%2: %3" Auth.InvalidScope.Title="Autenticação Necessária" Auth.InvalidScope.Text="Os requisitos de autenticação para %1 mudaram. Algumas funcionalidades podem não estar disponíveis." Auth.LoadingChannel.Title="Carregando informação do canal..." Auth.LoadingChannel.Text="A carregar informação do canal para %1, por favor espere..." Auth.ChannelFailure.Title="Erro ao carregar canal" Auth.ChannelFailure.Text="Erro ao carregar informaões do canal do %1\n\n%2: %3" -Auth.Chat="Chat" +Auth.Chat="Conversação" Auth.StreamInfo="Informação da Transmissão" TwitchAuth.Stats="Estatísticas da Twitch" TwitchAuth.Feed="Alimentação de atividade de Twitch" @@ -114,28 +117,27 @@ BandwidthTest.Region.US="Estados Unidos" BandwidthTest.Region.EU="Europa" BandwidthTest.Region.Asia="Ásia" -BandwidthTest.Region.Other="Outro" +BandwidthTest.Region.Other="Outra" Basic.FirstStartup.RunWizard="Gostaria de executar o assistente de configuração automática? Pode também definir as suas configurações na janela principal." Basic.FirstStartup.RunWizard.NoClicked="Se muder de ideias pode correr o assistente de configuração automática a qualquer momento no menu Ferramentas." Basic.AutoConfig="Assistente de Configuração Automática" -Basic.AutoConfig.ApplySettings="Aplicar definições" -Basic.AutoConfig.StartPage="Informação de utilização" +Basic.AutoConfig.ApplySettings="Aplicar Configurações" +Basic.AutoConfig.StartPage="Informação de Utilização" Basic.AutoConfig.StartPage.SubTitle="Especifique qual vai ser a utilização do programa" Basic.AutoConfig.StartPage.PrioritizeStreaming="Otimizar para transmissão, gravação é secundária" Basic.AutoConfig.StartPage.PrioritizeRecording="Otimizar para gravação, a transmissão é secundária" -Basic.AutoConfig.VideoPage="Definições de video" +Basic.AutoConfig.VideoPage="Definições de Video" Basic.AutoConfig.VideoPage.SubTitle="Especifique as definições de video que pretende" Basic.AutoConfig.VideoPage.BaseResolution.UseCurrent="Usar atual (%1x%2)" Basic.AutoConfig.VideoPage.BaseResolution.Display="Monitor %1 (%2x%3)" -Basic.AutoConfig.VideoPage.FPS.UseCurrent="Usar atual (%1)" +Basic.AutoConfig.VideoPage.FPS.UseCurrent="Utilizar atual (%1)" Basic.AutoConfig.VideoPage.FPS.PreferHighFPS="60 ou 30, com prioridade a 60" Basic.AutoConfig.VideoPage.FPS.PreferHighRes="60 ou 30, com prioridade a alta resolução" Basic.AutoConfig.VideoPage.CanvasExplanation="Nota: A resolução base do canvas não é necessariamente a mesma que resolução da gravação ou stream. A resolução da gravação/stream pode ser reduzida para diminuir o uso de recursos e os requisitos de bitrate." Basic.AutoConfig.StreamPage="Informação de Transmissão" Basic.AutoConfig.StreamPage.SubTitle="Por favor introduza a informação necessária" -Basic.AutoConfig.StreamPage.ConnectAccount="Conectar Conta (opcional)" Basic.AutoConfig.StreamPage.DisconnectAccount="Desconectar Conta" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Desconectar Conta?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Esta alteração será aplicada imediatamente. De certeza que queres desconectar a tua conta?" @@ -145,7 +147,7 @@ Basic.AutoConfig.StreamPage.Service.Custom="Personalizado..." Basic.AutoConfig.StreamPage.Server="Servidor" Basic.AutoConfig.StreamPage.StreamKey="Chave de Transmissão" -Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(Link)" +Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(Hiperligação)" Basic.AutoConfig.StreamPage.PerformBandwidthTest="Estimar bitrate com teste de largura de banda (pode demorar alguns minutos)" Basic.AutoConfig.StreamPage.PreferHardwareEncoding="Preferir codificação de hardware" Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="A Codificação de Hardware elimina maior parte da utilização do CPU mas pode precisar de uma bitrate maior para obter o mesmo nível de qualidade." @@ -168,7 +170,7 @@ Basic.AutoConfig.TestPage.Result.Header="O programa determinou que estas definições são as mais ideais para si:" Basic.AutoConfig.TestPage.Result.Footer="Para utilizar estas definições, carregue em Aplicar Definições. Para reconfigurar o assistente e tentar novamente, carregue em Voltar. Para configurar manualmente as definições, carregue em Cancelar e abra as Definições." -Basic.Stats="Estados" +Basic.Stats="Estatísticas" Basic.Stats.CPUUsage="Utilização de CPU" Basic.Stats.HDDSpaceAvailable="Espaço em disco disponível" Basic.Stats.MemoryUsage="Utilização de Memória" @@ -178,22 +180,22 @@ Basic.Stats.Output.Stream="Transmissão" Basic.Stats.Output.Recording="Gravação" Basic.Stats.Status="Estado" -Basic.Stats.Status.Recording="A Gravar" -Basic.Stats.Status.Live="Ao Vivo" -Basic.Stats.Status.Reconnecting="A Reconectar" +Basic.Stats.Status.Recording="Gravação" +Basic.Stats.Status.Live="LIVE" +Basic.Stats.Status.Reconnecting="A religar" Basic.Stats.Status.Inactive="Inactivo" Basic.Stats.DroppedFrames="Frames perdidas (Rede)" -Basic.Stats.MegabytesSent="Total saída de dados" -Basic.Stats.Bitrate="Taxa de Bits" +Basic.Stats.MegabytesSent="Total Dados de Saída" +Basic.Stats.Bitrate="Taxa de bits" -ResetUIWarning.Title="De certeza que queres reiniciar a interface?" -ResetUIWarning.Text="Reiniciar a interface irá esconder docks adicionais. Vais ter de as ativar outra vez a partir no menu ver se quiseres torná-las visíveis.\n\nDe certeza que queres reiniciar a interface?" +ResetUIWarning.Title="Tem a certeza que deseja reiniciar a interface?" +ResetUIWarning.Text="Ao reiniciar a interface irá ocultar as \"docks\" adicionais. Terá de as ativar novamente no menu de visualização se quiser torná-las visíveis.\n\nTem a certeza que deseja reiniciar a interface?" -Updater.Title="Nova atualização disponível" -Updater.Text="Existe uma nova atualização disponível:" +Updater.Title="Disponível nova atualização" +Updater.Text="Está disponível uma nova atualização:" Updater.UpdateNow="Atualizar Agora" Updater.RemindMeLater="Lembrar-me mais tarde" -Updater.Skip="Saltar Versão" +Updater.Skip="Ignorar Versão" Updater.Running.Title="Programa atualmente ativo" Updater.Running.Text="Existem Outputs ativos atualmente, por favor desligar quaisquer Outputs ativos antes de começar a atualização" Updater.NoUpdatesAvailable.Title="Nenhuma atualização disponível" @@ -235,6 +237,9 @@ ConfirmStop.Title="Parar a transmissão?" ConfirmStop.Text="Tem a certeza que quer parar a transmissão?" +ConfirmStopRecord.Title="Parar gravação?" +ConfirmStopRecord.Text="Tem a certeza que deseja parar a gravação?" + ConfirmBWTest.Title="Iniciar teste de largura de banda?" ConfirmBWTest.Text="Você tem o OBS configurado no modo de teste de largura de banda. Este modo permite o teste de rede sem que o seu canal entre em funcionamento. Uma vez terminado o teste, você precisará desativá-lo para que os espectadores possam ver sua transmissão.\n\nVocê quer continuar?" @@ -258,6 +263,7 @@ Output.ConnectFail.Error="Ocurreu um erro inesperado ao ligar-se ao servidor. Mais informação no ficheiro Log." Output.ConnectFail.Disconnected="Desligado do servidor." +Output.StreamEncodeError.Title="Erro de codificação" Output.RecordFail.Title="Não foi possível iniciar a gravação" Output.RecordFail.Unsupported="O formato de saída ou não é suportado ou não suporta mais do que uma faixa de áudio. Por favor, verifique as suas definições e tente novamente." @@ -308,6 +314,7 @@ Basic.Main.PreviewConextMenu.Enable="Ativar pré-visualização" +Basic.Main.Preview.Disable="Desativar Pré-visualização" ScaleFiltering="Filtragem de escala" ScaleFiltering.Point="Ponto" @@ -435,6 +442,7 @@ Basic.Main.StartReplayBuffer="Iniciar Replay Buffer" Basic.Main.StartStreaming="Iniciar transmissão" Basic.Main.StopRecording="Parar Gravação" +Basic.Main.PauseRecording="Pausar Gravação" Basic.Main.StoppingRecording="A parar gravação..." Basic.Main.StopReplayBuffer="Parar Replay Buffer" Basic.Main.StoppingReplayBuffer="A Parar Replay Buffer..." @@ -479,6 +487,8 @@ Basic.MainMenu.Edit.Transform.FitToScreen="Escalar ao ecrã (&F)" Basic.MainMenu.Edit.Transform.StretchToScreen="E&sticar ao ecrã" Basic.MainMenu.Edit.Transform.CenterToScreen="&Centrar ao ecrã" +Basic.MainMenu.Edit.Transform.VerticalCenter="Centrar Verticalmente" +Basic.MainMenu.Edit.Transform.HorizontalCenter="Centrar Horizontalmente" Basic.MainMenu.Edit.Order="&Ordem" Basic.MainMenu.Edit.Order.MoveUp="Mover para Cima (&U)" Basic.MainMenu.Edit.Order.MoveDown="Mover para Baixo (&D)" @@ -585,7 +595,6 @@ Basic.Settings.Output.Mode.Adv="Avançado" Basic.Settings.Output.Mode.FFmpeg="Saída FFmpeg" Basic.Settings.Output.UseReplayBuffer="Ativar Replay Buffer" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Tempo Máximo de Replay (Segundos)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Memória Máxima (Megabytes)" Basic.Settings.Output.ReplayBuffer.Estimate="Utilização estimada de memória: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Não é possível estimar a utilização de memória. Defina o limite máximo de memória." @@ -612,7 +621,6 @@ Basic.Settings.Output.VideoBitrate="Bitrate de Vídeo" Basic.Settings.Output.AudioBitrate="Bitrate de Áudio" Basic.Settings.Output.Reconnect="Religar Automaticamente" -Basic.Settings.Output.RetryDelay="Atraso de Tentatica de Religação (segundos)" Basic.Settings.Output.MaxRetries="Número Máximo de Tentativas de Religação" Basic.Settings.Output.Advanced="Ativar definições avançadas de codificação" Basic.Settings.Output.EncoderPreset="Predefinição do codificador" @@ -683,11 +691,12 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (mais rápido, mas desfocada se escalar)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicúbico (escalamento nítido, 16 amostras)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (escalamento nítido, 32 amostras)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (escalamento nítido, 36 amostras)" Basic.Settings.Audio="Áudio" Basic.Settings.Audio.SampleRate="Frequência de Samplagem" Basic.Settings.Audio.Channels="Canias" +Basic.Settings.Audio.Meters="Medidores" Basic.Settings.Audio.MeterDecayRate.Fast="Rápido" Basic.Settings.Audio.MeterDecayRate.Medium="Médio (Tipo I PPM)" Basic.Settings.Audio.MeterDecayRate.Slow="Lento (Tipo II PPM)" @@ -695,9 +704,14 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Pico Pré-definido" Basic.Settings.Audio.PeakMeterType.TruePeak="Pico Verdadeiro (Maior Uso da CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="AVISO: O som surround está ativo." -Basic.Settings.Audio.MultichannelWarning="Se transmitir, verifique se o seu serviço de transmissão suporta tanto ingestão de áudio surround como playback de áudio surround. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast são exemplos onde o áudio surround é totalmente suportado. Embora o Facebook Live e o YouTube Live aceitem os dois ingestão de áudio surround, o Facebook Live transforma-o em stereo, e o YouTube Live só toca dois canais.\n\nOs filtros de áudio do OBS são compatíveis com áudio surround, embora não esteja garantido o suporte para plugins VST." +Basic.Settings.Audio.MultichannelWarning="Se transmitir, verifique se o seu serviço de transmissão suporta tanto ingestão de áudio surround como playback de áudio surround. Facebook 360 Live, Mixer RTMP, Smashcast são exemplos onde o áudio surround é totalmente suportado. Embora o Facebook Live e o YouTube Live aceitem os dois ingestão de áudio surround, o Facebook Live transforma-o em stereo, e o YouTube Live só toca dois canais.\n\nOs filtros de áudio do OBS são compatíveis com áudio surround, embora não esteja garantido o suporte para plugins VST." Basic.Settings.Audio.MultichannelWarning.Title="Ativar audio surround?" Basic.Settings.Audio.MultichannelWarning.Confirm="Tem a certeza que quer ativar audio surround?" +Basic.Settings.Audio.Devices="Dispositivos" +Basic.Settings.Audio.AuxDevice="Áudio Mic./Auxiliar" +Basic.Settings.Audio.AuxDevice2="Áudio Mic./Auxiliar 2" +Basic.Settings.Audio.AuxDevice3="Áudio Mic./Auxiliar 3" +Basic.Settings.Audio.AuxDevice4="Áudio Mic./Auxiliar 4" Basic.Settings.Audio.EnablePushToMute="Ativar o push-to-mute" Basic.Settings.Audio.PushToMuteDelay="Atrado do push-to-mute" Basic.Settings.Audio.EnablePushToTalk="Ativar o push-to-talk" @@ -715,12 +729,14 @@ Basic.Settings.Advanced.FormatWarning="Aviso: Formatos de cor diferentes de NV12 destinam-se principalmente a gravação e não são recomendados durante a transmissão. A transmissão pode incorrer numa maior utilização do processador devido à conversão do formato de cor." Basic.Settings.Advanced.Audio.BufferingTime="Tempo de carregamento do áudio" Basic.Settings.Advanced.Video.ColorFormat="Formato de cor" +Basic.Settings.Advanced.Video.ColorSpace="Espaço de Cor" Basic.Settings.Advanced.Video.ColorRange.Partial="Parcial" Basic.Settings.Advanced.Video.ColorRange.Full="Total" +Basic.Settings.Advanced.Audio.MonitoringDevice="Dispositivo de Monitorização" Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Predefinição" Basic.Settings.Advanced.Audio.DisableAudioDucking="Desativar o ducking de audio do Windows" Basic.Settings.Advanced.StreamDelay="Atraso na trasmissão" -Basic.Settings.Advanced.StreamDelay.Duration="Duração (segundos)" +Basic.Settings.Advanced.StreamDelay.Duration="Duração" Basic.Settings.Advanced.StreamDelay.Preserve="Preservar o ponto de corte (aumentar atraso) quando reconectar" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Utilização estimada de memória: %1 MB" Basic.Settings.Advanced.Network="Rede" @@ -733,9 +749,9 @@ Basic.AdvAudio="Propriedades avançadas de áudio" Basic.AdvAudio.Name="Nome" -Basic.AdvAudio.Mono="Diminuir para mono" +Basic.AdvAudio.Volume="Volume" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Equilíbrio" -Basic.AdvAudio.SyncOffset="Atraso de sincronização (ms)" Basic.AdvAudio.Monitoring="Monitorização de Áudio" Basic.AdvAudio.Monitoring.None="Monitor Desligado" Basic.AdvAudio.Monitoring.MonitorOnly="Único Monitor (saída muda)" @@ -788,6 +804,7 @@ Hotkeys.AppleKeypadDecimal=". (Keypad)" Hotkeys.AppleKeypadEqual="= (Keypad)" Hotkeys.MouseButton="Rato %1" +Hotkeys.Escape="Esc" Mute="Silenciar" Unmute="Tirar de silencioso"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ro-RO.ini
Changed
@@ -23,20 +23,21 @@ Display="Display" Name="Nume" Exit="Ieși" -Mixer="Mixer" +Mixer="Mixer audio" Browse="Răsfoiește" Mono="Mono" Stereo="Stereo" DroppedFrames="Cadre pierdute %1 (%2%)" -StudioProgramProjector="Proiector în fereastră (Program)" +StudioProgramProjector="Proiector pe tot ecranul (Program)" PreviewProjector="Proiector pe tot ecranul (Previzualizare)" SceneProjector="Proiector pe tot ecranul (Scenă)" SourceProjector="Proiector pe tot ecranul (Sursă)" StudioProgramWindow="Proiector în fereastră (Program)" -PreviewWindow="Proiector pe tot ecranul (Previzualizare)" -SceneWindow="Proiector în fereastră (Program)" -SourceWindow="Proiector în fereastră (Sursa)" -MultiviewProjector="Vedere multipla (Pe tot ecranul)" +PreviewWindow="Proiector în fereastră (Previzualizare)" +SceneWindow="Proiector în fereastră (Scenă)" +SourceWindow="Proiector în fereastră (Sursă)" +MultiviewProjector="Vizualizare multiplă (Ecran complet)" +MultiviewWindowed="Vizualizare multiplă (În fereastră)" Clear="Șterge" Revert="Inversează" Show="Afișează" @@ -59,7 +60,7 @@ Hours="Ore" Minutes="Minute" Seconds="Secunde" -Deprecated="Obsolet" +Deprecated="Perimat" ReplayBuffer="Reluare Buffer" Import="Importă" Export="Exportă" @@ -67,11 +68,11 @@ Paste="Lipește" PasteReference="Lipește (Referință)" PasteDuplicate="Lipește (Duplicare)" -RemuxRecordings="Înregistrări Remux" +RemuxRecordings="Remuxează înregistrări" Next="Următorul" Back="Înapoi" Defaults="Valori implicite" -HideMixer="Ascunde în Mixer" +HideMixer="Ascunde în mixer" TransitionOverride="Suprascrierea tranziției" None="Fără" StudioMode.Preview="Previzualizare" @@ -79,11 +80,14 @@ ShowInMultiview="Afișează în vizualizarea multiplă" VerticalLayout="Aranjament vertical" Group="Grup" -DoNotShowAgain="Nu afișa iar" +DoNotShowAgain="Nu afișa din nou" +Default="(Implicit)" +Calculating="Se calculează..." + +AlreadyRunning.Title="OBS rulează deja" +AlreadyRunning.Text="OBS rulează deja! Dacă nu intenționezi să faci acest lucru, te rugăm să închizi toate instanțele OBS existente înainte de a încerca să rulezi o nouă instanță. Dacă ai OBS-ul setat să se minimizeze în bara de sistem, te rugam să verifici dacă rulează acolo." +AlreadyRunning.LaunchAnyway="Lansează oricum" -AlreadyRunning.Title="OBS ruleaza deja" -AlreadyRunning.Text="OBS rulează deja! În cazul în care ați încercat sa faceți acest lucru, vă rugăm să închideți toate instanțele OBS înainte de a porni una noua. Dacă aveți OBS-ul setat pentru a se minimiza in system tray vă rugam sa verificați daca inca ruleaza acolo." -AlreadyRunning.LaunchAnyway="Lansați Oricum" Auth.Authing.Title="Se autentifică..." @@ -98,6 +102,8 @@ Auth.StreamInfo="Informații privind transmisiunea" TwitchAuth.Stats="Statistici Twitch" TwitchAuth.Feed="Fluxul activității Twitch" +TwitchAuth.TwoFactorFail.Title="Nu se poate interoga cheia de transmisiune" +TwitchAuth.TwoFactorFail.Text="OBS nu a putut să se conecteze la contul tău Twitch. Te rugăm să te asiguri că autentificarea cu doi factori este configurată în <a href='https://www.twitch.tv/settings/security'>setările de securitate din Twitch</a>, deoarece acest lucru este necesar pentru a transmite." Copy.Filters="Copiază filtrele" Paste.Filters="Lipește filtrele" @@ -112,7 +118,7 @@ BandwidthTest.Region.Other="Alta" Basic.FirstStartup.RunWizard="Vrei să rulezi asistentul de configurare automată? Poți, de asemenea, să configurezi setările manual dând clic pe butonul Setări din fereastra principală." -Basic.FirstStartup.RunWizard.NoClicked="Dacă vă răzgândiți, puteți rula auto-configuratorul oricând din meniul Instrumente." +Basic.FirstStartup.RunWizard.NoClicked="Dacă te răzgândești, poți rula asistentul de configurare automată oricând din meniul Unelte." Basic.AutoConfig="Asistentul de configurare automată" Basic.AutoConfig.ApplySettings="Aplică setările" @@ -130,11 +136,11 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Notă: Rezoluția (de bază) a planșei nu este neapărat aceeași cu rezoluția cu care vei transmite sau înregistra. Rezoluția efectivă de transmisiune/înregistrare poate fi scalată în jos de la rezoluția planșei pentru a reduce necesarul de resurse sau de rată de biți." Basic.AutoConfig.StreamPage="Informații privind transmisiunea" Basic.AutoConfig.StreamPage.SubTitle="Te rugăm să introduci informațiile pentru transmisiune" -Basic.AutoConfig.StreamPage.ConnectAccount="Conectează un cont (opțional)" +Basic.AutoConfig.StreamPage.ConnectAccount="Conectează un cont (recomandat)" Basic.AutoConfig.StreamPage.DisconnectAccount="Deconectează contul" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Deconectezi contul?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Această modificare se va aplica imediat. Ești sigur că vrei să deconectezi contul?" -Basic.AutoConfig.StreamPage.UseStreamKey="Folosește cheia de transmisiune" +Basic.AutoConfig.StreamPage.UseStreamKey="Folosește o cheie de transmisiune" Basic.AutoConfig.StreamPage.Service="Serviciu" Basic.AutoConfig.StreamPage.Service.ShowAll="Afișează toate..." Basic.AutoConfig.StreamPage.Service.Custom="Personalizat..." @@ -143,8 +149,8 @@ Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(Link)" Basic.AutoConfig.StreamPage.PerformBandwidthTest="Estimează rata de biți cu o testare a lățimii de bandă (poate dura câteva minute)" Basic.AutoConfig.StreamPage.PreferHardwareEncoding="Preferă codificarea hardware" -Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="Codificarea hardware elimină cea mai mare parte a utilizării CPU, însă ar putea avea nevoie de o rată de biți mai mare pentru a obține același nivel de calitate." -Basic.AutoConfig.StreamPage.StreamWarning.Title="Avertizare transmisie" +Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="Codificarea hardware elimină cea mai mare parte a utilizării CPU, însă poate necesita o rată de biți mai mare pentru a obține același nivel de calitate." +Basic.AutoConfig.StreamPage.StreamWarning.Title="Avertisment privind transmisiunea" Basic.AutoConfig.StreamPage.StreamWarning.Text="Testarea lățimii de bandă este pe cale să transmită date video aleatorii fără audio către canalul tău. Dacă ai posibilitatea, este recomandat să oprești temporar salvarea videoclipurilor transmisiunilor și să setezi transmisiunea pe privat până la încheierea testării. Continui?" Basic.AutoConfig.TestPage="Rezultate finale" Basic.AutoConfig.TestPage.SubTitle.Testing="Programul rulează acum o serie de teste pentru identificarea setărilor ideale" @@ -170,17 +176,18 @@ Basic.Stats.AverageTimeToRender="Timpul mediu de redare a cadrului" Basic.Stats.SkippedFrames="Cadre sărite din pricina întârzierilor de codificare" Basic.Stats.MissedFrames="Cadre sărite din pricina întârzierii de redare" -Basic.Stats.Output.Stream="Transmisie" +Basic.Stats.Output.Stream="Transmisiune" Basic.Stats.Output.Recording="Înregistrare" Basic.Stats.Status="Stare" -Basic.Stats.Status.Recording="Înregistrare" -Basic.Stats.Status.Live="ÎN DIRECT" -Basic.Stats.Status.Reconnecting="Reconectare" +Basic.Stats.Status.Recording="Se înregistrează" +Basic.Stats.Status.Live="LIVE" +Basic.Stats.Status.Reconnecting="Se reconectează" Basic.Stats.Status.Inactive="Inactiv" Basic.Stats.DroppedFrames="Cadre pierdute (Rețea)" Basic.Stats.MegabytesSent="Date transmise în total" Basic.Stats.Bitrate="Rată de biți" +ResetUIWarning.Title="Sigur vrei să resetezi UI-ul?" Updater.Title="Actualizare nouă disponibilă" Updater.Text="Există o nouă actualizare disponibilă:" @@ -221,9 +228,12 @@ ConfirmStart.Title="Începi transmisiunea?" ConfirmStart.Text="Sigur vrei să pornești transmisiunea?" -ConfirmStop.Title="Oprești streamul?" +ConfirmStop.Title="Oprești transmisiunea?" ConfirmStop.Text="Sigur vrei să oprești transmisiunea?" +ConfirmStopRecord.Title="Oprești înregistrarea?" +ConfirmStopRecord.Text="Sigur vrei să oprești înregistrarea?" + ConfirmBWTest.Title="Începi testarea pentru lățimea de bandă?" ConfirmBWTest.Text="Ai configurat OBS în modul de testare a lățimii de bandă. Acest mod permite testarea rețelei fără să transmiți live pe canal. Odată ce ai terminat testarea, va trebui să îl dezactivezi pentru ca spectatorii să îți poată vedea transmisiunea.\n\nVrei să continui?" @@ -232,26 +242,29 @@ ConfirmRemove.Title="Confirmă eliminarea" ConfirmRemove.Text="Sigur vrei să elimini „$1”?" -ConfirmRemove.TextMultiple="Sigur doriți sa eliminați %1 obiecte?" +ConfirmRemove.TextMultiple="Sigur vrei să elimini %1 elemente?" Output.StartStreamFailed="Pornirea transmisiunii a eșuat" Output.StartRecordingFailed="Pornirea înregistrării a eșuat" -Output.ConnectFail.Title="Eșec la conectare" +Output.ConnectFail.Title="Conectarea a eșuat" Output.ConnectFail.BadPath="URL-ul conexiunii sau calea este invalidă. Te rugăm să verifici setările pentru a confirma că acestea sunt valide." Output.ConnectFail.ConnectFailed="Nu se poate conecta la server" Output.ConnectFail.InvalidStream="Nu a putut fi accesat canalul sau cheia de transmisiune specificată, te rugăm să verifici cheia de transmisiune. Dacă aceasta este corectă, poate fi o problemă cu conectarea la server." Output.ConnectFail.Error="Eroare neașteptată la încercarea de a conecta la server. Mai multe informaţii în fişierul jurnal." Output.ConnectFail.Disconnected="Deconectat de la server." +Output.StreamEncodeError.Title="Eroare privind codificarea" +Output.StreamEncodeError.Msg="A apărut o eroare de codificare în timpul transmisiunii." Output.RecordFail.Title="Eșec la pornirea înregistrării" Output.RecordFail.Unsupported="Formatul de ieşire este fie nesuportat, fie nu suportă mai mult de o pistă audio. Te rugăm să verifici setările şi să încerci din nou." Output.RecordNoSpace.Title="Spațiu insuficient pe disc" Output.RecordNoSpace.Msg="Nu există spațiu suficient pe disc pentru a continua înregistrarea." -Output.RecordError.Title="Eroare de înregistrare" +Output.RecordError.Title="Eroare privind înregistrarea" Output.RecordError.Msg="S-a produs o eroare nespecificată în timpul înregistrării." +Output.RecordError.EncodeErrorMsg="A apărut o eroare de codificare în timpul înregistrării." Output.ReplayBuffer.NoHotkey.Title="Nicio tastă rapidă setată!" Output.BadPath.Title="Calea fișierului greșită" @@ -263,19 +276,20 @@ Remux.SourceFile="Înregistrare OBS" Remux.TargetFile="Fișier țintă" -Remux.Remux="Remux" +Remux.Remux="Remuxează" Remux.Stop="Oprește remuxarea" Remux.ClearFinished="Șterge elementele finalizate" Remux.ClearAll="Șterge toate elementele" Remux.OBSRecording="Înregistrare OBS" -Remux.FinishedTitle="Remuxing încheiat" +Remux.FinishedTitle="Remuxare încheiată" Remux.Finished="Înregistrare remuxată" Remux.FinishedError="Înregistrare remuxată, însă fișierul poate fi incomplet" Remux.SelectRecording="Selectează înregistrarea OBS..." -Remux.FileExistsTitle="Fișierele țintă există deja" -Remux.FileExists="Fișierele deja exista. Vreți să le înlocuiți?" -Remux.ExitUnfinishedTitle="Remuxing în desfășurare" -Remux.ExitUnfinished="Remuxingul nu este încheiat, oprirea în acest moment poate face fișierul țintă inutilizabil.\nSigur vrei să oprești remuxingul?" +Remux.SelectTarget="Selectează fișierul țintă..." +Remux.FileExistsTitle="Fișierele țintă există" +Remux.FileExists="Următoarele fișiere țintă există deja. Vrei să le înlocuiești?" +Remux.ExitUnfinishedTitle="Remuxare în desfășurare" +Remux.ExitUnfinished="Remuxarea nu este încheiată, oprirea în acest moment poate face fișierul țintă inutilizabil.\nSigur vrei să oprești remuxarea?" Remux.HelpText="Plasează fișierele în această fereastră pentru a remuxa ori selectează o celulă „Înregistrare OBS” goală pentru a răsfoi un fișier." UpdateAvailable="Actualizare nouă disponibilă" @@ -293,11 +307,14 @@ Basic.Main.PreviewConextMenu.Enable="Activează previzualizarea" +Basic.Main.Preview.Disable="Dezactivează previzualizarea" +ScaleFiltering="Filtrare scalară" ScaleFiltering.Point="Punct" -ScaleFiltering.Bilinear="Biliniar" -ScaleFiltering.Bicubic="Bicubic" +ScaleFiltering.Bilinear="Bilineară" +ScaleFiltering.Bicubic="Bicubică" ScaleFiltering.Lanczos="Lanczos" +ScaleFiltering.Area="Zonă" Deinterlacing="Deîntrețesere" Deinterlacing.Discard="Înlătură" @@ -329,6 +346,7 @@ RenameProfile.Title="Redenumește profilul" +Basic.Main.MixerRename.Title="Redenumește sursa audio" Basic.Main.MixerRename.Text="Te rugăm să introduci numele sursei audio" @@ -414,6 +432,8 @@ Basic.Main.StartRecording="Pornește înregistrarea" Basic.Main.StartStreaming="Pornește transmisiunea" Basic.Main.StopRecording="Oprește înregistrarea" +Basic.Main.PauseRecording="Pune pe pauză înregistrarea" +Basic.Main.UnpauseRecording="Scoate de pe pauză înregistrarea" Basic.Main.StoppingRecording="Se oprește înregistrarea..." Basic.Main.StopStreaming="Oprește transmisiunea" Basic.Main.StoppingStreaming="Se oprește transmisiunea..." @@ -425,12 +445,12 @@ Basic.MainMenu.File.Export="&Exportă" Basic.MainMenu.File.Import="&Importă" Basic.MainMenu.File.ShowRecordings="Afișează în®istrările" -Basic.MainMenu.File.Remux="Înregistrări re&mux" +Basic.MainMenu.File.Remux="Re&muxează înregistrări" Basic.MainMenu.File.Settings="&Setări" Basic.MainMenu.File.ShowSettingsFolder="Afișează folderul cu setări" Basic.MainMenu.File.ShowProfileFolder="Afișează folderul cu profiluri" Basic.MainMenu.AlwaysOnTop="Întotde&auna deasupra" -Basic.MainMenu.File.Exit="Ieșire (&X)" +Basic.MainMenu.File.Exit="Ieși (&X)" Basic.MainMenu.Edit="&Editare" Basic.MainMenu.Edit.Undo="An&ulează acțiunea" @@ -455,7 +475,7 @@ Basic.MainMenu.Edit.Transform.StretchToScreen="Întinde pe ecran (&S)" Basic.MainMenu.Edit.Transform.CenterToScreen="&Centrează pe ecran" Basic.MainMenu.Edit.Order="&Ordonare" -Basic.MainMenu.Edit.Order.MoveUp="M&ută sus" +Basic.MainMenu.Edit.Order.MoveUp="Mută s&us" Basic.MainMenu.Edit.Order.MoveDown="Mută jos (&D)" Basic.MainMenu.Edit.Order.MoveToTop="Mu&tă în vârf" Basic.MainMenu.Edit.Order.MoveToBottom="Mută la fund (&B)" @@ -488,7 +508,7 @@ Basic.MainMenu.Help.Discord="Alătură-te serverului de &Discord" Basic.MainMenu.Help.Logs="Fișiere jurna&l" Basic.MainMenu.Help.Logs.ShowLogs="Afișează fișierele jurnal (&S)" -Basic.MainMenu.Help.Logs.UploadCurrentLog="În&carcă actualul fişier jurnal" +Basic.MainMenu.Help.Logs.UploadCurrentLog="Încarcă a&ctualul fișier jurnal" Basic.MainMenu.Help.Logs.UploadLastLog="Încarcă u<imul fișier jurnal" Basic.MainMenu.Help.Logs.ViewCurrentLog="&Vezi log-ul actual" Basic.MainMenu.Help.CheckForUpdates="Caută actualizări" @@ -524,11 +544,22 @@ Basic.Settings.General.SaveProjectors="Salvează proiectoarele la ieșire" Basic.Settings.General.Preview="Previzualizare" Basic.Settings.General.SwitchOnDoubleClick="Efectuează tranziția către scenă la dublu clic" +Basic.Settings.General.StudioPortraitLayout="Activează aranjamentul de tip portret/vertical" +Basic.Settings.General.Multiview="Vizualizare multiplă" Basic.Settings.General.Multiview.MouseSwitch="Efectuează clic pentru a comuta între scene" Basic.Settings.General.Multiview.DrawSourceNames="Afișează numele scenelor" +Basic.Settings.General.MultiviewLayout="Aranjament pentru vizualizare multiplă" +Basic.Settings.General.MultiviewLayout.Horizontal.Top="Orizontal, sus (8 scene)" +Basic.Settings.General.MultiviewLayout.Horizontal.Bottom="Orizontal, jos (8 scene)" +Basic.Settings.General.MultiviewLayout.Vertical.Left="Vertical, stânga (8 scene)" +Basic.Settings.General.MultiviewLayout.Vertical.Right="Vertical, dreapta (8 scene)" +Basic.Settings.General.MultiviewLayout.Horizontal.Extended.Top="Orizontal, sus (24 de scene)" Basic.Settings.Stream="Transmisiune" Basic.Settings.Stream.StreamType="Tipul transmisiunii" +Basic.Settings.Stream.Custom.UseAuthentication="Folosește autentificarea" +Basic.Settings.Stream.Custom.Username="Nume de utilizator" +Basic.Settings.Stream.Custom.Password="Parolă" Basic.Settings.Stream.BandwidthTestMode="Activează modul de testare a lățimii de bandă" Basic.Settings.Output="Ieșire" @@ -552,6 +583,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Calitate lossless, dimensiune extrem de mare pentru fișiere" Basic.Settings.Output.Simple.Warn.VideoBitrate="Avertisment: Rata de biți a transmisiei video va fi setată la %1, care este limita superioară pentru serviciul de transmisiune actual. Dacă ești sigur că vrei să depășești %1, activează opțiunile avansate ale codificatorului și debifează „Impune limitele ratei de biți pentru serviciul de transmisiune”." Basic.Settings.Output.Simple.Warn.AudioBitrate="Avertisment: Rata de biți a transmisiei audio va fi setată la %1, care este limita superioară pentru serviciul de transmisiune actual. Dacă ești sigur că vrei să depășești %1, activează opțiunile avansate ale codificatorului și debifează „Impune limitele ratei de biți pentru serviciul de transmisiune”." +Basic.Settings.Output.Simple.Warn.CannotPause="Avertisment: Înregistrările nu pot fi puse pe pauză dacă calitatea de înregistrare este setată pe „La fel cu cea a streamului”." Basic.Settings.Output.Simple.Warn.Encoder="Avertisment: Înregistrarea cu un codificator software la o calitate diferită de cea a transmisiunii va necesita o utilizare CPU crescută dacă transmiți şi înregistrezi în același timp." Basic.Settings.Output.Simple.Warn.Lossless="Avertisment: Calitatea lossless generează dimensiuni extrem de mari de fișiere! Calitatea lossless poate folosi până la 7GB spațiu de disc per minut la frecvențe de cadre și rezoluții ridicate. Lossless nu este recomandat pentru înregistrări lungi decât dacă ai o cantitate foarte mare de spațiu disponibil pe disc." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Sigur vrei să folosești calitatea lossless?" @@ -564,7 +596,6 @@ Basic.Settings.Output.VideoBitrate="Rată de biți video" Basic.Settings.Output.AudioBitrate="Rată de biți audio" Basic.Settings.Output.Reconnect="Reconectare automată" -Basic.Settings.Output.RetryDelay="Întârziere pentru reîncercare (secunde)" Basic.Settings.Output.MaxRetries="Reîncercări maxime" Basic.Settings.Output.Advanced="Activează setările avansate ale codificatorului" Basic.Settings.Output.EncoderPreset="Presetare pentru codificator" @@ -634,7 +665,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Biliniar (Cel mai rapid, dar neclar în cazul scalării)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (Scalare ascuțită, 16 mostre)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Scalare ascuțită, 32 de mostre)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Scalare ascuțită, 36 de mostre)" +Basic.Settings.Video.DownscaleFilter.Area="Zonă (Sumă ponderată, 4/6/9 mostre)" Basic.Settings.Audio="Audio" Basic.Settings.Audio.SampleRate="Rată de eșantionare" @@ -642,8 +674,16 @@ Basic.Settings.Audio.MeterDecayRate.Fast="Rapidă" Basic.Settings.Audio.MeterDecayRate.Medium="Medie (Type I PPM)" Basic.Settings.Audio.MeterDecayRate.Slow="Lentă (Type II PPM)" +Basic.Settings.Audio.MultiChannelWarning.Enabled="AVERTISMENT: Sunetul audio cu sunet surround este activat." +Basic.Settings.Audio.MultichannelWarning.Title="Activezi sistemul audio cu sunet surround?" +Basic.Settings.Audio.MultichannelWarning.Confirm="Sigur vrei să activezi sistemul audio cu sunet surround?" +Basic.Settings.Audio.Devices="Dispozitive" Basic.Settings.Audio.DesktopDevice="Audio desktop" Basic.Settings.Audio.DesktopDevice2="Audio desktop 2" +Basic.Settings.Audio.AuxDevice="Audio microfon/auxiliar" +Basic.Settings.Audio.AuxDevice2="Audio microfon/auxiliar 2" +Basic.Settings.Audio.AuxDevice3="Audio microfon/auxiliar 3" +Basic.Settings.Audio.AuxDevice4="Audio microfon/auxiliar 4" Basic.Settings.Audio.EnablePushToMute="Activează push-to-mute" Basic.Settings.Audio.PushToMuteDelay="Întârziere la push-to-mute" Basic.Settings.Audio.EnablePushToTalk="Activează push-to-talk" @@ -661,26 +701,30 @@ Basic.Settings.Advanced.FormatWarning="Atentie: Formatele de culori diferite de NV12 sunt facute pentru inregistrare si nu sunt recomandate in cazul streaming-ului. Streaming-ul e posibil sa ceara mai multe resurse CPU datorita conversiei formatului culorii." Basic.Settings.Advanced.Audio.BufferingTime="Timp pentru zona tampon audio" Basic.Settings.Advanced.Video.ColorFormat="Format de culori" +Basic.Settings.Advanced.Video.ColorSpace="Spațiu de culori" +Basic.Settings.Advanced.Video.ColorRange="Gamă de culori" Basic.Settings.Advanced.Video.ColorRange.Partial="Parțială" Basic.Settings.Advanced.Video.ColorRange.Full="Completă" +Basic.Settings.Advanced.Audio.MonitoringDevice="Dispozitiv de monitorizare" Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Implicit" Basic.Settings.Advanced.StreamDelay="Întârziere pentru transmisiune" -Basic.Settings.Advanced.StreamDelay.Duration="Durată (secunde)" Basic.Settings.Advanced.StreamDelay.Preserve="Păstrează punctul de tăiere (crește întârzierea) la reconectare" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Utilizare estimată a memoriei: %1 MB" Basic.Settings.Advanced.Network="Rețea" Basic.Settings.Advanced.Network.BindToIP="Leagă de IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Activează noul cod pentru rețea" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Mod de latență redusă" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Comportamentul focalizării pentru tastele rapide" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Nu dezactiva niciodată tastele rapide" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Dezactivează tastele rapide când fereastra principală este în prim-plan" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Dezactivează tastele rapide când fereastra principală nu este focalizată" Basic.Settings.Advanced.AutoRemux="Remuxează automat în mp4" Basic.Settings.Advanced.AutoRemux.MP4="(înregistrează ca mkv)" Basic.AdvAudio="Proprietăți audio avansate" Basic.AdvAudio.Name="Nume" -Basic.AdvAudio.Mono="Transformă în mono" +Basic.AdvAudio.Volume="Volum" Basic.AdvAudio.Balance="Balans" -Basic.AdvAudio.SyncOffset="Decalajul sincronizării (ms)" Basic.AdvAudio.Monitoring="Monitorizare audio" Basic.AdvAudio.Monitoring.None="Monitorizare dezactivată" Basic.AdvAudio.Monitoring.MonitorOnly="Numai monitorizare (amuțește ieșirea)" @@ -733,6 +777,7 @@ Hotkeys.AppleKeypadDecimal=". (Tastatură numerică)" Hotkeys.AppleKeypadEqual="= (Tastatură numerică)" Hotkeys.MouseButton="Mouse %1" +Hotkeys.Escape="Esc" Mute="Pune pe mut" Unmute="Scoate de pe mut" @@ -744,12 +789,17 @@ OutputWarnings.NoTracksSelected="Trebuie să selectezi cel puțin o pistă" OutputWarnings.MultiTrackRecording="Atenție: Anumite formate (precum FLV) nu suportă multiple piste per înregistrare" +OutputWarnings.CannotPause="Avertisment: Înregistrările nu pot fi puse pe pauză dacă codificatorul de înregistrare este setat pe „(Folosește codificatorul de transmisiune)”" FinalScene.Title="Șterge scena" FinalScene.Text="Trebuie să existe cel puțin o scenă." +NoSources.Title="Nicio sursă" +NoSources.Text="Se pare că nu ai adăugat încă nicio sursă video, așa că se va afișa doar un ecran negru. Sigur vrei să faci asta?" +NoSources.Label="Nu ai nicio sursă. Dă clic pe\nbutonul + de mai jos sau\nclic dreapta aici pentru a adăuga una." ChangeBG="Setează culoarea" +CustomColor="Culoare personalizată" BrowserSource.EnableHardwareAcceleration="Activează accelerarea hardware pentru Browser Source" @@ -762,4 +812,5 @@ About.Contribute="Sprijină proiectul OBS" +PreviewTransition="Previzualizează tranziția"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ru-RU.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ru-RU.ini
Changed
@@ -23,7 +23,7 @@ Display="Экран" Name="Название" Exit="Выход" -Mixer="Микшер" +Mixer="Аудио микшер" Browse="Обзор" Mono="Моно" Stereo="Стерео" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Закрытие закрепляемого окна" DockCloseWarning.Text="Вы только что закрыли закрепляемое окно. Если вы хотите показать его снова, используйте меню Вид → Док-панели в строке меню." +ExtraBrowsers="Пользовательские доки браузера" +ExtraBrowsers.Info="Добавьте док-панели, указав имя или ссылку, затем нажмите Принять или Закрыть, чтобы открыть док-панели. Вы можете добавлять или удалять док-панели когда угодно." +ExtraBrowsers.DockName="Название дока" + Auth.Authing.Title="Аутентификация..." Auth.Authing.Text="Аутентификация с %1, пожалуйста подождите..." Auth.AuthFailure.Title="Ошибка аутентификации" @@ -106,7 +110,8 @@ TwitchAuth.Stats="Статистика Twitch" TwitchAuth.Feed="Лента активности Twitch" TwitchAuth.TwoFactorFail.Title="Не удалось запросить ключ трансляции" -TwitchAuth.TwoFactorFail.Text="Невозможно подключиться к учётной записи Twitch. Пожалуйста, убедитесь, что в <a href='https://www.twitch.tv/settings/security'>настройках безопасности</a> включена и настроена двухфакторная аутентификация." +TwitchAuth.TwoFactorFail.Text="OBS не смогло подключиться к вашему Twitch аккаунту. Пожалуйста, проверьте что двуфакторная аутентификация включена в <a href='https://www.twitch.tv/settings/security'>Настройках безопасности Twitch</a> она требуется для начала прямой трансляции." +RestreamAuth.Channels="Restream каналы" Copy.Filters="Копировать фильтры" Paste.Filters="Вставить фильтры" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Примечание: Разрешение холста (базовое), не обязательно должно совпадать с разрешением трансляции или записи. Реальное разрешение вашей трансляции/записи может быть снижено для уменьшения использования ресурсов или битрейта." Basic.AutoConfig.StreamPage="Информация о трансляции" Basic.AutoConfig.StreamPage.SubTitle="Пожалуйста, введите вашу информацию о трансляциях" -Basic.AutoConfig.StreamPage.ConnectAccount="Подключить аккаунт (необязательно)" +Basic.AutoConfig.StreamPage.ConnectAccount="Подключить аккаунт (рекомендуется)" Basic.AutoConfig.StreamPage.DisconnectAccount="Отключить аккаунт" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Отключить аккаунт?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Это изменение вступит в силу немедленно. Вы уверены, что хотите отключить ваш аккаунт?" @@ -178,7 +183,7 @@ Basic.Stats.MemoryUsage="Использование памяти" Basic.Stats.AverageTimeToRender="Среднее время рендеринга кадра" Basic.Stats.SkippedFrames="Пропущенные кадры из-за задержки кодирования" -Basic.Stats.MissedFrames="Кадры, пропущенные из-за отставания рендеринга" +Basic.Stats.MissedFrames="Пропущенные кадры из-за отставания рендеринга" Basic.Stats.Output.Stream="Трансляция" Basic.Stats.Output.Recording="Запись" Basic.Stats.Status="Статус" @@ -210,9 +215,9 @@ QuickTransitions.SwapScenes="Менять местами сцены предпросмотра и вывода после перехода" QuickTransitions.SwapScenesTT="Меняет местами сцены предпросмотра и вывода после перехода (если оригинальная выходная сцена до сих пор существует).\nЭто не отменяет никаких изменений, которые возможно были сделаны в оригинальной выходной сцене." QuickTransitions.DuplicateScene="Дублировать сцену" -QuickTransitions.DuplicateSceneTT="При редактировании одной и той же сцены, функция позволяет трансформировать редактирования/видимости источников без изменения выхода.\nДля редактирования свойств источников без изменения выходного сигнала, включить \"дублировать источники'.\nИзменение этого параметра приведет к сбросу выходного сигнала в сцене (если оно еще существует)." +QuickTransitions.DuplicateSceneTT="При редактировании одной и той же сцены, функция позволяет трансформировать редактирования/видимости источников без изменения выхода.\nДля редактирования свойств источников без изменения выходного сигнала, включить \"дублировать источники'.\nИзменение этого параметра приведёт к сбросу выходного сигнала в сцене (если оно ещё существует)." QuickTransitions.EditProperties="Дублировать источники" -QuickTransitions.EditPropertiesTT="При редактировании одной и той же сцены, функция позволяет редактировать свойства источников без изменения выхода.\nЭто может только использоваться, если \"Повторяющиеся Сцены\" включен.\nНекоторые источники (такие как захват или медиа-источники) не поддерживаются и не могут быть отредактированы отдельно.\nИзменение этого параметра приведет к сбросу выходного сигнала в сцене (если оно еще существует).\n\nПредупреждение: поскольку источники будут дублироваться, это может потребовать дополнительных системных ресурсов или видео." +QuickTransitions.EditPropertiesTT="При редактировании одной и той же сцены, функция позволяет редактировать свойства источников без изменения выхода.\nЭто может только использоваться, если параметр \"Повторяющиеся Сцены\" включён.\nНекоторые источники (такие как захват или медиа-источники) не поддерживаются и не могут быть отредактированы отдельно.\nИзменение этого параметра приведёт к сбросу выходного сигнала в сцене (если оно ещё существует).\n\nПредупреждение: поскольку источники будут дублироваться, это может потребовать дополнительных системных ресурсов или видео." QuickTransitions.HotkeyName="Быстрый переход: %1" Basic.AddTransition="Добавить настраиваемый переход" @@ -240,6 +245,9 @@ ConfirmStop.Title="Остановить трансляцию?" ConfirmStop.Text="Вы уверены, что хотите остановить трансляцию?" +ConfirmStopRecord.Title="Остановить запись?" +ConfirmStopRecord.Text="Вы уверены, что хотите остановить запись?" + ConfirmBWTest.Title="Начать тест пропускной способности?" ConfirmBWTest.Text="Вы настроили OBS в режиме тестирования пропускной способности. Этот режим позволяет тестировать сеть без выхода вашего канала в эфир. После того, как вы закончите тестирование, вам необходимо выключить эту функцию для того чтобы зрители могли видеть вашу трансляцию.\n\nВы хотите продолжить?" @@ -253,15 +261,17 @@ Output.StartStreamFailed="Не удалось запустить вещание" Output.StartRecordingFailed="Не удалось начать запись" Output.StartReplayFailed="Не удалось запустить воспроизведение из буфера" -Output.StartFailedGeneric="Сбой вывода. Подробности отражены в журнале.\n\nПримечание: Если вы используете кодировщики NVENC или AMD, убедитесь что у вас установлена последняя версия видеорайвера." +Output.StartFailedGeneric="Сбой вывода. Подробности отражены в журнале.\n\nПримечание: Если вы используете кодировщики NVENC или AMD, убедитесь что у вас установлена последняя версия видеодрайвера." +Output.ReplayBuffer.PauseWarning.Title="Не удаётся сохранить повторы во время паузы" +Output.ReplayBuffer.PauseWarning.Text="Предупреждение: Повторы не могут быть сохранены во время приостановления записи." Output.ConnectFail.Title="Не удалось подключиться" Output.ConnectFail.BadPath="Неверный путь или URL соединения. Пожалуйста, проверьте настройки, чтобы подтвердить, что они являются действительными." Output.ConnectFail.ConnectFailed="Не удалось подключиться к серверу" Output.ConnectFail.InvalidStream="Не удалось получить доступ к указанному ключу канала или стрима, пожалуйста, перепроверьте ключ. Если он правильный, проблема может быть с подключением к серверу." Output.ConnectFail.Error="Произошла непредвиденная ошибка при попытке подключиться к серверу. Более подробная информация в лог-файле." -Output.ConnectFail.Disconnected="Отключен от сервера." +Output.ConnectFail.Disconnected="Отключён от сервера." Output.StreamEncodeError.Title="Ошибка кодирования" Output.StreamEncodeError.Msg="Произошла ошибка кодировщика во время трансляции." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Запустить повтор" Basic.Main.StartStreaming="Запустить трансляцию" Basic.Main.StopRecording="Остановить запись" +Basic.Main.PauseRecording="Приостановить запись" +Basic.Main.UnpauseRecording="Возобновить запись" Basic.Main.StoppingRecording="Остановка записи..." Basic.Main.StopReplayBuffer="Остановить повтор" Basic.Main.StoppingReplayBuffer="Остановка повтора..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="Док-панели" Basic.MainMenu.View.Docks.ResetUI="Сбросить интерфейс" Basic.MainMenu.View.Docks.LockUI="Зафиксировать интерфейс" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Пользовательские доки браузера..." Basic.MainMenu.View.Toolbars.Listboxes="Списки (&L)" Basic.MainMenu.View.SceneTransitions="Сцена переходов (&C)" Basic.MainMenu.View.StatusBar="Строка состояния (&S)" @@ -534,8 +547,8 @@ Basic.MainMenu.Help.About="О программе (&A)" Basic.Settings.ProgramRestart="Для изменения этих параметров требуется перезапустить программу." -Basic.Settings.ConfirmTitle="Подтверждить Изменения" -Basic.Settings.Confirm="У вас есть несохраненные изменения. Сохранить изменения?" +Basic.Settings.ConfirmTitle="Подтверждение изменений" +Basic.Settings.Confirm="У вас есть несохранённые изменения. Сохранить изменения?" Basic.Settings.General="Общие" Basic.Settings.General.Theme="Тема" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Открывать окно статистики при запуске" Basic.Settings.General.WarnBeforeStartingStream="Показывать окно подтверждения при запуске трансляции" Basic.Settings.General.WarnBeforeStoppingStream="Показывать окно подтверждения при остановке трансляции" +Basic.Settings.General.WarnBeforeStoppingRecord="Показывать окно подтверждения при остановке записи" Basic.Settings.General.Projectors="Проекторы" Basic.Settings.General.HideProjectorCursor="Скрыть курсор за проекторы" Basic.Settings.General.ProjectorAlwaysOnTop="Показывать проекторы поверх всех окон" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Выбрать каталог записи" Basic.Settings.Output.SelectFile="Выбрать файл записи" Basic.Settings.Output.EnforceBitrate="Следовать ограничениям битрейта, накладываемые потоковой службой" +Basic.Settings.Output.DynamicBitrate="Динамически изменять битрейт для управления перегрузкой сети" +Basic.Settings.Output.DynamicBitrate.Beta="Динамически изменять битрейт для управления перегрузкой сети (бета)" +Basic.Settings.Output.DynamicBitrate.TT="Вместо пропуска кадров, будет задействовано динамическое изменение битрейта на лету, чтобы уменьшить перегрузку сети.\n\nОбратите внимание, что это может увеличить задержку для зрителей, в случае внезапного забивания канала.\nПосле уменьшения битрейта может потребоваться несколько минут для его восстановления.\n\nВ настоящее время поддерживается только для RTMP." Basic.Settings.Output.Mode="Режим вывода" Basic.Settings.Output.Mode.Simple="Простой" Basic.Settings.Output.Mode.Adv="Расширенный" Basic.Settings.Output.Mode.FFmpeg="Вывод FFmpeg" Basic.Settings.Output.UseReplayBuffer="Включить Буфер повтора" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Максимальное время повтора (секунд)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Максимальное время повтора" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Максимальный объем памяти (МБ)" Basic.Settings.Output.ReplayBuffer.Estimate="Предполагаемое использование памяти: %1 МБ" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Невозможно оценить использование памяти. Пожалуйста, установите максимальный объем памяти." @@ -611,8 +628,9 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Без потери качества, чрезвычайно большой размер файла" Basic.Settings.Output.Simple.Warn.VideoBitrate="Предупреждение: битрейт видео при вещании будет установлен на %1, что является максимумом для текущей потоковой службы. Если вы уверены, что хотите получить битрейт больше %1, включите дополнительные настройки кодировщика и снимите флажок с \"Принудительно использовать ограничения битрейта потоковой службы\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Предупреждение: битрейт аудио при вещании будет установлен на %1, что является максимумом для текущей потоковой службы. Если вы уверены, что хотите получить битрейт больше %1, включите дополнительные настройки кодировщика и снимите флажок с \"Принудительно использовать ограничения битрейта потоковой службы\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Предупреждение: Записи не могут быть приостановлены, если качество записи установлено на \"То же самое как поток\"." Basic.Settings.Output.Simple.Warn.Encoder="Предупреждение: Запись с программным кодировщиком в качестве, отличным от качества трансляции, потребует дополнительной нагрузки на ЦП, если записывать и транслировать одновременно." -Basic.Settings.Output.Simple.Warn.Lossless="Предупреждение: Качество без потерь создает чрезвычайно большие файлы! Такое качество может использовать свыше 7 гигабайт дискового пространства в минуту при высоком разрешении и частоте кадров. Оно не рекомендуется для долгой записи, если у Вас нет очень много места на диске." +Basic.Settings.Output.Simple.Warn.Lossless="Предупреждение: Качество без потерь создаёт чрезвычайно большие файлы! Такое качество может использовать свыше 7 гигабайт дискового пространства в минуту при высоком разрешении и частоте кадров. Оно не рекомендуется для долгой записи, если у Вас нет очень много места на диске." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Вы уверены, что хотите записывать без потери качества?" Basic.Settings.Output.Simple.Warn.Lossless.Title="Предупреждение о качестве без потерь!" Basic.Settings.Output.Simple.Encoder.Software="Программный (x264)" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Битрейт видео" Basic.Settings.Output.AudioBitrate="Битрейт аудио" Basic.Settings.Output.Reconnect="Автопереподключение" -Basic.Settings.Output.RetryDelay="Переподключиться через (секунд)" +Basic.Settings.Output.RetryDelay="Задержка повтора" Basic.Settings.Output.MaxRetries="Количество попыток подключиться" Basic.Settings.Output.Advanced="Включить дополнительные настройки кодировщика" Basic.Settings.Output.EncoderPreset="Предустановка кодировщика" @@ -671,8 +689,9 @@ Basic.Settings.Output.Adv.FFmpeg.GOPSize="Интервал ключевых кадров (кадры)" Basic.Settings.Output.Adv.FFmpeg.IgnoreCodecCompat="Показать все кодеки (даже потенциально несовместимые)" +FilenameFormatting.completer="%CCYY-%MM-%DD %hh-%mm-%ss\n%YY-%MM-%DD %hh-%mm-%ss\n%Y-%m-%d %H-%M-%S\n%y-%m-%d %H-%M-%S\n%a %Y-%m-%d %H-%M-%S\n%A %Y-%m-%d %H-%M-%S\n%Y-%b-%d %H-%M-%S\n%Y-%B-%d %H-%M-%S\n%Y-%m-%d %I-%M-%S-%p\n%Y-%m-%d %H-%M-%S-%z\n%Y-%m-%d %H-%M-%S-%Z" -FilenameFormatting.TT="%CCYY Год, четыре знака\n%YY Год, последние два знака (00-99)\n%MM Месяц в числовом значении (01-12)\n%DD День месяца, ноль не опускается (01-31)\n%hh Час в 24-часовом формате (00-23)\n%mm Минута (00-59)\n%ss Секунда (00-61)\n%% Знак '%'\n%a Сокращенное название дня недели\n%A Полное название дня недели\n%b Сокращенное название месяца\n%B Полное название месяца\n%d День месяца, ноль не опускается (01-31)\n%H Час в 24 часовом формате (00-23)\n%I Час в 12 часовом формате (01-12)\n%m Месяц в числовом значении (01-12)\n%M Минута (00-59)\n%p Обозначение AM или PM\n%S Секунда (00-61)\n%y Год, последние два знака (00-99)\n%Y Год\n%z ISO 8601 смещение от UTC или\n название или сокращение часового пояса\n%Z Название или сокращение часового пояса\n" +FilenameFormatting.TT="%CCYY Год, четыре знака\n%YY Год, последние два знака (00-99)\n%MM Месяц в числовом значении (01-12)\n%DD День месяца, ноль не опускается (01-31)\n%hh Час в 24-часовом формате (00-23)\n%mm Минута (00-59)\n%ss Секунда (00-61)\n%% Знак '%'\n%a Сокращенное название дня недели\n%A Полное название дня недели\n%b Сокращённое название месяца\n%B Полное название месяца\n%d День месяца, ноль не опускается (01-31)\n%H Час в 24 часовом формате (00-23)\n%I Час в 12 часовом формате (01-12)\n%m Месяц в числовом значении (01-12)\n%M Минута (00-59)\n%p Обозначение AM или PM\n%S Секунда (00-61)\n%y Год, последние два знака (00-99)\n%Y Год\n%z ISO 8601 смещение от UTC или\n название или сокращение часового пояса\n%Z Название или сокращение часового пояса\n" Basic.Settings.Video="Видео" Basic.Settings.Video.Adapter="Видеоадаптер" @@ -693,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Билинейный (самый быстрый, но размытый при масштабировании)" Basic.Settings.Video.DownscaleFilter.Bicubic="Бикубический (чёткое масштабирование, 16 выборок)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Метод Ланцоша (Чёткое масштабирование, 32 выборки)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Метод Ланцоша (Чёткое масштабирование, 36 выборок)" +Basic.Settings.Video.DownscaleFilter.Area="Область (взвешенная сумма, 4/6/9 выборок)" Basic.Settings.Audio="Аудио" Basic.Settings.Audio.SampleRate="Частота дискретизации" @@ -704,12 +724,12 @@ Basic.Settings.Audio.MeterDecayRate.Medium="Средне (PPM типа I)" Basic.Settings.Audio.MeterDecayRate.Slow="Медленно (PPM типа II)" Basic.Settings.Audio.PeakMeterType="Тип измерителя пиков" -Basic.Settings.Audio.PeakMeterType.SamplePeak="Упрощенный" +Basic.Settings.Audio.PeakMeterType.SamplePeak="Упрощённый" Basic.Settings.Audio.PeakMeterType.TruePeak="Точный (Повышенное использование ЦП)" Basic.Settings.Audio.MultiChannelWarning.Enabled="ВНИМАНИЕ: Объемный звук включен." -Basic.Settings.Audio.MultichannelWarning="При запуске стрима проверьте, поддерживает ли ваш сервис потокового вещания объемный звук (как запись, так и воспроизведение). Twitch, Facebook 360 Live, Mixer RTMP, Smashcast — примеры сервисов, полностью поддерживающих объемное звучание. Несмотря на то, что Facebook Live и Youtube Live принимают объёмный звук, Facebook Live микширует его в стерео, а Youtube Live воспроизводит только два канала.\n\nЗвуковые фильтры OBS совместимы с объемным звучанием, хотя поддержка плагинов VST не гарантируется." +Basic.Settings.Audio.MultichannelWarning="При запуске стрима проверьте, поддерживает ли ваш сервис потокового вещания объёмный звук (как запись, так и воспроизведение). Facebook 360 Live, Mixer RTMP, Smashcast — примеры сервисов, полностью поддерживающих объёмное звучание. Несмотря на то, что Facebook Live и Youtube Live принимают объёмный звук, Facebook Live микширует его в стерео, а Youtube Live воспроизводит только два канала.\n\nЗвуковые фильтры OBS совместимы с объёмным звучанием, хотя поддержка плагинов VST не гарантируется." Basic.Settings.Audio.MultichannelWarning.Title="Включить объемный звук?" -Basic.Settings.Audio.MultichannelWarning.Confirm="Хотите включить объемный звук?" +Basic.Settings.Audio.MultichannelWarning.Confirm="Хотите включить объёмный звук?" Basic.Settings.Audio.Devices="Устройства" Basic.Settings.Audio.DesktopDevice="Аудио с рабочего стола" Basic.Settings.Audio.DesktopDevice2="Аудио с рабочего стола 2" @@ -742,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="По умолчанию" Basic.Settings.Advanced.Audio.DisableAudioDucking="Отключить приглушение звуков Windows" Basic.Settings.Advanced.StreamDelay="Задержка потока" -Basic.Settings.Advanced.StreamDelay.Duration="Продолжительность (секунд)" +Basic.Settings.Advanced.StreamDelay.Duration="Длительность" Basic.Settings.Advanced.StreamDelay.Preserve="Сохранить точку отсечки (увеличить задержку) при переподключении" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Предполагаемое использование памяти: %1 МБ" Basic.Settings.Advanced.Network="Сеть" Basic.Settings.Advanced.Network.BindToIP="Привязать к IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Включить новый сетевой код" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Режим низкой задержки" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Поведение фокуса горячих клавиш" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Никогда не отключать горячие клавиши" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Отключить горячие клавиши, если главное окно находится в фокусе" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Отключать горячие клавиши, когда главное окно вне фокуса" Basic.Settings.Advanced.AutoRemux="Автоматически ремультиплексировать в mp4" Basic.Settings.Advanced.AutoRemux.MP4="(записывать как mkv)" Basic.AdvAudio="Расширенные свойства аудио" Basic.AdvAudio.Name="Название" Basic.AdvAudio.Volume="Громкость" -Basic.AdvAudio.Mono="Объединение в один канал" +Basic.AdvAudio.Mono="Моно" Basic.AdvAudio.Balance="Баланс" -Basic.AdvAudio.SyncOffset="Смещение синхронизации (мс)" +Basic.AdvAudio.SyncOffset="Смещение синхронизации" Basic.AdvAudio.Monitoring="Аудио прослушивание" Basic.AdvAudio.Monitoring.None="Выключить прослушивание" Basic.AdvAudio.Monitoring.MonitorOnly="Только прослушивание (заглушить вывод)" @@ -823,13 +846,14 @@ OutputWarnings.NoTracksSelected="Вы должны выбрать хотя бы одну звуковую дорожку" OutputWarnings.MultiTrackRecording="Предупреждение: Некоторые форматы (такие как FLV) не поддерживают множественные звуковые дорожки" -OutputWarnings.MP4Recording="Внимание: Записи, сохраненные в MP4/MOV будут нечитаемы если файл не будет завершен (например, в результате BSOD'а, потери напряжения в сети и т.д.). Если вы хотите записывать несколько аудио дорожек, рассмотрите использование MKV и последующее ремультиплексирование в MP4/MOV после завершения записи (Файл → Ремультиплексирование записей)" +OutputWarnings.MP4Recording="Внимание: Записи, сохранённые в MP4/MOV будут нечитаемы, если файл не будет завершён (например, в результате BSOD'а, потери напряжения в сети и т.д.). Если вы хотите записывать несколько аудио дорожек, рассмотрите использование MKV и последующее ремультиплексирование в MP4/MOV после завершения записи (Файл → Ремультиплексирование записей)" +OutputWarnings.CannotPause="Предупреждение: Записи не могут быть приостановлены, если кодировщик записи установлен на \"(Использовать кодировщик потока)\"" FinalScene.Title="Удалить сцену" FinalScene.Text="Здесь должна быть по крайней мере одна сцена." NoSources.Title="Нет источников" -NoSources.Text="Похоже, вы еще не добавили ни одного источника. Вы будете выводить только пустой экран. Вы уверены, что хотите этого?" +NoSources.Text="Похоже, вы ещё не добавили ни одного источника. Вы будете выводить только пустой экран. Вы уверены, что хотите этого?" NoSources.Text.AddSource="Вы можете добавить источники, нажав иконку + под окном Источники в главном окне в любое время." NoSources.Label="У вас нет источников.\nНажмите кнопку + ниже,\nили нажмите правой кнопкой здесь, чтобы добавить его."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/sk-SK.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/sk-SK.ini
Changed
@@ -23,7 +23,6 @@ Display="Monitor" Name="Meno" Exit="Ukončiť" -Mixer="Zmiešavač" Browse="Prehľadávať" Mono="Mono" Stereo="Stereo" @@ -61,7 +60,7 @@ Minutes="Minúty" Seconds="Sekundy" Deprecated="Zastaralé" -ReplayBuffer="Medzipamäť znovuprehratia" +ReplayBuffer="Záznam do pamäte" Import="Importovať" Export="Exportovať" Copy="Kopírovať" @@ -91,6 +90,8 @@ DockCloseWarning.Title="Zatvorenie dokovateľného okna" DockCloseWarning.Text="Práve ste zatvorili dokovateľné okno. Ak ho chcete znovu zobraziť, použite menu Zobraziť → Doky." +ExtraBrowsers.DockName="Názov doku" + Auth.Authing.Title="Autentifikácia..." Auth.Authing.Text="Prebieha overovanie so službou %1, čakajte..." Auth.AuthFailure.Title="Overenie zlyhalo" @@ -105,6 +106,9 @@ Auth.StreamInfo="Informácie o vysielaní" TwitchAuth.Stats="Twitch štatistiky" TwitchAuth.Feed="Kanál aktivít v službe Twitch" +TwitchAuth.TwoFactorFail.Title="Nemožno získať vysielací kľúč" +TwitchAuth.TwoFactorFail.Text="OBS sa nedokáže pripojiť k vášmu Twitch účtu. Prosím, uistite sa, že máte v <a href='https://www.twitch.tv/settings/security'>bezpečnostných nastaveniach služby Twitch</a> nastavené dvojfaktorové overenie, ktoré je nutné pre vysielanie." +RestreamAuth.Channels="Kanály Restream" Copy.Filters="Kopírovať filtre" Paste.Filters="Vložiť filtre" @@ -134,10 +138,9 @@ Basic.AutoConfig.VideoPage.FPS.UseCurrent="Použiť aktuálne (%1)" Basic.AutoConfig.VideoPage.FPS.PreferHighFPS="60 alebo 30, ale radšej 60, ak je to možné" Basic.AutoConfig.VideoPage.FPS.PreferHighRes="60 alebo 30, ale radšej vysoké rozlíšenie" -Basic.AutoConfig.VideoPage.CanvasExplanation="Poznámka: rozlíšenie (základné) plátna nie je nevyhnutne rovnaké ako rozlíšenie v ktorom budete streamovať alebo nahrávať. Skutočné streamovacie/nahrávacie rozlíšenie môže byť zmenšené preto aby sa znížilo používanie dát alebo zdrojov." +Basic.AutoConfig.VideoPage.CanvasExplanation="Poznámka: rozlíšenie (základné) plátna nie je nevyhnutne rovnaké ako rozlíšenie, v ktorom budete vysielať alebo nahrávať. Skutočné vysielacie/nahrávacie rozlíšenie môže byť zmenšené preto, aby sa znížilo používanie dát alebo zdrojov." Basic.AutoConfig.StreamPage="Informácie o streame" Basic.AutoConfig.StreamPage.SubTitle="Prosím, zadajte svoje údaje o vysielaní" -Basic.AutoConfig.StreamPage.ConnectAccount="Prepojiť účet (voliteľné)" Basic.AutoConfig.StreamPage.DisconnectAccount="Odpojiť účet" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Odpojiť účet?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Táto zmena sa uplatní okamžite. Naozaj chcete odpojiť svoj účet?" @@ -150,7 +153,7 @@ Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(Odkaz)" Basic.AutoConfig.StreamPage.PerformBandwidthTest="Odhadnúť bitrate pomocou testu rýchlosti pripojenia (môže to trvať pár minút)" Basic.AutoConfig.StreamPage.PreferHardwareEncoding="Preferovať hardvérové enkódovanie" -Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="Hardwarové enkódovanie eliminuje väčšinu využitia CPU, ale na dosiahnutie rovnakej kvality videa môže vyžadovať väčší bitrate." +Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="Hardvérové kódovanie eliminuje väčšinu využitia CPU, ale na dosiahnutie rovnakej kvality videa môže vyžadovať väčší bitrate." Basic.AutoConfig.StreamPage.StreamWarning.Title="Upozornenie o streame" Basic.AutoConfig.StreamPage.StreamWarning.Text="Test rýchlosti pripojenia vysiela obraz bez zvuku s náhodnými dátami. Odporúčame dočasne zakázať záznam vysielaní a nastaviť živý prenos ako súkromný, kým sa celý test nedokončí. Pokračovať?" Basic.AutoConfig.TestPage="Konečné výsledky" @@ -238,6 +241,9 @@ ConfirmStop.Title="Zastaviť stream?" ConfirmStop.Text="Naozaj chcete zastaviť stream?" +ConfirmStopRecord.Title="Zastaviť nahrávanie?" +ConfirmStopRecord.Text="Naozaj si želáte zastaviť nahrávanie?" + ConfirmBWTest.Title="Spustiť test šírky pásma siete?" ConfirmBWTest.Text="Vaše OBS je nakonfigurované pre režim testovania šírky pásma. Toto umožní zistiť parametre vašej siete bez spustenia živého vysielania na vašom kanáli. Po dokončení testovania musíte tento režim zakázať, ináč diváci neuvidia vami prenášaný obsah.\n\nNaozaj si želáte pokračovať?" @@ -250,9 +256,11 @@ Output.StartStreamFailed="Nepodarilo sa spustiť streamovanie" Output.StartRecordingFailed="Nepodarilo sa spustiť nahrávanie" -Output.StartReplayFailed="Nepodarilo sa spustiť medzipamäť znovunahrávania" +Output.StartReplayFailed="Nepodarilo sa spustiť záznam do pamäte" Output.StartFailedGeneric="Nastala chyba pri spúšťaní nahrávania. Podrobnosti nájdete v textovom logu.\n\nPoznámka: Ak používate NVENC alebo AMD enkodér, uistite sa, že používate najnovšiu verziu grafického ovládača." +Output.ReplayBuffer.PauseWarning.Title="Nemožno ukladať záznamy pri zapauzovaní" +Output.ReplayBuffer.PauseWarning.Text="Upozornenie: Záznamy nemôžu byť ukladané, keď je pozastavené nahrávanie." Output.ConnectFail.Title="Spojenie sa nepodarilo" Output.ConnectFail.BadPath="Neplatná cesta alebo URL. Prosím, skontrolujte, či sú vaše nastavenia správne." @@ -272,7 +280,7 @@ Output.RecordError.Msg="Pri nahrávaní došlo k nešpecifikovanej chybe." Output.RecordError.EncodeErrorMsg="Nastala chyba pri kódovaní počas nahrávania." Output.ReplayBuffer.NoHotkey.Title="Nepriradená žiadna klávesová skratka!" -Output.ReplayBuffer.NoHotkey.Msg="Nie je nastavená žiadna klávesová skratka pre uloženie záznamu. Nastavte ju, prosím, aby ste mohli ukladať záznam." +Output.ReplayBuffer.NoHotkey.Msg="Nie je nastavená žiadna klávesová skratka pre uloženie záznamu v pamäti. Nastavte ju, prosím, aby ste mohli ukladať záznam." Output.BadPath.Title="Nesprávna cesta k súboru" Output.BadPath.Text="Nastavená cesta k výstupnému súboru je chybná. Prosím, skontrolujte správnosť nastavenej cesty." @@ -439,12 +447,14 @@ Basic.Main.Controls="Ovládacie prvky" Basic.Main.Connecting="Pripájanie..." Basic.Main.StartRecording="Spustiť nahrávanie" -Basic.Main.StartReplayBuffer="Spustiť Replay Buffer" +Basic.Main.StartReplayBuffer="Spustiť záznam do pamäte" Basic.Main.StartStreaming="Spustiť stream" Basic.Main.StopRecording="Ukončiť nahrávanie" +Basic.Main.PauseRecording="Pozastaviť nahrávanie" +Basic.Main.UnpauseRecording="Pokračovať v nahrávaní" Basic.Main.StoppingRecording="Zastavenie nahrávania..." -Basic.Main.StopReplayBuffer="Zastaviť Replay Buffer" -Basic.Main.StoppingReplayBuffer="Zastavujem Replay Buffer..." +Basic.Main.StopReplayBuffer="Zastaviť záznam do pamäte" +Basic.Main.StoppingReplayBuffer="Zastavujem záznam do pamäte..." Basic.Main.StopStreaming="Ukončiť stream" Basic.Main.StoppingStreaming="Zastavenie streamu..." Basic.Main.ForceStopStreaming="Zastaviť vysielanie (bez oneskorenia)" @@ -542,6 +552,7 @@ Basic.Settings.General.OpenStatsOnStartup="Otvoriť dialógové okno štatistík po štarte" Basic.Settings.General.WarnBeforeStartingStream="Ukáž potvrďovacie okno pri začatí vysielania" Basic.Settings.General.WarnBeforeStoppingStream="Ukáž potvrďovacie okno pri zastavení vysielania" +Basic.Settings.General.WarnBeforeStoppingRecord="Ukáž potvrdzovacie okno pri zastavení nahrávania" Basic.Settings.General.Projectors="Projektory" Basic.Settings.General.HideProjectorCursor="Skryť kurzor pred náhľadmi" Basic.Settings.General.ProjectorAlwaysOnTop="Náhľady vždy navrchu" @@ -552,8 +563,8 @@ Basic.Settings.General.SnapDistance="Prichytávať citlivosť" Basic.Settings.General.RecordWhenStreaming="Automaticky nahrávať pri vysielaní" Basic.Settings.General.KeepRecordingWhenStreamStops="Nahrávať aj po ukončení vysielania" -Basic.Settings.General.ReplayBufferWhileStreaming="Automaticky zapnúť záznam do pamäti pri začatí vysielania" -Basic.Settings.General.KeepReplayBufferStreamStops="Ponechať záznam do pamäti aktívny i po zastavení vysielania" +Basic.Settings.General.ReplayBufferWhileStreaming="Automaticky zapnúť záznam do pamäte pri začatí vysielania" +Basic.Settings.General.KeepReplayBufferStreamStops="Ponechať záznam do pamäte aktívny i po zastavení vysielania" Basic.Settings.General.SysTray="Systémová lišta" Basic.Settings.General.SysTrayWhenStarted="Minimalizovať do systémovej lišty pri spustení" Basic.Settings.General.SystemTrayHideMinimize="Vždy minimalizovať do systémovej lišty namiesto panela úloh" @@ -593,23 +604,24 @@ Basic.Settings.Output.Mode.Simple="Jednoduchý" Basic.Settings.Output.Mode.Adv="Rozšírené" Basic.Settings.Output.Mode.FFmpeg="Výstup FFmpeg" -Basic.Settings.Output.UseReplayBuffer="Zapnúť záznam do pamäti" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximálny čas záznamu (v sekundách)" +Basic.Settings.Output.UseReplayBuffer="Zapnúť záznam do pamäte" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximálny čas záznamu" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maximálna pamäť (v megabajtoch)" Basic.Settings.Output.ReplayBuffer.Estimate="Odhadované využitie pamäte: %1 MB" -Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Nemôžem odhadnúť použivanie pamäte. Prosím nastavte maximálny limit pamäte." -Basic.Settings.Output.ReplayBuffer.HotkeyMessage="(Poznámka: Uistite sa, že ste nastavili klávesovú skratku pre záznam do pamäte, v sekcii klávesových skratiek)" +Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Nemožno odhadnúť využitie pamäte. Prosím, nastavte maximálny pamäťový limit." +Basic.Settings.Output.ReplayBuffer.HotkeyMessage="(Poznámka: Uistite sa, že ste nastavili klávesovú skratku pre záznam do pamäte v sekcii klávesových skratiek)" Basic.Settings.Output.ReplayBuffer.Prefix="Predpona názvu súboru záznamu do pamäte" Basic.Settings.Output.ReplayBuffer.Suffix="Prípona" Basic.Settings.Output.Simple.SavePath="Nahrávacia cesta" Basic.Settings.Output.Simple.RecordingQuality="Kvalita nahrávania" -Basic.Settings.Output.Simple.RecordingQuality.Stream="Rovnaká ako pre stream" +Basic.Settings.Output.Simple.RecordingQuality.Stream="Rovnaká ako pre vysielanie" Basic.Settings.Output.Simple.RecordingQuality.Small="Vysoká kvalita, stredná veľkosť súboru" Basic.Settings.Output.Simple.RecordingQuality.HQ="Nerozoznateľná kvalita, veľká veľkosť súboru" Basic.Settings.Output.Simple.RecordingQuality.Lossless="Bezstratová kvalita, ohromne veľké súbory" Basic.Settings.Output.Simple.Warn.VideoBitrate="Upozornenie: Dátový tok vysielaného obrazu bude nastavený na %1, čo je horná hranica pre súčasnú vysielaciu službu. Ak ste si istý, že chcete vysielať nad %1, v rozšírených nastaveniach enkodéra zakážte \"Vynútiť limit dátového toku vysielacou službou\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Upozornenie: Dátový tok vysielaného zvuku bude nastavený na %1, čo je horná hranica pre súčasnú vysielaciu službu. Ak ste si istý, že chcete vysielať nad %1, v rozšírených nastaveniach enkodéra zakážte \"Vynútiť limit dátového toku vysielacou službou\"." -Basic.Settings.Output.Simple.Warn.Encoder="Upozornenie: Nahrávanie softvérovým enkodérom s rozdielnou kvalitou než vysielanie spôsobí zvýšenú záťaž CPU pri nahrávaní a vysielaní zároveň." +Basic.Settings.Output.Simple.Warn.CannotPause="Upozornenie: Nahrávanie nemôže byť pozastavené, ak je kvalita nahrávania nastavená na \"Rovnaké ako pre vysielanie\"." +Basic.Settings.Output.Simple.Warn.Encoder="Upozornenie: Nahrávanie softvérovým kodérom s rozdielnou kvalitou než vysielanie spôsobí zvýšenú záťaž CPU pri nahrávaní a vysielaní zároveň." Basic.Settings.Output.Simple.Warn.Lossless="Varovanie: Bezstratová kvalita generuje ohromne veľké súbory! Bezstratová kvalita môže použiť až 7 gigabajtov za minútu na disku pri vysokých rozlíšeniach a snímkoch za sekundu. Bezstratová kvalita nie je odporúčaná pre dlhé nahrávky pokiaľ nemáte veľmi veľa priestoru na disku." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Ste si istí, že chcete použiť bezstratovú kvalitu?" Basic.Settings.Output.Simple.Warn.Lossless.Title="Varovanie bezstratovej kvality!" @@ -621,7 +633,7 @@ Basic.Settings.Output.VideoBitrate="Bitrate videa" Basic.Settings.Output.AudioBitrate="Bitrate zvuku" Basic.Settings.Output.Reconnect="Automaticky znovupripájať" -Basic.Settings.Output.RetryDelay="Čas medzi pokusmi (sekundy)" +Basic.Settings.Output.RetryDelay="Oneskorenie opakovania" Basic.Settings.Output.MaxRetries="Maximálny počet pokusov" Basic.Settings.Output.Advanced="Povoliť pokročilé nastavenia enkodéra" Basic.Settings.Output.EncoderPreset="Predvoľba kodéra" @@ -692,7 +704,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilineárne (Najrýchlejšie, ale rozmazané pri škálovaní)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bikubické (ostrejšie pri škálovaní, 16 vzoriek)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczosov (ostrejšie pri škálovaní, 32 vzoriek)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczosov (ostrejšie pri škálovaní, 36 vzoriek)" Basic.Settings.Audio="Zvuk" Basic.Settings.Audio.SampleRate="Vzorkovacia frekvencia" @@ -706,7 +718,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Špička vzorky" Basic.Settings.Audio.PeakMeterType.TruePeak="Pravý Špička (Vyššie využitie CPU)" Basic.Settings.Audio.MultiChannelWarning.Enabled="VAROVANIE: Priestorový zvuk je zapnutý." -Basic.Settings.Audio.MultichannelWarning="Ak vysielate, uistite sa že vaša vysielacia služba podporuje prijímanie a aj prehrávanie priestorového zvuku. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast sú príklady služieb ktoré priestorový zvuk plne podporujú. Avšak Facebook Live a YouTube Live podporujú prijímanie priestorového zvuku, Facebook Live ho prevádza do stereo zvuku a YouTub Live prehráva iba 2 kanály.\n\nOBS zvukové filtre sú kompatibilné s priestorovým zvukom, no podpora u VST pluginu nie je garantovaná." +Basic.Settings.Audio.MultichannelWarning="Ak vysielate, uistite sa že vaša vysielacia služba podporuje prijímanie a aj prehrávanie priestorového zvuku. Facebook 360 Live, Mixer RTMP, Smashcast sú príklady služieb ktoré priestorový zvuk plne podporujú. Avšak Facebook Live a YouTube Live podporujú prijímanie priestorového zvuku, Facebook Live ho prevádza do stereo zvuku a YouTub Live prehráva iba 2 kanály.\n\nOBS zvukové filtre sú kompatibilné s priestorovým zvukom, no podpora u VST pluginu nie je garantovaná." Basic.Settings.Audio.MultichannelWarning.Title="Povoliť priestorový zvuk?" Basic.Settings.Audio.MultichannelWarning.Confirm="Naozaj si želáte povoliť priestorový zvuk?" Basic.Settings.Audio.Devices="Zariadenia" @@ -741,7 +753,7 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Predvolené" Basic.Settings.Advanced.Audio.DisableAudioDucking="Vypnúť zvukové utišovanie Windowsu" Basic.Settings.Advanced.StreamDelay="Oneskorenie vysielania" -Basic.Settings.Advanced.StreamDelay.Duration="Trvanie (sekundy)" +Basic.Settings.Advanced.StreamDelay.Duration="Trvanie" Basic.Settings.Advanced.StreamDelay.Preserve="Zachovať bod prerušenia (zväčšiť oneskorenie) pri znovupripojení" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Odhadované využitie pamäte: %1 MB" Basic.Settings.Advanced.Network="Sieť" @@ -755,9 +767,9 @@ Basic.AdvAudio="Pokročilé nastavenia zvuku" Basic.AdvAudio.Name="Názov" Basic.AdvAudio.Volume="Hlasitosť" -Basic.AdvAudio.Mono="Previesť na Mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Vyváženie" -Basic.AdvAudio.SyncOffset="Oneskorenie synchronizácie (ms)" +Basic.AdvAudio.SyncOffset="Oneskorenie synchronizácie" Basic.AdvAudio.Monitoring="Monitorovanie zvuku" Basic.AdvAudio.Monitoring.None="Vypnuté monitorovanie" Basic.AdvAudio.Monitoring.MonitorOnly="Iba monitorovanie (žiaden výstup)" @@ -823,6 +835,7 @@ OutputWarnings.NoTracksSelected="Musíte vybrať aspoň jednu zvukovú stopu" OutputWarnings.MultiTrackRecording="Varovanie: Niektoré formáty (ako FLV) nepodporujú nahrávanie viacerých stôp" OutputWarnings.MP4Recording="Upozornenie: Nahrávky uložené v MP4/MOV nebude možné obnoviť, ak súbor nebude korektne ukončený (napr. po BSOD, výpadku napájania atp.). Ak chcete nahrávať viacero zvukových stôp, skúste použiť MKV a po dokončení súbor previesť do MP4/MOV (Súbor -> Previesť nahrávky)" +OutputWarnings.CannotPause="Upozornenie: Nahrávanie nemôže byť pozastavené, ak je kvalita nahrávania nastavená na \"Rovnaké ako pre vysielanie\"" FinalScene.Title="Odstrániť scénu" FinalScene.Text="Musí existovať aspoň jedna scéna."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/sl-SI.ini
Changed
@@ -1,9 +1,9 @@ -Language="slovenščina" +Language="Slovenščina" Region="Slovenija" OK="V redu" -Apply="Potrdi" +Apply="Uporabi" Cancel="Prekliči" Close="Zapri" Save="Shrani" @@ -18,26 +18,26 @@ Filters="Filtri" Properties="Lastnosti" MoveUp="Premakni gor" -MoveDown="Premakni Dol" +MoveDown="Premakni dol" Settings="Nastavitve" Display="Zaslon" Name="Ime" Exit="Izhod" -Mixer="Mešalnik" +Mixer="Mešalec zvoka" Browse="Prebrskaj" Mono="Mono" Stereo="Stereo" DroppedFrames="Izpuščene sličice %1 (%2 %)" -StudioProgramProjector="Celozaslonski predogled (Program)" -PreviewProjector="Celozaslonski predogled (Predogled)" -SceneProjector="Celozaslonski predogled (Scena)" -SourceProjector="Celozaslonski predogled (Vir)" -StudioProgramWindow="Predogled v oknu (Program)" -PreviewWindow="Predogled v oknu (Predogled)" -SceneWindow="Predogled v oknu (Scena)" -SourceWindow="Predogled v oknu (Vir)" -MultiviewProjector="Večdelni pogled (Celozaslonsko)" -MultiviewWindowed="Večdelni pogled (V oknu)" +StudioProgramProjector="Celozaslonski projektor (program)" +PreviewProjector="Celozaslonski projektor (predogled)" +SceneProjector="Celozaslonski projektor (prizor)" +SourceProjector="Celozaslonski projektor (vir)" +StudioProgramWindow="Projektor v oknu (program)" +PreviewWindow="Projektor v oknu (predogled)" +SceneWindow="Projektor v oknu (prizor)" +SourceWindow="Projektor v oknu (vir)" +MultiviewProjector="Več pogledov (celozaslonsko)" +MultiviewWindowed="Več pogledov (v oknu)" Clear="Počisti" Revert="Povrni" Show="Prikaži" @@ -49,7 +49,7 @@ Enable="Omogoči" DisableOSXVSync="Onemogoči OSX V-Sync" ResetOSXVSyncOnExit="Ponastavi OSX V-Sync ob izhodu" -HighResourceUsage="Preobremenjeno kodiranje! Zmanjšajte video nastavitve ali uporabite hitrejše kodirne prednastavitve." +HighResourceUsage="Kodiranje je preobremenjeno! Razmislite o znižanju nastavitev slike ali uporabi prednastavitve s hitrejšim kodiranjem." Transition="Prehod" QuickTransitions="Hitri prehodi" Left="Levo" @@ -57,39 +57,67 @@ Top="Zgoraj" Bottom="Spodaj" Reset="Ponastavi" -Hours="Ure" -Minutes="Minute" -Seconds="Sekunde" +Hours="urah" +Minutes="minutah" +Seconds="sekundah" Deprecated="Zastarelo" -ReplayBuffer="Ponovitev medpomnilnika" +ReplayBuffer="Medpomn. za pon. predv." Import="Uvozi" Export="Izvozi" Copy="Kopiraj" Paste="Prilepi" -PasteReference="Prilepi (Referenca)" -PasteDuplicate="Prilepi (Dvojnika)" -RemuxRecordings="Nadaljuj snemanje" +PasteReference="Prilepi (referenco)" +PasteDuplicate="Prilepi (dvojnika)" +RemuxRecordings="Ponovno zvij posnetke" Next="Naprej" Back="Nazaj" Defaults="Privzeto" -HideMixer="Skrij v mešalnik" -TransitionOverride="Vsili prehod" -None="Nič" +HideMixer="Skrij v mešalniku" +TransitionOverride="Preglasi prehod" +None="Brez" StudioMode.Preview="Predogled" StudioMode.Program="Program" -ShowInMultiview="Pokaži v večdelnem pogledu" +ShowInMultiview="Prikaži v več pogledih" VerticalLayout="Navpična razporeditev" Group="Skupina" +DoNotShowAgain="Ne prikaži ponovno" +Default="(privzeto)" +Calculating="Izračunavanje …" -AlreadyRunning.Title="OBS že obratuje" -AlreadyRunning.Text="OBS je že v izvajanju! Razen če ste imeli namen zagnati dve aplikaciji naenkrat, zaustavite vse OBS aplikacije v teku, tudi v sistemski vrstici." +AlreadyRunning.Title="OBS se že izvaja" +AlreadyRunning.Text="OBS se že izvaja! Razen če ste imeli namen zagnati več primerkov, pred zagonom novega primerka OBS-a zaustavite vse obstoječe. Če imate OBS nastavljen, da se skrči v sistemsko vrstico, preverite, če se tam še izvaja." AlreadyRunning.LaunchAnyway="Vseeno zaženi" - - -Copy.Filters="Kopiraj Filtre" -Paste.Filters="Prilepi Filtre" - +DockCloseWarning.Title="Zapiranje sidrnega okna" +DockCloseWarning.Text="Pravkar ste zaprli sidrno okno. Če bi ga radi zopet prikazali, v menijski vrstici uporabite meni Pogled → Sidrišča." + +ExtraBrowsers="Brskalnikova sidrišča po meri …" +ExtraBrowsers.Info="Dodajte sidrišča tako, da jim dodate ime in URL, in nato kliknite Uporabi ali Zapri, da jih odprete. Sidrišča lahko dodate ali odstranite kadarkoli." +ExtraBrowsers.DockName="Ime sidrišča" + +Auth.Authing.Title="Overjanje …" +Auth.Authing.Text="Overjanje preko storitve %1. Prosimo, počakajte …" +Auth.AuthFailure.Title="Neuspešna prijava" +Auth.AuthFailure.Text="Overitev s/z %1 je spodletela:\n\n%2: %3" +Auth.InvalidScope.Title="Potrebna je overitev" +Auth.InvalidScope.Text="Overitvene zahteve za %1 so se spremenile. Nekatere značilnosti morda ne bodo na voljo." +Auth.LoadingChannel.Title="Nalaganje informacij o kanalu …" +Auth.LoadingChannel.Text="Nalaganje informacij o kanalu za %1. Prosimo, počakajte …" +Auth.ChannelFailure.Title="Nalaganje kanala neuspešno" +Auth.ChannelFailure.Text="Nalaganje informacij o kanalu za %1 je spodletelo\n\n%2: %3" +Auth.Chat="Klepet" +Auth.StreamInfo="Informacije o pretoku" +TwitchAuth.Stats="Statistika Twitcha" +TwitchAuth.Feed="Vir dejavnosti na Twitchu" +TwitchAuth.TwoFactorFail.Title="Ni bilo mogoče poizvedeti za ključ pretoka" +TwitchAuth.TwoFactorFail.Text="OBS se ni mogel povezati z računom Twitch. Prepričajte se, da je v vaših <a href='https://www.twitch.tv/settings/security'>varnostnih nastavitvah Twitcha</a> nastavljeno dvostopenjsko overjanje, ker je to zahtevano za pretakanje." +RestreamAuth.Channels="Kanali Restream" + +Copy.Filters="Kopiraj filtre" +Paste.Filters="Prilepi filtre" + +BrowserPanelInit.Title="Zaganjanje brskalnika …" +BrowserPanelInit.Text="Zaganjanje brskalnika, počakajte …" BandwidthTest.Region="Območje" BandwidthTest.Region.US="Združene države Amerike" @@ -97,41 +125,113 @@ BandwidthTest.Region.Asia="Azija" BandwidthTest.Region.Other="Drugo" -Basic.FirstStartup.RunWizard="Želite zagnati čarovnika za samodejno konfiguracijo? Svoje nastavitve lahko tudi spremenite tako, da kliknete gumb Nastavitve v glavnem oknu." - - -Basic.Stats.MemoryUsage="Poraba Pomnilnika" -Basic.Stats.AverageTimeToRender="Povprečen čas za izdelavo slike" -Basic.Stats.SkippedFrames="Preskočene slike zaradi kodirnega zastoja" -Basic.Stats.MissedFrames="Izgubljene slike zaradi kodirnega zastoja" +Basic.FirstStartup.RunWizard="Želite zagnati čarovnika za samodejno nastavitev? Svoje nastavitve lahko tudi spremenite tako, da kliknete gumb Nastavitve v glavnem oknu." +Basic.FirstStartup.RunWizard.NoClicked="Če si premislite, lahko iz menija Orodja kadarkoli znova zaženete čarovnika za samodejno nastavitev." + +Basic.AutoConfig="Čarovnik za samodejno nastavitev" +Basic.AutoConfig.ApplySettings="Uporabi nastavitve" +Basic.AutoConfig.StartPage="Informacije o uporabi" +Basic.AutoConfig.StartPage.SubTitle="Navedite, za kaj želite program uporabljati" +Basic.AutoConfig.StartPage.PrioritizeStreaming="Optimiziraj za pretakanje - snemanje je drugotnega pomena" +Basic.AutoConfig.StartPage.PrioritizeRecording="Optimiziraj samo za snemanje - ne bom pretakal" +Basic.AutoConfig.VideoPage="Nastavitve slike" +Basic.AutoConfig.VideoPage.SubTitle="Navedite želene nastavitve slike" +Basic.AutoConfig.VideoPage.BaseResolution.UseCurrent="Uporabi trenutno (%1x%2)" +Basic.AutoConfig.VideoPage.BaseResolution.Display="Zaslon %1 (%2x%3)" +Basic.AutoConfig.VideoPage.FPS.UseCurrent="Uporabi trenutno (%1)" +Basic.AutoConfig.VideoPage.FPS.PreferHighFPS="60 ali 30, vendar uporabi raje 60, če je možno" +Basic.AutoConfig.VideoPage.FPS.PreferHighRes="60 ali 30, vendar uporabi raje višjo ločljivost" +Basic.AutoConfig.VideoPage.CanvasExplanation="Opomba: ločljivost platna (osnovna ločljivost) ni nujno enaka ločljivosti, s katero boste pretakali ali snemali. Dejanska ločljivost pretakanja/snemanja je lahko nižja od ločljivosti platna, da se zmanjša poraba virov ali bitna hitrost." +Basic.AutoConfig.StreamPage="Podatki o pretakanju" +Basic.AutoConfig.StreamPage.SubTitle="Vnesite podatke o pretakanju" +Basic.AutoConfig.StreamPage.ConnectAccount="Poveži račun (priporočljivo)" +Basic.AutoConfig.StreamPage.DisconnectAccount="Odklopi račun" +Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Odklopi račun?" +Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Ta sprememba bo začela veljati takoj. Ali res želite odklopiti račun?" +Basic.AutoConfig.StreamPage.UseStreamKey="Uporabi ključ pretoka" +Basic.AutoConfig.StreamPage.Service="Storitev" +Basic.AutoConfig.StreamPage.Service.ShowAll="Prikaži vse …" +Basic.AutoConfig.StreamPage.Service.Custom="Po meri …" +Basic.AutoConfig.StreamPage.Server="Strežnik" +Basic.AutoConfig.StreamPage.StreamKey="Ključ pretoka" +Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(povezava)" +Basic.AutoConfig.StreamPage.PerformBandwidthTest="Oceni bitno hitrost s preizkusom pasovne širine (lahko traja nekaj minut)" +Basic.AutoConfig.StreamPage.PreferHardwareEncoding="Daj prednost strojnemu kodiranju" +Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="Strojno kodiranje večinoma odpravi uporabo CPE-ja, vendar pa za isto raven kakovosti lahko zahteva večjo bitno hitrost." +Basic.AutoConfig.StreamPage.StreamWarning.Title="Opozorilo o pretakanju" +Basic.AutoConfig.StreamPage.StreamWarning.Text="Preizkus pasovne širine bo pretakal naključne slikovne podatke brez zvoka v vaš kanal. Če je možno, je priporočljivo začasno izklopiti shranjevanje videoposnetkov pretokov in pretok nastaviti na zaseben, dokler se preizkus ne konča. Nadaljuj?" +Basic.AutoConfig.TestPage="Končni rezultat" +Basic.AutoConfig.TestPage.SubTitle.Testing="Program trenutno izvaja množico preizkusov, da lahko oceni, katere nastavitve so najprimernejše" +Basic.AutoConfig.TestPage.SubTitle.Complete="Preizkušanje je končano" +Basic.AutoConfig.TestPage.TestingBandwidth="Izvajanje preizkusa pasovne širine. To lahko traja nekaj minut …" +Basic.AutoConfig.TestPage.TestingBandwidth.Connecting="Povezovanje na: %1 …" +Basic.AutoConfig.TestPage.TestingBandwidth.ConnectFailed="Povezava s strežniki je spodletela. Preverite internetno povezavo in poizkusite znova." +Basic.AutoConfig.TestPage.TestingBandwidth.Server="Preizkušanje pasovne širine za: " +Basic.AutoConfig.TestPage.TestingStreamEncoder="Preizkušanje pretočnega kodirnika. To lahko traja nekaj minut …" +Basic.AutoConfig.TestPage.TestingRecordingEncoder="Preizkušanje snemalnega kodirnika. To lahko traja nekaj minut …" +Basic.AutoConfig.TestPage.TestingRes="Preizkušanje ločljivosti. To lahko traja nekaj minut …" +Basic.AutoConfig.TestPage.TestingRes.Fail="Zagon kodirnika je spodletel" +Basic.AutoConfig.TestPage.TestingRes.Resolution="Preizkušanje %1x%2 %3 sl./s …" +Basic.AutoConfig.TestPage.Result.StreamingEncoder="Pretočni kodirnik" +Basic.AutoConfig.TestPage.Result.RecordingEncoder="Snemalni kodirnik" +Basic.AutoConfig.TestPage.Result.Header="Program je ocenil, da so te nastavitve najprimernejše za vas:" +Basic.AutoConfig.TestPage.Result.Footer="Za uporabo teh nastavitev kliknite 'Uporabi nastavitve'. Za ponovno nastavitev čarovnika in vnovičen poizkus kliknite 'Nazaj'. Za ročno nastavitev kliknite 'Prekliči' in odprite nastavitve." + +Basic.Stats="Statistika" +Basic.Stats.CPUUsage="Poraba CPE-ja" +Basic.Stats.HDDSpaceAvailable="Razpoložljiv prostor na disku" +Basic.Stats.MemoryUsage="Poraba pomnilnika" +Basic.Stats.AverageTimeToRender="Povprečen čas za izris sličice" +Basic.Stats.SkippedFrames="Preskočene sličice zaradi zakasnitve kodiranja" +Basic.Stats.MissedFrames="Zgrešene sličice zaradi zakasnitve izrisovanja" Basic.Stats.Output.Stream="Pretok" Basic.Stats.Output.Recording="Snemanje" Basic.Stats.Status="Stanje" Basic.Stats.Status.Recording="Snemanje" Basic.Stats.Status.Live="V ŽIVO" Basic.Stats.Status.Reconnecting="Ponovno vzpostavljanje povezave" -Basic.Stats.Status.Inactive="Neaktiven" +Basic.Stats.Status.Inactive="Nedejavno" Basic.Stats.DroppedFrames="Izpuščanje sličic (omrežje)" -Basic.Stats.MegabytesSent="Skupni podatkovni izhod" +Basic.Stats.MegabytesSent="Skupni izhodni podatki" Basic.Stats.Bitrate="Bitna hitrost" +Basic.Stats.DiskFullIn="Disk bo poln v (pribl.)" +ResetUIWarning.Title="Ali res želite ponastaviti uporabniški vmesnik?" +ResetUIWarning.Text="Ponastavitev uporabniškega vmesnika bo skrila dodatna sidrišča. Če jih želite prikazati, lahko to storite v meniju 'Pogled'.\n\nAli res želite ponastaviti uporabniški vmesnik?" -Updater.Title="Na Voljo So Nove Posodobitve" -Updater.Text="Nova Posodobitev Je Na Voljo:" +Updater.Title="Na voljo so nove posodobitve" +Updater.Text="Na voljo je nova posodobitev:" Updater.UpdateNow="Posodobi zdaj" Updater.RemindMeLater="Opomni me kasneje" Updater.Skip="Preskoči različico" -Updater.Running.Title="Program je trenutno aktiven" -Updater.Running.Text="Izhodi so trenutno v uporabi, prosimo ugasnite izhode pred posodabljanjem" +Updater.Running.Title="Program je trenutno dejaven" +Updater.Running.Text="Izhodi so trenutno v uporabi. Prosimo, da pred poizkusom posodobitve izklopite dejavne izhode" Updater.NoUpdatesAvailable.Title="Na voljo ni nobenih posodobitev" Updater.NoUpdatesAvailable.Text="Na voljo ni novih posodobitev" -Updater.FailedToLaunch="Zagon posodobitve je spodletel" -Updater.GameCaptureActive.Title="Zajem Igre aktiven" +Updater.FailedToLaunch="Zagon posodobilnika je spodletel" +Updater.GameCaptureActive.Title="Zajemanje igre je dejavno" Updater.GameCaptureActive.Text="Knjižnica za zajem Igre je trenutno v uporabi. Prosimo zaprite vse programe, ki so bili snemani (ali ponovno zaženite Windows) in poskusite ponovno." +QuickTransitions.SwapScenes="Zamenjaj predogled/izhodne prizore po prehodu" +QuickTransitions.SwapScenesTT="Zamenja predogled in izhodne prizore po prehodu (če izhodni izvirni prizor še obstaja).\nTo ne bo razveljavilo morebitnih sprememb izhodnega izvirnega prizora." +QuickTransitions.DuplicateScene="Podvoji prizor" +QuickTransitions.DuplicateSceneTT="Med urejanjem istega prizora omogoča urejanje preoblike/vidnosti virov brez spreminjanja izhoda.\nZa urejanje lastnosti virov brez spreminjanja izhoda omogočite 'Podvoji vire'.\nSprememba te vrednosti bo ponastavila trenutni izhodni prizor (če še obstaja)." +QuickTransitions.EditProperties="Podvoji vire" +QuickTransitions.EditPropertiesTT="Med urejanjem istega prizora omogoča urejanje lastnosti virov brez spreminjanja izhoda.\nTo lahko uporabite samo, če je 'Podvoji prizor' omogočeno.\nDoločeni viri (kot je zajem ali vir predstavnosti) tega ne podpirajo in jih ni mogoče ločeno urejati.\nSprememba te vrednosti bo ponastavila izhodni prizor (če še obstaja).\n\nOpozorilo: ker bodo viri podvojeni, lahko to zahteva dodatne sistemske ali slikovne vire." +QuickTransitions.HotkeyName="Hiter prehod: %1" +Basic.AddTransition="Dodaj nastavljiv prehod" +Basic.RemoveTransition="Odstrani nastavljiv prehod" +Basic.TransitionProperties="Lastnosti prehoda" +Basic.SceneTransitions="Prehodi prizorov" +Basic.TransitionDuration="Trajanje" +Basic.TogglePreviewProgramMode="Studijski način" +TransitionNameDlg.Text="Vnesite ime prehoda" +TransitionNameDlg.Title="Ime prehoda" +TitleBar.Profile="Profil" +TitleBar.Scenes="Prizori" NameExists.Title="Ime že obstaja" NameExists.Text="Ime je že v uporabi." @@ -139,211 +239,640 @@ NoNameEntered.Title="Prosim vnesite veljavno ime" NoNameEntered.Text="Praznega imena ne morete uporabiti." +ConfirmStart.Title="Začni pretakati?" +ConfirmStart.Text="Ali res da želite začeti pretakati?" +ConfirmStop.Title="Prenehaj pretakati?" +ConfirmStop.Text="Ali res da želite prenehati pretakati?" +ConfirmStopRecord.Title="Prenehaj snemati?" +ConfirmStopRecord.Text="Ali res želite prenehati snemati?" + +ConfirmBWTest.Title="Zaženi preizkus pasovne širine?" +ConfirmBWTest.Text="OBS imate nastavljen v načinu preizkusa pasovne širine. Ta način omogoča preizkušanje omrežja brez pretakanja v živo. Ko končate s preizkusom, ga boste morali onemogočiti, da si bodo gledalci lahko ogledali vaš pretok.\n\nŽelite nadaljevati?" ConfirmExit.Title="Zapusti OBS?" +ConfirmExit.Text="OBS je trenutno dejaven. Vsi pretoki/snemanja bodo ustavljeni. Ali res želite končati?" ConfirmRemove.Title="Potrdite odstranitev" -ConfirmRemove.Text="Ali ste prepričani, da želite odstraniti '$ 1'?" +ConfirmRemove.Text="Ali res želite odstraniti '$1'?" +ConfirmRemove.TextMultiple="Ali res želite odstraniti %1 predmetov?" +Output.StartStreamFailed="Zagon pretakanja je spodletel" +Output.StartRecordingFailed="Zagon snemanja je spodletel" +Output.StartReplayFailed="Zagon medpomnilnika za ponovno predvajanje je spodletel" +Output.StartFailedGeneric="Zagon izhoda je spodletel. Za podrobnosti preverite dnevnik.\n\nOpomba: če uporabljate kodirnik NVENC ali AMD, se prepričajte, da so vaši grafični gonilniki posodobljeni." +Output.ReplayBuffer.PauseWarning.Title="Ponovnih predvajanj ni mogoče shraniti med premorom" +Output.ReplayBuffer.PauseWarning.Text="Opozorilo: ponovnih predvajanj ni mogoče shraniti, ko je snemanje v premoru." Output.ConnectFail.Title="Povezava ni uspela" Output.ConnectFail.BadPath="Neveljavna pot ali URL povezava. Prosimo, preverite vaše nastavitve za potrditev, da so veljavne." -Output.ConnectFail.ConnectFailed="Ni uspelo povezati s strežnikom" -Output.ConnectFail.Error="Med poskusom povezave s strežnikom je prišlo do nepričakovane napake. Več informacij v log datoteko." -Output.ConnectFail.Disconnected="Odklopiti od strežnika." - - +Output.ConnectFail.ConnectFailed="Povezava s strežnikom je spodletela" +Output.ConnectFail.InvalidStream="Dostop do navedenega kanala ali ključa pretoka ni mogoč. Preverite ključ pretoka. Če je pravilen, so težave lahko pri povezovanju na strežnik." +Output.ConnectFail.Error="Med poizkusom povezave s strežnikom je prišlo do nepričakovane napake. Več informacij je v dnevniški datoteki." +Output.ConnectFail.Disconnected="Povezava s strežnikom je prekinjena." + +Output.StreamEncodeError.Title="Napaka pri kodiranju" +Output.StreamEncodeError.Msg="Med pretakanjem se je pojavila napaka kodirnika." + +Output.RecordFail.Title="Zagon snemanja je spodletel" +Output.RecordFail.Unsupported="Izhodna oblika bodisi ni podprta bodisi ne podpira več kot ene zvočne sledi. Preverite nastavitve in poizkusite znova." +Output.RecordNoSpace.Title="Premalo prostora na disku" +Output.RecordNoSpace.Msg="Za nadaljevanje snemanja na disku ni dovolj prostora." +Output.RecordError.Title="Napaka pri snemanju" +Output.RecordError.Msg="Med snemanjem se je pojavila nedoločena napaka." +Output.RecordError.EncodeErrorMsg="Med snemanjem se je pojavila napaka kodirnika." +Output.ReplayBuffer.NoHotkey.Title="Hitra tipka ni nastavljena!" +Output.ReplayBuffer.NoHotkey.Msg="Hitra tipka za shranjevanje za medpomnilnik ponovnega predvajanja ni nastavljena. Nastavite hitro tipko \"Shrani\" za uporabo pri shranjevanju posnetkov ponovnega predvajanja." Output.BadPath.Title="Nepravilna pot do datoteke" -Output.BadPath.Text="Pot izhodne konfiguracije ni veljavna. Prosimo, preverite vaše nastavitve, da je določena veljavna pot datoteke." +Output.BadPath.Text="Nastavljena pot do datoteke ni veljavna. Preverite, da je nastavljena veljavna pot do datoteke." -LogReturnDialog="Dnevnik uspešno naložen" +LogReturnDialog="Dnevnik je bil uspešno poslan" LogReturnDialog.CopyURL="Kopiraj URL" -LogReturnDialog.ErrorUploadingLog="Napaka pri nalaganju dnevnika" - +LogReturnDialog.ErrorUploadingLog="Napaka pri pošiljanju dnevniške datoteke" + +Remux.SourceFile="Posnetek OBS" +Remux.TargetFile="Ciljna datoteka" +Remux.Remux="Pon. zvij" +Remux.Stop="Ustavi pon. zvijanje" +Remux.ClearFinished="Počisti dokončane predmete" +Remux.ClearAll="Počisti vse predmete" +Remux.OBSRecording="Posnetek OBS" +Remux.FinishedTitle="Ponovno zvijanje je končano" +Remux.Finished="Posnetek je bil ponovno zvit" +Remux.FinishedError="Posnetek je bil ponovno zvit, vendar je datoteka lahko nedokončana" +Remux.SelectRecording="Izberite posnetek OBS …" +Remux.SelectTarget="Izberite ciljno datoteko …" +Remux.FileExistsTitle="Ciljne datoteke že obstajajo" +Remux.FileExists="Naslednje ciljne datoteke že obstajajo. Ali jih želite zamenjati?" +Remux.ExitUnfinishedTitle="Ponovno zvijanje je v teku" +Remux.ExitUnfinished="Ponovno zvijanje še ni končano. Takojšnja ustavitev lahko povzroči neuporabnost ciljne datoteke.\nAli res želite ustaviti ponovno zvijanje?" +Remux.HelpText="Za ponovno zvijanje v to okno spustite datoteke ali izberite prazno celico \"Posnetek OBS\", da poiščete datoteko." UpdateAvailable="Nova posodobitev je na voljo" -UpdateAvailable.Text="Verzija %1.%2.%3 je sedaj na voljo. <a href='%4'>Klikni tukaj za prenos</a>" +UpdateAvailable.Text="Različica %1.%2.%3 je sedaj na voljo. <a href='%4'>Kliknite tukaj za prenos</a>" -Basic.DesktopDevice1="Namizni Zvok" -Basic.DesktopDevice2="Namizni Zvok 2" -Basic.AuxDevice1="Mic/Aux" -Basic.AuxDevice2="Mic/Aux 2" -Basic.AuxDevice3="Mic/Aux 3" -Basic.AuxDevice4="Mic/Aux 4" +Basic.DesktopDevice1="Namizni zvok" +Basic.DesktopDevice2="Namizni zvok 2" +Basic.AuxDevice1="Mikrofon/Pomožni vhod" +Basic.AuxDevice2="Mikrofon/Pomožni vhod 2" +Basic.AuxDevice3="Mikrofon/Pomožni vhod 3" +Basic.AuxDevice4="Mikrofon/Pomožni vhod 4" -Basic.Scene="Scena" +Basic.Scene="Prizor" Basic.DisplayCapture="Zajemanje zaslona" +Basic.Main.PreviewConextMenu.Enable="Omogoči predogled" +Basic.Main.Preview.Disable="Onemogoči predogled" +ScaleFiltering="Filtriranje sprem. velikosti" +ScaleFiltering.Point="Točkovno" +ScaleFiltering.Bilinear="Dvovrstno" +ScaleFiltering.Bicubic="Dvoprostor." +ScaleFiltering.Lanczos="Lanczos" +ScaleFiltering.Area="Območje" +Deinterlacing="Razpletanje" +Deinterlacing.Discard="Opusti" +Deinterlacing.Retro="Povratno" +Deinterlacing.Blend="Premešaj" +Deinterlacing.Blend2x="Premešaj 2x" +Deinterlacing.Linear="Premočrtno" +Deinterlacing.Linear2x="Premočrtno 2x" +Deinterlacing.Yadif="Yadif" +Deinterlacing.Yadif2x="Yadif 2x" +Deinterlacing.TopFieldFirst="Najprej zgornje polje" +Deinterlacing.BottomFieldFirst="Najprej spodnje polje" +VolControl.SliderUnmuted="Drsnik glasnosti za '%1': %2" +VolControl.SliderMuted="Drsnik glasnosti za '%1': %2 (trenutno je utišano)" +VolControl.Mute="Utišaj '%1'" +VolControl.Properties="Lastnosti za '%1'" -Basic.Main.AddSceneDlg.Title="Dodaj seceno" -Basic.Main.AddSceneDlg.Text="Prosimo, vnesite ime scene" +Basic.Main.AddSceneDlg.Title="Dodaj prizor" +Basic.Main.AddSceneDlg.Text="Vnesite ime prizora" -Basic.Main.DefaultSceneName.Text="Scena %1" +Basic.Main.DefaultSceneName.Text="%1. prizor" +Basic.Main.AddSceneCollection.Title="Dodaj zbirko prizorov" +Basic.Main.AddSceneCollection.Text="Vnesite ime zbirke prizorov" +Basic.Main.RenameSceneCollection.Title="Preimenuj zbirko prizorov" +AddProfile.Title="Dodaj profil" +AddProfile.Text="Vnesite ime profila" +RenameProfile.Title="Preimenuj profil" +Basic.Main.MixerRename.Title="Preimenuj zvočni vir" +Basic.Main.MixerRename.Text="Vnesite ime zvočnega vira" +Basic.Main.PreviewDisabled="Predogled je trenutno onemogočen" -Basic.SourceSelect="Ustvarite / Izberite Vir" -Basic.SourceSelect.CreateNew="Ustvari novo" -Basic.SourceSelect.AddExisting="Dodaj obstoječo" +Basic.SourceSelect="Ustvarite/izberite vir" +Basic.SourceSelect.CreateNew="Ustvari novega" +Basic.SourceSelect.AddExisting="Dodaj obstoječega" +Basic.SourceSelect.AddVisible="Prikaži vir" -Basic.PropertiesWindow="Lastnosti za \"%1\"" +Basic.PropertiesWindow="Lastnosti za '%1'" +Basic.PropertiesWindow.AutoSelectFormat="%1 (samodejno izberi: %2)" Basic.PropertiesWindow.SelectColor="Izberi barvo" Basic.PropertiesWindow.SelectFont="Izberi pisavo" - +Basic.PropertiesWindow.ConfirmTitle="Nastavitve so se spremenile" +Basic.PropertiesWindow.Confirm="Obstajajo neshranjene spremembe. Ali jih želite obdržati?" +Basic.PropertiesWindow.NoProperties="Lastnosti niso na voljo" +Basic.PropertiesWindow.AddFiles="Dodaj datoteke" +Basic.PropertiesWindow.AddDir="Dodaj mapo" +Basic.PropertiesWindow.AddURL="Dodaj pot/URL" +Basic.PropertiesWindow.AddEditableListDir="Dodaj mapo na '%1'" +Basic.PropertiesWindow.AddEditableListFiles="Dodaj datoteke na '%1'" +Basic.PropertiesWindow.AddEditableListEntry="Dodaj vnos na '%1'" +Basic.PropertiesWindow.EditEditableListEntry="Uredi vnos s/z '%1'" + +Basic.PropertiesView.FPS.Simple="Preproste vrednosti sl./s" +Basic.PropertiesView.FPS.Rational="Racionalne vrednosti sl./s" +Basic.PropertiesView.FPS.ValidFPSRanges="Veljavni razpon sl./s:" Basic.InteractionWindow="V stiku z '%1'" +Basic.StatusBar.Reconnecting="Povezava je bila prekinjena. Ponovno povezava čez %2 sekund (%1. poizkus)" +Basic.StatusBar.AttemptingReconnect="Poizkušanje ponovne povezave … (%1. poizkus)" Basic.StatusBar.ReconnectSuccessful="Ponovna povezava uspešna" - - -Basic.TransformWindow="Transformacija stvari na sceni" +Basic.StatusBar.Delay="Zakasnitev (%1 s)" +Basic.StatusBar.DelayStartingIn="Zakasnitev (začetek čez %1 s)" +Basic.StatusBar.DelayStoppingIn="Zakasnitev (konec čez %1 s)" +Basic.StatusBar.DelayStartingStoppingIn="Zakasnitev (začetek čez %1 s, konec čez %2 s)" + +Basic.Filters="Filtri" +Basic.Filters.AsyncFilters="Zvočni/slikovni filtri" +Basic.Filters.AudioFilters="Zvočni filtri" +Basic.Filters.EffectFilters="Filtri učinkov" +Basic.Filters.Title="Filtri za '%1'" +Basic.Filters.AddFilter.Title="Ime filtra" +Basic.Filters.AddFilter.Text="Navedite ime filtra" + +Basic.TransformWindow="Preoblika predmetov v prizoru" Basic.TransformWindow.Position="Položaj" -Basic.TransformWindow.Rotation="Rotacija" +Basic.TransformWindow.Rotation="Zasuk" Basic.TransformWindow.Size="Velikost" -Basic.TransformWindow.Alignment="Pozicijski poravnava" -Basic.TransformWindow.BoundsType="Vrsta prostorskega obsega" -Basic.TransformWindow.BoundsAlignment="Postavitev v prostorskem obsegu" -Basic.TransformWindow.Bounds="Velikost prostorskega obsega" +Basic.TransformWindow.Alignment="Poravnava položaja" +Basic.TransformWindow.BoundsType="Vrsta okvirja" +Basic.TransformWindow.BoundsAlignment="Poravnava v okvirju" +Basic.TransformWindow.Bounds="Velikost okvirja" +Basic.TransformWindow.Crop="Obreži" Basic.TransformWindow.Alignment.TopLeft="Zgoraj levo" -Basic.TransformWindow.Alignment.TopCenter="Zgoraj na sredini" +Basic.TransformWindow.Alignment.TopCenter="Zgoraj na sredino" Basic.TransformWindow.Alignment.TopRight="Zgoraj desno" Basic.TransformWindow.Alignment.CenterLeft="Na sredini levo" Basic.TransformWindow.Alignment.Center="Sredina" Basic.TransformWindow.Alignment.CenterRight="Na sredini desno" Basic.TransformWindow.Alignment.BottomLeft="Spodaj levo" -Basic.TransformWindow.Alignment.BottomCenter="Spodaj na sredini" +Basic.TransformWindow.Alignment.BottomCenter="Spodaj na sredino" Basic.TransformWindow.Alignment.BottomRight="Spodaj desno" -Basic.TransformWindow.BoundsType.None="Brez mej" +Basic.TransformWindow.BoundsType.None="Neomejeno" Basic.TransformWindow.BoundsType.MaxOnly="Samo največja velikost" Basic.TransformWindow.BoundsType.ScaleInner="Prilagodi notranji meji" Basic.TransformWindow.BoundsType.ScaleOuter="Prilagodi zunanji meji" Basic.TransformWindow.BoundsType.ScaleToWidth="Prilagodi širini meje" Basic.TransformWindow.BoundsType.ScaleToHeight="Prilagodi višini meje" -Basic.TransformWindow.BoundsType.Stretch="Razpotegni do meje" +Basic.TransformWindow.BoundsType.Stretch="Raztegni do meje" Basic.Main.AddSourceHelp.Title="Ni mogoče dodati vira" -Basic.Main.AddSourceHelp.Text="Potrebujete vsaj 1 sceno, da lahko dodate vir." +Basic.Main.AddSourceHelp.Text="Potrebujete vsaj 1 prizor, da lahko dodate vir." -Basic.Main.Scenes="Scene" +Basic.Main.Scenes="Prizori" Basic.Main.Sources="Viri" -Basic.Main.Connecting="Povezovanje..." +Basic.Main.Controls="Nadzorne tipke" +Basic.Main.Connecting="Povezovanje …" Basic.Main.StartRecording="Začni snemati" -Basic.Main.StartStreaming="Začni oddajati" +Basic.Main.StartReplayBuffer="Zaženi medpomnilnik za pon. predv." +Basic.Main.StartStreaming="Začni pretakati" Basic.Main.StopRecording="Prenehaj snemati" -Basic.Main.StopStreaming="Prenehaj oddajati" +Basic.Main.PauseRecording="Premor snemanja" +Basic.Main.UnpauseRecording="Nadaljuj snemanje" +Basic.Main.StoppingRecording="Ustavljanje snemanja …" +Basic.Main.StopReplayBuffer="Ustavi medpomnilnik za pon. predv." +Basic.Main.StoppingReplayBuffer="Ustavljanje medp. za pon. predv. …" +Basic.Main.StopStreaming="Prenehaj pretakati" +Basic.Main.StoppingStreaming="Ustavljanje pretoka …" +Basic.Main.ForceStopStreaming="Prenehaj pretakati (zavrzi zakasnitev)" +Basic.Main.Group="%1. skupina" +Basic.Main.GroupItems="Združi izbrane predmete" +Basic.Main.Ungroup="Razdruži" Basic.MainMenu.File="Datoteka (&F)" Basic.MainMenu.File.Export="Izvozi (&E)" -Basic.MainMenu.File.Import="Uvoz (&I)" -Basic.MainMenu.File.ShowRecordings="Pokaži Posnetke (&R)" +Basic.MainMenu.File.Import="Uvoz&i" +Basic.MainMenu.File.ShowRecordings="P&rikaži posnetke" +Basic.MainMenu.File.Remux="Ponovno zvij posnetke (&M)" Basic.MainMenu.File.Settings="Na&stavitve" +Basic.MainMenu.File.ShowSettingsFolder="Prikaži mapo z nastavitvami" +Basic.MainMenu.File.ShowProfileFolder="Prikaži mapo s profili" +Basic.MainMenu.AlwaysOnTop="Vedno n&a vrhu" Basic.MainMenu.File.Exit="Izhod (&X)" -Basic.MainMenu.Edit="Spr&emeni" +Basic.MainMenu.Edit="Ur&edi" Basic.MainMenu.Edit.Undo="Razveljavi (&U)" Basic.MainMenu.Edit.Redo="Uveljavi (&R)" Basic.MainMenu.Edit.UndoAction="Razveljavi $1 (&U)" Basic.MainMenu.Edit.RedoAction="Uveljavi $1 (&R)" +Basic.MainMenu.Edit.LockPreview="Zak&leni predogled" +Basic.MainMenu.Edit.Scale="&Spremeni velikost predogleda" +Basic.MainMenu.Edit.Scale.Window="Prilagodi oknu" +Basic.MainMenu.Edit.Scale.Canvas="Platno (%1x%2)" +Basic.MainMenu.Edit.Scale.Output="Izhod (%1x%2)" Basic.MainMenu.Edit.Transform="Preoblikuj (&T)" -Basic.MainMenu.Edit.Transform.EditTransform="Ur&edi preoblikovanje..." -Basic.MainMenu.Edit.Transform.ResetTransform="Ponostavi p&reoblikovanje" -Basic.MainMenu.Edit.Transform.Rotate90CW="Zasukati za 90 stopinj v desno" -Basic.MainMenu.Edit.Transform.Rotate90CCW="Zasukati za 90 stopinj v levo" -Basic.MainMenu.Edit.Transform.Rotate180="Zavrti 180 stopin" -Basic.MainMenu.Edit.Transform.FlipHorizontal="Zrcali Vodoravno (&H)" -Basic.MainMenu.Edit.Transform.FlipVertical="Zrcali Na&vpično" +Basic.MainMenu.Edit.Transform.EditTransform="Ur&edi preobliko …" +Basic.MainMenu.Edit.Transform.CopyTransform="Kopiraj preobliko" +Basic.MainMenu.Edit.Transform.PasteTransform="Prilepi preobliko" +Basic.MainMenu.Edit.Transform.ResetTransform="Ponastavi p&reobliko" +Basic.MainMenu.Edit.Transform.Rotate90CW="Zasukaj za 90 stopinj v desno" +Basic.MainMenu.Edit.Transform.Rotate90CCW="Zasukaj za 90 stopinj v levo" +Basic.MainMenu.Edit.Transform.Rotate180="Zasukaj za 180 stopinj" +Basic.MainMenu.Edit.Transform.FlipHorizontal="Zrcali vodoravno (&H)" +Basic.MainMenu.Edit.Transform.FlipVertical="Zrcali na&vpično" Basic.MainMenu.Edit.Transform.FitToScreen="Prilagodi zaslonu (&F)" -Basic.MainMenu.Edit.Transform.StretchToScreen="Prilagodi za&slonu" -Basic.MainMenu.Edit.Transform.CenterToScreen="&Centriraj na zaslon" +Basic.MainMenu.Edit.Transform.StretchToScreen="Raztegni na veliko&st zaslona" +Basic.MainMenu.Edit.Transform.CenterToScreen="Usredini na zaslon (&C)" +Basic.MainMenu.Edit.Transform.VerticalCenter="Usredini navpično" +Basic.MainMenu.Edit.Transform.HorizontalCenter="Usredini vodoravno" Basic.MainMenu.Edit.Order="Zap&oredje" -Basic.MainMenu.Edit.Order.MoveUp="Premakni Gor (&U)" -Basic.MainMenu.Edit.Order.MoveDown="Premakni &Dol" -Basic.MainMenu.Edit.Order.MoveToTop="Premakni na Vrh (&T)" -Basic.MainMenu.Edit.Order.MoveToBottom="Premakni na Dno (&B)" - - - +Basic.MainMenu.Edit.Order.MoveUp="Premakni gor (&U)" +Basic.MainMenu.Edit.Order.MoveDown="Premakni &dol" +Basic.MainMenu.Edit.Order.MoveToTop="Premakni na vrh (&T)" +Basic.MainMenu.Edit.Order.MoveToBottom="Premakni na dno (&B)" +Basic.MainMenu.Edit.AdvAudio="N&apredne lastnosti zvoka" + +Basic.MainMenu.View="Pogled (&V)" +Basic.MainMenu.View.Toolbars="Orodne vrs&tice" +Basic.MainMenu.View.Docks="Sidrišča" +Basic.MainMenu.View.Docks.ResetUI="Ponastavi up. vmesnik" +Basic.MainMenu.View.Docks.LockUI="Zakleni up. vmesnik" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Brskalnikova sidrišča po meri …" +Basic.MainMenu.View.Toolbars.Listboxes="Vrstice seznamov (&L)" +Basic.MainMenu.View.SceneTransitions="Prehodi prizorov (&C)" +Basic.MainMenu.View.StatusBar="Vr&stica stanja" +Basic.MainMenu.View.Fullscreen.Interface="Celozaslonski vmesnik" + +Basic.MainMenu.SceneCollection="Zbirka prizorov (&S)" +Basic.MainMenu.Profile="&Profil" +Basic.MainMenu.Profile.Import="Uvozi profil" +Basic.MainMenu.Profile.Export="Izvozi profil" +Basic.MainMenu.SceneCollection.Import="Uvozi zbirko prizorov" +Basic.MainMenu.SceneCollection.Export="Izvozi zbirko prizorov" +Basic.MainMenu.Profile.Exists="Profil že obstaja" +Basic.MainMenu.SceneCollection.Exists="Zbirka prizorov že obstaja" + +Basic.MainMenu.Tools="Orodja (&T)" Basic.MainMenu.Help="Pomoč (&H)" -Basic.MainMenu.Help.Logs="Dnevniki (&L)" -Basic.MainMenu.Help.Logs.ShowLogs="Pokaži Zapi&snik" -Basic.MainMenu.Help.Logs.UploadCurrentLog="Naloži Trenutni dnevnik (&C)" -Basic.MainMenu.Help.Logs.UploadLastLog="Na&loži Zadni dnevnik" +Basic.MainMenu.Help.HelpPortal="&Portal za pomoč" +Basic.MainMenu.Help.Website="Obišči spletno mesto (&W)" +Basic.MainMenu.Help.Discord="Pridruži se strežniku &Discord" +Basic.MainMenu.Help.Logs="Dnevniške datoteke (&L)" +Basic.MainMenu.Help.Logs.ShowLogs="Prikaži dnevniške datoteke (&S)" +Basic.MainMenu.Help.Logs.UploadCurrentLog="Pošlji trenutno dnevniško datoteko (&C)" +Basic.MainMenu.Help.Logs.UploadLastLog="Poš&lji zadnjo dnevniško datoteko" +Basic.MainMenu.Help.Logs.ViewCurrentLog="Pokaži trenutni dne&vnik" Basic.MainMenu.Help.CheckForUpdates="Preveri za posodobitve" +Basic.MainMenu.Help.CrashLogs="Po&ročila o zrušitvi" +Basic.MainMenu.Help.CrashLogs.ShowLogs="Prikaži poročila o zrušitvi (&S)" +Basic.MainMenu.Help.CrashLogs.UploadLastLog="Poš&lji zadnje poročilo o zrušitvi" +Basic.MainMenu.Help.About="O progr&amu" Basic.Settings.ProgramRestart="Program je treba ponovno zagnati, da se te nastavitve uveljavijo." Basic.Settings.ConfirmTitle="Potrdi spremembe" -Basic.Settings.Confirm="Imate neshranjene spremembe. Shranim spremembe?" +Basic.Settings.Confirm="Imate neshranjene spremembe. Shrani spremembe?" Basic.Settings.General="Splošno" +Basic.Settings.General.Theme="Tema" +Basic.Settings.General.Language="Jezik" +Basic.Settings.General.EnableAutoUpdates="Ob zagonu samodejno preveri za posodobitve" +Basic.Settings.General.OpenStatsOnStartup="Ob zagonu odpri pogovorno okno s statistiko" +Basic.Settings.General.WarnBeforeStartingStream="Prikaži potrditveno okno ob zagonu pretokov" +Basic.Settings.General.WarnBeforeStoppingStream="Prikaži potrditveno okno ob končanju pretokov" +Basic.Settings.General.WarnBeforeStoppingRecord="Prikaži potrditveno okno ob končanju snemanja" +Basic.Settings.General.Projectors="Projektorji" +Basic.Settings.General.HideProjectorCursor="Skrij kazalec nad projektorji" +Basic.Settings.General.ProjectorAlwaysOnTop="Projektorje prikaži vedno na vrhu" +Basic.Settings.General.Snapping="Pripenjanje virov ob poravnavi" +Basic.Settings.General.ScreenSnapping="Pripni vire na rob zaslona" +Basic.Settings.General.CenterSnapping="Pripni vire na vodoravno in navpično sredino" +Basic.Settings.General.SourceSnapping="Pripni vire na druge vire" +Basic.Settings.General.SnapDistance="Občutljivost pripenjanja" +Basic.Settings.General.RecordWhenStreaming="Samodejno snemaj med pretakanjem" +Basic.Settings.General.KeepRecordingWhenStreamStops="Obdrži posnetek, ko se pretok ustavi" +Basic.Settings.General.ReplayBufferWhileStreaming="Med pretakanjem samodejno zaženi medpomnilnik za ponovno predvajanje" +Basic.Settings.General.KeepReplayBufferStreamStops="Medpomnilnik za ponovno predvajanje naj bo še naprej dejaven, ko se pretok ustavi" +Basic.Settings.General.SysTray="Sistemska vrstica" +Basic.Settings.General.SysTrayWhenStarted="Skrči v sistemsko vrstico ob zagonu" +Basic.Settings.General.SystemTrayHideMinimize="Vedno skrči v sistemsko vrstico namesto v opravilno" +Basic.Settings.General.SaveProjectors="Shrani projektorje on izhodu" +Basic.Settings.General.Preview="Predogled" +Basic.Settings.General.OverflowHidden="Skrij prekoračitev" +Basic.Settings.General.OverflowAlwaysVisible="Prekoračitev je vedno vidna" +Basic.Settings.General.OverflowSelectionHidden="Prikaži prekoračitev, tudi ko je vir neviden" +Basic.Settings.General.SwitchOnDoubleClick="Ob dvokliku izvedi prehod na prizor" +Basic.Settings.General.StudioPortraitLayout="Omogoči pokončno/navpično razporeditev" +Basic.Settings.General.TogglePreviewProgramLabels="Prikaži oznake za predogled/program" +Basic.Settings.General.Multiview="Več pogledov" +Basic.Settings.General.Multiview.MouseSwitch="Klik preklopi med prizori" +Basic.Settings.General.Multiview.DrawSourceNames="Prikaži imena prizorov" +Basic.Settings.General.Multiview.DrawSafeAreas="Nariši varna območja (EBU R 95)" +Basic.Settings.General.MultiviewLayout="Razporeditev več pogledov" +Basic.Settings.General.MultiviewLayout.Horizontal.Top="Vodoravno zgoraj (8 prizorov)" +Basic.Settings.General.MultiviewLayout.Horizontal.Bottom="Vodoravno spodaj (8 prizorov)" +Basic.Settings.General.MultiviewLayout.Vertical.Left="Vodoravno levo (8 prizorov)" +Basic.Settings.General.MultiviewLayout.Vertical.Right="Vodoravno desno (8 prizorov)" +Basic.Settings.General.MultiviewLayout.Horizontal.Extended.Top="Vodoravno zgoraj (24 prizorov)" Basic.Settings.Stream="Pretok" Basic.Settings.Stream.StreamType="Vrsta pretoka" - -Basic.Settings.Output="Izhodišče" -Basic.Settings.Output.Mode="Vrsta izhodišča" -Basic.Settings.Output.VideoBitrate="Bitrate Videa" -Basic.Settings.Output.AudioBitrate="Bitrate zvoka" +Basic.Settings.Stream.Custom.UseAuthentication="Uporabi overitev" +Basic.Settings.Stream.Custom.Username="Uporabniško ime" +Basic.Settings.Stream.Custom.Password="Geslo" +Basic.Settings.Stream.BandwidthTestMode="Omogoči način preverjanja pasovne širine" + +Basic.Settings.Output="Izhod" +Basic.Settings.Output.Format="Oblika posnetkov" +Basic.Settings.Output.Encoder="Kodirnik" +Basic.Settings.Output.SelectDirectory="Izberite mapo za posnetke" +Basic.Settings.Output.SelectFile="Izberite datoteko posnetka" +Basic.Settings.Output.EnforceBitrate="Vsili omejitve bitne hitrosti storitve pretakanja" +Basic.Settings.Output.DynamicBitrate="Dinamično spreminjaj bitno hitrost za odpravo zastojev" +Basic.Settings.Output.DynamicBitrate.Beta="Dinamično spreminjaj bitno hitrost za odpravo zastojev (beta)" +Basic.Settings.Output.DynamicBitrate.TT="Namesto izpuščanja sličic za odpravo zastojev sproti dinamično spreminja bitno hitrost.\n\nUpoštevajte, da to lahko poveča zakasnitve pri gledalcih, če pride do nenadnega znatnega zastoja.\nKo se bitna hitrost zniža, lahko obnovitev traja nekaj minut.\n\nTrenutno podprto samo za RMTP." +Basic.Settings.Output.Mode="Način izhoda" +Basic.Settings.Output.Mode.Simple="Preprost" +Basic.Settings.Output.Mode.Adv="Napreden" +Basic.Settings.Output.Mode.FFmpeg="Izhod FFmpeg" +Basic.Settings.Output.UseReplayBuffer="Omogoči medpomnilnik za pon. predv." +Basic.Settings.Output.ReplayBuffer.SecondsMax="Najdaljši čas ponovnega predvajanja" +Basic.Settings.Output.ReplayBuffer.MegabytesMax="Največja količina pomnilnika (MB)" +Basic.Settings.Output.ReplayBuffer.Estimate="Ocenjena poraba pomnilnika: %1 MB" +Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Porabe pomnilnika ni mogoče oceniti. Nastavite zgornjo omejitev porabe." +Basic.Settings.Output.ReplayBuffer.HotkeyMessage="Opomba: prepričajte se, da v odseku za hitre tipke nastavite hitro tipko za medpomnilnik ponovnega predvajanja" +Basic.Settings.Output.ReplayBuffer.Prefix="Predpona imena dat. medp. za pon. predv." +Basic.Settings.Output.ReplayBuffer.Suffix="Pripona" +Basic.Settings.Output.Simple.SavePath="Pot za snemanje" +Basic.Settings.Output.Simple.RecordingQuality="Kakovost posnetkov" +Basic.Settings.Output.Simple.RecordingQuality.Stream="Enaka kot pri pretakanju" +Basic.Settings.Output.Simple.RecordingQuality.Small="Visoka kakovost, srednja velikost datoteke" +Basic.Settings.Output.Simple.RecordingQuality.HQ="Nerazločljiva kakovost, zelo velika velikost datoteke" +Basic.Settings.Output.Simple.RecordingQuality.Lossless="Brezizgubna kakovost, izjemno velika velikost datoteke" +Basic.Settings.Output.Simple.Warn.VideoBitrate="Opozorilo: slikovna bitna hitrost pretoka bo nastavljena na %1, ki je zgornja meja trenutne storitve pretakanja. Če ste prepričani, da želite iti čez %1, omogočite napredne možnosti kodirnika in odznačite \"Vsili omejitve bitne hitrosti storitve pretakanja\"." +Basic.Settings.Output.Simple.Warn.AudioBitrate="Opozorilo: bitna hitrost zvočnega pretoka bo nastavljena na %1, ki je zgornja meja trenutne storitve pretakanja. Če ste prepričani, da želite iti čez %1, omogočite napredne možnosti kodirnika in odznačite \"Vsili omejitve bitne hitrosti storitve pretakanja\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Opozorilo: posnetkov ni mogoče začasno ustaviti, če je kakovost posnetka nastavljena na \"Enaka kot pri pretakanju\"." +Basic.Settings.Output.Simple.Warn.Encoder="Opozorilo: snemanje s programskim kodirnikom pri drugačni kakovosti kot pri pretakanju zahteva dodatno porabo CPE-ja, če pretakate in snemate istočasno." +Basic.Settings.Output.Simple.Warn.Lossless="Opozorilo: brezizgubna kakovost ustvari izjemno velike velikosti datotek! Brezizgubna kakovost lahko porabi več kot 7 GB prostora na disku na minuto pri visokih ločljivostih in hitrostih sličic. Brezizgubna kakovost ni priporočljiva za dolge posnetke, razen če imate na voljo veliko prostora na disku." +Basic.Settings.Output.Simple.Warn.Lossless.Msg="Ali res želite uporabiti brezizgubno kakovost?" +Basic.Settings.Output.Simple.Warn.Lossless.Title="Opozorilo o brezizgubni kakovosti!" +Basic.Settings.Output.Simple.Encoder.Software="Programski (x264)" +Basic.Settings.Output.Simple.Encoder.Hardware.QSV="Strojni (QSV)" +Basic.Settings.Output.Simple.Encoder.Hardware.AMD="Strojni (AMD)" +Basic.Settings.Output.Simple.Encoder.Hardware.NVENC="Strojni (NVENC)" +Basic.Settings.Output.Simple.Encoder.SoftwareLowCPU="Programski (prednastavitev x264 s nizko porabo CPE-ja, poveča velikost datoteke)" +Basic.Settings.Output.VideoBitrate="Bitna hitrost slike" +Basic.Settings.Output.AudioBitrate="Bitna hitrost zvoka" Basic.Settings.Output.Reconnect="Samodejno ponovno poveži" -Basic.Settings.Output.RetryDelay="Premor med ponovnim poskusom (sekund)" -Basic.Settings.Output.MaxRetries="Število ponovnih poskusov" +Basic.Settings.Output.RetryDelay="Zakasn. pon. poizkusa" +Basic.Settings.Output.MaxRetries="Število ponovnih poizkusov" Basic.Settings.Output.Advanced="Omogoči napredne nastavitve kodiranja" - - +Basic.Settings.Output.EncoderPreset="Prednastavitev kodirnika" +Basic.Settings.Output.CustomEncoderSettings="Nastavitve po meri za kodirnik" +Basic.Settings.Output.CustomMuxerSettings="Nastavitve po meri za zvijalnik" +Basic.Settings.Output.NoSpaceFileName="Ustvari ime datoteke brez presledkov" + +Basic.Settings.Output.Adv.Rescale="Spremeni velikost izhoda" +Basic.Settings.Output.Adv.AudioTrack="Zvočna sled" +Basic.Settings.Output.Adv.Streaming="Pretakanje" +Basic.Settings.Output.Adv.ApplyServiceSettings="Vsili nastavitve kodirnika storitve za pretakanje" +Basic.Settings.Output.Adv.Audio.Track1="1. sled" +Basic.Settings.Output.Adv.Audio.Track2="2. sled" +Basic.Settings.Output.Adv.Audio.Track3="3. sled" +Basic.Settings.Output.Adv.Audio.Track4="4. sled" +Basic.Settings.Output.Adv.Audio.Track5="5. sled" +Basic.Settings.Output.Adv.Audio.Track6="6. sled" + +Basic.Settings.Output.Adv.Recording="Snemanje" +Basic.Settings.Output.Adv.Recording.Type="Vrsta" +Basic.Settings.Output.Adv.Recording.Type.Standard="Običajno" +Basic.Settings.Output.Adv.Recording.Type.FFmpegOutput="Izhod po meri (FFmpeg)" +Basic.Settings.Output.Adv.Recording.UseStreamEncoder="(uporabi pretočni kodirnik)" +Basic.Settings.Output.Adv.Recording.Filename="Oblika imena datoteke" +Basic.Settings.Output.Adv.Recording.OverwriteIfExists="Prepiši, če datoteka že obstaja" +Basic.Settings.Output.Adv.FFmpeg.Type="Vrsta izhoda FFmpeg" +Basic.Settings.Output.Adv.FFmpeg.Type.URL="Odvajaj v URL" +Basic.Settings.Output.Adv.FFmpeg.Type.RecordToFile="Odvajaj v datoteko" +Basic.Settings.Output.Adv.FFmpeg.SaveFilter.Common="Pogoste oblike posnetkov" Basic.Settings.Output.Adv.FFmpeg.SaveFilter.All="Vse datoteke" - - - -Basic.Settings.Video="Video" +Basic.Settings.Output.Adv.FFmpeg.SavePathURL="Pot do datoteke ali URL" +Basic.Settings.Output.Adv.FFmpeg.Format="Oblika vsebnika" +Basic.Settings.Output.Adv.FFmpeg.FormatAudio="Zvok" +Basic.Settings.Output.Adv.FFmpeg.FormatVideo="Slika" +Basic.Settings.Output.Adv.FFmpeg.FormatDefault="Privzeta oblika" +Basic.Settings.Output.Adv.FFmpeg.FormatDesc="Opis oblike vsebnika" +Basic.Settings.Output.Adv.FFmpeg.FormatDescDef="Zvočni/slikovni kodek se ugane iz poti datoteke ali URL-ja" +Basic.Settings.Output.Adv.FFmpeg.AVEncoderDefault="Privzeti kodirnik" +Basic.Settings.Output.Adv.FFmpeg.AVEncoderDisable="Onemogoči kodirnik" +Basic.Settings.Output.Adv.FFmpeg.VEncoder="Slikovni kodirnik" +Basic.Settings.Output.Adv.FFmpeg.VEncoderSettings="Nastavitve slikovnega kodirnika (če obstaja)" +Basic.Settings.Output.Adv.FFmpeg.AEncoder="Zvočni kodirnik" +Basic.Settings.Output.Adv.FFmpeg.AEncoderSettings="Nastavitve zvočnega kodirnika (če obstaja)" +Basic.Settings.Output.Adv.FFmpeg.MuxerSettings="Nastavitve zvijalnika (če obstaja)" +Basic.Settings.Output.Adv.FFmpeg.GOPSize="Razmik med ključnimi sličicami (sličic)" +Basic.Settings.Output.Adv.FFmpeg.IgnoreCodecCompat="Prikaže vse kodeke (tudi če so mogoče nezdružljivi)" + +FilenameFormatting.completer="%CCYY-%MM-%DD %hh-%mm-%ss\n%YY-%MM-%DD %hh-%mm-%ss\n%Y-%m-%d %H-%M-%S\n%y-%m-%d %H-%M-%S\n%a %Y-%m-%d %H-%M-%S\n%A %Y-%m-%d %H-%M-%S\n%Y-%b-%d %H-%M-%S\n%Y-%B-%d %H-%M-%S\n%Y-%m-%d %I-%M-%S-%p\n%Y-%m-%d %H-%M-%S-%z\n%Y-%m-%d %H-%M-%S-%Z" + +FilenameFormatting.TT="%CCYY leto - štiri številke\n%YY zadnji dve številki leta (00-99)\n%MM mesec kot desetiško število (01-12)\n%DD dan v mesecu z dvema številkama (01-31)\n%hh ura v 24-urni obliki (00-23)\n%mm minute (00-59)\n%ss sekunde (00-61)\n%% znak %\n%a skrajšano ime dneva v tednu\n%A ime dneva v tednu\n%b skrajšano ime meseca\n%B polno ime meseca\n%d dan v mesecu z dvema številkama (01-31)\n%H ura v 24-urni obliki (00-23)\n%I ura v 12-urni obliki (01-12)\n%m mesec kot desetiško število (01-12)\n%M minute (00-59)\n%p označbi AM ali PM\n%S sekunde (00-61)\n%y zadnji dve številki leta (00-99)\n%Y leto\n%z zamik ISO 8601 od UTC-ja v časovnem pasu\n%Z ime ali okrajšava časovnega pasu\n" + +Basic.Settings.Video="Slika" Basic.Settings.Video.Adapter="Grafična kartica" +Basic.Settings.Video.BaseResolution="Osnovna ločljivost" +Basic.Settings.Video.ScaledResolution="Izhodna ločljivost" Basic.Settings.Video.DownscaleFilter="Pomanjševalni filter" Basic.Settings.Video.DisableAeroWindows="Onemogoči Aero (samo Windows)" -Basic.Settings.Video.FPS="FPS" -Basic.Settings.Video.FPSCommon="Pogoste FPS vrednosti" -Basic.Settings.Video.FPSInteger="Cela števila FPS" -Basic.Settings.Video.FPSFraction="Decimalne FPS vrednosti" +Basic.Settings.Video.FPS="sl./s" +Basic.Settings.Video.FPSCommon="Pogoste vrednosti sl./s" +Basic.Settings.Video.FPSInteger="Cela števila sl./s" +Basic.Settings.Video.FPSFraction="Decimalne vrednosti sl./s" Basic.Settings.Video.Numerator="Števec" Basic.Settings.Video.Denominator="Imenovalec" -Basic.Settings.Video.Renderer="Rendanje" -Basic.Settings.Video.InvalidResolution="Neveljavna vrednost ločljivost. Biti mora [širina] x [višina] (npr. 1920x1080)" -Basic.Settings.Video.CurrentlyActive="Video izhod je trenutno aktiven. Prosimo, izklopite kakšen koli izhod za spreminjanje nastavitev." +Basic.Settings.Video.Renderer="Izrisovalnik" +Basic.Settings.Video.InvalidResolution="Neveljavna vrednost ločljivosti. Biti mora [širina] x [višina] (npr. 1920 x 1080)" +Basic.Settings.Video.CurrentlyActive="Slikovni izhod je trenutno dejaven. Prosimo, izklopite vse izhode za spreminjanje nastavitev slike." +Basic.Settings.Video.DisableAero="Onemogoči Aero" +Basic.Settings.Video.DownscaleFilter.Bilinear="Dvovrsten (najhitrejši, vendar ob znižanju ločljivosti povzroči megleno sliko)" +Basic.Settings.Video.DownscaleFilter.Bicubic="Dvoprostorninski (izostreno spreminjanje ločljivosti, 16 vzorcev)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (izostreno spreminjanje ločljivosti, 36 vzorcev)" +Basic.Settings.Video.DownscaleFilter.Area="Območje (utežena vsota, 4/6/9 vzorcev)" Basic.Settings.Audio="Zvok" -Basic.Settings.Audio.SampleRate="Sample Rate" +Basic.Settings.Audio.SampleRate="Hitrost vzorčenja" Basic.Settings.Audio.Channels="Kanali" - +Basic.Settings.Audio.Meters="Merilci" +Basic.Settings.Audio.MeterDecayRate="Hitrost razkroja" +Basic.Settings.Audio.MeterDecayRate.Fast="Hitra" +Basic.Settings.Audio.MeterDecayRate.Medium="Srednja (vrsta I PPM)" +Basic.Settings.Audio.MeterDecayRate.Slow="Počasna (vrsta II PPM)" +Basic.Settings.Audio.PeakMeterType="Vrsta merilca najvišjih točk" +Basic.Settings.Audio.PeakMeterType.SamplePeak="Primer najvišje točke" +Basic.Settings.Audio.PeakMeterType.TruePeak="Resnična najvišja točka (večja poraba CPE-ja)" +Basic.Settings.Audio.MultiChannelWarning.Enabled="OPOZORILO: prostorski zvok je omogočen." +Basic.Settings.Audio.MultichannelWarning="Če pretakate, preverite, ali storitev pretakanja podpira tako snemanje kot predvajanje prostorskega zvoka. Facebook 360 Live, Mixer RTMP in Smashcast so primeri, kjer je prostorski zvok v celoti podprt. Čeprav Facebook Live in YouTube Live podpirata snemanje prostorskega zvoka, ga Facebook Live premeša na stereo, YouTube Live pa predvaja samo dva kanala.\n\nFiltri OBS Studio so združljivi s prostorskim zvokom, čeprav podpora za vtičnik VST ni zajamčena." +Basic.Settings.Audio.MultichannelWarning.Title="Omogoči prostorski zvok?" +Basic.Settings.Audio.MultichannelWarning.Confirm="Ali res želite omogočiti prostorski zvok?" +Basic.Settings.Audio.Devices="Naprave" +Basic.Settings.Audio.DesktopDevice="Namizni zvok" +Basic.Settings.Audio.DesktopDevice2="Namizni zvok 2" +Basic.Settings.Audio.AuxDevice="Mikrofon/Dodatni zvok" +Basic.Settings.Audio.AuxDevice2="Mikrofon/Dodatni zvok 2" +Basic.Settings.Audio.AuxDevice3="Mikrofon/Dodatni zvok 3" +Basic.Settings.Audio.AuxDevice4="Mikrofon/Dodatni zvok 4" +Basic.Settings.Audio.EnablePushToMute="Omogoči 'Pritisni in utišaj'" +Basic.Settings.Audio.PushToMuteDelay="Zakasn. funk. 'Pritisni in utišaj'" +Basic.Settings.Audio.EnablePushToTalk="Omogoči 'Pritisni in govori'" +Basic.Settings.Audio.PushToTalkDelay="Zakasn. funk. 'Pritisni in govori'" +Basic.Settings.Audio.UnknownAudioDevice="[naprava ni povezana ali ni na voljo]" +Basic.Settings.Audio.Disabled="Onemogočeno" + +Basic.Settings.Advanced="Napredno" +Basic.Settings.Advanced.General.ProcessPriority="Prednost opravila" +Basic.Settings.Advanced.General.ProcessPriority.High="Visoka" +Basic.Settings.Advanced.General.ProcessPriority.AboveNormal="Nad običajno" +Basic.Settings.Advanced.General.ProcessPriority.Normal="Običajna" +Basic.Settings.Advanced.General.ProcessPriority.BelowNormal="Pod običajno" +Basic.Settings.Advanced.General.ProcessPriority.Idle="Nedejavno" +Basic.Settings.Advanced.FormatWarning="Opozorilo: barvne oblike razen NV12 so v glavnem namenjene snemanju in niso priporočljive za pretakanje. Pretakanje lahko poveča porabo CPE-ja zaradi pretvarjanja barvne oblike." +Basic.Settings.Advanced.Audio.BufferingTime="Čas medpomnenja zvoka" +Basic.Settings.Advanced.Video.ColorFormat="Barvna oblika" +Basic.Settings.Advanced.Video.ColorSpace="Barvni prostor" +Basic.Settings.Advanced.Video.ColorRange="Barvni razpon" Basic.Settings.Advanced.Video.ColorRange.Partial="Delno" Basic.Settings.Advanced.Video.ColorRange.Full="Celotno" - - - - - - - - - - - - - - - - +Basic.Settings.Advanced.Audio.MonitoringDevice="Nadzorna naprava" +Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Privzeto" +Basic.Settings.Advanced.Audio.DisableAudioDucking="Onemogoči zmanjšanje glasnosti zvoka sistema Windows" +Basic.Settings.Advanced.StreamDelay="Zakasnitev pretoka" +Basic.Settings.Advanced.StreamDelay.Duration="Trajanje" +Basic.Settings.Advanced.StreamDelay.Preserve="Ohrani točko prekinitve (povečaj zakasnitev) ob ponovni povezavi" +Basic.Settings.Advanced.StreamDelay.MemoryUsage="Ocenjena poraba pomnilnika: %1 MB" +Basic.Settings.Advanced.Network="Omrežje" +Basic.Settings.Advanced.Network.BindToIP="Veži na IP" +Basic.Settings.Advanced.Network.EnableNewSocketLoop="Omogoči novo omrežno kodo" +Basic.Settings.Advanced.Network.EnableLowLatencyMode="Način nizke zakasnitve" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Vedenje hitrih tipk ob osredotočanju" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Nikoli ne onemogoči hitrih tipk" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Onemogoči hitre tipke, ko je glavno okno v žarišču" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Onemogoči hitre tipke, ko glavno okno ni v žarišču" +Basic.Settings.Advanced.AutoRemux="Samodejno ponovno zvij v mp4" +Basic.Settings.Advanced.AutoRemux.MP4="(posnemi kot mkv)" + +Basic.AdvAudio="Napredne lastnosti zvoka" +Basic.AdvAudio.Name="Ime" +Basic.AdvAudio.Volume="Glasnost" +Basic.AdvAudio.Mono="Mono" +Basic.AdvAudio.Balance="Ravnovesje" +Basic.AdvAudio.SyncOffset="Zamik sinhronizacije" +Basic.AdvAudio.Monitoring="Nadzor zvoka" +Basic.AdvAudio.Monitoring.None="Nadzor je izklopljen" +Basic.AdvAudio.Monitoring.MonitorOnly="Samo nadziraj (utišaj izhod)" +Basic.AdvAudio.Monitoring.Both="Nadzor in izhod" +Basic.AdvAudio.AudioTracks="Sledi" + +Basic.Settings.Hotkeys="Hitre tipke" +Basic.Settings.Hotkeys.Pair="Kombinacije tipk, deljene s/z '%1', delujejo kot preklopniki" +Basic.Settings.Hotkeys.Filter="Filter" + +Basic.Hotkeys.SelectScene="Preklopi na prizor" + +Basic.SystemTray.Show="Prikaži" +Basic.SystemTray.Hide="Skrij" + +Basic.SystemTray.Message.Reconnecting="Povezava je bila prekinjena. Ponovno povezovanje …" + +Hotkeys.Insert="Vstavi" +Hotkeys.Delete="Izbriši" +Hotkeys.Home="Domov" +Hotkeys.End="Ustavi" +Hotkeys.PageUp="Stran gor" +Hotkeys.PageDown="Stran dol" +Hotkeys.NumLock="Num Lock" +Hotkeys.ScrollLock="Scroll Lock" +Hotkeys.CapsLock="Caps Lock" +Hotkeys.Backspace="Vračalka" +Hotkeys.Tab="Zamik." +Hotkeys.Print="Natisni" +Hotkeys.Pause="Premor" +Hotkeys.Left="Levo" +Hotkeys.Right="Desno" +Hotkeys.Up="Gor" +Hotkeys.Down="Dol" +Hotkeys.Windows="Okna" +Hotkeys.Super="Super" +Hotkeys.Menu="Meni" +Hotkeys.Space="Presledek" +Hotkeys.NumpadNum="Tipka številč. %1" +Hotkeys.NumpadMultiply="Tipka * na številč." +Hotkeys.NumpadDivide="Tipka / na številč." +Hotkeys.NumpadAdd="Tipka + na številč." +Hotkeys.NumpadSubtract="Tipka - na številč." +Hotkeys.NumpadDecimal="Tipka . na številč." +Hotkeys.AppleKeypadNum="%1 (številčnica)" +Hotkeys.AppleKeypadMultiply="* (številčnica)" +Hotkeys.AppleKeypadDivide="/ (številčnica)" +Hotkeys.AppleKeypadAdd="+ (številčnica)" +Hotkeys.AppleKeypadSubtract="- (številčnica)" +Hotkeys.AppleKeypadDecimal=". (številčnica)" +Hotkeys.AppleKeypadEqual="= (številčnica)" +Hotkeys.MouseButton="Miška %1" +Hotkeys.Escape="Esc" + +Mute="Utišaj" +Unmute="Vklopi zvok" +Push-to-mute="Pritisni in utišaj" +Push-to-talk="Pritisni in govori" + +SceneItemShow="Prikaži '%1'" +SceneItemHide="Skrij '%1'" + +OutputWarnings.NoTracksSelected="Izbrati morate vsaj eno sled" +OutputWarnings.MultiTrackRecording="Opozorilo: določene oblike (kot je flv) ne podpirajo več sledi na posnetek" +OutputWarnings.MP4Recording="Opozorilo: posnetkov, shranjenih v mp4/mov, ne bo mogoče obnoviti, če datoteka ni dokončana (npr. kot posledica \"modrega zaslona smrti\", izgube napajanja itd.). Če želite posneti več zvočnih sledi, razmislite o uporabi mkv-ja in po dokončanju posnetka njegovim ponovnim zvijanjem v mp4/mov (Datoteka → Ponovno zvij posnetke)." +OutputWarnings.CannotPause="Opozorilo: posnetkov ni mogoče začasno ustaviti, če je snemalni kodirnik nastavljen na \"(uporabi pretočni kodirnik)\"" + +FinalScene.Title="Izbriši prizor" +FinalScene.Text="Obstajati mora vsaj en prizor." + +NoSources.Title="Ni virov" +NoSources.Text="Videti je, da še niste dodali nobenega slikovnega vira, tako da boste odvajali samo prazen zaslon. Ali res želite to storiti?" +NoSources.Text.AddSource="Vire lahko kadarkoli dodate s klikom na ikono + pod poljem Viri v glavnem oknu." +NoSources.Label="Nimate virov.\nKliknite na spodnji gumb\nali tukaj z desno tipko na miški, da enega dodate." + +ChangeBG="Nastavi barvo" +CustomColor="Barva po meri" + +BrowserSource.EnableHardwareAcceleration="Omogoči strojno pospeševanje brskalnika" + +About="O programu" +About.Info="OBS Studio je prosta in odprtokodna programska oprema za snemanje videoposnetkov in pretakanje v živo." +About.Donate="Prispevaj" +About.GetInvolved="Pridruži se" +About.Authors="Avtorji" +About.License="Licenca" +About.Contribute="Podprite projekt OBS" + +ResizeOutputSizeOfSource="Spremeni velikost izhoda (vira)" +ResizeOutputSizeOfSource.Text="Osnovna in izhodna ločljivost bosta spremenjeni na ločljivost trenutnega vira." +ResizeOutputSizeOfSource.Continue="Želite nadaljevati?" + +PreviewTransition="Predogled prehoda"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/sq-AL.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/sq-AL.ini
Changed
@@ -23,7 +23,6 @@ Display="Ekrani" Name="Emri" Exit="Dil" -Mixer="Mikser" Browse="Shfleto" Mono="Mono" Stereo="Stereo" @@ -87,6 +86,7 @@ + Copy.Filters="Kopjo Filterat" Paste.Filters="Ngjit Filterat" @@ -218,3 +218,4 @@ +
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/sr-CS.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/sr-CS.ini
Changed
@@ -23,7 +23,6 @@ Display="Ekran" Name="Ime" Exit="Izlaz" -Mixer="Mikseta" Browse="Pretraži" Mono="Mono" Stereo="Stereo" @@ -89,6 +88,7 @@ AlreadyRunning.LaunchAnyway="Pokreni bez obzira na sve" + Auth.Authing.Title="Provera autentičnosti.." Auth.Authing.Text="Provera autentičnosti pomoću %1, molim sačekajte.." Auth.AuthFailure.Title="Nije moguće utvrditi autentičnost" @@ -134,7 +134,6 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Napomena: Osnovna rezolucija nije nužno ista kao rezolucija kojom ćete strimovati ili kojom ćete snimati. Vaša stvarna rezolucija kojom strimujete/snimate može biti skalirana u odnosu na osnovnu kako bi se smanjila upotreba resursa ili optimizovao protok." Basic.AutoConfig.StreamPage="Informacije o strimovanju" Basic.AutoConfig.StreamPage.SubTitle="Molimo unesite Vaše informacije o strimovanju" -Basic.AutoConfig.StreamPage.ConnectAccount="Poveži nalog (opciono)" Basic.AutoConfig.StreamPage.DisconnectAccount="Diskonektuj nalog" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Diskonektuj nalog?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Ova promena će biti primenjena odmah. Da li ste sigurni da želite da diskonektujete Vaš nalog?" @@ -235,6 +234,7 @@ ConfirmStop.Text="Da li ste sigurni da želite da zaustavite strimovanje?" + ConfirmExit.Title="Izađite iz OBS programa?" ConfirmExit.Text="OBS je trenutno aktivan. Svi strimovi/snimanja će biti ugašeni. Da li ste sigurni da želite da izađete iz programa?" @@ -577,7 +577,6 @@ Basic.Settings.Output.Mode.Adv="Napredno" Basic.Settings.Output.Mode.FFmpeg="FFmpeg izlaz" Basic.Settings.Output.UseReplayBuffer="Uključi bafer ponovnog prikazivanja" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maksimalno vreme ponovnog prikazivanja (sekunde)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maksimalna memorija (MB)" Basic.Settings.Output.ReplayBuffer.Estimate="Procenjena iskorišćenost memorije: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Nemoguće je proceniti iskorišćenost memorije. Molimo podesite maksimalnu granicu memorije." @@ -604,7 +603,6 @@ Basic.Settings.Output.VideoBitrate="Protok videa" Basic.Settings.Output.AudioBitrate="Protok zvuka" Basic.Settings.Output.Reconnect="Automatski poveži ponovo" -Basic.Settings.Output.RetryDelay="Kašnjenje ponovnog pokušaja (sekunde)" Basic.Settings.Output.MaxRetries="Maksimalan broj ponovnih pokušaja" Basic.Settings.Output.Advanced="Omogući napredna podešavanja kompresora" Basic.Settings.Output.EncoderPreset="Predefinisano podešavanje enkodera" @@ -675,7 +673,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (najbrže, ali mutno pri skaliranju)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (oštrije skaliranje, 16 uzoraka)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (oštrije skaliranje, 32 uzorka)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (oštrije skaliranje, 36 uzorka)" Basic.Settings.Audio="Zvuk" Basic.Settings.Audio.SampleRate="Protok" @@ -687,7 +685,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Vrh uzorka" Basic.Settings.Audio.PeakMeterType.TruePeak="Pravi vrh (Veća upotreba procesora)" Basic.Settings.Audio.MultiChannelWarning.Enabled="UPOZORENJE: Zvuk okruženja je uključen." -Basic.Settings.Audio.MultichannelWarning="Ako je strim u toku, proverite da li vaša striming usluga podržava integraciju i plejbek zvuka okruženja. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast su primeri gde je zvuk okruženja u potpunosti podržan. Iako i Facebook Live i YouTube Live podržavaju integraciju okruženja, Facebook Live miksuje kao stereo, a YouTube Live reprodukuje samo dva kanala.\n\nOBS zvučni filteri su kompatibilni sa zvukom okruženja, mada podrška za VST priključke nije zagarantovana." +Basic.Settings.Audio.MultichannelWarning="Ako je strim u toku, proverite da li vaša striming usluga podržava integraciju i plejbek zvuka okruženja. Facebook 360 Live, Mixer RTMP, Smashcast su primeri gde je zvuk okruženja u potpunosti podržan. Iako i Facebook Live i YouTube Live podržavaju integraciju okruženja, Facebook Live miksuje kao stereo, a YouTube Live reprodukuje samo dva kanala.\n\nOBS zvučni filteri su kompatibilni sa zvukom okruženja, mada podrška za VST priključke nije zagarantovana." Basic.Settings.Audio.MultichannelWarning.Title="Da li želite da uključite zvuk okruženja?" Basic.Settings.Audio.MultichannelWarning.Confirm="Da li ste sigurni da želite da uključite zvuk okruženja?" Basic.Settings.Audio.Devices="Uređaji" @@ -713,7 +711,6 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Podrazumevano" Basic.Settings.Advanced.Audio.DisableAudioDucking="Isključi Windows audio ducking" Basic.Settings.Advanced.StreamDelay="Kašnjenje strimovanja" -Basic.Settings.Advanced.StreamDelay.Duration="Trajanje (sekunde)" Basic.Settings.Advanced.StreamDelay.Preserve="Sačuvaj tačku prekida (povećaj kašnjenje) prilikom ponovnog povezivanja" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Procenjena upotreba memorije: %1 MB" Basic.Settings.Advanced.Network="Mreža" @@ -726,9 +723,7 @@ Basic.AdvAudio="Napredna podešavanja zvuka" Basic.AdvAudio.Name="Ime" -Basic.AdvAudio.Mono="Spoji u mono" Basic.AdvAudio.Balance="Balans" -Basic.AdvAudio.SyncOffset="Razlika u sinhronizaciji (ms)" Basic.AdvAudio.Monitoring="Audio nadzor" Basic.AdvAudio.Monitoring.None="Isključi nadzor" Basic.AdvAudio.Monitoring.MonitorOnly="Samo nadzor (izlaz bez zvuka)"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/sr-SP.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/sr-SP.ini
Changed
@@ -23,7 +23,6 @@ Display="Екран" Name="Име" Exit="Изађи" -Mixer="Миксета" Browse="Прегледај" Mono="Моно" Stereo="Стерео" @@ -86,6 +85,7 @@ AlreadyRunning.LaunchAnyway="Свеједно покрени" + Auth.Authing.Title="Потврда идентитета" Auth.Authing.Text="Потврда идентитета помоћу %1-а, сачекајте…" Auth.AuthFailure.Title="Грешка при потврди идентитета" @@ -131,7 +131,6 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Напомена: основна резолуција није нужно иста као резолуција којом ћете стримовати или којом ћете снимати. Ваша стварна резолуција којом стримујете/снимате може бити скалирана у односу на основну како би се смањила употреба ресурса или оптимизовао проток." Basic.AutoConfig.StreamPage="Информације о стримовању" Basic.AutoConfig.StreamPage.SubTitle="Молимо унесите ваше информације о стримовању" -Basic.AutoConfig.StreamPage.ConnectAccount="Повежи налог (опционо)" Basic.AutoConfig.StreamPage.DisconnectAccount="Дисконектуј налог" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Дисконектуј налог?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Ова промена ће бити примењена одмах. Да ли сте сигурни да желите да дисконектујете Ваш налог?" @@ -231,6 +230,7 @@ ConfirmStop.Text="Да ли сте сигурни да желите да зауставите стримовање?" + ConfirmExit.Title="Изађите из OBS програма?" ConfirmExit.Text="OBS је тренутно активан. Сви стримови/снимања ће бити угашени. Да ли сте сигурни да желите да изађете из програма?" @@ -573,7 +573,6 @@ Basic.Settings.Output.Mode.Adv="Напредно" Basic.Settings.Output.Mode.FFmpeg="FFmpeg излаз" Basic.Settings.Output.UseReplayBuffer="Укључи бафер поновног приказивања" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Максимално време поновног приказивања (секунде)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Максимална меморија (мегабајти)" Basic.Settings.Output.ReplayBuffer.Estimate="Процењена искоришћеност меморије: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Немогуће је проценити искоришћеност меморије. Молимо подесите максималну границу меморије." @@ -600,7 +599,6 @@ Basic.Settings.Output.VideoBitrate="Проток видеа" Basic.Settings.Output.AudioBitrate="Проток звука" Basic.Settings.Output.Reconnect="Аутоматски повежи поново" -Basic.Settings.Output.RetryDelay="Кашњење поновног покушаја (секунде)" Basic.Settings.Output.MaxRetries="Максималан број поновних покушаја" Basic.Settings.Output.Advanced="Омогући напредна подешавања компресора" Basic.Settings.Output.EncoderPreset="Предефинисано подешавање енкодера" @@ -671,7 +669,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (најбрже, али мутно при скалирању)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (оштрије скалирање, 16 узорака)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (оштрије скалирање, 32 узорка)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (оштрије скалирање, 36 узорка)" Basic.Settings.Audio="Звук" Basic.Settings.Audio.SampleRate="Проток" @@ -683,7 +681,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Врх узорка" Basic.Settings.Audio.PeakMeterType.TruePeak="Прави врх (већа употреба процесора)" Basic.Settings.Audio.MultiChannelWarning.Enabled="УПОЗОРЕЊЕ: Звук окружења је укључен." -Basic.Settings.Audio.MultichannelWarning="Ако је стрим у току, проверите да ли ваша стриминг услуга подржава интеграцију и плејбек звука окружења. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast су примери где је звук окружења у потпуности подржан. Иако и Facebook Live i YouTube Live подржавају интеграцију окружења, Facebook Live миксује као стерео, а YouTube Live репродукује само два канала. \n\nOBS звучни филтери су компатибилни са звуком окружења, мада подршка за VST прикључке није загарантована." +Basic.Settings.Audio.MultichannelWarning="Ако је стрим у току, проверите да ли ваша стриминг услуга подржава интеграцију и плејбек звука окружења. Facebook 360 Live, Mixer RTMP, Smashcast су примери где је звук окружења у потпуности подржан. Иако и Facebook Live i YouTube Live подржавају интеграцију окружења, Facebook Live миксује као стерео, а YouTube Live репродукује само два канала. \n\nOBS звучни филтери су компатибилни са звуком окружења, мада подршка за VST прикључке није загарантована." Basic.Settings.Audio.MultichannelWarning.Title="Да ли желите да укључите звук окружења?" Basic.Settings.Audio.MultichannelWarning.Confirm="Да ли сте сигурни да желите да укључите звук окружења?" Basic.Settings.Audio.EnablePushToMute="Омогући стисни-за-мутирање" @@ -707,7 +705,6 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Подразумевано" Basic.Settings.Advanced.Audio.DisableAudioDucking="Искључи Windows audio ducking" Basic.Settings.Advanced.StreamDelay="Кашњење стримовања" -Basic.Settings.Advanced.StreamDelay.Duration="Трајање (секунде)" Basic.Settings.Advanced.StreamDelay.Preserve="Сачувај тачку прекида (повећај кашњење) приликом поновног повезивања" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Процењена употреба меморије: %1 MB" Basic.Settings.Advanced.Network="Мрежа" @@ -720,9 +717,7 @@ Basic.AdvAudio="Напредна подешавања звука" Basic.AdvAudio.Name="Име" -Basic.AdvAudio.Mono="Споји у моно" Basic.AdvAudio.Balance="Баланс" -Basic.AdvAudio.SyncOffset="Разлика у синхронизацији (ms)" Basic.AdvAudio.Monitoring="Аудио надзор" Basic.AdvAudio.Monitoring.None="Искључи надзор" Basic.AdvAudio.Monitoring.MonitorOnly="Само надзор (излаз без звука)"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/sv-SE.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/sv-SE.ini
Changed
@@ -7,13 +7,13 @@ Cancel="Avbryt" Close="Stäng" Save="Spara" -Discard="Radera" +Discard="Ignorera" Disable="Inaktivera" Yes="Ja" No="Nej" Add="Lägg till" Remove="Ta bort" -Rename="Ändra namn" +Rename="Byt namn" Interact="Interagera" Filters="Filter" Properties="Egenskaper" @@ -23,7 +23,7 @@ Display="Bildskärm" Name="Namn" Exit="Avsluta" -Mixer="Mixer" +Mixer="Ljudmixer" Browse="Bläddra" Mono="Mono" Stereo="Stereo" @@ -39,7 +39,7 @@ MultiviewProjector="Multivy (helskärm)" MultiviewWindowed="Multivy (fönster)" Clear="Rensa" -Revert="Återgå" +Revert="Nollställ" Show="Visa" Hide="Dölj" UnhideAll="Visa alla" @@ -67,7 +67,7 @@ Copy="Kopiera" Paste="Klistra in" PasteReference="Klistra in (referens)" -PasteDuplicate="Klistra in (duplicera)" +PasteDuplicate="Klistra in (dubblett)" RemuxRecordings="Remuxa inspelningar" Next="Nästa" Back="Tillbaka" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Stäng flytande fönster" DockCloseWarning.Text="Du stängde precis ett flytande fönster. Om du vill visa det igen, använd Visa → Flytande fönster i menyfältet." +ExtraBrowsers="Anpassade flytande webbläsarfönster" +ExtraBrowsers.Info="Lägg till flytande fönster genom att ge dem ett namn och en webbadress, klicka sedan på Verkställ eller Stäng för att öppna fönstren. Du kan lägga till eller ta bort flytande fönster när som helst." +ExtraBrowsers.DockName="Namn på flytande fönster" + Auth.Authing.Title="Autentiserar..." Auth.Authing.Text="Autentiserar med %1, var god vänta..." Auth.AuthFailure.Title="Autentiseringsfel" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Aktivitetsflöde för Twitch" TwitchAuth.TwoFactorFail.Title="Kunde inte efterfråga strömnyckel" TwitchAuth.TwoFactorFail.Text="OBS kunde inte ansluta till ditt Twitch-konto. Se till att tvåfaktorsautentiseringen har ställts in i <a href='https://www.twitch.tv/settings/security'>säkerhetsinställningarna på Twitch</a> då detta är nödvändigt för att kunna strömma." +RestreamAuth.Channels="Restream-kanaler" Copy.Filters="Kopiera filter" Paste.Filters="Klistra in filter" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="OBS: Kanvasens (grundens) upplösning är nödvändigtvis samma som upplösningen upp kommer att strömma eller spela in med. Din riktiga upplösning för strömning/inspelning kan skalas ned från kanvasupplösningen för att reducera användning av resurser eller krav på bithastighet." Basic.AutoConfig.StreamPage="Ströminformation" Basic.AutoConfig.StreamPage.SubTitle="Var god ange din ströminformation" -Basic.AutoConfig.StreamPage.ConnectAccount="Anslut konto (valfritt)" +Basic.AutoConfig.StreamPage.ConnectAccount="Anslut konto (rekommenderas)" Basic.AutoConfig.StreamPage.DisconnectAccount="Koppla från konto" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Koppla från konto?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Denna ändring kommer tillämpas direkt. Är du säker på att du vill koppla från ditt konto?" @@ -157,7 +162,7 @@ Basic.AutoConfig.StreamPage.StreamWarning.Text="Bandbreddstestet kommer att strömma slumpad videodata utan ljud till din kanal. Om det fungerar, är det rekommenderat det att tillfälligt inaktivera att spara videor av strömmar och ändra strömmen till privat tills testet är färdigt. Fortsätta?" Basic.AutoConfig.TestPage="Slutgiltiga resultat" Basic.AutoConfig.TestPage.SubTitle.Testing="Programmet utför nu en grupp tester för att uppskatta de mest idealiska inställningarna" -Basic.AutoConfig.TestPage.SubTitle.Complete="Testet slutfört" +Basic.AutoConfig.TestPage.SubTitle.Complete="Testet slutfördes" Basic.AutoConfig.TestPage.TestingBandwidth="Utför bandbreddstest, detta kan ta några minuter..." Basic.AutoConfig.TestPage.TestingBandwidth.Connecting="Ansluter till: %1..." Basic.AutoConfig.TestPage.TestingBandwidth.ConnectFailed="Misslyckades att ansluta till någon server, kontrollera din Internetanslutning och försök igen." @@ -213,7 +218,7 @@ QuickTransitions.DuplicateSceneTT="När du redigerar samma scen kan du redigera transformering/synligheten för källor utan att modifiera utmatningen.\nFör att redigera egenskaper för källor utan att modifiera utmatningen aktiverar du 'Duplicera källor'.\nNär detta värde ändras kommer den aktuella utmatningsscenen återställas (om den fortfarande finns)." QuickTransitions.EditProperties="Duplicera källor" QuickTransitions.EditPropertiesTT="När du redigerar samma scen kan du redigera egenskaperna för källor utan att modifiera utmatningen.\nDetta fungerar endast om 'Duplicera scen' är aktiverad.\nVissa källor (som mediakällor) stöder inte detta och kan inte redigeras separat.\nNär detta värde ändras kommer den aktuella utmatningsscenen återställas (om den fortfarande finns).\n\nVarning: Eftersom källor kommer att dupliceras kan detta kräva extra system- eller videoresurser." -QuickTransitions.HotkeyName="Snabba övergång: %1" +QuickTransitions.HotkeyName="Snabb övergång: %1" Basic.AddTransition="Lägg till konfigurerbar övergång" Basic.RemoveTransition="Ta bort konfigurerbar övergång" @@ -240,6 +245,9 @@ ConfirmStop.Title="Sluta strömma?" ConfirmStop.Text="Är du säker på att du vill sluta strömma?" +ConfirmStopRecord.Title="Stoppa inspelning?" +ConfirmStopRecord.Text="Är du säker på att du vill stoppa inspelningen?" + ConfirmBWTest.Title="Starta bandbreddstest?" ConfirmBWTest.Text="Du har konfigurerat OBS i testläge för bandbredd. Detta läge låter dig testa nätverket utan att din kanal direktsänder. När du har testat färdigt behöver du inaktivera den för att att tittare ska kunna se din ström.\n\nVill du fortsätta?" @@ -255,10 +263,12 @@ Output.StartReplayFailed="Misslyckades att starta reprisbuffert" Output.StartFailedGeneric="Misslyckades att starta utmatningen. Kolla loggen för detaljer.\n\nOBS: Om du använder kodarna NVENC eller AMD, se till att dina grafikdrivrutiner är uppdaterade." +Output.ReplayBuffer.PauseWarning.Title="Kan inte spara repriser under pausning" +Output.ReplayBuffer.PauseWarning.Text="Varning: Repriser kan inte sparas när inspelningen är pausad." -Output.ConnectFail.Title="Anslutning misslyckades" +Output.ConnectFail.Title="Misslyckades att ansluta" Output.ConnectFail.BadPath="Ogiltig sökväg eller anslutnings-URL. Kontrollera att dina inställningar är korrekta." -Output.ConnectFail.ConnectFailed="Kunde inte ansluta till servern" +Output.ConnectFail.ConnectFailed="Misslyckades att ansluta till server" Output.ConnectFail.InvalidStream="Kunde inte komma åt den valda kanalen eller strömnyckeln, var god dubbelkolla din strömnyckel. Om den stämmer kan det finnas något anslutningsproblem till servern." Output.ConnectFail.Error="Ett oväntat fel uppstod vid anslutning till servern. Se loggfilen för ytterligare information." Output.ConnectFail.Disconnected="Nedkopplad från servern." @@ -266,7 +276,7 @@ Output.StreamEncodeError.Title="Kodningsfel" Output.StreamEncodeError.Msg="Ett kodarfel uppstod under strömmande." -Output.RecordFail.Title="Det gick inte att starta inspelningen" +Output.RecordFail.Title="Misslyckades att starta inspelning" Output.RecordFail.Unsupported="Antingen stöds inte utdataformatet eller så har det inte stöd för mer än ett ljudspår. Kontrollera dina inställningar och försök igen." Output.RecordNoSpace.Title="Otillräckligt diskutrymme" Output.RecordNoSpace.Msg="Det finns inte tillräckligt med diskutrymme för att fortsätta inspelningen." @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="Starta reprisbuffert" Basic.Main.StartStreaming="Börja strömma" Basic.Main.StopRecording="Sluta spela in" +Basic.Main.PauseRecording="Pausa inspelning" +Basic.Main.UnpauseRecording="Återuppta inspelning" Basic.Main.StoppingRecording="Slutar spela in..." Basic.Main.StopReplayBuffer="Stoppa reprisbuffert" Basic.Main.StoppingReplayBuffer="Stoppar reprisbuffert..." @@ -454,54 +466,55 @@ Basic.Main.GroupItems="Gruppera markerade föremål" Basic.Main.Ungroup="Avgruppera" -Basic.MainMenu.File="Arkiv (&F)" +Basic.MainMenu.File="&Arkiv" Basic.MainMenu.File.Export="&Exportera" Basic.MainMenu.File.Import="&Importera" -Basic.MainMenu.File.ShowRecordings="Visa inspelninga&r" +Basic.MainMenu.File.ShowRecordings="&Visa inspelningar" Basic.MainMenu.File.Remux="Re&muxa inspelningar" -Basic.MainMenu.File.Settings="In&ställningar" +Basic.MainMenu.File.Settings="&Inställningar" Basic.MainMenu.File.ShowSettingsFolder="Visa inställningsmapp" Basic.MainMenu.File.ShowProfileFolder="Visa profilmapp" Basic.MainMenu.AlwaysOnTop="&Alltid överst" -Basic.MainMenu.File.Exit="Avsluta (&X)" +Basic.MainMenu.File.Exit="Avsl&uta" -Basic.MainMenu.Edit="R&edigera" -Basic.MainMenu.Edit.Undo="Ångra (&U)" -Basic.MainMenu.Edit.Redo="Gö&r om" -Basic.MainMenu.Edit.UndoAction="Ångra $1 (&U)" -Basic.MainMenu.Edit.RedoAction="Gö&r om $1" +Basic.MainMenu.Edit="&Redigera" +Basic.MainMenu.Edit.Undo="&Ångra" +Basic.MainMenu.Edit.Redo="&Gör om" +Basic.MainMenu.Edit.UndoAction="&Ångra $1" +Basic.MainMenu.Edit.RedoAction="&Gör om $1" Basic.MainMenu.Edit.LockPreview="&Lås förhandsvisning" -Basic.MainMenu.Edit.Scale="Förhandsvisa &skalning" +Basic.MainMenu.Edit.Scale="&Förhandsvisa skalning" Basic.MainMenu.Edit.Scale.Window="Skala till fönster" Basic.MainMenu.Edit.Scale.Canvas="Kanvas (%1x%2)" Basic.MainMenu.Edit.Scale.Output="Utmatning (%1x%2)" -Basic.MainMenu.Edit.Transform="Omvandla (&T)" -Basic.MainMenu.Edit.Transform.EditTransform="R&edigera omvandling..." -Basic.MainMenu.Edit.Transform.CopyTransform="Kopiera transformering" -Basic.MainMenu.Edit.Transform.PasteTransform="Klistra in transformering" -Basic.MainMenu.Edit.Transform.ResetTransform="Åte&rställ omvandling" +Basic.MainMenu.Edit.Transform="O&mvandla" +Basic.MainMenu.Edit.Transform.EditTransform="&Redigera omvandling..." +Basic.MainMenu.Edit.Transform.CopyTransform="Kopiera omvandling" +Basic.MainMenu.Edit.Transform.PasteTransform="Klistra in omvandling" +Basic.MainMenu.Edit.Transform.ResetTransform="&Återställ omvandling" Basic.MainMenu.Edit.Transform.Rotate90CW="Rotera 90 grader medsols" Basic.MainMenu.Edit.Transform.Rotate90CCW="Rotera 90 grader motsols" Basic.MainMenu.Edit.Transform.Rotate180="Rotera 180 grader" -Basic.MainMenu.Edit.Transform.FlipHorizontal="Spegelvänd vågrätt (&H)" -Basic.MainMenu.Edit.Transform.FlipVertical="Spegel&vänd lodrätt" -Basic.MainMenu.Edit.Transform.FitToScreen="Anpassa till skärmen (&F)" +Basic.MainMenu.Edit.Transform.FlipHorizontal="Spegelvänd &horisontalt" +Basic.MainMenu.Edit.Transform.FlipVertical="Spegel&vänd vertikalt" +Basic.MainMenu.Edit.Transform.FitToScreen="&Anpassa till skärmen" Basic.MainMenu.Edit.Transform.StretchToScreen="Anpa&ssa storlek till skärmen" Basic.MainMenu.Edit.Transform.CenterToScreen="&Centrera på skärmen" Basic.MainMenu.Edit.Transform.VerticalCenter="Centrera vertikalt" Basic.MainMenu.Edit.Transform.HorizontalCenter="Centrera horisontalt" Basic.MainMenu.Edit.Order="&Ordning" Basic.MainMenu.Edit.Order.MoveUp="Flytta &upp" -Basic.MainMenu.Edit.Order.MoveDown="Flytta ne&d" -Basic.MainMenu.Edit.Order.MoveToTop="Lägg övers&t" -Basic.MainMenu.Edit.Order.MoveToBottom="Lägg underst (&B)" +Basic.MainMenu.Edit.Order.MoveDown="Flytta &ned" +Basic.MainMenu.Edit.Order.MoveToTop="Flytta längst u&pp" +Basic.MainMenu.Edit.Order.MoveToBottom="Flytta längst ne&d" Basic.MainMenu.Edit.AdvAudio="&Avancerade ljudinställningar" Basic.MainMenu.View="&Visa" -Basic.MainMenu.View.Toolbars="Verk&tygsfält" +Basic.MainMenu.View.Toolbars="&Verktygsfält" Basic.MainMenu.View.Docks="Flytande fönster" Basic.MainMenu.View.Docks.ResetUI="Återställ gränssnitt" Basic.MainMenu.View.Docks.LockUI="Lås gränssnitt" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Anpassade flytande webbläsarfönster..." Basic.MainMenu.View.Toolbars.Listboxes="&Listrutor" Basic.MainMenu.View.SceneTransitions="S&cenövergångar" Basic.MainMenu.View.StatusBar="&Statusfält" @@ -516,22 +529,22 @@ Basic.MainMenu.Profile.Exists="Profilen finns redan" Basic.MainMenu.SceneCollection.Exists="Scensamlingen finns redan" -Basic.MainMenu.Tools="Verk&tyg" +Basic.MainMenu.Tools="&Verktyg" Basic.MainMenu.Help="&Hjälp" Basic.MainMenu.Help.HelpPortal="Hjälp&portal" Basic.MainMenu.Help.Website="Besök &webbplats" Basic.MainMenu.Help.Discord="Anslut till &Discord-servern" Basic.MainMenu.Help.Logs="&Loggfiler" -Basic.MainMenu.Help.Logs.ShowLogs="Vi&sa loggfiler" -Basic.MainMenu.Help.Logs.UploadCurrentLog="Ladda upp aktuell loggfil (&C)" -Basic.MainMenu.Help.Logs.UploadLastLog="&Ladda upp senaste loggfil" -Basic.MainMenu.Help.Logs.ViewCurrentLog="&Visa Aktuell Logg" +Basic.MainMenu.Help.Logs.ShowLogs="&Visa loggfiler" +Basic.MainMenu.Help.Logs.UploadCurrentLog="Ladda upp &aktuell loggfil" +Basic.MainMenu.Help.Logs.UploadLastLog="Ladda upp &senaste loggfil" +Basic.MainMenu.Help.Logs.ViewCurrentLog="Visa aktuell &logg" Basic.MainMenu.Help.CheckForUpdates="Sök efter uppdateringar" -Basic.MainMenu.Help.CrashLogs="Krasch&rapporter" -Basic.MainMenu.Help.CrashLogs.ShowLogs="Vi&sa kraschrapporter" +Basic.MainMenu.Help.CrashLogs="&Kraschrapporter" +Basic.MainMenu.Help.CrashLogs.ShowLogs="&Visa kraschrapporter" Basic.MainMenu.Help.CrashLogs.UploadLastLog="&Ladda upp senaste kraschrapport" -Basic.MainMenu.Help.About="Om (&A)" +Basic.MainMenu.Help.About="&Om" Basic.Settings.ProgramRestart="Du måste starta om programmet för att ändringarna ska träda i kraft." Basic.Settings.ConfirmTitle="Bekräfta ändringar" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Öppna statistikfönstret vid uppstart" Basic.Settings.General.WarnBeforeStartingStream="Visa bekräftelsedialog när ström startas" Basic.Settings.General.WarnBeforeStoppingStream="Visa bekräftelsedialog när ström stoppas" +Basic.Settings.General.WarnBeforeStoppingRecord="Visa bekräftelsedialog när inspelning stoppas" Basic.Settings.General.Projectors="Projektorer" Basic.Settings.General.HideProjectorCursor="Dölj pekaren över projektorer" Basic.Settings.General.ProjectorAlwaysOnTop="Lägg alltid projektorer överst" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Välj inspelningsplats" Basic.Settings.Output.SelectFile="Välj inspelningsfil" Basic.Settings.Output.EnforceBitrate="Tvinga gränser för streamens bit-rate" +Basic.Settings.Output.DynamicBitrate="Ändra bithastigheten dynamiskt för att hantera överbelastning" +Basic.Settings.Output.DynamicBitrate.Beta="Ändra bithastigheten dynamiskt för att hantera överbelastning (beta)" +Basic.Settings.Output.DynamicBitrate.TT="Istället för att kasta bildrutor för att reducera överbelastning kommer bithastigheten ändras dynamiskt.\n\nObservera att detta kan öka fördröjningen för tittare om en avsevärd belastning uppstår.\nNär bithastigheten sjunker kan det ta ett par minuter att återställas.\n\nStöds för närvarande endast för RTMP." Basic.Settings.Output.Mode="Utmatningsläge" Basic.Settings.Output.Mode.Simple="Simpel" Basic.Settings.Output.Mode.Adv="Avancerat" Basic.Settings.Output.Mode.FFmpeg="FFmpeg-utmatning" Basic.Settings.Output.UseReplayBuffer="Aktivera reprisbuffert" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximal repristid (sekunder)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maximal repristid" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maximalt minne (Megabyte)" Basic.Settings.Output.ReplayBuffer.Estimate="Uppskattad minnesanvändning: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Kan inte uppskatta minnesanvändningen. Ange maximal minnesgräns." @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Förlustfri kvalitet, oerhört stor filstorlek" Basic.Settings.Output.Simple.Warn.VideoBitrate="Varning: Streamens videobit-rate kommer att sättas till %1, vilket är den övre gränsen för den nuvarande streaming-tjänsten. Om du är säker på att du vill gå över %1, aktivera \"avancerade kodarinställningar\" och avaktivera \"Tvinga streaming-tjänstens bit-rategränser\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Varning: Streamens ljudbit-rate kommer att sättas till %1, vilket är den övre gränsen för den nuvarande streaming-tjänsten. Om du är säker på att du vill gå över %1, aktivera \"avancerade kodarinställningar\" och avaktivera \"Tvinga streaming-tjänstens bit-rategränser\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Varning: Inspelningar kan inte pausas om inspelningskvaliteten är \"Samma som ström\"." Basic.Settings.Output.Simple.Warn.Encoder="Varning: Inspelning med en mjukvaru-kodare i annan kvalitet än streamen kräver mer CPU-använding om du streamar och spelar in samtidigt." Basic.Settings.Output.Simple.Warn.Lossless="Varning: Förlustfri kvalitet generar oerhört stora filstorlekar! Förlustfri kvalitet kan använda upp till 7 gigabyte hårddiskutrymme per minut vid höga upplösningar och bildfrekvenser. Detta rekommenderas inte för långa inspelningar såvida du har riktigt mycket hårddiskutrymme tillgängligt." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Är du säker på att du vill använda förlustfri kvalitet?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Bithastighet för video" Basic.Settings.Output.AudioBitrate="Bithastighet för ljud" Basic.Settings.Output.Reconnect="Automatisk återanslutning" -Basic.Settings.Output.RetryDelay="Återanslutningsfördröjning (sek)" +Basic.Settings.Output.RetryDelay="Fördröjning för nästa försök" Basic.Settings.Output.MaxRetries="Maximalt antal försök" Basic.Settings.Output.Advanced="Aktivera avancerade kodarinställningar" Basic.Settings.Output.EncoderPreset="Förinställning för kodare" @@ -680,21 +698,22 @@ Basic.Settings.Video.BaseResolution="Grundupplösning (kanvas)" Basic.Settings.Video.ScaledResolution="Utdataupplösning (skalad)" Basic.Settings.Video.DownscaleFilter="Nedskalningsfilter" -Basic.Settings.Video.DisableAeroWindows="Avaktivera Aero (endast Windows)" -Basic.Settings.Video.FPS="FPS" +Basic.Settings.Video.DisableAeroWindows="Inaktivera Aero (endast Windows)" +Basic.Settings.Video.FPS="Bildfrekvens" Basic.Settings.Video.FPSCommon="Vanliga bildhastighetsvärden" -Basic.Settings.Video.FPSInteger="Heltals-bildhastighetsvärde" -Basic.Settings.Video.FPSFraction="Decimaltals-bildhastighetsvärde" +Basic.Settings.Video.FPSInteger="Bildfrekvensvärde (heltal)" +Basic.Settings.Video.FPSFraction="Bildfrekvensvärde (decimaltal)" Basic.Settings.Video.Numerator="Täljare" Basic.Settings.Video.Denominator="Nämnare" -Basic.Settings.Video.Renderer="Renderare:" -Basic.Settings.Video.InvalidResolution="Ogiltig upplösning. Måste anges som [bredd]x[höjd] (t.ex 1920x1080)" +Basic.Settings.Video.Renderer="Renderare" +Basic.Settings.Video.InvalidResolution="Ogiltigt upplösningsvärde. Måste vara [bredd]x[höjd] (t.ex. 1920x1080)" Basic.Settings.Video.CurrentlyActive="Videoutmatning är aktiv. Stoppa alla utmatningar för att kunna ändra videoinställningar." Basic.Settings.Video.DisableAero="Inaktivera Aero" Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinjär (snabbast, men suddigt om skalad)" -Basic.Settings.Video.DownscaleFilter.Bicubic="Bikubisk (Vässd skalning, 16 prover)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Vässd skalning, 32 prover)" +Basic.Settings.Video.DownscaleFilter.Bicubic="Bikubisk (skarpare skalning, 16 samplingar)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (skarpare skalning, 36 samplingar)" +Basic.Settings.Video.DownscaleFilter.Area="Area (viktad summa, 4/6/9 samplingar)" Basic.Settings.Audio="Ljud" Basic.Settings.Audio.SampleRate="Samplingsfrekvens" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Samplingsmaxpunkt" Basic.Settings.Audio.PeakMeterType.TruePeak="Sann maxpunkt (högre CPU-användning)" Basic.Settings.Audio.MultiChannelWarning.Enabled="VARNING: Surroundljud är aktiverat." -Basic.Settings.Audio.MultichannelWarning="Om du strömmar, se till att kolla om din strömtjänst stöder både inmatning och uppspelning av surroundljud. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast är några exempel på tjänster som har fullt stöd. Fastän Facebook Live och YouTube Live stöder inmatning för surroundljud mixar Facebook Live ned till stereo och YouTube Live spelar upp i bara två kanaler.\n\nLjudfiltren i OBS är kompatibla med surroundljud, fast stöd för VST-insticksmodulen garanteras inte." +Basic.Settings.Audio.MultichannelWarning="Om du strömmar, se till att kolla om din strömtjänst stöder både inmatning och uppspelning av surroundljud. Facebook 360 Live, Mixer RTMP, Smashcast är några exempel på tjänster som har fullt stöd. Fastän Facebook Live och YouTube Live stöder inmatning för surroundljud mixar Facebook Live ned till stereo och YouTube Live spelar upp i bara två kanaler.\n\nLjudfiltren i OBS är kompatibla med surroundljud, fast stöd för VST-insticksmodulen garanteras inte." Basic.Settings.Audio.MultichannelWarning.Title="Aktivera surroundljud?" Basic.Settings.Audio.MultichannelWarning.Confirm="Är du säker på att du vill aktivera surroundljud?" Basic.Settings.Audio.Devices="Enheter" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Standard" Basic.Settings.Advanced.Audio.DisableAudioDucking="Inaktivera audio ducking i Windows" Basic.Settings.Advanced.StreamDelay="Strömfördröjning" -Basic.Settings.Advanced.StreamDelay.Duration="Varaktighet (sekunder)" +Basic.Settings.Advanced.StreamDelay.Duration="Varaktighet" Basic.Settings.Advanced.StreamDelay.Preserve="Behåll stoppunkten (öka fördröjningen) vid återanslutning" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Uppskattad minnesanvändning: %1 MB" Basic.Settings.Advanced.Network="Nätverk" Basic.Settings.Advanced.Network.BindToIP="Bind till IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Aktivera ny nätverkskod" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Låg latens-läge" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Fokusbeteende för kortkommando" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Inaktivera aldrig kortkommandon" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Inaktivera kortkommandon när fokus ligger i huvudfönstret" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Inaktivera kortkommandon när huvudfönstret inte har fokus" Basic.Settings.Advanced.AutoRemux="Remuxa automatiskt till mp4" Basic.Settings.Advanced.AutoRemux.MP4="(spela in som mkv)" Basic.AdvAudio="Avancerade ljudinställningar" Basic.AdvAudio.Name="Namn" Basic.AdvAudio.Volume="Volym" -Basic.AdvAudio.Mono="Nedmixa till mono" +Basic.AdvAudio.Mono="Mono" Basic.AdvAudio.Balance="Balans" -Basic.AdvAudio.SyncOffset="Sync Offset (ms)" +Basic.AdvAudio.SyncOffset="Synkroniseringsavvikelse" Basic.AdvAudio.Monitoring="Ljuduppspelning" Basic.AdvAudio.Monitoring.None="Monitor av" Basic.AdvAudio.Monitoring.MonitorOnly="Endast monitor (tysta utgång)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="Du måste välja minst ett spår" OutputWarnings.MultiTrackRecording="Varning: En del format (t.ex. FLV) stöder inte flera spår för varje inspelning" OutputWarnings.MP4Recording="Varning: Inspelningar som sparas i MP4/MOV kommer inte kunna återhämtas om filen inte slutförs (t.ex. p.g.a. blåskärmar, strömavbrott, etc.). Om du vill spela in flera ljudspår, överväg att använda MKV och remuxa inspelningen till MP4/MOV när den är färdig (Arkiv → Remuxa inspelningar)" +OutputWarnings.CannotPause="Varning: Inspelningar kan inte pausas om inspelningskodaren är \"(Använd strömkodare)\"" FinalScene.Title="Radera scen" FinalScene.Text="Det måste finnas minst en scen."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ta-IN.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ta-IN.ini
Changed
@@ -23,7 +23,6 @@ Display="காட்சித்திரை" Name="பெயர்" Exit="வெளியேறு" -Mixer="ஒலி கலவை" Browse="உலாவு" Mono="ஒற்றை ஒலி" Stereo="பல ஒலி" @@ -89,6 +88,7 @@ DockCloseWarning.Title="நகரக்கூடிய சாளரத்தை மூடு" DockCloseWarning.Text="நீங்கள் ஒரு நகர்த்தக்கூடிய சாளரத்தை மூடியுள்ளீர்கள். நீங்கள் அதை மீண்டும் காண்பிக்க விரும்பினால், மெனு பட்டியில் காட்சி → டாக்ஸ் மெனுவைப் பயன்படுத்தவும்." + Auth.Authing.Title="அங்கீகரிக்கிறது..." Auth.Authing.Text="%1, உடன் அங்கீகரிக்கிறது, தயவுசெய்து காத்திருக்கவும்..." Auth.AuthFailure.Title="அங்கீகரிப்பு தோல்வி" @@ -135,7 +135,6 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="குறிப்பு: சுற்றளவு (அடிப்படை) தெளிவுதிறனானது நேரலை அல்லது பதிவுக்கான தெளிவுதிறனுக்கு சமமாக இருக்கவேண்டிய அவசியம் இல்லை. உங்கள் உண்மையான நேரலை அல்லது பதிவுக்கான தெளிவுதிறன் சுற்றளவு தெளிவுதிறனிலிருந்து ஆதார பயன்பாடு அல்லது பிட்ரேட் தேவைகளுக்கு குறைக்கப்பட்டு இருக்கலாம்." Basic.AutoConfig.StreamPage="அலை தகவல்" Basic.AutoConfig.StreamPage.SubTitle="உங்கள் அலை தகவலை உள்ளிடவும்" -Basic.AutoConfig.StreamPage.ConnectAccount="இணைய கணக்கு (விருப்ப)" Basic.AutoConfig.StreamPage.DisconnectAccount="கணக்கைத் துண்டிக்கவும்" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="கணக்கைத் துண்டிக்கவா?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="இந்த மாற்றம் உடனடியாக பொருந்தும். உங்கள் கணக்கு துண்டிக்க விரும்புகிறீர்களா?" @@ -235,6 +234,7 @@ ConfirmStop.Text="அலை நிறுத்த நீங்கள் உறுதியாக இருக்கிறீர்களா?" + ConfirmExit.Title="OBS ஐ வெளியேற்றவா?" ConfirmExit.Text="OBS தற்போது செயலில் உள்ளது. அனைத்து அலைகள் / பதிவுகள் மூடப்படும். நிச்சயமாக வெளியேற விரும்புகிறீர்களா?" @@ -557,7 +557,6 @@ Basic.Settings.Output.Simple.Encoder.Hardware.QSV="வன்பொருள் (QSV)" Basic.Settings.Output.Simple.Encoder.Hardware.AMD="வன்பொருள் (AMD)" Basic.Settings.Output.Simple.Encoder.Hardware.NVENC="வன்பொருள் (NVENC)" -Basic.Settings.Output.RetryDelay="தாமதம் (நொடிகளில்) மீண்டும் முயற்சிக்கவும்" Basic.Settings.Output.MaxRetries="அதிகபட்ச முயற்சிகள்" Basic.Settings.Output.Advanced="மேம்பட்ட குறியாக்கி அமைப்புகளை இயக்கு" Basic.Settings.Output.CustomEncoderSettings="விருப்ப குறியாக்கி அமைப்புகள்"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/th-TH.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/th-TH.ini
Changed
@@ -14,6 +14,7 @@ Add="เพิ่ม" Remove="ลบ" Rename="เปลี่ยนชื่อ" +Interact="การโต้ตอบ" Filters="ฟิลเตอร์" Properties="คุณสมบัติ" MoveUp="เลื่อนขึ้น" @@ -25,14 +26,29 @@ Browse="เปิดหา" Mono="โมโน" Stereo="สเตอริโอ" +DroppedFrames="เฟรมลดลง %1 (%2%)" +StudioProgramProjector="แสดงผลแบบเต็มจอ (ตัวอย่าง)" PreviewProjector="แสดงผลแบบเต็มจอ (ตัวอย่าง)" +SceneProjector="แสดงผลแบบเต็มจอ (ฉาก)" +SourceProjector="แสดงผลแบบเต็มจอ (ทรัพยากร)" +StudioProgramWindow="แสดงผลแบบหน้าต่าง (โปรแกรม)" +PreviewWindow="แสดงผลแบบหน้าต่าง (ตัวอย่าง)" +SceneWindow="แสดงผลแบบหน้าต่าง (ฉาก)" +SourceWindow="แสดงผลแบบหน้าต่าง (ทรัพยากร)" +MultiviewProjector="แสดงผลหลายหน้าจอ (เต็มจอ)" +MultiviewWindowed="แสดงผลหลายหน้าจอ (หน้าต่าง)" Clear="ล้าง" Revert="กลับค่าเดิม" Show="แสดง" Hide="ซ่อน" +UnhideAll="ยกเลิกการซ่อนทั้งหมด" Untitled="ไม่มีชื่อ" New="ใหม่" +Duplicate="ทำสำเนา" Enable="เปิดใช้งาน" +DisableOSXVSync="ไม่ใช้ OSX V-Sync" +ResetOSXVSyncOnExit="คืนค่า OSX V-Sync เมื่อออก" +HighResourceUsage="การเข้ารหัสเกินขีดจำกัด! โปรดปรับลดการกำหนดค่าวีดีโอ หรือใช้รูปแบบการเข้ารหัสอื่นที่เร็วขึ้น" Transition="เปลี่ยนภาพ" QuickTransitions="ช่วงการเปลี่ยนภาพอย่างรวดเร็ว" Left="ซ้าย" @@ -44,6 +60,7 @@ Minutes="นาที" Seconds="วินาที" Deprecated="ไม่ใช้งาน" +ReplayBuffer="รีเพลย์บัพเฟอร์" Import="นําเข้า" Export="ส่งออก" Copy="คัดลอก" @@ -53,18 +70,41 @@ Next="ถัดไป" Back="กลับ" Defaults="ค่ามาตรฐาน" +HideMixer="ซ่อนในมิกซ์เซอร์" +TransitionOverride="แทนที่การสลับฉาก" None="ไม่มี" StudioMode.Preview="แสดงตัวอย่าง" StudioMode.Program="โปรแกรม" +ShowInMultiview="แสดงในการแสดงผลหลายหน้าจอ" +VerticalLayout="เค้าโครงแนวตั้ง" Group="กลุ่ม" +DoNotShowAgain="ไม่ต้องแสดงอีก" +Default="(ค่าเริ่มต้น)" +Calculating="กำลังคำนวณ..." AlreadyRunning.Title="OBS กำลังทำงานอยู่" +AlreadyRunning.LaunchAnyway="ยังไงก็จะเปิด" +DockCloseWarning.Title="ปิดหน้าต่างเครื่องมือ" +DockCloseWarning.Text="คุณกำลังจะปิดหน้าต่างเครื่องมือ ถ้าคุณต้องการให้มันแสดงอีกครั้ง ให้ไปที่แถบเมนูแล้วเลือกเมนู มุมมอง → หน้าต่างเครื่องมือ" +Auth.Authing.Title="การตรวจสอบสิทธิ์" +Auth.Authing.Text="กำลังตรวจสอบสิทธิ์ไปยัง %1, โปรดรอสักครู่..." +Auth.AuthFailure.Title="การตรวจสอบล้มเหลว" +Auth.InvalidScope.Title="จำเป็นต้องมีการตรวจสอบสิทธิ์" +Auth.LoadingChannel.Title="กำลังโหลดรายละเอียดของช่อง..." +Auth.LoadingChannel.Text="กำลังโหลดรายละเอียดของช่องสำหรับ %1, โปรดรอสักครู่..." +Auth.ChannelFailure.Title="ไม่สามารถโหลดช่อง" +Auth.ChannelFailure.Text="ไม่สามารถโหลดรายละเอียดของช่องสำหรับ %1\n\n%2: %3" +Auth.Chat="ห้องสนทนา" +Auth.StreamInfo="รายละเอียดการสตรีม" + Copy.Filters="คัดลอก Filters" Paste.Filters="วาง Filters" +BrowserPanelInit.Title="กำลังเริ่มต้นเบราว์เซอร์..." +BrowserPanelInit.Text="กำลังเริ่มต้นเบราว์เซอร์, โปรดรอสักครู่..." BandwidthTest.Region="ภูมิภาค" BandwidthTest.Region.US="สหรัฐอเมริกา" @@ -73,6 +113,7 @@ BandwidthTest.Region.Other="อื่นๆ" Basic.FirstStartup.RunWizard="คุณต้องการเรียกใช้ตัวช่วยสร้างการกำหนดค่าอัตโนมัติ นอกจากนี้คุณด้วยตนเองสามารถกำหนดค่าการตั้งค่า โดยคลิกปุ่มการตั้งค่าในหน้าต่างหลัก" +Basic.FirstStartup.RunWizard.NoClicked="ถ้าคุณเปลี่ยนใจ คุณสามารถเรียกใช้ตัวช่วยการกำหนดค่าอัตโนมัติได้ตลอดเวลาจากแถบเมนู เครื่องมือ" Basic.AutoConfig="การปรับแต่งอัตโนมัติ" Basic.AutoConfig.ApplySettings="ใช้การตั้งค่า" @@ -80,12 +121,28 @@ Basic.AutoConfig.StartPage.SubTitle="ระบุสิ่งที่คุณต้องการใช้โปรแกรมสำหรับ" Basic.AutoConfig.StartPage.PrioritizeStreaming="เพิ่มประสิทธิภาพสำหรับการสตรีม บันทึกเป็นรอง" Basic.AutoConfig.StartPage.PrioritizeRecording="เพิ่มประสิทธิภาพสำหรับการบันทึก ฉันจะไม่สามารถส่งข้อมูล Steam" +Basic.AutoConfig.VideoPage="กำหนดค่าวีดีโอ" +Basic.AutoConfig.VideoPage.SubTitle="กำหนดการตั้งค่าวีดีโอที่คุณต้องการใช้งาน" +Basic.AutoConfig.VideoPage.BaseResolution.UseCurrent="ใช้ค่าปัจจุบัน (%1x%2)" +Basic.AutoConfig.VideoPage.BaseResolution.Display="จอภาพ %1 (%2x%3)" +Basic.AutoConfig.VideoPage.FPS.UseCurrent="ใช้ค่าปัจจุบัน (%1)" +Basic.AutoConfig.VideoPage.FPS.PreferHighFPS="เลือก 60 หรือ 30, ถ้าเป็นไปได้เลือก 60" +Basic.AutoConfig.VideoPage.FPS.PreferHighRes="เลือก 60 หรือ 30, ต้องการความละเอียดสูง" +Basic.AutoConfig.VideoPage.CanvasExplanation="หมายเหตุ: ความละเอียดของพื้นที่หลัก ไม่จำเป็นต้องเหมือนกับความละเอียดที่คุณจะสตรีม หรือบันทึก การสตรีมหรือการบันทึกจริง อาจจะลดขนาดลงจากความละเอียดของพื้นที่หลัก เพื่อลดการใช้ทรัพยากร หรือความต้องการของบิตเรต" +Basic.AutoConfig.StreamPage="รายละเอียดการสตรีม" Basic.AutoConfig.StreamPage.SubTitle="กรุณากรอกข้อมูลสตรีม" +Basic.AutoConfig.StreamPage.DisconnectAccount="ตัดการเชื่อมต่อบัญชี" +Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="ตัดการเชื่อมต่อบัญชี?" +Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="การเปลี่ยนแปลงนี้จะมีผลทันที คุณแน่ใจหรือไม่ว่าต้องการตัดการเชื่อมต่อบัญชีของคุณ?" +Basic.AutoConfig.StreamPage.UseStreamKey="ใช้รหัสสตรีม" Basic.AutoConfig.StreamPage.Service="บริการ" Basic.AutoConfig.StreamPage.Service.ShowAll="แสดงทั้งหมด..." +Basic.AutoConfig.StreamPage.Service.Custom="กำหนดเอง..." Basic.AutoConfig.StreamPage.Server="เซิร์ฟเวอร์" Basic.AutoConfig.StreamPage.StreamKey="รหัสสตรีม" Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(เชื่อมโยง)" +Basic.AutoConfig.StreamPage.PerformBandwidthTest="ทดสอบการประเมินค่าบิตเรตกับแบนด์วิดท์ (อาจใช้เวลาสักพัก)" +Basic.AutoConfig.StreamPage.PreferHardwareEncoding="กำหนดการเข้ารหัสด้วยฮาร์ดแวร์" Basic.Stats="สถานะ" Basic.Stats.CPUUsage="การใช้ CPU" @@ -102,15 +159,33 @@ Updater.RemindMeLater="เตือนฉันในภายหลัง" Updater.Skip="ข้ามรุ่น" +QuickTransitions.EditProperties="ทำสำเนาทรัพยากร" +QuickTransitions.HotkeyName="สลับฉากอย่างรวดเร็ว: %1" +Basic.AddTransition="เพิ่มรูปแบบการสลับฉาก" +Basic.RemoveTransition="ลบรูปแบบการสลับฉาก" +Basic.TransitionProperties="กำหนดค่ารูปแบบการสลับฉาก" +Basic.SceneTransitions="รูปแบบการสลับฉาก" +Basic.TransitionDuration="ระยะเวลา" +Basic.TogglePreviewProgramMode="โหมดสตูดิโอ" +TransitionNameDlg.Text="โปรดกำหนดชื่อสำหรับรูปแบบการสลับฉาก" +TransitionNameDlg.Title="ชื่อรูปแบบการสลับฉาก" TitleBar.Profile="โปรไฟล์" +TitleBar.Scenes="ฉาก" NameExists.Title="มีผู้ใช้นี้ในระบบแล้ว" +NameExists.Text="ชื่อนี้ถูกใช้แล้ว" NoNameEntered.Title="กรุณาใส่ชื่อให้ถูกต้อง" +NoNameEntered.Text="คุณจำเป็นต้องกำหนดชื่อ" + +ConfirmStart.Title="เริ่มทำการสตรีม?" +ConfirmStart.Text="คุณแน่ใจไหมว่าต้องการเริ่มการสตรีม?" +ConfirmStop.Title="หยุดการสครีม?" +ConfirmStop.Text="คุณแน่ใจไหมว่าต้องการที่จะหยุดการสตรีม?"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/tl-PH.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/tl-PH.ini
Changed
@@ -23,7 +23,6 @@ Display="Ipakita" Name="Pangalan" Exit="Lumabas" -Mixer="Mixer" Browse="Browse" Mono="Mono" Stereo="Stereo" @@ -85,6 +84,7 @@ + Copy.Filters="Kopyahin ang mga Panala" Paste.Filters="I-paste ang mga Panala" @@ -206,6 +206,7 @@ ConfirmStop.Text="Sigurado ka bang gusto mong itigil ang pag-stream?" + ConfirmExit.Title="Lumabas sa OBS?" ConfirmExit.Text="Ang OBS ang kasalukuyang aktibo. Ang lahat ng pag-stream/pagrerekord ay magsasara. Sigurado ka bang gusto mong lumabas?" @@ -518,7 +519,6 @@ Basic.Settings.Output.Mode.Adv="Mas Mahusay" Basic.Settings.Output.Mode.FFmpeg="FFmpeg Output" Basic.Settings.Output.UseReplayBuffer="Paganahin ang Replay Buffer" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Pinakamataas na Oras ng Replay (Segundo)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Pinakamataas na Memorya (Megabytes)" Basic.Settings.Output.ReplayBuffer.Estimate="Tantiyang gamit sa memorya: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Hindi matantiya ang gamit sa memorya. Mangyari lamang mag-takda ng pinakamataas na limitasyon sa memorya." @@ -545,7 +545,6 @@ Basic.Settings.Output.VideoBitrate="Video Bitrate" Basic.Settings.Output.AudioBitrate="Audio Bitrate" Basic.Settings.Output.Reconnect="Pakusa Makipagkonek muli" -Basic.Settings.Output.RetryDelay="Subukan muling Maantala (Mga segundo)" Basic.Settings.Output.MaxRetries="Pinakamaraming Retries" Basic.Settings.Output.Advanced="Paganahin Pauna ang Enkoder Settings" Basic.Settings.Output.CustomEncoderSettings="Pasadyang enkoder Mga setting" @@ -615,7 +614,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (Pinakamabilis, ngunit hindi malinaw pag nag-scale)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (Matalas na pag-scale, 16 na mga halimbawa)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Pinatalas na pag-scale, 32 na mga halimbawa)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Pinatalas na pag-scale, 36 na mga halimbawa)" Basic.Settings.Audio="Audio" Basic.Settings.Audio.SampleRate="Sample Rate" @@ -624,7 +623,7 @@ Basic.Settings.Audio.MeterDecayRate.Medium="Medium (Type I PPM)" Basic.Settings.Audio.MeterDecayRate.Slow="Mabagal (Type II PPM)" Basic.Settings.Audio.MultiChannelWarning.Enabled="BABALA: Naka-enable ang surround sound audio." -Basic.Settings.Audio.MultichannelWarning="Kung nagsi-stream, tingnan kung ang streaming service ay sinusuportahan ang parehong surround sound ingest pat ang surround sound playback. Ang Twitch, Facebook 360 Live, Mixer RTMP, Smashcast ay mga halimbawa kung saan ang surround sound ay sinusuportahan ng buo. Kahit na ang Facebook Live at YouTube live ay parehong tumatanggap ng surround ingest, ang Facebook Live ay nagda-downmix sa stereo, at ang YouTube Live ay nagpapakita lamang ng dalawang channel. \n\nAng OBS audio na mga filter ay akma sa surround sound, pero ang suporta sa VST plugin ay hindi garantisado." +Basic.Settings.Audio.MultichannelWarning="Kung nagsi-stream, tingnan kung ang streaming service ay sinusuportahan ang parehong surround sound ingest pat ang surround sound playback. Ang Facebook 360 Live, Mixer RTMP, Smashcast ay mga halimbawa kung saan ang surround sound ay sinusuportahan ng buo. Kahit na ang Facebook Live at YouTube live ay parehong tumatanggap ng surround ingest, ang Facebook Live ay nagda-downmix sa stereo, at ang YouTube Live ay nagpapakita lamang ng dalawang channel. \n\nAng OBS audio na mga filter ay akma sa surround sound, pero ang suporta sa VST plugin ay hindi garantisado." Basic.Settings.Audio.MultichannelWarning.Title="Mapapagana ba ang tunog ng palibot ng audio?" Basic.Settings.Audio.MultichannelWarning.Confirm="Sigurado ka ba na gusto mong paganahin ang tunog ng palibot ng audio?" Basic.Settings.Audio.EnablePushToMute="Paganahin Itulak-para-ma-i-mute" @@ -648,7 +647,6 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Default" Basic.Settings.Advanced.Audio.DisableAudioDucking="Huwag paganahin ang audio ducking ng Windows" Basic.Settings.Advanced.StreamDelay="Antala sa Pag-stream" -Basic.Settings.Advanced.StreamDelay.Duration="Bilis (segundo)" Basic.Settings.Advanced.StreamDelay.Preserve="Balikan kung saan huling pinutol (dagadagan ang antala) pagka konekta muli" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Tantiyang Gamit sa Memorya: %1 MB" Basic.Settings.Advanced.Network="Network" @@ -658,8 +656,6 @@ Basic.AdvAudio="Pinahusay na mga Katangian ng Audio" Basic.AdvAudio.Name="Pangalan" -Basic.AdvAudio.Mono="I-downmix para maging Mono" -Basic.AdvAudio.SyncOffset="Sync Offset (ms)" Basic.AdvAudio.Monitoring="Pagsubaybay sa Audio" Basic.AdvAudio.Monitoring.None="Naka-off ang Monitor" Basic.AdvAudio.Monitoring.MonitorOnly="Monitor Lamang (naka-mute na output)"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/tr-TR.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/tr-TR.ini
Changed
@@ -23,7 +23,6 @@ Display="Ekran" Name="İsim" Exit="Çıkış" -Mixer="Karıştırıcı" Browse="Gözat" Mono="Mono" Stereo="Stereo" @@ -91,6 +90,9 @@ DockCloseWarning.Title="Yuvalanabilir Pencere Kapatma" DockCloseWarning.Text="Az önce yuvalanabilir bir pencere kapattınız. Eğer tekrardan göstermek istiyorsanız, Menü çubuğundan Görüntüle → Paneller menüsünü kullanın." +ExtraBrowsers.Info="Onlara isim ve URL vererek yuva ekleyin, ardından yuvaları açmak için Uygulaya ve Kapata tıklayın. Herhangi bir zaman yuva ekleyebilir ya da kaldırabilirsiniz." +ExtraBrowsers.DockName="Yuva Adı" + Auth.Authing.Title="Kimlik doğrulanıyor..." Auth.Authing.Text="%1 ile doğrulanıyor, lütfen bekleyin..." Auth.AuthFailure.Title="Kimlik Doğrulaması Başarısız" @@ -107,6 +109,7 @@ TwitchAuth.Feed="Twitch Etkinlik akışı" TwitchAuth.TwoFactorFail.Title="Yayın anahtarı sorgulanamadı" TwitchAuth.TwoFactorFail.Text="OBS Twitch hesabına bağlanamadı. Lütfen iki-faktörlü doğrulamanın <a href='https://www.twitch.tv/settings/security'>Twitch güvenlik ayarlarında ayarlandığından emin olun </a> Bu yayın yapmanız için gereklidir." +RestreamAuth.Channels="Restream Kanalları" Copy.Filters="Filtreleri Kopyala" Paste.Filters="Filtreleri Yapıştır" @@ -139,7 +142,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Not: Tuval (taban) çözünürlüğü yayın veya kayıt yapacağınız çözünürlük ile aynı olmak zorunda değildir. Gerçek yayın/kayıt çözünürlüğünüz kaynak kullanımı ve bit hızı gereksinimlerini düşürmek için tuval çözünürlüğünüzden aşağıya boyutlandırılabilir." Basic.AutoConfig.StreamPage="Yayın Bilgisi" Basic.AutoConfig.StreamPage.SubTitle="Lütfen yayın bilginizi girin" -Basic.AutoConfig.StreamPage.ConnectAccount="Hesabı Bağla (isteğe bağlı)" +Basic.AutoConfig.StreamPage.ConnectAccount="Hesap Bağla (önerilir)" Basic.AutoConfig.StreamPage.DisconnectAccount="Hesap Bağlantısını Kes" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Hesap Bağlantısı Kesilsin Mi?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Bu değişiklik hemen uygulanacaktır. Hesabınızın bağlantısını kesmek istediğinize emin misiniz?" @@ -189,6 +192,7 @@ Basic.Stats.DroppedFrames="Atlanan Kareler (Ağ)" Basic.Stats.MegabytesSent="Toplam Veri Çıkışı" Basic.Stats.Bitrate="Bit Hızı" +Basic.Stats.DiskFullIn="Disk dolacak (yaklaşık)" ResetUIWarning.Title="Kullanıcı arayüzünü sıfırlamak istediğinize emin misiniz?" ResetUIWarning.Text="Kullanıcı arayüzünü sıfırlamak, ek panelleri gizleyecektir. Panellerin görünmelerini istiyorsanız, bu panelleri görünüm menüsünden etkinleştirebilirsiniz.\n\nKullanıcı arayüzünü sıfırlamak istediğinize emin misiniz?" @@ -239,6 +243,9 @@ ConfirmStop.Title="Yayın Durdurulsun Mu?" ConfirmStop.Text="Yayını gerçekten durdurmak istiyor musunuz?" +ConfirmStopRecord.Title="Kaydı Durdur?" +ConfirmStopRecord.Text="Kaydı durdurmak istediğinizden emin misiniz?" + ConfirmBWTest.Title="Bant genişliği testini başlat?" ConfirmBWTest.Text="OBS'i bant genişliği test modunda yapılandırdınız. Bu mod, kanalınız yayına girmeden ağ testi yapmanıza olanak sağlar. Test tamamlandıktan sonra, izleyicilerin yayını görebilmesi için bu modu devre dışı bırakmanız gerekecektir.\n\nDevam etmek istiyor musunuz?" @@ -254,6 +261,8 @@ Output.StartReplayFailed="Tekrar oynatma arabelleği başlatılamadı" Output.StartFailedGeneric="Çıkışı başlatma başarısız oldu. Detaylar için lütfen günlüğe bakın: \n\nNVENC veya AMD kodlayıcılarını kullanıyorsanız, video sürücülerinin güncel olduğundan emin olun." +Output.ReplayBuffer.PauseWarning.Title="Durdurulduğunda tekrarlar kaydedilemez" +Output.ReplayBuffer.PauseWarning.Text="Dikkat: Kayıt durdurulmuşken tekrarlar kaydedilemez." Output.ConnectFail.Title="Bağlantı kurulamadı" Output.ConnectFail.BadPath="Bağlantı adresiniz geçersiz. Ayarlarınızı kontrol edin ve geçerli bir adres giriniz." @@ -443,6 +452,8 @@ Basic.Main.StartReplayBuffer="Tekrar Oynatma Arabelleğini Başlat" Basic.Main.StartStreaming="Yayını Başlat" Basic.Main.StopRecording="Kaydı Durdur" +Basic.Main.PauseRecording="Kaydı Duraklat" +Basic.Main.UnpauseRecording="Kaydı Devam Ettir" Basic.Main.StoppingRecording="Kayıt Durduruluyor..." Basic.Main.StopReplayBuffer="Tekrar Oynatma Arabelleğini Durdur" Basic.Main.StoppingReplayBuffer="Tekrar Oynatma Arabelleği Durduruluyor..." @@ -501,6 +512,7 @@ Basic.MainMenu.View.Docks="Paneller" Basic.MainMenu.View.Docks.ResetUI="Arayüzü Sıfırla" Basic.MainMenu.View.Docks.LockUI="Arayüzü Kilitle" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Özel Tarayıcı Yuvaları..." Basic.MainMenu.View.Toolbars.Listboxes="&Liste Kutuları" Basic.MainMenu.View.SceneTransitions="Sahne Geçişleri (&C)" Basic.MainMenu.View.StatusBar="Durum Çubuğu (&S)" @@ -542,7 +554,8 @@ Basic.Settings.General.EnableAutoUpdates="Başlangıçta güncellemeleri otomatik olarak denetle" Basic.Settings.General.OpenStatsOnStartup="Başlangıçta istatistikler iletişim kutusunu aç" Basic.Settings.General.WarnBeforeStartingStream="Yayın başlatırken onay iletişim kutusunu göster" -Basic.Settings.General.WarnBeforeStoppingStream="Yayın durduğunda onay iletişim kutusunu göster" +Basic.Settings.General.WarnBeforeStoppingStream="Yayın durdulacağı zaman onay kutusunu göster" +Basic.Settings.General.WarnBeforeStoppingRecord="Kaydı durdururken onay kutusunu göster" Basic.Settings.General.Projectors="Projektörler" Basic.Settings.General.HideProjectorCursor="Projektörler üzerinde imleci gizle" Basic.Settings.General.ProjectorAlwaysOnTop="Projektörleri her zaman üstte tut" @@ -590,12 +603,15 @@ Basic.Settings.Output.SelectDirectory="Kayıt Dizinini Seçin" Basic.Settings.Output.SelectFile="Kayıt Dosyasını Seçin" Basic.Settings.Output.EnforceBitrate="Yayın hizmetini bit hızı sınırlarına zorla" +Basic.Settings.Output.DynamicBitrate="Akışı yönetmek için bit hızını değişkenli bir biçimde değiştir" +Basic.Settings.Output.DynamicBitrate.Beta="Akışı yönetmek için bit hızını değişkenli bir biçimde değiştir (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="Akışı azaltmak için kare hızını düşürmek yerine, bit hızını değişkenli bir biçimde değiştirir.\n\nBunun, eğer ani bir akış olursa izleyiciler için gecikme yaratabileceğini unutmayın.\nEğer bit hızı düşerse, yenilenmesi bir kaç dakika alabilir.\n\nŞu anlık sadece RTMP için destekli." Basic.Settings.Output.Mode="Çıkış modu" Basic.Settings.Output.Mode.Simple="Basit" Basic.Settings.Output.Mode.Adv="Gelişmiş" Basic.Settings.Output.Mode.FFmpeg="FFmpeg Çıkışı" Basic.Settings.Output.UseReplayBuffer="Tekrar Oynatma Arabelleğini Etkinleştir" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Maksimum Yeniden Oynatma Süresi (Seconds)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Maksimum Tekrar Süresi" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Maksimum Bellek (Megabayt)" Basic.Settings.Output.ReplayBuffer.Estimate="Tahmini bellek kullanımı: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Bellek kullanımını tahmin edemezsin. Lütfen maksimum bellek sınırını ayarlayın." @@ -610,6 +626,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Kayıpsız Kalite, Çok Büyük Dosya Boyutu" Basic.Settings.Output.Simple.Warn.VideoBitrate="Uyarı: Yayın video bit hızı %1 olarak ayarlanacak, bu şu anki yayın hizmeti için üst sınırdır. Eğer %1 değerinin üstüne çıkmak istediğinizden eminseniz, gelişmiş kodlayıcı seçeneklerini etkinleştirin ve \"Yayın hizmetini bit hızı sınırlarına zorla\" işaretini kaldırın." Basic.Settings.Output.Simple.Warn.AudioBitrate="Uyarı: Yayın audio bit hızı %1 olarak ayarlanacak, bu şu anki yayın hizmeti için üst sınırdır. Eğer %1 değerinin üstüne çıkmak istediğinizden eminseniz, gelişmiş kodlayıcı seçeneklerini etkinleştirin ve \"Yayın hizmetini bit hızı sınırlarına zorla\" işaretini kaldırın." +Basic.Settings.Output.Simple.Warn.CannotPause="Dikkat: Kayıt kalitesi \"Yayın ile aynı\"ya ayarlanmışken kayıtlar durdurulamaz." Basic.Settings.Output.Simple.Warn.Encoder="Uyarı: Bir yazılım kodlayıcı ile yayın kalitesinden farklı kayıt yapmak eğer aynı anda hem kayıt hem de yayın yapıyorsanız ilave CPU kullanımı gerektirecektir." Basic.Settings.Output.Simple.Warn.Lossless="Uyarı: Kayıpsız kalite muazzam büyük dosya boyutları oluşturur! Kayıpsız kalite, yüksek çözünürlüklerde ve kare hızlarında, dakikada 7 gigabyte'a kadar disk alanı kullanabilir. Kayıpsız, kullanılabilir disk alanınız çok büyük değilse, uzun kayıtlar için tavsiye edilmez." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Kayıpsız kalitede kullanmak istediğinizden emin misiniz?" @@ -622,7 +639,7 @@ Basic.Settings.Output.VideoBitrate="Video Bit Hızı" Basic.Settings.Output.AudioBitrate="Ses Bit Hızı" Basic.Settings.Output.Reconnect="Otomatik Yeniden Bağlan" -Basic.Settings.Output.RetryDelay="Yeniden Deneme Gecikmesi (saniye)" +Basic.Settings.Output.RetryDelay="Tekrar Gecikmesi" Basic.Settings.Output.MaxRetries="Maksimum Deneme Sayısı" Basic.Settings.Output.Advanced="Gelişmiş Kodlayıcı Ayarlarını Etkinleştir" Basic.Settings.Output.EncoderPreset="Kodlayıcı Hazır Ayarı" @@ -693,11 +710,12 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (En hızlı, ancak boyutlandırmada bulanık görüntü)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (Keskinleştirilmiş boyutlandırma, 16 örnek)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Keskinleştirilmiş boyutlandırma, 32 örnek)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Keskinleştirilmiş boyutlandırma, 36 örnek)" Basic.Settings.Audio="Ses" Basic.Settings.Audio.SampleRate="Örnekleme Sıklığı" Basic.Settings.Audio.Channels="Kanallar" +Basic.Settings.Audio.Meters="Metre" Basic.Settings.Audio.MeterDecayRate.Fast="Hızlı" Basic.Settings.Audio.MeterDecayRate.Medium="Orta (Tür I PPM)" Basic.Settings.Audio.MeterDecayRate.Slow="Yavaş (Tür II PPM)" @@ -705,7 +723,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="Örnek Tepe" Basic.Settings.Audio.PeakMeterType.TruePeak="Gerçek Tepe (Daha yüksek CPU kullanımı)" Basic.Settings.Audio.MultiChannelWarning.Enabled="Uyarı: Surround ses etkin." -Basic.Settings.Audio.MultichannelWarning="Yayın yapılıyorsa, yayın hizmetinizin hem surround ses alınımını hem de surround ses geri oynatımını desteklediğinden emin olun. Twitch, Facebook 360 Live, Karıştırıcı RTMP, Smashcast, surround sesin tam desteklendiği örneklerdir. Facebook Live'ın ve YouTube Live'ın her ikisi de surround alınımını desteklese de, Facebook Live stereo'ya indirger, ve YouTube Live sadece iki kanal oynatır.\n\nOBS ses filtreleri surround sesle uyumludur, ancak VST eklenti desteği kesin değildir." +Basic.Settings.Audio.MultichannelWarning="Yayın yapılıyorsa, yayın hizmetinizin hem surround ses alınımını hem de surround ses geri oynatımını desteklediğinden emin olun. Facebook 360 Live, Karıştırıcı RTMP, Smashcast, surround sesin tam desteklendiği örneklerdir. Facebook Live'ın ve YouTube Live'ın her ikisi de surround alınımını desteklese de, Facebook Live stereo'ya indirger, ve YouTube Live sadece iki kanal oynatır.\n\nOBS ses filtreleri surround sesle uyumludur, ancak VST eklenti desteği kesin değildir." Basic.Settings.Audio.MultichannelWarning.Title="Surround ses etkinleştirilsin mi?" Basic.Settings.Audio.MultichannelWarning.Confirm="Surround sesi etkinleştirmek istediğinize emin misiniz?" Basic.Settings.Audio.Devices="Cihazlar" @@ -740,23 +758,23 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Varsayılan" Basic.Settings.Advanced.Audio.DisableAudioDucking="Windows ses alçaltmasını devre dışı bırak" Basic.Settings.Advanced.StreamDelay="Yayın Gecikmesi" -Basic.Settings.Advanced.StreamDelay.Duration="Süre (saniye)" +Basic.Settings.Advanced.StreamDelay.Duration="Süre" Basic.Settings.Advanced.StreamDelay.Preserve="Tatbik ederken kesim noktasını (gecikme artışı) koru" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Tahmini Bellek Kullanımı: %1 MB" Basic.Settings.Advanced.Network="Ağ" Basic.Settings.Advanced.Network.BindToIP="IP Bağla" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Yeni ağ kodunu etkinleştir" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Düşük gecike modu" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Kısayol tuşlarını asla devre dışı bırakma" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Ana pencere odaktayken kısayol tuşlarını devre dışı bırak" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Pencere odakta değilken kısayol tuşlarını devre dışı bırak" Basic.Settings.Advanced.AutoRemux="Otomatik olarak mp4'e remux et" Basic.Settings.Advanced.AutoRemux.MP4="(mkv olarak kaydet)" Basic.AdvAudio="Gelişmiş Ses Özellikleri" Basic.AdvAudio.Name="İsim" Basic.AdvAudio.Volume="Ses" -Basic.AdvAudio.Mono="Mono Karıştırmayı Azalt" Basic.AdvAudio.Balance="Denge" -Basic.AdvAudio.SyncOffset="Eşitleme Uzaklığı (ms)" Basic.AdvAudio.Monitoring="Ses İzleme" Basic.AdvAudio.Monitoring.None="Ekran Kapalı" Basic.AdvAudio.Monitoring.MonitorOnly="Sadece Ekran (sessiz çıkış)" @@ -822,6 +840,7 @@ OutputWarnings.NoTracksSelected="En az bir ses parçası seçmelisiniz" OutputWarnings.MultiTrackRecording="Uyarı: Bazı biçimler (FLV gibi) kayıt başına birden fazla parçayı desteklemez" OutputWarnings.MP4Recording="Uyarı: MP4/MOV için kaydedilen kayıtları dosya (örneğin BSODs sonucu olarak, güç kayıp, vb.) kesinleşmiş değil varsa geri almanız mümkün olmayacaktır. Kaydetmek istediğiniz birden çok ses parçaları bu bittikten sonra MKV ve MP4/MOV için kayıt remux kullanmayı göz önünde bulundurun (dosya → Remux kayıtları)" +OutputWarnings.CannotPause="Dikkat: Kayıt kodlayıcısı \"(Yayın kodlayıcısını kullan)\"a ayarlanmışken kayıtlar durdurulamaz" FinalScene.Title="Sahneyi Sil" FinalScene.Text="En az bir sahne olması gerekiyor."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/uk-UA.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/uk-UA.ini
Changed
@@ -23,7 +23,7 @@ Display="Екран" Name="Ім'я" Exit="Вихід" -Mixer="Мікшер" +Mixer="Мікшер Аудіо" Browse="Огляд" Mono="Моно" Stereo="Стерео" @@ -91,6 +91,10 @@ DockCloseWarning.Title="Закриття панелі інтерфейсу" DockCloseWarning.Text="Ви щойно закрили одну з панелей інтерфейсу. Якщо ви бажаєте вивести її знов - використайте опції з головного меню Вид → Панелі інтерфейсу." +ExtraBrowsers="Панелі браузера" +ExtraBrowsers.Info="Додавайте панелі через надання їм назви та URL-адреси. Натисніть Застосувати або Закрити щоб відкрити щойно додані панелі. Список можна редагувати." +ExtraBrowsers.DockName="Назва панелі" + Auth.Authing.Title="Перевірка автентичності..." Auth.Authing.Text="Перевірка автентичності з %1, будь ласка зачекайте..." Auth.AuthFailure.Title="Помилка автентифікації" @@ -106,6 +110,8 @@ TwitchAuth.Stats="Статистика Twitch" TwitchAuth.Feed="Стрічка активності Twitch" TwitchAuth.TwoFactorFail.Title="Не вдалося запросити ключ трансляції" +TwitchAuth.TwoFactorFail.Text="OBS не може підключитись до вашого облікового запису Twitch. Будь ласка, переконайтеся, що дворівневу автентифікацію було встановлено у вашому <a href='https://www.twitch.tv/settings/security'>Twitch security settings</a> бо це вимога для здійснення трансляцій." +RestreamAuth.Channels="Канали Restream" Copy.Filters="Копіювати фільтри" Paste.Filters="Вставити фільтри" @@ -138,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="Примітка: Роздільна здатність (Полотно), не обов'язково повинно дорівнювати роздільної здатності з якою ви плануєте транслювати або записувати. Роздільну здатність фактичної трансляції/запису може бути зменшено від роздільною здатності полотна задля зменшення використання ресурсів або зменшення вимог до бітрейту." Basic.AutoConfig.StreamPage="Інформація про Трансляцію" Basic.AutoConfig.StreamPage.SubTitle="Будь ласка, введіть інформацію щодо вашої Трансляції" -Basic.AutoConfig.StreamPage.ConnectAccount="Підключити обліковий запис (за бажанням)" +Basic.AutoConfig.StreamPage.ConnectAccount="Підключити обліковий запис (рекомендується)" Basic.AutoConfig.StreamPage.DisconnectAccount="Відключити обліковий запис" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Відключити обліковий запис?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Ці зміни буде застосовано негайно. Ви дійсно бажаєте відключити обліковий запис?" @@ -188,6 +194,7 @@ Basic.Stats.DroppedFrames="Пропущено кадрів (мережа)" Basic.Stats.MegabytesSent="Загалом до Виводу" Basic.Stats.Bitrate="Бітрейт" +Basic.Stats.DiskFullIn="Повний диск через (прибл.)" ResetUIWarning.Title="Ви дійсно бажаєте скинути інтерфейс?" ResetUIWarning.Text="Скидання інтерфейсу користувача приховує всі додаткові вікна. Вам потрібно буде знов увімкнути ці додаткові вікна з меню Вид, якщо ви хочете, щоб вони були видимі.\n\nВи дійсно бажаєте скинути інтерфейс?" @@ -238,6 +245,9 @@ ConfirmStop.Title="Закінчити трансляцію?" ConfirmStop.Text="Ви впевнені, що хочете закінчити трансляцію?" +ConfirmStopRecord.Title="Зупинити запис?" +ConfirmStopRecord.Text="Ви впевнені, що хочете зупинити запис?" + ConfirmBWTest.Title="Почати тест пропускної здатності?" ConfirmBWTest.Text="OBS було настроєно у режимі тестування пропускної здатності. Цей режим дозволяє здійснювати тестування мережі без виводу вашого каналу наживо. Як тільки ви закінчите тестування, вам потрібно буде вимкнути його для того, щоб глядачі змогли побачити вашу трансляцію.\n\nВи бажаєте продовжити?" @@ -253,6 +263,8 @@ Output.StartReplayFailed="Не вдалося запустити Буфер Повторів" Output.StartFailedGeneric="Помилка. Вивід не було розпочато. За додатковою інформацією, будь ласка зверніться до файлу журналу.\n\nПримітка: якщо ви використовуєте NVENC або AMD енкодер, перевірте чи оновлений драйвер відео." +Output.ReplayBuffer.PauseWarning.Title="Не можливо зберегти файл Повторів коли запис Призупинено" +Output.ReplayBuffer.PauseWarning.Text="Попередження: Повтори не можуть бути збережені якщо запис Призупинено." Output.ConnectFail.Title="Не вдалося підключитися" Output.ConnectFail.BadPath="Шлях або URL-адреса недосяжні. Будь ласка, перевірте налаштування програмного забезпечення." @@ -261,6 +273,8 @@ Output.ConnectFail.Error="Під час зв'язку з сервером відбулася несподівана помилка. Подробиці знаходяться у лог-файлі." Output.ConnectFail.Disconnected="Від'єднаний від серверу." +Output.StreamEncodeError.Title="Помилка кодування" +Output.StreamEncodeError.Msg="Під час трансляції відбулася помилка у енкодері." Output.RecordFail.Title="Не вдалося розпочати запис" Output.RecordFail.Unsupported="Формат виводу на жаль не підтримується або форматом не підтримується більш однієї звукової доріжки. Будь ласка, перевірте налаштування та повторіть спробу." @@ -268,6 +282,7 @@ Output.RecordNoSpace.Msg="На диску недостатньо простору для запису." Output.RecordError.Title="Помилка запису" Output.RecordError.Msg="Під час запису відбулася несподівана помилка." +Output.RecordError.EncodeErrorMsg="Під час запису відбулася помилка у енкодері." Output.ReplayBuffer.NoHotkey.Title="Гарячу клавішу не вказано!" Output.ReplayBuffer.NoHotkey.Msg="Гарячу клавішу для Буферу Повторів не вказано. Будь ласка, встановіть гарячу клавішу на дію \"Зберегти Повтор\", щоб використовувати її для збереження повторів." @@ -439,6 +454,8 @@ Basic.Main.StartReplayBuffer="Запустити Буфер Повторів" Basic.Main.StartStreaming="Почати трансляцію" Basic.Main.StopRecording="Зупинити запис" +Basic.Main.PauseRecording="Призупинити Запис" +Basic.Main.UnpauseRecording="Продовжити Запис" Basic.Main.StoppingRecording="Запис зупиняється..." Basic.Main.StopReplayBuffer="Зупинити Буфер Повторів" Basic.Main.StoppingReplayBuffer="Буфер Повторів зупиняється..." @@ -465,7 +482,7 @@ Basic.MainMenu.Edit.Redo="Відновити (&R)" Basic.MainMenu.Edit.UndoAction="Відмінити $1 (&U)" Basic.MainMenu.Edit.RedoAction="Відновити $1 (&R)" -Basic.MainMenu.Edit.LockPreview="Заблокувати вікно Перегляду (&L)" +Basic.MainMenu.Edit.LockPreview="&Заблокувати вікно Перегляду" Basic.MainMenu.Edit.Scale="Масштабувати вікно Перегляду (&S)" Basic.MainMenu.Edit.Scale.Window="В розмір вікна" Basic.MainMenu.Edit.Scale.Canvas="Як Полотно (%1x%2)" @@ -497,6 +514,7 @@ Basic.MainMenu.View.Docks="Панелі інтерфейсу" Basic.MainMenu.View.Docks.ResetUI="Скинути інтерфейс" Basic.MainMenu.View.Docks.LockUI="Зафіксувати інтерфейс" +Basic.MainMenu.View.Docks.CustomBrowserDocks="Панелі браузера..." Basic.MainMenu.View.Toolbars.Listboxes="У Списках (&L)" Basic.MainMenu.View.SceneTransitions="Відео-переходи між Сценами (&C)" Basic.MainMenu.View.StatusBar="Панель стану (&S)" @@ -539,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="Відкривати вікно статистики під час запуску" Basic.Settings.General.WarnBeforeStartingStream="Показувати підтвердження для початку трансляції" Basic.Settings.General.WarnBeforeStoppingStream="Показувати підтвердження для закінчення трансляції" +Basic.Settings.General.WarnBeforeStoppingRecord="Показувати підтвердження для зупинення запису" Basic.Settings.General.Projectors="Проектор" Basic.Settings.General.HideProjectorCursor="Приховати курсор у режимі Проектор" Basic.Settings.General.ProjectorAlwaysOnTop="Режим Проектор показувати поверх всіх вікон" @@ -586,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="Вибір каталогу для Запису" Basic.Settings.Output.SelectFile="Вибір файлу для Запису" Basic.Settings.Output.EnforceBitrate="Застосувати примусовий бітрейт з сервісу трансляцій" +Basic.Settings.Output.DynamicBitrate="Змінювати бітрейт підлаштовуючись до низької якості мережі" +Basic.Settings.Output.DynamicBitrate.Beta="Змінювати бітрейт підлаштовуючись до низької якості мережі (Бета)" +Basic.Settings.Output.DynamicBitrate.TT="Замість пропуску кадрів змінює бітрейт, підлаштовуючись до низької якості мережі.\n\nПримітка: з цією опцією, надзвичайно високе несподіване зростання помилок у мережі,\nможе викликати зростання затримки для глядачів. Відновлення бітрейту після\nпадіння може зайняти до кількох хвилин.\n\nЗараз підтримується лише для RTMP з'єднань." Basic.Settings.Output.Mode="Режим виводу" Basic.Settings.Output.Mode.Simple="Простий" Basic.Settings.Output.Mode.Adv="Розширений" Basic.Settings.Output.Mode.FFmpeg="Вивід FFmpeg" Basic.Settings.Output.UseReplayBuffer="Увімкнути Буфер Повторів" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Максимальна тривалість Повтору (у секундах)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="Максимальна тривалість Повтору" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Максимальний об'єм пам'яті (у мегабайтах)" Basic.Settings.Output.ReplayBuffer.Estimate="Буде використано пам'яті: %1 МБ" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Не вдалося оцінити об'єм використання пам'яті. Будь ласка, встановіть максимальний об'єм пам'яті для Буферу Повторів вручну." @@ -606,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="Без втрат якості, надзвичайно великий розмір файлу" Basic.Settings.Output.Simple.Warn.VideoBitrate="Увага! Буде встановлено відео бітрейт трансляції %1, що є верхней межою для обраного сервісу трансляцій. Якщо ви хочете встановити бітрейт вищий за %1, то увімкніть Додаткові Налаштування Енкодера та зніміть прапорець \"Застосувати примусовий бітрейт з сервісу трансляцій\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="Увага! Буде встановлено аудіо бітрейт трансляції %1, що є верхней межою для обраного сервісу трансляцій. Якщо ви хочете встановити бітрейт вищий за %1, то увімкніть Додаткові Налаштування Енкодера та зніміть прапорець \"Застосувати примусовий бітрейт з сервісу трансляцій\"." +Basic.Settings.Output.Simple.Warn.CannotPause="Попередження: Запис не може бути Призупинено, якщо якість встановлено у \"Так само як трансляція\"." Basic.Settings.Output.Simple.Warn.Encoder="Попередження: Запис програмним енкодером з якістю не \"Так само як трансляція\", здійснює додаткове навантаження на ЦП при використовуванні трансляції і запису одночасно." Basic.Settings.Output.Simple.Warn.Lossless="Попередження: Відео Без втрат якості генерує надзвичайно великі розміри файлів! Воно може використовувати понад 7 гігабайт дискового простору на хвилину при високих роздільній здатності зображення та частоти кадрів. Відео Без втрат якості не рекомендується для довгого запису, тільки якщо у вас є дуже великий обсяг вільного дискового простору." Basic.Settings.Output.Simple.Warn.Lossless.Msg="Ви впевнені, що ви хочете використовувати якість \"Без втрат якості\"?" @@ -618,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="Відео бітрейт" Basic.Settings.Output.AudioBitrate="Аудіо бітрейт" Basic.Settings.Output.Reconnect="Поновити зв'язок автоматично" -Basic.Settings.Output.RetryDelay="Затримка спроби (секунди)" +Basic.Settings.Output.RetryDelay="Затримка перед повторною спробою" Basic.Settings.Output.MaxRetries="Кількість спроб" Basic.Settings.Output.Advanced="Увімкнути Додаткові Налаштування Енкодера" Basic.Settings.Output.EncoderPreset="Шаблон до енкодера" @@ -689,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Білінійний (найшвидший, але розмито, якщо масштабувати)" Basic.Settings.Video.DownscaleFilter.Bicubic="Бікубічний (чітке масштабування, 16 проб)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Ланцош (чітке масштабування, 32 проби)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Ланцош (чітке масштабування, 36 проб)" +Basic.Settings.Video.DownscaleFilter.Area="Усереднення площ (зважена сума, 4/6/9 проб)" Basic.Settings.Audio="Аудіо" Basic.Settings.Audio.SampleRate="Частота дискретизації" @@ -703,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="З точністю до вибірки" Basic.Settings.Audio.PeakMeterType.TruePeak="Істинно-піковий (більше навантаження на ЦП)" Basic.Settings.Audio.MultiChannelWarning.Enabled="ПОПЕРЕДЖЕННЯ: Увімкнуто об'ємний звук." -Basic.Settings.Audio.MultichannelWarning="Якщо робите трансляції, перевірте чи підтримує ваш сервіс трансляцій об'ємний звук на вході та виході. Twitch, Facebook 360 Live, Mixer RTMP, Smashcast - це приклади сервісів де об'ємний звук цілком підтримується. Навпаки, Facebook Live і YouTube Live обидва підтримують вхідний об'ємний звук, але Facebook Live мікшує його до стерео, а YouTube Live відтворює лише два канали.\n\nАудіо фільтри самої OBS сумісні з об'ємним звуком, хоча підтримку VST плагінами не гарантовано." +Basic.Settings.Audio.MultichannelWarning="Якщо робите трансляції, перевірте чи підтримує ваш сервіс трансляцій об'ємний звук на вході та виході. Facebook 360 Live, Mixer RTMP, Smashcast - це приклади сервісів де об'ємний звук цілком підтримується. Навпаки, Facebook Live і YouTube Live обидва підтримують вхідний об'ємний звук, але Facebook Live мікшує його до стерео, а YouTube Live відтворює лише два канали.\n\nАудіо фільтри самої OBS сумісні з об'ємним звуком, хоча підтримку VST плагінами не гарантовано." Basic.Settings.Audio.MultichannelWarning.Title="Увімкнути об'ємний звук для виводу аудіо?" Basic.Settings.Audio.MultichannelWarning.Confirm="Ви справді бажаєте увімкнути об'ємний звук для виводу аудіо?" Basic.Settings.Audio.Devices="Пристрої" @@ -730,28 +754,34 @@ Basic.Settings.Advanced.FormatWarning="Попередження: Формати кольору, які відрізняються від NV12, в першу чергу призначені для запису, і не рекомендуються для трансляцій. Трансляція може додатково навантажити ЦП через перетворення форматів." Basic.Settings.Advanced.Audio.BufferingTime="Розмір аудіо буфера, (мс)" Basic.Settings.Advanced.Video.ColorFormat="Формат кольору" +Basic.Settings.Advanced.Video.ColorSpace="Колірний простір" +Basic.Settings.Advanced.Video.ColorRange="Колірний діапазон" Basic.Settings.Advanced.Video.ColorRange.Partial="Частковий" Basic.Settings.Advanced.Video.ColorRange.Full="Повний" Basic.Settings.Advanced.Audio.MonitoringDevice="Пристрій Тестування Аудіо (на слух)" Basic.Settings.Advanced.Audio.MonitoringDevice.Default="За замовчанням" Basic.Settings.Advanced.Audio.DisableAudioDucking="Вимкнути у Windows опцію зменшення гучності під час зв'язку" Basic.Settings.Advanced.StreamDelay="Затримка трансляції" -Basic.Settings.Advanced.StreamDelay.Duration="Тривалість (секунди)" +Basic.Settings.Advanced.StreamDelay.Duration="Тривалість" Basic.Settings.Advanced.StreamDelay.Preserve="Зберегати точку роз'єднання (збільшує затримку) під час встановлення нового зв'язку" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Буде використано пам'яті: %1 МБ" Basic.Settings.Advanced.Network="Мережа" Basic.Settings.Advanced.Network.BindToIP="Прив'язати до адаптера (IP)" Basic.Settings.Advanced.Network.EnableNewSocketLoop="Увімкнути новий мережевий код" Basic.Settings.Advanced.Network.EnableLowLatencyMode="Режим з низькою затримкою" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="Гарячі клавіші та фокус" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="Ніколи не відключати гарячі клавіші" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="Відключати гарячі клавіші, коли головне вікно знаходиться у фокусі" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="Відключати гарячі клавіші, коли головне вікно не знаходиться у фокусі" Basic.Settings.Advanced.AutoRemux="Запускати автоматичну Ремультиплексацію до .mp4" Basic.Settings.Advanced.AutoRemux.MP4="(записувати як .mkv)" Basic.AdvAudio="Розширені Налаштування Аудіо" Basic.AdvAudio.Name="Назва" -Basic.AdvAudio.Mono="Мікшувати до псевдо-Моно" +Basic.AdvAudio.Volume="Гучність" +Basic.AdvAudio.Mono="Моно" Basic.AdvAudio.Balance="Баланс" -Basic.AdvAudio.SyncOffset="Зсув синхронізації (мс)" +Basic.AdvAudio.SyncOffset="Зсув синхронізації" Basic.AdvAudio.Monitoring="Тестування Аудіо (на слух)" Basic.AdvAudio.Monitoring.None="Тест вимкнено" Basic.AdvAudio.Monitoring.MonitorOnly="Слухати, але не Виводити" @@ -817,6 +847,7 @@ OutputWarnings.NoTracksSelected="Ви повинні вибрати хоча б одну аудіо-доріжку" OutputWarnings.MultiTrackRecording="Попередження: Певні формати (наприклад, FLV) не підтримують кілька треків на запис" OutputWarnings.MP4Recording="Попередження: Запис в MP4/MOV може стати невиправно пошкодженим, якщо файл не буде завершено (наприклад, в результаті BSOD, втрати живлення і т.п.). Якщо ви хочете, мати запис декількох звукових доріжок спробуйте використати MKV та зробіть ремультиплексацію запису до MP4/MOV після того, як запис буде закінчено (Файл → Ремультиплексація Записів)" +OutputWarnings.CannotPause="Попередження: Запис не може бути Призупинено, якщо якість встановлено у \"(Використовувати енкодер трансляцій)\"" FinalScene.Title="Видалення сцени" FinalScene.Text="Повинна бути принаймні одна сцена." @@ -843,4 +874,5 @@ ResizeOutputSizeOfSource.Text="Параметри: Роздільна здатність (Полотно) та Роздільна здатність (Вивід), буде встановлено у розмір обраного Джерела." ResizeOutputSizeOfSource.Continue="Ви хочете продовжити?" +PreviewTransition="Перегляд Відео-переходу"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/ur-PK.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/ur-PK.ini
Changed
@@ -23,7 +23,6 @@ Display="ڈسپلے" Name="نام" Exit="بند کریں" -Mixer="مکسر" Browse="براؤز کریں" Mono="مونو" Stereo="سٹیریو" @@ -75,6 +74,7 @@ AlreadyRunning.LaunchAnyway="ویسے بھی شروع" + Auth.Authing.Title="توثیق کر رہا ہے..." Auth.AuthFailure.Title="تصدیق کی ناکامی" Auth.Chat="گفتگو" @@ -172,3 +172,4 @@ +
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/vi-VN.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/vi-VN.ini
Changed
@@ -23,7 +23,6 @@ Display="Hiển thị" Name="Tên" Exit="Thoát" -Mixer="Bộ trộn" Browse="Chọn đường dẫn" Mono="Âm thanh đơn" Stereo="Âm thanh nổi" @@ -72,6 +71,7 @@ Next="Tiếp tục" Back="Quay lại" Defaults="Mặc định" +HideMixer="Ẩn trong bộ trộn" TransitionOverride="Ghi đè chuyển tiếp" None="Không có" StudioMode.Preview="Xem trước" @@ -90,15 +90,22 @@ DockCloseWarning.Title="Đóng cửa sổ gắn đế được" DockCloseWarning.Text="Bạn vừa đóng một cửa số gắn đế được. Nếu bạn muốn hiển thị lại lần nữa, sử dụng trình đơn Hiển thị → Thanh đế trên thanh trình đơn." + Auth.Authing.Title="Đang xác thực..." +Auth.Authing.Text="Đang xác thực với %1, chờ lát..." Auth.AuthFailure.Title="Xác thực không thành công" +Auth.AuthFailure.Text="Không xác thực được với %1:\n\n%2: %3" Auth.InvalidScope.Title="Bắt buộc phải xác thực" Auth.LoadingChannel.Title="Đang tải thông tin kênh..." +Auth.LoadingChannel.Text="Đang tải thông tin về kênh cho %1, chờ lát..." Auth.ChannelFailure.Title="Bị lỗi khi nạp kênh" +Auth.ChannelFailure.Text="Không tải được thông tin kênh cho %1\n\n%2: %3" Auth.Chat="Tán gẫu" Auth.StreamInfo="Thông tin luồng phát" TwitchAuth.Stats="Thống kê Twitch" +TwitchAuth.Feed="Bảng tin hoạt động Twitch" TwitchAuth.TwoFactorFail.Title="Không thể truy vấn khóa luồng" +RestreamAuth.Channels="Truyền phát lại kênh" Copy.Filters="Sao chép các bộ lọc" Paste.Filters="Dán các bộ lọc" @@ -128,9 +135,10 @@ Basic.AutoConfig.VideoPage.FPS.UseCurrent="Sử dụng hiện tại (%1)" Basic.AutoConfig.VideoPage.FPS.PreferHighFPS="60 hoặc 30, nhưng ưu tiên chọn 60 khi có thể" Basic.AutoConfig.VideoPage.FPS.PreferHighRes="60 hoặc 30, nhưng ưu tiên độ phân giải cao" +Basic.AutoConfig.VideoPage.CanvasExplanation="Lưu ý: Độ phân giải tấm vẽ (cơ sở) không nhất thiết phải bằng với độ phân giải bạn sẽ truyền phát hay ghi hình. Độ phân giải truyền phát/ghi hình thực tế có thể bị giảm tỉ lệ từ độ phân giải của tấm vẽ để giảm sử dụng tài nguyên hoặc yêu cầu về tốc độ bit." Basic.AutoConfig.StreamPage="Thông tin stream" Basic.AutoConfig.StreamPage.SubTitle="Vui lòng nhập thông tin máy chủ stream của bạn" -Basic.AutoConfig.StreamPage.ConnectAccount="Kết nối tài khoản (tùy chọn)" +Basic.AutoConfig.StreamPage.ConnectAccount="Kết nối tài khoản (đề xuất)" Basic.AutoConfig.StreamPage.DisconnectAccount="Ngắt kết nối tài khoản" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="Ngắt kết nối tài khoản?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="Thay đổi này sẽ được áp dụng ngay lập tức. Bạn có chắc là bạn muốn ngắt kết nối tài khoản của bạn?" @@ -226,6 +234,9 @@ ConfirmStop.Title="Ngừng Stream?" ConfirmStop.Text="Bạn có chắc muốn dừng stream?" +ConfirmStopRecord.Title="Ngừng ghi hình?" +ConfirmStopRecord.Text="Bạn có chắc bạn muốn dừng ghi hình?" + ConfirmBWTest.Title="Bắt đầu kiểm tra băng thông?" ConfirmExit.Title="Thoát OBS?" @@ -240,6 +251,8 @@ Output.StartReplayFailed="Không thể khởi động replay buffer" Output.StartFailedGeneric="Bắt đầu đầu ra đã thất bại. Vui lòng kiểm tra các bản ghi để biết thêm chi tiết.\n\nGhi chú: nếu bạn đang sử dụng bộ mã hóa NVENC hoặc AMD, hãy chắc chắn rằng các trình điều khiển GPU được cập nhật phiên bản mới nhất." +Output.ReplayBuffer.PauseWarning.Title="Không thể lưu bản phát lại trong khi tạm dừng" +Output.ReplayBuffer.PauseWarning.Text="Cảnh báo: Bản phát lại không thể được lưu trong khi tạm dừng ghi hình." Output.ConnectFail.Title="Không thể kết nối" Output.ConnectFail.BadPath="URL không hợp lệ của đường dẫn hoặc kết nối. Xin vui lòng kiểm tra cài đặt của bạn để xác nhận rằng họ là hợp lệ." @@ -279,6 +292,7 @@ Remux.Finished="Ghi remuxed" Remux.FinishedError="Ghi âm remuxed, nhưng các tập tin có thể không đầy đủ" Remux.SelectRecording="Chọn Ghi âm OBS..." +Remux.SelectTarget="Chọn tệp mục tiêu..." Remux.ExitUnfinishedTitle="Remuxing trong tiến trình" Remux.ExitUnfinished="Remuxing không được hoàn tất, dừng bây giờ có thể hiển thị các tập tin mục tiêu không sử dụng được. \nAre bạn có chắc bạn muốn dừng remuxing?" @@ -423,6 +437,7 @@ Basic.Main.StartReplayBuffer="Bắt đầu Replay Buffer" Basic.Main.StartStreaming="Bắt đầu Stream" Basic.Main.StopRecording="Dừng ghi" +Basic.Main.PauseRecording="Tạm dừng ghi hình" Basic.Main.StoppingRecording="Dừng ghi video..." Basic.Main.StopReplayBuffer="Dừng Replay Buffer" Basic.Main.StoppingReplayBuffer="Đang dừng Replay Buffer..." @@ -452,6 +467,7 @@ Basic.MainMenu.Edit.LockPreview="Khóa xem trước (&L)" Basic.MainMenu.Edit.Scale="Xem trước co dãn (&S)" Basic.MainMenu.Edit.Scale.Window="Co dãn cửa sổ" +Basic.MainMenu.Edit.Scale.Canvas="Tấm vẽ (%1x%2)" Basic.MainMenu.Edit.Scale.Output="Đầu ra (%1x%2)" Basic.MainMenu.Edit.Transform="Biến đổi (&T)" Basic.MainMenu.Edit.Transform.EditTransform="Chỉnh sửa biến đổi... (&E)" @@ -507,6 +523,7 @@ Basic.MainMenu.Help.Logs.ViewCurrentLog="Xem sổ ghi hiện tại (&V)" Basic.MainMenu.Help.CheckForUpdates="Kiểm tra cập nhật mới" Basic.MainMenu.Help.CrashLogs="Sự cố & Báo cáo" +Basic.MainMenu.Help.CrashLogs.ShowLogs="Hiện báo cáo hỏng chương trình (&S)" Basic.MainMenu.Help.About="Giới thiệu (&A)" Basic.Settings.ProgramRestart="Chương trình phải được khởi động lại để những thiết đặt có hiệu lực." @@ -536,10 +553,18 @@ Basic.Settings.General.Preview="Xem trước" Basic.Settings.General.StudioPortraitLayout="Bật bố cục theo chiều ngang/dọc" Basic.Settings.General.Multiview="Đa góc nhìn" +Basic.Settings.General.Multiview.DrawSourceNames="Hiện tên cảnh" +Basic.Settings.General.Multiview.DrawSafeAreas="Vẽ khu vực an toàn (EBU R 95)" Basic.Settings.General.MultiviewLayout="Giao diện nhiều lớp" +Basic.Settings.General.MultiviewLayout.Horizontal.Top="Chiều ngang, trên (8 cảnh)" +Basic.Settings.General.MultiviewLayout.Horizontal.Bottom="Chiều ngang, dưới (8 cảnh)" +Basic.Settings.General.MultiviewLayout.Vertical.Left="Chiều dọc, trái (8 cảnh)" +Basic.Settings.General.MultiviewLayout.Vertical.Right="Chiều dọc, phải (8 cảnh)" +Basic.Settings.General.MultiviewLayout.Horizontal.Extended.Top="Chiều ngang, trên (24 cảnh)" Basic.Settings.Stream="Stream" Basic.Settings.Stream.StreamType="Kiểu Stream" +Basic.Settings.Stream.Custom.UseAuthentication="Xác thực sử dụng" Basic.Settings.Stream.Custom.Username="Tên đăng nhập" Basic.Settings.Stream.Custom.Password="Mật khẩu" @@ -553,7 +578,6 @@ Basic.Settings.Output.Mode.Adv="Nâng cao" Basic.Settings.Output.Mode.FFmpeg="FFmpeg đầu ra" Basic.Settings.Output.UseReplayBuffer="Bật Replay Buffer" -Basic.Settings.Output.ReplayBuffer.SecondsMax="Thời gian phát lại tối đa (Giây)" Basic.Settings.Output.ReplayBuffer.MegabytesMax="Bộ nhớ tối đa (Megabyte)" Basic.Settings.Output.ReplayBuffer.Estimate="Ước tính bộ nhớ sử dụng: %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="Không thể ước tính sử dụng bộ nhớ. Xin vui lòng thiết lập giới hạn bộ nhớ tối đa." @@ -577,7 +601,6 @@ Basic.Settings.Output.VideoBitrate="Video Bitrate" Basic.Settings.Output.AudioBitrate="Âm thanh Bitrate" Basic.Settings.Output.Reconnect="Tự động kết nối" -Basic.Settings.Output.RetryDelay="Thử lại chậm trễ (giây)" Basic.Settings.Output.MaxRetries="Tối đa Retries" Basic.Settings.Output.Advanced="Kích hoạt tính năng cài đặt mã hóa nâng cao" Basic.Settings.Output.CustomEncoderSettings="Thiết đặt tùy chỉnh mã hóa" @@ -628,7 +651,7 @@ Basic.Settings.Video="Video" Basic.Settings.Video.Adapter="Video Adapter" -Basic.Settings.Video.BaseResolution="Cơ sở (vải) độ phân giải" +Basic.Settings.Video.BaseResolution="Độ phân giải cơ sở (tấm vẽ)" Basic.Settings.Video.ScaledResolution="Độ phân giải (Kích thước) đầu ra" Basic.Settings.Video.DownscaleFilter="Downscale lọc" Basic.Settings.Video.DisableAeroWindows="Vô hiệu hóa hàng không (Windows only)" @@ -645,7 +668,7 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear (nhanh nhất, nhưng mờ nếu rộng)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic (Sharpened rộng, 16 mẫu)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Sharpened rộng, 32 mẫu)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos (Sharpened rộng, 36 mẫu)" Basic.Settings.Audio="Âm thanh" Basic.Settings.Audio.SampleRate="Tỷ lệ mẫu" @@ -672,7 +695,6 @@ Basic.Settings.Advanced.Video.ColorRange.Full="Đầy đủ" Basic.Settings.Advanced.Audio.MonitoringDevice.Default="Mặc định" Basic.Settings.Advanced.StreamDelay="Stream trễ" -Basic.Settings.Advanced.StreamDelay.Duration="Thời gian (giây)" Basic.Settings.Advanced.StreamDelay.Preserve="Giữ điểm cắt (tăng chậm trễ) khi kết nối lại" Basic.Settings.Advanced.StreamDelay.MemoryUsage="Ước tính bộ nhớ sử dụng: %1 MB" Basic.Settings.Advanced.Network="Mạng" @@ -683,9 +705,7 @@ Basic.AdvAudio="Thuộc tính âm thanh nâng cao" Basic.AdvAudio.Name="Tên" -Basic.AdvAudio.Mono="Downmix để Mono" Basic.AdvAudio.Balance="Cân bằng" -Basic.AdvAudio.SyncOffset="Bù đắp đồng bộ (ms)" Basic.AdvAudio.Monitoring="Giám sát âm thanh" Basic.AdvAudio.Monitoring.None="Tắt giám sát" Basic.AdvAudio.Monitoring.MonitorOnly="Chỉ giám sát (không âm thanh ra)"
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/zh-CN.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/zh-CN.ini
Changed
@@ -25,8 +25,8 @@ Exit="退出" Mixer="混音器" Browse="浏览" -Mono="单声道" -Stereo="立体声" +Mono="单声道" +Stereo="立体声" DroppedFrames="丢帧 %1(%2%)" StudioProgramProjector="全屏投影(输出)" PreviewProjector="全屏投影(预览)" @@ -91,6 +91,10 @@ DockCloseWarning.Title="关闭可停靠窗口" DockCloseWarning.Text="您刚关闭了一个可停靠的窗口。如果想要再次显示它,请使用菜单栏上的 查看→停靠部件 菜单。" +ExtraBrowsers="自定义浏览器 Dock" +ExtraBrowsers.Info="通过指定名称和 URL 来添加 Dock(停靠部件),然后选择“应用”或“关闭”来打开这些Dock。你可以在任何时刻添加或删除这些Dock。" +ExtraBrowsers.DockName="Dock 名" + Auth.Authing.Title="正在验证…" Auth.Authing.Text="正在与 %1 进行身份验证,请稍候…" Auth.AuthFailure.Title="身份验证失败" @@ -107,6 +111,7 @@ TwitchAuth.Feed="Twitch 活动订阅源" TwitchAuth.TwoFactorFail.Title="无法查询流密钥" TwitchAuth.TwoFactorFail.Text="OBS 无法连接到您的 Twitch 账户。请确保在 <a href='https://www.twitch.tv/settings/security'>Twitch 安全性设置</a>中开启了双重身份验证,只有开启后才能开始推流。" +RestreamAuth.Channels="Restream 频道" Copy.Filters="复制滤镜" Paste.Filters="粘贴滤镜" @@ -139,7 +144,7 @@ Basic.AutoConfig.VideoPage.CanvasExplanation="注意:画布(基础)分辨率并不一定要与推流或录像的分辨率相同。实际推流或录像的分辨率可从画布分辨率缩小,以降低对资源的使用或对比特率的需求。" Basic.AutoConfig.StreamPage="串流资讯" Basic.AutoConfig.StreamPage.SubTitle="请输入你的串流信息" -Basic.AutoConfig.StreamPage.ConnectAccount="连接帐户(可选)" +Basic.AutoConfig.StreamPage.ConnectAccount="连接帐户 (推荐)" Basic.AutoConfig.StreamPage.DisconnectAccount="解除帐户连接" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="解除帐户连接?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="此更改将立即应用。您确定要解除帐户连接吗?" @@ -240,6 +245,9 @@ ConfirmStop.Title="停止串流?" ConfirmStop.Text="你确定你想要停止串流?" +ConfirmStopRecord.Title="停止录制?" +ConfirmStopRecord.Text="你确定要停止录制吗?" + ConfirmBWTest.Title="开始带宽测试?" ConfirmBWTest.Text="您已经在带宽测试模式下配置了 OBS。此模式允许在不启用频道的情况下进行网络测试。完成测试后,您需要禁用它,以便观众能够看到您的流。\n\n是否继续?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="启动回放缓存失败" Output.StartFailedGeneric="启动输出失败. 请检查日志来了解细节.\n\n注意: 如果你使用的是 NVENC 或 AMD 编码器, 请确保您的视频驱动程序是最新的." +Output.ReplayBuffer.PauseWarning.Title="暂停时无法保存回放" +Output.ReplayBuffer.PauseWarning.Text="警告:在录制暂停时无法保存回放。" Output.ConnectFail.Title="连接失败" Output.ConnectFail.BadPath="无效的路径或URL。请检查您的设置以确认它们是有效的。" @@ -398,12 +408,12 @@ Basic.StatusBar.DelayStartingStoppingIn="延迟 (在%1 秒后停止,在 %2 秒后开始)" Basic.Filters="滤镜" -Basic.Filters.AsyncFilters="音频/视频滤镜" -Basic.Filters.AudioFilters="音频滤镜" +Basic.Filters.AsyncFilters="音视频滤镜" +Basic.Filters.AudioFilters="滤音器" Basic.Filters.EffectFilters="效果滤镜" Basic.Filters.Title="'%1' 的滤镜" Basic.Filters.AddFilter.Title="滤镜名称" -Basic.Filters.AddFilter.Text="请指定滤镜的名称" +Basic.Filters.AddFilter.Text="请指定滤镜名称" Basic.TransformWindow="场景物体变换" Basic.TransformWindow.Position="位置" @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="开始回放缓存" Basic.Main.StartStreaming="开始推流" Basic.Main.StopRecording="停止录制" +Basic.Main.PauseRecording="暂停录制" +Basic.Main.UnpauseRecording="恢复录制" Basic.Main.StoppingRecording="停止录制..." Basic.Main.StopReplayBuffer="停止回放缓存" Basic.Main.StoppingReplayBuffer="正在停止回放缓存..." @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="停靠部件" Basic.MainMenu.View.Docks.ResetUI="重置界面" Basic.MainMenu.View.Docks.LockUI="锁定界面" +Basic.MainMenu.View.Docks.CustomBrowserDocks="自定义浏览器 Dock..." Basic.MainMenu.View.Toolbars.Listboxes="列表框(&L)" Basic.MainMenu.View.SceneTransitions="转场特效(&C)" Basic.MainMenu.View.StatusBar="状态栏(&S)" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="在启动时打开统计对话框" Basic.Settings.General.WarnBeforeStartingStream="启动流时显示确认对话框" Basic.Settings.General.WarnBeforeStoppingStream="停止流时显示确认对话框" +Basic.Settings.General.WarnBeforeStoppingRecord="停止录制时显示确认对话框" Basic.Settings.General.Projectors="投影窗口" Basic.Settings.General.HideProjectorCursor="投影窗口中隐藏光标" Basic.Settings.General.ProjectorAlwaysOnTop="使投影窗口置顶" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="选择录像目录" Basic.Settings.Output.SelectFile="选择录像文件" Basic.Settings.Output.EnforceBitrate="强制执行流媒体服务比特率限制" +Basic.Settings.Output.DynamicBitrate="动态调整比特率以应对网络拥堵" +Basic.Settings.Output.DynamicBitrate.Beta="动态调整比特率以应对网络拥堵(Beta)" +Basic.Settings.Output.DynamicBitrate.TT="在网络拥堵时快速动态调整比特率,而不是丢弃帧来减缓拥堵。\n\n注意:开启后,若有严重的突发网络拥堵,到观众的延迟可能会增加。\n比特率降低之后,可能需要几分钟时间才能恢复。\n\n当前只支持 RTMP 流。" Basic.Settings.Output.Mode="输出模式" Basic.Settings.Output.Mode.Simple="简单" Basic.Settings.Output.Mode.Adv="高级" Basic.Settings.Output.Mode.FFmpeg="FFmpeg 输出" Basic.Settings.Output.UseReplayBuffer="启用回放缓存" -Basic.Settings.Output.ReplayBuffer.SecondsMax="最大回放时间(秒)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="最长回放时间" Basic.Settings.Output.ReplayBuffer.MegabytesMax="最大内存(MB)" Basic.Settings.Output.ReplayBuffer.Estimate="估计内存使用量:%1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="无法估计内存使用量。请设置最大内存限制。" @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="无损的质量, 非常大的文件大小" Basic.Settings.Output.Simple.Warn.VideoBitrate="警告: 视频比特率将设置为 %1, 这是当前的流媒体服务的上限值. 如果你确定你想要超过 %1, 启用高级的编码器选项并取消选中\"强制流媒体服务比特率限制\"." Basic.Settings.Output.Simple.Warn.AudioBitrate="警告: 音频比特率将设置为 %1, 这是当前的流媒体服务的上限值. 如果你确定你想要超过 %1, 启用高级的编码器选项并取消选中\"强制流媒体服务比特率限制\"." +Basic.Settings.Output.Simple.Warn.CannotPause="警告:当录像质量设为“与串流画质相同”时,无法暂停录制。" Basic.Settings.Output.Simple.Warn.Encoder="警告: 同时传输流和录像, 并使用软件编码器编码与流不同的质量, 将会需要额外的CPU使用." Basic.Settings.Output.Simple.Warn.Lossless="警告:无损质量产生的文件大小非常大!无损质量在高分辨率和帧速率的情况下每分钟可使用超过 7GB 的磁盘空间。无损不适合长时间录像,除非你有很多可用的磁盘空间。" Basic.Settings.Output.Simple.Warn.Lossless.Msg="你确定你想要使用无损质量?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="视频比特率" Basic.Settings.Output.AudioBitrate="音频比特率" Basic.Settings.Output.Reconnect="自动重连" -Basic.Settings.Output.RetryDelay="重试间隔(秒)" +Basic.Settings.Output.RetryDelay="重试延迟" Basic.Settings.Output.MaxRetries="最大重试次数" Basic.Settings.Output.Advanced="启用高级编码器设置" Basic.Settings.Output.EncoderPreset="编码器预设" @@ -646,7 +664,7 @@ Basic.Settings.Output.Adv.Recording.Type="类型" Basic.Settings.Output.Adv.Recording.Type.Standard="标准" Basic.Settings.Output.Adv.Recording.Type.FFmpegOutput="自定义输出 (FFmpeg)" -Basic.Settings.Output.Adv.Recording.UseStreamEncoder="(使用串流编码器)" +Basic.Settings.Output.Adv.Recording.UseStreamEncoder="(使用推流编码器)" Basic.Settings.Output.Adv.Recording.Filename="文件名格式" Basic.Settings.Output.Adv.Recording.OverwriteIfExists="如果文件存在则覆盖" Basic.Settings.Output.Adv.FFmpeg.Type="FFmpeg 输出类型" @@ -693,8 +711,9 @@ Basic.Settings.Video.DisableAero="禁用 Aero" Basic.Settings.Video.DownscaleFilter.Bilinear="双直线法(最快, 但如果缩放会模糊)" -Basic.Settings.Video.DownscaleFilter.Bicubic="两次立方(削尖缩放, 16 个样本)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos(削尖缩放, 32个样本)" +Basic.Settings.Video.DownscaleFilter.Bicubic="双立方(锐化缩放, 16 个样本)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos(锐化缩放, 36 个样本)" +Basic.Settings.Video.DownscaleFilter.Area="区域(加权和, 4/6/9个样本)" Basic.Settings.Audio="音频" Basic.Settings.Audio.SampleRate="采样率" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="采样峰值" Basic.Settings.Audio.PeakMeterType.TruePeak="真峰值 (更高的的 CPU 使用率)" Basic.Settings.Audio.MultiChannelWarning.Enabled="警告: 已启用环绕声音频。" -Basic.Settings.Audio.MultichannelWarning="如果是串流,请检查你的串流服务是否支持环绕立体声的接收与播放。Twitch、Facebook 360 Live、Mixer RTMP、Smashcast 皆完全支持环绕立体声。虽然 Facebook Live 和 YouTube Live 都支持对环绕立体声的接收,但是 Facebook Live 将把声音混音成立体声,而 YouTube Live 则只播放两个声道。\n\n虽然无法保证 VST 插件对其的支持,但 OBS 的音频滤镜与环绕立体声兼容。" +Basic.Settings.Audio.MultichannelWarning="如果是串流,请检查你的串流服务是否支持环绕立体声的接收与播放。Facebook 360 Live、Mixer RTMP、Smashcast 皆完全支持环绕立体声。虽然 Facebook Live 和 YouTube Live 都支持对环绕立体声的接收,但是 Facebook Live 将把声音混音成立体声,而 YouTube Live 则只播放两个声道。\n\n虽然无法保证 VST 插件对其的支持,但 OBS 的音频滤镜与环绕立体声兼容。" Basic.Settings.Audio.MultichannelWarning.Title="是否启用环绕立体声?" Basic.Settings.Audio.MultichannelWarning.Confirm="确实要启用环绕立体声吗?" Basic.Settings.Audio.Devices="设备" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="默认" Basic.Settings.Advanced.Audio.DisableAudioDucking="禁用 Windows 音频闪避(检测到通信活动时降低其他声音的音量)" Basic.Settings.Advanced.StreamDelay="串流延迟" -Basic.Settings.Advanced.StreamDelay.Duration="延迟时间(秒)" +Basic.Settings.Advanced.StreamDelay.Duration="延迟时间" Basic.Settings.Advanced.StreamDelay.Preserve="重新连接时保持截止点 (增加延迟)" Basic.Settings.Advanced.StreamDelay.MemoryUsage="估计内存使用量:%1 MB" Basic.Settings.Advanced.Network="网络" Basic.Settings.Advanced.Network.BindToIP="绑定到 IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="启用新的网络代码" Basic.Settings.Advanced.Network.EnableLowLatencyMode="低延迟模式" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="热键与窗口焦点" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="任何时候都启用热键" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="当主窗口获得焦点时禁用热键" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="主窗口失去焦点时禁用热键" Basic.Settings.Advanced.AutoRemux="自动封装至 MP4 格式" Basic.Settings.Advanced.AutoRemux.MP4="(录制为 mkv 格式)" Basic.AdvAudio="高级音频属性" Basic.AdvAudio.Name="名称" Basic.AdvAudio.Volume="音量" -Basic.AdvAudio.Mono="混缩为单声道" +Basic.AdvAudio.Mono="单声道" Basic.AdvAudio.Balance="平衡" -Basic.AdvAudio.SyncOffset="同步偏移 (毫秒)" +Basic.AdvAudio.SyncOffset="同步偏移" Basic.AdvAudio.Monitoring="音频监听" Basic.AdvAudio.Monitoring.None="关闭监听" Basic.AdvAudio.Monitoring.MonitorOnly="仅监听(输出静音)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="您必须选择至少一个轨道" OutputWarnings.MultiTrackRecording="警告: 某些格式 (如 FLV) 不支持每个录像多个轨道" OutputWarnings.MP4Recording="警告:如果文件无法完成(例如,由于蓝屏BSOD,掉电等),保存到 MP4/MOV 的记录将无法恢复。如果要录制多个音轨,请考虑使用 MKV 录制,并在完成后将录像重新封装为 MP4/MOV(文件→录像转封装)" +OutputWarnings.CannotPause="警告:当录像编码器设为“(使用推流编码器)”时,无法暂停录制。" FinalScene.Title="删除场景" FinalScene.Text="至少要有一个场景."
View file
obs-studio-23.2.1.tar.xz/UI/data/locale/zh-TW.ini -> obs-studio-24.0.0.tar.xz/UI/data/locale/zh-TW.ini
Changed
@@ -1,5 +1,5 @@ -Language="正體中文(臺灣)" +Language="繁體中文" Region="臺灣/香港/澳門" OK="確定" @@ -23,55 +23,55 @@ Display="螢幕" Name="名稱" Exit="離開" -Mixer="混音器" +Mixer="音效混音器" Browse="瀏覽" Mono="單聲道" Stereo="立體聲" -DroppedFrames="影格遺失: %1 (%2%)" -StudioProgramProjector="全屏投影(程式)" +DroppedFrames="拋棄影格數:%1 (%2%)" +StudioProgramProjector="全螢幕投影(程式)" PreviewProjector="全螢幕投影(預覽)" SceneProjector="全螢幕投影(場景)" SourceProjector="全螢幕投影(來源)" -StudioProgramWindow="窗式投影儀(程序)" +StudioProgramWindow="視窗化投影(程式)" PreviewWindow="視窗化投影(預覽)" SceneWindow="視窗化投影(場景)" SourceWindow="視窗化投影(來源)" -MultiviewProjector="多視圖(全屏)" -MultiviewWindowed="多視圖(窗口)" +MultiviewProjector="多檢視畫面(全螢幕)" +MultiviewWindowed="多檢視畫面(視窗)" Clear="清除" Revert="復原" Show="顯示" Hide="隱藏" -UnhideAll="全部取消隱藏" +UnhideAll="全數取消隱藏" Untitled="無標題" New="新增" Duplicate="複製" Enable="啟用" -DisableOSXVSync="關閉OSX垂直同步" -ResetOSXVSyncOnExit="離開時重置OSX垂直同步" -HighResourceUsage="編碼過載!考慮降低影像設定或使用更快的編碼預設。" -Transition="轉場" +DisableOSXVSync="關閉 OSX 垂直同步" +ResetOSXVSyncOnExit="離開時重設 OSX 垂直同步" +HighResourceUsage="編碼過載!請考慮調低影像設定,或使用更快的編碼設定檔。" +Transition="轉場特效" QuickTransitions="快速轉場" Left="左" Right="右" Top="上" Bottom="下" -Reset="重置" -Hours="小時" -Minutes="分鐘" +Reset="重設" +Hours="時" +Minutes="分" Seconds="秒" -Deprecated="不再維護" -ReplayBuffer="重播緩衝" +Deprecated="已經廢棄" +ReplayBuffer="重播緩衝區" Import="匯入" Export="匯出" Copy="複製" Paste="貼上" PasteReference="貼上 (參考)" -PasteDuplicate="貼上 (重複)" -RemuxRecordings="重新封裝錄影" +PasteDuplicate="貼上 (複製)" +RemuxRecordings="重新封裝錄影檔" Next="下一步" -Back="返回" -Defaults="預設" +Back="上一步" +Defaults="預設設定檔" HideMixer="在混合器中隱藏" TransitionOverride="轉換覆蓋" None="無" @@ -85,31 +85,36 @@ Calculating="正在計算……" AlreadyRunning.Title="OBS 已在執行中" -AlreadyRunning.Text="OBS 已在執行中!除非這是您的意圖,請在執行新的 OBS 前關閉現存的 OBS 。如果有設定 OBS 最小化到系統工具列,請確認是否仍在該處執行。" -AlreadyRunning.LaunchAnyway="強制啟動" +AlreadyRunning.Text="OBS 已經執行!除非你正要這麼做,否則請在執行新實體前,先關閉現存的 OBS 實體。如果你已將 OBS 設定成最小化到系統工具列,那請檢查 OBS 是否仍在該處執行。" +AlreadyRunning.LaunchAnyway="仍然啟動" DockCloseWarning.Title="關閉停駐視窗" DockCloseWarning.Text="您剛關閉了一個停駐視窗。若想再次顯示,請重新在選單欄的「檢視」->「停駐視窗」選單開啟此視窗。" -Auth.Authing.Title="正在認證中…" +ExtraBrowsers="自訂瀏覽器停駐視窗" +ExtraBrowsers.Info="可透過提供名稱及網址來新增停駐視窗,再按下「套用」或「關閉」開啟停駐視窗。您可隨時新增或移除停駐視窗。" +ExtraBrowsers.DockName="停駐視窗名稱" + +Auth.Authing.Title="正在認證…" Auth.Authing.Text="正在透過 %1 認證,請稍候…" -Auth.AuthFailure.Title="身份驗證失敗" -Auth.AuthFailure.Text="%1 認證失敗:\n\n%2: %3" -Auth.InvalidScope.Title="需要身份驗證" -Auth.InvalidScope.Text="%1 的身份驗證要求已更改。 某些功能可能不可用。" +Auth.AuthFailure.Title="認證失敗" +Auth.AuthFailure.Text="透過 %1 認證失敗:\n\n%2:%3" +Auth.InvalidScope.Title="需要認證" +Auth.InvalidScope.Text="已變更 %1 的認證要求。可能無法使用部份功能。" Auth.LoadingChannel.Title="正在載入頻道資訊…" Auth.LoadingChannel.Text="正在載入 %1 的頻道資訊,請稍候…" Auth.ChannelFailure.Title="讀取頻道資訊失敗" -Auth.ChannelFailure.Text="讀取 %1 頻道失敗\n\n%2: %3" +Auth.ChannelFailure.Text="無法讀取 %1 頻道資訊\n\n%2: %3" Auth.Chat="聊天室" Auth.StreamInfo="實況資訊" -TwitchAuth.Stats="Twitch狀態" +TwitchAuth.Stats="Twitch 狀態" TwitchAuth.Feed="Twitch 活動摘要" TwitchAuth.TwoFactorFail.Title="無法查詢串流金鑰" -TwitchAuth.TwoFactorFail.Text="OBS 無法連線至您的 Twitch 帳號。請確保您已經在 <a href='https://www.twitch.tv/settings/security'>Twitch 安全性設定</a> 中設定串流所需的兩步驟驗證。" +TwitchAuth.TwoFactorFail.Text="OBS 無法連結您的 Twitch 帳號。請確保您已在 <a href='https://www.twitch.tv/settings/security'>Twitch 安全性設定</a> 中設定串流所需的兩步驟驗證。" +RestreamAuth.Channels="Restream 頻道" Copy.Filters="複製過濾器" -Paste.Filters="貼上篩選器" +Paste.Filters="貼上過濾器" BrowserPanelInit.Title="正在初始化瀏覽器…" BrowserPanelInit.Text="正在初始化瀏覽器,請稍候…" @@ -120,15 +125,15 @@ BandwidthTest.Region.Asia="亞洲" BandwidthTest.Region.Other="其他" -Basic.FirstStartup.RunWizard="您想要運行自動設定精靈嗎? 也可以透過點選主視窗中的設定按鈕來手動設定。" -Basic.FirstStartup.RunWizard.NoClicked="如果你改變主意,可以隨時從工具功能表再次執行自動設定精靈。" +Basic.FirstStartup.RunWizard="是否執行「自動設定精靈」?您亦可藉由按下主視窗的「設定」按鈕手動設定。" +Basic.FirstStartup.RunWizard.NoClicked="若您改變主意,您隨時皆可在「工具」選單重新執行「自動設定精靈」。" Basic.AutoConfig="自動設定精靈" Basic.AutoConfig.ApplySettings="套用設定" -Basic.AutoConfig.StartPage="使用資訊" +Basic.AutoConfig.StartPage="用量資訊" Basic.AutoConfig.StartPage.SubTitle="指定想運用的場合" Basic.AutoConfig.StartPage.PrioritizeStreaming="為串流最佳化,錄影為次要的" -Basic.AutoConfig.StartPage.PrioritizeRecording="僅為錄影最佳化,將不會串流" +Basic.AutoConfig.StartPage.PrioritizeRecording="僅為錄影最佳化,不會用於串流" Basic.AutoConfig.VideoPage="影像設定" Basic.AutoConfig.VideoPage.SubTitle="指定想使用的影像設定" Basic.AutoConfig.VideoPage.BaseResolution.UseCurrent="使用現在的 (%1x%2)" @@ -136,26 +141,26 @@ Basic.AutoConfig.VideoPage.FPS.UseCurrent="使用現在的 (%1)" Basic.AutoConfig.VideoPage.FPS.PreferHighFPS="60 或 30,但可能時優先選擇 60" Basic.AutoConfig.VideoPage.FPS.PreferHighRes="60 或 30,但優先高解析度" -Basic.AutoConfig.VideoPage.CanvasExplanation="注︰ 畫布(來源)解析度並不一定與串流或錄影相同。實際的串流/錄影解析度可以從畫布解析度縮小以減少資源使用或位元率需求。" +Basic.AutoConfig.VideoPage.CanvasExplanation="註:畫布(來源)解析度並不一定與串流或錄影相同。實際的串流 / 錄影解析度,可以從畫布解析度縮小,以減少資源使用或位元率需求。" Basic.AutoConfig.StreamPage="串流資訊" Basic.AutoConfig.StreamPage.SubTitle="請輸入您的串流資訊" -Basic.AutoConfig.StreamPage.ConnectAccount="連結帳號 (選用)" -Basic.AutoConfig.StreamPage.DisconnectAccount="解除帳號連結" -Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="是否要解除帳號連結?" +Basic.AutoConfig.StreamPage.ConnectAccount="連結帳號(建議)" +Basic.AutoConfig.StreamPage.DisconnectAccount="解除連結帳號" +Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Title="是否要解除連結帳號?" Basic.AutoConfig.StreamPage.DisconnectAccount.Confirm.Text="此變更將立即套用,確定斷開帳號連結?" Basic.AutoConfig.StreamPage.UseStreamKey="使用串流金鑰" Basic.AutoConfig.StreamPage.Service="服務" -Basic.AutoConfig.StreamPage.Service.ShowAll="顯示全部..." +Basic.AutoConfig.StreamPage.Service.ShowAll="全部顯示..." Basic.AutoConfig.StreamPage.Service.Custom="自訂…" Basic.AutoConfig.StreamPage.Server="伺服器" Basic.AutoConfig.StreamPage.StreamKey="串流金鑰" -Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(連結)" -Basic.AutoConfig.StreamPage.PerformBandwidthTest="用頻寬測試估計位元率(可能需要幾分鐘)" +Basic.AutoConfig.StreamPage.StreamKey.LinkToSite="(連結)" +Basic.AutoConfig.StreamPage.PerformBandwidthTest="藉由頻寬測試估計位元速率(可能需要幾分鐘)" Basic.AutoConfig.StreamPage.PreferHardwareEncoding="優先使用硬體編碼" Basic.AutoConfig.StreamPage.PreferHardwareEncoding.ToolTip="硬體編碼去除了大多數的 CPU 使用率,但可能需要更多的位元率以獲得同等的品質。" Basic.AutoConfig.StreamPage.StreamWarning.Title="串流警告" Basic.AutoConfig.StreamPage.StreamWarning.Text="頻寬測試即將串流隨機沒有音訊的影像資料到您的頻道。 如果能的話,建議暫時關閉保存影像串流並設定串流為私密直到完成測試。 要繼續嗎?" -Basic.AutoConfig.TestPage="最後的結果" +Basic.AutoConfig.TestPage="最終結果" Basic.AutoConfig.TestPage.SubTitle.Testing="程式目前正在執行一系列的測試以估計最理想的設定" Basic.AutoConfig.TestPage.SubTitle.Complete="測試完成" Basic.AutoConfig.TestPage.TestingBandwidth="執行頻寬測試,這可能需要幾分鐘..." @@ -240,6 +245,9 @@ ConfirmStop.Title="停止串流?" ConfirmStop.Text="你確定你想要停止串流?" +ConfirmStopRecord.Title="停止錄影?" +ConfirmStopRecord.Text="確定停止錄製?" + ConfirmBWTest.Title="開始頻寬測試?" ConfirmBWTest.Text="你已在頻寬測試模式下配置了 OBS。此模式允許在沒有開始直播的情況下進行網路測試。完成測試後,你要禁用它才可以進行直播。\n\n要繼續嗎?" @@ -255,6 +263,8 @@ Output.StartReplayFailed="無法啟動重播緩衝區" Output.StartFailedGeneric="啟動輸出失敗。 詳情請看 Log 檔。\n\n注意︰ 如果你使用 NVENC 或 AMD 編碼器,請確保您的視頻驅動程式是最新。" +Output.ReplayBuffer.PauseWarning.Title="暫停時,無法儲存檔案。" +Output.ReplayBuffer.PauseWarning.Text="警告:錄影暫停時,將無法儲存重播。" Output.ConnectFail.Title="連線失敗" Output.ConnectFail.BadPath="無效的路徑或 URL。 請確認您的設定是正確的。" @@ -444,6 +454,8 @@ Basic.Main.StartReplayBuffer="開始重播緩衝" Basic.Main.StartStreaming="開始串流" Basic.Main.StopRecording="停止錄製" +Basic.Main.PauseRecording="暫停錄影" +Basic.Main.UnpauseRecording="繼續錄製" Basic.Main.StoppingRecording="停止錄製..." Basic.Main.StopReplayBuffer="停止重播緩衝" Basic.Main.StoppingReplayBuffer="正在停止重播緩衝..." @@ -451,7 +463,7 @@ Basic.Main.StoppingStreaming="停止串流..." Basic.Main.ForceStopStreaming="停止實況(丟棄延遲)" Basic.Main.Group="群組 %1" -Basic.Main.GroupItems="群組選取的項目" +Basic.Main.GroupItems="群組選取項目" Basic.Main.Ungroup="取消群組" Basic.MainMenu.File="檔案 (&F)" @@ -502,6 +514,7 @@ Basic.MainMenu.View.Docks="停駐視窗" Basic.MainMenu.View.Docks.ResetUI="重設使用者介面" Basic.MainMenu.View.Docks.LockUI="鎖定使用者介面" +Basic.MainMenu.View.Docks.CustomBrowserDocks="自訂瀏覽器停駐視窗…" Basic.MainMenu.View.Toolbars.Listboxes="列表控制項(&L)" Basic.MainMenu.View.SceneTransitions="轉場特效(&c)" Basic.MainMenu.View.StatusBar="狀態列(&S)" @@ -544,6 +557,7 @@ Basic.Settings.General.OpenStatsOnStartup="在啟動時打開狀態對話欄" Basic.Settings.General.WarnBeforeStartingStream="啟動串流時顯示確認對話框" Basic.Settings.General.WarnBeforeStoppingStream="停止串流時顯示確認對話框" +Basic.Settings.General.WarnBeforeStoppingRecord="停止錄影時顯示確認對話框" Basic.Settings.General.Projectors="投影" Basic.Settings.General.HideProjectorCursor="當游標在投影上時隱藏游標" Basic.Settings.General.ProjectorAlwaysOnTop="讓投影總是在最上層" @@ -591,12 +605,15 @@ Basic.Settings.Output.SelectDirectory="選擇錄影資料夾" Basic.Settings.Output.SelectFile="選擇錄影檔案" Basic.Settings.Output.EnforceBitrate="強制設定串流位元率上限" +Basic.Settings.Output.DynamicBitrate="動態調整位元速率以管理堵塞問題" +Basic.Settings.Output.DynamicBitrate.Beta="動態調整位元速率以管理堵塞問題 (Beta)" +Basic.Settings.Output.DynamicBitrate.TT="快速動態變更位元速率而非丟棄影格來緩解堵塞問題。\n\n註:這可能會在突發嚴重堵塞時增加觀看者的延遲。\n位元速率降低後,可能會需要幾分鐘才會恢復。\n\n目前僅支援 RTMP。" Basic.Settings.Output.Mode="輸出模式" Basic.Settings.Output.Mode.Simple="簡易" Basic.Settings.Output.Mode.Adv="進階" Basic.Settings.Output.Mode.FFmpeg="FFmpeg 輸出" Basic.Settings.Output.UseReplayBuffer="啟用重播緩衝" -Basic.Settings.Output.ReplayBuffer.SecondsMax="最大重播時間(秒)" +Basic.Settings.Output.ReplayBuffer.SecondsMax="最大重播時間" Basic.Settings.Output.ReplayBuffer.MegabytesMax="最大記憶體使用量(MB)" Basic.Settings.Output.ReplayBuffer.Estimate="估計記憶體使用量︰ %1 MB" Basic.Settings.Output.ReplayBuffer.EstimateUnknown="無法預估記憶體使用量。請設定最大記憶體使用量。" @@ -611,6 +628,7 @@ Basic.Settings.Output.Simple.RecordingQuality.Lossless="無損畫質,非常大的檔案" Basic.Settings.Output.Simple.Warn.VideoBitrate="警告:串流影像位元率將會被設為 %1,他是目前串流位元率的上限。如果您確定想要超過 %1 的限制,請開啟進階編碼器選項,並取消「強制設定串流位元率上限」。" Basic.Settings.Output.Simple.Warn.AudioBitrate="警告:實況串流位元率將會被設為 %1,他是目前串流位元率的上限。如果您確定想要超過 %1 的限制,請開啟進階編碼器選項,並取消「強制設定串流位元率上限」。" +Basic.Settings.Output.Simple.Warn.CannotPause="警告:如果錄影編碼器畫質設為「(和直播編碼器相同)」,錄影時將無法暫停。" Basic.Settings.Output.Simple.Warn.Encoder="警告:如果錄影與串流同時運作,並使用與串流不同的編碼品質設定將會增加額外的CPU使用量" Basic.Settings.Output.Simple.Warn.Lossless="警告:無損畫質將會產生非常大的檔案!無損畫質在高解析度或高影格率時,可能會每分鐘使用高達 7GB(gigabytes)的容量。除非您擁有非常大量的硬碟空間,否則不建議使用無損畫質錄製長時間的影片。" Basic.Settings.Output.Simple.Warn.Lossless.Msg="你確定你想要使用無損畫質?" @@ -623,7 +641,7 @@ Basic.Settings.Output.VideoBitrate="影像位元率(kbit/s)" Basic.Settings.Output.AudioBitrate="音效位元率(kbit/s)" Basic.Settings.Output.Reconnect="自動重新連線" -Basic.Settings.Output.RetryDelay="重試間隔(秒)" +Basic.Settings.Output.RetryDelay="重試延遲" Basic.Settings.Output.MaxRetries="最大嘗試次數" Basic.Settings.Output.Advanced="啓用進階編碼器設定" Basic.Settings.Output.EncoderPreset="編碼器預設" @@ -694,7 +712,8 @@ Basic.Settings.Video.DownscaleFilter.Bilinear="Bilinear(快速,但縮放時易模糊)" Basic.Settings.Video.DownscaleFilter.Bicubic="Bicubic(縮放後較銳利,取 16 個樣本數)" -Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos(縮放後最為銳利,取 32 個樣本數)" +Basic.Settings.Video.DownscaleFilter.Lanczos="Lanczos(縮放後最為銳利,取 36 個樣本數)" +Basic.Settings.Video.DownscaleFilter.Area="Area (加權總和,4/6/9 個樣本)" Basic.Settings.Audio="音效" Basic.Settings.Audio.SampleRate="取樣頻率" @@ -708,7 +727,7 @@ Basic.Settings.Audio.PeakMeterType.SamplePeak="範例峰值" Basic.Settings.Audio.PeakMeterType.TruePeak="真實峰值(較高的 CPU 用量)" Basic.Settings.Audio.MultiChannelWarning.Enabled="警告: 已啟用環繞聲音訊。" -Basic.Settings.Audio.MultichannelWarning="如果是流媒體,請檢查您的流媒體服務是否同時支持環繞聲攝取和環繞聲播放。 Twitch,Facebook 360 Live,Mixer RTMP,Smashcast都是完全支持環繞聲的例子。 儘管Facebook Live和YouTube Live都接受環繞聲攝取,但是Facebook Live會混音為立體聲,而YouTube Live只播放兩個聲道。\n\n 儘管不支持VST插件,但OBS音頻濾波器與環繞聲兼容。" +Basic.Settings.Audio.MultichannelWarning="如果是流媒體,請檢查您的流媒體服務是否同時支持環繞聲攝取和環繞聲播放。 Facebook 360 Live,Mixer RTMP,Smashcast都是完全支持環繞聲的例子。 儘管Facebook Live和YouTube Live都接受環繞聲攝取,但是Facebook Live會混音為立體聲,而YouTube Live只播放兩個聲道。\n\n 儘管不支持VST插件,但OBS音頻濾波器與環繞聲兼容。" Basic.Settings.Audio.MultichannelWarning.Title="是否啟用環繞聲音訊?" Basic.Settings.Audio.MultichannelWarning.Confirm="確實要啟用環繞聲音訊嗎?" Basic.Settings.Audio.Devices="裝置" @@ -743,23 +762,26 @@ Basic.Settings.Advanced.Audio.MonitoringDevice.Default="預設裝置" Basic.Settings.Advanced.Audio.DisableAudioDucking="停用 Windows 雙層次音量自動調整" Basic.Settings.Advanced.StreamDelay="實況延遲" -Basic.Settings.Advanced.StreamDelay.Duration="延遲(秒)" +Basic.Settings.Advanced.StreamDelay.Duration="持續時間" Basic.Settings.Advanced.StreamDelay.Preserve="重新連線時維持截止點 (增加延遲)" Basic.Settings.Advanced.StreamDelay.MemoryUsage="預計記憶體使用率: %1 MB" Basic.Settings.Advanced.Network="網路" Basic.Settings.Advanced.Network.BindToIP="綁定到 IP" Basic.Settings.Advanced.Network.EnableNewSocketLoop="啟用新的網路程式碼" Basic.Settings.Advanced.Network.EnableLowLatencyMode="低延遲模式" +Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior="快速鍵焦點行為" +Basic.Settings.Advanced.Hotkeys.NeverDisableHotkeys="永不停用快速鍵" Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus="當主視窗處於焦點,則停用熱鍵" +Basic.Settings.Advanced.Hotkeys.DisableHotkeysOutOfFocus="僅在焦點不在主視窗時停用快速鍵" Basic.Settings.Advanced.AutoRemux="自動 remux 到 mp4" Basic.Settings.Advanced.AutoRemux.MP4="(錄成 mkv 格式)" Basic.AdvAudio="進階音訊屬性" Basic.AdvAudio.Name="名稱" Basic.AdvAudio.Volume="音量" -Basic.AdvAudio.Mono="混降為單聲道" +Basic.AdvAudio.Mono="單聲道" Basic.AdvAudio.Balance="聲道平衡" -Basic.AdvAudio.SyncOffset="同步位移(ms)" +Basic.AdvAudio.SyncOffset="同步位移" Basic.AdvAudio.Monitoring="音訊監測" Basic.AdvAudio.Monitoring.None="關閉監測" Basic.AdvAudio.Monitoring.MonitorOnly="僅監測(輸出為靜音)" @@ -825,6 +847,7 @@ OutputWarnings.NoTracksSelected="您必須至少選擇一個軌道" OutputWarnings.MultiTrackRecording="警告:某些格式 (例如 FLV) 不支援多個軌道錄製" OutputWarnings.MP4Recording="警告︰ 如果檔案沒有完整儲存(例如由於 BSOD,斷電等中斷),儲存成 MP4/MOV 的檔案將無法復原 。如果想要記錄多個音軌,請考慮儲存成 MKV ,並在完成後重新封裝成 MP4/MOV (檔案 -> 重新封裝)" +OutputWarnings.CannotPause="警告:如果錄影編碼器設為「(使用直播編碼器)」,錄影時將無法暫停。" FinalScene.Title="刪除場景" FinalScene.Text="至少要有一個場景。"
View file
obs-studio-23.2.1.tar.xz/UI/data/themes/Acri.qss -> obs-studio-24.0.0.tar.xz/UI/data/themes/Acri.qss
Changed
@@ -42,7 +42,6 @@ outline: none; font-family: "Open Sans", "Tahoma", "Arial", sans-serif; font-size: 12px; - overflow: auto; } #menubar { @@ -353,6 +352,10 @@ qproperty-icon: url(./Dark/down.svg); } +* [themeID="pauseIconSmall"] { + qproperty-icon: url(./Dark/media-pause.svg); +} + /* Tab Widget */ QTabWidget::pane { /* The tab widget frame */ @@ -647,14 +650,6 @@ /* Volume Control */ -/* Old Meters */ -VolumeMeter { - qproperty-bkColor: rgb(8,8,11); - qproperty-magColor:; - qproperty-peakColor:; - qproperty-peakHoldColor: rgb(225,224,225); -} - VolumeMeter { qproperty-backgroundNominalColor: #42740c; @@ -998,3 +993,16 @@ * [themeID="revertIcon"] { qproperty-icon: url(./Dark/revert.svg); } + +QPushButton#extraPanelDelete { + background: transparent; + border: none; +} + +QPushButton#extraPanelDelete:hover { + background-color: #2a3a75; +} + +QPushButton#extraPanelDelete:pressed { + background-color: #161f41; +}
View file
obs-studio-23.2.1.tar.xz/UI/data/themes/Dark.qss -> obs-studio-24.0.0.tar.xz/UI/data/themes/Dark.qss
Changed
@@ -142,7 +142,14 @@ QGroupBox { border: 1px solid rgb(31,30,31); /* veryDark */; border-radius: 5px; - padding-top: 16px; + padding-top: 24px; + font-weight: bold; +} + +QGroupBox::title { + subcontrol-origin: margin; + left: 4px; + top: 4px; } @@ -253,6 +260,10 @@ qproperty-icon: url(./Dark/down.svg); } +* [themeID="pauseIconSmall"] { + qproperty-icon: url(./Dark/media-pause.svg); +} + /* Tab Widget */ @@ -577,6 +588,19 @@ color: red; } +/* Pause */ +PauseCheckBox { + outline: none; +} + +PauseCheckBox::indicator:checked { + image: url(:/res/images/media-pause.svg); +} + +PauseCheckBox::indicator:unchecked { + image: url(:/res/images/media-play.svg); +} + /* Group Collapse Checkbox */ SourceTreeSubItemCheckBox { @@ -713,3 +737,15 @@ * [themeID="revertIcon"] { qproperty-icon: url(./Dark/revert.svg); } + +QPushButton#extraPanelDelete { + background-color: rgb(31, 30, 31); +} + +QPushButton#extraPanelDelete:hover { + background-color: rgb(122,121,122); +} + +QPushButton#extraPanelDelete:pressed { + background-color: rgb(31,30,31); +}
View file
obs-studio-24.0.0.tar.xz/UI/data/themes/Dark/media-pause.svg
Added
@@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8" fill="#d2d2d2"> + <path d="M0 0v6h2v-6h-2zm4 0v6h2v-6h-2z" transform="translate(1 1)" /> +</svg>
View file
obs-studio-23.2.1.tar.xz/UI/data/themes/Rachni.qss -> obs-studio-24.0.0.tar.xz/UI/data/themes/Rachni.qss
Changed
@@ -507,6 +507,10 @@ qproperty-icon: url(./Dark/down.svg); } +* [themeID="pauseIconSmall"] { + qproperty-icon: url(./Dark/media-pause.svg); +} + /***********************/ /* --- Combo boxes --- */ /***********************/ @@ -952,7 +956,8 @@ QPushButton:checked[themeID="replayBufferButton"], QPushButton:checked#modeSwitch, QPushButton:checked#settingsButton, -QPushButton:checked#exitButton { +QPushButton:checked#exitButton, +QPushButton:checked[themeID="pauseIconSmall"] { background-color: rgba(240, 98, 146, 0.5); /* Pink (Secondary) */ border: 1px solid rgba(240, 98, 146, 0.5); /* Pink (Secondary) */ } @@ -1323,3 +1328,15 @@ * [themeID="revertIcon"] { qproperty-icon: url(./Dark/revert.svg); } + +QPushButton#extraPanelDelete { + background-color: rgb(35, 38, 41); +} + +QPushButton#extraPanelDelete:hover { + background-color: rgba(145, 76, 103); +} + +QPushButton#extraPanelDelete:pressed { + background-color: rgb(240, 98, 146); +}
View file
obs-studio-23.2.1.tar.xz/UI/data/themes/System.qss -> obs-studio-24.0.0.tar.xz/UI/data/themes/System.qss
Changed
@@ -39,6 +39,10 @@ qproperty-icon: url(:/res/images/down.svg); } +* [themeID="pauseIconSmall"] { + qproperty-icon: url(:/res/images/media-pause.svg); +} + MuteCheckBox { outline: none; }
View file
obs-studio-23.2.1.tar.xz/UI/display-helpers.hpp -> obs-studio-24.0.0.tar.xz/UI/display-helpers.hpp
Changed
@@ -21,15 +21,15 @@ #define SUPPORTS_FRACTIONAL_SCALING #endif -static inline void GetScaleAndCenterPos( - int baseCX, int baseCY, int windowCX, int windowCY, - int &x, int &y, float &scale) +static inline void GetScaleAndCenterPos(int baseCX, int baseCY, int windowCX, + int windowCY, int &x, int &y, + float &scale) { double windowAspect, baseAspect; int newCX, newCY; windowAspect = double(windowCX) / double(windowCY); - baseAspect = double(baseCX) / double(baseCY); + baseAspect = double(baseCX) / double(baseCY); if (windowAspect > baseAspect) { scale = float(windowCY) / float(baseCY); @@ -41,16 +41,16 @@ newCY = int(float(windowCX) / baseAspect); } - x = windowCX/2 - newCX/2; - y = windowCY/2 - newCY/2; + x = windowCX / 2 - newCX / 2; + y = windowCY / 2 - newCY / 2; } -static inline void GetCenterPosFromFixedScale( - int baseCX, int baseCY, int windowCX, int windowCY, - int &x, int &y, float scale) +static inline void GetCenterPosFromFixedScale(int baseCX, int baseCY, + int windowCX, int windowCY, + int &x, int &y, float scale) { - x = (float(windowCX) - float(baseCX)*scale) / 2.0f; - y = (float(windowCY) - float(baseCY)*scale) / 2.0f; + x = (float(windowCX) - float(baseCX) * scale) / 2.0f; + y = (float(windowCY) - float(baseCY) * scale) / 2.0f; } static inline QSize GetPixelSize(QWidget *widget)
View file
obs-studio-23.2.1.tar.xz/UI/double-slider.cpp -> obs-studio-24.0.0.tar.xz/UI/double-slider.cpp
Changed
@@ -4,12 +4,12 @@ DoubleSlider::DoubleSlider(QWidget *parent) : SliderIgnoreScroll(parent) { - connect(this, SIGNAL(valueChanged(int)), - this, SLOT(intValChanged(int))); + connect(this, SIGNAL(valueChanged(int)), this, + SLOT(intValChanged(int))); } void DoubleSlider::setDoubleConstraints(double newMin, double newMax, - double newStep, double val) + double newStep, double val) { minVal = newMin; maxVal = newMax; @@ -26,7 +26,7 @@ void DoubleSlider::intValChanged(int val) { - emit doubleValChanged((minVal/minStep + val) * minStep); + emit doubleValChanged((minVal / minStep + val) * minStep); } void DoubleSlider::setDoubleVal(double val)
View file
obs-studio-23.2.1.tar.xz/UI/double-slider.hpp -> obs-studio-24.0.0.tar.xz/UI/double-slider.hpp
Changed
@@ -11,8 +11,8 @@ public: DoubleSlider(QWidget *parent = nullptr); - void setDoubleConstraints(double newMin, double newMax, - double newStep, double val); + void setDoubleConstraints(double newMin, double newMax, double newStep, + double val); signals: void doubleValChanged(double val);
View file
obs-studio-23.2.1.tar.xz/UI/focus-list.hpp -> obs-studio-24.0.0.tar.xz/UI/focus-list.hpp
Changed
@@ -2,8 +2,7 @@ #include <QListWidget> -class FocusList : public QListWidget -{ +class FocusList : public QListWidget { Q_OBJECT public:
View file
obs-studio-23.2.1.tar.xz/UI/forms/OBSBasic.ui -> obs-studio-24.0.0.tar.xz/UI/forms/OBSBasic.ui
Changed
@@ -41,30 +41,102 @@ <item> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> - <widget class="QLabel" name="previewDisabledLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="contextMenuPolicy"> - <enum>Qt::CustomContextMenu</enum> - </property> - <property name="text"> - <string>Basic.Main.PreviewDisabled</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> <layout class="QHBoxLayout" name="previewLayout"> <property name="spacing"> <number>2</number> </property> <item> + <widget class="QWidget" name="previewDisabledWidget" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Basic.Main.PreviewDisabled</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="enablePreviewButton"> + <property name="text"> + <string>Basic.Main.PreviewConextMenu.Enable</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> <layout class="QVBoxLayout" name="previewTextLayout"> <property name="spacing"> <number>0</number> @@ -843,7 +915,7 @@ <string notr="true"/> </property> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/add.png</normaloff>:/res/images/add.png</iconset> </property> <property name="flat"> @@ -878,7 +950,7 @@ <string notr="true"/> </property> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset> </property> <property name="flat"> @@ -913,7 +985,7 @@ <string notr="true"/> </property> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/configuration21_16.png</normaloff>:/res/images/configuration21_16.png</iconset> </property> <property name="flat"> @@ -953,7 +1025,7 @@ <string>Basic.TransitionDuration</string> </property> <property name="suffix"> - <string>ms</string> + <string> ms</string> </property> <property name="minimum"> <number>2</number> @@ -1000,7 +1072,7 @@ <attribute name="dockWidgetArea"> <number>8</number> </attribute> - <widget class="QWidget" name="dockWidgetContents_3"> + <widget class="QWidget" name="controlsDockContents"> <layout class="QVBoxLayout" name="buttonsVLayout"> <property name="spacing"> <number>2</number> @@ -1037,29 +1109,48 @@ </widget> </item> <item> - <widget class="QPushButton" name="recordButton"> - <property name="enabled"> - <bool>true</bool> + <layout class="QHBoxLayout" name="recordingLayout"> + <property name="spacing"> + <number>2</number> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="leftMargin"> + <number>0</number> </property> - <property name="minimumSize"> - <size> - <width>130</width> - <height>0</height> - </size> + <property name="topMargin"> + <number>0</number> </property> - <property name="text"> - <string>Basic.Main.StartRecording</string> + <property name="rightMargin"> + <number>0</number> </property> - <property name="checkable"> - <bool>true</bool> + <property name="bottomMargin"> + <number>0</number> </property> - </widget> + <item> + <widget class="RecordButton" name="recordButton"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>130</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Basic.Main.StartRecording</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> </item> <item> <widget class="QPushButton" name="modeSwitch"> @@ -1115,7 +1206,7 @@ </widget> <action name="actionAddScene"> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/add.png</normaloff>:/res/images/add.png</iconset> </property> <property name="text"> @@ -1127,7 +1218,7 @@ </action> <action name="actionAddSource"> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/add.png</normaloff>:/res/images/add.png</iconset> </property> <property name="text"> @@ -1139,7 +1230,7 @@ </action> <action name="actionRemoveScene"> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset> </property> <property name="text"> @@ -1157,7 +1248,7 @@ </action> <action name="actionRemoveSource"> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/list_remove.png</normaloff>:/res/images/list_remove.png</iconset> </property> <property name="text"> @@ -1178,7 +1269,7 @@ <bool>true</bool> </property> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/properties.png</normaloff>:/res/images/properties.png</iconset> </property> <property name="text"> @@ -1190,7 +1281,7 @@ </action> <action name="actionSceneUp"> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/up.png</normaloff>:/res/images/up.png</iconset> </property> <property name="text"> @@ -1205,7 +1296,7 @@ <bool>true</bool> </property> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/up.png</normaloff>:/res/images/up.png</iconset> </property> <property name="text"> @@ -1217,7 +1308,7 @@ </action> <action name="actionSceneDown"> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/down.png</normaloff>:/res/images/down.png</iconset> </property> <property name="text"> @@ -1232,7 +1323,7 @@ <bool>true</bool> </property> <property name="icon"> - <iconset resource="obs.qrc"> + <iconset> <normaloff>:/res/images/down.png</normaloff>:/res/images/down.png</iconset> </property> <property name="text"> @@ -1733,6 +1824,11 @@ <header>window-dock.hpp</header> <container>1</container> </customwidget> + <customwidget> + <class>RecordButton</class> + <extends>QPushButton</extends> + <header>record-button.hpp</header> + </customwidget> </customwidgets> <resources> <include location="obs.qrc"/>
View file
obs-studio-23.2.1.tar.xz/UI/forms/OBSBasicSettings.ui -> obs-studio-24.0.0.tar.xz/UI/forms/OBSBasicSettings.ui
Changed
@@ -138,7 +138,7 @@ <item> <widget class="QScrollArea" name="scrollArea_2"> <property name="frameShape"> - <enum>QFrame::NoFrame</enum> + <enum>QFrame::NoFrame</enum> </property> <property name="frameShadow"> <enum>QFrame::Plain</enum> @@ -151,8 +151,8 @@ <rect> <x>0</x> <y>0</y> - <width>808</width> - <height>989</height> + <width>803</width> + <height>977</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_19"> @@ -291,13 +291,20 @@ </widget> </item> <item row="2" column="1"> + <widget class="QCheckBox" name="warnBeforeRecordStop"> + <property name="text"> + <string>Basic.Settings.General.WarnBeforeStoppingRecord</string> + </property> + </widget> + </item> + <item row="3" column="1"> <widget class="QCheckBox" name="recordWhenStreaming"> <property name="text"> <string>Basic.Settings.General.RecordWhenStreaming</string> </property> </widget> </item> - <item row="3" column="1"> + <item row="4" column="1"> <widget class="QCheckBox" name="keepRecordStreamStops"> <property name="enabled"> <bool>false</bool> @@ -307,14 +314,14 @@ </property> </widget> </item> - <item row="4" column="1"> + <item row="5" column="1"> <widget class="QCheckBox" name="replayWhileStreaming"> <property name="text"> <string>Basic.Settings.General.ReplayBufferWhileStreaming</string> </property> </widget> </item> - <item row="5" column="1"> + <item row="6" column="1"> <widget class="QCheckBox" name="keepReplayStreamStops"> <property name="enabled"> <bool>false</bool> @@ -1159,22 +1166,22 @@ </property> <item> <widget class="QScrollArea" name="scrollArea_3"> - <property name="widgetResizable"> - <bool>true</bool> - </property> <property name="frameShape"> - <enum>QFrame::NoFrame</enum> + <enum>QFrame::NoFrame</enum> </property> <property name="frameShadow"> <enum>QFrame::Plain</enum> </property> + <property name="widgetResizable"> + <bool>true</bool> + </property> <widget class="QWidget" name="scrollAreaWidgetContents_3"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>747</width> - <height>808</height> + <width>601</width> + <height>631</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_21"> @@ -3511,7 +3518,7 @@ <item row="0" column="1"> <widget class="QSpinBox" name="advRBSecMax"> <property name="suffix"> - <string notr="true"> sec</string> + <string notr="true"> s</string> </property> <property name="minimum"> <number>5</number> @@ -3608,21 +3615,7 @@ <item> <widget class="QScrollArea" name="scrollArea_50"> <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>594</width> - <height>807</height> - </rect> + <enum>QFrame::NoFrame</enum> </property> <property name="frameShadow"> <enum>QFrame::Plain</enum> @@ -3635,8 +3628,8 @@ <rect> <x>0</x> <y>0</y> - <width>594</width> - <height>807</height> + <width>555</width> + <height>469</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_50"> @@ -4064,7 +4057,7 @@ </widget> </widget> </item> - <item row="11" column="1"> + <item> <widget class="QLabel" name="audioMsg"> <property name="text"> <string notr="true"/> @@ -4077,7 +4070,7 @@ </property> </widget> </item> - <item row="12" column="1"> + <item> <widget class="QLabel" name="audioMsg_2"> <property name="text"> <string notr="true"/> @@ -4451,8 +4444,8 @@ <rect> <x>0</x> <y>0</y> - <width>765</width> - <height>993</height> + <width>803</width> + <height>781</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_23"> @@ -4895,7 +4888,7 @@ </size> </property> <property name="suffix"> - <string notr="true">s</string> + <string notr="true"> s</string> </property> <property name="minimum"> <number>1</number> @@ -4989,6 +4982,9 @@ </property> <item> <widget class="QSpinBox" name="reconnectRetryDelay"> + <property name="suffix"> + <string> s</string> + </property> <property name="maximum"> <number>30</number> </property> @@ -5076,14 +5072,14 @@ <item row="0" column="1"> <widget class="QComboBox" name="bindToIP"/> </item> - <item row="1" column="1"> + <item row="2" column="1"> <widget class="QCheckBox" name="enableNewSocketLoop"> <property name="text"> <string>Basic.Settings.Advanced.Network.EnableNewSocketLoop</string> </property> </widget> </item> - <item row="2" column="1"> + <item row="3" column="1"> <widget class="QCheckBox" name="enableLowLatencyMode"> <property name="enabled"> <bool>false</bool> @@ -5093,7 +5089,7 @@ </property> </widget> </item> - <item row="1" column="0"> + <item row="2" column="0"> <spacer name="horizontalSpacer_7"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -5101,11 +5097,21 @@ <property name="sizeHint" stdset="0"> <size> <width>170</width> - <height>20</height> + <height>1</height> </size> </property> </spacer> </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="dynBitrate"> + <property name="toolTip"> + <string>Basic.Settings.Output.DynamicBitrate.TT</string> + </property> + <property name="text"> + <string>Basic.Settings.Output.DynamicBitrate.Beta</string> + </property> + </widget> + </item> </layout> </widget> </item> @@ -5147,17 +5153,23 @@ <string>Basic.Settings.Hotkeys</string> </property> <layout class="QFormLayout" name="formLayout_33"> + <property name="labelAlignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> <property name="topMargin"> <number>2</number> </property> - <item row="0" column="1"> - <widget class="QCheckBox" name="disableFocusHotkeys"> + <item row="0" column="0"> + <widget class="QLabel" name="label_21"> <property name="text"> - <string>Basic.Settings.Advanced.Hotkeys.DisableHotkeysInFocus</string> + <string>Basic.Settings.Advanced.Hotkeys.HotkeyFocusBehavior</string> </property> </widget> </item> - <item row="0" column="0"> + <item row="0" column="1"> + <widget class="QComboBox" name="hotkeyFocusType"/> + </item> + <item row="1" column="0"> <spacer name="horizontalSpacer_14"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -5165,7 +5177,7 @@ <property name="sizeHint" stdset="0"> <size> <width>170</width> - <height>20</height> + <height>0</height> </size> </property> </spacer> @@ -5246,6 +5258,7 @@ <tabstop>openStatsOnStartup</tabstop> <tabstop>warnBeforeStreamStart</tabstop> <tabstop>warnBeforeStreamStop</tabstop> + <tabstop>warnBeforeRecordStop</tabstop> <tabstop>recordWhenStreaming</tabstop> <tabstop>keepRecordStreamStops</tabstop> <tabstop>replayWhileStreaming</tabstop> @@ -5410,7 +5423,6 @@ <tabstop>enableNewSocketLoop</tabstop> <tabstop>enableLowLatencyMode</tabstop> <tabstop>browserHWAccel</tabstop> - <tabstop>disableFocusHotkeys</tabstop> </tabstops> <resources> <include location="obs.qrc"/>
View file
obs-studio-24.0.0.tar.xz/UI/forms/OBSExtraBrowsers.ui
Added
@@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>OBSExtraBrowsers</class> + <widget class="QWidget" name="OBSExtraBrowsers"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>785</width> + <height>353</height> + </rect> + </property> + <property name="windowTitle"> + <string>ExtraBrowsers</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>ExtraBrowsers.Info</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QTableView" name="table"> + <property name="selectionMode"> + <enum>QAbstractItemView::NoSelection</enum> + </property> + <attribute name="horizontalHeaderDefaultSectionSize"> + <number>23</number> + </attribute> + <attribute name="horizontalHeaderMinimumSectionSize"> + <number>23</number> + </attribute> + <attribute name="verticalHeaderVisible"> + <bool>false</bool> + </attribute> + <attribute name="verticalHeaderDefaultSectionSize"> + <number>23</number> + </attribute> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="apply"> + <property name="text"> + <string>Apply</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="close"> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>close</sender> + <signal>clicked()</signal> + <receiver>OBSExtraBrowsers</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel"> + <x>520</x> + <y>286</y> + </hint> + <hint type="destinationlabel"> + <x>435</x> + <y>-19</y> + </hint> + </hints> + </connection> + </connections> +</ui>
View file
obs-studio-24.0.0.tar.xz/UI/forms/images/media-pause.svg
Added
@@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8" fill="#000000"> + <path d="M0 0v6h2v-6h-2zm4 0v6h2v-6h-2z" transform="translate(1 1)" /> +</svg>
View file
obs-studio-23.2.1.tar.xz/UI/forms/obs.qrc -> obs-studio-24.0.0.tar.xz/UI/forms/obs.qrc
Changed
@@ -1,5 +1,6 @@ <RCC> <qresource prefix="/res"> + <file>images/media-pause.svg</file> <file>images/mute.svg</file> <file>images/refresh.svg</file> <file>images/no_sources.svg</file>
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.cpp
Changed
@@ -5,8 +5,7 @@ #include "decklink-ui-main.h" DecklinkOutputUI::DecklinkOutputUI(QWidget *parent) - : QDialog(parent), - ui(new Ui_Output) + : QDialog(parent), ui(new Ui_Output) { ui->setupUi(this); @@ -20,8 +19,10 @@ connect(ui->startOutput, SIGNAL(released()), this, SLOT(StartOutput())); connect(ui->stopOutput, SIGNAL(released()), this, SLOT(StopOutput())); - connect(ui->startPreviewOutput, SIGNAL(released()), this, SLOT(StartPreviewOutput())); - connect(ui->stopPreviewOutput, SIGNAL(released()), this, SLOT(StopPreviewOutput())); + connect(ui->startPreviewOutput, SIGNAL(released()), this, + SLOT(StartPreviewOutput())); + connect(ui->stopPreviewOutput, SIGNAL(released()), this, + SLOT(StopPreviewOutput())); } void DecklinkOutputUI::ShowHideDialog() @@ -43,25 +44,26 @@ if (data) obs_data_apply(settings, data); - propertiesView = new OBSPropertiesView(settings, - "decklink_output", - (PropertiesReloadCallback) obs_get_output_properties, - 170); + propertiesView = new OBSPropertiesView( + settings, "decklink_output", + (PropertiesReloadCallback)obs_get_output_properties, 170); ui->propertiesLayout->addWidget(propertiesView); obs_data_release(settings); - connect(propertiesView, SIGNAL(Changed()), this, SLOT(PropertiesChanged())); + connect(propertiesView, SIGNAL(Changed()), this, + SLOT(PropertiesChanged())); } void DecklinkOutputUI::SaveSettings() { - BPtr<char> modulePath = obs_module_get_config_path(obs_current_module(), ""); + BPtr<char> modulePath = + obs_module_get_config_path(obs_current_module(), ""); os_mkdirs(modulePath); - BPtr<char> path = obs_module_get_config_path(obs_current_module(), - "decklinkOutputProps.json"); + BPtr<char> path = obs_module_get_config_path( + obs_current_module(), "decklinkOutputProps.json"); obs_data_t *settings = propertiesView->GetSettings(); if (settings) @@ -79,15 +81,15 @@ if (data) obs_data_apply(settings, data); - previewPropertiesView = new OBSPropertiesView(settings, - "decklink_output", - (PropertiesReloadCallback) obs_get_output_properties, - 170); + previewPropertiesView = new OBSPropertiesView( + settings, "decklink_output", + (PropertiesReloadCallback)obs_get_output_properties, 170); ui->previewPropertiesLayout->addWidget(previewPropertiesView); obs_data_release(settings); - connect(previewPropertiesView, SIGNAL(Changed()), this, SLOT(PreviewPropertiesChanged())); + connect(previewPropertiesView, SIGNAL(Changed()), this, + SLOT(PreviewPropertiesChanged())); } void DecklinkOutputUI::SavePreviewSettings() @@ -96,15 +98,14 @@ os_mkdirs(modulePath); - char *path = obs_module_get_config_path(obs_current_module(), - "decklinkPreviewOutputProps.json"); + char *path = obs_module_get_config_path( + obs_current_module(), "decklinkPreviewOutputProps.json"); obs_data_t *settings = previewPropertiesView->GetSettings(); if (settings) obs_data_save_json_safe(settings, path, "tmp", "bak"); } - void DecklinkOutputUI::StartOutput() { SaveSettings(); @@ -121,7 +122,6 @@ SaveSettings(); } - void DecklinkOutputUI::StartPreviewOutput() { SavePreviewSettings();
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.h -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/decklink-output-ui/DecklinkOutputUI.h
Changed
@@ -6,7 +6,7 @@ #include "../../UI/properties-view.hpp" class DecklinkOutputUI : public QDialog { -Q_OBJECT + Q_OBJECT private: OBSPropertiesView *propertiesView; OBSPropertiesView *previewPropertiesView;
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/decklink-output-ui/decklink-ui-main.cpp
Changed
@@ -37,8 +37,8 @@ OBSData load_settings() { - BPtr<char> path = obs_module_get_config_path(obs_current_module(), - "decklinkOutputProps.json"); + BPtr<char> path = obs_module_get_config_path( + obs_current_module(), "decklinkOutputProps.json"); BPtr<char> jsonData = os_quick_read_utf8_file(path); if (!!jsonData) { obs_data_t *data = obs_data_create_from_json(jsonData); @@ -57,8 +57,9 @@ OBSData settings = load_settings(); if (settings != nullptr) { - output = obs_output_create("decklink_output", - "decklink_output", settings, NULL); + output = obs_output_create("decklink_output", + "decklink_output", settings, + NULL); obs_output_start(output); obs_data_release(settings); @@ -77,11 +78,10 @@ } } - OBSData load_preview_settings() { - BPtr<char> path = obs_module_get_config_path(obs_current_module(), - "decklinkPreviewOutputProps.json"); + BPtr<char> path = obs_module_get_config_path( + obs_current_module(), "decklinkPreviewOutputProps.json"); BPtr<char> jsonData = os_quick_read_utf8_file(path); if (!!jsonData) { obs_data_t *data = obs_data_create_from_json(jsonData); @@ -103,8 +103,9 @@ OBSData settings = load_preview_settings(); if (settings != nullptr) { - context.output = obs_output_create("decklink_output", - "decklink_preview_output", settings, NULL); + context.output = obs_output_create( + "decklink_output", "decklink_preview_output", + settings, NULL); obs_get_video_info(&context.ovi); @@ -112,11 +113,14 @@ uint32_t height = context.ovi.base_height; obs_enter_graphics(); - context.texrender = gs_texrender_create(GS_BGRA, GS_ZS_NONE); - context.stagesurface = gs_stagesurface_create(width, height, GS_BGRA); + context.texrender = + gs_texrender_create(GS_BGRA, GS_ZS_NONE); + context.stagesurface = + gs_stagesurface_create(width, height, GS_BGRA); obs_leave_graphics(); - const video_output_info *mainVOI = video_output_get_info(obs_get_video()); + const video_output_info *mainVOI = + video_output_get_info(obs_get_video()); video_output_info vi = {0}; vi.format = VIDEO_FORMAT_BGRA; @@ -131,15 +135,21 @@ video_output_open(&context.video_queue, &vi); - obs_frontend_add_event_callback(on_preview_scene_changed, &context); + obs_frontend_add_event_callback( + on_preview_scene_changed, &context); if (obs_frontend_preview_program_mode_active()) { - context.current_source = obs_frontend_get_current_preview_scene(); + context.current_source = + obs_frontend_get_current_preview_scene(); } else { - context.current_source = obs_frontend_get_current_scene(); + context.current_source = + obs_frontend_get_current_scene(); } - obs_add_main_render_callback(render_preview_source, &context); + obs_add_main_render_callback(render_preview_source, + &context); - obs_output_set_media(context.output, context.video_queue, obs_get_audio()); + obs_output_set_media(context.output, + context.video_queue, + obs_get_audio()); obs_output_start(context.output); preview_output_running = true; @@ -153,8 +163,10 @@ obs_output_stop(context.output); video_output_stop(context.video_queue); - obs_remove_main_render_callback(render_preview_source, &context); - obs_frontend_remove_event_callback(on_preview_scene_changed, &context); + obs_remove_main_render_callback(render_preview_source, + &context); + obs_frontend_remove_event_callback(on_preview_scene_changed, + &context); obs_source_release(context.current_source); @@ -171,33 +183,37 @@ void on_preview_scene_changed(enum obs_frontend_event event, void *param) { - auto ctx = (struct preview_output*)param; + auto ctx = (struct preview_output *)param; switch (event) { - case OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED: - case OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED: - obs_source_release(ctx->current_source); - ctx->current_source = obs_frontend_get_current_preview_scene(); - break; - case OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED: + case OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED: + case OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED: + obs_source_release(ctx->current_source); + ctx->current_source = obs_frontend_get_current_preview_scene(); + break; + case OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED: + obs_source_release(ctx->current_source); + ctx->current_source = obs_frontend_get_current_scene(); + break; + case OBS_FRONTEND_EVENT_SCENE_CHANGED: + if (!obs_frontend_preview_program_mode_active()) { obs_source_release(ctx->current_source); ctx->current_source = obs_frontend_get_current_scene(); - break; - case OBS_FRONTEND_EVENT_SCENE_CHANGED: - if (!obs_frontend_preview_program_mode_active()) { - obs_source_release(ctx->current_source); - ctx->current_source = obs_frontend_get_current_scene(); - } - break; - default: - break; + } + break; + default: + break; } } void render_preview_source(void *param, uint32_t cx, uint32_t cy) { - auto ctx = (struct preview_output*)param; + UNUSED_PARAMETER(cx); + UNUSED_PARAMETER(cy); + + auto ctx = (struct preview_output *)param; - if (!ctx->current_source) return; + if (!ctx->current_source) + return; uint32_t width = obs_source_get_base_width(ctx->current_source); uint32_t height = obs_source_get_base_height(ctx->current_source); @@ -209,7 +225,8 @@ vec4_zero(&background); gs_clear(GS_CLEAR_COLOR, &background, 0.0f, 0); - gs_ortho(0.0f, (float)width, 0.0f, (float)height, -100.0f, 100.0f); + gs_ortho(0.0f, (float)width, 0.0f, (float)height, -100.0f, + 100.0f); gs_blend_state_push(); gs_blend_function(GS_BLEND_ONE, GS_BLEND_ZERO); @@ -220,18 +237,25 @@ gs_texrender_end(ctx->texrender); struct video_frame output_frame; - if (video_output_lock_frame(ctx->video_queue, &output_frame, 1, os_gettime_ns())) - { - gs_stage_texture(ctx->stagesurface, gs_texrender_get_texture(ctx->texrender)); - - if (gs_stagesurface_map(ctx->stagesurface, &ctx->video_data, &ctx->video_linesize)) { + if (video_output_lock_frame(ctx->video_queue, &output_frame, 1, + os_gettime_ns())) { + gs_stage_texture( + ctx->stagesurface, + gs_texrender_get_texture(ctx->texrender)); + + if (gs_stagesurface_map(ctx->stagesurface, + &ctx->video_data, + &ctx->video_linesize)) { uint32_t linesize = output_frame.linesize[0]; - for (uint32_t i = 0; i < ctx->ovi.base_height; i++) { + for (uint32_t i = 0; i < ctx->ovi.base_height; + i++) { uint32_t dst_offset = linesize * i; - uint32_t src_offset = ctx->video_linesize * i; - memcpy(output_frame.data[0] + dst_offset, - ctx->video_data + src_offset, - linesize); + uint32_t src_offset = + ctx->video_linesize * i; + memcpy(output_frame.data[0] + + dst_offset, + ctx->video_data + src_offset, + linesize); } gs_stagesurface_unmap(ctx->stagesurface); @@ -245,18 +269,16 @@ void addOutputUI(void) { - QAction *action = (QAction*)obs_frontend_add_tools_menu_qaction( - obs_module_text("Decklink Output")); + QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction( + obs_module_text("Decklink Output")); - QMainWindow *window = (QMainWindow*)obs_frontend_get_main_window(); + QMainWindow *window = (QMainWindow *)obs_frontend_get_main_window(); obs_frontend_push_ui_translation(obs_module_get_string); doUI = new DecklinkOutputUI(window); obs_frontend_pop_ui_translation(); - auto cb = []() { - doUI->ShowHideDialog(); - }; + auto cb = []() { doUI->ShowHideDialog(); }; action->connect(action, &QAction::triggered, cb); } @@ -271,7 +293,8 @@ OBSData previewSettings = load_preview_settings(); - if (previewSettings && obs_data_get_bool(previewSettings, "auto_start")) + if (previewSettings && + obs_data_get_bool(previewSettings, "auto_start")) preview_output_start(); } }
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/decklink-output-ui/forms/output.ui -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/decklink-output-ui/forms/output.ui
Changed
@@ -115,7 +115,7 @@ </layout> </item> <item> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="keyerLabel"> <property name="text"> <string>Keyer output requires RGB mode in advanced settings.</string> </property>
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/auto-scene-switcher-nix.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/auto-scene-switcher-nix.cpp
Changed
@@ -17,7 +17,7 @@ using namespace std; -static Display* xdisplay = 0; +static Display *xdisplay = 0; Display *disp() { @@ -39,31 +39,22 @@ static bool ewmhIsSupported() { Display *display = disp(); - Atom netSupportingWmCheck = XInternAtom(display, - "_NET_SUPPORTING_WM_CHECK", true); + Atom netSupportingWmCheck = + XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", true); Atom actualType; int format = 0; unsigned long num = 0, bytes = 0; unsigned char *data = NULL; Window ewmh_window = 0; - int status = XGetWindowProperty( - display, - DefaultRootWindow(display), - netSupportingWmCheck, - 0L, - 1L, - false, - XA_WINDOW, - &actualType, - &format, - &num, - &bytes, - &data); + int status = XGetWindowProperty(display, DefaultRootWindow(display), + netSupportingWmCheck, 0L, 1L, false, + XA_WINDOW, &actualType, &format, &num, + &bytes, &data); if (status == Success) { if (num > 0) { - ewmh_window = ((Window*)data)[0]; + ewmh_window = ((Window *)data)[0]; } if (data) { XFree(data); @@ -72,21 +63,12 @@ } if (ewmh_window) { - status = XGetWindowProperty( - display, - ewmh_window, - netSupportingWmCheck, - 0L, - 1L, - false, - XA_WINDOW, - &actualType, - &format, - &num, - &bytes, - &data); + status = XGetWindowProperty(display, ewmh_window, + netSupportingWmCheck, 0L, 1L, false, + XA_WINDOW, &actualType, &format, + &num, &bytes, &data); if (status != Success || num == 0 || - ewmh_window != ((Window*)data)[0]) { + ewmh_window != ((Window *)data)[0]) { ewmh_window = 0; } if (status == Success && data) { @@ -111,24 +93,15 @@ Atom actualType; int format; unsigned long num, bytes; - Window* data = 0; + Window *data = 0; for (int i = 0; i < ScreenCount(disp()); ++i) { Window rootWin = RootWindow(disp(), i); - int status = XGetWindowProperty( - disp(), - rootWin, - netClList, - 0L, - ~0L, - false, - AnyPropertyType, - &actualType, - &format, - &num, - &bytes, - (uint8_t**)&data); + int status = XGetWindowProperty(disp(), rootWin, netClList, 0L, + ~0L, false, AnyPropertyType, + &actualType, &format, &num, + &bytes, (uint8_t **)&data); if (status != Success) { continue; @@ -147,11 +120,10 @@ { Window w = getTopLevelWindows().at(i); std::string windowTitle; - char* name; + char *name; int status = XFetchName(disp(), w, &name); - if (status >= Success && name != nullptr) - { + if (status >= Success && name != nullptr) { std::string str(name); windowTitle = str; } @@ -165,7 +137,7 @@ { windows.resize(0); - for (size_t i = 0; i < getTopLevelWindows().size(); ++i){ + for (size_t i = 0; i < getTopLevelWindows().size(); ++i) { if (GetWindowTitle(i) != "") windows.emplace_back(GetWindowTitle(i)); } @@ -181,24 +153,14 @@ Atom actualType; int format; unsigned long num, bytes; - Window* data = 0; - char* name; + Window *data = 0; + char *name; Window rootWin = RootWindow(disp(), 0); - XGetWindowProperty( - disp(), - rootWin, - active, - 0L, - ~0L, - false, - AnyPropertyType, - &actualType, - &format, - &num, - &bytes, - (uint8_t**)&data); + XGetWindowProperty(disp(), rootWin, active, 0L, ~0L, false, + AnyPropertyType, &actualType, &format, &num, &bytes, + (uint8_t **)&data); int status = XFetchName(disp(), data[0], &name);
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/auto-scene-switcher-win.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/auto-scene-switcher-win.cpp
Changed
@@ -32,7 +32,7 @@ return false; GetClientRect(window, &rect); - styles = GetWindowLongPtr(window, GWL_STYLE); + styles = GetWindowLongPtr(window, GWL_STYLE); ex_styles = GetWindowLongPtr(window, GWL_EXSTYLE); if (ex_styles & WS_EX_TOOLWINDOW)
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/auto-scene-switcher.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/auto-scene-switcher.cpp
Changed
@@ -69,23 +69,19 @@ } } - inline ~SwitcherData() - { - Stop(); - } + inline ~SwitcherData() { Stop(); } }; static SwitcherData *switcher = nullptr; static inline QString MakeSwitchName(const QString &scene, - const QString &window) + const QString &window) { return QStringLiteral("[") + scene + QStringLiteral("]: ") + window; } SceneSwitcher::SceneSwitcher(QWidget *parent) - : QDialog(parent), - ui(new Ui_SceneSwitcher) + : QDialog(parent), ui(new Ui_SceneSwitcher) { ui->setupUi(this); @@ -95,7 +91,7 @@ switcher->Prune(); - BPtr<char*> scenes = obs_frontend_get_scene_names(); + BPtr<char *> scenes = obs_frontend_get_scene_names(); char **temp = scenes; while (*temp) { const char *name = *temp; @@ -110,7 +106,7 @@ ui->noMatchDontSwitch->setChecked(true); ui->noMatchSwitchScene->setCurrentText( - GetWeakSourceName(switcher->nonMatchingScene).c_str()); + GetWeakSourceName(switcher->nonMatchingScene).c_str()); ui->checkInterval->setValue(switcher->interval); vector<string> windows; @@ -121,11 +117,10 @@ for (auto &s : switcher->switches) { string sceneName = GetWeakSourceName(s.scene); - QString text = MakeSwitchName(sceneName.c_str(), - s.window.c_str()); + QString text = + MakeSwitchName(sceneName.c_str(), s.window.c_str()); - QListWidgetItem *item = new QListWidgetItem(text, - ui->switches); + QListWidgetItem *item = new QListWidgetItem(text, ui->switches); item->setData(Qt::UserRole, s.window.c_str()); } @@ -137,7 +132,7 @@ loading = false; } -void SceneSwitcher::closeEvent(QCloseEvent*) +void SceneSwitcher::closeEvent(QCloseEvent *) { obs_frontend_save(); } @@ -149,8 +144,7 @@ for (int i = 0; i < count; i++) { QListWidgetItem *item = ui->switches->item(i); - QString itemWindow = - item->data(Qt::UserRole).toString(); + QString itemWindow = item->data(Qt::UserRole).toString(); if (itemWindow == window) { idx = i; @@ -206,16 +200,16 @@ if (idx == -1) { try { lock_guard<mutex> lock(switcher->m); - switcher->switches.emplace_back(source, - windowName.toUtf8().constData()); - - QListWidgetItem *item = new QListWidgetItem(text, - ui->switches); + switcher->switches.emplace_back( + source, windowName.toUtf8().constData()); + + QListWidgetItem *item = + new QListWidgetItem(text, ui->switches); item->setData(Qt::UserRole, v); } catch (const regex_error &) { - QMessageBox::warning(this, - obs_module_text("InvalidRegex.Title"), - obs_module_text("InvalidRegex.Text")); + QMessageBox::warning( + this, obs_module_text("InvalidRegex.Title"), + obs_module_text("InvalidRegex.Text")); } } else { QListWidgetItem *item = ui->switches->item(idx); @@ -274,8 +268,7 @@ void SceneSwitcher::UpdateNonMatchingScene(const QString &name) { - obs_source_t *scene = obs_get_source_by_name( - name.toUtf8().constData()); + obs_source_t *scene = obs_get_source_by_name(name.toUtf8().constData()); obs_weak_source_t *ws = obs_source_get_weak_source(scene); switcher->nonMatchingScene = ws; @@ -303,8 +296,7 @@ UpdateNonMatchingScene(ui->noMatchSwitchScene->currentText()); } -void SceneSwitcher::on_noMatchSwitchScene_currentTextChanged( - const QString &text) +void SceneSwitcher::on_noMatchSwitchScene_currentTextChanged(const QString &text) { if (loading) return; @@ -357,13 +349,13 @@ for (SceneSwitch &s : switcher->switches) { obs_data_t *array_obj = obs_data_create(); - obs_source_t *source = obs_weak_source_get_source( - s.scene); + obs_source_t *source = + obs_weak_source_get_source(s.scene); if (source) { const char *n = obs_source_get_name(source); obs_data_set_string(array_obj, "scene", n); obs_data_set_string(array_obj, "window_title", - s.window.c_str()); + s.window.c_str()); obs_data_array_push_back(array, array_obj); obs_source_release(source); } @@ -376,9 +368,9 @@ obs_data_set_int(obj, "interval", switcher->interval); obs_data_set_string(obj, "non_matching_scene", - nonMatchingSceneName.c_str()); + nonMatchingSceneName.c_str()); obs_data_set_bool(obj, "switch_if_not_matching", - switcher->switchIfNotMatching); + switcher->switchIfNotMatching); obs_data_set_bool(obj, "active", switcher->th.joinable()); obs_data_set_array(obj, "switches", array); @@ -389,8 +381,8 @@ } else { switcher->m.lock(); - obs_data_t *obj = obs_data_get_obj(save_data, - "auto-scene-switcher"); + obs_data_t *obj = + obs_data_get_obj(save_data, "auto-scene-switcher"); obs_data_array_t *array = obs_data_get_array(obj, "switches"); size_t count = obs_data_array_count(array); @@ -420,8 +412,7 @@ obs_data_get_string(array_obj, "window_title"); switcher->switches.emplace_back( - GetWeakSourceByName(scene), - window); + GetWeakSourceByName(scene), window); obs_data_release(array_obj); } @@ -476,18 +467,18 @@ for (SceneSwitch &s : switches) { try { bool matches = regex_match( - title, s.re); + title, s.re); if (matches) { match = true; scene = s.scene; break; } - } catch (const regex_error &) {} + } catch (const regex_error &) { + } } } - if (!match && switchIfNotMatching && - nonMatchingScene) { + if (!match && switchIfNotMatching && nonMatchingScene) { match = true; scene = nonMatchingScene; } @@ -513,7 +504,7 @@ void SwitcherData::Start() { if (!switcher->th.joinable()) - switcher->th = thread([] () {switcher->Thread();}); + switcher->th = thread([]() { switcher->Thread(); }); } void SwitcherData::Stop() @@ -542,17 +533,16 @@ extern "C" void InitSceneSwitcher() { - QAction *action = (QAction*)obs_frontend_add_tools_menu_qaction( - obs_module_text("SceneSwitcher")); + QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction( + obs_module_text("SceneSwitcher")); switcher = new SwitcherData; - auto cb = [] () - { + auto cb = []() { obs_frontend_push_ui_translation(obs_module_get_string); QMainWindow *window = - (QMainWindow*)obs_frontend_get_main_window(); + (QMainWindow *)obs_frontend_get_main_window(); SceneSwitcher ss(window); ss.exec();
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/captions-handler.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/captions-handler.cpp
Changed
@@ -1,33 +1,24 @@ #include "captions-handler.hpp" -captions_handler::captions_handler( - captions_cb callback, - enum audio_format format, - uint32_t sample_rate) +captions_handler::captions_handler(captions_cb callback, + enum audio_format format, + uint32_t sample_rate) : cb(callback) { if (!reset_resampler(format, sample_rate)) throw CAPTIONS_ERROR_GENERIC_FAIL; } -bool captions_handler::reset_resampler( - enum audio_format format, - uint32_t sample_rate) +bool captions_handler::reset_resampler(enum audio_format format, + uint32_t sample_rate) try { obs_audio_info ai; if (!obs_get_audio_info(&ai)) throw std::string("Failed to get OBS audio info"); - resample_info src = { - ai.samples_per_sec, - AUDIO_FORMAT_FLOAT_PLANAR, - ai.speakers - }; - resample_info dst = { - sample_rate, - format, - SPEAKERS_MONO - }; + resample_info src = {ai.samples_per_sec, AUDIO_FORMAT_FLOAT_PLANAR, + ai.speakers}; + resample_info dst = {sample_rate, format, SPEAKERS_MONO}; if (!resampler.reset(dst, src)) throw std::string("Failed to create audio resampler"); @@ -46,9 +37,9 @@ uint64_t ts_offset; bool success; - success = audio_resampler_resample(resampler, - out, &frames, &ts_offset, - (const uint8_t *const *)audio->data, audio->frames); + success = audio_resampler_resample(resampler, out, &frames, &ts_offset, + (const uint8_t *const *)audio->data, + audio->frames); if (success) pcm_data(out[0], frames); }
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/captions-handler.hpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/captions-handler.hpp
Changed
@@ -9,10 +9,7 @@ audio_resampler_t *resampler = nullptr; public: - inline ~resampler_obj() - { - audio_resampler_destroy(resampler); - } + inline ~resampler_obj() { audio_resampler_destroy(resampler); } inline bool reset(const resample_info &dst, const resample_info &src) { @@ -21,15 +18,15 @@ return !!resampler; } - inline operator audio_resampler_t*() {return resampler;} + inline operator audio_resampler_t *() { return resampler; } }; /* ------------------------------------------------------------------------- */ -typedef std::function<void (const std::string &)> captions_cb; +typedef std::function<void(const std::string &)> captions_cb; -#define captions_error(s) std::string(obs_module_text("Captions.Error." ## s)) -#define CAPTIONS_ERROR_GENERIC_FAIL captions_error("GenericFail") +#define captions_error(s) std::string(obs_module_text("Captions.Error."##s)) +#define CAPTIONS_ERROR_GENERIC_FAIL captions_error("GenericFail") /* ------------------------------------------------------------------------- */ @@ -38,22 +35,17 @@ resampler_obj resampler; protected: - inline void callback(const std::string &text) - { - cb(text); - } + inline void callback(const std::string &text) { cb(text); } - virtual void pcm_data(const void *data, size_t frames)=0; + virtual void pcm_data(const void *data, size_t frames) = 0; /* always resamples to 1 channel */ bool reset_resampler(enum audio_format format, uint32_t sample_rate); public: /* throw std::string for errors shown to users */ - captions_handler( - captions_cb callback, - enum audio_format format, - uint32_t sample_rate); + captions_handler(captions_cb callback, enum audio_format format, + uint32_t sample_rate); virtual ~captions_handler() {} void push_audio(const audio_data *audio); @@ -62,6 +54,6 @@ /* ------------------------------------------------------------------------- */ struct captions_handler_info { - std::string (*name)(void); + std::string (*name)(void); captions_handler *(*create)(captions_cb cb, const std::string &lang); };
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/captions-mssapi-stream.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/captions-mssapi-stream.cpp
Changed
@@ -8,16 +8,17 @@ using namespace std; #if 0 -#define debugfunc(format, ...) blog(LOG_DEBUG, "[Captions] %s(" format ")", \ - __FUNCTION__, ##__VA_ARGS__) +#define debugfunc(format, ...) \ + blog(LOG_DEBUG, "[Captions] %s(" format ")", __FUNCTION__, \ + ##__VA_ARGS__) #else #define debugfunc(format, ...) #endif -CaptionStream::CaptionStream(DWORD samplerate_, mssapi_captions *handler_) : - handler(handler_), - samplerate(samplerate_), - event(CreateEvent(nullptr, false, false, nullptr)) +CaptionStream::CaptionStream(DWORD samplerate_, mssapi_captions *handler_) + : handler(handler_), + samplerate(samplerate_), + event(CreateEvent(nullptr, false, false, nullptr)) { buf_info.ulMsMinNotification = 50; buf_info.ulMsBufferSize = 500; @@ -66,15 +67,15 @@ } else if (riid == IID_IStream) { AddRef(); - *ppv = (IStream*)this; + *ppv = (IStream *)this; } else if (riid == IID_ISpStreamFormat) { AddRef(); - *ppv = (ISpStreamFormat*)this; + *ppv = (ISpStreamFormat *)this; } else if (riid == IID_ISpAudio) { AddRef(); - *ppv = (ISpAudio*)this; + *ppv = (ISpAudio *)this; } else { *ppv = nullptr; @@ -134,8 +135,7 @@ return hr; } -STDMETHODIMP CaptionStream::Write(const void *, ULONG bytes, - ULONG*) +STDMETHODIMP CaptionStream::Write(const void *, ULONG bytes, ULONG *) { debugfunc("data, %lu, written_bytes", bytes); UNUSED_PARAMETER(bytes); @@ -146,7 +146,7 @@ // IStream methods STDMETHODIMP CaptionStream::Seek(LARGE_INTEGER move, DWORD origin, - ULARGE_INTEGER *new_pos) + ULARGE_INTEGER *new_pos) { debugfunc("%lld, %lx, new_pos", move, origin); UNUSED_PARAMETER(move); @@ -170,8 +170,8 @@ } STDMETHODIMP CaptionStream::CopyTo(IStream *stream, ULARGE_INTEGER bytes, - ULARGE_INTEGER *read_bytes, - ULARGE_INTEGER *written_bytes) + ULARGE_INTEGER *read_bytes, + ULARGE_INTEGER *written_bytes) { HRESULT hr; @@ -213,7 +213,7 @@ } STDMETHODIMP CaptionStream::LockRegion(ULARGE_INTEGER offset, - ULARGE_INTEGER size, DWORD type) + ULARGE_INTEGER size, DWORD type) { debugfunc("%llu, %llu, %ld", offset, size, type); UNUSED_PARAMETER(offset); @@ -224,7 +224,7 @@ } STDMETHODIMP CaptionStream::UnlockRegion(ULARGE_INTEGER offset, - ULARGE_INTEGER size, DWORD type) + ULARGE_INTEGER size, DWORD type) { debugfunc("%llu, %llu, %ld", offset, size, type); UNUSED_PARAMETER(offset); @@ -250,7 +250,7 @@ if (flag == STATFLAG_DEFAULT) { size_t byte_size = (wcslen(stat_name) + 1) * sizeof(wchar_t); - stg->pwcsName = (wchar_t*)CoTaskMemAlloc(byte_size); + stg->pwcsName = (wchar_t *)CoTaskMemAlloc(byte_size); memcpy(stg->pwcsName, stat_name, byte_size); } @@ -267,7 +267,7 @@ // ISpStreamFormat methods STDMETHODIMP CaptionStream::GetFormat(GUID *guid, - WAVEFORMATEX **co_mem_wfex_out) + WAVEFORMATEX **co_mem_wfex_out) { debugfunc("guid, co_mem_wfex_out"); @@ -282,7 +282,7 @@ void *wfex = CoTaskMemAlloc(sizeof(format)); memcpy(wfex, &format, sizeof(format)); - *co_mem_wfex_out = (WAVEFORMATEX*)wfex; + *co_mem_wfex_out = (WAVEFORMATEX *)wfex; return S_OK; } @@ -296,7 +296,7 @@ } STDMETHODIMP CaptionStream::SetFormat(REFGUID guid_ref, - const WAVEFORMATEX *wfex) + const WAVEFORMATEX *wfex) { debugfunc("guid, wfex"); if (!wfex) @@ -306,7 +306,7 @@ lock_guard<mutex> lock(m); memcpy(&format, wfex, sizeof(format)); if (!handler->reset_resampler(AUDIO_FORMAT_16BIT, - wfex->nSamplesPerSec)) + wfex->nSamplesPerSec)) return E_FAIL; /* 50 msec */ @@ -354,7 +354,7 @@ } STDMETHODIMP CaptionStream::GetDefaultFormat(GUID *format, - WAVEFORMATEX **co_mem_wfex_out) + WAVEFORMATEX **co_mem_wfex_out) { debugfunc("format, co_mem_wfex_out"); @@ -365,7 +365,7 @@ memcpy(wfex, &format, sizeof(format)); *format = SPDFID_WaveFormatEx; - *co_mem_wfex_out = (WAVEFORMATEX*)wfex; + *co_mem_wfex_out = (WAVEFORMATEX *)wfex; return S_OK; }
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/captions-mssapi-stream.hpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/captions-mssapi-stream.hpp
Changed
@@ -13,10 +13,11 @@ class CircleBuf { circlebuf buf = {}; + public: - inline ~CircleBuf() {circlebuf_free(&buf);} - inline operator circlebuf*() {return &buf;} - inline circlebuf *operator->() {return &buf;} + inline ~CircleBuf() { circlebuf_free(&buf); } + inline operator circlebuf *() { return &buf; } + inline circlebuf *operator->() { return &buf; } }; class mssapi_captions; @@ -54,38 +55,38 @@ // ISequentialStream methods STDMETHODIMP Read(void *data, ULONG bytes, ULONG *read_bytes) override; - STDMETHODIMP Write(const void *data, ULONG bytes, ULONG *written_bytes) - override; + STDMETHODIMP Write(const void *data, ULONG bytes, + ULONG *written_bytes) override; // IStream methods STDMETHODIMP Seek(LARGE_INTEGER move, DWORD origin, - ULARGE_INTEGER *new_pos) override; + ULARGE_INTEGER *new_pos) override; STDMETHODIMP SetSize(ULARGE_INTEGER new_size) override; STDMETHODIMP CopyTo(IStream *stream, ULARGE_INTEGER bytes, - ULARGE_INTEGER *read_bytes, - ULARGE_INTEGER *written_bytes) override; + ULARGE_INTEGER *read_bytes, + ULARGE_INTEGER *written_bytes) override; STDMETHODIMP Commit(DWORD commit_flags) override; STDMETHODIMP Revert(void) override; STDMETHODIMP LockRegion(ULARGE_INTEGER offset, ULARGE_INTEGER size, - DWORD type) override; + DWORD type) override; STDMETHODIMP UnlockRegion(ULARGE_INTEGER offset, ULARGE_INTEGER size, - DWORD type) override; + DWORD type) override; STDMETHODIMP Stat(STATSTG *stg, DWORD flags) override; STDMETHODIMP Clone(IStream **stream) override; // ISpStreamFormat methods - STDMETHODIMP GetFormat(GUID *guid, WAVEFORMATEX **co_mem_wfex_out) - override; + STDMETHODIMP GetFormat(GUID *guid, + WAVEFORMATEX **co_mem_wfex_out) override; // ISpAudio methods STDMETHODIMP SetState(SPAUDIOSTATE state, ULONGLONG reserved) override; - STDMETHODIMP SetFormat(REFGUID guid_ref, const WAVEFORMATEX *wfex) - override; + STDMETHODIMP SetFormat(REFGUID guid_ref, + const WAVEFORMATEX *wfex) override; STDMETHODIMP GetStatus(SPAUDIOSTATUS *status) override; STDMETHODIMP SetBufferInfo(const SPAUDIOBUFFERINFO *buf_info) override; STDMETHODIMP GetBufferInfo(SPAUDIOBUFFERINFO *buf_info) override; STDMETHODIMP GetDefaultFormat(GUID *format, - WAVEFORMATEX **co_mem_wfex_out) override; + WAVEFORMATEX **co_mem_wfex_out) override; STDMETHODIMP_(HANDLE) EventHandle(void) override; STDMETHODIMP GetVolumeLevel(ULONG *level) override; STDMETHODIMP SetVolumeLevel(ULONG level) override;
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/captions-mssapi.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/captions-mssapi.cpp
Changed
@@ -1,16 +1,13 @@ #include "captions-mssapi.hpp" -#define do_log(type, format, ...) blog(type, "[Captions] " format, \ - ##__VA_ARGS__) +#define do_log(type, format, ...) \ + blog(type, "[Captions] " format, ##__VA_ARGS__) #define error(format, ...) do_log(LOG_ERROR, format, ##__VA_ARGS__) #define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) -mssapi_captions::mssapi_captions( - captions_cb callback, - const std::string &lang) try - : captions_handler(callback, AUDIO_FORMAT_16BIT, 16000) -{ +mssapi_captions::mssapi_captions(captions_cb callback, const std::string &lang) +try : captions_handler(callback, AUDIO_FORMAT_16BIT, 16000) { HRESULT hr; std::wstring wlang; @@ -33,7 +30,7 @@ throw HRError("SpFindBestToken failed", hr); hr = CoCreateInstance(CLSID_SpInprocRecognizer, nullptr, CLSCTX_ALL, - __uuidof(ISpRecognizer), (void**)&recognizer); + __uuidof(ISpRecognizer), (void **)&recognizer); if (FAILED(hr)) throw HRError("CoCreateInstance for recognizer failed", hr); @@ -50,7 +47,7 @@ throw HRError("CreateRecoContext failed", hr); ULONGLONG interest = SPFEI(SPEI_RECOGNITION) | - SPFEI(SPEI_END_SR_STREAM); + SPFEI(SPEI_END_SR_STREAM); hr = context->SetInterest(interest, interest); if (FAILED(hr)) throw HRError("SetInterest failed", hr); @@ -80,7 +77,7 @@ throw HRError("LoadDictation failed", hr); try { - t = std::thread([this] () {main_thread();}); + t = std::thread([this]() { main_thread(); }); } catch (...) { throw "Failed to create thread"; } @@ -133,8 +130,8 @@ ISpRecoResult *result = event.RecoResult(); CoTaskMemPtr<wchar_t> text; - hr = result->GetText((ULONG)-1, (ULONG)-1, - true, &text, nullptr); + hr = result->GetText((ULONG)-1, (ULONG)-1, true, + &text, nullptr); if (FAILED(hr)) continue; @@ -168,12 +165,7 @@ } captions_handler_info mssapi_info = { - [] () -> std::string - { - return "Microsoft Speech-to-Text"; - }, - [] (captions_cb cb, const std::string &lang) -> captions_handler * - { + []() -> std::string { return "Microsoft Speech-to-Text"; }, + [](captions_cb cb, const std::string &lang) -> captions_handler * { return new mssapi_captions(cb, lang); - } -}; + }};
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/captions-mssapi.hpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/captions-mssapi.hpp
Changed
@@ -27,16 +27,16 @@ class mssapi_captions : public captions_handler { friend class CaptionStream; - ComPtr<CaptionStream> audio; + ComPtr<CaptionStream> audio; ComPtr<ISpObjectToken> token; ComPtr<ISpRecoGrammar> grammar; - ComPtr<ISpRecognizer> recognizer; + ComPtr<ISpRecognizer> recognizer; ComPtr<ISpRecoContext> context; - HANDLE notify; - WinHandle stop; - std::thread t; - bool started = false; + HANDLE notify; + WinHandle stop; + std::thread t; + bool started = false; void main_thread();
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/captions.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/captions.cpp
Changed
@@ -31,8 +31,8 @@ #include "captions-mssapi.hpp" -#define do_log(type, format, ...) blog(type, "[Captions] " format, \ - ##__VA_ARGS__) +#define do_log(type, format, ...) \ + blog(type, "[Captions] " format, ##__VA_ARGS__) #define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) #define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) @@ -48,10 +48,10 @@ unique_ptr<captions_handler> handler; LANGID lang_id = GetUserDefaultUILanguage(); - std::unordered_map<std::string, captions_handler_info&> handler_types; + std::unordered_map<std::string, captions_handler_info &> handler_types; inline void register_handler(const char *id, - captions_handler_info &info) + captions_handler_info &info) { handler_types.emplace(id, info); } @@ -60,7 +60,7 @@ void stop(); obs_captions(); - inline ~obs_captions() {stop();} + inline ~obs_captions() { stop(); } }; static obs_captions *captions = nullptr; @@ -74,9 +74,9 @@ inline locale_info() {} inline locale_info(const locale_info &) = delete; inline locale_info(locale_info &&li) - : name(std::move(li.name)), - id(li.id) - {} + : name(std::move(li.name)), id(li.id) + { + } }; static void get_valid_locale_names(vector<locale_info> &names); @@ -84,16 +84,14 @@ /* ------------------------------------------------------------------------- */ -CaptionsDialog::CaptionsDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui_CaptionsDialog) +CaptionsDialog::CaptionsDialog(QWidget *parent) + : QDialog(parent), ui(new Ui_CaptionsDialog) { ui->setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - auto cb = [this] (obs_source_t *source) - { + auto cb = [this](obs_source_t *source) { uint32_t caps = obs_source_get_output_flags(source); QString name = obs_source_get_name(source); @@ -111,8 +109,11 @@ ui->source->blockSignals(true); ui->source->addItem(QStringLiteral("")); ui->source->setCurrentIndex(0); - obs_enum_sources([] (void *data, obs_source_t *source) { - return (*static_cast<cb_t*>(data))(source);}, &cb); + obs_enum_sources( + [](void *data, obs_source_t *source) { + return (*static_cast<cb_t *>(data))(source); + }, + &cb); ui->source->blockSignals(false); for (auto &ht : captions->handler_types) { @@ -232,8 +233,8 @@ } } -static void audio_capture(void*, obs_source_t*, - const struct audio_data *audio, bool) +static void audio_capture(void *, obs_source_t *, + const struct audio_data *audio, bool) { captions->handler->push_audio(audio); } @@ -245,14 +246,13 @@ auto pair = handler_types.find(handler_id); if (pair == handler_types.end()) { - warn("Failed to find handler '%s'", - handler_id.c_str()); + warn("Failed to find handler '%s'", handler_id.c_str()); return; } if (!LCIDToLocaleName(lang_id, wname, 256, 0)) { warn("Failed to get locale name: %d", - (int)GetLastError()); + (int)GetLastError()); return; } @@ -271,24 +271,24 @@ } try { - captions_handler *h = pair->second.create(caption_text, - lang_name); + captions_handler *h = + pair->second.create(caption_text, lang_name); handler.reset(h); OBSSource s = OBSGetStrongRef(source); - obs_source_add_audio_capture_callback(s, - audio_capture, nullptr); + obs_source_add_audio_capture_callback(s, audio_capture, + nullptr); } catch (std::string text) { QWidget *window = - (QWidget*)obs_frontend_get_main_window(); + (QWidget *)obs_frontend_get_main_window(); warn("Failed to create handler: %s", text.c_str()); - QMessageBox::warning(window, + QMessageBox::warning( + window, obs_module_text("Captions.Error.GenericFail"), text.c_str()); - } } } @@ -297,8 +297,8 @@ { OBSSource s = OBSGetStrongRef(source); if (s) - obs_source_remove_audio_capture_callback(s, - audio_capture, nullptr); + obs_source_remove_audio_capture_callback(s, audio_capture, + nullptr); handler.reset(); } @@ -332,42 +332,18 @@ char locale_name[256]; static const LANGID default_locales[] = { - 0x0409, - 0x0401, - 0x0402, - 0x0403, - 0x0404, - 0x0405, - 0x0406, - 0x0407, - 0x0408, - 0x040a, - 0x040b, - 0x040c, - 0x040d, - 0x040e, - 0x040f, - 0x0410, - 0x0411, - 0x0412, - 0x0413, - 0x0414, - 0x0415, - 0x0416, - 0x0417, - 0x0418, - 0x0419, - 0x041a, - 0 - }; + 0x0409, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, + 0x0407, 0x0408, 0x040a, 0x040b, 0x040c, 0x040d, 0x040e, + 0x040f, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, + 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0}; /* ---------------------------------- */ LANGID def_id = GetUserDefaultUILanguage(); LANGID id = def_id; if (valid_lang(id) && get_locale_name(id, locale_name)) { - dstr_copy(cur.name, obs_module_text( - "Captions.CurrentSystemLanguage")); + dstr_copy(cur.name, + obs_module_text("Captions.CurrentSystemLanguage")); dstr_replace(cur.name, "%1", locale_name); cur.id = id; @@ -381,8 +357,7 @@ while (*locale) { id = *locale; - if (id != def_id && - valid_lang(id) && + if (id != def_id && valid_lang(id) && get_locale_name(id, locale_name)) { dstr_copy(cur.name, locale_name); @@ -418,17 +393,17 @@ FreeCaptions(); } -static void save_caption_data(obs_data_t *save_data, bool saving, void*) +static void save_caption_data(obs_data_t *save_data, bool saving, void *) { if (saving) { obs_data_t *obj = obs_data_create(); obs_data_set_string(obj, "source", - captions->source_name.c_str()); + captions->source_name.c_str()); obs_data_set_bool(obj, "enabled", !!captions->handler); obs_data_set_int(obj, "lang_id", captions->lang_id); obs_data_set_string(obj, "provider", - captions->handler_id.c_str()); + captions->handler_id.c_str()); obs_data_set_obj(save_data, "captions", obj); obs_data_release(obj); @@ -440,15 +415,15 @@ obj = obs_data_create(); obs_data_set_default_int(obj, "lang_id", - GetUserDefaultUILanguage()); + GetUserDefaultUILanguage()); obs_data_set_default_string(obj, "provider", DEFAULT_HANDLER); bool enabled = obs_data_get_bool(obj, "enabled"); captions->source_name = obs_data_get_string(obj, "source"); captions->lang_id = (int)obs_data_get_int(obj, "lang_id"); captions->handler_id = obs_data_get_string(obj, "provider"); - captions->source = GetWeakSourceByName( - captions->source_name.c_str()); + captions->source = + GetWeakSourceByName(captions->source_name.c_str()); obs_data_release(obj); if (enabled) @@ -458,17 +433,15 @@ extern "C" void InitCaptions() { - QAction *action = (QAction*)obs_frontend_add_tools_menu_qaction( - obs_module_text("Captions")); + QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction( + obs_module_text("Captions")); captions = new obs_captions; - auto cb = [] () - { + auto cb = []() { obs_frontend_push_ui_translation(obs_module_get_string); - QWidget *window = - (QWidget*)obs_frontend_get_main_window(); + QWidget *window = (QWidget *)obs_frontend_get_main_window(); CaptionsDialog dialog(window); dialog.exec();
View file
obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/af-ZA.ini
Added
@@ -0,0 +1,7 @@ +Start="Begin" +Stop="Stop" + + + + +
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ar-SA.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ar-SA.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="سيتم إيقاف التسجيل بعد:" OutputTimer.Stream.EnableEverytime="تفعيل مؤقِّت البث في كل مرة" OutputTimer.Record.EnableEverytime="تفعيل مؤقِّت التسجيل في كل مرة" +OutputTimer.Record.PauseTimer="إيقاف المُؤَقِت عندما يكون التسجيل متوقف" Scripts="سكريبتات" LoadedScripts="السكريبتات المحملة"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ca-ES.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ca-ES.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="La gravació s'aturarà en:" OutputTimer.Stream.EnableEverytime="Activa el temporitzador en cada transmissió" OutputTimer.Record.EnableEverytime="Activa el temporitzador en cada enregistrament" +OutputTimer.Record.PauseTimer="Pausa el temporitzador en pausar l'enregistrament" Scripts="Scripts" LoadedScripts="Scripts carregats"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/cs-CZ.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/cs-CZ.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Nahrávání se zastaví za:" OutputTimer.Stream.EnableEverytime="Pokaždé povolit časovač vysílání" OutputTimer.Record.EnableEverytime="Pokaždé povolit časovač nahrávání" +OutputTimer.Record.PauseTimer="Pozastavit časovač při pozastavení nahrávání" Scripts="Skripty" LoadedScripts="Načtené skripty"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/da-DK.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/da-DK.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Optagelse standser om:" OutputTimer.Stream.EnableEverytime="Aktivér streamingtimer hver gang" OutputTimer.Record.EnableEverytime="Aktivér optagetimer hver gang" +OutputTimer.Record.PauseTimer="Sæt timer på pause, når optagelsen er sat på pause" Scripts="Scripts" LoadedScripts="Indlæste scripts"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/de-DE.ini
Changed
@@ -4,7 +4,7 @@ SceneSwitcher.OnNoMatch.SwitchTo="Wechseln zu:" SceneSwitcher.CheckInterval="Titel des aktiven Fensters überprüfen alle:" SceneSwitcher.ActiveOrNotActive="Szenenwechsler ist:" -InvalidRegex.Title="Ungültiger regulärer Ausdruck" +InvalidRegex.Title="Ungültiger, regulärer Ausdruck" InvalidRegex.Text="Der reguläre Ausdruck, den Sie eingegeben haben, ist ungültig." Active="Aktiv" Inactive="Inaktiv" @@ -24,16 +24,17 @@ OutputTimer.Record.StoppingIn="Aufnahme stoppt in:" OutputTimer.Stream.EnableEverytime="Streamingtimer jedes Mal aktivieren" OutputTimer.Record.EnableEverytime="Aufnahmetimer jedes Mal aktivieren" +OutputTimer.Record.PauseTimer="Timer beim Pausieren der Aufnahme anhalten" Scripts="Skripte" LoadedScripts="Geladene Skripte" AddScripts="Skripte hinzufügen" RemoveScripts="Skripte entfernen" -ReloadScripts="Skripte neu laden" -PythonSettings="Python-Einstellungen" -PythonSettings.PythonInstallPath32bit="Python-Installationspfad (32bit)" -PythonSettings.PythonInstallPath64bit="Python-Installationspfad (64bit)" -PythonSettings.BrowsePythonPath="Python-Pfad öffnen" +ReloadScripts="Skripte neuladen" +PythonSettings="Python‐Einstellungen" +PythonSettings.PythonInstallPath32bit="Python‐Installationspfad (32bit)" +PythonSettings.PythonInstallPath64bit="Python‐Installationspfad (64bit)" +PythonSettings.BrowsePythonPath="Python‐Pfad öffnen" ScriptLogWindow="Skriptprotokoll" Description="Beschreibung"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/en-US.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/en-US.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Recording stopping in:" OutputTimer.Stream.EnableEverytime="Enable streaming timer every time" OutputTimer.Record.EnableEverytime="Enable recording timer every time" +OutputTimer.Record.PauseTimer="Pause timer when recording is paused" Scripts="Scripts" LoadedScripts="Loaded Scripts"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/es-ES.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/es-ES.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Finalizando grabación en:" OutputTimer.Stream.EnableEverytime="Activar temporizador en cada transmisión" OutputTimer.Record.EnableEverytime="Activar temporizador en cada grabación" +OutputTimer.Record.PauseTimer="Pausar temporizador cuando la grabación se pause" Scripts="Scripts" LoadedScripts="Scripts Cargados"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/eu-ES.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/eu-ES.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Grabazioa geldituko da hau barru:" OutputTimer.Stream.EnableEverytime="Gaitu transmisio tenporizadorea aldiro" OutputTimer.Record.EnableEverytime="Gaitu grabazio tenporizadorea aldiro" +OutputTimer.Record.PauseTimer="Pausatu tenporizadorea grabazioa pausatuta dagoenean" Scripts="Script-ak" LoadedScripts="Kargatutako script-ak"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/fr-FR.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/fr-FR.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Arrêt de l'enregistrement dans :" OutputTimer.Stream.EnableEverytime="Démarrer le minuteur automatiquement à chaque stream" OutputTimer.Record.EnableEverytime="Démarrer le minuteur automatiquement à chaque enregistrement" +OutputTimer.Record.PauseTimer="Mettre en pause le minuteur quand l'enregistrement est mis en pause" Scripts="Scripts" LoadedScripts="Scripts chargés"
View file
obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/gl-ES.ini
Added
@@ -0,0 +1,43 @@ +SceneSwitcher="Conmutador automático de escena" +SceneSwitcher.OnNoMatch="Cando non coincida ningunha xanela:" +SceneSwitcher.OnNoMatch.DontSwitch="Non conmutar" +SceneSwitcher.OnNoMatch.SwitchTo="Cambiar a:" +SceneSwitcher.CheckInterval="Comprobar o título da xanela activa cada:" +SceneSwitcher.ActiveOrNotActive="O conmutador de escena está:" +InvalidRegex.Title="Expresión regular non válida" +InvalidRegex.Text="A expresión regular que introduciu non é válida." +Active="Activo" +Inactive="Inactivo" +Start="Iniciar" +Stop="Parar" + +Captions="Subtítulos (experimental)" +Captions.AudioSource="Fonte de son" +Captions.CurrentSystemLanguage="Idioma actual do sistema (%1)" +Captions.Provider="Fornecedor" +Captions.Error.GenericFail="Produciuse un erro ao iniciar os suntítulos" + +OutputTimer="Temporizador de Saída" +OutputTimer.Stream="Deter a emisión após:" +OutputTimer.Record="Deter a gravación após:" +OutputTimer.Stream.StoppingIn="Detendo a emisión en:" +OutputTimer.Record.StoppingIn="Detendo a gravación en:" +OutputTimer.Stream.EnableEverytime="Activar o temporizador en cada emisión" +OutputTimer.Record.EnableEverytime="Activar o temporizador en cada gravación" +OutputTimer.Record.PauseTimer="Pór en pausa o temporizador ao pór en pausa a gravación" + +Scripts="Scripts" +LoadedScripts="Scripts cargados" +AddScripts="Engadir scripts" +RemoveScripts="Retirar scripts" +ReloadScripts="Volver cargar scripts" +PythonSettings="Axustes de Python" +PythonSettings.PythonInstallPath32bit="Ruta de instalación de Python (32bit)" +PythonSettings.PythonInstallPath64bit="Ruta de instalación de Python (64bit)" +PythonSettings.BrowsePythonPath="Examinar a ruta de Python" +ScriptLogWindow="Rexistro de script" +Description="Descrición" + +FileFilter.ScriptFiles="Ficheiros de scripts" +FileFilter.AllFiles="Todos os ficheiros" +
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/hu-HU.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/hu-HU.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Felvétel leáll:" OutputTimer.Stream.EnableEverytime="Stream időzítő indítása minden alkalommal" OutputTimer.Record.EnableEverytime="Felvétel időzítő indítása minden alkalommal" +OutputTimer.Record.PauseTimer="Idő megállítása, ha a felvétel is megáll" Scripts="Szkriptek" LoadedScripts="Betöltött szkriptek"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/it-IT.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/it-IT.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="La registrazione terminerà tra:" OutputTimer.Stream.EnableEverytime="Attiva il conto alla rovescia per le dirette ogni volta" OutputTimer.Record.EnableEverytime="Attiva il conto alla rovescia per le registrazioni ogni volta" +OutputTimer.Record.PauseTimer="Pausa il timer quando la registrazione è in pausa" Scripts="Script" LoadedScripts="Script caricati"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ja-JP.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ja-JP.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="録画停止まで:" OutputTimer.Stream.EnableEverytime="毎回配信タイマーを有効にする" OutputTimer.Record.EnableEverytime="毎回録画タイマーを有効にする" +OutputTimer.Record.PauseTimer="録画が一時停止したときにタイマーを一時停止" Scripts="スクリプト" LoadedScripts="ロードしたスクリプト"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ka-GE.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="ჩაწერის შეწყვეტის დრო:" OutputTimer.Stream.EnableEverytime="ნაკადის წამზომის ჩართვა ყოველ ჯერზე" OutputTimer.Record.EnableEverytime="ჩაწერის წამზომის ჩართვა ყოველ ჯერზე" +OutputTimer.Record.PauseTimer="წამზომის შეჩერება ჩაწერის შეჩერებისას" Scripts="სკრიპტები" LoadedScripts="ჩატვირთული სკრიპტები"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ko-KR.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ko-KR.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="녹화 중지까지 남은 시간:" OutputTimer.Stream.EnableEverytime="매번 방송 시간 기록기 활성화" OutputTimer.Record.EnableEverytime="매번 녹화 시간 기록기 활성화" +OutputTimer.Record.PauseTimer="녹화가 중지되었을 때 타이머 일시 정지" Scripts="스크립트" LoadedScripts="입력한 스크립트"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/nl-NL.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/nl-NL.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Opname stopt over:" OutputTimer.Stream.EnableEverytime="Schakel streaming timer elke keer in" OutputTimer.Record.EnableEverytime="Schakel opnametimer elke keer in" +OutputTimer.Record.PauseTimer="Pauzeer timer tijdens het pauzeren van de opname" Scripts="Scripts" LoadedScripts="Geladen Scripts"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/pl-PL.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/pl-PL.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Zatrzymanie nagrywania za:" OutputTimer.Stream.EnableEverytime="Włącz timer streamu za każdym razem" OutputTimer.Record.EnableEverytime="Włącz timer nagrywania za każdym razem" +OutputTimer.Record.PauseTimer="Zatrzymaj czas, gdy nagrywanie jest spauzowane" Scripts="Skrypty" LoadedScripts="Wczytane skrypty"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/pt-BR.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/pt-BR.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="A gravação irá parar em:" OutputTimer.Stream.EnableEverytime="Ativar o timer streaming o tempo todo" OutputTimer.Record.EnableEverytime="Ativar o timer de gravação o tempo todo" +OutputTimer.Record.PauseTimer="Pausar o temporizador quando a gravação é pausada" Scripts="Scripts" LoadedScripts="Scripts Carregados"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ro-RO.ini
Changed
@@ -10,11 +10,11 @@ Stop="Oprește" Captions="Subtitrări (experimentale)" -Captions.AudioSource="Sursa audio" +Captions.AudioSource="Sursă audio" Captions.CurrentSystemLanguage="Limba actuală a sistemului (%1)" Captions.Provider="Furnizor" -OutputTimer.Record="Opriți înregistrarea după:" +OutputTimer.Record="Oprește înregistrarea după:" OutputTimer.Stream.StoppingIn="Se oprește transmisiunea în:" OutputTimer.Record.StoppingIn="Înregistrarea se oprește în:"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ru-RU.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/ru-RU.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Запись будет завершена через:" OutputTimer.Stream.EnableEverytime="Включать таймер трансляции каждый раз" OutputTimer.Record.EnableEverytime="Включать таймер записи каждый раз" +OutputTimer.Record.PauseTimer="Таймер паузы при приостановке записи" Scripts="Скрипты" LoadedScripts="Загруженные скрипты"
View file
obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/sl-SI.ini
Added
@@ -0,0 +1,43 @@ +SceneSwitcher="Samodejno preklapljanje prizorov" +SceneSwitcher.OnNoMatch="Ko se nobeno okno ne ujema:" +SceneSwitcher.OnNoMatch.DontSwitch="Ne preklopi" +SceneSwitcher.OnNoMatch.SwitchTo="Preklopi na:" +SceneSwitcher.CheckInterval="Preveri naziv dejavnega okna vsakih:" +SceneSwitcher.ActiveOrNotActive="Preklopnik prizorov je:" +InvalidRegex.Title="Neveljaven regularni izraz" +InvalidRegex.Text="Vneseni regularni izraz ni veljaven." +Active="Dejaven" +Inactive="Nedejaven" +Start="Začni" +Stop="Ustavi" + +Captions="Napisi (preizkusno)" +Captions.AudioSource="Zvočni vir" +Captions.CurrentSystemLanguage="Trenutni jezik sistema (%1)" +Captions.Provider="Ponudnik" +Captions.Error.GenericFail="Zagon napisov je spodletel" + +OutputTimer="Odštevalnik izhoda" +OutputTimer.Stream="Prenehaj pretakati po:" +OutputTimer.Record="Prenehaj snemati po:" +OutputTimer.Stream.StoppingIn="Pretok se bo ustavil čez:" +OutputTimer.Record.StoppingIn="Snemanje se bo ustavilo čez:" +OutputTimer.Stream.EnableEverytime="Vsakič omogoči odštevalnik pretakanja" +OutputTimer.Record.EnableEverytime="Vsakič omogoči odštevalnik snemanja" +OutputTimer.Record.PauseTimer="Premor odštevalnika ob premoru snemanja" + +Scripts="Skripti" +LoadedScripts="Naloženi skripti" +AddScripts="Dodaj skripte" +RemoveScripts="Odstrani skripte" +ReloadScripts="Ponovno naloži skripte" +PythonSettings="Nastavitve Python" +PythonSettings.PythonInstallPath32bit="Namestitvena pot Pythona (32-bitni)" +PythonSettings.PythonInstallPath64bit="Namestitvena pot Pythona (64-bitni)" +PythonSettings.BrowsePythonPath="Prebrskaj pot do Pythona" +ScriptLogWindow="Dnevnik skriptov" +Description="Opis" + +FileFilter.ScriptFiles="Datoteke skriptov" +FileFilter.AllFiles="Vse datoteke" +
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/sv-SE.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/sv-SE.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Inspelningen stoppas om:" OutputTimer.Stream.EnableEverytime="Aktivera strömtimer varje gång" OutputTimer.Record.EnableEverytime="Aktivera inspelningstimer varje gång" +OutputTimer.Record.PauseTimer="Pausa timer när inspelning pausas" Scripts="Skript" LoadedScripts="Inlästa skript"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/th-TH.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/th-TH.ini
Changed
@@ -1,3 +1,8 @@ +SceneSwitcher="สลับฉากอัตโนมัติ" +SceneSwitcher.OnNoMatch="เมื่อหน้าต่างไม่สัมพันธ์กัน:" +SceneSwitcher.OnNoMatch.DontSwitch="ไม่สลับ" +SceneSwitcher.OnNoMatch.SwitchTo="สลับไปยัง:" +SceneSwitcher.CheckInterval="ตรวจสอบหน้าต่างที่ถูกเลือกทุกๆ" Active="ใช้งานอยู่" Inactive="ไม่ใช้งาน" Start="เริ่ม"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/tr-TR.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/tr-TR.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Kayıt durduruluyor:" OutputTimer.Stream.EnableEverytime="Her zaman yayın zamanlayıcıyı etkinleştir" OutputTimer.Record.EnableEverytime="Her zaman kayıt zamanlayıcıyı etkinleştir" +OutputTimer.Record.PauseTimer="Kayıt durdurulduğunda sayacı durdur" Scripts="Betikler" LoadedScripts="Yüklü Betikler"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/uk-UA.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/uk-UA.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="Запис зупиниться за:" OutputTimer.Stream.EnableEverytime="Щоразу запускається трансляція - вмикати Таймер для Виводу" OutputTimer.Record.EnableEverytime="Щоразу починається запис - вмикати Таймер для Виводу" +OutputTimer.Record.PauseTimer="Призупиняти таймер коли запис Призупинено" Scripts="Скрипти" LoadedScripts="Завантажені скрипти"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/zh-CN.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/zh-CN.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="录制停止在:" OutputTimer.Stream.EnableEverytime="每次启用流计时器" OutputTimer.Record.EnableEverytime="每次启用录制计时器" +OutputTimer.Record.PauseTimer="暂停录制时暂停计时器" Scripts="脚本" LoadedScripts="已载入脚本"
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/zh-TW.ini -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/locale/zh-TW.ini
Changed
@@ -24,6 +24,7 @@ OutputTimer.Record.StoppingIn="錄影將在下面時間內停止" OutputTimer.Stream.EnableEverytime="每次都啟動串流計時器" OutputTimer.Record.EnableEverytime="每次都啟動錄影計時器" +OutputTimer.Record.PauseTimer="錄影暫停時,計時器也暫停。" Scripts="腳本" LoadedScripts="已載入腳本"
View file
obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/data/scripts/pause-scene.lua
Added
@@ -0,0 +1,44 @@ +obs = obslua +pause_scene = "" + +function on_event(event) + if event == obs.OBS_FRONTEND_EVENT_SCENE_CHANGED then + local scene = obs.obs_frontend_get_current_scene() + local scene_name = obs.obs_source_get_name(scene) + if pause_scene == scene_name then + obs.obs_frontend_recording_pause(true) + else + obs.obs_frontend_recording_pause(false) + end + + obs.obs_source_release(scene); + end +end + +function script_properties() + local props = obs.obs_properties_create() + + local p = obs.obs_properties_add_list(props, "pause_scene", "Pause Scene", obs.OBS_COMBO_TYPE_EDITABLE, obs.OBS_COMBO_FORMAT_STRING) + local scenes = obs.obs_frontend_get_scenes() + if scenes ~= nil then + for _, scene in ipairs(scenes) do + local name = obs.obs_source_get_name(scene); + obs.obs_property_list_add_string(p, name, name) + end + end + obs.source_list_release(scenes) + + return props +end + +function script_description() + return "Adds the ability to pause recording when switching to a specific scene" +end + +function script_update(settings) + pause_scene = obs.obs_data_get_string(settings, "pause_scene") +end + +function script_load(settings) + obs.obs_frontend_add_event_callback(on_event) +end
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/forms/output-timer.ui -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/forms/output-timer.ui
Changed
@@ -1,215 +1,237 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>OutputTimer</class> - <widget class="QDialog" name="OutputTimer"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>600</width> - <height>200</height> - </rect> - </property> - <property name="windowTitle"> - <string>OutputTimer</string> - </property> - <layout class="QGridLayout" name="timerLayout"> - <item row="0" column="1"> - <widget class="QLabel" name="streamingLabel"> - <property name="text"> - <string>OutputTimer.Stream</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QSpinBox" name="streamingTimerHours"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>24</number> - </property> - <property name="value"> - <number>0</number> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="hoursLabel"> - <property name="text"> - <string>Hours</string> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QSpinBox" name="streamingTimerMinutes"> - <property name="maximum"> - <number>59</number> - </property> - <property name="value"> - <number>0</number> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QLabel" name="minutesLabel"> - <property name="text"> - <string>Minutes</string> - </property> - </widget> - </item> - <item row="0" column="6"> - <widget class="QSpinBox" name="streamingTimerSeconds"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>59</number> - </property> - <property name="value"> - <number>30</number> - </property> - </widget> - </item> - <item row="0" column="7"> - <widget class="QLabel" name="secondsLabel"> - <property name="text"> - <string>Seconds</string> - </property> - </widget> - </item> - <item row="0" column="8"> - <widget class="QPushButton" name="outputTimerStream"> - <property name="text"> - <string>Start</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="streamStoppingIn"> - <property name="text"> - <string>OutputTimer.Stream.StoppingIn</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="streamTime"> - <property name="text"> - <string>00:00:00</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="recordingLabel"> - <property name="text"> - <string>OutputTimer.Record</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QSpinBox" name="recordingTimerHours"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>24</number> - </property> - <property name="value"> - <number>0</number> - </property> - </widget> - </item> - <item row="3" column="3"> - <widget class="QLabel" name="hoursLabel_2"> - <property name="text"> - <string>Hours</string> - </property> - </widget> - </item> - <item row="3" column="4"> - <widget class="QSpinBox" name="recordingTimerMinutes"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>59</number> - </property> - <property name="value"> - <number>0</number> - </property> - </widget> - </item> - <item row="3" column="5"> - <widget class="QLabel" name="minutesLabel_2"> - <property name="text"> - <string>Minutes</string> - </property> - </widget> - </item> - <item row="3" column="6"> - <widget class="QSpinBox" name="recordingTimerSeconds"> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>59</number> - </property> - <property name="value"> - <number>30</number> - </property> - </widget> - </item> - <item row="3" column="7"> - <widget class="QLabel" name="secondsLabel_2"> - <property name="text"> - <string>Seconds</string> - </property> - </widget> - </item> - <item row="3" column="8"> - <widget class="QPushButton" name="outputTimerRecord"> - <property name="text"> - <string>Start</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QLabel" name="recordStoppingIn"> - <property name="text"> - <string>OutputTimer.Record.StoppingIn</string> - </property> - </widget> - </item> - <item row="5" column="2"> - <widget class="QLabel" name="recordTime"> - <property name="text"> - <string>00:00:00</string> - </property> - </widget> - </item> - <item row="1" column="1" colspan="3"> - <widget class="QCheckBox" name="autoStartStreamTimer"> - <property name="text"> - <string>OutputTimer.Stream.EnableEverytime</string> - </property> - </widget> - </item> - <item row="4" column="1" colspan="3"> - <widget class="QCheckBox" name="autoStartRecordTimer"> - <property name="text"> - <string>OutputTimer.Record.EnableEverytime</string> - </property> - </widget> - </item> - <item row="6" column="8"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Close</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources /> - <connections /> + <widget class="QDialog" name="OutputTimer"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>697</width> + <height>240</height> + </rect> + </property> + <property name="windowTitle"> + <string>OutputTimer</string> + </property> + <layout class="QGridLayout" name="timerLayout"> + <item row="0" column="3"> + <widget class="QLabel" name="hoursLabel"> + <property name="text"> + <string>Hours</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <widget class="QSpinBox" name="recordingTimerHours"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>24</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + <item row="0" column="6"> + <widget class="QSpinBox" name="streamingTimerSeconds"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>59</number> + </property> + <property name="value"> + <number>30</number> + </property> + </widget> + </item> + <item row="0" column="8"> + <widget class="QPushButton" name="outputTimerStream"> + <property name="text"> + <string>Start</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="4"> + <widget class="QSpinBox" name="recordingTimerMinutes"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>59</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="streamingLabel"> + <property name="text"> + <string>OutputTimer.Stream</string> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QSpinBox" name="streamingTimerMinutes"> + <property name="maximum"> + <number>59</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + <item row="3" column="8"> + <widget class="QPushButton" name="outputTimerRecord"> + <property name="text"> + <string>Start</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="6" column="1"> + <widget class="QLabel" name="recordStoppingIn"> + <property name="text"> + <string>OutputTimer.Record.StoppingIn</string> + </property> + </widget> + </item> + <item row="3" column="7"> + <widget class="QLabel" name="secondsLabel_2"> + <property name="text"> + <string>Seconds</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="streamTime"> + <property name="text"> + <string>00:00:00</string> + </property> + </widget> + </item> + <item row="3" column="5"> + <widget class="QLabel" name="minutesLabel_2"> + <property name="text"> + <string>Minutes</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QSpinBox" name="streamingTimerHours"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>24</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + <item row="6" column="2"> + <widget class="QLabel" name="recordTime"> + <property name="text"> + <string>00:00:00</string> + </property> + </widget> + </item> + <item row="0" column="5"> + <widget class="QLabel" name="minutesLabel"> + <property name="text"> + <string>Minutes</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="recordingLabel"> + <property name="text"> + <string>OutputTimer.Record</string> + </property> + </widget> + </item> + <item row="3" column="6"> + <widget class="QSpinBox" name="recordingTimerSeconds"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>59</number> + </property> + <property name="value"> + <number>30</number> + </property> + </widget> + </item> + <item row="1" column="1" colspan="3"> + <widget class="QCheckBox" name="autoStartStreamTimer"> + <property name="text"> + <string>OutputTimer.Stream.EnableEverytime</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="streamStoppingIn"> + <property name="text"> + <string>OutputTimer.Stream.StoppingIn</string> + </property> + </widget> + </item> + <item row="4" column="1" colspan="3"> + <widget class="QCheckBox" name="autoStartRecordTimer"> + <property name="text"> + <string>OutputTimer.Record.EnableEverytime</string> + </property> + </widget> + </item> + <item row="7" column="8"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Close</set> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QLabel" name="hoursLabel_2"> + <property name="text"> + <string>Hours</string> + </property> + </widget> + </item> + <item row="0" column="7"> + <widget class="QLabel" name="secondsLabel"> + <property name="text"> + <string>Seconds</string> + </property> + </widget> + </item> + <item row="5" column="1" colspan="3"> + <widget class="QCheckBox" name="pauseRecordTimer"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>OutputTimer.Record.PauseTimer</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> </ui>
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/output-timer.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/output-timer.cpp
Changed
@@ -13,19 +13,18 @@ OutputTimer *ot; OutputTimer::OutputTimer(QWidget *parent) - : QDialog(parent), - ui(new Ui_OutputTimer) + : QDialog(parent), ui(new Ui_OutputTimer) { ui->setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); QObject::connect(ui->outputTimerStream, SIGNAL(clicked()), this, - SLOT(StreamingTimerButton())); + SLOT(StreamingTimerButton())); QObject::connect(ui->outputTimerRecord, SIGNAL(clicked()), this, - SLOT(RecordingTimerButton())); + SLOT(RecordingTimerButton())); QObject::connect(ui->buttonBox->button(QDialogButtonBox::Close), - SIGNAL(clicked()), this, SLOT(hide())); + SIGNAL(clicked()), this, SLOT(hide())); streamingTimer = new QTimer(this); streamingTimerDisplay = new QTimer(this); @@ -34,7 +33,7 @@ recordingTimerDisplay = new QTimer(this); } -void OutputTimer::closeEvent(QCloseEvent*) +void OutputTimer::closeEvent(QCloseEvent *) { obs_frontend_save(); } @@ -78,9 +77,7 @@ int minutes = ui->streamingTimerMinutes->value(); int seconds = ui->streamingTimerSeconds->value(); - int total = (((hours * 3600) + - (minutes * 60)) + - seconds) * 1000; + int total = (((hours * 3600) + (minutes * 60)) + seconds) * 1000; if (total == 0) total = 1000; @@ -89,16 +86,18 @@ streamingTimer->setSingleShot(true); QObject::connect(streamingTimer, SIGNAL(timeout()), - SLOT(EventStopStreaming())); + SLOT(EventStopStreaming())); QObject::connect(streamingTimerDisplay, SIGNAL(timeout()), this, - SLOT(UpdateStreamTimerDisplay())); + SLOT(UpdateStreamTimerDisplay())); streamingTimer->start(); streamingTimerDisplay->start(1000); ui->outputTimerStream->setText(obs_module_text("Stop")); UpdateStreamTimerDisplay(); + + ui->outputTimerStream->setChecked(true); } void OutputTimer::RecordTimerStart() @@ -112,9 +111,7 @@ int minutes = ui->recordingTimerMinutes->value(); int seconds = ui->recordingTimerSeconds->value(); - int total = (((hours * 3600) + - (minutes * 60)) + - seconds) * 1000; + int total = (((hours * 3600) + (minutes * 60)) + seconds) * 1000; if (total == 0) total = 1000; @@ -123,16 +120,18 @@ recordingTimer->setSingleShot(true); QObject::connect(recordingTimer, SIGNAL(timeout()), - SLOT(EventStopRecording())); + SLOT(EventStopRecording())); QObject::connect(recordingTimerDisplay, SIGNAL(timeout()), this, - SLOT(UpdateRecordTimerDisplay())); + SLOT(UpdateRecordTimerDisplay())); recordingTimer->start(); recordingTimerDisplay->start(1000); ui->outputTimerRecord->setText(obs_module_text("Stop")); UpdateRecordTimerDisplay(); + + ui->outputTimerRecord->setChecked(true); } void OutputTimer::StreamTimerStop() @@ -151,6 +150,7 @@ streamingTimerDisplay->stop(); ui->streamTime->setText("00:00:00"); + ui->outputTimerStream->setChecked(false); } void OutputTimer::RecordTimerStop() @@ -169,6 +169,7 @@ recordingTimerDisplay->stop(); ui->recordTime->setText("00:00:00"); + ui->outputTimerRecord->setChecked(false); } void OutputTimer::UpdateStreamTimerDisplay() @@ -186,7 +187,13 @@ void OutputTimer::UpdateRecordTimerDisplay() { - int remainingTime = recordingTimer->remainingTime() / 1000; + int remainingTime = 0; + + if (obs_frontend_recording_paused() && + ui->pauseRecordTimer->isChecked()) + remainingTime = recordingTimeLeft / 1000; + else + remainingTime = recordingTimer->remainingTime() / 1000; int seconds = remainingTime % 60; int minutes = (remainingTime % 3600) / 60; @@ -197,6 +204,26 @@ ui->recordTime->setText(text); } +void OutputTimer::PauseRecordingTimer() +{ + if (!ui->pauseRecordTimer->isChecked()) + return; + + if (recordingTimer->isActive()) { + recordingTimeLeft = recordingTimer->remainingTime(); + recordingTimer->stop(); + } +} + +void OutputTimer::UnpauseRecordingTimer() +{ + if (!ui->pauseRecordTimer->isChecked()) + return; + + if (!recordingTimer->isActive()) + recordingTimer->start(recordingTimeLeft); +} + void OutputTimer::ShowHideDialog() { if (!isVisible()) { @@ -226,60 +253,63 @@ obs_data_t *obj = obs_data_create(); obs_data_set_int(obj, "streamTimerHours", - ot->ui->streamingTimerHours->value()); + ot->ui->streamingTimerHours->value()); obs_data_set_int(obj, "streamTimerMinutes", - ot->ui->streamingTimerMinutes->value()); + ot->ui->streamingTimerMinutes->value()); obs_data_set_int(obj, "streamTimerSeconds", - ot->ui->streamingTimerSeconds->value()); + ot->ui->streamingTimerSeconds->value()); obs_data_set_int(obj, "recordTimerHours", - ot->ui->recordingTimerHours->value()); + ot->ui->recordingTimerHours->value()); obs_data_set_int(obj, "recordTimerMinutes", - ot->ui->recordingTimerMinutes->value()); + ot->ui->recordingTimerMinutes->value()); obs_data_set_int(obj, "recordTimerSeconds", - ot->ui->recordingTimerSeconds->value()); + ot->ui->recordingTimerSeconds->value()); obs_data_set_bool(obj, "autoStartStreamTimer", - ot->ui->autoStartStreamTimer->isChecked()); + ot->ui->autoStartStreamTimer->isChecked()); obs_data_set_bool(obj, "autoStartRecordTimer", - ot->ui->autoStartRecordTimer->isChecked()); + ot->ui->autoStartRecordTimer->isChecked()); + + obs_data_set_bool(obj, "pauseRecordTimer", + ot->ui->pauseRecordTimer->isChecked()); obs_data_set_obj(save_data, "output-timer", obj); obs_data_release(obj); } else { - obs_data_t *obj = obs_data_get_obj(save_data, - "output-timer"); + obs_data_t *obj = obs_data_get_obj(save_data, "output-timer"); if (!obj) obj = obs_data_create(); ot->ui->streamingTimerHours->setValue( - obs_data_get_int(obj, "streamTimerHours")); + obs_data_get_int(obj, "streamTimerHours")); ot->ui->streamingTimerMinutes->setValue( - obs_data_get_int(obj, "streamTimerMinutes")); + obs_data_get_int(obj, "streamTimerMinutes")); ot->ui->streamingTimerSeconds->setValue( - obs_data_get_int(obj, "streamTimerSeconds")); + obs_data_get_int(obj, "streamTimerSeconds")); ot->ui->recordingTimerHours->setValue( - obs_data_get_int(obj, "recordTimerHours")); + obs_data_get_int(obj, "recordTimerHours")); ot->ui->recordingTimerMinutes->setValue( - obs_data_get_int(obj, "recordTimerMinutes")); + obs_data_get_int(obj, "recordTimerMinutes")); ot->ui->recordingTimerSeconds->setValue( - obs_data_get_int(obj, "recordTimerSeconds")); + obs_data_get_int(obj, "recordTimerSeconds")); ot->ui->autoStartStreamTimer->setChecked( - obs_data_get_bool(obj, "autoStartStreamTimer")); + obs_data_get_bool(obj, "autoStartStreamTimer")); ot->ui->autoStartRecordTimer->setChecked( - obs_data_get_bool(obj, "autoStartRecordTimer")); + obs_data_get_bool(obj, "autoStartRecordTimer")); + + ot->ui->pauseRecordTimer->setChecked( + obs_data_get_bool(obj, "pauseRecordTimer")); obs_data_release(obj); } } -extern "C" void FreeOutputTimer() -{ -} +extern "C" void FreeOutputTimer() {} static void OBSEvent(enum obs_frontend_event event, void *) { @@ -294,24 +324,25 @@ ot->RecordTimerStart(); } else if (event == OBS_FRONTEND_EVENT_RECORDING_STOPPING) { ot->RecordTimerStop(); + } else if (event == OBS_FRONTEND_EVENT_RECORDING_PAUSED) { + ot->PauseRecordingTimer(); + } else if (event == OBS_FRONTEND_EVENT_RECORDING_UNPAUSED) { + ot->UnpauseRecordingTimer(); } } extern "C" void InitOutputTimer() { - QAction *action = (QAction*)obs_frontend_add_tools_menu_qaction( - obs_module_text("OutputTimer")); + QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction( + obs_module_text("OutputTimer")); obs_frontend_push_ui_translation(obs_module_get_string); - QMainWindow *window = (QMainWindow*)obs_frontend_get_main_window(); + QMainWindow *window = (QMainWindow *)obs_frontend_get_main_window(); ot = new OutputTimer(window); - auto cb = [] () - { - ot->ShowHideDialog(); - }; + auto cb = []() { ot->ShowHideDialog(); }; obs_frontend_pop_ui_translation();
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/output-timer.hpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/output-timer.hpp
Changed
@@ -15,6 +15,8 @@ OutputTimer(QWidget *parent); void closeEvent(QCloseEvent *event) override; + void PauseRecordingTimer(); + void UnpauseRecordingTimer(); public slots: void StreamingTimerButton(); @@ -37,4 +39,6 @@ QTimer *recordingTimer; QTimer *streamingTimerDisplay; QTimer *recordingTimerDisplay; + + int recordingTimeLeft; };
View file
obs-studio-23.2.1.tar.xz/UI/frontend-plugins/frontend-tools/scripts.cpp -> obs-studio-24.0.0.tar.xz/UI/frontend-plugins/frontend-tools/scripts.cpp
Changed
@@ -43,7 +43,7 @@ /* ----------------------------------------------------------------- */ -using OBSScript = OBSObj<obs_script_t*, obs_script_destroy>; +using OBSScript = OBSObj<obs_script_t *, obs_script_destroy>; struct ScriptData { std::vector<OBSScript> scripts; @@ -92,11 +92,10 @@ QHBoxLayout *buttonLayout = new QHBoxLayout(); QPushButton *clearButton = new QPushButton(tr("Clear")); - connect(clearButton, &QPushButton::clicked, - this, &ScriptLogWindow::ClearWindow); + connect(clearButton, &QPushButton::clicked, this, + &ScriptLogWindow::ClearWindow); QPushButton *closeButton = new QPushButton(tr("Close")); - connect(closeButton, &QPushButton::clicked, - this, &QDialog::hide); + connect(closeButton, &QPushButton::clicked, this, &QDialog::hide); buttonLayout->addStretch(); buttonLayout->addWidget(clearButton); @@ -112,8 +111,8 @@ resize(600, 400); config_t *global_config = obs_frontend_get_global_config(); - const char *geom = config_get_string(global_config, - "ScriptLogWindow", "geometry"); + const char *geom = + config_get_string(global_config, "ScriptLogWindow", "geometry"); if (geom != nullptr) { QByteArray ba = QByteArray::fromBase64(QByteArray(geom)); restoreGeometry(ba); @@ -121,16 +120,15 @@ setWindowTitle(obs_module_text("ScriptLogWindow")); - connect(edit->verticalScrollBar(), &QAbstractSlider::sliderMoved, - this, &ScriptLogWindow::ScrollChanged); + connect(edit->verticalScrollBar(), &QAbstractSlider::sliderMoved, this, + &ScriptLogWindow::ScrollChanged); } ScriptLogWindow::~ScriptLogWindow() { config_t *global_config = obs_frontend_get_global_config(); - config_set_string(global_config, - "ScriptLogWindow", "geometry", - saveGeometry().toBase64().constData()); + config_set_string(global_config, "ScriptLogWindow", "geometry", + saveGeometry().toBase64().constData()); } void ScriptLogWindow::ScrollChanged(int val) @@ -180,17 +178,15 @@ /* ----------------------------------------------------------------- */ -ScriptsTool::ScriptsTool() - : QWidget (nullptr), - ui (new Ui_ScriptsTool) +ScriptsTool::ScriptsTool() : QWidget(nullptr), ui(new Ui_ScriptsTool) { ui->setupUi(this); RefreshLists(); #if PYTHON_UI config_t *config = obs_frontend_get_global_config(); - const char *path = config_get_string(config, "Python", - "Path" ARCH_NAME); + const char *path = + config_get_string(config, "Python", "Path" ARCH_NAME); ui->pythonPath->setText(path); ui->pythonPathLabel->setText(obs_module_text(PYTHONPATH_LABEL_TEXT)); #else @@ -201,7 +197,7 @@ delete propertiesView; propertiesView = new QWidget(); propertiesView->setSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Expanding); + QSizePolicy::Expanding); ui->propertiesLayout->addWidget(propertiesView); } @@ -217,8 +213,8 @@ const char *script_path = obs_script_get_path(script); if (strcmp(script_path, path) == 0) { - scriptData->scripts.erase( - scriptData->scripts.begin() + i); + scriptData->scripts.erase(scriptData->scripts.begin() + + i); break; } } @@ -323,7 +319,8 @@ scriptData->scripts.emplace_back(script); - QListWidgetItem *item = new QListWidgetItem(script_file); + QListWidgetItem *item = + new QListWidgetItem(script_file); item->setData(Qt::UserRole, QString(file)); ui->scripts->addItem(item); @@ -343,8 +340,10 @@ QList<QListWidgetItem *> items = ui->scripts->selectedItems(); for (QListWidgetItem *item : items) - RemoveScript(item->data(Qt::UserRole).toString() - .toUtf8().constData()); + RemoveScript(item->data(Qt::UserRole) + .toString() + .toUtf8() + .constData()); RefreshLists(); } @@ -352,8 +351,10 @@ { QList<QListWidgetItem *> items = ui->scripts->selectedItems(); for (QListWidgetItem *item : items) - ReloadScript(item->data(Qt::UserRole).toString() - .toUtf8().constData()); + ReloadScript(item->data(Qt::UserRole) + .toString() + .toUtf8() + .constData()); on_scripts_currentRowChanged(ui->scripts->currentRow()); } @@ -368,9 +369,7 @@ { QString curPath = ui->pythonPath->text(); QString newPath = QFileDialog::getExistingDirectory( - this, - ui->pythonPathLabel->text(), - curPath); + this, ui->pythonPathLabel->text(), curPath); if (newPath.isEmpty()) return; @@ -406,14 +405,14 @@ if (row == -1) { propertiesView = new QWidget(); propertiesView->setSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Expanding); + QSizePolicy::Expanding); ui->propertiesLayout->addWidget(propertiesView); ui->description->setText(QString()); return; } - QByteArray array = ui->scripts->item(row)->data(Qt::UserRole) - .toString().toUtf8(); + QByteArray array = + ui->scripts->item(row)->data(Qt::UserRole).toString().toUtf8(); const char *path = array.constData(); obs_script_t *script = scriptData->FindScript(path); @@ -425,9 +424,10 @@ OBSData settings = obs_script_get_settings(script); obs_data_release(settings); - propertiesView = new OBSPropertiesView(settings, script, - (PropertiesReloadCallback)obs_script_get_properties, - (PropertiesUpdateCallback)obs_script_update); + propertiesView = new OBSPropertiesView( + settings, script, + (PropertiesReloadCallback)obs_script_get_properties, + (PropertiesUpdateCallback)obs_script_update); ui->propertiesLayout->addWidget(propertiesView); ui->description->setText(obs_script_get_description(script)); } @@ -457,8 +457,7 @@ static void load_script_data(obs_data_t *load_data, bool, void *) { - obs_data_array_t *array = obs_data_get_array(load_data, - "scripts-tool"); + obs_data_array_t *array = obs_data_get_array(load_data, "scripts-tool"); delete scriptData; scriptData = new ScriptData; @@ -509,21 +508,19 @@ } static void script_log(void *, obs_script_t *script, int log_level, - const char *message) + const char *message) { QString qmsg; if (script) { qmsg = QStringLiteral("[%1] %2").arg( - obs_script_get_file(script), - message); + obs_script_get_file(script), message); } else { qmsg = QStringLiteral("[Unknown Script] %1").arg(message); } QMetaObject::invokeMethod(scriptLogWindow, "AddLogMsg", - Q_ARG(int, log_level), - Q_ARG(QString, qmsg)); + Q_ARG(int, log_level), Q_ARG(QString, qmsg)); } extern "C" void InitScripts() @@ -533,13 +530,13 @@ obs_scripting_load(); obs_scripting_set_log_callback(script_log, nullptr); - QAction *action = (QAction*)obs_frontend_add_tools_menu_qaction( - obs_module_text("Scripts")); + QAction *action = (QAction *)obs_frontend_add_tools_menu_qaction( + obs_module_text("Scripts")); #if PYTHON_UI config_t *config = obs_frontend_get_global_config(); - const char *python_path = config_get_string(config, "Python", - "Path" ARCH_NAME); + const char *python_path = + config_get_string(config, "Python", "Path" ARCH_NAME); if (!obs_scripting_python_loaded() && python_path && *python_path) obs_scripting_load_python(python_path); @@ -547,8 +544,7 @@ scriptData = new ScriptData; - auto cb = [] () - { + auto cb = []() { obs_frontend_push_ui_translation(obs_module_get_string); if (!scriptsWindow) {
View file
obs-studio-23.2.1.tar.xz/UI/horizontal-scroll-area.hpp -> obs-studio-24.0.0.tar.xz/UI/horizontal-scroll-area.hpp
Changed
@@ -8,8 +8,7 @@ Q_OBJECT public: - inline HScrollArea(QWidget *parent = nullptr) - : QScrollArea(parent) + inline HScrollArea(QWidget *parent = nullptr) : QScrollArea(parent) { setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); }
View file
obs-studio-23.2.1.tar.xz/UI/hotkey-edit.cpp -> obs-studio-24.0.0.tar.xz/UI/hotkey-edit.cpp
Changed
@@ -25,13 +25,13 @@ #include "qt-wrappers.hpp" static inline bool operator!=(const obs_key_combination_t &c1, - const obs_key_combination_t &c2) + const obs_key_combination_t &c2) { return c1.modifiers != c2.modifiers || c1.key != c2.key; } static inline bool operator==(const obs_key_combination_t &c1, - const obs_key_combination_t &c2) + const obs_key_combination_t &c2) { return !(c1 != c2); } @@ -105,32 +105,34 @@ new_key.key = OBS_KEY_MOUSE3; break; -#define MAP_BUTTON(i, j) case Qt::ExtraButton ## i: \ - new_key.key = OBS_KEY_MOUSE ## j; break; - MAP_BUTTON( 1, 4); - MAP_BUTTON( 2, 5); - MAP_BUTTON( 3, 6); - MAP_BUTTON( 4, 7); - MAP_BUTTON( 5, 8); - MAP_BUTTON( 6, 9); - MAP_BUTTON( 7, 10); - MAP_BUTTON( 8, 11); - MAP_BUTTON( 9, 12); - MAP_BUTTON(10, 13); - MAP_BUTTON(11, 14); - MAP_BUTTON(12, 15); - MAP_BUTTON(13, 16); - MAP_BUTTON(14, 17); - MAP_BUTTON(15, 18); - MAP_BUTTON(16, 19); - MAP_BUTTON(17, 20); - MAP_BUTTON(18, 21); - MAP_BUTTON(19, 22); - MAP_BUTTON(20, 23); - MAP_BUTTON(21, 24); - MAP_BUTTON(22, 25); - MAP_BUTTON(23, 26); - MAP_BUTTON(24, 27); +#define MAP_BUTTON(i, j) \ + case Qt::ExtraButton##i: \ + new_key.key = OBS_KEY_MOUSE##j; \ + break; + MAP_BUTTON(1, 4) + MAP_BUTTON(2, 5) + MAP_BUTTON(3, 6) + MAP_BUTTON(4, 7) + MAP_BUTTON(5, 8) + MAP_BUTTON(6, 9) + MAP_BUTTON(7, 10) + MAP_BUTTON(8, 11) + MAP_BUTTON(9, 12) + MAP_BUTTON(10, 13) + MAP_BUTTON(11, 14) + MAP_BUTTON(12, 15) + MAP_BUTTON(13, 16) + MAP_BUTTON(14, 17) + MAP_BUTTON(15, 18) + MAP_BUTTON(16, 19) + MAP_BUTTON(17, 20) + MAP_BUTTON(18, 21) + MAP_BUTTON(19, 22) + MAP_BUTTON(20, 23) + MAP_BUTTON(21, 24) + MAP_BUTTON(22, 25) + MAP_BUTTON(23, 26) + MAP_BUTTON(24, 27) #undef MAP_BUTTON } @@ -183,13 +185,13 @@ void OBSHotkeyEdit::InitSignalHandler() { - layoutChanged = {obs_get_signal_handler(), - "hotkey_layout_change", - [](void *this_, calldata_t*) - { - auto edit = static_cast<OBSHotkeyEdit*>(this_); - QMetaObject::invokeMethod(edit, "ReloadKeyLayout"); - }, this}; + layoutChanged = { + obs_get_signal_handler(), "hotkey_layout_change", + [](void *this_, calldata_t *) { + auto edit = static_cast<OBSHotkeyEdit *>(this_); + QMetaObject::invokeMethod(edit, "ReloadKeyLayout"); + }, + this}; } void OBSHotkeyEdit::ReloadKeyLayout() @@ -198,7 +200,7 @@ } void OBSHotkeyWidget::SetKeyCombinations( - const std::vector<obs_key_combination_t> &combos) + const std::vector<obs_key_combination_t> &combos) { if (combos.empty()) AddEdit({0, OBS_KEY_NONE}); @@ -210,10 +212,8 @@ bool OBSHotkeyWidget::Changed() const { return changed || - std::any_of(begin(edits), end(edits), [](OBSHotkeyEdit *edit) - { - return edit->changed; - }); + std::any_of(begin(edits), end(edits), + [](OBSHotkeyEdit *edit) { return edit->changed; }); } void OBSHotkeyWidget::Apply() @@ -230,7 +230,7 @@ } void OBSHotkeyWidget::GetCombinations( - std::vector<obs_key_combination_t> &combinations) const + std::vector<obs_key_combination_t> &combinations) const { combinations.clear(); for (auto &edit : edits) @@ -249,21 +249,19 @@ GetCombinations(combinations); Apply(); - auto AtomicUpdate = [&]() - { + auto AtomicUpdate = [&]() { ignoreChangedBindings = true; - obs_hotkey_load_bindings(id, - combinations.data(), combinations.size()); + obs_hotkey_load_bindings(id, combinations.data(), + combinations.size()); ignoreChangedBindings = false; }; using AtomicUpdate_t = decltype(&AtomicUpdate); - obs_hotkey_update_atomic([](void *d) - { - (*static_cast<AtomicUpdate_t>(d))(); - }, static_cast<void*>(&AtomicUpdate)); + obs_hotkey_update_atomic( + [](void *d) { (*static_cast<AtomicUpdate_t>(d))(); }, + static_cast<void *>(&AtomicUpdate)); } void OBSHotkeyWidget::AddEdit(obs_key_combination combo, int idx) @@ -285,12 +283,13 @@ clear->setFlat(true); clear->setEnabled(!obs_key_combination_is_empty(combo)); - QObject::connect(edit, &OBSHotkeyEdit::KeyChanged, - [=](obs_key_combination_t new_combo) - { - clear->setEnabled(!obs_key_combination_is_empty(new_combo)); - revert->setEnabled(edit->original != new_combo); - }); + QObject::connect( + edit, &OBSHotkeyEdit::KeyChanged, + [=](obs_key_combination_t new_combo) { + clear->setEnabled( + !obs_key_combination_is_empty(new_combo)); + revert->setEnabled(edit->original != new_combo); + }); auto add = new QPushButton; add->setProperty("themeID", "addIconSmall"); @@ -303,25 +302,18 @@ remove->setFixedSize(24, 24); remove->setFlat(true); - auto CurrentIndex = [&, remove] - { - auto res = std::find(begin(removeButtons), - end(removeButtons), - remove); + auto CurrentIndex = [&, remove] { + auto res = std::find(begin(removeButtons), end(removeButtons), + remove); return std::distance(begin(removeButtons), res); }; - QObject::connect(add, &QPushButton::clicked, - [&, CurrentIndex] - { + QObject::connect(add, &QPushButton::clicked, [&, CurrentIndex] { AddEdit({0, OBS_KEY_NONE}, CurrentIndex() + 1); }); QObject::connect(remove, &QPushButton::clicked, - [&, CurrentIndex] - { - RemoveEdit(CurrentIndex()); - }); + [&, CurrentIndex] { RemoveEdit(CurrentIndex()); }); QHBoxLayout *subLayout = new QHBoxLayout; subLayout->setContentsMargins(0, 4, 0, 0); @@ -346,16 +338,13 @@ layout()->insertLayout(idx, subLayout); - QObject::connect(revert, &QPushButton::clicked, - edit, &OBSHotkeyEdit::ResetKey); - QObject::connect(clear, &QPushButton::clicked, - edit, &OBSHotkeyEdit::ClearKey); + QObject::connect(revert, &QPushButton::clicked, edit, + &OBSHotkeyEdit::ResetKey); + QObject::connect(clear, &QPushButton::clicked, edit, + &OBSHotkeyEdit::ClearKey); QObject::connect(edit, &OBSHotkeyEdit::KeyChanged, - [&](obs_key_combination) - { - emit KeyChanged(); - }); + [&](obs_key_combination) { emit KeyChanged(); }); } void OBSHotkeyWidget::RemoveEdit(size_t idx, bool signal) @@ -384,34 +373,35 @@ void OBSHotkeyWidget::BindingsChanged(void *data, calldata_t *param) { - auto widget = static_cast<OBSHotkeyWidget*>(data); - auto key = static_cast<obs_hotkey_t*>(calldata_ptr(param, "key")); + auto widget = static_cast<OBSHotkeyWidget *>(data); + auto key = static_cast<obs_hotkey_t *>(calldata_ptr(param, "key")); QMetaObject::invokeMethod(widget, "HandleChangedBindings", - Q_ARG(obs_hotkey_id, obs_hotkey_get_id(key))); + Q_ARG(obs_hotkey_id, obs_hotkey_get_id(key))); } void OBSHotkeyWidget::HandleChangedBindings(obs_hotkey_id id_) { - if (ignoreChangedBindings || id != id_) return; + if (ignoreChangedBindings || id != id_) + return; std::vector<obs_key_combination_t> bindings; - auto LoadBindings = [&](obs_hotkey_binding_t *binding) - { - if (obs_hotkey_binding_get_hotkey_id(binding) != id) return; + auto LoadBindings = [&](obs_hotkey_binding_t *binding) { + if (obs_hotkey_binding_get_hotkey_id(binding) != id) + return; auto get_combo = obs_hotkey_binding_get_key_combination; bindings.push_back(get_combo(binding)); }; using LoadBindings_t = decltype(&LoadBindings); - obs_enum_hotkey_bindings([](void *data, - size_t, obs_hotkey_binding_t *binding) - { - auto LoadBindings = *static_cast<LoadBindings_t>(data); - LoadBindings(binding); - return true; - }, static_cast<void*>(&LoadBindings)); + obs_enum_hotkey_bindings( + [](void *data, size_t, obs_hotkey_binding_t *binding) { + auto LoadBindings = *static_cast<LoadBindings_t>(data); + LoadBindings(binding); + return true; + }, + static_cast<void *>(&LoadBindings)); while (edits.size() > 0) RemoveEdit(edits.size() - 1, false);
View file
obs-studio-23.2.1.tar.xz/UI/hotkey-edit.hpp -> obs-studio-24.0.0.tar.xz/UI/hotkey-edit.hpp
Changed
@@ -45,10 +45,8 @@ Q_OBJECT; public: - OBSHotkeyEdit(obs_key_combination_t original, - QWidget *parent=nullptr) - : QLineEdit(parent), - original(original) + OBSHotkeyEdit(obs_key_combination_t original, QWidget *parent = nullptr) + : QLineEdit(parent), original(original) { #ifdef __APPLE__ // disable the input cursor on OSX, focus should be clear @@ -63,9 +61,10 @@ obs_key_combination_t original; obs_key_combination_t key; - bool changed = false; + bool changed = false; + protected: - OBSSignal layoutChanged; + OBSSignal layoutChanged; void InitSignalHandler(); @@ -92,15 +91,14 @@ public: OBSHotkeyWidget(obs_hotkey_id id, std::string name, - const std::vector<obs_key_combination_t> &combos={}, - QWidget *parent=nullptr) + const std::vector<obs_key_combination_t> &combos = {}, + QWidget *parent = nullptr) : QWidget(parent), id(id), name(name), bindingsChanged(obs_get_signal_handler(), "hotkey_bindings_changed", - &OBSHotkeyWidget::BindingsChanged, - this) + &OBSHotkeyWidget::BindingsChanged, this) { auto layout = new QVBoxLayout; layout->setSpacing(0); @@ -110,7 +108,7 @@ SetKeyCombinations(combos); } - void SetKeyCombinations(const std::vector<obs_key_combination_t>&); + void SetKeyCombinations(const std::vector<obs_key_combination_t> &); obs_hotkey_id id; std::string name; @@ -129,7 +127,7 @@ } void Apply(); - void GetCombinations(std::vector<obs_key_combination_t>&) const; + void GetCombinations(std::vector<obs_key_combination_t> &) const; void Save(); void Save(std::vector<obs_key_combination_t> &combinations); @@ -137,8 +135,8 @@ void leaveEvent(QEvent *event) override; private: - void AddEdit(obs_key_combination combo, int idx=-1); - void RemoveEdit(size_t idx, bool signal=true); + void AddEdit(obs_key_combination combo, int idx = -1); + void RemoveEdit(size_t idx, bool signal = true); static void BindingsChanged(void *data, calldata_t *param); @@ -150,7 +148,7 @@ QVBoxLayout *layout() const { - return dynamic_cast<QVBoxLayout*>(QWidget::layout()); + return dynamic_cast<QVBoxLayout *>(QWidget::layout()); } private slots:
View file
obs-studio-23.2.1.tar.xz/UI/menu-button.hpp -> obs-studio-24.0.0.tar.xz/UI/menu-button.hpp
Changed
@@ -16,7 +16,7 @@ } explicit inline MenuButton(const QString &text, - QWidget *parent = nullptr) + QWidget *parent = nullptr) : QPushButton(text, parent) { }
View file
obs-studio-23.2.1.tar.xz/UI/obf.c -> obs-studio-24.0.0.tar.xz/UI/obf.c
Changed
@@ -1,21 +1,20 @@ #include "obf.h" #include <stdbool.h> -#define LOWER_HALFBYTE(x) ((x) & 0xF) +#define LOWER_HALFBYTE(x) ((x)&0xF) #define UPPER_HALFBYTE(x) (((x) >> 4) & 0xF) void deobfuscate_str(char *str, uint64_t val) { - uint8_t *dec_val = (uint8_t*)&val; + uint8_t *dec_val = (uint8_t *)&val; int i = 0; while (*str != 0) { int pos = i / 2; bool bottom = (i % 2) == 0; - uint8_t *ch = (uint8_t*)str; - uint8_t xor = bottom ? - LOWER_HALFBYTE(dec_val[pos]) : - UPPER_HALFBYTE(dec_val[pos]); + uint8_t *ch = (uint8_t *)str; + uint8_t xor = bottom ? LOWER_HALFBYTE(dec_val[pos]) + : UPPER_HALFBYTE(dec_val[pos]); *ch ^= xor;
View file
obs-studio-23.2.1.tar.xz/UI/obs-app.cpp -> obs-studio-24.0.0.tar.xz/UI/obs-app.cpp
Changed
@@ -91,10 +91,11 @@ QObject *CreateShortcutFilter() { - return new OBSEventFilter([](QObject *obj, QEvent *event) - { - auto mouse_event = [](QMouseEvent &event) - { + return new OBSEventFilter([](QObject *obj, QEvent *event) { + auto mouse_event = [](QMouseEvent &event) { + if (!App()->HotkeysEnabledInFocus()) + return true; + obs_key_combination_t hotkey = {0, OBS_KEY_NONE}; bool pressed = event.type() == QEvent::MouseButtonPress; @@ -110,45 +111,49 @@ hotkey.key = OBS_KEY_MOUSE3; break; -#define MAP_BUTTON(i, j) case Qt::ExtraButton ## i: \ - hotkey.key = OBS_KEY_MOUSE ## j; break; - MAP_BUTTON( 1, 4); - MAP_BUTTON( 2, 5); - MAP_BUTTON( 3, 6); - MAP_BUTTON( 4, 7); - MAP_BUTTON( 5, 8); - MAP_BUTTON( 6, 9); - MAP_BUTTON( 7, 10); - MAP_BUTTON( 8, 11); - MAP_BUTTON( 9, 12); - MAP_BUTTON(10, 13); - MAP_BUTTON(11, 14); - MAP_BUTTON(12, 15); - MAP_BUTTON(13, 16); - MAP_BUTTON(14, 17); - MAP_BUTTON(15, 18); - MAP_BUTTON(16, 19); - MAP_BUTTON(17, 20); - MAP_BUTTON(18, 21); - MAP_BUTTON(19, 22); - MAP_BUTTON(20, 23); - MAP_BUTTON(21, 24); - MAP_BUTTON(22, 25); - MAP_BUTTON(23, 26); - MAP_BUTTON(24, 27); +#define MAP_BUTTON(i, j) \ + case Qt::ExtraButton##i: \ + hotkey.key = OBS_KEY_MOUSE##j; \ + break; + MAP_BUTTON(1, 4); + MAP_BUTTON(2, 5); + MAP_BUTTON(3, 6); + MAP_BUTTON(4, 7); + MAP_BUTTON(5, 8); + MAP_BUTTON(6, 9); + MAP_BUTTON(7, 10); + MAP_BUTTON(8, 11); + MAP_BUTTON(9, 12); + MAP_BUTTON(10, 13); + MAP_BUTTON(11, 14); + MAP_BUTTON(12, 15); + MAP_BUTTON(13, 16); + MAP_BUTTON(14, 17); + MAP_BUTTON(15, 18); + MAP_BUTTON(16, 19); + MAP_BUTTON(17, 20); + MAP_BUTTON(18, 21); + MAP_BUTTON(19, 22); + MAP_BUTTON(20, 23); + MAP_BUTTON(21, 24); + MAP_BUTTON(22, 25); + MAP_BUTTON(23, 26); + MAP_BUTTON(24, 27); #undef MAP_BUTTON } hotkey.modifiers = TranslateQtKeyboardEventModifiers( - event.modifiers()); + event.modifiers()); obs_hotkey_inject_event(hotkey, pressed); return true; }; - auto key_event = [&](QKeyEvent *event) - { - QDialog *dialog = qobject_cast<QDialog*>(obj); + auto key_event = [&](QKeyEvent *event) { + if (!App()->HotkeysEnabledInFocus()) + return true; + + QDialog *dialog = qobject_cast<QDialog *>(obj); obs_key_combination_t hotkey = {0, OBS_KEY_NONE}; bool pressed = event->type() == QEvent::KeyPress; @@ -180,7 +185,7 @@ } hotkey.modifiers = TranslateQtKeyboardEventModifiers( - event->modifiers()); + event->modifiers()); obs_hotkey_inject_event(hotkey, pressed); return true; @@ -189,13 +194,13 @@ switch (event->type()) { case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: - return mouse_event(*static_cast<QMouseEvent*>(event)); + return mouse_event(*static_cast<QMouseEvent *>(event)); /*case QEvent::MouseButtonDblClick: case QEvent::Wheel:*/ case QEvent::KeyPress: case QEvent::KeyRelease: - return key_event(static_cast<QKeyEvent*>(event)); + return key_event(static_cast<QKeyEvent *>(event)); default: return false; @@ -207,8 +212,8 @@ { using namespace std::chrono; - struct tm tstruct; - char buf[80]; + struct tm tstruct; + char buf[80]; auto tp = system_clock::now(); auto now = system_clock::to_time_t(tp); @@ -216,14 +221,12 @@ size_t written = strftime(buf, sizeof(buf), "%X", &tstruct); if (ratio_less<system_clock::period, seconds::period>::value && - written && (sizeof(buf) - written) > 5) { - auto tp_secs = - time_point_cast<seconds>(tp); - auto millis = - duration_cast<milliseconds>(tp - tp_secs).count(); + written && (sizeof(buf) - written) > 5) { + auto tp_secs = time_point_cast<seconds>(tp); + auto millis = duration_cast<milliseconds>(tp - tp_secs).count(); snprintf(buf + written, sizeof(buf) - written, ".%03u", - static_cast<unsigned>(millis)); + static_cast<unsigned>(millis)); } return buf; @@ -231,16 +234,16 @@ string CurrentDateTimeString() { - time_t now = time(0); - struct tm tstruct; - char buf[80]; + time_t now = time(0); + struct tm tstruct; + char buf[80]; tstruct = *localtime(&now); strftime(buf, sizeof(buf), "%Y-%m-%d, %X", &tstruct); return buf; } static inline void LogString(fstream &logFile, const char *timeString, - char *str) + char *str) { logFile << timeString << str << endl; } @@ -283,7 +286,7 @@ } static inline bool too_many_repeated_entries(fstream &logFile, const char *msg, - const char *output_str) + const char *output_str) { static mutex log_mutex; static const char *last_msg_ptr = nullptr; @@ -307,10 +310,10 @@ } if (rep_count > MAX_REPEATED_LINES) { - logFile << CurrentTimeString() << - ": Last log entry repeated for " << - to_string(rep_count - MAX_REPEATED_LINES) << - " more lines" << endl; + logFile << CurrentTimeString() + << ": Last log entry repeated for " + << to_string(rep_count - MAX_REPEATED_LINES) + << " more lines" << endl; } last_msg_ptr = msg; @@ -323,7 +326,7 @@ static void do_log(int log_level, const char *msg, va_list args, void *param) { - fstream &logFile = *static_cast<fstream*>(param); + fstream &logFile = *static_cast<fstream *>(param); char str[4096]; #ifndef _WIN32 @@ -344,7 +347,7 @@ wide_buf.reserve(wNum + 1); wide_buf.resize(wNum - 1); MultiByteToWideChar(CP_UTF8, 0, str, -1, &wide_buf[0], - wNum); + wNum); wide_buf.push_back('\n'); OutputDebugStringW(wide_buf.c_str()); @@ -372,88 +375,91 @@ bool OBSApp::InitGlobalConfigDefaults() { config_set_default_string(globalConfig, "General", "Language", - DEFAULT_LANG); + DEFAULT_LANG); config_set_default_uint(globalConfig, "General", "MaxLogs", 10); config_set_default_int(globalConfig, "General", "InfoIncrement", -1); config_set_default_string(globalConfig, "General", "ProcessPriority", - "Normal"); + "Normal"); config_set_default_bool(globalConfig, "General", "EnableAutoUpdates", - true); + true); #if _WIN32 config_set_default_string(globalConfig, "Video", "Renderer", - "Direct3D 11"); + "Direct3D 11"); #else config_set_default_string(globalConfig, "Video", "Renderer", "OpenGL"); #endif config_set_default_bool(globalConfig, "BasicWindow", "PreviewEnabled", - true); - config_set_default_bool(globalConfig, "BasicWindow", - "PreviewProgramMode", false); - config_set_default_bool(globalConfig, "BasicWindow", - "SceneDuplicationMode", true); - config_set_default_bool(globalConfig, "BasicWindow", - "SwapScenesMode", true); - config_set_default_bool(globalConfig, "BasicWindow", - "SnappingEnabled", true); - config_set_default_bool(globalConfig, "BasicWindow", - "ScreenSnapping", true); - config_set_default_bool(globalConfig, "BasicWindow", - "SourceSnapping", true); + true); config_set_default_bool(globalConfig, "BasicWindow", - "CenterSnapping", false); - config_set_default_double(globalConfig, "BasicWindow", - "SnapDistance", 10.0); + "PreviewProgramMode", false); config_set_default_bool(globalConfig, "BasicWindow", - "RecordWhenStreaming", false); + "SceneDuplicationMode", true); + config_set_default_bool(globalConfig, "BasicWindow", "SwapScenesMode", + true); + config_set_default_bool(globalConfig, "BasicWindow", "SnappingEnabled", + true); + config_set_default_bool(globalConfig, "BasicWindow", "ScreenSnapping", + true); + config_set_default_bool(globalConfig, "BasicWindow", "SourceSnapping", + true); + config_set_default_bool(globalConfig, "BasicWindow", "CenterSnapping", + false); + config_set_default_double(globalConfig, "BasicWindow", "SnapDistance", + 10.0); config_set_default_bool(globalConfig, "BasicWindow", - "KeepRecordingWhenStreamStops", false); + "RecordWhenStreaming", false); config_set_default_bool(globalConfig, "BasicWindow", - "SysTrayEnabled", true); + "KeepRecordingWhenStreamStops", false); + config_set_default_bool(globalConfig, "BasicWindow", "SysTrayEnabled", + true); config_set_default_bool(globalConfig, "BasicWindow", - "SysTrayWhenStarted", false); + "SysTrayWhenStarted", false); + config_set_default_bool(globalConfig, "BasicWindow", "SaveProjectors", + false); + config_set_default_bool(globalConfig, "BasicWindow", "ShowTransitions", + true); config_set_default_bool(globalConfig, "BasicWindow", - "SaveProjectors", false); - config_set_default_bool(globalConfig, "BasicWindow", - "ShowTransitions", true); - config_set_default_bool(globalConfig, "BasicWindow", - "ShowListboxToolbars", true); - config_set_default_bool(globalConfig, "BasicWindow", - "ShowStatusBar", true); - config_set_default_bool(globalConfig, "BasicWindow", - "StudioModeLabels", true); + "ShowListboxToolbars", true); + config_set_default_bool(globalConfig, "BasicWindow", "ShowStatusBar", + true); + config_set_default_bool(globalConfig, "BasicWindow", "StudioModeLabels", + true); if (!config_get_bool(globalConfig, "General", "Pre21Defaults")) { config_set_default_string(globalConfig, "General", - "CurrentTheme", DEFAULT_THEME); + "CurrentTheme", DEFAULT_THEME); } + config_set_default_string(globalConfig, "General", "HotkeyFocusType", + "NeverDisableHotkeys"); + config_set_default_bool(globalConfig, "BasicWindow", - "VerticalVolControl", false); + "VerticalVolControl", false); config_set_default_bool(globalConfig, "BasicWindow", - "MultiviewMouseSwitch", true); + "MultiviewMouseSwitch", true); config_set_default_bool(globalConfig, "BasicWindow", - "MultiviewDrawNames", true); + "MultiviewDrawNames", true); config_set_default_bool(globalConfig, "BasicWindow", - "MultiviewDrawAreas", true); + "MultiviewDrawAreas", true); #ifdef _WIN32 uint32_t winver = GetWindowsVersion(); config_set_default_bool(globalConfig, "Audio", "DisableAudioDucking", - true); + true); config_set_default_bool(globalConfig, "General", "BrowserHWAccel", - winver > 0x601); + winver > 0x601); #endif #ifdef __APPLE__ config_set_default_bool(globalConfig, "Video", "DisableOSXVSync", true); config_set_default_bool(globalConfig, "Video", "ResetOSXVSyncOnExit", - true); + true); #endif return true; } @@ -550,8 +556,8 @@ if (config.Open(path, CONFIG_OPEN_EXISTING) != 0) continue; - const char *curName = config_get_string(config, "General", - "Name"); + const char *curName = + config_get_string(config, "General", "Name"); if (astrcmpi(curName, name) == 0) { outputPath = ent.path; break; @@ -621,28 +627,32 @@ return false; if (astrcmpi(layout, "horizontaltop") == 0) { - config_set_int(globalConfig, "BasicWindow", "MultiviewLayout", + config_set_int( + globalConfig, "BasicWindow", "MultiviewLayout", static_cast<int>( MultiviewLayout::HORIZONTAL_TOP_8_SCENES)); return true; } if (astrcmpi(layout, "horizontalbottom") == 0) { - config_set_int(globalConfig, "BasicWindow", "MultiviewLayout", + config_set_int( + globalConfig, "BasicWindow", "MultiviewLayout", static_cast<int>( MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES)); return true; } if (astrcmpi(layout, "verticalleft") == 0) { - config_set_int(globalConfig, "BasicWindow", "MultiviewLayout", + config_set_int( + globalConfig, "BasicWindow", "MultiviewLayout", static_cast<int>( MultiviewLayout::VERTICAL_LEFT_8_SCENES)); return true; } if (astrcmpi(layout, "verticalright") == 0) { - config_set_int(globalConfig, "BasicWindow", "MultiviewLayout", + config_set_int( + globalConfig, "BasicWindow", "MultiviewLayout", static_cast<int>( MultiviewLayout::VERTICAL_RIGHT_8_SCENES)); return true; @@ -656,8 +666,7 @@ char path[512]; bool changed = false; - int len = GetConfigPath(path, sizeof(path), - "obs-studio/global.ini"); + int len = GetConfigPath(path, sizeof(path), "obs-studio/global.ini"); if (len <= 0) { return false; } @@ -670,35 +679,36 @@ if (!opt_starting_collection.empty()) { string path = GetSceneCollectionFileFromName( - opt_starting_collection.c_str()); + opt_starting_collection.c_str()); if (!path.empty()) { - config_set_string(globalConfig, - "Basic", "SceneCollection", - opt_starting_collection.c_str()); - config_set_string(globalConfig, - "Basic", "SceneCollectionFile", - path.c_str()); + config_set_string(globalConfig, "Basic", + "SceneCollection", + opt_starting_collection.c_str()); + config_set_string(globalConfig, "Basic", + "SceneCollectionFile", path.c_str()); changed = true; } } if (!opt_starting_profile.empty()) { - string path = GetProfileDirFromName( - opt_starting_profile.c_str()); + string path = + GetProfileDirFromName(opt_starting_profile.c_str()); if (!path.empty()) { config_set_string(globalConfig, "Basic", "Profile", - opt_starting_profile.c_str()); + opt_starting_profile.c_str()); config_set_string(globalConfig, "Basic", "ProfileDir", - path.c_str()); + path.c_str()); changed = true; } } + uint32_t lastVersion = + config_get_int(globalConfig, "General", "LastVersion"); + if (!config_has_user_value(globalConfig, "General", "Pre19Defaults")) { - uint32_t lastVersion = config_get_int(globalConfig, "General", - "LastVersion"); bool useOldDefaults = lastVersion && - lastVersion < MAKE_SEMANTIC_VERSION(19, 0, 0); + lastVersion < + MAKE_SEMANTIC_VERSION(19, 0, 0); config_set_bool(globalConfig, "General", "Pre19Defaults", useOldDefaults); @@ -706,10 +716,9 @@ } if (!config_has_user_value(globalConfig, "General", "Pre21Defaults")) { - uint32_t lastVersion = config_get_int(globalConfig, "General", - "LastVersion"); bool useOldDefaults = lastVersion && - lastVersion < MAKE_SEMANTIC_VERSION(21, 0, 0); + lastVersion < + MAKE_SEMANTIC_VERSION(21, 0, 0); config_set_bool(globalConfig, "General", "Pre21Defaults", useOldDefaults); @@ -717,10 +726,9 @@ } if (!config_has_user_value(globalConfig, "General", "Pre23Defaults")) { - uint32_t lastVersion = config_get_int(globalConfig, "General", - "LastVersion"); bool useOldDefaults = lastVersion && - lastVersion < MAKE_SEMANTIC_VERSION(23, 0, 0); + lastVersion < + MAKE_SEMANTIC_VERSION(23, 0, 0); config_set_bool(globalConfig, "General", "Pre23Defaults", useOldDefaults); @@ -728,12 +736,22 @@ } if (config_has_user_value(globalConfig, "BasicWindow", - "MultiviewLayout")) { - const char *layout = config_get_string(globalConfig, - "BasicWindow", "MultiviewLayout"); + "MultiviewLayout")) { + const char *layout = config_get_string( + globalConfig, "BasicWindow", "MultiviewLayout"); changed |= UpdatePre22MultiviewLayout(layout); } + if (lastVersion && lastVersion < MAKE_SEMANTIC_VERSION(24, 0, 0)) { + bool disableHotkeysInFocus = config_get_bool( + globalConfig, "General", "DisableHotkeysInFocus"); + if (disableHotkeysInFocus) + config_set_string(globalConfig, "General", + "HotkeyFocusType", + "DisableHotkeysInFocus"); + changed = true; + } + if (changed) config_save_safe(globalConfig, "tmp", nullptr); @@ -743,8 +761,8 @@ bool OBSApp::InitLocale() { ProfileScope("OBSApp::InitLocale"); - const char *lang = config_get_string(globalConfig, "General", - "Language"); + const char *lang = + config_get_string(globalConfig, "General", "Language"); locale = lang; @@ -757,12 +775,12 @@ textLookup = text_lookup_create(englishPath.c_str()); if (!textLookup) { OBSErrorBox(NULL, "Failed to create locale from file '%s'", - englishPath.c_str()); + englishPath.c_str()); return false; } - bool userLocale = config_has_user_value(globalConfig, "General", - "Language"); + bool userLocale = + config_has_user_value(globalConfig, "General", "Language"); bool defaultLang = astrcmpi(lang, DEFAULT_LANG) == 0; if (userLocale && defaultLang) @@ -784,7 +802,7 @@ continue; blog(LOG_INFO, "Using preferred locale '%s'", - locale_.c_str()); + locale_.c_str()); locale = locale_; return true; } @@ -799,27 +817,26 @@ if (GetDataFilePath(file.str().c_str(), path)) { if (!text_lookup_add(textLookup, path.c_str())) blog(LOG_ERROR, "Failed to add locale file '%s'", - path.c_str()); + path.c_str()); } else { blog(LOG_ERROR, "Could not find locale file '%s'", - file.str().c_str()); + file.str().c_str()); } return true; } -void OBSApp::AddExtraThemeColor(QPalette &pal, int group, - const char *name, uint32_t color) +void OBSApp::AddExtraThemeColor(QPalette &pal, int group, const char *name, + uint32_t color) { std::function<void(QPalette::ColorGroup)> func; -#define DEF_PALETTE_ASSIGN(name) \ - do { \ - func = [&] (QPalette::ColorGroup group) \ - { \ - pal.setColor(group, QPalette::name, \ - QColor::fromRgb(color)); \ - }; \ +#define DEF_PALETTE_ASSIGN(name) \ + do { \ + func = [&](QPalette::ColorGroup group) { \ + pal.setColor(group, QPalette::name, \ + QColor::fromRgb(color)); \ + }; \ } while (false) if (astrcmpi(name, "alternateBase") == 0) { @@ -853,7 +870,7 @@ } else if (astrcmpi(name, "shadow") == 0) { DEF_PALETTE_ASSIGN(Shadow); } else if (astrcmpi(name, "text") == 0 || - astrcmpi(name, "foreground") == 0) { + astrcmpi(name, "foreground") == 0) { DEF_PALETTE_ASSIGN(Text); } else if (astrcmpi(name, "toolTipBase") == 0) { DEF_PALETTE_ASSIGN(ToolTipBase); @@ -862,7 +879,7 @@ } else if (astrcmpi(name, "windowText") == 0) { DEF_PALETTE_ASSIGN(WindowText); } else if (astrcmpi(name, "window") == 0 || - astrcmpi(name, "background") == 0) { + astrcmpi(name, "background") == 0) { DEF_PALETTE_ASSIGN(Window); } else { return; @@ -885,9 +902,9 @@ struct CFParser { cf_parser cfp = {}; - inline ~CFParser() {cf_parser_free(&cfp);} - inline operator cf_parser*() {return &cfp;} - inline cf_parser *operator->() {return &cfp;} + inline ~CFParser() { cf_parser_free(&cfp); } + inline operator cf_parser *() { return &cfp; } + inline cf_parser *operator->() { return &cfp; } }; void OBSApp::ParseExtraThemeData(const char *path) @@ -900,16 +917,19 @@ cf_parser_parse(cfp, data, path); while (cf_go_to_token(cfp, "OBSTheme", nullptr)) { - if (!cf_next_token(cfp)) return; + if (!cf_next_token(cfp)) + return; int group = -1; if (cf_token_is(cfp, ":")) { ret = cf_next_token_should_be(cfp, ":", nullptr, - nullptr); - if (ret != PARSE_SUCCESS) continue; + nullptr); + if (ret != PARSE_SUCCESS) + continue; - if (!cf_next_token(cfp)) return; + if (!cf_next_token(cfp)) + return; if (cf_token_is(cfp, "disabled")) { group = QPalette::Disabled; @@ -921,27 +941,31 @@ continue; } - if (!cf_next_token(cfp)) return; + if (!cf_next_token(cfp)) + return; } - if (!cf_token_is(cfp, "{")) continue; + if (!cf_token_is(cfp, "{")) + continue; for (;;) { - if (!cf_next_token(cfp)) return; + if (!cf_next_token(cfp)) + return; ret = cf_token_is_type(cfp, CFTOKEN_NAME, "name", - nullptr); + nullptr); if (ret != PARSE_SUCCESS) break; DStr name; dstr_copy_strref(name, &cfp->cur_token->str); - ret = cf_next_token_should_be(cfp, ":", ";", - nullptr); - if (ret != PARSE_SUCCESS) continue; + ret = cf_next_token_should_be(cfp, ":", ";", nullptr); + if (ret != PARSE_SUCCESS) + continue; - if (!cf_next_token(cfp)) return; + if (!cf_next_token(cfp)) + return; const char *array; uint32_t color = 0; @@ -952,25 +976,31 @@ } else if (cf_token_is(cfp, "rgb")) { ret = cf_next_token_should_be(cfp, "(", ";", - nullptr); - if (ret != PARSE_SUCCESS) continue; - if (!cf_next_token(cfp)) return; + nullptr); + if (ret != PARSE_SUCCESS) + continue; + if (!cf_next_token(cfp)) + return; array = cfp->cur_token->str.array; color |= strtol(array, nullptr, 10) << 16; ret = cf_next_token_should_be(cfp, ",", ";", - nullptr); - if (ret != PARSE_SUCCESS) continue; - if (!cf_next_token(cfp)) return; + nullptr); + if (ret != PARSE_SUCCESS) + continue; + if (!cf_next_token(cfp)) + return; array = cfp->cur_token->str.array; color |= strtol(array, nullptr, 10) << 8; ret = cf_next_token_should_be(cfp, ",", ";", - nullptr); - if (ret != PARSE_SUCCESS) continue; - if (!cf_next_token(cfp)) return; + nullptr); + if (ret != PARSE_SUCCESS) + continue; + if (!cf_next_token(cfp)) + return; array = cfp->cur_token->str.array; color |= strtol(array, nullptr, 10); @@ -982,13 +1012,15 @@ color = 0; } - if (!cf_go_to_token(cfp, ";", nullptr)) return; + if (!cf_go_to_token(cfp, ";", nullptr)) + return; AddExtraThemeColor(pal, group, name->array, color); } ret = cf_token_should_be(cfp, "}", "}", nullptr); - if (ret != PARSE_SUCCESS) continue; + if (ret != PARSE_SUCCESS) + continue; } setPalette(pal); @@ -1003,8 +1035,7 @@ char userDir[512]; name = "themes/" + name + ".qss"; string temp = "obs-studio/" + name; - int ret = GetConfigPath(userDir, sizeof(userDir), - temp.c_str()); + int ret = GetConfigPath(userDir, sizeof(userDir), temp.c_str()); if (ret > 0 && QFile::exists(userDir)) { path = string(userDir); @@ -1027,13 +1058,12 @@ { defaultPalette = palette(); - const char *themeName = config_get_string(globalConfig, "General", - "CurrentTheme"); + const char *themeName = + config_get_string(globalConfig, "General", "CurrentTheme"); if (!themeName) { /* Use deprecated "Theme" value if available */ - themeName = config_get_string(globalConfig, - "General", "Theme"); + themeName = config_get_string(globalConfig, "General", "Theme"); if (!themeName) themeName = DEFAULT_THEME; if (!themeName) @@ -1047,8 +1077,7 @@ } OBSApp::OBSApp(int &argc, char **argv, profiler_name_store_t *store) - : QApplication(argc, argv), - profilerNameStore(store) + : QApplication(argc, argv), profilerNameStore(store) { sleepInhibitor = os_inhibit_sleep_create("OBS Video/audio"); @@ -1058,17 +1087,17 @@ OBSApp::~OBSApp() { #ifdef _WIN32 - bool disableAudioDucking = config_get_bool(globalConfig, "Audio", - "DisableAudioDucking"); + bool disableAudioDucking = + config_get_bool(globalConfig, "Audio", "DisableAudioDucking"); if (disableAudioDucking) DisableAudioDucking(false); #endif #ifdef __APPLE__ - bool vsyncDiabled = config_get_bool(globalConfig, "Video", - "DisableOSXVSync"); - bool resetVSync = config_get_bool(globalConfig, "Video", - "ResetOSXVSyncOnExit"); + bool vsyncDiabled = + config_get_bool(globalConfig, "Video", "DisableOSXVSync"); + bool resetVSync = + config_get_bool(globalConfig, "Video", "ResetOSXVSyncOnExit"); if (vsyncDiabled && resetVSync) EnableOSXVSync(true); #endif @@ -1174,31 +1203,31 @@ throw "Failed to load theme"; config_set_default_string(globalConfig, "Basic", "Profile", - Str("Untitled")); + Str("Untitled")); config_set_default_string(globalConfig, "Basic", "ProfileDir", - Str("Untitled")); + Str("Untitled")); config_set_default_string(globalConfig, "Basic", "SceneCollection", - Str("Untitled")); + Str("Untitled")); config_set_default_string(globalConfig, "Basic", "SceneCollectionFile", - Str("Untitled")); + Str("Untitled")); if (!config_has_user_value(globalConfig, "Basic", "Profile")) { config_set_string(globalConfig, "Basic", "Profile", - Str("Untitled")); + Str("Untitled")); config_set_string(globalConfig, "Basic", "ProfileDir", - Str("Untitled")); + Str("Untitled")); } if (!config_has_user_value(globalConfig, "Basic", "SceneCollection")) { - config_set_string(globalConfig, "Basic", - "SceneCollection", Str("Untitled")); - config_set_string(globalConfig, "Basic", - "SceneCollectionFile", Str("Untitled")); + config_set_string(globalConfig, "Basic", "SceneCollection", + Str("Untitled")); + config_set_string(globalConfig, "Basic", "SceneCollectionFile", + Str("Untitled")); } #ifdef _WIN32 - bool disableAudioDucking = config_get_bool(globalConfig, "Audio", - "DisableAudioDucking"); + bool disableAudioDucking = + config_get_bool(globalConfig, "Audio", "DisableAudioDucking"); if (disableAudioDucking) DisableAudioDucking(true); #endif @@ -1208,8 +1237,7 @@ EnableOSXVSync(false); #endif - enableHotkeysInFocus = !config_get_bool(globalConfig, "General", - "DisableHotkeysInFocus"); + UpdateHotkeyFocusSetting(false); move_basic_to_profiles(); move_basic_to_scene_collections(); @@ -1220,11 +1248,10 @@ const char *OBSApp::GetRenderModule() const { - const char *renderer = config_get_string(globalConfig, "Video", - "Renderer"); + const char *renderer = + config_get_string(globalConfig, "Video", "Renderer"); - return (astrcmpi(renderer, "Direct3D 11") == 0) ? - DL_D3D11 : DL_OPENGL; + return (astrcmpi(renderer, "Direct3D 11") == 0) ? DL_D3D11 : DL_OPENGL; } static bool StartupOBS(const char *locale, profiler_name_store_t *store) @@ -1240,13 +1267,33 @@ inline void OBSApp::ResetHotkeyState(bool inFocus) { obs_hotkey_enable_background_press( - inFocus || enableHotkeysInFocus); + (inFocus && enableHotkeysInFocus) || + (!inFocus && enableHotkeysOutOfFocus)); } -void OBSApp::EnableInFocusHotkeys(bool enable) +void OBSApp::UpdateHotkeyFocusSetting(bool resetState) { - enableHotkeysInFocus = enable; - ResetHotkeyState(applicationState() != Qt::ApplicationActive); + enableHotkeysInFocus = true; + enableHotkeysOutOfFocus = true; + + const char *hotkeyFocusType = + config_get_string(globalConfig, "General", "HotkeyFocusType"); + + if (astrcmpi(hotkeyFocusType, "DisableHotkeysInFocus") == 0) { + enableHotkeysInFocus = false; + } else if (astrcmpi(hotkeyFocusType, "DisableHotkeysOutOfFocus") == 0) { + enableHotkeysOutOfFocus = false; + } + + if (resetState) + ResetHotkeyState(applicationState() == Qt::ApplicationActive); +} + +void OBSApp::DisableHotkeys() +{ + enableHotkeysInFocus = false; + enableHotkeysOutOfFocus = false; + ResetHotkeyState(applicationState() == Qt::ApplicationActive); } Q_DECLARE_METATYPE(VoidFunc) @@ -1268,22 +1315,22 @@ return false; #ifdef _WIN32 - bool browserHWAccel = config_get_bool(globalConfig, "General", - "BrowserHWAccel"); + bool browserHWAccel = + config_get_bool(globalConfig, "General", "BrowserHWAccel"); obs_data_t *settings = obs_data_create(); obs_data_set_bool(settings, "BrowserHWAccel", browserHWAccel); obs_apply_private_data(settings); obs_data_release(settings); - blog(LOG_INFO, "Current Date/Time: %s", CurrentDateTimeString().c_str()); + blog(LOG_INFO, "Current Date/Time: %s", + CurrentDateTimeString().c_str()); blog(LOG_INFO, "Browser Hardware Acceleration: %s", - browserHWAccel ? "true" : "false"); + browserHWAccel ? "true" : "false"); #endif - blog(LOG_INFO, "Portable mode: %s", - portable_mode ? "true" : "false"); + blog(LOG_INFO, "Portable mode: %s", portable_mode ? "true" : "false"); setQuitOnLastWindowClosed(false); @@ -1295,12 +1342,10 @@ mainWindow->OBSInit(); connect(this, &QGuiApplication::applicationStateChanged, - [this](Qt::ApplicationState state) - { - ResetHotkeyState( - state != Qt::ApplicationActive); - }); - ResetHotkeyState(applicationState() != Qt::ApplicationActive); + [this](Qt::ApplicationState state) { + ResetHotkeyState(state == Qt::ApplicationActive); + }); + ResetHotkeyState(applicationState() == Qt::ApplicationActive); return true; } @@ -1311,15 +1356,14 @@ #ifdef HAVE_OBSCONFIG_H ver << OBS_VERSION; #else - ver << LIBOBS_API_MAJOR_VER << "." << - LIBOBS_API_MINOR_VER << "." << - LIBOBS_API_PATCH_VER; + ver << LIBOBS_API_MAJOR_VER << "." << LIBOBS_API_MINOR_VER << "." + << LIBOBS_API_PATCH_VER; #endif ver << " ("; #ifdef _WIN32 - if (sizeof(void*) == 8) + if (sizeof(void *) == 8) ver << "64-bit, "; else ver << "32-bit, "; @@ -1342,13 +1386,13 @@ } #ifdef __APPLE__ -#define INPUT_AUDIO_SOURCE "coreaudio_input_capture" +#define INPUT_AUDIO_SOURCE "coreaudio_input_capture" #define OUTPUT_AUDIO_SOURCE "coreaudio_output_capture" #elif _WIN32 -#define INPUT_AUDIO_SOURCE "wasapi_input_capture" +#define INPUT_AUDIO_SOURCE "wasapi_input_capture" #define OUTPUT_AUDIO_SOURCE "wasapi_output_capture" #else -#define INPUT_AUDIO_SOURCE "pulse_input_capture" +#define INPUT_AUDIO_SOURCE "pulse_input_capture" #define OUTPUT_AUDIO_SOURCE "pulse_output_capture" #endif @@ -1388,7 +1432,7 @@ } QString OBSTranslator::translate(const char *context, const char *sourceText, - const char *disambiguation, int n) const + const char *disambiguation, int n) const { const char *out = nullptr; if (!App()->TranslateString(sourceText, &out)) @@ -1425,26 +1469,37 @@ static uint64_t convert_log_name(bool has_prefix, const char *name) { - BaseLexer lex; - string year, month, day, hour, minute, second; + BaseLexer lex; + string year, month, day, hour, minute, second; lexer_start(lex, name); if (has_prefix) { string temp; - if (!get_token(lex, temp, BASETOKEN_ALPHA)) return 0; + if (!get_token(lex, temp, BASETOKEN_ALPHA)) + return 0; } - if (!get_token(lex, year, BASETOKEN_DIGIT)) return 0; - if (!expect_token(lex, "-", BASETOKEN_OTHER)) return 0; - if (!get_token(lex, month, BASETOKEN_DIGIT)) return 0; - if (!expect_token(lex, "-", BASETOKEN_OTHER)) return 0; - if (!get_token(lex, day, BASETOKEN_DIGIT)) return 0; - if (!get_token(lex, hour, BASETOKEN_DIGIT)) return 0; - if (!expect_token(lex, "-", BASETOKEN_OTHER)) return 0; - if (!get_token(lex, minute, BASETOKEN_DIGIT)) return 0; - if (!expect_token(lex, "-", BASETOKEN_OTHER)) return 0; - if (!get_token(lex, second, BASETOKEN_DIGIT)) return 0; + if (!get_token(lex, year, BASETOKEN_DIGIT)) + return 0; + if (!expect_token(lex, "-", BASETOKEN_OTHER)) + return 0; + if (!get_token(lex, month, BASETOKEN_DIGIT)) + return 0; + if (!expect_token(lex, "-", BASETOKEN_OTHER)) + return 0; + if (!get_token(lex, day, BASETOKEN_DIGIT)) + return 0; + if (!get_token(lex, hour, BASETOKEN_DIGIT)) + return 0; + if (!expect_token(lex, "-", BASETOKEN_OTHER)) + return 0; + if (!get_token(lex, minute, BASETOKEN_DIGIT)) + return 0; + if (!expect_token(lex, "-", BASETOKEN_OTHER)) + return 0; + if (!get_token(lex, second, BASETOKEN_DIGIT)) + return 0; stringstream timestring; timestring << year << month << day << hour << minute << second; @@ -1453,13 +1508,13 @@ static void delete_oldest_file(bool has_prefix, const char *location) { - BPtr<char> logDir(GetConfigPathPtr(location)); - string oldestLog; - uint64_t oldest_ts = (uint64_t)-1; + BPtr<char> logDir(GetConfigPathPtr(location)); + string oldestLog; + uint64_t oldest_ts = (uint64_t)-1; struct os_dirent *entry; unsigned int maxLogs = (unsigned int)config_get_uint( - App()->GlobalConfig(), "General", "MaxLogs"); + App()->GlobalConfig(), "General", "MaxLogs"); os_dir_t *dir = os_opendir(logDir); if (dir) { @@ -1469,8 +1524,8 @@ if (entry->directory || *entry->d_name == '.') continue; - uint64_t ts = convert_log_name(has_prefix, - entry->d_name); + uint64_t ts = + convert_log_name(has_prefix, entry->d_name); if (ts) { if (ts < oldest_ts) { @@ -1494,20 +1549,20 @@ } static void get_last_log(bool has_prefix, const char *subdir_to_use, - std::string &last) + std::string &last) { - BPtr<char> logDir(GetConfigPathPtr(subdir_to_use)); + BPtr<char> logDir(GetConfigPathPtr(subdir_to_use)); struct os_dirent *entry; - os_dir_t *dir = os_opendir(logDir); - uint64_t highest_ts = 0; + os_dir_t *dir = os_opendir(logDir); + uint64_t highest_ts = 0; if (dir) { while ((entry = os_readdir(dir)) != NULL) { if (entry->directory || *entry->d_name == '.') continue; - uint64_t ts = convert_log_name(has_prefix, - entry->d_name); + uint64_t ts = + convert_log_name(has_prefix, entry->d_name); if (ts > highest_ts) { last = entry->d_name; @@ -1521,35 +1576,30 @@ string GenerateTimeDateFilename(const char *extension, bool noSpace) { - time_t now = time(0); - char file[256] = {}; + time_t now = time(0); + char file[256] = {}; struct tm *cur_time; cur_time = localtime(&now); snprintf(file, sizeof(file), "%d-%02d-%02d%c%02d-%02d-%02d.%s", - cur_time->tm_year+1900, - cur_time->tm_mon+1, - cur_time->tm_mday, - noSpace ? '_' : ' ', - cur_time->tm_hour, - cur_time->tm_min, - cur_time->tm_sec, - extension); + cur_time->tm_year + 1900, cur_time->tm_mon + 1, + cur_time->tm_mday, noSpace ? '_' : ' ', cur_time->tm_hour, + cur_time->tm_min, cur_time->tm_sec, extension); return string(file); } string GenerateSpecifiedFilename(const char *extension, bool noSpace, - const char *format) + const char *format) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); bool autoRemux = config_get_bool(main->Config(), "Video", "AutoRemux"); if ((strcmp(extension, "mp4") == 0) && autoRemux) extension = "mkv"; - BPtr<char> filename = os_generate_formatted_filename(extension, - !noSpace, format); + BPtr<char> filename = + os_generate_formatted_filename(extension, !noSpace, format); remuxFilename = string(filename); remuxAfterRecord = autoRemux; @@ -1597,11 +1647,9 @@ #ifdef _WIN32 BPtr<wchar_t> wpath; os_utf8_to_wcs_ptr(path, 0, &wpath); - logFile.open(wpath, - ios_base::in | ios_base::out | ios_base::trunc); + logFile.open(wpath, ios_base::in | ios_base::out | ios_base::trunc); #else - logFile.open(path, - ios_base::in | ios_base::out | ios_base::trunc); + logFile.open(path, ios_base::in | ios_base::out | ios_base::trunc); #endif if (logFile.is_open()) { @@ -1612,23 +1660,20 @@ } } -static auto ProfilerNameStoreRelease = [](profiler_name_store_t *store) -{ +static auto ProfilerNameStoreRelease = [](profiler_name_store_t *store) { profiler_name_store_free(store); }; -using ProfilerNameStore = - std::unique_ptr<profiler_name_store_t, - decltype(ProfilerNameStoreRelease)>; +using ProfilerNameStore = std::unique_ptr<profiler_name_store_t, + decltype(ProfilerNameStoreRelease)>; ProfilerNameStore CreateNameStore() { return ProfilerNameStore{profiler_name_store_create(), - ProfilerNameStoreRelease}; + ProfilerNameStoreRelease}; } -static auto SnapshotRelease = [](profiler_snapshot_t *snap) -{ +static auto SnapshotRelease = [](profiler_snapshot_t *snap) { profile_snapshot_free(snap); }; @@ -1659,11 +1704,10 @@ BPtr<char> path = GetConfigPathPtr(dst.str().c_str()); if (!profiler_snapshot_dump_csv_gz(snap.get(), path)) blog(LOG_WARNING, "Could not save profiler data to '%s'", - static_cast<const char*>(path)); + static_cast<const char *>(path)); } -static auto ProfilerFree = [](void *) -{ +static auto ProfilerFree = [](void *) { profiler_stop(); auto snap = GetSnapshot(); @@ -1683,9 +1727,8 @@ auto profilerNameStore = CreateNameStore(); - std::unique_ptr<void, decltype(ProfilerFree)> - prof_release(static_cast<void*>(&ProfilerFree), - ProfilerFree); + std::unique_ptr<void, decltype(ProfilerFree)> prof_release( + static_cast<void *>(&ProfilerFree), ProfilerFree); profiler_start(); profile_register_root(run_program_init, 0); @@ -1722,13 +1765,13 @@ if (!multi) { QMessageBox::StandardButtons buttons( - QMessageBox::Yes | QMessageBox::Cancel); + QMessageBox::Yes | QMessageBox::Cancel); QMessageBox mb(QMessageBox::Question, - QTStr("AlreadyRunning.Title"), - QTStr("AlreadyRunning.Text"), buttons, - nullptr); + QTStr("AlreadyRunning.Title"), + QTStr("AlreadyRunning.Text"), buttons, + nullptr); mb.setButtonText(QMessageBox::Yes, - QTStr("AlreadyRunning.LaunchAnyway")); + QTStr("AlreadyRunning.LaunchAnyway")); mb.setButtonText(QMessageBox::Cancel, QTStr("Cancel")); mb.setDefaultButton(QMessageBox::Cancel); @@ -1747,17 +1790,17 @@ if (multi) { blog(LOG_INFO, "User enabled --multi flag and is now " - "running multiple instances of OBS."); + "running multiple instances of OBS."); } else { blog(LOG_WARNING, "================================"); blog(LOG_WARNING, "Warning: OBS is already running!"); blog(LOG_WARNING, "================================"); blog(LOG_WARNING, "User is now running multiple " - "instances of OBS!"); + "instances of OBS!"); } /* --------------------------------------- */ -run: + run: #endif if (!created_log) { @@ -1771,7 +1814,8 @@ for (int i = 2; i < argc; ++i) { stor << " " << argv[i]; } - blog(LOG_INFO, "Command Line Arguments: %s", stor.str().c_str()); + blog(LOG_INFO, "Command Line Arguments: %s", + stor.str().c_str()); } if (!program.OBSInit()) @@ -1793,9 +1837,9 @@ #ifdef _WIN32 -#define CRASH_MESSAGE \ +#define CRASH_MESSAGE \ "Woops, OBS has crashed!\n\nWould you like to copy the crash log " \ - "to the clipboard? (Crash logs will still be saved to the " \ + "to the clipboard? (Crash logs will still be saved to the " \ "%appdata%\\obs-studio\\crashes directory)" static void main_crash_handler(const char *format, va_list args, void *param) @@ -1818,16 +1862,16 @@ BPtr<wchar_t> wpath; os_utf8_to_wcs_ptr(path, 0, &wpath); file.open(wpath, ios_base::in | ios_base::out | ios_base::trunc | - ios_base::binary); + ios_base::binary); #else - file.open(path, ios_base::in | ios_base::out | ios_base::trunc | - ios_base::binary); + file.open(path, ios_base::in | ios_base::out | ios_base::trunc | + ios_base::binary); #endif file << text; file.close(); int ret = MessageBoxA(NULL, CRASH_MESSAGE, "OBS has crashed!", - MB_YESNO | MB_ICONERROR | MB_TASKMODAL); + MB_YESNO | MB_ICONERROR | MB_TASKMODAL); if (ret == IDYES) { size_t len = strlen(text); @@ -1863,8 +1907,8 @@ tp.Privileges[0].Luid = val; tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - AdjustTokenPrivileges(token, false, &tp, - sizeof(tp), NULL, NULL); + AdjustTokenPrivileges(token, false, &tp, sizeof(tp), NULL, + NULL); } CloseHandle(token); @@ -1982,17 +2026,17 @@ bool WindowPositionValid(QRect rect) { - for (QScreen* screen: QGuiApplication::screens()) { + for (QScreen *screen : QGuiApplication::screens()) { if (screen->availableGeometry().intersects(rect)) return true; } return false; } -static inline bool arg_is(const char *arg, - const char *long_form, const char *short_form) +static inline bool arg_is(const char *arg, const char *long_form, + const char *short_form) { - return (long_form && strcmp(arg, long_form) == 0) || + return (long_form && strcmp(arg, long_form) == 0) || (short_form && strcmp(arg, short_form) == 0); } @@ -2100,8 +2144,8 @@ if (!mode) return false; - const char *section = (strcmp(mode, "Advanced") == 0) ? - "AdvOut" : "SimpleOutput"; + const char *section = (strcmp(mode, "Advanced") == 0) ? "AdvOut" + : "SimpleOutput"; if (move_reconnect_settings(config, section)) { config_remove_value(config, "SimpleOutput", "Reconnect"); @@ -2179,7 +2223,7 @@ while (ent) { if (ent->directory && strcmp(ent->d_name, ".") != 0 && - strcmp(ent->d_name, "..") != 0) { + strcmp(ent->d_name, "..") != 0) { strcat(path, "/"); strcat(path, ent->d_name); strcat(path, "/basic.ini"); @@ -2192,16 +2236,15 @@ if (update_ffmpeg_output(config) || update_reconnect(config)) { config_save_safe(config, "tmp", - nullptr); + nullptr); } } - if (config) { - const char *sEnc = config_get_string(config, - "AdvOut", "Encoder"); - const char *rEnc = config_get_string(config, - "AdvOut", "RecEncoder"); + const char *sEnc = config_get_string( + config, "AdvOut", "Encoder"); + const char *rEnc = config_get_string( + config, "AdvOut", "RecEncoder"); /* replace "cbr" option with "rate_control" for * each profile's encoder data */ @@ -2227,10 +2270,11 @@ os_closedir(dir); } -void ctrlc_handler (int s) { +void ctrlc_handler(int s) +{ UNUSED_PARAMETER(s); - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); main->close(); } @@ -2247,7 +2291,6 @@ sigaction(SIGINT, &sig_handler, NULL); - /* Block SIGPIPE in all threads, this can happen if a thread calls write on a closed pipe. */ sigset_t sigpipe_mask; @@ -2301,13 +2344,16 @@ opt_start_replaybuffer = true; } else if (arg_is(argv[i], "--collection", nullptr)) { - if (++i < argc) opt_starting_collection = argv[i]; + if (++i < argc) + opt_starting_collection = argv[i]; } else if (arg_is(argv[i], "--profile", nullptr)) { - if (++i < argc) opt_starting_profile = argv[i]; + if (++i < argc) + opt_starting_profile = argv[i]; } else if (arg_is(argv[i], "--scene", nullptr)) { - if (++i < argc) opt_starting_scene = argv[i]; + if (++i < argc) + opt_starting_scene = argv[i]; } else if (arg_is(argv[i], "--minimize-to-tray", nullptr)) { opt_minimize_tray = true; @@ -2319,30 +2365,30 @@ opt_allow_opengl = true; } else if (arg_is(argv[i], "--help", "-h")) { - std::cout << - "--help, -h: Get list of available commands.\n\n" << - "--startstreaming: Automatically start streaming.\n" << - "--startrecording: Automatically start recording.\n" << - "--startreplaybuffer: Start replay buffer.\n\n" << - "--collection <string>: Use specific scene collection." - << "\n" << - "--profile <string>: Use specific profile.\n" << - "--scene <string>: Start with specific scene.\n\n" << - "--studio-mode: Enable studio mode.\n" << - "--minimize-to-tray: Minimize to system tray.\n" << - "--portable, -p: Use portable mode.\n" << - "--multi, -m: Don't warn when launching multiple instances.\n\n" << - "--verbose: Make log more verbose.\n" << - "--always-on-top: Start in 'always on top' mode.\n\n" << - "--unfiltered_log: Make log unfiltered.\n\n" << - "--allow-opengl: Allow OpenGL on Windows.\n\n" << - "--version, -V: Get current version.\n"; + std::cout + << "--help, -h: Get list of available commands.\n\n" + << "--startstreaming: Automatically start streaming.\n" + << "--startrecording: Automatically start recording.\n" + << "--startreplaybuffer: Start replay buffer.\n\n" + << "--collection <string>: Use specific scene collection." + << "\n" + << "--profile <string>: Use specific profile.\n" + << "--scene <string>: Start with specific scene.\n\n" + << "--studio-mode: Enable studio mode.\n" + << "--minimize-to-tray: Minimize to system tray.\n" + << "--portable, -p: Use portable mode.\n" + << "--multi, -m: Don't warn when launching multiple instances.\n\n" + << "--verbose: Make log more verbose.\n" + << "--always-on-top: Start in 'always on top' mode.\n\n" + << "--unfiltered_log: Make log unfiltered.\n\n" + << "--allow-opengl: Allow OpenGL on Windows.\n\n" + << "--version, -V: Get current version.\n"; exit(0); } else if (arg_is(argv[i], "--version", "-V")) { - std::cout << "OBS Studio - " << - App()->GetVersionString() << "\n"; + std::cout << "OBS Studio - " + << App()->GetVersionString() << "\n"; exit(0); } }
View file
obs-studio-23.2.1.tar.xz/UI/obs-app.hpp -> obs-studio-24.0.0.tar.xz/UI/obs-app.hpp
Changed
@@ -36,48 +36,51 @@ std::string CurrentTimeString(); std::string CurrentDateTimeString(); -std::string GenerateTimeDateFilename(const char *extension, bool noSpace=false); +std::string GenerateTimeDateFilename(const char *extension, + bool noSpace = false); std::string GenerateSpecifiedFilename(const char *extension, bool noSpace, - const char *format); + const char *format); QObject *CreateShortcutFilter(); struct BaseLexer { lexer lex; + public: - inline BaseLexer() {lexer_init(&lex);} - inline ~BaseLexer() {lexer_free(&lex);} - operator lexer*() {return &lex;} + inline BaseLexer() { lexer_init(&lex); } + inline ~BaseLexer() { lexer_free(&lex); } + operator lexer *() { return &lex; } }; class OBSTranslator : public QTranslator { Q_OBJECT public: - virtual bool isEmpty() const override {return false;} + virtual bool isEmpty() const override { return false; } virtual QString translate(const char *context, const char *sourceText, - const char *disambiguation, int n) const override; + const char *disambiguation, + int n) const override; }; -typedef std::function<void ()> VoidFunc; +typedef std::function<void()> VoidFunc; class OBSApp : public QApplication { Q_OBJECT private: - std::string locale; - std::string theme; - ConfigFile globalConfig; - TextLookup textLookup; - OBSContext obsContext; - QPointer<OBSMainWindow> mainWindow; - profiler_name_store_t *profilerNameStore = nullptr; - - os_inhibit_t *sleepInhibitor = nullptr; - int sleepInhibitRefs = 0; + std::string locale; + std::string theme; + ConfigFile globalConfig; + TextLookup textLookup; + OBSContext obsContext; + QPointer<OBSMainWindow> mainWindow; + profiler_name_store_t *profilerNameStore = nullptr; - bool enableHotkeysInFocus = true; + os_inhibit_t *sleepInhibitor = nullptr; + int sleepInhibitRefs = 0; + bool enableHotkeysInFocus = true; + bool enableHotkeysOutOfFocus = true; std::deque<obs_frontend_translate_ui_cb> translatorHooks; @@ -93,8 +96,8 @@ QPalette defaultPalette; void ParseExtraThemeData(const char *path); - void AddExtraThemeColor(QPalette &pal, int group, - const char *name, uint32_t color); + void AddExtraThemeColor(QPalette &pal, int group, const char *name, + uint32_t color); public: OBSApp(int &argc, char **argv, profiler_name_store_t *store); @@ -103,21 +106,24 @@ void AppInit(); bool OBSInit(); - void EnableInFocusHotkeys(bool enable); - - inline QMainWindow *GetMainWindow() const {return mainWindow.data();} - - inline config_t *GlobalConfig() const {return globalConfig;} + void UpdateHotkeyFocusSetting(bool reset = true); + void DisableHotkeys(); - inline const char *GetLocale() const + inline bool HotkeysEnabledInFocus() const { - return locale.c_str(); + return enableHotkeysInFocus; } - inline const char *GetTheme() const {return theme.c_str();} + inline QMainWindow *GetMainWindow() const { return mainWindow.data(); } + + inline config_t *GlobalConfig() const { return globalConfig; } + + inline const char *GetLocale() const { return locale.c_str(); } + + inline const char *GetTheme() const { return theme.c_str(); } bool SetTheme(std::string name, std::string path = ""); - inline lookup_t *GetTextLookup() const {return textLookup;} + inline lookup_t *GetTextLookup() const { return textLookup; } inline const char *GetString(const char *lookupVal) const { @@ -146,15 +152,18 @@ inline void IncrementSleepInhibition() { - if (!sleepInhibitor) return; + if (!sleepInhibitor) + return; if (sleepInhibitRefs++ == 0) os_inhibit_sleep_set_active(sleepInhibitor, true); } inline void DecrementSleepInhibition() { - if (!sleepInhibitor) return; - if (sleepInhibitRefs == 0) return; + if (!sleepInhibitor) + return; + if (sleepInhibitRefs == 0) + return; if (--sleepInhibitRefs == 0) os_inhibit_sleep_set_active(sleepInhibitor, false); } @@ -164,10 +173,7 @@ translatorHooks.emplace_front(cb); } - inline void PopUITranslation() - { - translatorHooks.pop_front(); - } + inline void PopUITranslation() { translatorHooks.pop_front(); } public slots: void Exec(VoidFunc func); @@ -182,12 +188,21 @@ int GetProgramDataPath(char *path, size_t size, const char *name); char *GetProgramDataPathPtr(const char *name); -inline OBSApp *App() {return static_cast<OBSApp*>(qApp);} +inline OBSApp *App() +{ + return static_cast<OBSApp *>(qApp); +} -inline config_t *GetGlobalConfig() {return App()->GlobalConfig();} +inline config_t *GetGlobalConfig() +{ + return App()->GlobalConfig(); +} std::vector<std::pair<std::string, std::string>> GetLocaleNames(); -inline const char *Str(const char *lookup) {return App()->GetString(lookup);} +inline const char *Str(const char *lookup) +{ + return App()->GetString(lookup); +} #define QTStr(lookupVal) QString::fromUtf8(Str(lookupVal)) bool GetFileSafeName(const char *name, std::string &file); @@ -197,8 +212,8 @@ static inline int GetProfilePath(char *path, size_t size, const char *file) { - OBSMainWindow *window = reinterpret_cast<OBSMainWindow*>( - App()->GetMainWindow()); + OBSMainWindow *window = + reinterpret_cast<OBSMainWindow *>(App()->GetMainWindow()); return window->GetProfilePath(path, size, file); }
View file
obs-studio-23.2.1.tar.xz/UI/obs-frontend-api/obs-frontend-api.cpp -> obs-studio-24.0.0.tar.xz/UI/obs-frontend-api/obs-frontend-api.cpp
Changed
@@ -14,7 +14,7 @@ { if (!c) { blog(LOG_WARNING, "Tried to call %s with no callbacks!", - func_name); + func_name); return false; } @@ -26,7 +26,7 @@ static char **convert_string_list(vector<string> &strings) { size_t size = 0; - size_t string_data_offset = (strings.size() + 1) * sizeof(char*); + size_t string_data_offset = (strings.size() + 1) * sizeof(char *); uint8_t *out; char **ptr_list; char *string_data; @@ -39,9 +39,9 @@ if (!size) return 0; - out = (uint8_t*)bmalloc(size); - ptr_list = (char**)out; - string_data = (char*)(out + string_data_offset); + out = (uint8_t *)bmalloc(size); + ptr_list = (char **)out; + string_data = (char *)(out + string_data_offset); for (auto &str : strings) { *ptr_list = string_data; @@ -52,30 +52,27 @@ } *ptr_list = nullptr; - return (char**)out; + return (char **)out; } /* ------------------------------------------------------------------------- */ void *obs_frontend_get_main_window(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_main_window() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_main_window() + : nullptr; } void *obs_frontend_get_main_window_handle(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_main_window_handle() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_main_window_handle() + : nullptr; } void *obs_frontend_get_system_tray(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_system_tray() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_system_tray() + : nullptr; } char **obs_frontend_get_scene_names(void) @@ -99,31 +96,32 @@ void obs_frontend_get_scenes(struct obs_frontend_source_list *sources) { - if (callbacks_valid()) c->obs_frontend_get_scenes(sources); + if (callbacks_valid()) + c->obs_frontend_get_scenes(sources); } obs_source_t *obs_frontend_get_current_scene(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_current_scene() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_current_scene() + : nullptr; } void obs_frontend_set_current_scene(obs_source_t *scene) { - if (callbacks_valid()) c->obs_frontend_set_current_scene(scene); + if (callbacks_valid()) + c->obs_frontend_set_current_scene(scene); } void obs_frontend_get_transitions(struct obs_frontend_source_list *sources) { - if (callbacks_valid()) c->obs_frontend_get_transitions(sources); + if (callbacks_valid()) + c->obs_frontend_get_transitions(sources); } obs_source_t *obs_frontend_get_current_transition(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_current_transition() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_current_transition() + : nullptr; } void obs_frontend_set_current_transition(obs_source_t *transition) @@ -134,9 +132,8 @@ int obs_frontend_get_transition_duration(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_transition_duration() - : 0; + return !!callbacks_valid() ? c->obs_frontend_get_transition_duration() + : 0; } void obs_frontend_set_transition_duration(int duration) @@ -158,8 +155,8 @@ char *obs_frontend_get_current_scene_collection(void) { return !!callbacks_valid() - ? c->obs_frontend_get_current_scene_collection() - : nullptr; + ? c->obs_frontend_get_current_scene_collection() + : nullptr; } void obs_frontend_set_current_scene_collection(const char *collection) @@ -170,9 +167,8 @@ bool obs_frontend_add_scene_collection(const char *name) { - return callbacks_valid() - ? c->obs_frontend_add_scene_collection(name) - : false; + return callbacks_valid() ? c->obs_frontend_add_scene_collection(name) + : false; } char **obs_frontend_get_profiles(void) @@ -187,9 +183,8 @@ char *obs_frontend_get_current_profile(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_current_profile() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_current_profile() + : nullptr; } void obs_frontend_set_current_profile(const char *profile) @@ -200,91 +195,103 @@ void obs_frontend_streaming_start(void) { - if (callbacks_valid()) c->obs_frontend_streaming_start(); + if (callbacks_valid()) + c->obs_frontend_streaming_start(); } void obs_frontend_streaming_stop(void) { - if (callbacks_valid()) c->obs_frontend_streaming_stop(); + if (callbacks_valid()) + c->obs_frontend_streaming_stop(); } bool obs_frontend_streaming_active(void) { - return !!callbacks_valid() - ? c->obs_frontend_streaming_active() - : false; + return !!callbacks_valid() ? c->obs_frontend_streaming_active() : false; } void obs_frontend_recording_start(void) { - if (callbacks_valid()) c->obs_frontend_recording_start(); + if (callbacks_valid()) + c->obs_frontend_recording_start(); } void obs_frontend_recording_stop(void) { - if (callbacks_valid()) c->obs_frontend_recording_stop(); + if (callbacks_valid()) + c->obs_frontend_recording_stop(); } bool obs_frontend_recording_active(void) { - return !!callbacks_valid() - ? c->obs_frontend_recording_active() - : false; + return !!callbacks_valid() ? c->obs_frontend_recording_active() : false; +} + +void obs_frontend_recording_pause(bool pause) +{ + if (!!callbacks_valid()) + c->obs_frontend_recording_pause(pause); +} + +bool obs_frontend_recording_paused(void) +{ + return !!callbacks_valid() ? c->obs_frontend_recording_paused() : false; } void obs_frontend_replay_buffer_start(void) { - if (callbacks_valid()) c->obs_frontend_replay_buffer_start(); + if (callbacks_valid()) + c->obs_frontend_replay_buffer_start(); } void obs_frontend_replay_buffer_save(void) { - if (callbacks_valid()) c->obs_frontend_replay_buffer_save(); + if (callbacks_valid()) + c->obs_frontend_replay_buffer_save(); } void obs_frontend_replay_buffer_stop(void) { - if (callbacks_valid()) c->obs_frontend_replay_buffer_stop(); + if (callbacks_valid()) + c->obs_frontend_replay_buffer_stop(); } bool obs_frontend_replay_buffer_active(void) { - return !!callbacks_valid() - ? c->obs_frontend_replay_buffer_active() - : false; + return !!callbacks_valid() ? c->obs_frontend_replay_buffer_active() + : false; } void *obs_frontend_add_tools_menu_qaction(const char *name) { return !!callbacks_valid() - ? c->obs_frontend_add_tools_menu_qaction(name) - : nullptr; + ? c->obs_frontend_add_tools_menu_qaction(name) + : nullptr; } void obs_frontend_add_tools_menu_item(const char *name, - obs_frontend_cb callback, void *private_data) + obs_frontend_cb callback, + void *private_data) { if (callbacks_valid()) c->obs_frontend_add_tools_menu_item(name, callback, - private_data); + private_data); } void *obs_frontend_add_dock(void *dock) { - return !!callbacks_valid() - ? c->obs_frontend_add_dock(dock) - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_add_dock(dock) : nullptr; } void obs_frontend_add_event_callback(obs_frontend_event_cb callback, - void *private_data) + void *private_data) { if (callbacks_valid()) c->obs_frontend_add_event_callback(callback, private_data); } void obs_frontend_remove_event_callback(obs_frontend_event_cb callback, - void *private_data) + void *private_data) { if (callbacks_valid()) c->obs_frontend_remove_event_callback(callback, private_data); @@ -292,37 +299,32 @@ obs_output_t *obs_frontend_get_streaming_output(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_streaming_output() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_streaming_output() + : nullptr; } obs_output_t *obs_frontend_get_recording_output(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_recording_output() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_recording_output() + : nullptr; } obs_output_t *obs_frontend_get_replay_buffer_output(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_replay_buffer_output() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_replay_buffer_output() + : nullptr; } config_t *obs_frontend_get_profile_config(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_profile_config() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_profile_config() + : nullptr; } config_t *obs_frontend_get_global_config(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_global_config() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_global_config() + : nullptr; } void obs_frontend_save(void) @@ -344,28 +346,28 @@ } void obs_frontend_add_save_callback(obs_frontend_save_cb callback, - void *private_data) + void *private_data) { if (callbacks_valid()) c->obs_frontend_add_save_callback(callback, private_data); } void obs_frontend_remove_save_callback(obs_frontend_save_cb callback, - void *private_data) + void *private_data) { if (callbacks_valid()) c->obs_frontend_remove_save_callback(callback, private_data); } void obs_frontend_add_preload_callback(obs_frontend_save_cb callback, - void *private_data) + void *private_data) { if (callbacks_valid()) c->obs_frontend_add_preload_callback(callback, private_data); } void obs_frontend_remove_preload_callback(obs_frontend_save_cb callback, - void *private_data) + void *private_data) { if (callbacks_valid()) c->obs_frontend_remove_preload_callback(callback, private_data); @@ -389,11 +391,10 @@ c->obs_frontend_set_streaming_service(service); } -obs_service_t* obs_frontend_get_streaming_service(void) +obs_service_t *obs_frontend_get_streaming_service(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_streaming_service() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_streaming_service() + : nullptr; } void obs_frontend_save_streaming_service(void) @@ -405,8 +406,8 @@ bool obs_frontend_preview_program_mode_active(void) { return !!callbacks_valid() - ? c->obs_frontend_preview_program_mode_active() - : false; + ? c->obs_frontend_preview_program_mode_active() + : false; } void obs_frontend_set_preview_program_mode(bool enable) @@ -429,16 +430,13 @@ bool obs_frontend_preview_enabled(void) { - return !!callbacks_valid() - ? c->obs_frontend_preview_enabled() - : false; + return !!callbacks_valid() ? c->obs_frontend_preview_enabled() : false; } obs_source_t *obs_frontend_get_current_preview_scene(void) { - return !!callbacks_valid() - ? c->obs_frontend_get_current_preview_scene() - : nullptr; + return !!callbacks_valid() ? c->obs_frontend_get_current_preview_scene() + : nullptr; } void obs_frontend_set_current_preview_scene(obs_source_t *scene)
View file
obs-studio-23.2.1.tar.xz/UI/obs-frontend-api/obs-frontend-api.h -> obs-studio-24.0.0.tar.xz/UI/obs-frontend-api/obs-frontend-api.h
Changed
@@ -43,7 +43,10 @@ OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED, OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP, - OBS_FRONTEND_EVENT_FINISHED_LOADING + OBS_FRONTEND_EVENT_FINISHED_LOADING, + + OBS_FRONTEND_EVENT_RECORDING_PAUSED, + OBS_FRONTEND_EVENT_RECORDING_UNPAUSED, }; /* ------------------------------------------------------------------------- */ @@ -51,11 +54,11 @@ #ifndef SWIG struct obs_frontend_source_list { - DARRAY(obs_source_t*) sources; + DARRAY(obs_source_t *) sources; }; -static inline void obs_frontend_source_list_free( - struct obs_frontend_source_list *source_list) +static inline void +obs_frontend_source_list_free(struct obs_frontend_source_list *source_list) { size_t num = source_list->sources.num; for (size_t i = 0; i < num; i++) @@ -89,8 +92,8 @@ EXPORT obs_source_t *obs_frontend_get_current_scene(void); EXPORT void obs_frontend_set_current_scene(obs_source_t *scene); -EXPORT void obs_frontend_get_transitions( - struct obs_frontend_source_list *sources); +EXPORT void +obs_frontend_get_transitions(struct obs_frontend_source_list *sources); EXPORT obs_source_t *obs_frontend_get_current_transition(void); EXPORT void obs_frontend_set_current_transition(obs_source_t *transition); EXPORT int obs_frontend_get_transition_duration(void); @@ -109,37 +112,38 @@ EXPORT void *obs_frontend_add_tools_menu_qaction(const char *name); EXPORT void obs_frontend_add_tools_menu_item(const char *name, - obs_frontend_cb callback, void *private_data); + obs_frontend_cb callback, + void *private_data); /* takes QDockWidget and returns QAction */ EXPORT void *obs_frontend_add_dock(void *dock); typedef void (*obs_frontend_event_cb)(enum obs_frontend_event event, - void *private_data); + void *private_data); EXPORT void obs_frontend_add_event_callback(obs_frontend_event_cb callback, - void *private_data); + void *private_data); EXPORT void obs_frontend_remove_event_callback(obs_frontend_event_cb callback, - void *private_data); + void *private_data); typedef void (*obs_frontend_save_cb)(obs_data_t *save_data, bool saving, - void *private_data); + void *private_data); EXPORT void obs_frontend_add_save_callback(obs_frontend_save_cb callback, - void *private_data); + void *private_data); EXPORT void obs_frontend_remove_save_callback(obs_frontend_save_cb callback, - void *private_data); + void *private_data); EXPORT void obs_frontend_add_preload_callback(obs_frontend_save_cb callback, - void *private_data); + void *private_data); EXPORT void obs_frontend_remove_preload_callback(obs_frontend_save_cb callback, - void *private_data); + void *private_data); typedef bool (*obs_frontend_translate_ui_cb)(const char *text, - const char **out); + const char **out); -EXPORT void obs_frontend_push_ui_translation( - obs_frontend_translate_ui_cb translate); +EXPORT void +obs_frontend_push_ui_translation(obs_frontend_translate_ui_cb translate); EXPORT void obs_frontend_pop_ui_translation(void); #endif //!SWIG @@ -151,6 +155,8 @@ EXPORT void obs_frontend_recording_start(void); EXPORT void obs_frontend_recording_stop(void); EXPORT bool obs_frontend_recording_active(void); +EXPORT void obs_frontend_recording_pause(bool pause); +EXPORT bool obs_frontend_recording_paused(void); EXPORT void obs_frontend_replay_buffer_start(void); EXPORT void obs_frontend_replay_buffer_save(void); @@ -169,7 +175,7 @@ EXPORT config_t *obs_frontend_get_global_config(void); EXPORT void obs_frontend_set_streaming_service(obs_service_t *service); -EXPORT obs_service_t* obs_frontend_get_streaming_service(void); +EXPORT obs_service_t *obs_frontend_get_streaming_service(void); EXPORT void obs_frontend_save_streaming_service(void); EXPORT bool obs_frontend_preview_program_mode_active(void);
View file
obs-studio-23.2.1.tar.xz/UI/obs-frontend-api/obs-frontend-internal.hpp -> obs-studio-24.0.0.tar.xz/UI/obs-frontend-api/obs-frontend-internal.hpp
Changed
@@ -7,103 +7,113 @@ struct obs_frontend_callbacks { virtual ~obs_frontend_callbacks() {} - virtual void *obs_frontend_get_main_window(void)=0; - virtual void *obs_frontend_get_main_window_handle(void)=0; - virtual void *obs_frontend_get_system_tray(void)=0; + virtual void *obs_frontend_get_main_window(void) = 0; + virtual void *obs_frontend_get_main_window_handle(void) = 0; + virtual void *obs_frontend_get_system_tray(void) = 0; - virtual void obs_frontend_get_scenes( - struct obs_frontend_source_list *sources)=0; - virtual obs_source_t *obs_frontend_get_current_scene(void)=0; - virtual void obs_frontend_set_current_scene(obs_source_t *scene)=0; + virtual void + obs_frontend_get_scenes(struct obs_frontend_source_list *sources) = 0; + virtual obs_source_t *obs_frontend_get_current_scene(void) = 0; + virtual void obs_frontend_set_current_scene(obs_source_t *scene) = 0; virtual void obs_frontend_get_transitions( - struct obs_frontend_source_list *sources)=0; - virtual obs_source_t *obs_frontend_get_current_transition(void)=0; - virtual void obs_frontend_set_current_transition( - obs_source_t *transition)=0; - virtual int obs_frontend_get_transition_duration(void)=0; - virtual void obs_frontend_set_transition_duration(int duration)=0; + struct obs_frontend_source_list *sources) = 0; + virtual obs_source_t *obs_frontend_get_current_transition(void) = 0; + virtual void + obs_frontend_set_current_transition(obs_source_t *transition) = 0; + virtual int obs_frontend_get_transition_duration(void) = 0; + virtual void obs_frontend_set_transition_duration(int duration) = 0; virtual void obs_frontend_get_scene_collections( - std::vector<std::string> &strings)=0; - virtual char *obs_frontend_get_current_scene_collection(void)=0; - virtual void obs_frontend_set_current_scene_collection( - const char *collection)=0; - virtual bool obs_frontend_add_scene_collection(const char *name)=0; - - virtual void obs_frontend_get_profiles( - std::vector<std::string> &strings)=0; - virtual char *obs_frontend_get_current_profile(void)=0; - virtual void obs_frontend_set_current_profile(const char *profile)=0; - - virtual void obs_frontend_streaming_start(void)=0; - virtual void obs_frontend_streaming_stop(void)=0; - virtual bool obs_frontend_streaming_active(void)=0; - - virtual void obs_frontend_recording_start(void)=0; - virtual void obs_frontend_recording_stop(void)=0; - virtual bool obs_frontend_recording_active(void)=0; - - virtual void obs_frontend_replay_buffer_start(void)=0; + std::vector<std::string> &strings) = 0; + virtual char *obs_frontend_get_current_scene_collection(void) = 0; + virtual void + obs_frontend_set_current_scene_collection(const char *collection) = 0; + virtual bool obs_frontend_add_scene_collection(const char *name) = 0; + + virtual void + obs_frontend_get_profiles(std::vector<std::string> &strings) = 0; + virtual char *obs_frontend_get_current_profile(void) = 0; + virtual void obs_frontend_set_current_profile(const char *profile) = 0; + + virtual void obs_frontend_streaming_start(void) = 0; + virtual void obs_frontend_streaming_stop(void) = 0; + virtual bool obs_frontend_streaming_active(void) = 0; + + virtual void obs_frontend_recording_start(void) = 0; + virtual void obs_frontend_recording_stop(void) = 0; + virtual bool obs_frontend_recording_active(void) = 0; + virtual void obs_frontend_recording_pause(bool pause) = 0; + virtual bool obs_frontend_recording_paused(void) = 0; + + virtual void obs_frontend_replay_buffer_start(void) = 0; virtual void obs_frontend_replay_buffer_save(void) = 0; - virtual void obs_frontend_replay_buffer_stop(void)=0; - virtual bool obs_frontend_replay_buffer_active(void)=0; + virtual void obs_frontend_replay_buffer_stop(void) = 0; + virtual bool obs_frontend_replay_buffer_active(void) = 0; - virtual void *obs_frontend_add_tools_menu_qaction(const char *name)=0; + virtual void *obs_frontend_add_tools_menu_qaction(const char *name) = 0; virtual void obs_frontend_add_tools_menu_item(const char *name, - obs_frontend_cb callback, void *private_data)=0; + obs_frontend_cb callback, + void *private_data) = 0; - virtual void *obs_frontend_add_dock(void *dock)=0; + virtual void *obs_frontend_add_dock(void *dock) = 0; - virtual void obs_frontend_add_event_callback( - obs_frontend_event_cb callback, void *private_data)=0; - virtual void obs_frontend_remove_event_callback( - obs_frontend_event_cb callback, void *private_data)=0; + virtual void + obs_frontend_add_event_callback(obs_frontend_event_cb callback, + void *private_data) = 0; + virtual void + obs_frontend_remove_event_callback(obs_frontend_event_cb callback, + void *private_data) = 0; - virtual obs_output_t *obs_frontend_get_streaming_output(void)=0; - virtual obs_output_t *obs_frontend_get_recording_output(void)=0; - virtual obs_output_t *obs_frontend_get_replay_buffer_output(void)=0; + virtual obs_output_t *obs_frontend_get_streaming_output(void) = 0; + virtual obs_output_t *obs_frontend_get_recording_output(void) = 0; + virtual obs_output_t *obs_frontend_get_replay_buffer_output(void) = 0; - virtual config_t *obs_frontend_get_profile_config(void)=0; - virtual config_t *obs_frontend_get_global_config(void)=0; + virtual config_t *obs_frontend_get_profile_config(void) = 0; + virtual config_t *obs_frontend_get_global_config(void) = 0; virtual void obs_frontend_save(void) = 0; virtual void obs_frontend_defer_save_begin(void) = 0; virtual void obs_frontend_defer_save_end(void) = 0; - virtual void obs_frontend_add_save_callback( - obs_frontend_save_cb callback, void *private_data)=0; - virtual void obs_frontend_remove_save_callback( - obs_frontend_save_cb callback, void *private_data)=0; - - virtual void obs_frontend_add_preload_callback( - obs_frontend_save_cb callback, void *private_data)=0; - virtual void obs_frontend_remove_preload_callback( - obs_frontend_save_cb callback, void *private_data)=0; + virtual void + obs_frontend_add_save_callback(obs_frontend_save_cb callback, + void *private_data) = 0; + virtual void + obs_frontend_remove_save_callback(obs_frontend_save_cb callback, + void *private_data) = 0; + + virtual void + obs_frontend_add_preload_callback(obs_frontend_save_cb callback, + void *private_data) = 0; + virtual void + obs_frontend_remove_preload_callback(obs_frontend_save_cb callback, + void *private_data) = 0; virtual void obs_frontend_push_ui_translation( - obs_frontend_translate_ui_cb translate)=0; - virtual void obs_frontend_pop_ui_translation(void)=0; + obs_frontend_translate_ui_cb translate) = 0; + virtual void obs_frontend_pop_ui_translation(void) = 0; - virtual void obs_frontend_set_streaming_service( - obs_service_t *service)=0; - virtual obs_service_t *obs_frontend_get_streaming_service(void)=0; - virtual void obs_frontend_save_streaming_service()=0; + virtual void + obs_frontend_set_streaming_service(obs_service_t *service) = 0; + virtual obs_service_t *obs_frontend_get_streaming_service(void) = 0; + virtual void obs_frontend_save_streaming_service() = 0; - virtual bool obs_frontend_preview_program_mode_active(void)=0; - virtual void obs_frontend_set_preview_program_mode(bool enable)=0; - virtual void obs_frontend_preview_program_trigger_transition(void)=0; + virtual bool obs_frontend_preview_program_mode_active(void) = 0; + virtual void obs_frontend_set_preview_program_mode(bool enable) = 0; + virtual void obs_frontend_preview_program_trigger_transition(void) = 0; - virtual bool obs_frontend_preview_enabled(void)=0; - virtual void obs_frontend_set_preview_enabled(bool enable)=0; + virtual bool obs_frontend_preview_enabled(void) = 0; + virtual void obs_frontend_set_preview_enabled(bool enable) = 0; - virtual obs_source_t *obs_frontend_get_current_preview_scene(void)=0; - virtual void obs_frontend_set_current_preview_scene(obs_source_t *scene)=0; + virtual obs_source_t *obs_frontend_get_current_preview_scene(void) = 0; + virtual void + obs_frontend_set_current_preview_scene(obs_source_t *scene) = 0; - virtual void on_load(obs_data_t *settings)=0; - virtual void on_preload(obs_data_t *settings)=0; - virtual void on_save(obs_data_t *settings)=0; - virtual void on_event(enum obs_frontend_event event)=0; + virtual void on_load(obs_data_t *settings) = 0; + virtual void on_preload(obs_data_t *settings) = 0; + virtual void on_save(obs_data_t *settings) = 0; + virtual void on_event(enum obs_frontend_event event) = 0; }; -EXPORT void obs_frontend_set_callbacks_internal( - obs_frontend_callbacks *callbacks); +EXPORT void +obs_frontend_set_callbacks_internal(obs_frontend_callbacks *callbacks);
View file
obs-studio-23.2.1.tar.xz/UI/platform-osx.mm -> obs-studio-24.0.0.tar.xz/UI/platform-osx.mm
Changed
@@ -58,7 +58,7 @@ throw "Could not change working directory to " "bundle path"; - } catch (const char* error) { + } catch (const char *error) { blog(LOG_ERROR, "InitBundle: %s", error); return false; } @@ -77,7 +77,7 @@ appropriateForURL:nil create:true error:nil]; - + if (!url) return getenv("HOME"); @@ -97,7 +97,7 @@ return locale.first; if (!lang_match.size() && - locale.first.substr(0, 2) == lang.substr(0, 2)) + locale.first.substr(0, 2) == lang.substr(0, 2)) lang_match = locale.first; } @@ -150,12 +150,13 @@ if (!initialized) { void *quartzCore = dlopen("/System/Library/Frameworks/" - "QuartzCore.framework/QuartzCore", RTLD_LAZY); + "QuartzCore.framework/QuartzCore", + RTLD_LAZY); if (quartzCore) { - set_debug_options = (set_int_t)dlsym(quartzCore, - "CGSSetDebugOptions"); - deferred_updates = (set_int_t)dlsym(quartzCore, - "CGSDeferredUpdates"); + set_debug_options = (set_int_t)dlsym( + quartzCore, "CGSSetDebugOptions"); + deferred_updates = (set_int_t)dlsym( + quartzCore, "CGSDeferredUpdates"); valid = set_debug_options && deferred_updates; } @@ -174,5 +175,6 @@ if (enable) [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; else - [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited]; + [NSApp setActivationPolicy: + NSApplicationActivationPolicyProhibited]; }
View file
obs-studio-23.2.1.tar.xz/UI/platform-windows.cpp -> obs-studio-24.0.0.tar.xz/UI/platform-windows.cpp
Changed
@@ -37,8 +37,8 @@ #include <util/windows/HRError.hpp> #include <util/windows/ComPtr.hpp> -static inline bool check_path(const char* data, const char *path, - string &output) +static inline bool check_path(const char *data, const char *path, + string &output) { ostringstream str; str << path << data; @@ -65,10 +65,10 @@ string GetDefaultVideoSavePath() { wchar_t path_utf16[MAX_PATH]; - char path_utf8[MAX_PATH] = {}; + char path_utf8[MAX_PATH] = {}; SHGetFolderPathW(NULL, CSIDL_MYVIDEO, NULL, SHGFP_TYPE_CURRENT, - path_utf16); + path_utf16); os_wcs_to_utf8(path_utf16, wcslen(path_utf16), path_utf8, MAX_PATH); return string(path_utf8); @@ -79,18 +79,18 @@ vector<string> result; ULONG num, length = 0; - if (!GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &num, - nullptr, &length)) + if (!GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &num, nullptr, + &length)) return result; vector<wchar_t> buffer(length); if (!GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &num, - &buffer.front(), &length)) + &buffer.front(), &length)) return result; result.reserve(num); auto start = begin(buffer); - auto end_ = end(buffer); + auto end_ = end(buffer); decltype(start) separator; while ((separator = find(start, end_, 0)) != end_) { if (result.size() == num) @@ -162,7 +162,7 @@ void SetAeroEnabled(bool enable) { - static HRESULT (WINAPI *func)(UINT) = nullptr; + static HRESULT(WINAPI * func)(UINT) = nullptr; static bool failed = false; if (!func) { @@ -176,8 +176,8 @@ return; } - func = reinterpret_cast<decltype(func)>(GetProcAddress(dwm, - "DwmEnableComposition")); + func = reinterpret_cast<decltype(func)>( + GetProcAddress(dwm, "DwmEnableComposition")); if (!func) { failed = true; return; @@ -197,7 +197,7 @@ { HWND hwnd = (HWND)window->winId(); SetWindowPos(hwnd, enable ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } void SetProcessPriority(const char *priority) @@ -208,11 +208,13 @@ if (strcmp(priority, "High") == 0) SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); else if (strcmp(priority, "AboveNormal") == 0) - SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS); + SetPriorityClass(GetCurrentProcess(), + ABOVE_NORMAL_PRIORITY_CLASS); else if (strcmp(priority, "Normal") == 0) SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); else if (strcmp(priority, "BelowNormal") == 0) - SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS); + SetPriorityClass(GetCurrentProcess(), + BELOW_NORMAL_PRIORITY_CLASS); else if (strcmp(priority, "Idle") == 0) SetPriorityClass(GetCurrentProcess(), IDLE_PRIORITY_CLASS); } @@ -227,16 +229,16 @@ bool DisableAudioDucking(bool disable) { - ComPtr<IMMDeviceEnumerator> devEmum; - ComPtr<IMMDevice> device; + ComPtr<IMMDeviceEnumerator> devEmum; + ComPtr<IMMDevice> device; ComPtr<IAudioSessionManager2> sessionManager2; - ComPtr<IAudioSessionControl> sessionControl; + ComPtr<IAudioSessionControl> sessionControl; ComPtr<IAudioSessionControl2> sessionControl2; - HRESULT result = CoCreateInstance(__uuidof(MMDeviceEnumerator), - nullptr, CLSCTX_INPROC_SERVER, - __uuidof(IMMDeviceEnumerator), - (void **)&devEmum); + HRESULT result = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, + CLSCTX_INPROC_SERVER, + __uuidof(IMMDeviceEnumerator), + (void **)&devEmum); if (FAILED(result)) return false; @@ -245,13 +247,13 @@ return false; result = device->Activate(__uuidof(IAudioSessionManager2), - CLSCTX_INPROC_SERVER, nullptr, - (void **)&sessionManager2); + CLSCTX_INPROC_SERVER, nullptr, + (void **)&sessionManager2); if (FAILED(result)) return false; result = sessionManager2->GetAudioSessionControl(nullptr, 0, - &sessionControl); + &sessionControl); if (FAILED(result)) return false;
View file
obs-studio-23.2.1.tar.xz/UI/platform-x11.cpp -> obs-studio-24.0.0.tar.xz/UI/platform-x11.cpp
Changed
@@ -29,8 +29,8 @@ #include "platform.hpp" using namespace std; -static inline bool check_path(const char* data, const char *path, - string &output) +static inline bool check_path(const char *data, const char *path, + string &output) { ostringstream str; str << path << data;
View file
obs-studio-23.2.1.tar.xz/UI/platform.hpp -> obs-studio-24.0.0.tar.xz/UI/platform.hpp
Changed
@@ -48,6 +48,7 @@ class RunOnceMutex { RunOnceMutexData *data = nullptr; + public: RunOnceMutex(RunOnceMutexData *data_) : data(data_) {} RunOnceMutex(const RunOnceMutex &rom) = delete;
View file
obs-studio-23.2.1.tar.xz/UI/properties-view.cpp -> obs-studio-24.0.0.tar.xz/UI/properties-view.cpp
Changed
@@ -37,23 +37,18 @@ static inline QColor color_from_int(long long val) { - return QColor( val & 0xff, - (val >> 8) & 0xff, - (val >> 16) & 0xff, + return QColor(val & 0xff, (val >> 8) & 0xff, (val >> 16) & 0xff, (val >> 24) & 0xff); } static inline long long color_to_int(QColor color) { - auto shift = [&](unsigned val, int shift) - { + auto shift = [&](unsigned val, int shift) { return ((val & 0xff) << shift); }; - return shift(color.red(), 0) | - shift(color.green(), 8) | - shift(color.blue(), 16) | - shift(color.alpha(), 24); + return shift(color.red(), 0) | shift(color.green(), 8) | + shift(color.blue(), 16) | shift(color.alpha(), 24); } namespace { @@ -68,16 +63,11 @@ frame_rate_tag() = default; - explicit frame_rate_tag(tag_type type) - : type(type) - {} + explicit frame_rate_tag(tag_type type) : type(type) {} - explicit frame_rate_tag(const char *val) - : type(USER), - val(val) - {} + explicit frame_rate_tag(const char *val) : type(USER), val(val) {} - static frame_rate_tag simple() { return frame_rate_tag{SIMPLE}; } + static frame_rate_tag simple() { return frame_rate_tag{SIMPLE}; } static frame_rate_tag rational() { return frame_rate_tag{RATIONAL}; } }; @@ -96,7 +86,7 @@ if (obj) { properties.reset(reloadCallback(obj)); } else { - properties.reset(reloadCallback((void*)type.c_str())); + properties.reset(reloadCallback((void *)type.c_str())); obs_properties_apply_settings(properties.get(), settings); } @@ -181,28 +171,30 @@ } OBSPropertiesView::OBSPropertiesView(OBSData settings_, void *obj_, - PropertiesReloadCallback reloadCallback, - PropertiesUpdateCallback callback_, int minSize_) - : VScrollArea (nullptr), - properties (nullptr, obs_properties_destroy), - settings (settings_), - obj (obj_), - reloadCallback (reloadCallback), - callback (callback_), - minSize (minSize_) + PropertiesReloadCallback reloadCallback, + PropertiesUpdateCallback callback_, + int minSize_) + : VScrollArea(nullptr), + properties(nullptr, obs_properties_destroy), + settings(settings_), + obj(obj_), + reloadCallback(reloadCallback), + callback(callback_), + minSize(minSize_) { setFrameShape(QFrame::NoFrame); ReloadProperties(); } OBSPropertiesView::OBSPropertiesView(OBSData settings_, const char *type_, - PropertiesReloadCallback reloadCallback_, int minSize_) - : VScrollArea (nullptr), - properties (nullptr, obs_properties_destroy), - settings (settings_), - type (type_), - reloadCallback (reloadCallback_), - minSize (minSize_) + PropertiesReloadCallback reloadCallback_, + int minSize_) + : VScrollArea(nullptr), + properties(nullptr, obs_properties_destroy), + settings(settings_), + type(type_), + reloadCallback(reloadCallback_), + minSize(minSize_) { setFrameShape(QFrame::NoFrame); ReloadProperties(); @@ -215,7 +207,7 @@ } QWidget *OBSPropertiesView::NewWidget(obs_property_t *prop, QWidget *widget, - const char *signal) + const char *signal) { const char *long_desc = obs_property_long_description(prop); @@ -231,7 +223,7 @@ { const char *name = obs_property_name(prop); const char *desc = obs_property_description(prop); - bool val = obs_data_get_bool(settings, name); + bool val = obs_data_get_bool(settings, name); QCheckBox *checkbox = new QCheckBox(QT_UTF8(desc)); checkbox->setCheckState(val ? Qt::Checked : Qt::Unchecked); @@ -239,11 +231,11 @@ } QWidget *OBSPropertiesView::AddText(obs_property_t *prop, QFormLayout *layout, - QLabel *&label) + QLabel *&label) { - const char *name = obs_property_name(prop); - const char *val = obs_data_get_string(settings, name); - obs_text_type type = obs_property_text_type(prop); + const char *name = obs_property_name(prop); + const char *val = obs_data_get_string(settings, name); + obs_text_type type = obs_property_text_type(prop); if (type == OBS_TEXT_MULTILINE) { QPlainTextEdit *edit = new QPlainTextEdit(QT_UTF8(val)); @@ -263,10 +255,9 @@ subLayout->addWidget(show); WidgetInfo *info = new WidgetInfo(this, prop, edit); - connect(show, &QAbstractButton::toggled, - info, &WidgetInfo::TogglePasswordText); - connect(show, &QAbstractButton::toggled, [=](bool hide) - { + connect(show, &QAbstractButton::toggled, info, + &WidgetInfo::TogglePasswordText); + connect(show, &QAbstractButton::toggled, [=](bool hide) { show->setText(hide ? QTStr("Hide") : QTStr("Show")); }); children.emplace_back(info); @@ -276,8 +267,8 @@ edit->setToolTip(QT_UTF8(obs_property_long_description(prop))); - connect(edit, SIGNAL(textEdited(const QString &)), - info, SLOT(ControlChanged())); + connect(edit, SIGNAL(textEdited(const QString &)), info, + SLOT(ControlChanged())); return nullptr; } @@ -290,13 +281,13 @@ } void OBSPropertiesView::AddPath(obs_property_t *prop, QFormLayout *layout, - QLabel **label) + QLabel **label) { - const char *name = obs_property_name(prop); - const char *val = obs_data_get_string(settings, name); - QLayout *subLayout = new QHBoxLayout(); - QLineEdit *edit = new QLineEdit(); - QPushButton *button = new QPushButton(QTStr("Browse")); + const char *name = obs_property_name(prop); + const char *val = obs_data_get_string(settings, name); + QLayout *subLayout = new QHBoxLayout(); + QLineEdit *edit = new QLineEdit(); + QPushButton *button = new QPushButton(QTStr("Browse")); if (!obs_property_enabled(prop)) { edit->setEnabled(false); @@ -320,14 +311,14 @@ } void OBSPropertiesView::AddInt(obs_property_t *prop, QFormLayout *layout, - QLabel **label) + QLabel **label) { obs_number_type type = obs_property_int_type(prop); QLayout *subLayout = new QHBoxLayout(); const char *name = obs_property_name(prop); - int val = (int)obs_data_get_int(settings, name); - QSpinBox *spin = new SpinBoxIgnoreScroll(); + int val = (int)obs_data_get_int(settings, name); + QSpinBox *spin = new SpinBoxIgnoreScroll(); if (!obs_property_enabled(prop)) spin->setEnabled(false); @@ -356,10 +347,10 @@ slider->setOrientation(Qt::Horizontal); subLayout->addWidget(slider); - connect(slider, SIGNAL(valueChanged(int)), - spin, SLOT(setValue(int))); - connect(spin, SIGNAL(valueChanged(int)), - slider, SLOT(setValue(int))); + connect(slider, SIGNAL(valueChanged(int)), spin, + SLOT(setValue(int))); + connect(spin, SIGNAL(valueChanged(int)), slider, + SLOT(setValue(int))); } connect(spin, SIGNAL(valueChanged(int)), info, SLOT(ControlChanged())); @@ -371,13 +362,13 @@ } void OBSPropertiesView::AddFloat(obs_property_t *prop, QFormLayout *layout, - QLabel **label) + QLabel **label) { obs_number_type type = obs_property_float_type(prop); QLayout *subLayout = new QHBoxLayout(); - const char *name = obs_property_name(prop); - double val = obs_data_get_double(settings, name); + const char *name = obs_property_name(prop); + double val = obs_data_get_double(settings, name); QDoubleSpinBox *spin = new QDoubleSpinBox(); if (!obs_property_enabled(prop)) @@ -404,14 +395,14 @@ slider->setOrientation(Qt::Horizontal); subLayout->addWidget(slider); - connect(slider, SIGNAL(doubleValChanged(double)), - spin, SLOT(setValue(double))); - connect(spin, SIGNAL(valueChanged(double)), - slider, SLOT(setDoubleVal(double))); + connect(slider, SIGNAL(doubleValChanged(double)), spin, + SLOT(setValue(double))); + connect(spin, SIGNAL(valueChanged(double)), slider, + SLOT(setDoubleVal(double))); } connect(spin, SIGNAL(valueChanged(double)), info, - SLOT(ControlChanged())); + SLOT(ControlChanged())); subLayout->addWidget(spin); @@ -420,7 +411,7 @@ } static void AddComboItem(QComboBox *combo, obs_property_t *prop, - obs_combo_format format, size_t idx) + obs_combo_format format, size_t idx) { const char *name = obs_property_list_item_name(prop, idx); QVariant var; @@ -447,7 +438,7 @@ return; QStandardItemModel *model = - dynamic_cast<QStandardItemModel*>(combo->model()); + dynamic_cast<QStandardItemModel *>(combo->model()); if (!model) return; @@ -455,11 +446,11 @@ item->setFlags(Qt::NoItemFlags); } -template <long long get_int(obs_data_t*, const char*), - double get_double(obs_data_t*, const char*), - const char *get_string(obs_data_t*, const char*)> +template<long long get_int(obs_data_t *, const char *), + double get_double(obs_data_t *, const char *), + const char *get_string(obs_data_t *, const char *)> static string from_obs_data(obs_data_t *data, const char *name, - obs_combo_format format) + obs_combo_format format) { switch (format) { case OBS_COMBO_FORMAT_INT: @@ -474,28 +465,29 @@ } static string from_obs_data(obs_data_t *data, const char *name, - obs_combo_format format) + obs_combo_format format) { return from_obs_data<obs_data_get_int, obs_data_get_double, - obs_data_get_string>(data, name, format); + obs_data_get_string>(data, name, format); } static string from_obs_data_autoselect(obs_data_t *data, const char *name, - obs_combo_format format) + obs_combo_format format) { return from_obs_data<obs_data_get_autoselect_int, - obs_data_get_autoselect_double, - obs_data_get_autoselect_string>(data, name, format); + obs_data_get_autoselect_double, + obs_data_get_autoselect_string>(data, name, + format); } QWidget *OBSPropertiesView::AddList(obs_property_t *prop, bool &warning) { - const char *name = obs_property_name(prop); - QComboBox *combo = new ComboBoxIgnoreScroll(); - obs_combo_type type = obs_property_list_type(prop); + const char *name = obs_property_name(prop); + QComboBox *combo = new ComboBoxIgnoreScroll(); + obs_combo_type type = obs_property_list_type(prop); obs_combo_format format = obs_property_list_format(prop); - size_t count = obs_property_list_item_count(prop); - int idx = -1; + size_t count = obs_property_list_item_count(prop); + int idx = -1; for (size_t i = 0; i < count; i++) AddComboItem(combo, prop, format, i); @@ -509,7 +501,7 @@ string value = from_obs_data(settings, name, format); if (format == OBS_COMBO_FORMAT_STRING && - type == OBS_COMBO_TYPE_EDITABLE) { + type == OBS_COMBO_TYPE_EDITABLE) { combo->lineEdit()->setText(QT_UTF8(value.c_str())); } else { idx = combo->findData(QByteArray(value.c_str())); @@ -517,34 +509,33 @@ if (type == OBS_COMBO_TYPE_EDITABLE) return NewWidget(prop, combo, - SIGNAL(editTextChanged(const QString &))); + SIGNAL(editTextChanged(const QString &))); if (idx != -1) combo->setCurrentIndex(idx); - + if (obs_data_has_autoselect_value(settings, name)) { string autoselect = from_obs_data_autoselect(settings, name, format); int id = combo->findData(QT_UTF8(autoselect.c_str())); if (id != -1 && id != idx) { - QString actual = combo->itemText(id); + QString actual = combo->itemText(id); QString selected = combo->itemText(idx); QString combined = QTStr( "Basic.PropertiesWindow.AutoSelectFormat"); combo->setItemText(idx, - combined.arg(selected).arg(actual)); + combined.arg(selected).arg(actual)); } } - QAbstractItemModel *model = combo->model(); warning = idx != -1 && - model->flags(model->index(idx, 0)) == Qt::NoItemFlags; + model->flags(model->index(idx, 0)) == Qt::NoItemFlags; WidgetInfo *info = new WidgetInfo(this, prop, combo); connect(combo, SIGNAL(currentIndexChanged(int)), info, - SLOT(ControlChanged())); + SLOT(ControlChanged())); children.emplace_back(info); /* trigger a settings update if the index was not found */ @@ -554,9 +545,8 @@ return combo; } -static void NewButton(QLayout *layout, WidgetInfo *info, - const char *themeIcon, - void (WidgetInfo::*method)()) +static void NewButton(QLayout *layout, WidgetInfo *info, const char *themeIcon, + void (WidgetInfo::*method)()) { QPushButton *button = new QPushButton(); button->setProperty("themeID", themeIcon); @@ -570,12 +560,12 @@ } void OBSPropertiesView::AddEditableList(obs_property_t *prop, - QFormLayout *layout, QLabel *&label) + QFormLayout *layout, QLabel *&label) { - const char *name = obs_property_name(prop); + const char *name = obs_property_name(prop); obs_data_array_t *array = obs_data_get_array(settings, name); - QListWidget *list = new QListWidget(); - size_t count = obs_data_array_count(array); + QListWidget *list = new QListWidget(); + size_t count = obs_data_array_count(array); if (!obs_property_enabled(prop)) list->setEnabled(false); @@ -588,25 +578,24 @@ obs_data_t *item = obs_data_array_item(array, i); list->addItem(QT_UTF8(obs_data_get_string(item, "value"))); list->setItemSelected(list->item((int)i), - obs_data_get_bool(item, "selected")); + obs_data_get_bool(item, "selected")); list->setItemHidden(list->item((int)i), - obs_data_get_bool(item, "hidden")); + obs_data_get_bool(item, "hidden")); obs_data_release(item); } WidgetInfo *info = new WidgetInfo(this, prop, list); QVBoxLayout *sideLayout = new QVBoxLayout(); - NewButton(sideLayout, info, "addIconSmall", - &WidgetInfo::EditListAdd); + NewButton(sideLayout, info, "addIconSmall", &WidgetInfo::EditListAdd); NewButton(sideLayout, info, "removeIconSmall", - &WidgetInfo::EditListRemove); + &WidgetInfo::EditListRemove); NewButton(sideLayout, info, "configIconSmall", - &WidgetInfo::EditListEdit); + &WidgetInfo::EditListEdit); NewButton(sideLayout, info, "upArrowIconSmall", - &WidgetInfo::EditListUp); + &WidgetInfo::EditListUp); NewButton(sideLayout, info, "downArrowIconSmall", - &WidgetInfo::EditListDown); + &WidgetInfo::EditListDown); sideLayout->addStretch(0); QHBoxLayout *subLayout = new QHBoxLayout(); @@ -632,13 +621,13 @@ } void OBSPropertiesView::AddColor(obs_property_t *prop, QFormLayout *layout, - QLabel *&label) + QLabel *&label) { - QPushButton *button = new QPushButton; - QLabel *colorLabel = new QLabel; - const char *name = obs_property_name(prop); - long long val = obs_data_get_int(settings, name); - QColor color = color_from_int(val); + QPushButton *button = new QPushButton; + QLabel *colorLabel = new QLabel; + const char *name = obs_property_name(prop); + long long val = obs_data_get_int(settings, name); + QColor color = color_from_int(val); if (!obs_property_enabled(prop)) { button->setEnabled(false); @@ -657,8 +646,10 @@ colorLabel->setPalette(palette); colorLabel->setStyleSheet( QString("background-color :%1; color: %2;") - .arg(palette.color(QPalette::Window).name(QColor::HexArgb)) - .arg(palette.color(QPalette::WindowText).name(QColor::HexArgb))); + .arg(palette.color(QPalette::Window) + .name(QColor::HexArgb)) + .arg(palette.color(QPalette::WindowText) + .name(QColor::HexArgb))); colorLabel->setAutoFillBackground(true); colorLabel->setAlignment(Qt::AlignCenter); colorLabel->setToolTip(QT_UTF8(obs_property_long_description(prop))); @@ -679,10 +670,10 @@ static void MakeQFont(obs_data_t *font_obj, QFont &font, bool limit = false) { - const char *face = obs_data_get_string(font_obj, "face"); + const char *face = obs_data_get_string(font_obj, "face"); const char *style = obs_data_get_string(font_obj, "style"); - int size = (int)obs_data_get_int(font_obj, "size"); - uint32_t flags = (uint32_t)obs_data_get_int(font_obj, "flags"); + int size = (int)obs_data_get_int(font_obj, "size"); + uint32_t flags = (uint32_t)obs_data_get_int(font_obj, "flags"); if (face) { font.setFamily(face); @@ -692,28 +683,34 @@ if (size) { if (limit) { int max_size = font.pointSize(); - if (max_size < 28) max_size = 28; - if (size > max_size) size = max_size; + if (max_size < 28) + max_size = 28; + if (size > max_size) + size = max_size; } font.setPointSize(size); } - if (flags & OBS_FONT_BOLD) font.setBold(true); - if (flags & OBS_FONT_ITALIC) font.setItalic(true); - if (flags & OBS_FONT_UNDERLINE) font.setUnderline(true); - if (flags & OBS_FONT_STRIKEOUT) font.setStrikeOut(true); + if (flags & OBS_FONT_BOLD) + font.setBold(true); + if (flags & OBS_FONT_ITALIC) + font.setItalic(true); + if (flags & OBS_FONT_UNDERLINE) + font.setUnderline(true); + if (flags & OBS_FONT_STRIKEOUT) + font.setStrikeOut(true); } void OBSPropertiesView::AddFont(obs_property_t *prop, QFormLayout *layout, - QLabel *&label) + QLabel *&label) { - const char *name = obs_property_name(prop); - obs_data_t *font_obj = obs_data_get_obj(settings, name); - const char *face = obs_data_get_string(font_obj, "face"); - const char *style = obs_data_get_string(font_obj, "style"); - QPushButton *button = new QPushButton; - QLabel *fontLabel = new QLabel; - QFont font; + const char *name = obs_property_name(prop); + obs_data_t *font_obj = obs_data_get_obj(settings, name); + const char *face = obs_data_get_string(font_obj, "face"); + const char *style = obs_data_get_string(font_obj, "style"); + QPushButton *button = new QPushButton; + QLabel *fontLabel = new QLabel; + QFont font; if (!obs_property_enabled(prop)) { button->setEnabled(false); @@ -751,35 +748,26 @@ namespace std { -template <> -struct default_delete<obs_data_t> { - void operator()(obs_data_t *data) - { - obs_data_release(data); - } +template<> struct default_delete<obs_data_t> { + void operator()(obs_data_t *data) { obs_data_release(data); } }; -template <> -struct default_delete<obs_data_item_t> { - void operator()(obs_data_item_t *item) - { - obs_data_item_release(&item); - } +template<> struct default_delete<obs_data_item_t> { + void operator()(obs_data_item_t *item) { obs_data_item_release(&item); } }; } -template <typename T> -static double make_epsilon(T val) +template<typename T> static double make_epsilon(T val) { return val * 0.00001; } static bool matches_range(media_frames_per_second &match, - media_frames_per_second fps, - const frame_rate_range_t &pair) + media_frames_per_second fps, + const frame_rate_range_t &pair) { - auto val = media_frames_per_second_to_frame_interval(fps); + auto val = media_frames_per_second_to_frame_interval(fps); auto max_ = media_frames_per_second_to_frame_interval(pair.first); auto min_ = media_frames_per_second_to_frame_interval(pair.second); @@ -792,8 +780,9 @@ } static bool matches_ranges(media_frames_per_second &best_match, - media_frames_per_second fps, - const frame_rate_ranges_t &fps_ranges, bool exact=false) + media_frames_per_second fps, + const frame_rate_ranges_t &fps_ranges, + bool exact = false) { auto convert_fn = media_frames_per_second_to_frame_interval; auto val = convert_fn(fps); @@ -830,7 +819,6 @@ match = true; continue; } - } return match; @@ -845,19 +833,13 @@ } static const common_frame_rate common_fps[] = { - {"60", {60, 1}}, - {"59.94", {60000, 1001}}, - {"50", {50, 1}}, - {"48", {48, 1}}, - {"30", {30, 1}}, - {"29.97", {30000, 1001}}, - {"25", {25, 1}}, - {"24", {24, 1}}, - {"23.976", {24000, 1001}}, + {"60", {60, 1}}, {"59.94", {60000, 1001}}, {"50", {50, 1}}, + {"48", {48, 1}}, {"30", {30, 1}}, {"29.97", {30000, 1001}}, + {"25", {25, 1}}, {"24", {24, 1}}, {"23.976", {24000, 1001}}, }; static void UpdateSimpleFPSSelection(OBSFrameRatePropertyWidget *fpsProps, - const media_frames_per_second *current_fps) + const media_frames_per_second *current_fps) { if (!current_fps || !media_frames_per_second_is_valid(*current_fps)) { fpsProps->simpleFPS->setCurrentIndex(0); @@ -883,14 +865,13 @@ } static void AddFPSRanges(vector<common_frame_rate> &items, - const frame_rate_ranges_t &ranges) + const frame_rate_ranges_t &ranges) { - auto InsertFPS = [&](media_frames_per_second fps) - { + auto InsertFPS = [&](media_frames_per_second fps) { auto fps_val = media_frames_per_second_to_fps(fps); auto end_ = end(items); - auto i = begin(items); + auto i = begin(items); for (; i != end_; i++) { auto i_fps_val = media_frames_per_second_to_fps(i->fps); if (fabsl(i_fps_val - fps_val) < 0.01) @@ -911,8 +892,9 @@ } } -static QWidget *CreateSimpleFPSValues(OBSFrameRatePropertyWidget *fpsProps, - bool &selected, const media_frames_per_second *current_fps) +static QWidget * +CreateSimpleFPSValues(OBSFrameRatePropertyWidget *fpsProps, bool &selected, + const media_frames_per_second *current_fps) { auto widget = new QWidget{}; widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -921,7 +903,7 @@ layout->setContentsMargins(0, 0, 0, 0); auto items = vector<common_frame_rate>{}; - items.reserve(sizeof(common_fps)/sizeof(common_frame_rate)); + items.reserve(sizeof(common_fps) / sizeof(common_frame_rate)); auto combo = fpsProps->simpleFPS = new ComboBoxIgnoreScroll{}; @@ -938,10 +920,11 @@ for (const auto &item : items) { auto var = QVariant::fromValue(item.fps); - auto name = item.fps_name ? - QString(item.fps_name) : - QString("%1") - .arg(media_frames_per_second_to_fps(item.fps)); + auto name = item.fps_name + ? QString(item.fps_name) + : QString("%1").arg( + media_frames_per_second_to_fps( + item.fps)); combo->addItem(name, var); bool select = current_fps && *current_fps == item.fps; @@ -958,7 +941,7 @@ } static void UpdateRationalFPSWidgets(OBSFrameRatePropertyWidget *fpsProps, - const media_frames_per_second *current_fps) + const media_frames_per_second *current_fps) { if (!current_fps || !media_frames_per_second_is_valid(*current_fps)) { fpsProps->numEdit->setValue(0); @@ -979,7 +962,7 @@ media_frames_per_second match{}; if (!matches_range(match, *current_fps, - fpsProps->fps_ranges[idx])) + fpsProps->fps_ranges[idx])) continue; combo->setCurrentIndex(i); @@ -991,7 +974,8 @@ } static QWidget *CreateRationalFPS(OBSFrameRatePropertyWidget *fpsProps, - bool &selected, const media_frames_per_second *current_fps) + bool &selected, + const media_frames_per_second *current_fps) { auto widget = new QWidget{}; widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -1007,12 +991,12 @@ auto convert_fps = media_frames_per_second_to_fps; //auto convert_fi = media_frames_per_second_to_frame_interval; - for (size_t i = 0; i < fpsProps->fps_ranges.size(); i++) { + for (size_t i = 0; i < fpsProps->fps_ranges.size(); i++) { auto &pair = fpsProps->fps_ranges[i]; combo->addItem(QString{"%1 - %2"} - .arg(convert_fps(pair.first)) - .arg(convert_fps(pair.second)), - QVariant::fromValue(i)); + .arg(convert_fps(pair.first)) + .arg(convert_fps(pair.second)), + QVariant::fromValue(i)); media_frames_per_second match; if (!current_fps || !matches_range(match, *current_fps, pair)) @@ -1043,12 +1027,12 @@ return widget; } -static OBSFrameRatePropertyWidget *CreateFrameRateWidget(obs_property_t *prop, - bool &warning, const char *option, - media_frames_per_second *current_fps, - frame_rate_ranges_t &fps_ranges) +static OBSFrameRatePropertyWidget * +CreateFrameRateWidget(obs_property_t *prop, bool &warning, const char *option, + media_frames_per_second *current_fps, + frame_rate_ranges_t &fps_ranges) { - auto widget = new OBSFrameRatePropertyWidget{}; + auto widget = new OBSFrameRatePropertyWidget{}; auto hlayout = new QHBoxLayout{}; hlayout->setContentsMargins(0, 0, 0, 0); @@ -1056,9 +1040,9 @@ auto combo = widget->modeSelect = new ComboBoxIgnoreScroll{}; combo->addItem(QTStr("Basic.PropertiesView.FPS.Simple"), - QVariant::fromValue(frame_rate_tag::simple())); + QVariant::fromValue(frame_rate_tag::simple())); combo->addItem(QTStr("Basic.PropertiesView.FPS.Rational"), - QVariant::fromValue(frame_rate_tag::rational())); + QVariant::fromValue(frame_rate_tag::rational())); combo->setToolTip(QT_UTF8(obs_property_long_description(prop))); @@ -1084,8 +1068,7 @@ auto stack = widget->modeDisplay = new QStackedWidget{}; bool match_found = option_found; - auto AddWidget = [&](decltype(CreateRationalFPS) func) - { + auto AddWidget = [&](decltype(CreateRationalFPS) func) { bool selected = false; stack->addWidget(func(widget, selected, current_fps)); @@ -1106,7 +1089,7 @@ stack->setCurrentIndex(stack->count() - 1); else if (!match_found) { int idx = current_fps ? 1 : 0; // Rational for "unsupported" - // Simple as default + // Simple as default stack->setCurrentIndex(idx); combo->setCurrentIndex(idx); warning = true; @@ -1116,7 +1099,7 @@ auto label_area = widget->labels = new QWidget{}; label_area->setSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Expanding); + QSizePolicy::Expanding); auto vlayout = new QVBoxLayout{}; vlayout->setContentsMargins(0, 0, 0, 0); @@ -1149,16 +1132,14 @@ static void UpdateMinMaxLabels(OBSFrameRatePropertyWidget *w) { - auto Hide = [&](bool hide) - { + auto Hide = [&](bool hide) { w->minLabel->setHidden(hide); w->maxLabel->setHidden(hide); }; auto variant = w->modeSelect->currentData(); if (!variant.canConvert<frame_rate_tag>() || - variant.value<frame_rate_tag>().type != - frame_rate_tag::RATIONAL) { + variant.value<frame_rate_tag>().type != frame_rate_tag::RATIONAL) { Hide(true); return; } @@ -1181,11 +1162,11 @@ auto max = w->fps_ranges[idx].second; w->minLabel->setText(QString("Min FPS: %1/%2") - .arg(min.numerator) - .arg(min.denominator)); + .arg(min.numerator) + .arg(min.denominator)); w->maxLabel->setText(QString("Max FPS: %1/%2") - .arg(max.numerator) - .arg(max.denominator)); + .arg(max.numerator) + .arg(max.denominator)); } static void UpdateFPSLabels(OBSFrameRatePropertyWidget *w) @@ -1198,9 +1179,8 @@ media_frames_per_second fps{}; media_frames_per_second *valid_fps = nullptr; if (obs_data_item_get_autoselect_frames_per_second(obj.get(), &fps, - nullptr) || - obs_data_item_get_frames_per_second(obj.get(), &fps, - nullptr)) + nullptr) || + obs_data_item_get_frames_per_second(obj.get(), &fps, nullptr)) valid_fps = &fps; const char *option = nullptr; @@ -1211,7 +1191,7 @@ w->timePerFrame->setHidden(true); if (!option) w->warningLabel->setStyleSheet( - "QLabel { color: red; }"); + "QLabel { color: red; }"); return; } @@ -1229,14 +1209,15 @@ auto convert_to_frame_interval = media_frames_per_second_to_frame_interval; - w->currentFPS->setText(QString("FPS: %1") - .arg(convert_to_fps(*valid_fps))); - w->timePerFrame->setText(QString("Frame Interval: %1 ms") + w->currentFPS->setText( + QString("FPS: %1").arg(convert_to_fps(*valid_fps))); + w->timePerFrame->setText( + QString("Frame Interval: %1 ms") .arg(convert_to_frame_interval(*valid_fps) * 1000)); } void OBSPropertiesView::AddFrameRate(obs_property_t *prop, bool &warning, - QFormLayout *layout, QLabel *&label) + QFormLayout *layout, QLabel *&label) { const char *name = obs_property_name(prop); bool enabled = obs_property_enabled(prop); @@ -1255,12 +1236,12 @@ fps_ranges.reserve(num); for (size_t i = 0; i < num; i++) fps_ranges.emplace_back( - obs_property_frame_rate_fps_range_min(prop, i), - obs_property_frame_rate_fps_range_max(prop, i)); + obs_property_frame_rate_fps_range_min(prop, i), + obs_property_frame_rate_fps_range_max(prop, i)); auto widget = CreateFrameRateWidget(prop, warning, option, valid_fps, - fps_ranges); - auto info = new WidgetInfo(this, prop, widget); + fps_ranges); + auto info = new WidgetInfo(this, prop, widget); widget->setToolTip(QT_UTF8(obs_property_long_description(prop))); @@ -1289,10 +1270,8 @@ combo->setToolTip(QT_UTF8(obs_property_long_description(prop))); auto comboIndexChanged = static_cast<void (QComboBox::*)(int)>( - &QComboBox::currentIndexChanged); - connect(combo, comboIndexChanged, stack, - [=](int index) - { + &QComboBox::currentIndexChanged); + connect(combo, comboIndexChanged, stack, [=](int index) { bool out_of_bounds = index >= stack->count(); auto idx = out_of_bounds ? stack->count() - 1 : index; stack->setCurrentIndex(idx); @@ -1304,34 +1283,30 @@ emit info->ControlChanged(); }); - connect(widget->simpleFPS, comboIndexChanged, [=](int) - { + connect(widget->simpleFPS, comboIndexChanged, [=](int) { if (widget->updating) return; emit info->ControlChanged(); }); - connect(widget->fpsRange, comboIndexChanged, [=](int) - { + connect(widget->fpsRange, comboIndexChanged, [=](int) { if (widget->updating) return; UpdateFPSLabels(widget); }); - auto sbValueChanged = static_cast<void (QSpinBox::*)(int)>( - &QSpinBox::valueChanged); - connect(widget->numEdit, sbValueChanged, [=](int) - { + auto sbValueChanged = + static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged); + connect(widget->numEdit, sbValueChanged, [=](int) { if (widget->updating) return; emit info->ControlChanged(); }); - connect(widget->denEdit, sbValueChanged, [=](int) - { + connect(widget->denEdit, sbValueChanged, [=](int) { if (widget->updating) return; @@ -1367,28 +1342,28 @@ // Insert into UI layout->setWidget(layout->rowCount(), - QFormLayout::ItemRole::SpanningRole, groupBox); + QFormLayout::ItemRole::SpanningRole, groupBox); // Register Group Widget WidgetInfo *info = new WidgetInfo(this, prop, groupBox); children.emplace_back(info); // Signals - connect(groupBox, SIGNAL(toggled()), info, SLOT(ControlChanged())); + connect(groupBox, SIGNAL(toggled(bool)), info, SLOT(ControlChanged())); } void OBSPropertiesView::AddProperty(obs_property_t *property, - QFormLayout *layout) + QFormLayout *layout) { - const char *name = obs_property_name(property); - obs_property_type type = obs_property_get_type(property); + const char *name = obs_property_name(property); + obs_property_type type = obs_property_get_type(property); if (!obs_property_visible(property)) return; - QLabel *label = nullptr; + QLabel *label = nullptr; QWidget *widget = nullptr; - bool warning = false; + bool warning = false; switch (type) { case OBS_PROPERTY_INVALID: @@ -1433,10 +1408,8 @@ if (widget && !obs_property_enabled(property)) widget->setEnabled(false); - if (!label && - type != OBS_PROPERTY_BOOL && - type != OBS_PROPERTY_BUTTON && - type != OBS_PROPERTY_GROUP) + if (!label && type != OBS_PROPERTY_BOOL && + type != OBS_PROPERTY_BUTTON && type != OBS_PROPERTY_GROUP) label = new QLabel(QT_UTF8(obs_property_description(property))); if (warning && label) //TODO: select color based on background color @@ -1466,8 +1439,9 @@ } static bool FrameRateChangedVariant(const QVariant &variant, - media_frames_per_second &fps, obs_data_item_t *&obj, - const media_frames_per_second *valid_fps) + media_frames_per_second &fps, + obs_data_item_t *&obj, + const media_frames_per_second *valid_fps) { if (!variant.canConvert<media_frames_per_second>()) return false; @@ -1481,11 +1455,12 @@ } static bool FrameRateChangedCommon(OBSFrameRatePropertyWidget *w, - obs_data_item_t *&obj, const media_frames_per_second *valid_fps) + obs_data_item_t *&obj, + const media_frames_per_second *valid_fps) { media_frames_per_second fps{}; if (!FrameRateChangedVariant(w->simpleFPS->currentData(), fps, obj, - valid_fps)) + valid_fps)) return false; UpdateRationalFPSWidgets(w, &fps); @@ -1493,14 +1468,15 @@ } static bool FrameRateChangedRational(OBSFrameRatePropertyWidget *w, - obs_data_item_t *&obj, const media_frames_per_second *valid_fps) + obs_data_item_t *&obj, + const media_frames_per_second *valid_fps) { auto num = w->numEdit->value(); auto den = w->denEdit->value(); auto fps = make_fps(num, den); if (valid_fps && media_frames_per_second_is_valid(fps) && - fps == *valid_fps) + fps == *valid_fps) return false; obs_data_item_set_frames_per_second(&obj, fps, nullptr); @@ -1509,9 +1485,9 @@ } static bool FrameRateChanged(QWidget *widget, const char *name, - OBSData &settings) + OBSData &settings) { - auto w = qobject_cast<OBSFrameRatePropertyWidget*>(widget); + auto w = qobject_cast<OBSFrameRatePropertyWidget *>(widget); if (!w) return false; @@ -1519,12 +1495,9 @@ if (!variant.canConvert<frame_rate_tag>()) return false; - auto StopUpdating = [&](void*) - { - w->updating = false; - }; + auto StopUpdating = [&](void *) { w->updating = false; }; unique_ptr<void, decltype(StopUpdating)> signalGuard( - static_cast<void*>(w), StopUpdating); + static_cast<void *>(w), StopUpdating); w->updating = true; if (!obs_data_has_user_value(settings, name)) @@ -1532,12 +1505,11 @@ unique_ptr<obs_data_item_t> obj{obs_data_item_byname(settings, name)}; auto obj_ptr = obj.get(); - auto CheckObj = [&]() - { + auto CheckObj = [&]() { if (!obj_ptr) obj.release(); }; - + const char *option = nullptr; obs_data_item_get_frames_per_second(obj.get(), nullptr, &option); @@ -1573,64 +1545,64 @@ void WidgetInfo::BoolChanged(const char *setting) { - QCheckBox *checkbox = static_cast<QCheckBox*>(widget); + QCheckBox *checkbox = static_cast<QCheckBox *>(widget); obs_data_set_bool(view->settings, setting, - checkbox->checkState() == Qt::Checked); + checkbox->checkState() == Qt::Checked); } void WidgetInfo::IntChanged(const char *setting) { - QSpinBox *spin = static_cast<QSpinBox*>(widget); + QSpinBox *spin = static_cast<QSpinBox *>(widget); obs_data_set_int(view->settings, setting, spin->value()); } void WidgetInfo::FloatChanged(const char *setting) { - QDoubleSpinBox *spin = static_cast<QDoubleSpinBox*>(widget); + QDoubleSpinBox *spin = static_cast<QDoubleSpinBox *>(widget); obs_data_set_double(view->settings, setting, spin->value()); } void WidgetInfo::TextChanged(const char *setting) { - obs_text_type type = obs_property_text_type(property); + obs_text_type type = obs_property_text_type(property); if (type == OBS_TEXT_MULTILINE) { - QPlainTextEdit *edit = static_cast<QPlainTextEdit*>(widget); + QPlainTextEdit *edit = static_cast<QPlainTextEdit *>(widget); obs_data_set_string(view->settings, setting, - QT_TO_UTF8(edit->toPlainText())); + QT_TO_UTF8(edit->toPlainText())); return; } - QLineEdit *edit = static_cast<QLineEdit*>(widget); + QLineEdit *edit = static_cast<QLineEdit *>(widget); obs_data_set_string(view->settings, setting, QT_TO_UTF8(edit->text())); } bool WidgetInfo::PathChanged(const char *setting) { - const char *desc = obs_property_description(property); - obs_path_type type = obs_property_path_type(property); - const char *filter = obs_property_path_filter(property); - const char *default_path = obs_property_path_default_path(property); - QString path; + const char *desc = obs_property_description(property); + obs_path_type type = obs_property_path_type(property); + const char *filter = obs_property_path_filter(property); + const char *default_path = obs_property_path_default_path(property); + QString path; if (type == OBS_PATH_DIRECTORY) - path = QFileDialog::getExistingDirectory(view, - QT_UTF8(desc), QT_UTF8(default_path), - QFileDialog::ShowDirsOnly | + path = QFileDialog::getExistingDirectory( + view, QT_UTF8(desc), QT_UTF8(default_path), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); else if (type == OBS_PATH_FILE) - path = QFileDialog::getOpenFileName(view, - QT_UTF8(desc), QT_UTF8(default_path), - QT_UTF8(filter)); + path = QFileDialog::getOpenFileName(view, QT_UTF8(desc), + QT_UTF8(default_path), + QT_UTF8(filter)); else if (type == OBS_PATH_FILE_SAVE) - path = QFileDialog::getSaveFileName(view, - QT_UTF8(desc), QT_UTF8(default_path), - QT_UTF8(filter)); + path = QFileDialog::getSaveFileName(view, QT_UTF8(desc), + QT_UTF8(default_path), + QT_UTF8(filter)); if (path.isEmpty()) return false; - QLineEdit *edit = static_cast<QLineEdit*>(widget); + QLineEdit *edit = static_cast<QLineEdit *>(widget); edit->setText(path); obs_data_set_string(view->settings, setting, QT_TO_UTF8(path)); return true; @@ -1638,10 +1610,10 @@ void WidgetInfo::ListChanged(const char *setting) { - QComboBox *combo = static_cast<QComboBox*>(widget); + QComboBox *combo = static_cast<QComboBox *>(widget); obs_combo_format format = obs_property_list_format(property); - obs_combo_type type = obs_property_list_type(property); - QVariant data; + obs_combo_type type = obs_property_list_type(property); + QVariant data; if (type == OBS_COMBO_TYPE_EDITABLE) { data = combo->currentText().toUtf8(); @@ -1658,15 +1630,15 @@ return; case OBS_COMBO_FORMAT_INT: obs_data_set_int(view->settings, setting, - data.value<long long>()); + data.value<long long>()); break; case OBS_COMBO_FORMAT_FLOAT: obs_data_set_double(view->settings, setting, - data.value<double>()); + data.value<double>()); break; case OBS_COMBO_FORMAT_STRING: obs_data_set_string(view->settings, setting, - data.toByteArray().constData()); + data.toByteArray().constData()); break; } } @@ -1674,8 +1646,8 @@ bool WidgetInfo::ColorChanged(const char *setting) { const char *desc = obs_property_description(property); - long long val = obs_data_get_int(view->settings, setting); - QColor color = color_from_int(val); + long long val = obs_data_get_int(view->settings, setting); + QColor color = color_from_int(val); QColorDialog::ColorDialogOptions options = 0; @@ -1693,14 +1665,15 @@ if (!color.isValid()) return false; - QLabel *label = static_cast<QLabel*>(widget); + QLabel *label = static_cast<QLabel *>(widget); label->setText(color.name(QColor::HexArgb)); QPalette palette = QPalette(color); label->setPalette(palette); - label->setStyleSheet( - QString("background-color :%1; color: %2;") - .arg(palette.color(QPalette::Window).name(QColor::HexArgb)) - .arg(palette.color(QPalette::WindowText).name(QColor::HexArgb))); + label->setStyleSheet(QString("background-color :%1; color: %2;") + .arg(palette.color(QPalette::Window) + .name(QColor::HexArgb)) + .arg(palette.color(QPalette::WindowText) + .name(QColor::HexArgb))); obs_data_set_int(view->settings, setting, color_to_int(color)); @@ -1710,9 +1683,9 @@ bool WidgetInfo::FontChanged(const char *setting) { obs_data_t *font_obj = obs_data_get_obj(view->settings, setting); - bool success; - uint32_t flags; - QFont font; + bool success; + uint32_t flags; + QFont font; QFontDialog::FontDialogOptions options; @@ -1722,10 +1695,12 @@ if (!font_obj) { QFont initial; - font = QFontDialog::getFont(&success, initial, view, "Pick a Font", options); + font = QFontDialog::getFont(&success, initial, view, + "Pick a Font", options); } else { MakeQFont(font_obj, font); - font = QFontDialog::getFont(&success, font, view, "Pick a Font", options); + font = QFontDialog::getFont(&success, font, view, "Pick a Font", + options); obs_data_release(font_obj); } @@ -1737,13 +1712,13 @@ obs_data_set_string(font_obj, "face", QT_TO_UTF8(font.family())); obs_data_set_string(font_obj, "style", QT_TO_UTF8(font.styleName())); obs_data_set_int(font_obj, "size", font.pointSize()); - flags = font.bold() ? OBS_FONT_BOLD : 0; + flags = font.bold() ? OBS_FONT_BOLD : 0; flags |= font.italic() ? OBS_FONT_ITALIC : 0; flags |= font.underline() ? OBS_FONT_UNDERLINE : 0; flags |= font.strikeOut() ? OBS_FONT_STRIKEOUT : 0; obs_data_set_int(font_obj, "flags", flags); - QLabel *label = static_cast<QLabel*>(widget); + QLabel *label = static_cast<QLabel *>(widget); QFont labelFont; MakeQFont(font_obj, labelFont, true); label->setFont(labelFont); @@ -1756,26 +1731,25 @@ void WidgetInfo::GroupChanged(const char *setting) { - QGroupBox *groupbox = static_cast<QGroupBox*>(widget); + QGroupBox *groupbox = static_cast<QGroupBox *>(widget); obs_data_set_bool(view->settings, setting, - groupbox->isCheckable() ? groupbox->isChecked() : true); + groupbox->isCheckable() ? groupbox->isChecked() + : true); } void WidgetInfo::EditableListChanged() { const char *setting = obs_property_name(property); - QListWidget *list = reinterpret_cast<QListWidget*>(widget); + QListWidget *list = reinterpret_cast<QListWidget *>(widget); obs_data_array *array = obs_data_array_create(); for (int i = 0; i < list->count(); i++) { QListWidgetItem *item = list->item(i); obs_data_t *arrayItem = obs_data_create(); obs_data_set_string(arrayItem, "value", - QT_TO_UTF8(item->text())); - obs_data_set_bool(arrayItem, "selected", - item->isSelected()); - obs_data_set_bool(arrayItem, "hidden", - item->isHidden()); + QT_TO_UTF8(item->text())); + obs_data_set_bool(arrayItem, "selected", item->isSelected()); + obs_data_set_bool(arrayItem, "hidden", item->isHidden()); obs_data_array_push_back(array, arrayItem); obs_data_release(arrayItem); } @@ -1790,29 +1764,42 @@ { if (obs_property_button_clicked(property, view->obj)) { QMetaObject::invokeMethod(view, "RefreshProperties", - Qt::QueuedConnection); + Qt::QueuedConnection); } } void WidgetInfo::TogglePasswordText(bool show) { - reinterpret_cast<QLineEdit*>(widget)->setEchoMode( - show ? QLineEdit::Normal : QLineEdit::Password); + reinterpret_cast<QLineEdit *>(widget)->setEchoMode( + show ? QLineEdit::Normal : QLineEdit::Password); } void WidgetInfo::ControlChanged() { - const char *setting = obs_property_name(property); - obs_property_type type = obs_property_get_type(property); + const char *setting = obs_property_name(property); + obs_property_type type = obs_property_get_type(property); switch (type) { - case OBS_PROPERTY_INVALID: return; - case OBS_PROPERTY_BOOL: BoolChanged(setting); break; - case OBS_PROPERTY_INT: IntChanged(setting); break; - case OBS_PROPERTY_FLOAT: FloatChanged(setting); break; - case OBS_PROPERTY_TEXT: TextChanged(setting); break; - case OBS_PROPERTY_LIST: ListChanged(setting); break; - case OBS_PROPERTY_BUTTON: ButtonClicked(); return; + case OBS_PROPERTY_INVALID: + return; + case OBS_PROPERTY_BOOL: + BoolChanged(setting); + break; + case OBS_PROPERTY_INT: + IntChanged(setting); + break; + case OBS_PROPERTY_FLOAT: + FloatChanged(setting); + break; + case OBS_PROPERTY_TEXT: + TextChanged(setting); + break; + case OBS_PROPERTY_LIST: + ListChanged(setting); + break; + case OBS_PROPERTY_BUTTON: + ButtonClicked(); + return; case OBS_PROPERTY_COLOR: if (!ColorChanged(setting)) return; @@ -1825,12 +1812,15 @@ if (!PathChanged(setting)) return; break; - case OBS_PROPERTY_EDITABLE_LIST: break; + case OBS_PROPERTY_EDITABLE_LIST: + break; case OBS_PROPERTY_FRAME_RATE: if (!FrameRateChanged(widget, setting, view->settings)) return; break; - case OBS_PROPERTY_GROUP: GroupChanged(setting); return; + case OBS_PROPERTY_GROUP: + GroupChanged(setting); + return; } if (view->callback && !view->deferUpdate) @@ -1841,7 +1831,7 @@ if (obs_property_modified(property, view->settings)) { view->lastFocused = setting; QMetaObject::invokeMethod(view, "RefreshProperties", - Qt::QueuedConnection); + Qt::QueuedConnection); } } @@ -1858,8 +1848,8 @@ curPath = default_path; QString path = QFileDialog::getOpenFileName( - App()->GetMainWindow(), QTStr("Browse"), - curPath, filter); + App()->GetMainWindow(), QTStr("Browse"), curPath, + filter); if (path.isEmpty()) return; @@ -1867,12 +1857,12 @@ } public: - EditableItemDialog(QWidget *parent, const QString &text, - bool browse, const char *filter_ = nullptr, - const char *default_path_ = nullptr) - : QDialog (parent), - filter (QT_UTF8(filter_)), - default_path (QT_UTF8(default_path_)) + EditableItemDialog(QWidget *parent, const QString &text, bool browse, + const char *filter_ = nullptr, + const char *default_path_ = nullptr) + : QDialog(parent), + filter(QT_UTF8(filter_)), + default_path(QT_UTF8(default_path_)) { QHBoxLayout *topLayout = new QHBoxLayout(); QVBoxLayout *mainLayout = new QVBoxLayout(); @@ -1890,12 +1880,11 @@ topLayout->setAlignment(browseButton, Qt::AlignVCenter); connect(browseButton, &QPushButton::clicked, this, - &EditableItemDialog::BrowseClicked); + &EditableItemDialog::BrowseClicked); } QDialogButtonBox::StandardButtons buttons = - QDialogButtonBox::Ok | - QDialogButtonBox::Cancel; + QDialogButtonBox::Ok | QDialogButtonBox::Cancel; QDialogButtonBox *buttonBox = new QDialogButtonBox(buttons); buttonBox->setCenterButtons(true); @@ -1910,13 +1899,13 @@ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); } - inline QString GetText() const {return edit->text();} + inline QString GetText() const { return edit->text(); } }; void WidgetInfo::EditListAdd() { - enum obs_editable_list_type type = obs_property_editable_list_type( - property); + enum obs_editable_list_type type = + obs_property_editable_list_type(property); if (type == OBS_EDITABLE_LIST_TYPE_STRINGS) { EditListAddText(); @@ -1929,20 +1918,19 @@ QAction *action; action = new QAction(QTStr("Basic.PropertiesWindow.AddFiles"), this); - connect(action, &QAction::triggered, - this, &WidgetInfo::EditListAddFiles); + connect(action, &QAction::triggered, this, + &WidgetInfo::EditListAddFiles); popup.addAction(action); action = new QAction(QTStr("Basic.PropertiesWindow.AddDir"), this); - connect(action, &QAction::triggered, - this, &WidgetInfo::EditListAddDir); + connect(action, &QAction::triggered, this, &WidgetInfo::EditListAddDir); popup.addAction(action); if (type == OBS_EDITABLE_LIST_TYPE_FILES_AND_URLS) { action = new QAction(QTStr("Basic.PropertiesWindow.AddURL"), - this); - connect(action, &QAction::triggered, - this, &WidgetInfo::EditListAddText); + this); + connect(action, &QAction::triggered, this, + &WidgetInfo::EditListAddText); popup.addAction(action); } @@ -1951,12 +1939,12 @@ void WidgetInfo::EditListAddText() { - QListWidget *list = reinterpret_cast<QListWidget*>(widget); + QListWidget *list = reinterpret_cast<QListWidget *>(widget); const char *desc = obs_property_description(property); EditableItemDialog dialog(widget->window(), QString(), false); - auto title = QTStr("Basic.PropertiesWindow.AddEditableListEntry").arg( - QT_UTF8(desc)); + auto title = QTStr("Basic.PropertiesWindow.AddEditableListEntry") + .arg(QT_UTF8(desc)); dialog.setWindowTitle(title); if (dialog.exec() == QDialog::Rejected) return; @@ -1971,18 +1959,18 @@ void WidgetInfo::EditListAddFiles() { - QListWidget *list = reinterpret_cast<QListWidget*>(widget); + QListWidget *list = reinterpret_cast<QListWidget *>(widget); const char *desc = obs_property_description(property); const char *filter = obs_property_editable_list_filter(property); const char *default_path = obs_property_editable_list_default_path(property); QString title = QTStr("Basic.PropertiesWindow.AddEditableListFiles") - .arg(QT_UTF8(desc)); + .arg(QT_UTF8(desc)); QStringList files = QFileDialog::getOpenFileNames( - App()->GetMainWindow(), title, QT_UTF8(default_path), - QT_UTF8(filter)); + App()->GetMainWindow(), title, QT_UTF8(default_path), + QT_UTF8(filter)); if (files.count() == 0) return; @@ -1993,16 +1981,16 @@ void WidgetInfo::EditListAddDir() { - QListWidget *list = reinterpret_cast<QListWidget*>(widget); + QListWidget *list = reinterpret_cast<QListWidget *>(widget); const char *desc = obs_property_description(property); const char *default_path = obs_property_editable_list_default_path(property); QString title = QTStr("Basic.PropertiesWindow.AddEditableListDir") - .arg(QT_UTF8(desc)); + .arg(QT_UTF8(desc)); QString dir = QFileDialog::getExistingDirectory( - App()->GetMainWindow(), title, QT_UTF8(default_path)); + App()->GetMainWindow(), title, QT_UTF8(default_path)); if (dir.isEmpty()) return; @@ -2013,8 +2001,8 @@ void WidgetInfo::EditListRemove() { - QListWidget *list = reinterpret_cast<QListWidget*>(widget); - QList<QListWidgetItem*> items = list->selectedItems(); + QListWidget *list = reinterpret_cast<QListWidget *>(widget); + QList<QListWidgetItem *> items = list->selectedItems(); for (QListWidgetItem *item : items) delete item; @@ -2023,12 +2011,12 @@ void WidgetInfo::EditListEdit() { - QListWidget *list = reinterpret_cast<QListWidget*>(widget); - enum obs_editable_list_type type = obs_property_editable_list_type( - property); + QListWidget *list = reinterpret_cast<QListWidget *>(widget); + enum obs_editable_list_type type = + obs_property_editable_list_type(property); const char *desc = obs_property_description(property); const char *filter = obs_property_editable_list_filter(property); - QList<QListWidgetItem*> selectedItems = list->selectedItems(); + QList<QListWidgetItem *> selectedItems = list->selectedItems(); if (!selectedItems.count()) return; @@ -2041,11 +2029,10 @@ if (pathDir.exists()) path = QFileDialog::getExistingDirectory( - App()->GetMainWindow(), - QTStr("Browse"), + App()->GetMainWindow(), QTStr("Browse"), item->text(), QFileDialog::ShowDirsOnly | - QFileDialog::DontResolveSymlinks); + QFileDialog::DontResolveSymlinks); else path = QFileDialog::getOpenFileName( App()->GetMainWindow(), QTStr("Browse"), @@ -2060,9 +2047,10 @@ } EditableItemDialog dialog(widget->window(), item->text(), - type != OBS_EDITABLE_LIST_TYPE_STRINGS, filter); - auto title = QTStr("Basic.PropertiesWindow.EditEditableListEntry").arg( - QT_UTF8(desc)); + type != OBS_EDITABLE_LIST_TYPE_STRINGS, + filter); + auto title = QTStr("Basic.PropertiesWindow.EditEditableListEntry") + .arg(QT_UTF8(desc)); dialog.setWindowTitle(title); if (dialog.exec() == QDialog::Rejected) return; @@ -2077,7 +2065,7 @@ void WidgetInfo::EditListUp() { - QListWidget *list = reinterpret_cast<QListWidget*>(widget); + QListWidget *list = reinterpret_cast<QListWidget *>(widget); int lastItemRow = -1; for (int i = 0; i < list->count(); i++) { @@ -2102,7 +2090,7 @@ void WidgetInfo::EditListDown() { - QListWidget *list = reinterpret_cast<QListWidget*>(widget); + QListWidget *list = reinterpret_cast<QListWidget *>(widget); int lastItemRow = list->count(); for (int i = list->count() - 1; i >= 0; i--) {
View file
obs-studio-23.2.1.tar.xz/UI/properties-view.hpp -> obs-studio-24.0.0.tar.xz/UI/properties-view.hpp
Changed
@@ -10,8 +10,7 @@ class QLabel; typedef obs_properties_t *(*PropertiesReloadCallback)(void *obj); -typedef void (*PropertiesUpdateCallback)(void *obj, - obs_data_t *settings); +typedef void (*PropertiesUpdateCallback)(void *obj, obs_data_t *settings); /* ------------------------------------------------------------------------- */ @@ -22,8 +21,8 @@ private: OBSPropertiesView *view; - obs_property_t *property; - QWidget *widget; + obs_property_t *property; + QWidget *widget; void BoolChanged(const char *setting); void IntChanged(const char *setting); @@ -41,9 +40,10 @@ public: inline WidgetInfo(OBSPropertiesView *view_, obs_property_t *prop, - QWidget *widget_) + QWidget *widget_) : view(view_), property(prop), widget(widget_) - {} + { + } public slots: @@ -72,37 +72,38 @@ std::unique_ptr<obs_properties_t, properties_delete_t>; private: - QWidget *widget = nullptr; - properties_t properties; - OBSData settings; - void *obj = nullptr; - std::string type; - PropertiesReloadCallback reloadCallback; - PropertiesUpdateCallback callback = nullptr; - int minSize; + QWidget *widget = nullptr; + properties_t properties; + OBSData settings; + void *obj = nullptr; + std::string type; + PropertiesReloadCallback reloadCallback; + PropertiesUpdateCallback callback = nullptr; + int minSize; std::vector<std::unique_ptr<WidgetInfo>> children; - std::string lastFocused; - QWidget *lastWidget = nullptr; - bool deferUpdate; + std::string lastFocused; + QWidget *lastWidget = nullptr; + bool deferUpdate; QWidget *NewWidget(obs_property_t *prop, QWidget *widget, - const char *signal); + const char *signal); QWidget *AddCheckbox(obs_property_t *prop); QWidget *AddText(obs_property_t *prop, QFormLayout *layout, - QLabel *&label); + QLabel *&label); void AddPath(obs_property_t *prop, QFormLayout *layout, QLabel **label); void AddInt(obs_property_t *prop, QFormLayout *layout, QLabel **label); void AddFloat(obs_property_t *prop, QFormLayout *layout, - QLabel**label); + QLabel **label); QWidget *AddList(obs_property_t *prop, bool &warning); void AddEditableList(obs_property_t *prop, QFormLayout *layout, - QLabel *&label); + QLabel *&label); QWidget *AddButton(obs_property_t *prop); - void AddColor(obs_property_t *prop, QFormLayout *layout, QLabel *&label); + void AddColor(obs_property_t *prop, QFormLayout *layout, + QLabel *&label); void AddFont(obs_property_t *prop, QFormLayout *layout, QLabel *&label); void AddFrameRate(obs_property_t *prop, bool &warning, - QFormLayout *layout, QLabel *&label); + QFormLayout *layout, QLabel *&label); void AddGroup(obs_property_t *prop, QFormLayout *layout); @@ -125,15 +126,14 @@ public: OBSPropertiesView(OBSData settings, void *obj, - PropertiesReloadCallback reloadCallback, - PropertiesUpdateCallback callback, - int minSize = 0); + PropertiesReloadCallback reloadCallback, + PropertiesUpdateCallback callback, int minSize = 0); OBSPropertiesView(OBSData settings, const char *type, - PropertiesReloadCallback reloadCallback, - int minSize = 0); + PropertiesReloadCallback reloadCallback, + int minSize = 0); - inline obs_data_t *GetSettings() const {return settings;} + inline obs_data_t *GetSettings() const { return settings; } - inline void UpdateSettings() {callback(obj, settings);} - inline bool DeferUpdate() const {return deferUpdate;} + inline void UpdateSettings() { callback(obj, settings); } + inline bool DeferUpdate() const { return deferUpdate; } };
View file
obs-studio-23.2.1.tar.xz/UI/properties-view.moc.hpp -> obs-studio-24.0.0.tar.xz/UI/properties-view.moc.hpp
Changed
@@ -15,13 +15,13 @@ #endif static bool operator!=(const media_frames_per_second &a, - const media_frames_per_second &b) + const media_frames_per_second &b) { return a.numerator != b.numerator || a.denominator != b.denominator; } static bool operator==(const media_frames_per_second &a, - const media_frames_per_second &b) + const media_frames_per_second &b) { return !(a != b); } @@ -36,27 +36,27 @@ public: frame_rate_ranges_t fps_ranges; - QComboBox *modeSelect = nullptr; - QStackedWidget *modeDisplay = nullptr; + QComboBox *modeSelect = nullptr; + QStackedWidget *modeDisplay = nullptr; - QWidget *labels = nullptr; - QLabel *currentFPS = nullptr; - QLabel *timePerFrame = nullptr; - QLabel *minLabel = nullptr; - QLabel *maxLabel = nullptr; + QWidget *labels = nullptr; + QLabel *currentFPS = nullptr; + QLabel *timePerFrame = nullptr; + QLabel *minLabel = nullptr; + QLabel *maxLabel = nullptr; - QComboBox *simpleFPS = nullptr; + QComboBox *simpleFPS = nullptr; - QComboBox *fpsRange = nullptr; - QSpinBox *numEdit = nullptr; - QSpinBox *denEdit = nullptr; + QComboBox *fpsRange = nullptr; + QSpinBox *numEdit = nullptr; + QSpinBox *denEdit = nullptr; - bool updating = false; + bool updating = false; - const char *name = nullptr; - obs_data_t *settings = nullptr; + const char *name = nullptr; + obs_data_t *settings = nullptr; - QLabel *warningLabel = nullptr; + QLabel *warningLabel = nullptr; OBSFrameRatePropertyWidget() = default; };
View file
obs-studio-23.2.1.tar.xz/UI/qt-display.cpp -> obs-studio-24.0.0.tar.xz/UI/qt-display.cpp
Changed
@@ -6,25 +6,20 @@ #include <QResizeEvent> #include <QShowEvent> -static inline long long color_to_int(QColor color) +static inline long long color_to_int(const QColor &color) { - auto shift = [&](unsigned val, int shift) - { + auto shift = [&](unsigned val, int shift) { return ((val & 0xff) << shift); }; - return shift(color.red(), 0) | - shift(color.green(), 8) | - shift(color.blue(), 16) | - shift(color.alpha(), 24); + return shift(color.red(), 0) | shift(color.green(), 8) | + shift(color.blue(), 16) | shift(color.alpha(), 24); } static inline QColor rgba_to_color(uint32_t rgba) { - return QColor::fromRgb(rgba & 0xFF, - (rgba >> 8) & 0xFF, - (rgba >> 16) & 0xFF, - (rgba >> 24) & 0xFF); + return QColor::fromRgb(rgba & 0xFF, (rgba >> 8) & 0xFF, + (rgba >> 16) & 0xFF, (rgba >> 24) & 0xFF); } OBSQTDisplay::OBSQTDisplay(QWidget *parent, Qt::WindowFlags flags) @@ -37,8 +32,7 @@ setAttribute(Qt::WA_DontCreateNativeAncestors); setAttribute(Qt::WA_NativeWindow); - auto windowVisible = [this] (bool visible) - { + auto windowVisible = [this](bool visible) { if (!visible) return; @@ -46,12 +40,12 @@ CreateDisplay(); } else { QSize size = GetPixelSize(this); - obs_display_resize(display, size.width(), size.height()); + obs_display_resize(display, size.width(), + size.height()); } }; - auto sizeChanged = [this] (QScreen*) - { + auto sizeChanged = [this](QScreen *) { CreateDisplay(); QSize size = GetPixelSize(this); @@ -89,11 +83,11 @@ QSize size = GetPixelSize(this); - gs_init_data info = {}; - info.cx = size.width(); - info.cy = size.height(); - info.format = GS_RGBA; - info.zsformat = GS_ZS_NONE; + gs_init_data info = {}; + info.cx = size.width(); + info.cy = size.height(); + info.format = GS_RGBA; + info.zsformat = GS_ZS_NONE; QTToGSWindow(winId(), info.window);
View file
obs-studio-23.2.1.tar.xz/UI/qt-display.hpp -> obs-studio-24.0.0.tar.xz/UI/qt-display.hpp
Changed
@@ -7,9 +7,9 @@ class OBSQTDisplay : public QWidget { Q_OBJECT - Q_PROPERTY(QColor displayBackgroundColor MEMBER backgroundColor - READ GetDisplayBackgroundColor - WRITE SetDisplayBackgroundColor) + Q_PROPERTY(QColor displayBackgroundColor MEMBER backgroundColor READ + GetDisplayBackgroundColor WRITE + SetDisplayBackgroundColor) OBSDisplay display; @@ -24,11 +24,11 @@ public: OBSQTDisplay(QWidget *parent = nullptr, - Qt::WindowFlags flags = nullptr); + Qt::WindowFlags flags = nullptr); virtual QPaintEngine *paintEngine() const override; - inline obs_display_t *GetDisplay() const {return display;} + inline obs_display_t *GetDisplay() const { return display; } uint32_t backgroundColor = GREY_COLOR_BACKGROUND;
View file
obs-studio-23.2.1.tar.xz/UI/qt-wrappers.cpp -> obs-studio-24.0.0.tar.xz/UI/qt-wrappers.cpp
Changed
@@ -24,6 +24,7 @@ #include <QLayout> #include <QMessageBox> #include <QDataStream> +#include <QKeyEvent> #if !defined(_WIN32) && !defined(__APPLE__) #include <QX11Info> @@ -45,20 +46,17 @@ va_end(args); } -QMessageBox::StandardButton OBSMessageBox::question( - QWidget *parent, - const QString &title, - const QString &text, - QMessageBox::StandardButtons buttons, - QMessageBox::StandardButton defaultButton) +QMessageBox::StandardButton +OBSMessageBox::question(QWidget *parent, const QString &title, + const QString &text, + QMessageBox::StandardButtons buttons, + QMessageBox::StandardButton defaultButton) { - QMessageBox mb(QMessageBox::Question, - title, text, buttons, - parent); + QMessageBox mb(QMessageBox::Question, title, text, buttons, parent); mb.setDefaultButton(defaultButton); - if (buttons & QMessageBox::Ok) \ + if (buttons & QMessageBox::Ok) mb.setButtonText(QMessageBox::Ok, QTStr("OK")); -#define translate_button(x) \ +#define translate_button(x) \ if (buttons & QMessageBox::x) \ mb.setButtonText(QMessageBox::x, QTStr(#x)); translate_button(Open); @@ -78,41 +76,31 @@ return (QMessageBox::StandardButton)mb.exec(); } -void OBSMessageBox::information( - QWidget *parent, - const QString &title, - const QString &text) +void OBSMessageBox::information(QWidget *parent, const QString &title, + const QString &text) { - QMessageBox mb(QMessageBox::Information, - title, text, QMessageBox::Ok, - parent); + QMessageBox mb(QMessageBox::Information, title, text, QMessageBox::Ok, + parent); mb.setButtonText(QMessageBox::Ok, QTStr("OK")); mb.exec(); } -void OBSMessageBox::warning( - QWidget *parent, - const QString &title, - const QString &text, - bool enableRichText) +void OBSMessageBox::warning(QWidget *parent, const QString &title, + const QString &text, bool enableRichText) { - QMessageBox mb(QMessageBox::Warning, - title, text, QMessageBox::Ok, - parent); + QMessageBox mb(QMessageBox::Warning, title, text, QMessageBox::Ok, + parent); if (enableRichText) mb.setTextFormat(Qt::RichText); mb.setButtonText(QMessageBox::Ok, QTStr("OK")); mb.exec(); } -void OBSMessageBox::critical( - QWidget *parent, - const QString &title, - const QString &text) +void OBSMessageBox::critical(QWidget *parent, const QString &title, + const QString &text) { - QMessageBox mb(QMessageBox::Critical, - title, text, QMessageBox::Ok, - parent); + QMessageBox mb(QMessageBox::Critical, title, text, QMessageBox::Ok, + parent); mb.setButtonText(QMessageBox::Ok, QTStr("OK")); mb.exec(); } @@ -156,13 +144,13 @@ } QDataStream &operator<<(QDataStream &out, - const std::vector<std::shared_ptr<OBSSignal>> &) + const std::vector<std::shared_ptr<OBSSignal>> &) { return out; } QDataStream &operator>>(QDataStream &in, - std::vector<std::shared_ptr<OBSSignal>> &) + std::vector<std::shared_ptr<OBSSignal>> &) { return in; } @@ -186,7 +174,7 @@ QDataStream &operator<<(QDataStream &out, const OBSSceneItem &si) { - obs_scene_t *scene = obs_sceneitem_get_scene(si); + obs_scene_t *scene = obs_sceneitem_get_scene(si); obs_source_t *source = obs_sceneitem_get_source(si); return out << QString(obs_source_get_name(obs_scene_get_source(scene))) << QString(obs_source_get_name(source)); @@ -234,16 +222,13 @@ class QuickThread : public QThread { public: - explicit inline QuickThread(std::function<void()> func_) - : func(func_) - {} - -private: - virtual void run() override + explicit inline QuickThread(std::function<void()> func_) : func(func_) { - func(); } +private: + virtual void run() override { func(); } + std::function<void()> func; }; @@ -258,11 +243,10 @@ { QEventLoop eventLoop; - auto wait = [&] () - { + auto wait = [&]() { func(); QMetaObject::invokeMethod(&eventLoop, "quit", - Qt::QueuedConnection); + Qt::QueuedConnection); }; os_atomic_inc_long(&insideEventLoop); @@ -273,10 +257,8 @@ os_atomic_dec_long(&insideEventLoop); } -void ExecuteFuncSafeBlockMsgBox( - std::function<void()> func, - const QString &title, - const QString &text) +void ExecuteFuncSafeBlockMsgBox(std::function<void()> func, + const QString &title, const QString &text) { QMessageBox dlg; dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowCloseButtonHint); @@ -284,8 +266,7 @@ dlg.setText(text); dlg.setStandardButtons(0); - auto wait = [&] () - { + auto wait = [&]() { func(); QMetaObject::invokeMethod(&dlg, "accept", Qt::QueuedConnection); }; @@ -305,13 +286,40 @@ enable_message_boxes = enable; } -void ExecThreadedWithoutBlocking( - std::function<void()> func, - const QString &title, - const QString &text) +void ExecThreadedWithoutBlocking(std::function<void()> func, + const QString &title, const QString &text) { if (!enable_message_boxes) ExecuteFuncSafeBlock(func); else ExecuteFuncSafeBlockMsgBox(func, title, text); } + +bool LineEditCanceled(QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = reinterpret_cast<QKeyEvent *>(event); + return keyEvent->key() == Qt::Key_Escape; + } + + return false; +} + +bool LineEditChanged(QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = reinterpret_cast<QKeyEvent *>(event); + + switch (keyEvent->key()) { + case Qt::Key_Tab: + case Qt::Key_Backtab: + case Qt::Key_Enter: + case Qt::Key_Return: + return true; + } + } else if (event->type() == QEvent::FocusOut) { + return true; + } + + return false; +}
View file
obs-studio-23.2.1.tar.xz/UI/qt-wrappers.hpp -> obs-studio-24.0.0.tar.xz/UI/qt-wrappers.hpp
Changed
@@ -38,25 +38,19 @@ class OBSMessageBox { public: - static QMessageBox::StandardButton question( - QWidget *parent, - const QString &title, - const QString &text, - QMessageBox::StandardButtons buttons = QMessageBox::StandardButtons( QMessageBox::Yes | QMessageBox::No ), - QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); - static void information( - QWidget *parent, - const QString &title, - const QString &text); - static void warning( - QWidget *parent, - const QString &title, - const QString &text, - bool enableRichText = false); - static void critical( - QWidget *parent, - const QString &title, - const QString &text); + static QMessageBox::StandardButton + question(QWidget *parent, const QString &title, const QString &text, + QMessageBox::StandardButtons buttons = + QMessageBox::StandardButtons(QMessageBox::Yes | + QMessageBox::No), + QMessageBox::StandardButton defaultButton = + QMessageBox::NoButton); + static void information(QWidget *parent, const QString &title, + const QString &text); + static void warning(QWidget *parent, const QString &title, + const QString &text, bool enableRichText = false); + static void critical(QWidget *parent, const QString &title, + const QString &text); }; void OBSErrorBox(QWidget *parent, const char *msg, ...); @@ -65,10 +59,11 @@ uint32_t TranslateQtKeyboardEventModifiers(Qt::KeyboardModifiers mods); -QDataStream &operator<<(QDataStream &out, - const std::vector<std::shared_ptr<OBSSignal>> &signal_vec); +QDataStream & +operator<<(QDataStream &out, + const std::vector<std::shared_ptr<OBSSignal>> &signal_vec); QDataStream &operator>>(QDataStream &in, - std::vector<std::shared_ptr<OBSSignal>> &signal_vec); + std::vector<std::shared_ptr<OBSSignal>> &signal_vec); QDataStream &operator<<(QDataStream &out, const OBSScene &scene); QDataStream &operator>>(QDataStream &in, OBSScene &scene); QDataStream &operator<<(QDataStream &out, const OBSSceneItem &si); @@ -77,18 +72,14 @@ QThread *CreateQThread(std::function<void()> func); void ExecuteFuncSafeBlock(std::function<void()> func); -void ExecuteFuncSafeBlockMsgBox( - std::function<void()> func, - const QString &title, - const QString &text); +void ExecuteFuncSafeBlockMsgBox(std::function<void()> func, + const QString &title, const QString &text); /* allows executing without message boxes if starting up, otherwise with a * message box */ void EnableThreadedMessageBoxes(bool enable); -void ExecThreadedWithoutBlocking( - std::function<void()> func, - const QString &title, - const QString &text); +void ExecThreadedWithoutBlocking(std::function<void()> func, + const QString &title, const QString &text); class SignalBlocker { QWidget *widget; @@ -100,10 +91,7 @@ blocked = widget->blockSignals(true); } - inline ~SignalBlocker() - { - widget->blockSignals(blocked); - } + inline ~SignalBlocker() { widget->blockSignals(blocked); } }; void DeleteLayout(QLayout *layout); @@ -111,6 +99,9 @@ static inline Qt::ConnectionType WaitConnection() { return QThread::currentThread() == qApp->thread() - ? Qt::DirectConnection - : Qt::BlockingQueuedConnection; + ? Qt::DirectConnection + : Qt::BlockingQueuedConnection; } + +bool LineEditCanceled(QEvent *event); +bool LineEditChanged(QEvent *event);
View file
obs-studio-24.0.0.tar.xz/UI/record-button.cpp
Added
@@ -0,0 +1,19 @@ +#include "record-button.hpp" +#include "window-basic-main.hpp" + +void RecordButton::resizeEvent(QResizeEvent *event) +{ + OBSBasic *main = OBSBasic::Get(); + if (!main->pause) + return; + + QSize pauseSize = main->pause->size(); + int height = main->ui->recordButton->size().height(); + + if (pauseSize.height() != height || pauseSize.width() != height) { + main->pause->setMinimumSize(height, height); + main->pause->setMaximumSize(height, height); + } + + event->accept(); +}
View file
obs-studio-24.0.0.tar.xz/UI/record-button.hpp
Added
@@ -0,0 +1,12 @@ +#pragma once + +#include <QPushButton> + +class RecordButton : public QPushButton { + Q_OBJECT + +public: + inline RecordButton(QWidget *parent = nullptr) : QPushButton(parent) {} + + virtual void resizeEvent(QResizeEvent *event) override; +};
View file
obs-studio-23.2.1.tar.xz/UI/remote-text.cpp -> obs-studio-24.0.0.tar.xz/UI/remote-text.cpp
Changed
@@ -22,7 +22,7 @@ using namespace std; -static auto curl_deleter = [] (CURL *curl) {curl_easy_cleanup(curl);}; +static auto curl_deleter = [](CURL *curl) { curl_easy_cleanup(curl); }; using Curl = unique_ptr<CURL, decltype(curl_deleter)>; static size_t string_write(char *ptr, size_t size, size_t nmemb, string &str) @@ -53,12 +53,11 @@ struct curl_slist *header = nullptr; string str; - header = curl_slist_append(header, - versionString.c_str()); + header = curl_slist_append(header, versionString.c_str()); if (!contentTypeString.empty()) { header = curl_slist_append(header, - contentTypeString.c_str()); + contentTypeString.c_str()); } for (std::string &h : extraHeaders) @@ -66,18 +65,15 @@ curl_easy_setopt(curl.get(), CURLOPT_URL, url.c_str()); curl_easy_setopt(curl.get(), CURLOPT_ACCEPT_ENCODING, ""); - curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, - header); - curl_easy_setopt(curl.get(), CURLOPT_ERRORBUFFER, - error); + curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, header); + curl_easy_setopt(curl.get(), CURLOPT_ERRORBUFFER, error); curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, - string_write); - curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, - &str); + string_write); + curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, &str); if (timeoutSec) curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, - timeoutSec); + timeoutSec); #if LIBCURL_VERSION_NUM >= 0x072400 // A lot of servers don't yet support ALPN @@ -86,7 +82,7 @@ if (!postData.empty()) { curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, - postData.c_str()); + postData.c_str()); } code = curl_easy_perform(curl.get()); @@ -101,7 +97,7 @@ } static size_t header_write(char *ptr, size_t size, size_t nmemb, - vector<string> &list) + vector<string> &list) { string str; @@ -118,16 +114,10 @@ return total; } -bool GetRemoteFile( - const char *url, - std::string &str, - std::string &error, - long *responseCode, - const char *contentType, - const char *postData, - std::vector<std::string> extraHeaders, - std::string *signature, - int timeoutSec) +bool GetRemoteFile(const char *url, std::string &str, std::string &error, + long *responseCode, const char *contentType, + const char *postData, std::vector<std::string> extraHeaders, + std::string *signature, int timeoutSec) { vector<string> header_in_list; char error_in[CURL_ERROR_SIZE]; @@ -148,12 +138,11 @@ if (curl) { struct curl_slist *header = nullptr; - header = curl_slist_append(header, - versionString.c_str()); + header = curl_slist_append(header, versionString.c_str()); if (!contentTypeString.empty()) { header = curl_slist_append(header, - contentTypeString.c_str()); + contentTypeString.c_str()); } for (std::string &h : extraHeaders) @@ -161,24 +150,21 @@ curl_easy_setopt(curl.get(), CURLOPT_URL, url); curl_easy_setopt(curl.get(), CURLOPT_ACCEPT_ENCODING, ""); - curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, - header); - curl_easy_setopt(curl.get(), CURLOPT_ERRORBUFFER, - error_in); + curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, header); + curl_easy_setopt(curl.get(), CURLOPT_ERRORBUFFER, error_in); curl_easy_setopt(curl.get(), CURLOPT_WRITEFUNCTION, - string_write); - curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, - &str); + string_write); + curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, &str); if (signature) { curl_easy_setopt(curl.get(), CURLOPT_HEADERFUNCTION, - header_write); + header_write); curl_easy_setopt(curl.get(), CURLOPT_HEADERDATA, - &header_in_list); + &header_in_list); } if (timeoutSec) curl_easy_setopt(curl.get(), CURLOPT_TIMEOUT, - timeoutSec); + timeoutSec); #if LIBCURL_VERSION_NUM >= 0x072400 // A lot of servers don't yet support ALPN @@ -187,13 +173,13 @@ if (postData) { curl_easy_setopt(curl.get(), CURLOPT_POSTFIELDS, - postData); + postData); } code = curl_easy_perform(curl.get()); if (responseCode) curl_easy_getinfo(curl.get(), CURLINFO_RESPONSE_CODE, - responseCode); + responseCode); if (code != CURLE_OK) { error = error_in;
View file
obs-studio-23.2.1.tar.xz/UI/remote-text.hpp -> obs-studio-24.0.0.tar.xz/UI/remote-text.hpp
Changed
@@ -38,38 +38,34 @@ void Result(const QString &text, const QString &error); public: - inline RemoteTextThread( - std::string url_, - std::string contentType_ = std::string(), - std::string postData_ = std::string(), - int timeoutSec_ = 0) - : url (url_), - contentType (contentType_), - postData (postData_), - timeoutSec (timeoutSec_) - {} + inline RemoteTextThread(std::string url_, + std::string contentType_ = std::string(), + std::string postData_ = std::string(), + int timeoutSec_ = 0) + : url(url_), + contentType(contentType_), + postData(postData_), + timeoutSec(timeoutSec_) + { + } - inline RemoteTextThread( - std::string url_, - std::vector<std::string> &&extraHeaders_, - std::string contentType_ = std::string(), - std::string postData_ = std::string(), - int timeoutSec_ = 0) - : url (url_), - contentType (contentType_), - postData (postData_), - extraHeaders (std::move(extraHeaders_)), - timeoutSec (timeoutSec_) - {} + inline RemoteTextThread(std::string url_, + std::vector<std::string> &&extraHeaders_, + std::string contentType_ = std::string(), + std::string postData_ = std::string(), + int timeoutSec_ = 0) + : url(url_), + contentType(contentType_), + postData(postData_), + extraHeaders(std::move(extraHeaders_)), + timeoutSec(timeoutSec_) + { + } }; bool GetRemoteFile( - const char *url, - std::string &str, - std::string &error, - long *responseCode = nullptr, - const char *contentType = nullptr, + const char *url, std::string &str, std::string &error, + long *responseCode = nullptr, const char *contentType = nullptr, const char *postData = nullptr, std::vector<std::string> extraHeaders = std::vector<std::string>(), - std::string *signature = nullptr, - int timeoutSec = 0); + std::string *signature = nullptr, int timeoutSec = 0);
View file
obs-studio-23.2.1.tar.xz/UI/slider-absoluteset-style.cpp -> obs-studio-24.0.0.tar.xz/UI/slider-absoluteset-style.cpp
Changed
@@ -1,19 +1,20 @@ #include "slider-absoluteset-style.hpp" -SliderAbsoluteSetStyle::SliderAbsoluteSetStyle(const QString& baseStyle) - :QProxyStyle(baseStyle) +SliderAbsoluteSetStyle::SliderAbsoluteSetStyle(const QString &baseStyle) + : QProxyStyle(baseStyle) { } -SliderAbsoluteSetStyle::SliderAbsoluteSetStyle(QStyle* baseStyle) - :QProxyStyle(baseStyle) +SliderAbsoluteSetStyle::SliderAbsoluteSetStyle(QStyle *baseStyle) + : QProxyStyle(baseStyle) { } int SliderAbsoluteSetStyle::styleHint(QStyle::StyleHint hint, - const QStyleOption* option = 0, const QWidget* widget = 0, - QStyleHintReturn* returnData = 0) const + const QStyleOption *option = 0, + const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const { - if(hint == QStyle::SH_Slider_AbsoluteSetButtons) + if (hint == QStyle::SH_Slider_AbsoluteSetButtons) return (Qt::LeftButton | Qt::MidButton); return QProxyStyle::styleHint(hint, option, widget, returnData); }
View file
obs-studio-23.2.1.tar.xz/UI/slider-absoluteset-style.hpp -> obs-studio-24.0.0.tar.xz/UI/slider-absoluteset-style.hpp
Changed
@@ -2,11 +2,11 @@ #include <QProxyStyle> -class SliderAbsoluteSetStyle : public QProxyStyle -{ +class SliderAbsoluteSetStyle : public QProxyStyle { public: - SliderAbsoluteSetStyle(const QString& baseStyle); - SliderAbsoluteSetStyle(QStyle* baseStyle = Q_NULLPTR); - int styleHint(QStyle::StyleHint hint, const QStyleOption* option, - const QWidget* widget, QStyleHintReturn* returnData) const; + SliderAbsoluteSetStyle(const QString &baseStyle); + SliderAbsoluteSetStyle(QStyle *baseStyle = Q_NULLPTR); + int styleHint(QStyle::StyleHint hint, const QStyleOption *option, + const QWidget *widget, + QStyleHintReturn *returnData) const; };
View file
obs-studio-23.2.1.tar.xz/UI/slider-ignorewheel.cpp -> obs-studio-24.0.0.tar.xz/UI/slider-ignorewheel.cpp
Changed
@@ -6,7 +6,7 @@ } SliderIgnoreScroll::SliderIgnoreScroll(Qt::Orientation orientation, - QWidget *parent) + QWidget *parent) : QSlider(parent) { setFocusPolicy(Qt::StrongFocus);
View file
obs-studio-23.2.1.tar.xz/UI/slider-ignorewheel.hpp -> obs-studio-24.0.0.tar.xz/UI/slider-ignorewheel.hpp
Changed
@@ -9,7 +9,8 @@ public: SliderIgnoreScroll(QWidget *parent = nullptr); - SliderIgnoreScroll(Qt::Orientation orientation, QWidget *parent = nullptr); + SliderIgnoreScroll(Qt::Orientation orientation, + QWidget *parent = nullptr); protected: virtual void wheelEvent(QWheelEvent *event) override;
View file
obs-studio-23.2.1.tar.xz/UI/source-label.cpp -> obs-studio-24.0.0.tar.xz/UI/source-label.cpp
Changed
@@ -19,7 +19,7 @@ void OBSSourceLabel::SourceRenamed(void *data, calldata_t *params) { - auto &label = *static_cast<OBSSourceLabel*>(data); + auto &label = *static_cast<OBSSourceLabel *>(data); const char *name = calldata_string(params, "new_name"); label.setText(name); @@ -29,13 +29,13 @@ void OBSSourceLabel::SourceRemoved(void *data, calldata_t *) { - auto &label = *static_cast<OBSSourceLabel*>(data); + auto &label = *static_cast<OBSSourceLabel *>(data); emit label.Removed(); } void OBSSourceLabel::SourceDestroyed(void *data, calldata_t *) { - auto &label = *static_cast<OBSSourceLabel*>(data); + auto &label = *static_cast<OBSSourceLabel *>(data); emit label.Destroyed(); label.destroyedSignal.Disconnect();
View file
obs-studio-23.2.1.tar.xz/UI/source-label.hpp -> obs-studio-24.0.0.tar.xz/UI/source-label.hpp
Changed
@@ -28,17 +28,18 @@ OBSSignal removedSignal; OBSSignal destroyedSignal; - OBSSourceLabel(const obs_source_t *source, QWidget *parent=nullptr, - Qt::WindowFlags f=0) + OBSSourceLabel(const obs_source_t *source, QWidget *parent = nullptr, + Qt::WindowFlags f = 0) : QLabel(obs_source_get_name(source), parent, f), renamedSignal(obs_source_get_signal_handler(source), "rename", - &OBSSourceLabel::SourceRenamed, this), + &OBSSourceLabel::SourceRenamed, this), removedSignal(obs_source_get_signal_handler(source), "remove", - &OBSSourceLabel::SourceRemoved, this), + &OBSSourceLabel::SourceRemoved, this), destroyedSignal(obs_source_get_signal_handler(source), "destroy", &OBSSourceLabel::SourceDestroyed, this) - {} + { + } protected: static void SourceRenamed(void *data, calldata_t *params);
View file
obs-studio-23.2.1.tar.xz/UI/source-tree.cpp -> obs-studio-24.0.0.tar.xz/UI/source-tree.cpp
Changed
@@ -25,15 +25,14 @@ static inline OBSScene GetCurrentScene() { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); return main->GetCurrentScene(); } /* ========================================================================= */ SourceTreeItem::SourceTreeItem(SourceTree *tree_, OBSSceneItem sceneitem_) - : tree (tree_), - sceneitem (sceneitem_) + : tree(tree_), sceneitem(sceneitem_) { setAttribute(Qt::WA_TranslucentBackground); setMouseTracking(true); @@ -98,14 +97,12 @@ /* --------------------------------------------------------- */ - auto setItemVisible = [this] (bool checked) - { + auto setItemVisible = [this](bool checked) { SignalBlocker sourcesSignalBlocker(this); obs_sceneitem_set_visible(sceneitem, checked); }; - auto setItemLocked = [this] (bool checked) - { + auto setItemLocked = [this](bool checked) { SignalBlocker sourcesSignalBlocker(this); obs_sceneitem_set_locked(sceneitem, checked); }; @@ -130,6 +127,7 @@ itemRemoveSignal.Disconnect(); deselectSignal.Disconnect(); visibleSignal.Disconnect(); + lockedSignal.Disconnect(); renameSignal.Disconnect(); removeSignal.Disconnect(); } @@ -149,47 +147,58 @@ /* --------------------------------------------------------- */ - auto removeItem = [] (void *data, calldata_t *cd) - { - SourceTreeItem *this_ = reinterpret_cast<SourceTreeItem*>(data); + auto removeItem = [](void *data, calldata_t *cd) { + SourceTreeItem *this_ = + reinterpret_cast<SourceTreeItem *>(data); obs_sceneitem_t *curItem = - (obs_sceneitem_t*)calldata_ptr(cd, "item"); + (obs_sceneitem_t *)calldata_ptr(cd, "item"); if (curItem == this_->sceneitem) { - QMetaObject::invokeMethod(this_->tree, - "Remove", - Q_ARG(OBSSceneItem, curItem)); + QMetaObject::invokeMethod(this_->tree, "Remove", + Q_ARG(OBSSceneItem, curItem)); curItem = nullptr; } if (!curItem) QMetaObject::invokeMethod(this_, "Clear"); }; - auto itemVisible = [] (void *data, calldata_t *cd) - { - SourceTreeItem *this_ = reinterpret_cast<SourceTreeItem*>(data); + auto itemVisible = [](void *data, calldata_t *cd) { + SourceTreeItem *this_ = + reinterpret_cast<SourceTreeItem *>(data); obs_sceneitem_t *curItem = - (obs_sceneitem_t*)calldata_ptr(cd, "item"); + (obs_sceneitem_t *)calldata_ptr(cd, "item"); bool visible = calldata_bool(cd, "visible"); if (curItem == this_->sceneitem) QMetaObject::invokeMethod(this_, "VisibilityChanged", - Q_ARG(bool, visible)); + Q_ARG(bool, visible)); }; - auto itemDeselect = [] (void *data, calldata_t *cd) - { - SourceTreeItem *this_ = reinterpret_cast<SourceTreeItem*>(data); + auto itemLocked = [](void *data, calldata_t *cd) { + SourceTreeItem *this_ = + reinterpret_cast<SourceTreeItem *>(data); + obs_sceneitem_t *curItem = + (obs_sceneitem_t *)calldata_ptr(cd, "item"); + bool locked = calldata_bool(cd, "locked"); + + if (curItem == this_->sceneitem) + QMetaObject::invokeMethod(this_, "LockedChanged", + Q_ARG(bool, locked)); + }; + + auto itemDeselect = [](void *data, calldata_t *cd) { + SourceTreeItem *this_ = + reinterpret_cast<SourceTreeItem *>(data); obs_sceneitem_t *curItem = - (obs_sceneitem_t*)calldata_ptr(cd, "item"); + (obs_sceneitem_t *)calldata_ptr(cd, "item"); if (curItem == this_->sceneitem) QMetaObject::invokeMethod(this_, "Deselect"); }; - auto reorderGroup = [] (void *data, calldata_t*) - { - SourceTreeItem *this_ = reinterpret_cast<SourceTreeItem*>(data); + auto reorderGroup = [](void *data, calldata_t *) { + SourceTreeItem *this_ = + reinterpret_cast<SourceTreeItem *>(data); QMetaObject::invokeMethod(this_->tree, "ReorderItems"); }; @@ -200,33 +209,34 @@ sceneRemoveSignal.Connect(signal, "remove", removeItem, this); itemRemoveSignal.Connect(signal, "item_remove", removeItem, this); visibleSignal.Connect(signal, "item_visible", itemVisible, this); + lockedSignal.Connect(signal, "item_locked", itemLocked, this); if (obs_sceneitem_is_group(sceneitem)) { obs_source_t *source = obs_sceneitem_get_source(sceneitem); signal = obs_source_get_signal_handler(source); groupReorderSignal.Connect(signal, "reorder", reorderGroup, - this); + this); } if (scene != GetCurrentScene()) deselectSignal.Connect(signal, "item_deselect", itemDeselect, - this); + this); /* --------------------------------------------------------- */ - auto renamed = [] (void *data, calldata_t *cd) - { - SourceTreeItem *this_ = reinterpret_cast<SourceTreeItem*>(data); + auto renamed = [](void *data, calldata_t *cd) { + SourceTreeItem *this_ = + reinterpret_cast<SourceTreeItem *>(data); const char *name = calldata_string(cd, "new_name"); QMetaObject::invokeMethod(this_, "Renamed", - Q_ARG(QString, QT_UTF8(name))); + Q_ARG(QString, QT_UTF8(name))); }; - auto removeSource = [] (void *data, calldata_t *) - { - SourceTreeItem *this_ = reinterpret_cast<SourceTreeItem*>(data); + auto removeSource = [](void *data, calldata_t *) { + SourceTreeItem *this_ = + reinterpret_cast<SourceTreeItem *>(data); this_->DisconnectSignals(); this_->sceneitem = nullptr; }; @@ -246,13 +256,34 @@ } else { obs_source_t *source = obs_sceneitem_get_source(sceneitem); OBSBasic *main = - reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); if (source) { main->CreatePropertiesWindow(source); } } } +void SourceTreeItem::enterEvent(QEvent *event) +{ + QWidget::enterEvent(event); + + OBSBasicPreview *preview = OBSBasicPreview::Get(); + + std::lock_guard<std::mutex> lock(preview->selectMutex); + preview->hoveredPreviewItems.clear(); + preview->hoveredPreviewItems.push_back(sceneitem); +} + +void SourceTreeItem::leaveEvent(QEvent *event) +{ + QWidget::leaveEvent(event); + + OBSBasicPreview *preview = OBSBasicPreview::Get(); + + std::lock_guard<std::mutex> lock(preview->selectMutex); + preview->hoveredPreviewItems.clear(); +} + bool SourceTreeItem::IsEditing() { return editor != nullptr; @@ -275,7 +306,7 @@ if (!editor) return; - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); std::string newName = QT_TO_UTF8(editor->text()); @@ -294,9 +325,8 @@ return; if (newName.empty()) { - OBSMessageBox::information(main, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + OBSMessageBox::information(main, QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); return; } @@ -310,15 +340,13 @@ /* ----------------------------------------- */ /* check for existing source */ - obs_source_t *existingSource = - obs_get_source_by_name(newName.c_str()); + obs_source_t *existingSource = obs_get_source_by_name(newName.c_str()); obs_source_release(existingSource); bool exists = !!existingSource; if (exists) { - OBSMessageBox::information(main, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + OBSMessageBox::information(main, QTStr("NameExists.Title"), + QTStr("NameExists.Text")); return; } @@ -335,28 +363,16 @@ if (editor != object) return false; - if (event->type() == QEvent::KeyPress) { - QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); - - switch (keyEvent->key()) { - case Qt::Key_Escape: - QMetaObject::invokeMethod(this, "ExitEditMode", - Qt::QueuedConnection, - Q_ARG(bool, false)); - return true; - case Qt::Key_Tab: - case Qt::Key_Backtab: - case Qt::Key_Enter: - case Qt::Key_Return: - QMetaObject::invokeMethod(this, "ExitEditMode", - Qt::QueuedConnection, - Q_ARG(bool, true)); - return true; - } - } else if (event->type() == QEvent::FocusOut) { + if (LineEditCanceled(event)) { + QMetaObject::invokeMethod(this, "ExitEditMode", + Qt::QueuedConnection, + Q_ARG(bool, false)); + return true; + } + if (LineEditChanged(event)) { QMetaObject::invokeMethod(this, "ExitEditMode", - Qt::QueuedConnection, - Q_ARG(bool, true)); + Qt::QueuedConnection, + Q_ARG(bool, true)); return true; } @@ -368,6 +384,11 @@ vis->setChecked(visible); } +void SourceTreeItem::LockedChanged(bool locked) +{ + lock->setChecked(locked); +} + void SourceTreeItem::Renamed(const QString &name) { label->setText(name); @@ -386,14 +407,14 @@ if (obs_sceneitem_is_group(sceneitem)) { newType = Type::Group; - /* ------------------------------------------------- */ - /* if it's a group sub-item */ + /* ------------------------------------------------- */ + /* if it's a group sub-item */ } else if (itemScene != scene) { newType = Type::SubItem; - /* ------------------------------------------------- */ - /* if it's a regular item */ + /* ------------------------------------------------- */ + /* if it's a regular item */ } else { newType = Type::Item; @@ -429,9 +450,8 @@ } else if (type == Type::Group) { expand = new SourceTreeSubItemCheckBox(); - expand->setSizePolicy( - QSizePolicy::Maximum, - QSizePolicy::Maximum); + expand->setSizePolicy(QSizePolicy::Maximum, + QSizePolicy::Maximum); expand->setMaximumSize(10, 16); expand->setMinimumSize(10, 0); #ifdef __APPLE__ @@ -439,14 +459,15 @@ #endif boxLayout->insertWidget(0, expand); - obs_data_t *data = obs_sceneitem_get_private_settings(sceneitem); + obs_data_t *data = + obs_sceneitem_get_private_settings(sceneitem); expand->blockSignals(true); expand->setChecked(obs_data_get_bool(data, "collapsed")); expand->blockSignals(false); obs_data_release(data); - connect(expand, &QPushButton::toggled, - this, &SourceTreeItem::ExpandClicked); + connect(expand, &QPushButton::toggled, this, + &SourceTreeItem::ExpandClicked); } else { spacer = new QSpacerItem(3, 1); @@ -498,10 +519,10 @@ hasGroups = false; } -static bool enumItem(obs_scene_t*, obs_sceneitem_t *item, void *ptr) +static bool enumItem(obs_scene_t *, obs_sceneitem_t *item, void *ptr) { QVector<OBSSceneItem> &items = - *reinterpret_cast<QVector<OBSSceneItem>*>(ptr); + *reinterpret_cast<QVector<OBSSceneItem> *>(ptr); if (obs_sceneitem_is_group(item)) { obs_data_t *data = obs_sceneitem_get_private_settings(item); @@ -537,14 +558,15 @@ bool select = obs_sceneitem_selected(items[i]); QModelIndex index = createIndex(i, 0); - st->selectionModel()->select(index, select - ? QItemSelectionModel::Select - : QItemSelectionModel::Deselect); + st->selectionModel()->select( + index, select ? QItemSelectionModel::Select + : QItemSelectionModel::Deselect); } } /* moves a scene item index (blame linux distros for using older Qt builds) */ -static inline void MoveItem(QVector<OBSSceneItem> &items, int oldIdx, int newIdx) +static inline void MoveItem(QVector<OBSSceneItem> &items, int oldIdx, + int newIdx) { OBSSceneItem item = items[oldIdx]; items.remove(oldIdx); @@ -618,7 +640,7 @@ /* move items */ beginMoveRows(QModelIndex(), idx1Old, idx1Old + count - 1, - QModelIndex(), idx1New + count); + QModelIndex(), idx1New + count); for (i = 0; i < count; i++) { int to = idx1New + count; if (to > idx1Old) @@ -690,8 +712,7 @@ } SourceTreeModel::SourceTreeModel(SourceTree *st_) - : QAbstractListModel (st_), - st (st_) + : QAbstractListModel(st_), st(st_) { obs_frontend_add_event_callback(OBSFrontendEvent, this); } @@ -725,8 +746,7 @@ obs_sceneitem_t *item = items[index.row()]; bool is_group = obs_sceneitem_is_group(item); - return QAbstractListModel::flags(index) | - Qt::ItemIsEditable | + return QAbstractListModel::flags(index) | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | (is_group ? Qt::ItemIsDropEnabled : Qt::NoItemFlags); } @@ -756,8 +776,8 @@ void SourceTreeModel::AddGroup() { QString name = GetNewGroupName(); - obs_sceneitem_t *group = obs_scene_add_group(GetCurrentScene(), - QT_TO_UTF8(name)); + obs_sceneitem_t *group = + obs_scene_add_group(GetCurrentScene(), QT_TO_UTF8(name)); if (!group) return; @@ -769,7 +789,7 @@ UpdateGroupState(true); QMetaObject::invokeMethod(st, "Edit", Qt::QueuedConnection, - Q_ARG(int, 0)); + Q_ARG(int, 0)); } void SourceTreeModel::GroupSelectedItems(QModelIndexList &indices) @@ -788,8 +808,7 @@ } obs_sceneitem_t *item = obs_scene_insert_group( - scene, QT_TO_UTF8(name), - item_order.data(), item_order.size()); + scene, QT_TO_UTF8(name), item_order.data(), item_order.size()); if (!item) { return; } @@ -808,7 +827,7 @@ int toIdx = newIdx + i + 1; if (fromIdx != toIdx) { beginMoveRows(QModelIndex(), fromIdx, fromIdx, - QModelIndex(), toIdx); + QModelIndex(), toIdx); MoveItem(items, fromIdx, toIdx); endMoveRows(); } @@ -820,7 +839,7 @@ obs_sceneitem_select(item, true); QMetaObject::invokeMethod(st, "Edit", Qt::QueuedConnection, - Q_ARG(int, newIdx)); + Q_ARG(int, newIdx)); } void SourceTreeModel::UngroupSelectedGroups(QModelIndexList &indices) @@ -910,20 +929,20 @@ SourceTreeModel *stm_ = new SourceTreeModel(this); setModel(stm_); setStyleSheet(QString( - "*[bgColor=\"1\"]{background-color:rgba(255,68,68,33%);}" \ - "*[bgColor=\"2\"]{background-color:rgba(255,255,68,33%);}" \ - "*[bgColor=\"3\"]{background-color:rgba(68,255,68,33%);}" \ - "*[bgColor=\"4\"]{background-color:rgba(68,255,255,33%);}" \ - "*[bgColor=\"5\"]{background-color:rgba(68,68,255,33%);}" \ - "*[bgColor=\"6\"]{background-color:rgba(255,68,255,33%);}" \ - "*[bgColor=\"7\"]{background-color:rgba(68,68,68,33%);}" \ + "*[bgColor=\"1\"]{background-color:rgba(255,68,68,33%);}" + "*[bgColor=\"2\"]{background-color:rgba(255,255,68,33%);}" + "*[bgColor=\"3\"]{background-color:rgba(68,255,68,33%);}" + "*[bgColor=\"4\"]{background-color:rgba(68,255,255,33%);}" + "*[bgColor=\"5\"]{background-color:rgba(68,68,255,33%);}" + "*[bgColor=\"6\"]{background-color:rgba(255,68,255,33%);}" + "*[bgColor=\"7\"]{background-color:rgba(68,68,68,33%);}" "*[bgColor=\"8\"]{background-color:rgba(255,255,255,33%);}")); setMouseTracking(true); UpdateNoSourcesMessage(); - connect(App(), &OBSApp::StyleChanged, - this, &SourceTree::UpdateNoSourcesMessage); + connect(App(), &OBSApp::StyleChanged, this, + &SourceTree::UpdateNoSourcesMessage); } void SourceTree::ResetWidgets() @@ -975,9 +994,9 @@ QModelIndex index = stm->createIndex(i, 0); if (index.isValid()) - selectionModel()->select(index, select - ? QItemSelectionModel::Select - : QItemSelectionModel::Deselect); + selectionModel()->select( + index, select ? QItemSelectionModel::Select + : QItemSelectionModel::Deselect); } Q_DECLARE_METATYPE(OBSSceneItem); @@ -1021,9 +1040,9 @@ obs_sceneitem_t *dropItem = items[row]; /* item being dropped on */ bool itemIsGroup = obs_sceneitem_is_group(dropItem); - obs_sceneitem_t *dropGroup = itemIsGroup - ? dropItem - : obs_sceneitem_get_group(scene, dropItem); + obs_sceneitem_t *dropGroup = + itemIsGroup ? dropItem + : obs_sceneitem_get_group(scene, dropItem); /* not a group if moving above the group */ if (indicator == QAbstractItemView::AboveItem && itemIsGroup) @@ -1037,7 +1056,8 @@ bool dropOnCollapsed = false; if (dropGroup) { - obs_data_t *data = obs_sceneitem_get_private_settings(dropGroup); + obs_data_t *data = + obs_sceneitem_get_private_settings(dropGroup); dropOnCollapsed = obs_data_get_bool(data, "collapsed"); obs_data_release(data); } @@ -1067,9 +1087,12 @@ /* if dropping a group, detect if it's */ /* below another group */ - obs_sceneitem_t *itemBelow = row == stm->items.count() - ? nullptr - : stm->items[row]; + obs_sceneitem_t *itemBelow; + if (row == stm->items.count()) + itemBelow = nullptr; + else + itemBelow = stm->items[row]; + if (hasGroups) { if (!itemBelow || obs_sceneitem_get_group(scene, itemBelow) != dropGroup) { @@ -1112,8 +1135,8 @@ for (int j = items.size() - 1; j >= 0; j--) { obs_sceneitem_t *subitem = items[j]; obs_sceneitem_t *subitemGroup = - obs_sceneitem_get_group(scene, - subitem); + obs_sceneitem_get_group( + scene, subitem); if (subitemGroup == item) { QModelIndex idx = @@ -1148,7 +1171,7 @@ if (itemTo != from) { stm->beginMoveRows(QModelIndex(), from, from, - QModelIndex(), to); + QModelIndex(), to); MoveItem(items, from, itemTo); stm->endMoveRows(); } @@ -1167,8 +1190,7 @@ obs_sceneitem_t *lastGroup = nullptr; int insertCollapsedIdx = 0; - auto insertCollapsed = [&] (obs_sceneitem_t *item) - { + auto insertCollapsed = [&](obs_sceneitem_t *item) { struct obs_sceneitem_order_info info; info.group = lastGroup; info.item = item; @@ -1178,25 +1200,23 @@ using insertCollapsed_t = decltype(insertCollapsed); - auto preInsertCollapsed = [] (obs_scene_t *, obs_sceneitem_t *item, - void *param) - { + auto preInsertCollapsed = [](obs_scene_t *, obs_sceneitem_t *item, + void *param) { (*reinterpret_cast<insertCollapsed_t *>(param))(item); return true; }; - auto insertLastGroup = [&] () - { - obs_data_t *data = obs_sceneitem_get_private_settings(lastGroup); + auto insertLastGroup = [&]() { + obs_data_t *data = + obs_sceneitem_get_private_settings(lastGroup); bool collapsed = obs_data_get_bool(data, "collapsed"); obs_data_release(data); if (collapsed) { insertCollapsedIdx = 0; - obs_sceneitem_group_enum_items( - lastGroup, - preInsertCollapsed, - &insertCollapsed); + obs_sceneitem_group_enum_items(lastGroup, + preInsertCollapsed, + &insertCollapsed); } struct obs_sceneitem_order_info info; @@ -1205,8 +1225,7 @@ orderList.insert(0, info); }; - auto updateScene = [&] () - { + auto updateScene = [&]() { struct obs_sceneitem_order_info info; for (int i = 0; i < items.size(); i++) { @@ -1241,14 +1260,13 @@ insertLastGroup(); } - obs_scene_reorder_items2(scene, - orderList.data(), orderList.size()); + obs_scene_reorder_items2(scene, orderList.data(), + orderList.size()); }; using updateScene_t = decltype(updateScene); - auto preUpdateScene = [] (void *data, obs_scene_t *) - { + auto preUpdateScene = [](void *data, obs_scene_t *) { (*reinterpret_cast<updateScene_t *>(data))(); }; @@ -1283,21 +1301,27 @@ SourceTreeItem *item = qobject_cast<SourceTreeItem *>(childAt(pos)); OBSBasicPreview *preview = OBSBasicPreview::Get(); - preview->hoveredListItem = !!item ? item->sceneitem : nullptr; QListView::mouseMoveEvent(event); + + std::lock_guard<std::mutex> lock(preview->selectMutex); + preview->hoveredPreviewItems.clear(); + if (item) + preview->hoveredPreviewItems.push_back(item->sceneitem); } void SourceTree::leaveEvent(QEvent *event) { OBSBasicPreview *preview = OBSBasicPreview::Get(); - preview->hoveredListItem = nullptr; + QListView::leaveEvent(event); + + std::lock_guard<std::mutex> lock(preview->selectMutex); + preview->hoveredPreviewItems.clear(); } -void SourceTree::selectionChanged( - const QItemSelection &selected, - const QItemSelection &deselected) +void SourceTree::selectionChanged(const QItemSelection &selected, + const QItemSelection &deselected) { { SignalBlocker sourcesSignalBlocker(this); @@ -1406,7 +1430,7 @@ void SourceTree::Remove(OBSSceneItem item) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); GetStm()->Remove(item); main->SaveProject(); @@ -1415,9 +1439,9 @@ obs_source_t *sceneSource = obs_scene_get_source(scene); obs_source_t *itemSource = obs_sceneitem_get_source(item); blog(LOG_INFO, "User Removed source '%s' (%s) from scene '%s'", - obs_source_get_name(itemSource), - obs_source_get_id(itemSource), - obs_source_get_name(sceneSource)); + obs_source_get_name(itemSource), + obs_source_get_id(itemSource), + obs_source_get_name(sceneSource)); } } @@ -1446,9 +1470,8 @@ QColor color = palette().text().color(); bool lightTheme = (color.redF() < 0.5); - QString file = lightTheme - ? ":res/images/no_sources.svg" - : darkPath.c_str(); + QString file = lightTheme ? ":res/images/no_sources.svg" + : darkPath.c_str(); iconNoSources.load(file); QTextOption opt(Qt::AlignHCenter);
View file
obs-studio-23.2.1.tar.xz/UI/source-tree.hpp -> obs-studio-24.0.0.tar.xz/UI/source-tree.hpp
Changed
@@ -30,6 +30,8 @@ friend class SourceTreeModel; void mouseDoubleClickEvent(QMouseEvent *event) override; + void enterEvent(QEvent *event) override; + void leaveEvent(QEvent *event) override; virtual bool eventFilter(QObject *object, QEvent *event) override; @@ -68,10 +70,11 @@ OBSSignal groupReorderSignal; OBSSignal deselectSignal; OBSSignal visibleSignal; + OBSSignal lockedSignal; OBSSignal renameSignal; OBSSignal removeSignal; - virtual void paintEvent(QPaintEvent* event) override; + virtual void paintEvent(QPaintEvent *event) override; private slots: void Clear(); @@ -80,6 +83,7 @@ void ExitEditMode(bool save); void VisibilityChanged(bool visible); + void LockedChanged(bool locked); void Renamed(const QString &name); void ExpandClicked(bool checked); @@ -121,7 +125,8 @@ ~SourceTreeModel(); virtual int rowCount(const QModelIndex &parent) const override; - virtual QVariant data(const QModelIndex &index, int role) const override; + virtual QVariant data(const QModelIndex &index, + int role) const override; virtual Qt::ItemFlags flags(const QModelIndex &index) const override; virtual Qt::DropActions supportedDropActions() const override; @@ -159,12 +164,12 @@ explicit SourceTree(QWidget *parent = nullptr); - inline bool IgnoreReorder() const {return ignoreReorder;} - inline void Clear() {GetStm()->Clear();} + inline bool IgnoreReorder() const { return ignoreReorder; } + inline void Clear() { GetStm()->Clear(); } - inline void Add(obs_sceneitem_t *item) {GetStm()->Add(item);} - inline OBSSceneItem Get(int idx) {return GetStm()->Get(idx);} - inline QString GetNewGroupName() {return GetStm()->GetNewGroupName();} + inline void Add(obs_sceneitem_t *item) { GetStm()->Add(item); } + inline OBSSceneItem Get(int idx) { return GetStm()->Get(idx); } + inline QString GetNewGroupName() { return GetStm()->GetNewGroupName(); } void SelectItem(obs_sceneitem_t *sceneitem, bool select); @@ -173,7 +178,7 @@ bool GroupedItemsSelected() const; public slots: - inline void ReorderItems() {GetStm()->ReorderItems();} + inline void ReorderItems() { GetStm()->ReorderItems(); } void Remove(OBSSceneItem item); void GroupSelectedItems(); void UngroupSelectedGroups(); @@ -187,5 +192,7 @@ virtual void leaveEvent(QEvent *event) override; virtual void paintEvent(QPaintEvent *event) override; - virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override; + virtual void + selectionChanged(const QItemSelection &selected, + const QItemSelection &deselected) override; };
View file
obs-studio-23.2.1.tar.xz/UI/sparkle-updater.mm -> obs-studio-24.0.0.tar.xz/UI/sparkle-updater.mm
Changed
@@ -6,15 +6,13 @@ return a && b && [a caseInsensitiveCompare:b] == NSOrderedSame; } -@interface OBSSparkleUpdateDelegate : - NSObject<SUUpdaterDelegate, SUVersionComparison> -{ +@interface OBSSparkleUpdateDelegate + : NSObject <SUUpdaterDelegate, SUVersionComparison> { } @property (nonatomic) bool updateToUndeployed; @end -@implementation OBSSparkleUpdateDelegate -{ +@implementation OBSSparkleUpdateDelegate { } @synthesize updateToUndeployed; @@ -50,11 +48,11 @@ item = mpkg; NSMutableDictionary *dict = [NSMutableDictionary - dictionaryWithDictionary:item.propertiesDictionary]; + dictionaryWithDictionary:item.propertiesDictionary]; NSString *build = [host objectForInfoDictionaryKey:@"CFBundleVersion"]; NSString *url = dict[@"sparkle:releaseNotesLink"]; - dict[@"sparkle:releaseNotesLink"] = [url stringByAppendingFormat:@"#%@", - build]; + dict[@"sparkle:releaseNotesLink"] = + [url stringByAppendingFormat:@"#%@", build]; return [[SUAppcastItem alloc] initWithDictionary:dict]; } @@ -62,9 +60,9 @@ - (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)updater { - SUAppcastItem *selected = - [self bestValidUpdateWithDeltasInAppcast:appcast - forUpdater:updater]; + SUAppcastItem *selected = [self + bestValidUpdateWithDeltasInAppcast:appcast + forUpdater:updater]; NSBundle *host = updater.hostBundle; NSString *build = [host objectForInfoDictionaryKey:@"CFBundleVersion"]; @@ -91,8 +89,8 @@ return NSOrderedSame; } -- (id <SUVersionComparison>) - versionComparatorForUpdater:(SUUpdater *)__unused updater +- (id<SUVersionComparison>)versionComparatorForUpdater:(SUUpdater *)__unused + updater { return self; } @@ -141,4 +139,3 @@ { [updater checkForUpdates:nil]; } -
View file
obs-studio-23.2.1.tar.xz/UI/vertical-scroll-area.hpp -> obs-studio-24.0.0.tar.xz/UI/vertical-scroll-area.hpp
Changed
@@ -8,8 +8,7 @@ Q_OBJECT public: - inline VScrollArea(QWidget *parent = nullptr) - : QScrollArea(parent) + inline VScrollArea(QWidget *parent = nullptr) : QScrollArea(parent) { setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); }
View file
obs-studio-23.2.1.tar.xz/UI/visibility-item-widget.cpp -> obs-studio-24.0.0.tar.xz/UI/visibility-item-widget.cpp
Changed
@@ -10,11 +10,11 @@ #include <QLabel> VisibilityItemWidget::VisibilityItemWidget(obs_source_t *source_) - : source (source_), - enabledSignal (obs_source_get_signal_handler(source), "enable", - OBSSourceEnabled, this), - renamedSignal (obs_source_get_signal_handler(source), "rename", - OBSSourceRenamed, this) + : source(source_), + enabledSignal(obs_source_get_signal_handler(source), "enable", + OBSSourceEnabled, this), + renamedSignal(obs_source_get_signal_handler(source), "rename", + OBSSourceRenamed, this) { const char *name = obs_source_get_name(source); bool enabled = obs_source_enabled(source); @@ -38,15 +38,15 @@ setLayout(itemLayout); setStyleSheet("background-color: rgba(255, 255, 255, 0);"); - connect(vis, SIGNAL(clicked(bool)), - this, SLOT(VisibilityClicked(bool))); + connect(vis, SIGNAL(clicked(bool)), this, + SLOT(VisibilityClicked(bool))); } VisibilityItemWidget::VisibilityItemWidget(obs_sceneitem_t *item_) - : item (item_), - source (obs_sceneitem_get_source(item)), - renamedSignal (obs_source_get_signal_handler(source), "rename", - OBSSourceRenamed, this) + : item(item_), + source(obs_sceneitem_get_source(item)), + renamedSignal(obs_source_get_signal_handler(source), "rename", + OBSSourceRenamed, this) { const char *name = obs_source_get_name(source); bool enabled = obs_sceneitem_visible(item); @@ -90,16 +90,15 @@ signal_handler_t *signal = obs_source_get_signal_handler(sceneSource); signal_handler_connect(signal, "remove", OBSSceneRemove, this); - signal_handler_connect(signal, "item_remove", OBSSceneItemRemove, - this); + signal_handler_connect(signal, "item_remove", OBSSceneItemRemove, this); signal_handler_connect(signal, "item_visible", OBSSceneItemVisible, - this); + this); + signal_handler_connect(signal, "item_locked", OBSSceneItemLocked, this); - connect(vis, SIGNAL(clicked(bool)), - this, SLOT(VisibilityClicked(bool))); + connect(vis, SIGNAL(clicked(bool)), this, + SLOT(VisibilityClicked(bool))); - connect(lock, SIGNAL(clicked(bool)), - this, SLOT(LockClicked(bool))); + connect(lock, SIGNAL(clicked(bool)), this, SLOT(LockClicked(bool))); } VisibilityItemWidget::~VisibilityItemWidget() @@ -118,9 +117,11 @@ signal_handler_disconnect(signal, "remove", OBSSceneRemove, this); signal_handler_disconnect(signal, "item_remove", OBSSceneItemRemove, - this); + this); signal_handler_disconnect(signal, "item_visible", OBSSceneItemVisible, - this); + this); + signal_handler_disconnect(signal, "item_locked", OBSSceneItemLocked, + this); sceneRemoved = true; } @@ -128,7 +129,7 @@ void VisibilityItemWidget::OBSSceneRemove(void *param, calldata_t *data) { VisibilityItemWidget *window = - reinterpret_cast<VisibilityItemWidget*>(param); + reinterpret_cast<VisibilityItemWidget *>(param); window->DisconnectItemSignals(); @@ -138,8 +139,8 @@ void VisibilityItemWidget::OBSSceneItemRemove(void *param, calldata_t *data) { VisibilityItemWidget *window = - reinterpret_cast<VisibilityItemWidget*>(param); - obs_sceneitem_t *item = (obs_sceneitem_t*)calldata_ptr(data, "item"); + reinterpret_cast<VisibilityItemWidget *>(param); + obs_sceneitem_t *item = (obs_sceneitem_t *)calldata_ptr(data, "item"); if (item == window->item) window->DisconnectItemSignals(); @@ -148,45 +149,47 @@ void VisibilityItemWidget::OBSSceneItemVisible(void *param, calldata_t *data) { VisibilityItemWidget *window = - reinterpret_cast<VisibilityItemWidget*>(param); - obs_sceneitem_t *curItem = (obs_sceneitem_t*)calldata_ptr(data, "item"); + reinterpret_cast<VisibilityItemWidget *>(param); + obs_sceneitem_t *curItem = + (obs_sceneitem_t *)calldata_ptr(data, "item"); bool enabled = calldata_bool(data, "visible"); if (window->item == curItem) QMetaObject::invokeMethod(window, "SourceEnabled", - Q_ARG(bool, enabled)); + Q_ARG(bool, enabled)); } void VisibilityItemWidget::OBSSceneItemLocked(void *param, calldata_t *data) { VisibilityItemWidget *window = - reinterpret_cast<VisibilityItemWidget*>(param); - obs_sceneitem_t *curItem = (obs_sceneitem_t*)calldata_ptr(data, "item"); + reinterpret_cast<VisibilityItemWidget *>(param); + obs_sceneitem_t *curItem = + (obs_sceneitem_t *)calldata_ptr(data, "item"); bool locked = calldata_bool(data, "locked"); if (window->item == curItem) QMetaObject::invokeMethod(window, "SourceLocked", - Q_ARG(bool, locked)); + Q_ARG(bool, locked)); } void VisibilityItemWidget::OBSSourceEnabled(void *param, calldata_t *data) { VisibilityItemWidget *window = - reinterpret_cast<VisibilityItemWidget*>(param); + reinterpret_cast<VisibilityItemWidget *>(param); bool enabled = calldata_bool(data, "enabled"); QMetaObject::invokeMethod(window, "SourceEnabled", - Q_ARG(bool, enabled)); + Q_ARG(bool, enabled)); } void VisibilityItemWidget::OBSSourceRenamed(void *param, calldata_t *data) { VisibilityItemWidget *window = - reinterpret_cast<VisibilityItemWidget*>(param); + reinterpret_cast<VisibilityItemWidget *>(param); const char *name = calldata_string(data, "new_name"); QMetaObject::invokeMethod(window, "SourceRenamed", - Q_ARG(QString, QT_UTF8(name))); + Q_ARG(QString, QT_UTF8(name))); } void VisibilityItemWidget::VisibilityClicked(bool visible) @@ -221,8 +224,8 @@ label->setText(name); } -void VisibilityItemWidget::SetColor(const QColor &color, - bool active_, bool selected_) +void VisibilityItemWidget::SetColor(const QColor &color, bool active_, + bool selected_) { /* Do not update unless the state has actually changed */ if (active_ == active && selected_ == selected) @@ -244,19 +247,19 @@ } void VisibilityItemDelegate::paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const + const QStyleOptionViewItem &option, + const QModelIndex &index) const { QStyledItemDelegate::paint(painter, option, index); QObject *parentObj = parent(); - QListWidget *list = qobject_cast<QListWidget*>(parentObj); + QListWidget *list = qobject_cast<QListWidget *>(parentObj); if (!list) return; QListWidgetItem *item = list->item(index.row()); VisibilityItemWidget *widget = - qobject_cast<VisibilityItemWidget*>(list->itemWidget(item)); + qobject_cast<VisibilityItemWidget *>(list->itemWidget(item)); if (!widget) return; @@ -265,8 +268,8 @@ QPalette palette = list->palette(); #if defined(_WIN32) || defined(__APPLE__) - QPalette::ColorGroup group = active ? - QPalette::Active : QPalette::Inactive; + QPalette::ColorGroup group = active ? QPalette::Active + : QPalette::Inactive; #else QPalette::ColorGroup group = QPalette::Active; #endif @@ -288,7 +291,7 @@ } void SetupVisibilityItem(QListWidget *list, QListWidgetItem *item, - obs_source_t *source) + obs_source_t *source) { VisibilityItemWidget *baseWidget = new VisibilityItemWidget(source); @@ -297,7 +300,7 @@ } void SetupVisibilityItem(QListWidget *list, QListWidgetItem *item, - obs_sceneitem_t *sceneItem) + obs_sceneitem_t *sceneItem) { VisibilityItemWidget *baseWidget = new VisibilityItemWidget(sceneItem);
View file
obs-studio-23.2.1.tar.xz/UI/visibility-item-widget.hpp -> obs-studio-24.0.0.tar.xz/UI/visibility-item-widget.hpp
Changed
@@ -61,10 +61,10 @@ VisibilityItemDelegate(QObject *parent = nullptr); void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const override; + const QModelIndex &index) const override; }; void SetupVisibilityItem(QListWidget *list, QListWidgetItem *item, - obs_source_t *source); + obs_source_t *source); void SetupVisibilityItem(QListWidget *list, QListWidgetItem *item, - obs_sceneitem_t *sceneItem); + obs_sceneitem_t *sceneItem);
View file
obs-studio-23.2.1.tar.xz/UI/volume-control.cpp -> obs-studio-24.0.0.tar.xz/UI/volume-control.cpp
Changed
@@ -21,35 +21,35 @@ void VolControl::OBSVolumeChanged(void *data, float db) { Q_UNUSED(db); - VolControl *volControl = static_cast<VolControl*>(data); + VolControl *volControl = static_cast<VolControl *>(data); QMetaObject::invokeMethod(volControl, "VolumeChanged"); } void VolControl::OBSVolumeLevel(void *data, - const float magnitude[MAX_AUDIO_CHANNELS], - const float peak[MAX_AUDIO_CHANNELS], - const float inputPeak[MAX_AUDIO_CHANNELS]) + const float magnitude[MAX_AUDIO_CHANNELS], + const float peak[MAX_AUDIO_CHANNELS], + const float inputPeak[MAX_AUDIO_CHANNELS]) { - VolControl *volControl = static_cast<VolControl*>(data); + VolControl *volControl = static_cast<VolControl *>(data); volControl->volMeter->setLevels(magnitude, peak, inputPeak); } void VolControl::OBSVolumeMuted(void *data, calldata_t *calldata) { - VolControl *volControl = static_cast<VolControl*>(data); + VolControl *volControl = static_cast<VolControl *>(data); bool muted = calldata_bool(calldata, "muted"); QMetaObject::invokeMethod(volControl, "VolumeMuted", - Q_ARG(bool, muted)); + Q_ARG(bool, muted)); } void VolControl::VolumeChanged() { slider->blockSignals(true); - slider->setValue((int) (obs_fader_get_deflection(obs_fader) * - FADER_PRECISION)); + slider->setValue( + (int)(obs_fader_get_deflection(obs_fader) * FADER_PRECISION)); slider->blockSignals(false); updateText(); @@ -74,14 +74,19 @@ void VolControl::updateText() { - QString db = QString::number(obs_fader_get_db(obs_fader), 'f', 1) - .append(" dB"); - volLabel->setText(db); + QString text; + float db = obs_fader_get_db(obs_fader); + + if (db < -96.0f) + text = "-inf dB"; + else + text = QString::number(db, 'f', 1).append(" dB"); + + volLabel->setText(text); bool muted = obs_source_muted(source); - const char *accTextLookup = muted - ? "VolControl.SliderMuted" - : "VolControl.SliderUnmuted"; + const char *accTextLookup = muted ? "VolControl.SliderMuted" + : "VolControl.SliderUnmuted"; QString sourceName = obs_source_get_name(source); QString accText = QTStr(accTextLookup).arg(sourceName, db); @@ -115,16 +120,16 @@ } VolControl::VolControl(OBSSource source_, bool showConfig, bool vertical) - : source (std::move(source_)), - levelTotal (0.0f), - levelCount (0.0f), - obs_fader (obs_fader_create(OBS_FADER_LOG)), - obs_volmeter (obs_volmeter_create(OBS_FADER_LOG)), - vertical (vertical) + : source(std::move(source_)), + levelTotal(0.0f), + levelCount(0.0f), + obs_fader(obs_fader_create(OBS_FADER_LOG)), + obs_volmeter(obs_volmeter_create(OBS_FADER_LOG)), + vertical(vertical) { nameLabel = new QLabel(); - volLabel = new QLabel(); - mute = new MuteCheckBox(); + volLabel = new QLabel(); + mute = new MuteCheckBox(); QString sourceName = obs_source_get_name(source); setObjectName(sourceName); @@ -134,15 +139,15 @@ config->setProperty("themeID", "configIconSmall"); config->setFlat(true); config->setSizePolicy(QSizePolicy::Maximum, - QSizePolicy::Maximum); + QSizePolicy::Maximum); config->setMaximumSize(22, 22); config->setAutoDefault(false); - config->setAccessibleName(QTStr("VolControl.Properties") - .arg(sourceName)); + config->setAccessibleName( + QTStr("VolControl.Properties").arg(sourceName)); - connect(config, &QAbstractButton::clicked, - this, &VolControl::EmitConfigClicked); + connect(config, &QAbstractButton::clicked, this, + &VolControl::EmitConfigClicked); } QVBoxLayout *mainLayout = new QVBoxLayout; @@ -153,10 +158,10 @@ QHBoxLayout *nameLayout = new QHBoxLayout; QHBoxLayout *controlLayout = new QHBoxLayout; QHBoxLayout *volLayout = new QHBoxLayout; - QHBoxLayout *meterLayout = new QHBoxLayout; + QHBoxLayout *meterLayout = new QHBoxLayout; - volMeter = new VolumeMeter(nullptr, obs_volmeter, true); - slider = new SliderIgnoreScroll(Qt::Vertical); + volMeter = new VolumeMeter(nullptr, obs_volmeter, true); + slider = new SliderIgnoreScroll(Qt::Vertical); nameLayout->setAlignment(Qt::AlignCenter); meterLayout->setAlignment(Qt::AlignCenter); @@ -195,18 +200,18 @@ setMaximumWidth(110); } else { - QHBoxLayout *volLayout = new QHBoxLayout; + QHBoxLayout *volLayout = new QHBoxLayout; QHBoxLayout *textLayout = new QHBoxLayout; - QHBoxLayout *botLayout = new QHBoxLayout; + QHBoxLayout *botLayout = new QHBoxLayout; - volMeter = new VolumeMeter(nullptr, obs_volmeter, false); - slider = new SliderIgnoreScroll(Qt::Horizontal); + volMeter = new VolumeMeter(nullptr, obs_volmeter, false); + slider = new SliderIgnoreScroll(Qt::Horizontal); textLayout->setContentsMargins(0, 0, 0, 0); textLayout->addWidget(nameLabel); textLayout->addWidget(volLabel); textLayout->setAlignment(nameLabel, Qt::AlignLeft); - textLayout->setAlignment(volLabel, Qt::AlignRight); + textLayout->setAlignment(volLabel, Qt::AlignRight); volLayout->addWidget(slider); volLayout->addWidget(mute); @@ -229,7 +234,7 @@ setLayout(mainLayout); QFont font = nameLabel->font(); - font.setPointSize(font.pointSize()-1); + font.setPointSize(font.pointSize() - 1); nameLabel->setText(sourceName); nameLabel->setFont(font); @@ -244,13 +249,13 @@ obs_fader_add_callback(obs_fader, OBSVolumeChanged, this); obs_volmeter_add_callback(obs_volmeter, OBSVolumeLevel, this); - signal_handler_connect(obs_source_get_signal_handler(source), - "mute", OBSVolumeMuted, this); + signal_handler_connect(obs_source_get_signal_handler(source), "mute", + OBSVolumeMuted, this); - QWidget::connect(slider, SIGNAL(valueChanged(int)), - this, SLOT(SliderChanged(int))); - QWidget::connect(mute, SIGNAL(clicked(bool)), - this, SLOT(SetMuted(bool))); + QWidget::connect(slider, SIGNAL(valueChanged(int)), this, + SLOT(SliderChanged(int))); + QWidget::connect(mute, SIGNAL(clicked(bool)), this, + SLOT(SetMuted(bool))); obs_fader_attach_source(obs_fader, source); obs_volmeter_attach_source(obs_volmeter, source); @@ -276,8 +281,8 @@ obs_fader_remove_callback(obs_fader, OBSVolumeChanged, this); obs_volmeter_remove_callback(obs_volmeter, OBSVolumeLevel, this); - signal_handler_disconnect(obs_source_get_signal_handler(source), - "mute", OBSVolumeMuted, this); + signal_handler_disconnect(obs_source_get_signal_handler(source), "mute", + OBSVolumeMuted, this); obs_fader_destroy(obs_fader); obs_volmeter_destroy(obs_volmeter); @@ -509,6 +514,7 @@ void VolumeMeter::mousePressEvent(QMouseEvent *event) { setFocus(Qt::MouseFocusReason); + event->accept(); } void VolumeMeter::wheelEvent(QWheelEvent *event) @@ -517,34 +523,33 @@ } VolumeMeter::VolumeMeter(QWidget *parent, obs_volmeter_t *obs_volmeter, - bool vertical) - : QWidget(parent), obs_volmeter(obs_volmeter), - vertical(vertical) + bool vertical) + : QWidget(parent), obs_volmeter(obs_volmeter), vertical(vertical) { // Use a font that can be rendered small. tickFont = QFont("Arial"); tickFont.setPixelSize(7); // Default meter color settings, they only show if // there is no stylesheet, do not remove. - backgroundNominalColor.setRgb(0x26, 0x7f, 0x26); // Dark green - backgroundWarningColor.setRgb(0x7f, 0x7f, 0x26); // Dark yellow - backgroundErrorColor.setRgb(0x7f, 0x26, 0x26); // Dark red - foregroundNominalColor.setRgb(0x4c, 0xff, 0x4c); // Bright green - foregroundWarningColor.setRgb(0xff, 0xff, 0x4c); // Bright yellow - foregroundErrorColor.setRgb(0xff, 0x4c, 0x4c); // Bright red - clipColor.setRgb(0xff, 0xff, 0xff); // Bright white - magnitudeColor.setRgb(0x00, 0x00, 0x00); // Black - majorTickColor.setRgb(0xff, 0xff, 0xff); // Black - minorTickColor.setRgb(0xcc, 0xcc, 0xcc); // Black - minimumLevel = -60.0; // -60 dB - warningLevel = -20.0; // -20 dB - errorLevel = -9.0; // -9 dB - clipLevel = -0.5; // -0.5 dB - minimumInputLevel = -50.0; // -50 dB - peakDecayRate = 11.76; // 20 dB / 1.7 sec - magnitudeIntegrationTime = 0.3; // 99% in 300 ms - peakHoldDuration = 20.0; // 20 seconds - inputPeakHoldDuration = 1.0; // 1 second + backgroundNominalColor.setRgb(0x26, 0x7f, 0x26); // Dark green + backgroundWarningColor.setRgb(0x7f, 0x7f, 0x26); // Dark yellow + backgroundErrorColor.setRgb(0x7f, 0x26, 0x26); // Dark red + foregroundNominalColor.setRgb(0x4c, 0xff, 0x4c); // Bright green + foregroundWarningColor.setRgb(0xff, 0xff, 0x4c); // Bright yellow + foregroundErrorColor.setRgb(0xff, 0x4c, 0x4c); // Bright red + clipColor.setRgb(0xff, 0xff, 0xff); // Bright white + magnitudeColor.setRgb(0x00, 0x00, 0x00); // Black + majorTickColor.setRgb(0xff, 0xff, 0xff); // Black + minorTickColor.setRgb(0xcc, 0xcc, 0xcc); // Black + minimumLevel = -60.0; // -60 dB + warningLevel = -20.0; // -20 dB + errorLevel = -9.0; // -9 dB + clipLevel = -0.5; // -0.5 dB + minimumInputLevel = -50.0; // -50 dB + peakDecayRate = 11.76; // 20 dB / 1.7 sec + magnitudeIntegrationTime = 0.3; // 99% in 300 ms + peakHoldDuration = 20.0; // 20 seconds + inputPeakHoldDuration = 1.0; // 1 second channels = (int)audio_output_get_channels(obs_get_audio()); @@ -566,8 +571,8 @@ } void VolumeMeter::setLevels(const float magnitude[MAX_AUDIO_CHANNELS], - const float peak[MAX_AUDIO_CHANNELS], - const float inputPeak[MAX_AUDIO_CHANNELS]) + const float peak[MAX_AUDIO_CHANNELS], + const float inputPeak[MAX_AUDIO_CHANNELS]) { uint64_t ts = os_gettime_ns(); QMutexLocker locker(&dataMutex); @@ -632,11 +637,12 @@ } } -inline void VolumeMeter::calculateBallisticsForChannel(int channelNr, - uint64_t ts, qreal timeSinceLastRedraw) +inline void +VolumeMeter::calculateBallisticsForChannel(int channelNr, uint64_t ts, + qreal timeSinceLastRedraw) { if (currentPeak[channelNr] >= displayPeak[channelNr] || - isnan(displayPeak[channelNr])) { + isnan(displayPeak[channelNr])) { // Attack of peak is immediate. displayPeak[channelNr] = currentPeak[channelNr]; } else { @@ -645,11 +651,11 @@ // 24 dB / 2.8 seconds for Slow Profile (Type II PPM) float decay = float(peakDecayRate * timeSinceLastRedraw); displayPeak[channelNr] = CLAMP(displayPeak[channelNr] - decay, - currentPeak[channelNr], 0); + currentPeak[channelNr], 0); } if (currentPeak[channelNr] >= displayPeakHold[channelNr] || - !isfinite(displayPeakHold[channelNr])) { + !isfinite(displayPeakHold[channelNr])) { // Attack of peak-hold is immediate, but keep track // when it was last updated. displayPeakHold[channelNr] = currentPeak[channelNr]; @@ -657,8 +663,10 @@ } else { // The peak and hold falls back to peak // after 20 seconds. - qreal timeSinceLastPeak = (uint64_t)(ts - - displayPeakHoldLastUpdateTime[channelNr]) * 0.000000001; + qreal timeSinceLastPeak = + (uint64_t)(ts - + displayPeakHoldLastUpdateTime[channelNr]) * + 0.000000001; if (timeSinceLastPeak > peakHoldDuration) { displayPeakHold[channelNr] = currentPeak[channelNr]; displayPeakHoldLastUpdateTime[channelNr] = ts; @@ -666,21 +674,22 @@ } if (currentInputPeak[channelNr] >= displayInputPeakHold[channelNr] || - !isfinite(displayInputPeakHold[channelNr])) { + !isfinite(displayInputPeakHold[channelNr])) { // Attack of peak-hold is immediate, but keep track // when it was last updated. displayInputPeakHold[channelNr] = currentInputPeak[channelNr]; displayInputPeakHoldLastUpdateTime[channelNr] = ts; } else { // The peak and hold falls back to peak after 1 second. - qreal timeSinceLastPeak = (uint64_t)(ts - - displayInputPeakHoldLastUpdateTime[channelNr]) * + qreal timeSinceLastPeak = + (uint64_t)( + ts - + displayInputPeakHoldLastUpdateTime[channelNr]) * 0.000000001; if (timeSinceLastPeak > inputPeakHoldDuration) { displayInputPeakHold[channelNr] = currentInputPeak[channelNr]; - displayInputPeakHoldLastUpdateTime[channelNr] = - ts; + displayInputPeakHoldLastUpdateTime[channelNr] = ts; } } @@ -692,27 +701,29 @@ // A VU meter will integrate to the new value to 99% in 300 ms. // The calculation here is very simplified and is more accurate // with higher frame-rate. - float attack = float((currentMagnitude[channelNr] - - displayMagnitude[channelNr]) * - (timeSinceLastRedraw / - magnitudeIntegrationTime) * 0.99); - displayMagnitude[channelNr] = CLAMP(displayMagnitude[channelNr] - + attack, (float)minimumLevel, 0); + float attack = + float((currentMagnitude[channelNr] - + displayMagnitude[channelNr]) * + (timeSinceLastRedraw / magnitudeIntegrationTime) * + 0.99); + displayMagnitude[channelNr] = + CLAMP(displayMagnitude[channelNr] + attack, + (float)minimumLevel, 0); } } inline void VolumeMeter::calculateBallistics(uint64_t ts, - qreal timeSinceLastRedraw) + qreal timeSinceLastRedraw) { QMutexLocker locker(&dataMutex); for (int channelNr = 0; channelNr < MAX_AUDIO_CHANNELS; channelNr++) calculateBallisticsForChannel(channelNr, ts, - timeSinceLastRedraw); + timeSinceLastRedraw); } void VolumeMeter::paintInputMeter(QPainter &painter, int x, int y, int width, - int height, float peakHold) + int height, float peakHold) { QMutexLocker locker(&dataMutex); QColor color; @@ -732,7 +743,7 @@ } void VolumeMeter::paintHTicks(QPainter &painter, int x, int y, int width, - int height) + int height) { qreal scale = width / minimumLevel; @@ -740,7 +751,7 @@ painter.setPen(majorTickColor); // Draw major tick lines and numeric indicators. - for (int i = 0; i >= minimumLevel; i-= 5) { + for (int i = 0; i >= minimumLevel; i -= 5) { int position = int(x + width - (i * scale) - 1); QString str = QString::number(i); @@ -768,7 +779,7 @@ painter.setPen(majorTickColor); // Draw major tick lines and numeric indicators. - for (int i = 0; i >= minimumLevel; i-= 5) { + for (int i = 0; i >= minimumLevel; i -= 5) { int position = y + int((i * scale) - 1); QString str = QString::number(i); @@ -798,22 +809,23 @@ } void VolumeMeter::paintHMeter(QPainter &painter, int x, int y, int width, - int height, float magnitude, float peak, float peakHold) + int height, float magnitude, float peak, + float peakHold) { qreal scale = width / minimumLevel; QMutexLocker locker(&dataMutex); - int minimumPosition = x + 0; - int maximumPosition = x + width; - int magnitudePosition = int(x + width - (magnitude * scale)); - int peakPosition = int(x + width - (peak * scale)); - int peakHoldPosition = int(x + width - (peakHold * scale)); - int warningPosition = int(x + width - (warningLevel * scale)); - int errorPosition = int(x + width - (errorLevel * scale)); - - int nominalLength = warningPosition - minimumPosition; - int warningLength = errorPosition - warningPosition; - int errorLength = maximumPosition - errorPosition; + int minimumPosition = x + 0; + int maximumPosition = x + width; + int magnitudePosition = int(x + width - (magnitude * scale)); + int peakPosition = int(x + width - (peak * scale)); + int peakHoldPosition = int(x + width - (peakHold * scale)); + int warningPosition = int(x + width - (warningLevel * scale)); + int errorPosition = int(x + width - (errorLevel * scale)); + + int nominalLength = warningPosition - minimumPosition; + int warningLength = errorPosition - warningPosition; + int errorLength = maximumPosition - errorPosition; locker.unlock(); if (clipping) { @@ -822,87 +834,89 @@ if (peakPosition < minimumPosition) { painter.fillRect(minimumPosition, y, nominalLength, height, - backgroundNominalColor); + backgroundNominalColor); painter.fillRect(warningPosition, y, warningLength, height, - backgroundWarningColor); + backgroundWarningColor); painter.fillRect(errorPosition, y, errorLength, height, - backgroundErrorColor); + backgroundErrorColor); } else if (peakPosition < warningPosition) { - painter.fillRect(minimumPosition, y, peakPosition - - minimumPosition, height, - foregroundNominalColor); - painter.fillRect(peakPosition, y, warningPosition - - peakPosition, height, backgroundNominalColor); + painter.fillRect(minimumPosition, y, + peakPosition - minimumPosition, height, + foregroundNominalColor); + painter.fillRect(peakPosition, y, + warningPosition - peakPosition, height, + backgroundNominalColor); painter.fillRect(warningPosition, y, warningLength, height, - backgroundWarningColor); + backgroundWarningColor); painter.fillRect(errorPosition, y, errorLength, height, - backgroundErrorColor); + backgroundErrorColor); } else if (peakPosition < errorPosition) { painter.fillRect(minimumPosition, y, nominalLength, height, - foregroundNominalColor); + foregroundNominalColor); painter.fillRect(warningPosition, y, - peakPosition - warningPosition, height, - foregroundWarningColor); - painter.fillRect(peakPosition, y, errorPosition - - peakPosition, height, backgroundWarningColor); + peakPosition - warningPosition, height, + foregroundWarningColor); + painter.fillRect(peakPosition, y, errorPosition - peakPosition, + height, backgroundWarningColor); painter.fillRect(errorPosition, y, errorLength, height, - backgroundErrorColor); + backgroundErrorColor); } else if (peakPosition < maximumPosition) { painter.fillRect(minimumPosition, y, nominalLength, height, - foregroundNominalColor); + foregroundNominalColor); painter.fillRect(warningPosition, y, warningLength, height, - foregroundWarningColor); + foregroundWarningColor); painter.fillRect(errorPosition, y, peakPosition - errorPosition, - height, foregroundErrorColor); + height, foregroundErrorColor); painter.fillRect(peakPosition, y, - maximumPosition - peakPosition, height, - backgroundErrorColor); + maximumPosition - peakPosition, height, + backgroundErrorColor); } else { if (!clipping) { QTimer::singleShot(CLIP_FLASH_DURATION_MS, this, - SLOT(ClipEnding())); + SLOT(ClipEnding())); clipping = true; } int end = errorLength + warningLength + nominalLength; painter.fillRect(minimumPosition, y, end, height, - QBrush(foregroundErrorColor)); + QBrush(foregroundErrorColor)); } if (peakHoldPosition - 3 < minimumPosition) - ;// Peak-hold below minimum, no drawing. + ; // Peak-hold below minimum, no drawing. else if (peakHoldPosition < warningPosition) painter.fillRect(peakHoldPosition - 3, y, 3, height, - foregroundNominalColor); + foregroundNominalColor); else if (peakHoldPosition < errorPosition) painter.fillRect(peakHoldPosition - 3, y, 3, height, - foregroundWarningColor); + foregroundWarningColor); else painter.fillRect(peakHoldPosition - 3, y, 3, height, - foregroundErrorColor); + foregroundErrorColor); if (magnitudePosition - 3 >= minimumPosition) painter.fillRect(magnitudePosition - 3, y, 3, height, - magnitudeColor); + magnitudeColor); } void VolumeMeter::paintVMeter(QPainter &painter, int x, int y, int width, - int height, float magnitude, float peak, float peakHold) + int height, float magnitude, float peak, + float peakHold) { qreal scale = height / minimumLevel; QMutexLocker locker(&dataMutex); - int minimumPosition = y + 0; - int maximumPosition = y + height; - int magnitudePosition = int(y + height - (magnitude * scale)); - int peakPosition = int(y + height - (peak * scale)); - int peakHoldPosition = int(y + height - (peakHold * scale)); - int warningPosition = int(y + height - (warningLevel * scale)); - int errorPosition = int(y + height - (errorLevel * scale)); - - int nominalLength = warningPosition - minimumPosition; - int warningLength = errorPosition - warningPosition; - int errorLength = maximumPosition - errorPosition; + int minimumPosition = y + 0; + int maximumPosition = y + height; + int magnitudePosition = int(y + height - (magnitude * scale)); + int peakPosition = int(y + height - (peak * scale)); + int peakHoldPosition = int(y + height - (peakHold * scale)); + int warningPosition = int(y + height - (warningLevel * scale)); + int errorPosition = int(y + height - (errorLevel * scale)); + + int nominalLength = warningPosition - minimumPosition; + int warningLength = errorPosition - warningPosition; + int errorLength = maximumPosition - errorPosition; locker.unlock(); if (clipping) { @@ -911,65 +925,71 @@ if (peakPosition < minimumPosition) { painter.fillRect(x, minimumPosition, width, nominalLength, - backgroundNominalColor); + backgroundNominalColor); painter.fillRect(x, warningPosition, width, warningLength, - backgroundWarningColor); + backgroundWarningColor); painter.fillRect(x, errorPosition, width, errorLength, - backgroundErrorColor); + backgroundErrorColor); } else if (peakPosition < warningPosition) { - painter.fillRect(x, minimumPosition, width, peakPosition - - minimumPosition, foregroundNominalColor); - painter.fillRect(x, peakPosition, width, warningPosition - - peakPosition, backgroundNominalColor); + painter.fillRect(x, minimumPosition, width, + peakPosition - minimumPosition, + foregroundNominalColor); + painter.fillRect(x, peakPosition, width, + warningPosition - peakPosition, + backgroundNominalColor); painter.fillRect(x, warningPosition, width, warningLength, - backgroundWarningColor); + backgroundWarningColor); painter.fillRect(x, errorPosition, width, errorLength, - backgroundErrorColor); + backgroundErrorColor); } else if (peakPosition < errorPosition) { - painter.fillRect(x,minimumPosition, width, nominalLength, - foregroundNominalColor); - painter.fillRect(x, warningPosition, width, peakPosition - - warningPosition, foregroundWarningColor); - painter.fillRect(x, peakPosition, width, errorPosition - - peakPosition, backgroundWarningColor); + painter.fillRect(x, minimumPosition, width, nominalLength, + foregroundNominalColor); + painter.fillRect(x, warningPosition, width, + peakPosition - warningPosition, + foregroundWarningColor); + painter.fillRect(x, peakPosition, width, + errorPosition - peakPosition, + backgroundWarningColor); painter.fillRect(x, errorPosition, width, errorLength, - backgroundErrorColor); + backgroundErrorColor); } else if (peakPosition < maximumPosition) { painter.fillRect(x, minimumPosition, width, nominalLength, - foregroundNominalColor); + foregroundNominalColor); painter.fillRect(x, warningPosition, width, warningLength, - foregroundWarningColor); - painter.fillRect(x, errorPosition, width, peakPosition - - errorPosition, foregroundErrorColor); - painter.fillRect(x, peakPosition, width, maximumPosition - - peakPosition, backgroundErrorColor); + foregroundWarningColor); + painter.fillRect(x, errorPosition, width, + peakPosition - errorPosition, + foregroundErrorColor); + painter.fillRect(x, peakPosition, width, + maximumPosition - peakPosition, + backgroundErrorColor); } else { if (!clipping) { QTimer::singleShot(CLIP_FLASH_DURATION_MS, this, - SLOT(ClipEnding())); + SLOT(ClipEnding())); clipping = true; } int end = errorLength + warningLength + nominalLength; painter.fillRect(x, minimumPosition, width, end, - QBrush(foregroundErrorColor)); + QBrush(foregroundErrorColor)); } if (peakHoldPosition - 3 < minimumPosition) - ;// Peak-hold below minimum, no drawing. + ; // Peak-hold below minimum, no drawing. else if (peakHoldPosition < warningPosition) painter.fillRect(x, peakHoldPosition - 3, width, 3, - foregroundNominalColor); + foregroundNominalColor); else if (peakHoldPosition < errorPosition) painter.fillRect(x, peakHoldPosition - 3, width, 3, - foregroundWarningColor); + foregroundWarningColor); else painter.fillRect(x, peakHoldPosition - 3, width, 3, - foregroundErrorColor); + foregroundErrorColor); if (magnitudePosition - 3 >= minimumPosition) painter.fillRect(x, magnitudePosition - 3, width, 3, - magnitudeColor); + magnitudeColor); } void VolumeMeter::paintEvent(QPaintEvent *event) @@ -978,7 +998,7 @@ qreal timeSinceLastRedraw = (ts - lastRedrawTime) * 0.000000001; const QRect rect = event->region().boundingRect(); - int width = rect.width(); + int width = rect.width(); int height = rect.height(); handleChannelCofigurationChange(); @@ -992,7 +1012,7 @@ else tickPaintCacheSize = QSize(width, 9); if (tickPaintCache == nullptr || - tickPaintCache->size() != tickPaintCacheSize) { + tickPaintCache->size() != tickPaintCacheSize) { delete tickPaintCache; tickPaintCache = new QPixmap(tickPaintCacheSize); @@ -1004,11 +1024,11 @@ tickPainter.translate(0, height); tickPainter.scale(1, -1); paintVTicks(tickPainter, 0, 11, - tickPaintCacheSize.height() - 11); + tickPaintCacheSize.height() - 11); } else { paintHTicks(tickPainter, 6, 0, - tickPaintCacheSize.width() - 6, - tickPaintCacheSize.height()); + tickPaintCacheSize.width() - 6, + tickPaintCacheSize.height()); } tickPainter.end(); } @@ -1020,29 +1040,29 @@ painter.translate(0, height); painter.scale(1, -1); painter.drawPixmap(displayNrAudioChannels * 4 - 1, 7, - *tickPaintCache); + *tickPaintCache); } else { painter.drawPixmap(0, height - 9, *tickPaintCache); } for (int channelNr = 0; channelNr < displayNrAudioChannels; - channelNr++) { + channelNr++) { - int channelNrFixed = (displayNrAudioChannels == 1 && - channels > 2) - ? 2 - : channelNr; + int channelNrFixed = + (displayNrAudioChannels == 1 && channels > 2) + ? 2 + : channelNr; if (vertical) paintVMeter(painter, channelNr * 4, 8, 3, height - 10, - displayMagnitude[channelNrFixed], - displayPeak[channelNrFixed], - displayPeakHold[channelNrFixed]); + displayMagnitude[channelNrFixed], + displayPeak[channelNrFixed], + displayPeakHold[channelNrFixed]); else paintHMeter(painter, 5, channelNr * 4, width - 5, 3, - displayMagnitude[channelNrFixed], - displayPeak[channelNrFixed], - displayPeakHold[channelNrFixed]); + displayMagnitude[channelNrFixed], + displayPeak[channelNrFixed], + displayPeakHold[channelNrFixed]); if (idle) continue; @@ -1071,7 +1091,7 @@ volumeMeters.removeOne(meter); } -void VolumeMeterTimer::timerEvent(QTimerEvent*) +void VolumeMeterTimer::timerEvent(QTimerEvent *) { for (VolumeMeter *meter : volumeMeters) meter->update();
View file
obs-studio-23.2.1.tar.xz/UI/volume-control.hpp -> obs-studio-24.0.0.tar.xz/UI/volume-control.hpp
Changed
@@ -11,74 +11,55 @@ class QPushButton; class VolumeMeterTimer; -class VolumeMeter : public QWidget -{ +class VolumeMeter : public QWidget { Q_OBJECT - Q_PROPERTY(QColor backgroundNominalColor - READ getBackgroundNominalColor - WRITE setBackgroundNominalColor DESIGNABLE true) - Q_PROPERTY(QColor backgroundWarningColor - READ getBackgroundWarningColor - WRITE setBackgroundWarningColor DESIGNABLE true) - Q_PROPERTY(QColor backgroundErrorColor - READ getBackgroundErrorColor - WRITE setBackgroundErrorColor DESIGNABLE true) - Q_PROPERTY(QColor foregroundNominalColor - READ getForegroundNominalColor - WRITE setForegroundNominalColor DESIGNABLE true) - Q_PROPERTY(QColor foregroundWarningColor - READ getForegroundWarningColor - WRITE setForegroundWarningColor DESIGNABLE true) - Q_PROPERTY(QColor foregroundErrorColor - READ getForegroundErrorColor - WRITE setForegroundErrorColor DESIGNABLE true) - Q_PROPERTY(QColor clipColor - READ getClipColor - WRITE setClipColor DESIGNABLE true) - Q_PROPERTY(QColor magnitudeColor - READ getMagnitudeColor - WRITE setMagnitudeColor DESIGNABLE true) - Q_PROPERTY(QColor majorTickColor - READ getMajorTickColor - WRITE setMajorTickColor DESIGNABLE true) - Q_PROPERTY(QColor minorTickColor - READ getMinorTickColor - WRITE setMinorTickColor DESIGNABLE true) + Q_PROPERTY(QColor backgroundNominalColor READ getBackgroundNominalColor + WRITE setBackgroundNominalColor DESIGNABLE true) + Q_PROPERTY(QColor backgroundWarningColor READ getBackgroundWarningColor + WRITE setBackgroundWarningColor DESIGNABLE true) + Q_PROPERTY(QColor backgroundErrorColor READ getBackgroundErrorColor + WRITE setBackgroundErrorColor DESIGNABLE true) + Q_PROPERTY(QColor foregroundNominalColor READ getForegroundNominalColor + WRITE setForegroundNominalColor DESIGNABLE true) + Q_PROPERTY(QColor foregroundWarningColor READ getForegroundWarningColor + WRITE setForegroundWarningColor DESIGNABLE true) + Q_PROPERTY(QColor foregroundErrorColor READ getForegroundErrorColor + WRITE setForegroundErrorColor DESIGNABLE true) + Q_PROPERTY(QColor clipColor READ getClipColor WRITE setClipColor + DESIGNABLE true) + Q_PROPERTY(QColor magnitudeColor READ getMagnitudeColor WRITE + setMagnitudeColor DESIGNABLE true) + Q_PROPERTY(QColor majorTickColor READ getMajorTickColor WRITE + setMajorTickColor DESIGNABLE true) + Q_PROPERTY(QColor minorTickColor READ getMinorTickColor WRITE + setMinorTickColor DESIGNABLE true) // Levels are denoted in dBFS. - Q_PROPERTY(qreal minimumLevel - READ getMinimumLevel - WRITE setMinimumLevel DESIGNABLE true) - Q_PROPERTY(qreal warningLevel - READ getWarningLevel - WRITE setWarningLevel DESIGNABLE true) - Q_PROPERTY(qreal errorLevel - READ getErrorLevel - WRITE setErrorLevel DESIGNABLE true) - Q_PROPERTY(qreal clipLevel - READ getClipLevel - WRITE setClipLevel DESIGNABLE true) - Q_PROPERTY(qreal minimumInputLevel - READ getMinimumInputLevel - WRITE setMinimumInputLevel DESIGNABLE true) + Q_PROPERTY(qreal minimumLevel READ getMinimumLevel WRITE setMinimumLevel + DESIGNABLE true) + Q_PROPERTY(qreal warningLevel READ getWarningLevel WRITE setWarningLevel + DESIGNABLE true) + Q_PROPERTY(qreal errorLevel READ getErrorLevel WRITE setErrorLevel + DESIGNABLE true) + Q_PROPERTY(qreal clipLevel READ getClipLevel WRITE setClipLevel + DESIGNABLE true) + Q_PROPERTY(qreal minimumInputLevel READ getMinimumInputLevel WRITE + setMinimumInputLevel DESIGNABLE true) // Rates are denoted in dB/second. - Q_PROPERTY(qreal peakDecayRate - READ getPeakDecayRate - WRITE setPeakDecayRate DESIGNABLE true) + Q_PROPERTY(qreal peakDecayRate READ getPeakDecayRate WRITE + setPeakDecayRate DESIGNABLE true) // Time in seconds for the VU meter to integrate over. - Q_PROPERTY(qreal magnitudeIntegrationTime - READ getMagnitudeIntegrationTime - WRITE setMagnitudeIntegrationTime DESIGNABLE true) + Q_PROPERTY( + qreal magnitudeIntegrationTime READ getMagnitudeIntegrationTime + WRITE setMagnitudeIntegrationTime DESIGNABLE true) // Duration is denoted in seconds. - Q_PROPERTY(qreal peakHoldDuration - READ getPeakHoldDuration - WRITE setPeakHoldDuration DESIGNABLE true) - Q_PROPERTY(qreal inputPeakHoldDuration - READ getInputPeakHoldDuration - WRITE setInputPeakHoldDuration DESIGNABLE true) + Q_PROPERTY(qreal peakHoldDuration READ getPeakHoldDuration WRITE + setPeakHoldDuration DESIGNABLE true) + Q_PROPERTY(qreal inputPeakHoldDuration READ getInputPeakHoldDuration + WRITE setInputPeakHoldDuration DESIGNABLE true) private slots: void ClipEnding(); @@ -92,18 +73,18 @@ inline void handleChannelCofigurationChange(); inline bool detectIdle(uint64_t ts); inline void calculateBallistics(uint64_t ts, - qreal timeSinceLastRedraw=0.0); - inline void calculateBallisticsForChannel(int channelNr, - uint64_t ts, qreal timeSinceLastRedraw); + qreal timeSinceLastRedraw = 0.0); + inline void calculateBallisticsForChannel(int channelNr, uint64_t ts, + qreal timeSinceLastRedraw); void paintInputMeter(QPainter &painter, int x, int y, int width, - int height, float peakHold); + int height, float peakHold); void paintHMeter(QPainter &painter, int x, int y, int width, int height, - float magnitude, float peak, float peakHold); + float magnitude, float peak, float peakHold); void paintHTicks(QPainter &painter, int x, int y, int width, - int height); + int height); void paintVMeter(QPainter &painter, int x, int y, int width, int height, - float magnitude, float peak, float peakHold); + float magnitude, float peak, float peakHold); void paintVTicks(QPainter &painter, int x, int y, int height); QMutex dataMutex; @@ -150,14 +131,13 @@ public: explicit VolumeMeter(QWidget *parent = nullptr, - obs_volmeter_t *obs_volmeter = nullptr, - bool vertical = false); + obs_volmeter_t *obs_volmeter = nullptr, + bool vertical = false); ~VolumeMeter(); - void setLevels( - const float magnitude[MAX_AUDIO_CHANNELS], - const float peak[MAX_AUDIO_CHANNELS], - const float inputPeak[MAX_AUDIO_CHANNELS]); + void setLevels(const float magnitude[MAX_AUDIO_CHANNELS], + const float peak[MAX_AUDIO_CHANNELS], + const float inputPeak[MAX_AUDIO_CHANNELS]); QColor getBackgroundNominalColor() const; void setBackgroundNominalColor(QColor c); @@ -216,7 +196,7 @@ protected: void timerEvent(QTimerEvent *event) override; - QList<VolumeMeter*> volumeMeters; + QList<VolumeMeter *> volumeMeters; }; class QLabel; @@ -228,23 +208,23 @@ private: OBSSource source; - QLabel *nameLabel; - QLabel *volLabel; - VolumeMeter *volMeter; - QSlider *slider; - MuteCheckBox *mute; - QPushButton *config = nullptr; - float levelTotal; - float levelCount; - obs_fader_t *obs_fader; - obs_volmeter_t *obs_volmeter; - bool vertical; + QLabel *nameLabel; + QLabel *volLabel; + VolumeMeter *volMeter; + QSlider *slider; + MuteCheckBox *mute; + QPushButton *config = nullptr; + float levelTotal; + float levelCount; + obs_fader_t *obs_fader; + obs_volmeter_t *obs_volmeter; + bool vertical; static void OBSVolumeChanged(void *param, float db); static void OBSVolumeLevel(void *data, - const float magnitude[MAX_AUDIO_CHANNELS], - const float peak[MAX_AUDIO_CHANNELS], - const float inputPeak[MAX_AUDIO_CHANNELS]); + const float magnitude[MAX_AUDIO_CHANNELS], + const float peak[MAX_AUDIO_CHANNELS], + const float inputPeak[MAX_AUDIO_CHANNELS]); static void OBSVolumeMuted(void *data, calldata_t *calldata); void EmitConfigClicked(); @@ -262,10 +242,10 @@ public: explicit VolControl(OBSSource source, bool showConfig = false, - bool vertical = false); + bool vertical = false); ~VolControl(); - inline obs_source_t *GetSource() const {return source;} + inline obs_source_t *GetSource() const { return source; } QString GetName() const; void SetName(const QString &newName);
View file
obs-studio-23.2.1.tar.xz/UI/win-update/update-window.cpp -> obs-studio-24.0.0.tar.xz/UI/win-update/update-window.cpp
Changed
@@ -2,10 +2,9 @@ #include "obs-app.hpp" OBSUpdate::OBSUpdate(QWidget *parent, bool manualUpdate, const QString &text) - : QDialog (parent, Qt::WindowSystemMenuHint | - Qt::WindowTitleHint | - Qt::WindowCloseButtonHint), - ui (new Ui_OBSUpdate) + : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | + Qt::WindowCloseButtonHint), + ui(new Ui_OBSUpdate) { ui->setupUi(this); ui->text->setHtml(text);
View file
obs-studio-23.2.1.tar.xz/UI/win-update/update-window.hpp -> obs-studio-24.0.0.tar.xz/UI/win-update/update-window.hpp
Changed
@@ -9,11 +9,7 @@ Q_OBJECT public: - enum ReturnVal { - No, - Yes, - Skip - }; + enum ReturnVal { No, Yes, Skip }; OBSUpdate(QWidget *parent, bool manualUpdate, const QString &text);
View file
obs-studio-23.2.1.tar.xz/UI/win-update/updater/hash.cpp -> obs-studio-24.0.0.tar.xz/UI/win-update/updater/hash.cpp
Changed
@@ -26,7 +26,7 @@ const wchar_t alphabet[] = L"0123456789abcdef"; for (int i = 0; i != BLAKE2_HASH_LENGTH; ++i) { - out[2 * i] = alphabet[in[i] / 16]; + out[2 * i] = alphabet[in[i] / 16]; out[2 * i + 1] = alphabet[in[i] % 16]; } @@ -35,7 +35,7 @@ void StringToHash(const wchar_t *in, BYTE *out) { - int temp; + unsigned int temp; for (int i = 0; i < BLAKE2_HASH_LENGTH; i++) { swscanf_s(in + i * 2, L"%02x", &temp); @@ -50,7 +50,7 @@ return false; WinHandle handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, - nullptr, OPEN_EXISTING, 0, nullptr); + nullptr, OPEN_EXISTING, 0, nullptr); if (handle == INVALID_HANDLE_VALUE) return false; @@ -60,7 +60,7 @@ for (;;) { DWORD read = 0; if (!ReadFile(handle, buf.data(), (DWORD)buf.size(), &read, - nullptr)) + nullptr)) return false; if (!read)
View file
obs-studio-23.2.1.tar.xz/UI/win-update/updater/http.cpp -> obs-studio-24.0.0.tar.xz/UI/win-update/updater/http.cpp
Changed
@@ -20,7 +20,7 @@ using namespace std; -#define MAX_BUF_SIZE 262144 +#define MAX_BUF_SIZE 262144 #define READ_BUF_SIZE 32768 /* ------------------------------------------------------------------------ */ @@ -36,8 +36,8 @@ inflateEnd(&strm); } - inline operator z_stream*() {return &strm;} - inline z_stream *operator->() {return &strm;} + inline operator z_stream *() { return &strm; } + inline z_stream *operator->() { return &strm; } inline bool inflate() { @@ -50,14 +50,15 @@ /* ------------------------------------------------------------------------ */ static bool ReadZippedHTTPData(string &responseBuf, z_stream *strm, - string &zipBuf, const uint8_t *buffer, DWORD outSize) + string &zipBuf, const uint8_t *buffer, + DWORD outSize) { strm->avail_in = outSize; - strm->next_in = buffer; + strm->next_in = buffer; do { strm->avail_out = (uInt)zipBuf.size(); - strm->next_out = (Bytef *)zipBuf.data(); + strm->next_out = (Bytef *)zipBuf.data(); int zret = inflate(strm, Z_NO_FLUSH); if (zret != Z_STREAM_END && zret != Z_OK) @@ -65,7 +66,7 @@ try { responseBuf.append(zipBuf.data(), - zipBuf.size() - strm->avail_out); + zipBuf.size() - strm->avail_out); } catch (...) { return false; } @@ -75,7 +76,7 @@ } static bool ReadHTTPData(string &responseBuf, const uint8_t *buffer, - DWORD outSize) + DWORD outSize) { try { responseBuf.append((const char *)buffer, outSize); @@ -85,19 +86,16 @@ return true; } -bool HTTPPostData(const wchar_t *url, - const BYTE * data, - int dataLen, - const wchar_t *extraHeaders, - int * responseCode, - string & responseBuf) +bool HTTPPostData(const wchar_t *url, const BYTE *data, int dataLen, + const wchar_t *extraHeaders, int *responseCode, + string &responseBuf) { - HttpHandle hSession; - HttpHandle hConnect; - HttpHandle hRequest; - string zipBuf; + HttpHandle hSession; + HttpHandle hConnect; + HttpHandle hRequest; + string zipBuf; URL_COMPONENTS urlComponents = {}; - bool secure = false; + bool secure = false; wchar_t hostName[256]; wchar_t path[1024]; @@ -113,10 +111,10 @@ urlComponents.dwStructSize = sizeof(urlComponents); - urlComponents.lpszHostName = hostName; + urlComponents.lpszHostName = hostName; urlComponents.dwHostNameLength = _countof(hostName); - urlComponents.lpszUrlPath = path; + urlComponents.lpszUrlPath = path; urlComponents.dwUrlPathLength = _countof(path); WinHttpCrackUrl(url, 0, 0, &urlComponents); @@ -128,22 +126,21 @@ * connect to server */ hSession = WinHttpOpen(L"OBS Studio Updater/2.1", - WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, - WINHTTP_NO_PROXY_NAME, - WINHTTP_NO_PROXY_BYPASS, - 0); + WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, + 0); if (!hSession) { *responseCode = -1; return false; } WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, - (LPVOID)&tlsProtocols, sizeof(tlsProtocols)); + (LPVOID)&tlsProtocols, sizeof(tlsProtocols)); hConnect = WinHttpConnect(hSession, hostName, - secure - ? INTERNET_DEFAULT_HTTPS_PORT - : INTERNET_DEFAULT_HTTP_PORT, 0); + secure ? INTERNET_DEFAULT_HTTPS_PORT + : INTERNET_DEFAULT_HTTP_PORT, + 0); if (!hConnect) { *responseCode = -2; return false; @@ -152,24 +149,19 @@ /* -------------------------------------- * * request data */ - hRequest = WinHttpOpenRequest(hConnect, - L"POST", - path, - nullptr, - WINHTTP_NO_REFERER, - acceptTypes, - secure - ? WINHTTP_FLAG_SECURE | - WINHTTP_FLAG_REFRESH - : WINHTTP_FLAG_REFRESH); + hRequest = WinHttpOpenRequest(hConnect, L"POST", path, nullptr, + WINHTTP_NO_REFERER, acceptTypes, + secure ? WINHTTP_FLAG_SECURE | + WINHTTP_FLAG_REFRESH + : WINHTTP_FLAG_REFRESH); if (!hRequest) { *responseCode = -3; return false; } bool bResults = !!WinHttpSendRequest(hRequest, extraHeaders, - extraHeaders ? -1 : 0, - (void *)data, dataLen, dataLen, 0); + extraHeaders ? -1 : 0, + (void *)data, dataLen, dataLen, 0); /* -------------------------------------- * * end request */ @@ -185,18 +177,15 @@ * get headers */ wchar_t encoding[64]; - DWORD encodingLen; + DWORD encodingLen; wchar_t statusCode[8]; - DWORD statusCodeLen; + DWORD statusCodeLen; statusCodeLen = sizeof(statusCode); - if (!WinHttpQueryHeaders(hRequest, - WINHTTP_QUERY_STATUS_CODE, - WINHTTP_HEADER_NAME_BY_INDEX, - &statusCode, - &statusCodeLen, - WINHTTP_NO_HEADER_INDEX)) { + if (!WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_STATUS_CODE, + WINHTTP_HEADER_NAME_BY_INDEX, &statusCode, + &statusCodeLen, WINHTTP_NO_HEADER_INDEX)) { *responseCode = -4; return false; } else { @@ -204,12 +193,9 @@ } encodingLen = sizeof(encoding); - if (!WinHttpQueryHeaders(hRequest, - WINHTTP_QUERY_CONTENT_ENCODING, - WINHTTP_HEADER_NAME_BY_INDEX, - encoding, - &encodingLen, - WINHTTP_NO_HEADER_INDEX)) { + if (!WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_CONTENT_ENCODING, + WINHTTP_HEADER_NAME_BY_INDEX, encoding, + &encodingLen, WINHTTP_NO_HEADER_INDEX)) { encoding[0] = 0; if (GetLastError() != ERROR_WINHTTP_HEADER_NOT_FOUND) { *responseCode = -5; @@ -238,11 +224,11 @@ bool gzip = wcscmp(encoding, L"gzip") == 0; if (gzip) { - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; - strm->opaque = Z_NULL; + strm->zalloc = Z_NULL; + strm->zfree = Z_NULL; + strm->opaque = Z_NULL; strm->avail_in = 0; - strm->next_in = Z_NULL; + strm->next_in = Z_NULL; if (!strm.inflate()) return false; @@ -278,7 +264,7 @@ dwSize = std::min(dwSize, (DWORD)sizeof(buffer)); if (!WinHttpReadData(hRequest, (void *)buffer, dwSize, - &outSize)) { + &outSize)) { *responseCode = -9; return false; } @@ -311,25 +297,23 @@ /* ------------------------------------------------------------------------ */ static bool ReadHTTPZippedFile(z_stream *strm, HANDLE updateFile, - string &zipBuf, const uint8_t *buffer, DWORD outSize, - int *responseCode) + string &zipBuf, const uint8_t *buffer, + DWORD outSize, int *responseCode) { strm->avail_in = outSize; - strm->next_in = buffer; + strm->next_in = buffer; do { strm->avail_out = (uInt)zipBuf.size(); - strm->next_out = (Bytef *)zipBuf.data(); + strm->next_out = (Bytef *)zipBuf.data(); int zret = inflate(strm, Z_NO_FLUSH); if (zret != Z_STREAM_END && zret != Z_OK) return false; DWORD written; - if (!WriteFile(updateFile, - zipBuf.data(), - MAX_BUF_SIZE - strm->avail_out, - &written, + if (!WriteFile(updateFile, zipBuf.data(), + MAX_BUF_SIZE - strm->avail_out, &written, nullptr)) { *responseCode = -10; return false; @@ -346,7 +330,7 @@ } static bool ReadHTTPFile(HANDLE updateFile, const uint8_t *buffer, - DWORD outSize, int *responseCode) + DWORD outSize, int *responseCode) { DWORD written; if (!WriteFile(updateFile, buffer, outSize, &written, nullptr)) { @@ -363,20 +347,18 @@ return true; } -bool HTTPGetFile(HINTERNET hConnect, - const wchar_t *url, - const wchar_t *outputPath, - const wchar_t *extraHeaders, - int * responseCode) +bool HTTPGetFile(HINTERNET hConnect, const wchar_t *url, + const wchar_t *outputPath, const wchar_t *extraHeaders, + int *responseCode) { HttpHandle hRequest; const wchar_t *acceptTypes[] = {L"*/*", nullptr}; URL_COMPONENTS urlComponents = {}; - bool secure = false; + bool secure = false; - string zipBuf; + string zipBuf; wchar_t hostName[256]; wchar_t path[1024]; @@ -385,10 +367,10 @@ urlComponents.dwStructSize = sizeof(urlComponents); - urlComponents.lpszHostName = hostName; + urlComponents.lpszHostName = hostName; urlComponents.dwHostNameLength = _countof(hostName); - urlComponents.lpszUrlPath = path; + urlComponents.lpszUrlPath = path; urlComponents.dwUrlPathLength = _countof(path); WinHttpCrackUrl(url, 0, 0, &urlComponents); @@ -399,23 +381,19 @@ /* -------------------------------------- * * request data */ - hRequest = WinHttpOpenRequest(hConnect, - L"GET", - path, - nullptr, - WINHTTP_NO_REFERER, - acceptTypes, - secure - ? WINHTTP_FLAG_SECURE | - WINHTTP_FLAG_REFRESH - : WINHTTP_FLAG_REFRESH); + hRequest = WinHttpOpenRequest(hConnect, L"GET", path, nullptr, + WINHTTP_NO_REFERER, acceptTypes, + secure ? WINHTTP_FLAG_SECURE | + WINHTTP_FLAG_REFRESH + : WINHTTP_FLAG_REFRESH); if (!hRequest) { *responseCode = -3; return false; } bool bResults = !!WinHttpSendRequest(hRequest, extraHeaders, - extraHeaders ? -1 : 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0); + extraHeaders ? -1 : 0, + WINHTTP_NO_REQUEST_DATA, 0, 0, 0); /* -------------------------------------- * * end request */ @@ -431,18 +409,15 @@ * get headers */ wchar_t encoding[64]; - DWORD encodingLen; + DWORD encodingLen; wchar_t statusCode[8]; - DWORD statusCodeLen; + DWORD statusCodeLen; statusCodeLen = sizeof(statusCode); - if (!WinHttpQueryHeaders(hRequest, - WINHTTP_QUERY_STATUS_CODE, - WINHTTP_HEADER_NAME_BY_INDEX, - &statusCode, - &statusCodeLen, - WINHTTP_NO_HEADER_INDEX)) { + if (!WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_STATUS_CODE, + WINHTTP_HEADER_NAME_BY_INDEX, &statusCode, + &statusCodeLen, WINHTTP_NO_HEADER_INDEX)) { *responseCode = -4; return false; } else { @@ -450,12 +425,9 @@ } encodingLen = sizeof(encoding); - if (!WinHttpQueryHeaders(hRequest, - WINHTTP_QUERY_CONTENT_ENCODING, - WINHTTP_HEADER_NAME_BY_INDEX, - encoding, - &encodingLen, - WINHTTP_NO_HEADER_INDEX)) { + if (!WinHttpQueryHeaders(hRequest, WINHTTP_QUERY_CONTENT_ENCODING, + WINHTTP_HEADER_NAME_BY_INDEX, encoding, + &encodingLen, WINHTTP_NO_HEADER_INDEX)) { encoding[0] = 0; if (GetLastError() != ERROR_WINHTTP_HEADER_NOT_FOUND) { *responseCode = -5; @@ -472,11 +444,11 @@ bool gzip = wcscmp(encoding, L"gzip") == 0; if (gzip) { - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; - strm->opaque = Z_NULL; + strm->zalloc = Z_NULL; + strm->zfree = Z_NULL; + strm->opaque = Z_NULL; strm->avail_in = 0; - strm->next_in = Z_NULL; + strm->next_in = Z_NULL; if (!strm.inflate()) return false; @@ -498,12 +470,12 @@ if (!bResults || *responseCode != 200) return true; - BYTE buffer[READ_BUF_SIZE]; + BYTE buffer[READ_BUF_SIZE]; DWORD dwSize, outSize; - int lastPosition = 0; + int lastPosition = 0; - WinHandle updateFile = CreateFile(outputPath, GENERIC_WRITE, 0, - nullptr, CREATE_ALWAYS, 0, nullptr); + WinHandle updateFile = CreateFile(outputPath, GENERIC_WRITE, 0, nullptr, + CREATE_ALWAYS, 0, nullptr); if (!updateFile.Valid()) { *responseCode = -7; return false; @@ -520,7 +492,7 @@ dwSize = std::min(dwSize, (DWORD)sizeof(buffer)); if (!WinHttpReadData(hRequest, (void *)buffer, dwSize, - &outSize)) { + &outSize)) { *responseCode = -9; return false; } else { @@ -529,21 +501,22 @@ if (gzip) { if (!ReadHTTPZippedFile(strm, updateFile, - zipBuf, buffer, - outSize, responseCode)) + zipBuf, buffer, outSize, + responseCode)) return false; } else { - if (!ReadHTTPFile(updateFile, buffer, - outSize, responseCode)) + if (!ReadHTTPFile(updateFile, buffer, outSize, + responseCode)) return false; } int position = (int)(((float)completedFileSize / - (float)totalFileSize) * 100.0f); + (float)totalFileSize) * + 100.0f); if (position > lastPosition) { lastPosition = position; SendDlgItemMessage(hwndMain, IDC_PROGRESS, - PBM_SETPOS, position, 0); + PBM_SETPOS, position, 0); } }
View file
obs-studio-23.2.1.tar.xz/UI/win-update/updater/patch.cpp -> obs-studio-24.0.0.tar.xz/UI/win-update/updater/patch.cpp
Changed
@@ -20,16 +20,16 @@ #include <vector> #ifdef _MSC_VER -# define restrict __restrict -# include <lzma.h> -# undef restrict +#define restrict __restrict +#include <lzma.h> +#undef restrict #else -# include <lzma.h> +#include <lzma.h> #endif using namespace std; -#define MAX_BUF_SIZE 262144 +#define MAX_BUF_SIZE 262144 #define READ_BUF_SIZE 32768 /* ------------------------------------------------------------------------ */ @@ -48,10 +48,7 @@ inline bool init_decoder() { - lzma_ret ret = lzma_stream_decoder( - &strm, - 200 * 1024 * 1024, - 0); + lzma_ret ret = lzma_stream_decoder(&strm, 200 * 1024 * 1024, 0); initialized = (ret == LZMA_OK); return initialized; } @@ -82,7 +79,7 @@ struct bspatch_stream { void *opaque; int (*read)(const struct bspatch_stream *stream, void *buffer, - int length); + int length); }; /* ------------------------------------------------------------------------ */ @@ -116,7 +113,7 @@ /* ------------------------------------------------------------------------ */ static int bspatch(const uint8_t *old, int64_t oldsize, uint8_t *newp, - int64_t newsize, struct bspatch_stream *stream) + int64_t newsize, struct bspatch_stream *stream) { uint8_t buf[8]; int64_t oldpos, newpos; @@ -169,9 +166,9 @@ /* ------------------------------------------------------------------------ */ struct patch_data { - HANDLE h; - lzma_stream *strm; - uint8_t buf[READ_BUF_SIZE]; + HANDLE h; + lzma_stream *strm; + uint8_t buf[READ_BUF_SIZE]; }; static int read_lzma(const struct bspatch_stream *stream, void *buffer, int len) @@ -179,24 +176,24 @@ if (!len) return 0; - patch_data *data = (patch_data*)stream->opaque; - HANDLE h = data->h; - lzma_stream *strm = data->strm; + patch_data *data = (patch_data *)stream->opaque; + HANDLE h = data->h; + lzma_stream *strm = data->strm; strm->avail_out = (size_t)len; - strm->next_out = (uint8_t *)buffer; + strm->next_out = (uint8_t *)buffer; for (;;) { if (strm->avail_in == 0) { DWORD read_size; if (!ReadFile(h, data->buf, READ_BUF_SIZE, &read_size, - nullptr)) + nullptr)) return -1; if (read_size == 0) return -1; strm->avail_in = (size_t)read_size; - strm->next_in = data->buf; + strm->next_in = data->buf; } lzma_ret ret = lzma_code(strm, LZMA_RUN); @@ -213,25 +210,25 @@ int ApplyPatch(const wchar_t *patchFile, const wchar_t *targetFile) try { - uint8_t header[24]; - int64_t newsize; + uint8_t header[24]; + int64_t newsize; struct bspatch_stream stream; - bool success; + bool success; - WinHandle hPatch; - WinHandle hTarget; + WinHandle hPatch; + WinHandle hTarget; LZMAStream strm; /* --------------------------------- * * open patch and file to patch */ - hPatch = CreateFile(patchFile, GENERIC_READ, 0, nullptr, - OPEN_EXISTING, 0, nullptr); + hPatch = CreateFile(patchFile, GENERIC_READ, 0, nullptr, OPEN_EXISTING, + 0, nullptr); if (!hPatch.Valid()) throw int(GetLastError()); hTarget = CreateFile(targetFile, GENERIC_READ, 0, nullptr, - OPEN_EXISTING, 0, nullptr); + OPEN_EXISTING, 0, nullptr); if (!hTarget.Valid()) throw int(GetLastError()); @@ -289,14 +286,14 @@ throw int(-10); patch_data data; - data.h = hPatch; + data.h = hPatch; data.strm = strm.get(); - stream.read = read_lzma; + stream.read = read_lzma; stream.opaque = &data; int ret = bspatch(oldData.data(), oldData.size(), newData.data(), - newData.size(), &stream); + newData.size(), &stream); if (ret != 0) throw int(-9); @@ -305,14 +302,14 @@ hTarget = nullptr; hTarget = CreateFile(targetFile, GENERIC_WRITE, 0, nullptr, - CREATE_ALWAYS, 0, nullptr); + CREATE_ALWAYS, 0, nullptr); if (!hTarget.Valid()) throw int(GetLastError()); DWORD written; - success = !!WriteFile(hTarget, newData.data(), (DWORD)newsize, - &written, nullptr); + success = !!WriteFile(hTarget, newData.data(), (DWORD)newsize, &written, + nullptr); if (!success || written != newsize) throw int(GetLastError());
View file
obs-studio-23.2.1.tar.xz/UI/win-update/updater/resource.h -> obs-studio-24.0.0.tar.xz/UI/win-update/updater/resource.h
Changed
@@ -2,20 +2,20 @@ // Microsoft Visual C++ generated include file. // Used by updater.rc // -#define IDD_UPDATEDIALOG 101 -#define IDI_ICON1 103 -#define IDC_PROGRESS 1001 -#define IDC_STATUS 1002 -#define IDCBUTTON 1004 -#define IDC_BUTTON 1004 +#define IDD_UPDATEDIALOG 101 +#define IDI_ICON1 103 +#define IDC_PROGRESS 1001 +#define IDC_STATUS 1002 +#define IDCBUTTON 1004 +#define IDC_BUTTON 1004 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 104 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1005 -#define _APS_NEXT_SYMED_VALUE 101 +#define _APS_NEXT_RESOURCE_VALUE 104 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1005 +#define _APS_NEXT_SYMED_VALUE 101 #endif #endif
View file
obs-studio-23.2.1.tar.xz/UI/win-update/updater/updater.cpp -> obs-studio-24.0.0.tar.xz/UI/win-update/updater/updater.cpp
Changed
@@ -29,21 +29,21 @@ /* ----------------------------------------------------------------------- */ -HANDLE cancelRequested = nullptr; -HANDLE updateThread = nullptr; -HINSTANCE hinstMain = nullptr; -HWND hwndMain = nullptr; -HCRYPTPROV hProvider = 0; +HANDLE cancelRequested = nullptr; +HANDLE updateThread = nullptr; +HINSTANCE hinstMain = nullptr; +HWND hwndMain = nullptr; +HCRYPTPROV hProvider = 0; -static bool bExiting = false; +static bool bExiting = false; static bool updateFailed = false; -static bool is32bit = false; +static bool is32bit = false; static bool downloadThreadFailure = false; -int totalFileSize = 0; +int totalFileSize = 0; int completedFileSize = 0; -static int completedUpdates = 0; +static int completedUpdates = 0; struct LastError { DWORD code; @@ -65,9 +65,8 @@ wchar_t path[MAX_PATH]; WIN32_FIND_DATAW wfd; HANDLE handle; - int folder = (is32bit && is_64bit_windows()) - ? CSIDL_SYSTEMX86 - : CSIDL_SYSTEM; + int folder = (is32bit && is_64bit_windows()) ? CSIDL_SYSTEMX86 + : CSIDL_SYSTEM; SHGetFolderPathW(NULL, folder, NULL, SHGFP_TYPE_CURRENT, base); @@ -97,7 +96,8 @@ PVOID old = nullptr; bool redirect = !!Wow64DisableWow64FsRedirection(&old); bool success = HasVS2017Redist2(); - if (redirect) Wow64RevertWow64FsRedirection(old); + if (redirect) + Wow64RevertWow64FsRedirection(old); return success; } @@ -135,16 +135,16 @@ WinHandle hDest; hSrc = CreateFile(src, GENERIC_READ, 0, nullptr, OPEN_EXISTING, - FILE_FLAG_SEQUENTIAL_SCAN, nullptr); + FILE_FLAG_SEQUENTIAL_SCAN, nullptr); if (!hSrc.Valid()) throw LastError(); - hDest = CreateFile(dest, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, - 0, nullptr); + hDest = CreateFile(dest, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, + nullptr); if (!hDest.Valid()) throw LastError(); - BYTE buf[65536]; + BYTE buf[65536]; DWORD read, wrote; for (;;) { @@ -182,10 +182,7 @@ return false; while (*p) { - if (!isalnum(*p) && - *p != '.' && - *p != '/' && - *p != '_' && + if (!isalnum(*p) && *p != '.' && *p != '/' && *p != '_' && *p != '-') return false; p++; @@ -199,7 +196,7 @@ string data; WinHandle handle = CreateFileW(path, GENERIC_READ, 0, nullptr, - OPEN_EXISTING, 0, nullptr); + OPEN_EXISTING, 0, nullptr); if (!handle.Valid()) { return string(); } @@ -213,11 +210,7 @@ data.resize((size_t)size.QuadPart); DWORD read; - if (!ReadFile(handle, - &data[0], - (DWORD)data.size(), - &read, - nullptr)) { + if (!ReadFile(handle, &data[0], (DWORD)data.size(), &read, nullptr)) { return string(); } if (read != size.QuadPart) { @@ -244,28 +237,28 @@ wstring tempPath; wstring previousFile; wstring basename; - string packageName; + string packageName; - DWORD fileSize = 0; - BYTE hash[BLAKE2_HASH_LENGTH]; - BYTE downloadhash[BLAKE2_HASH_LENGTH]; - BYTE my_hash[BLAKE2_HASH_LENGTH]; - state_t state = STATE_INVALID; - bool has_hash = false; - bool patchable = false; + DWORD fileSize = 0; + BYTE hash[BLAKE2_HASH_LENGTH]; + BYTE downloadhash[BLAKE2_HASH_LENGTH]; + BYTE my_hash[BLAKE2_HASH_LENGTH]; + state_t state = STATE_INVALID; + bool has_hash = false; + bool patchable = false; inline update_t() {} inline update_t(const update_t &from) - : sourceURL(from.sourceURL), - outputPath(from.outputPath), - tempPath(from.tempPath), - previousFile(from.previousFile), - basename(from.basename), - packageName(from.packageName), - fileSize(from.fileSize), - state(from.state), - has_hash(from.has_hash), - patchable(from.patchable) + : sourceURL(from.sourceURL), + outputPath(from.outputPath), + tempPath(from.tempPath), + previousFile(from.previousFile), + basename(from.basename), + packageName(from.packageName), + fileSize(from.fileSize), + state(from.state), + has_hash(from.has_hash), + patchable(from.patchable) { memcpy(hash, from.hash, sizeof(hash)); memcpy(downloadhash, from.downloadhash, sizeof(downloadhash)); @@ -273,16 +266,16 @@ } inline update_t(update_t &&from) - : sourceURL(std::move(from.sourceURL)), - outputPath(std::move(from.outputPath)), - tempPath(std::move(from.tempPath)), - previousFile(std::move(from.previousFile)), - basename(std::move(from.basename)), - packageName(std::move(from.packageName)), - fileSize(from.fileSize), - state(from.state), - has_hash(from.has_hash), - patchable(from.patchable) + : sourceURL(std::move(from.sourceURL)), + outputPath(std::move(from.outputPath)), + tempPath(std::move(from.tempPath)), + previousFile(std::move(from.previousFile)), + basename(std::move(from.basename)), + packageName(std::move(from.packageName)), + fileSize(from.fileSize), + state(from.state), + has_hash(from.has_hash), + patchable(from.patchable) { from.state = STATE_INVALID; @@ -293,12 +286,11 @@ void CleanPartialUpdate() { - if (state == STATE_INSTALL_FAILED || - state == STATE_INSTALLED) { + if (state == STATE_INSTALL_FAILED || state == STATE_INSTALLED) { if (!previousFile.empty()) { DeleteFile(outputPath.c_str()); MyCopyFile(previousFile.c_str(), - outputPath.c_str()); + outputPath.c_str()); DeleteFile(previousFile.c_str()); } else { DeleteFile(outputPath.c_str()); @@ -310,16 +302,16 @@ inline update_t &operator=(const update_t &from) { - sourceURL = from.sourceURL; - outputPath = from.outputPath; - tempPath = from.tempPath; - previousFile = from.previousFile; - basename = from.basename; - packageName = from.packageName; - fileSize = from.fileSize; - state = from.state; - has_hash = from.has_hash; - patchable = from.patchable; + sourceURL = from.sourceURL; + outputPath = from.outputPath; + tempPath = from.tempPath; + previousFile = from.previousFile; + basename = from.basename; + packageName = from.packageName; + fileSize = from.fileSize; + state = from.state; + has_hash = from.has_hash; + patchable = from.patchable; memcpy(hash, from.hash, sizeof(hash)); memcpy(downloadhash, from.downloadhash, sizeof(downloadhash)); @@ -345,10 +337,9 @@ const DWORD tlsProtocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2; HttpHandle hSession = WinHttpOpen(L"OBS Studio Updater/2.1", - WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, - WINHTTP_NO_PROXY_NAME, - WINHTTP_NO_PROXY_BYPASS, - 0); + WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, + WINHTTP_NO_PROXY_BYPASS, 0); if (!hSession) { downloadThreadFailure = true; Status(L"Update failed: Couldn't open obsproject.com"); @@ -356,10 +347,11 @@ } WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, - (LPVOID)&tlsProtocols, sizeof(tlsProtocols)); + (LPVOID)&tlsProtocols, sizeof(tlsProtocols)); - HttpHandle hConnect = WinHttpConnect(hSession, L"cdn-fastly.obsproject.com", - INTERNET_DEFAULT_HTTPS_PORT, 0); + HttpHandle hConnect = WinHttpConnect(hSession, + L"cdn-fastly.obsproject.com", + INTERNET_DEFAULT_HTTPS_PORT, 0); if (!hConnect) { downloadThreadFailure = true; Status(L"Update failed: Couldn't connect to cdn-fastly.obsproject.com"); @@ -395,18 +387,16 @@ Status(L"Downloading %s", update.outputPath.c_str()); - if (!HTTPGetFile(hConnect, - update.sourceURL.c_str(), - update.tempPath.c_str(), - L"Accept-Encoding: gzip", - &responseCode)) { + if (!HTTPGetFile(hConnect, update.sourceURL.c_str(), + update.tempPath.c_str(), + L"Accept-Encoding: gzip", + &responseCode)) { downloadThreadFailure = true; DeleteFile(update.tempPath.c_str()); Status(L"Update failed: Could not download " L"%s (error code %d)", - update.outputPath.c_str(), - responseCode); + update.outputPath.c_str(), responseCode); return 1; } @@ -415,19 +405,18 @@ DeleteFile(update.tempPath.c_str()); Status(L"Update failed: Could not download " L"%s (error code %d)", - update.outputPath.c_str(), - responseCode); + update.outputPath.c_str(), responseCode); return 1; } BYTE downloadHash[BLAKE2_HASH_LENGTH]; if (!CalculateFileHash(update.tempPath.c_str(), - downloadHash)) { + downloadHash)) { downloadThreadFailure = true; DeleteFile(update.tempPath.c_str()); Status(L"Update failed: Couldn't verify " - L"integrity of %s", - update.outputPath.c_str()); + L"integrity of %s", + update.outputPath.c_str()); return 1; } @@ -435,8 +424,8 @@ downloadThreadFailure = true; DeleteFile(update.tempPath.c_str()); Status(L"Update failed: Integrity check " - L"failed on %s", - update.outputPath.c_str()); + L"failed on %s", + update.outputPath.c_str()); return 1; } @@ -479,9 +468,9 @@ /* ----------------------------------------------------------------------- */ -#define WAITIFOBS_SUCCESS 0 +#define WAITIFOBS_SUCCESS 0 #define WAITIFOBS_WRONG_PROCESS 1 -#define WAITIFOBS_CANCELLED 2 +#define WAITIFOBS_CANCELLED 2 static inline DWORD WaitIfOBS(DWORD id, const wchar_t *expected) { @@ -489,11 +478,9 @@ wchar_t *name; *path = 0; - WinHandle proc = OpenProcess( - PROCESS_QUERY_INFORMATION | - PROCESS_VM_READ | - SYNCHRONIZE, - false, id); + WinHandle proc = OpenProcess(PROCESS_QUERY_INFORMATION | + PROCESS_VM_READ | SYNCHRONIZE, + false, id); if (!proc.Valid()) return WAITIFOBS_WRONG_PROCESS; @@ -559,13 +546,13 @@ static inline bool WideToUTF8(char *utf8, int utf8Size, const wchar_t *wide) { return !!WideCharToMultiByte(CP_UTF8, 0, wide, -1, utf8, utf8Size, - nullptr, nullptr); + nullptr, nullptr); } static inline bool FileExists(const wchar_t *path) { WIN32_FIND_DATAW wfd; - HANDLE hFind; + HANDLE hFind; hFind = FindFirstFileW(path, &wfd); if (hFind != INVALID_HANDLE_VALUE) @@ -578,13 +565,15 @@ { if (is32bit) { if (strcmp(name, "obs-browser") == 0) { - return FileExists(L"obs-plugins\\32bit\\obs-browser.dll"); + return FileExists( + L"obs-plugins\\32bit\\obs-browser.dll"); } else if (strcmp(name, "realsense") == 0) { return FileExists(L"obs-plugins\\32bit\\win-ivcam.dll"); } } else { if (strcmp(name, "obs-browser") == 0) { - return FileExists(L"obs-plugins\\64bit\\obs-browser.dll"); + return FileExists( + L"obs-plugins\\64bit\\obs-browser.dll"); } else if (strcmp(name, "realsense") == 0) { return FileExists(L"obs-plugins\\64bit\\win-ivcam.dll"); } @@ -625,11 +614,11 @@ #define UPDATE_URL L"https://cdn-fastly.obsproject.com/update_studio" static bool AddPackageUpdateFiles(json_t *root, size_t idx, - const wchar_t *tempPath) + const wchar_t *tempPath) { json_t *package = json_array_get(root, idx); - json_t *name = json_object_get(package, "name"); - json_t *files = json_object_get(package, "files"); + json_t *name = json_object_get(package, "name"); + json_t *files = json_object_get(package, "files"); bool isWin64 = is_64bit_windows(); @@ -650,10 +639,10 @@ return true; for (size_t j = 0; j < fileCount; j++) { - json_t *file = json_array_get(files, j); + json_t *file = json_array_get(files, j); json_t *fileName = json_object_get(file, "name"); - json_t *hash = json_object_get(file, "hash"); - json_t *size = json_object_get(file, "size"); + json_t *hash = json_object_get(file, "hash"); + json_t *size = json_object_get(file, "size"); if (!json_is_string(fileName)) continue; @@ -664,7 +653,7 @@ const char *fileUTF8 = json_string_value(fileName); const char *hashUTF8 = json_string_value(hash); - int fileSize = (int)json_integer_value(size); + int fileSize = (int)json_integer_value(size); if (strlen(hashUTF8) != BLAKE2_HASH_LENGTH * 2) continue; @@ -674,7 +663,7 @@ /* ignore update files of opposite arch to reduce download */ - if (( is32bit && has_str(fileUTF8, "/64bit/")) || + if ((is32bit && has_str(fileUTF8, "/64bit/")) || (!is32bit && has_str(fileUTF8, "/32bit/"))) continue; @@ -694,20 +683,21 @@ if (!IsSafeFilename(updateFileName)) { Status(L"Update failed: Unsafe path '%s' found in " - L"manifest", updateFileName); + L"manifest", + updateFileName); return false; } StringCbPrintf(sourceURL, sizeof(sourceURL), L"%s/%s/%s", - UPDATE_URL, wPackageName, updateFileName); - StringCbPrintf(tempFilePath, sizeof(tempFilePath), - L"%s\\%s", tempPath, updateHashStr); + UPDATE_URL, wPackageName, updateFileName); + StringCbPrintf(tempFilePath, sizeof(tempFilePath), L"%s\\%s", + tempPath, updateHashStr); /* Check file hash */ - BYTE existingHash[BLAKE2_HASH_LENGTH]; + BYTE existingHash[BLAKE2_HASH_LENGTH]; wchar_t fileHashStr[BLAKE2_HASH_STR_LENGTH]; - bool has_hash; + bool has_hash; /* We don't really care if this fails, it's just to avoid * wasting bandwidth by downloading unmodified files */ @@ -725,14 +715,14 @@ /* Add update file */ update_t update; - update.fileSize = fileSize; - update.basename = updateFileName; - update.outputPath = updateFileName; - update.tempPath = tempFilePath; - update.sourceURL = sourceURL; - update.packageName = packageName; - update.state = STATE_PENDING_DOWNLOAD; - update.patchable = false; + update.fileSize = fileSize; + update.basename = updateFileName; + update.outputPath = updateFileName; + update.tempPath = tempFilePath; + update.sourceURL = sourceURL; + update.packageName = packageName; + update.state = STATE_PENDING_DOWNLOAD; + update.patchable = false; StringToHash(updateHashStr, update.downloadhash); memcpy(update.hash, update.downloadhash, sizeof(update.hash)); @@ -750,8 +740,7 @@ } static void UpdateWithPatchIfAvailable(const char *name, const char *hash, - const char *source, - int size) + const char *source, int size) { wchar_t widePatchableFilename[MAX_PATH]; wchar_t widePatchHash[MAX_PATH]; @@ -791,7 +780,7 @@ * patchable, and re-calculate download size */ totalFileSize -= (update.fileSize - size); update.sourceURL = sourceURL; - update.fileSize = size; + update.fileSize = size; update.patchable = true; break; } @@ -812,10 +801,10 @@ if (attribs != INVALID_FILE_ATTRIBUTES) { wchar_t *curFileName = nullptr; - wchar_t baseName[MAX_PATH]; + wchar_t baseName[MAX_PATH]; StringCbCopy(baseName, sizeof(baseName), - file.outputPath.c_str()); + file.outputPath.c_str()); curFileName = wcsrchr(baseName, '/'); if (curFileName) { @@ -825,12 +814,10 @@ curFileName = baseName; /* Backup the existing file in case a rollback is needed */ - StringCbCopy(oldFileRenamedPath, - sizeof(oldFileRenamedPath), - file.outputPath.c_str()); - StringCbCat(oldFileRenamedPath, - sizeof(oldFileRenamedPath), - L".old"); + StringCbCopy(oldFileRenamedPath, sizeof(oldFileRenamedPath), + file.outputPath.c_str()); + StringCbCat(oldFileRenamedPath, sizeof(oldFileRenamedPath), + L".old"); if (!MyCopyFile(file.outputPath.c_str(), oldFileRenamedPath)) { int is_sharing_violation = @@ -849,19 +836,18 @@ file.previousFile = oldFileRenamedPath; - int error_code; + int error_code; bool installed_ok; if (file.patchable) { - error_code = ApplyPatch( - file.tempPath.c_str(), - file.outputPath.c_str()); + error_code = ApplyPatch(file.tempPath.c_str(), + file.outputPath.c_str()); installed_ok = (error_code == 0); if (installed_ok) { BYTE patchedFileHash[BLAKE2_HASH_LENGTH]; if (!CalculateFileHash(file.outputPath.c_str(), - patchedFileHash)) { + patchedFileHash)) { Status(L"Update failed: Couldn't " L"verify integrity of patched %s", curFileName); @@ -871,7 +857,7 @@ } if (memcmp(file.hash, patchedFileHash, - BLAKE2_HASH_LENGTH) != 0) { + BLAKE2_HASH_LENGTH) != 0) { Status(L"Update failed: Integrity " L"check of patched " L"%s failed", @@ -882,9 +868,8 @@ } } } else { - installed_ok = MyCopyFile( - file.tempPath.c_str(), - file.outputPath.c_str()); + installed_ok = MyCopyFile(file.tempPath.c_str(), + file.outputPath.c_str()); error_code = GetLastError(); } @@ -900,8 +885,7 @@ else Status(L"Update failed: Couldn't update %s " L"(error %d)", - curFileName, - GetLastError()); + curFileName, GetLastError()); file.state = STATE_INSTALL_FAILED; return false; @@ -913,7 +897,7 @@ /* Uh oh, we thought we could patch something but it's * no longer there! */ Status(L"Update failed: Source file %s not found", - file.outputPath.c_str()); + file.outputPath.c_str()); return false; } @@ -923,13 +907,11 @@ file.previousFile = L""; - bool success = !!MyCopyFile( - file.tempPath.c_str(), - file.outputPath.c_str()); + bool success = !!MyCopyFile(file.tempPath.c_str(), + file.outputPath.c_str()); if (!success) { Status(L"Update failed: Couldn't install %s (error %d)", - file.outputPath.c_str(), - GetLastError()); + file.outputPath.c_str(), GetLastError()); file.state = STATE_INSTALL_FAILED; return false; } @@ -944,8 +926,7 @@ #define PATCH_MANIFEST_URL \ L"https://obsproject.com/update_studio/getpatchmanifest" -#define HASH_NULL \ - L"0000000000000000000000000000000000000000" +#define HASH_NULL L"0000000000000000000000000000000000000000" static bool UpdateVS2017Redists(json_t *root) { @@ -955,20 +936,20 @@ const DWORD tlsProtocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2; HttpHandle hSession = WinHttpOpen(L"OBS Studio Updater/2.1", - WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, - WINHTTP_NO_PROXY_NAME, - WINHTTP_NO_PROXY_BYPASS, - 0); + WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, + WINHTTP_NO_PROXY_BYPASS, 0); if (!hSession) { Status(L"Update failed: Couldn't open obsproject.com"); return false; } WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, - (LPVOID)&tlsProtocols, sizeof(tlsProtocols)); + (LPVOID)&tlsProtocols, sizeof(tlsProtocols)); - HttpHandle hConnect = WinHttpConnect(hSession, L"cdn-fastly.obsproject.com", - INTERNET_DEFAULT_HTTPS_PORT, 0); + HttpHandle hConnect = WinHttpConnect(hSession, + L"cdn-fastly.obsproject.com", + INTERNET_DEFAULT_HTTPS_PORT, 0); if (!hConnect) { Status(L"Update failed: Couldn't connect to cdn-fastly.obsproject.com"); return false; @@ -986,9 +967,8 @@ Status(L"Downloading %s", L"Visual C++ 2017 Redistributable"); - const wchar_t *file = (is32bit) - ? L"vc2017redist_x86.exe" - : L"vc2017redist_x64.exe"; + const wchar_t *file = (is32bit) ? L"vc2017redist_x86.exe" + : L"vc2017redist_x64.exe"; wstring sourceURL; sourceURL += L"https://cdn-fastly.obsproject.com/downloads/"; @@ -999,26 +979,21 @@ destPath += L"\\"; destPath += file; - if (!HTTPGetFile(hConnect, - sourceURL.c_str(), - destPath.c_str(), - L"Accept-Encoding: gzip", - &responseCode)) { + if (!HTTPGetFile(hConnect, sourceURL.c_str(), destPath.c_str(), + L"Accept-Encoding: gzip", &responseCode)) { DeleteFile(destPath.c_str()); Status(L"Update failed: Could not download " L"%s (error code %d)", - L"Visual C++ 2017 Redistributable", - responseCode); + L"Visual C++ 2017 Redistributable", responseCode); return false; } /* ------------------------------------------ * * Get expected hash */ - json_t *redistJson = json_object_get(root, is32bit - ? "vc2017_redist_x86" - : "vc2017_redist_x64"); + json_t *redistJson = json_object_get( + root, is32bit ? "vc2017_redist_x86" : "vc2017_redist_x64"); if (!redistJson) { Status(L"Update failed: Could not parse VC2017 redist json"); return false; @@ -1045,7 +1020,7 @@ if (!CalculateFileHash(destPath.c_str(), downloadHash)) { DeleteFile(destPath.c_str()); Status(L"Update failed: Couldn't verify integrity of %s", - L"Visual C++ 2017 Redistributable"); + L"Visual C++ 2017 Redistributable"); return false; } @@ -1056,7 +1031,7 @@ if (wcscmp(expectedHashWide, downloadHashWide) != 0) { DeleteFile(destPath.c_str()); Status(L"Update failed: Couldn't verify integrity of %s", - L"Visual C++ 2017 Redistributable"); + L"Visual C++ 2017 Redistributable"); return false; } @@ -1065,15 +1040,15 @@ wchar_t commandline[MAX_PATH + MAX_PATH]; StringCbPrintf(commandline, sizeof(commandline), - L"%s /install /quiet /norestart", destPath.c_str()); + L"%s /install /quiet /norestart", destPath.c_str()); PROCESS_INFORMATION pi = {}; STARTUPINFO si = {}; si.cb = sizeof(si); - bool success = !!CreateProcessW(destPath.c_str(), commandline, - nullptr, nullptr, false, CREATE_NO_WINDOW, - nullptr, nullptr, &si, &pi); + bool success = !!CreateProcessW(destPath.c_str(), commandline, nullptr, + nullptr, false, CREATE_NO_WINDOW, + nullptr, nullptr, &si, &pi); if (success) { Status(L"Installing %s...", L"Visual C++ 2017 Redistributable"); @@ -1083,8 +1058,7 @@ } else { Status(L"Update failed: Could not execute " L"%s (error code %d)", - L"Visual C++ 2017 Redistributable", - (int)GetLastError()); + L"Visual C++ 2017 Redistributable", (int)GetLastError()); } DeleteFile(destPath.c_str()); @@ -1102,8 +1076,8 @@ /* ------------------------------------- * * Check to make sure OBS isn't running */ - HANDLE hObsUpdateMutex = OpenMutexW(SYNCHRONIZE, false, - L"OBSStudioUpdateMutex"); + HANDLE hObsUpdateMutex = + OpenMutexW(SYNCHRONIZE, false, L"OBSStudioUpdateMutex"); if (hObsUpdateMutex) { HANDLE hWait[2]; hWait[0] = hObsUpdateMutex; @@ -1128,7 +1102,7 @@ CryptProvider hProvider; if (!CryptAcquireContext(&hProvider, nullptr, MS_ENH_RSA_AES_PROV, - PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) { + PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) { SetDlgItemTextW(hwndMain, IDC_STATUS, L"Update failed: CryptAcquireContext failure"); return false; @@ -1179,18 +1153,18 @@ } else { CoTaskMemPtr<wchar_t> pOut; HRESULT hr = SHGetKnownFolderPath(FOLDERID_RoamingAppData, - KF_FLAG_DEFAULT, nullptr, &pOut); + KF_FLAG_DEFAULT, nullptr, + &pOut); if (hr != S_OK) { Status(L"Update failed: Could not determine AppData " - L"location"); + L"location"); return false; } StringCbCopy(lpAppDataPath, sizeof(lpAppDataPath), pOut); } - StringCbCat(lpAppDataPath, sizeof(lpAppDataPath), - L"\\obs-studio"); + StringCbCat(lpAppDataPath, sizeof(lpAppDataPath), L"\\obs-studio"); /* ------------------------------------- * * Get download path */ @@ -1199,18 +1173,18 @@ wchar_t tempDirName[MAX_PATH]; manifestPath[0] = 0; - tempDirName[0] = 0; + tempDirName[0] = 0; StringCbPrintf(manifestPath, sizeof(manifestPath), - L"%s\\updates\\manifest.json", lpAppDataPath); + L"%s\\updates\\manifest.json", lpAppDataPath); if (!GetTempPathW(_countof(tempDirName), tempDirName)) { Status(L"Update failed: Failed to get temp path: %ld", - GetLastError()); + GetLastError()); return false; } if (!GetTempFileNameW(tempDirName, L"obs-studio", 0, tempPath)) { Status(L"Update failed: Failed to create temp dir name: %ld", - GetLastError()); + GetLastError()); return false; } @@ -1233,7 +1207,8 @@ if (!root) { Status(L"Update failed: Couldn't parse update " - L"manifest: %S", error.text); + L"manifest: %S", + error.text); return false; } } @@ -1284,8 +1259,8 @@ for (update_t &update : updates) { wchar_t whash_string[BLAKE2_HASH_STR_LENGTH]; - char hash_string[BLAKE2_HASH_STR_LENGTH]; - char outputPath[MAX_PATH]; + char hash_string[BLAKE2_HASH_STR_LENGTH]; + char outputPath[MAX_PATH]; if (!update.has_hash) continue; @@ -1319,23 +1294,22 @@ if (json_array_size(files) > 0) { char *post_body = json_dumps(files, JSON_COMPACT); - int responseCode; + int responseCode; int len = (int)strlen(post_body); uLong compressSize = compressBound(len); string compressedJson; compressedJson.resize(compressSize); - compress2((Bytef*)&compressedJson[0], &compressSize, - (const Bytef*)post_body, len, - Z_BEST_COMPRESSION); + compress2((Bytef *)&compressedJson[0], &compressSize, + (const Bytef *)post_body, len, Z_BEST_COMPRESSION); compressedJson.resize(compressSize); bool success = !!HTTPPostData(PATCH_MANIFEST_URL, - (BYTE *)&compressedJson[0], - (int)compressedJson.size(), - L"Accept-Encoding: gzip", &responseCode, - newManifest); + (BYTE *)&compressedJson[0], + (int)compressedJson.size(), + L"Accept-Encoding: gzip", + &responseCode, newManifest); free(post_body); if (!success) @@ -1343,8 +1317,8 @@ if (responseCode != 200) { Status(L"Update failed: HTTP/%d while trying to " - L"download patch manifest", - responseCode); + L"download patch manifest", + responseCode); return false; } } else { @@ -1358,7 +1332,7 @@ root = json_loads(newManifest.c_str(), 0, &error); if (!root) { Status(L"Update failed: Couldn't parse patch manifest: %S", - error.text); + error.text); return false; } @@ -1377,10 +1351,10 @@ return false; } - json_t *name_json = json_object_get(patch, "name"); - json_t *hash_json = json_object_get(patch, "hash"); + json_t *name_json = json_object_get(patch, "name"); + json_t *hash_json = json_object_get(patch, "hash"); json_t *source_json = json_object_get(patch, "source"); - json_t *size_json = json_object_get(patch, "size"); + json_t *size_json = json_object_get(patch, "size"); if (!json_is_string(name_json)) continue; @@ -1391,10 +1365,10 @@ if (!json_is_integer(size_json)) continue; - const char *name = json_string_value(name_json); - const char *hash = json_string_value(hash_json); + const char *name = json_string_value(name_json); + const char *hash = json_string_value(hash_json); const char *source = json_string_value(source_json); - int size = (int)json_integer_value(size_json); + int size = (int)json_integer_value(size_json); UpdateWithPatchIfAvailable(name, hash, source, size); } @@ -1416,8 +1390,7 @@ int updatesInstalled = 0; int lastPosition = 0; - SendDlgItemMessage(hwndMain, IDC_PROGRESS, - PBM_SETPOS, 0, 0); + SendDlgItemMessage(hwndMain, IDC_PROGRESS, PBM_SETPOS, 0, 0); for (update_t &update : updates) { if (!UpdateFile(update)) { @@ -1425,11 +1398,12 @@ } else { updatesInstalled++; int position = (int)(((float)updatesInstalled / - (float)completedUpdates) * 100.0f); + (float)completedUpdates) * + 100.0f); if (position > lastPosition) { lastPosition = position; SendDlgItemMessage(hwndMain, IDC_PROGRESS, - PBM_SETPOS, position, 0); + PBM_SETPOS, position, 0); } } } @@ -1445,8 +1419,7 @@ DeleteFile(update.tempPath.c_str()); } - SendDlgItemMessage(hwndMain, IDC_PROGRESS, - PBM_SETPOS, 100, 0); + SendDlgItemMessage(hwndMain, IDC_PROGRESS, PBM_SETPOS, 100, 0); Status(L"Update complete."); SetDlgItemText(hwndMain, IDC_BUTTON, L"Launch OBS"); @@ -1508,15 +1481,13 @@ GetCurrentDirectory(_countof(cwd) - 1, cwd); StringCbCopy(obsPath, sizeof(obsPath), cwd); - StringCbCat(obsPath, sizeof(obsPath), is32bit - ? L"\\bin\\32bit" - : L"\\bin\\64bit"); + StringCbCat(obsPath, sizeof(obsPath), + is32bit ? L"\\bin\\32bit" : L"\\bin\\64bit"); SetCurrentDirectory(obsPath); StringCbCopy(newCwd, sizeof(newCwd), obsPath); - StringCbCat(obsPath, sizeof(obsPath), is32bit - ? L"\\obs32.exe" - : L"\\obs64.exe"); + StringCbCat(obsPath, sizeof(obsPath), + is32bit ? L"\\obs32.exe" : L"\\obs64.exe"); if (!FileExists(obsPath)) { StringCbCopy(obsPath, sizeof(obsPath), cwd); @@ -1536,21 +1507,21 @@ ZeroMemory(&execInfo, sizeof(execInfo)); - execInfo.cbSize = sizeof(execInfo); - execInfo.lpFile = obsPath; + execInfo.cbSize = sizeof(execInfo); + execInfo.lpFile = obsPath; execInfo.lpDirectory = newCwd; - execInfo.nShow = SW_SHOWNORMAL; + execInfo.nShow = SW_SHOWNORMAL; ShellExecuteEx(&execInfo); } -static INT_PTR CALLBACK UpdateDialogProc(HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK UpdateDialogProc(HWND hwnd, UINT message, WPARAM wParam, + LPARAM lParam) { switch (message) { case WM_INITDIALOG: { - static HICON hMainIcon = LoadIcon(hinstMain, - MAKEINTRESOURCE(IDI_ICON1)); + static HICON hMainIcon = + LoadIcon(hinstMain, MAKEINTRESOURCE(IDI_ICON1)); SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hMainIcon); SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hMainIcon); return true; @@ -1559,8 +1530,8 @@ case WM_COMMAND: if (LOWORD(wParam) == IDC_BUTTON) { if (HIWORD(wParam) == BN_CLICKED) { - DWORD result = WaitForSingleObject( - updateThread, 0); + DWORD result = + WaitForSingleObject(updateThread, 0); if (result == WAIT_OBJECT_0) { if (updateFailed) PostQuitMessage(0); @@ -1593,15 +1564,15 @@ GetCurrentDirectoryW(_countof(cwd) - 1, cwd); SHELLEXECUTEINFO shExInfo = {0}; - shExInfo.cbSize = sizeof(shExInfo); - shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS; - shExInfo.hwnd = 0; - shExInfo.lpVerb = L"runas"; /* Operation to perform */ - shExInfo.lpFile = myPath; /* Application to start */ - shExInfo.lpParameters = lpCmdLine; /* Additional parameters */ - shExInfo.lpDirectory = cwd; - shExInfo.nShow = SW_NORMAL; - shExInfo.hInstApp = 0; + shExInfo.cbSize = sizeof(shExInfo); + shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS; + shExInfo.hwnd = 0; + shExInfo.lpVerb = L"runas"; /* Operation to perform */ + shExInfo.lpFile = myPath; /* Application to start */ + shExInfo.lpParameters = lpCmdLine; /* Additional parameters */ + shExInfo.lpDirectory = cwd; + shExInfo.nShow = SW_NORMAL; + shExInfo.hInstApp = 0; /* annoyingly the actual elevated updater will disappear behind other * windows :( */ @@ -1627,7 +1598,8 @@ BOOL success; success = AllocateAndInitializeSid(&sia, 2, SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &sid); + DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, + 0, 0, &sid); if (success && sid) { CheckTokenMembership(nullptr, sid, &elevated); FreeSid(sid); @@ -1641,8 +1613,8 @@ INITCOMMONCONTROLSEX icce; if (!HasElevation()) { - HANDLE hLowMutex = CreateMutexW(nullptr, true, - L"OBSUpdaterRunningAsNonAdminUser"); + HANDLE hLowMutex = CreateMutexW( + nullptr, true, L"OBSUpdaterRunningAsNonAdminUser"); RestartAsAdmin(lpCmdLine); @@ -1669,13 +1641,13 @@ hinstMain = hInstance; icce.dwSize = sizeof(icce); - icce.dwICC = ICC_PROGRESS_CLASS; + icce.dwICC = ICC_PROGRESS_CLASS; InitCommonControlsEx(&icce); hwndMain = CreateDialog(hInstance, - MAKEINTRESOURCE(IDD_UPDATEDIALOG), nullptr, - UpdateDialogProc); + MAKEINTRESOURCE(IDD_UPDATEDIALOG), + nullptr, UpdateDialogProc); if (!hwndMain) { return -1; } @@ -1684,8 +1656,8 @@ SetForegroundWindow(hwndMain); cancelRequested = CreateEvent(nullptr, true, false, nullptr); - updateThread = CreateThread(nullptr, 0, UpdateThread, - lpCmdLine, 0, nullptr); + updateThread = CreateThread(nullptr, 0, UpdateThread, lpCmdLine, + 0, nullptr); MSG msg; while (GetMessage(&msg, nullptr, 0, 0)) { @@ -1697,8 +1669,8 @@ /* there is no non-elevated process waiting for us if UAC is * disabled */ - WinHandle hMutex = OpenMutex(SYNCHRONIZE, false, - L"OBSUpdaterRunningAsNonAdminUser"); + WinHandle hMutex = OpenMutex( + SYNCHRONIZE, false, L"OBSUpdaterRunningAsNonAdminUser"); if (msg.wParam == 1 && !hMutex) { LaunchOBS(); }
View file
obs-studio-23.2.1.tar.xz/UI/win-update/updater/updater.hpp -> obs-studio-24.0.0.tar.xz/UI/win-update/updater/updater.hpp
Changed
@@ -45,53 +45,44 @@ #define BLAKE2_HASH_STR_LENGTH ((BLAKE2_HASH_LENGTH * 2) + 1) #if defined _M_IX86 -#pragma comment(linker, \ - "/manifestdependency:\"type='win32' " \ - "name='Microsoft.Windows.Common-Controls' " \ - "version='6.0.0.0' " \ - "processorArchitecture='x86' " \ - "publicKeyToken='6595b64144ccf1df' " \ - "language='*'\"") +#pragma comment(linker, "/manifestdependency:\"type='win32' " \ + "name='Microsoft.Windows.Common-Controls' " \ + "version='6.0.0.0' " \ + "processorArchitecture='x86' " \ + "publicKeyToken='6595b64144ccf1df' " \ + "language='*'\"") #elif defined _M_IA64 -#pragma comment(linker, \ - "/manifestdependency:\"type='win32' " \ - "name='Microsoft.Windows.Common-Controls' " \ - "version='6.0.0.0' " \ - "processorArchitecture='ia64' " \ - "publicKeyToken='6595b64144ccf1df' " \ - "language='*'\"") +#pragma comment(linker, "/manifestdependency:\"type='win32' " \ + "name='Microsoft.Windows.Common-Controls' " \ + "version='6.0.0.0' " \ + "processorArchitecture='ia64' " \ + "publicKeyToken='6595b64144ccf1df' " \ + "language='*'\"") #elif defined _M_X64 -#pragma comment(linker, \ - "/manifestdependency:\"type='win32' " \ - "name='Microsoft.Windows.Common-Controls' " \ - "version='6.0.0.0' " \ - "processorArchitecture='amd64' " \ - "publicKeyToken='6595b64144ccf1df' " \ - "language='*'\"") +#pragma comment(linker, "/manifestdependency:\"type='win32' " \ + "name='Microsoft.Windows.Common-Controls' " \ + "version='6.0.0.0' " \ + "processorArchitecture='amd64' " \ + "publicKeyToken='6595b64144ccf1df' " \ + "language='*'\"") #else -#pragma comment(linker, \ - "/manifestdependency:\"type='win32' " \ - "name='Microsoft.Windows.Common-Controls' " \ - "version='6.0.0.0' processorArchitecture='*' " \ - "publicKeyToken='6595b64144ccf1df' " \ - "language='*'\"") +#pragma comment(linker, "/manifestdependency:\"type='win32' " \ + "name='Microsoft.Windows.Common-Controls' " \ + "version='6.0.0.0' processorArchitecture='*' " \ + "publicKeyToken='6595b64144ccf1df' " \ + "language='*'\"") #endif #include <util/windows/WinHandle.hpp> #include <jansson.h> #include "resource.h" -bool HTTPGetFile(HINTERNET hConnect, - const wchar_t *url, - const wchar_t *outputPath, - const wchar_t *extraHeaders, - int * responseCode); -bool HTTPPostData(const wchar_t *url, - const BYTE * data, - int dataLen, - const wchar_t *extraHeaders, - int * responseCode, - std::string & response); +bool HTTPGetFile(HINTERNET hConnect, const wchar_t *url, + const wchar_t *outputPath, const wchar_t *extraHeaders, + int *responseCode); +bool HTTPPostData(const wchar_t *url, const BYTE *data, int dataLen, + const wchar_t *extraHeaders, int *responseCode, + std::string &response); void HashToString(const BYTE *in, wchar_t *out); void StringToHash(const wchar_t *in, BYTE *out); @@ -100,17 +91,17 @@ int ApplyPatch(LPCTSTR patchFile, LPCTSTR targetFile); -extern HWND hwndMain; +extern HWND hwndMain; extern HCRYPTPROV hProvider; -extern int totalFileSize; -extern int completedFileSize; -extern HANDLE cancelRequested; +extern int totalFileSize; +extern int completedFileSize; +extern HANDLE cancelRequested; #pragma pack(push, r1, 1) typedef struct { BLOBHEADER blobheader; - RSAPUBKEY rsapubkey; + RSAPUBKEY rsapubkey; } PUBLICKEYHEADER; #pragma pack(pop, r1)
View file
obs-studio-23.2.1.tar.xz/UI/win-update/win-update-helpers.hpp -> obs-studio-24.0.0.tar.xz/UI/win-update/win-update-helpers.hpp
Changed
@@ -23,9 +23,9 @@ freefunc(handle); } - inline T *operator&() {return &handle;} - inline operator T() const {return handle;} - inline T get() const {return handle;} + inline T *operator&() { return &handle; } + inline operator T() const { return handle; } + inline T get() const { return handle; } inline CustomHandle<T, freefunc> &operator=(T in) { @@ -35,7 +35,7 @@ return *this; } - inline bool operator!() const {return !handle;} + inline bool operator!() const { return !handle; } }; void FreeProvider(HCRYPTPROV prov); @@ -43,8 +43,8 @@ void FreeKey(HCRYPTKEY key); using CryptProvider = CustomHandle<HCRYPTPROV, FreeProvider>; -using CryptHash = CustomHandle<HCRYPTHASH, FreeHash>; -using CryptKey = CustomHandle<HCRYPTKEY, FreeKey>; +using CryptHash = CustomHandle<HCRYPTHASH, FreeHash>; +using CryptKey = CustomHandle<HCRYPTKEY, FreeKey>; /* ------------------------------------------------------------------------ */ @@ -58,13 +58,13 @@ LocalFree(ptr); } - inline T **operator&() {return &ptr;} - inline operator T() const {return ptr;} - inline T *get() const {return ptr;} + inline T **operator&() { return &ptr; } + inline operator T() const { return ptr; } + inline T *get() const { return ptr; } - inline bool operator!() const {return !ptr;} + inline bool operator!() const { return !ptr; } - inline T *operator->() {return ptr;} + inline T *operator->() { return ptr; } }; /* ------------------------------------------------------------------------ */ @@ -76,9 +76,10 @@ inline Json() : json(nullptr) {} explicit inline Json(json_t *json_) : json(json_) {} inline Json(const Json &from) : json(json_incref(from.json)) {} - inline Json(Json &&from) : json(from.json) {from.json = nullptr;} + inline Json(Json &&from) : json(from.json) { from.json = nullptr; } - inline ~Json() { + inline ~Json() + { if (json) json_decref(json); } @@ -106,12 +107,12 @@ return *this; } - inline operator json_t *() const {return json;} + inline operator json_t *() const { return json; } - inline bool operator!() const {return !json;} + inline bool operator!() const { return !json; } inline const char *GetString(const char *name, - const char *def = nullptr) const + const char *def = nullptr) const { json_t *obj(json_object_get(json, name)); if (!obj) @@ -130,7 +131,7 @@ return json_object_get(json, name); } - inline json_t *get() const {return json;} + inline json_t *get() const { return json; } }; /* ------------------------------------------------------------------------ */
View file
obs-studio-23.2.1.tar.xz/UI/win-update/win-update.cpp -> obs-studio-24.0.0.tar.xz/UI/win-update/win-update.cpp
Changed
@@ -42,7 +42,7 @@ typedef struct { BLOBHEADER blobheader; - RSAPUBKEY rsapubkey; + RSAPUBKEY rsapubkey; } PUBLICKEYHEADER; #pragma pack(pop, r1) @@ -120,8 +120,7 @@ 0x42, 0x61, 0x35, 0x66, 0x37, 0x4c, 0x6f, 0x4b, 0x38, 0x43, 0x41, 0x77, 0x45, 0x41, 0x41, 0x51, 0x3d, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x4b, - 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a -}; + 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a}; static const unsigned int obs_pub_len = 800; /* ------------------------------------------------------------------------ */ @@ -132,27 +131,22 @@ if (os_utf8_to_wcs_ptr(file, 0, &w_file) == 0) return false; - WinHandle handle = CreateFileW( - w_file, - GENERIC_WRITE, - 0, - nullptr, - CREATE_ALWAYS, - FILE_FLAG_WRITE_THROUGH, - nullptr); + WinHandle handle = CreateFileW(w_file, GENERIC_WRITE, 0, nullptr, + CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH, + nullptr); if (handle == INVALID_HANDLE_VALUE) - throw strprintf("Failed to open file '%s': %lu", - file, GetLastError()); + throw strprintf("Failed to open file '%s': %lu", file, + GetLastError()); DWORD written; if (!WriteFile(handle, data, (DWORD)size, &written, nullptr)) - throw strprintf("Failed to write file '%s': %lu", - file, GetLastError()); + throw strprintf("Failed to write file '%s': %lu", file, + GetLastError()); return true; -} catch (string text) { +} catch (string &text) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str()); return false; } @@ -163,30 +157,24 @@ if (os_utf8_to_wcs_ptr(file, 0, &w_file) == 0) return false; - WinHandle handle = CreateFileW( - w_file, - GENERIC_READ, - FILE_SHARE_READ, - nullptr, - OPEN_EXISTING, - 0, - nullptr); + WinHandle handle = CreateFileW(w_file, GENERIC_READ, FILE_SHARE_READ, + nullptr, OPEN_EXISTING, 0, nullptr); if (handle == INVALID_HANDLE_VALUE) - throw strprintf("Failed to open file '%s': %lu", - file, GetLastError()); + throw strprintf("Failed to open file '%s': %lu", file, + GetLastError()); DWORD size = GetFileSize(handle, nullptr); data.resize(size); DWORD read; if (!ReadFile(handle, &data[0], size, &read, nullptr)) - throw strprintf("Failed to write file '%s': %lu", - file, GetLastError()); + throw strprintf("Failed to write file '%s': %lu", file, + GetLastError()); return true; -} catch (string text) { +} catch (string &text) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str()); return false; } @@ -196,7 +184,7 @@ const char alphabet[] = "0123456789abcdef"; for (int i = 0; i != BLAKE2_HASH_LENGTH; ++i) { - out[2 * i] = alphabet[in[i] / 16]; + out[2 * i] = alphabet[in[i] / 16]; out[2 * i + 1] = alphabet[in[i] % 16]; } @@ -214,10 +202,10 @@ return false; WinHandle handle = CreateFileW(w_path, GENERIC_READ, FILE_SHARE_READ, - nullptr, OPEN_EXISTING, 0, nullptr); + nullptr, OPEN_EXISTING, 0, nullptr); if (handle == INVALID_HANDLE_VALUE) - throw strprintf("Failed to open file '%s': %lu", - path, GetLastError()); + throw strprintf("Failed to open file '%s': %lu", path, + GetLastError()); vector<BYTE> buf; buf.resize(65536); @@ -225,9 +213,9 @@ for (;;) { DWORD read = 0; if (!ReadFile(handle, buf.data(), (DWORD)buf.size(), &read, - nullptr)) - throw strprintf("Failed to read file '%s': %lu", - path, GetLastError()); + nullptr)) + throw strprintf("Failed to read file '%s': %lu", path, + GetLastError()); if (!read) break; @@ -241,7 +229,7 @@ return true; -} catch (string text) { +} catch (string &text) { blog(LOG_DEBUG, "%s: %s", __FUNCTION__, text.c_str()); return false; } @@ -249,19 +237,19 @@ /* ------------------------------------------------------------------------ */ static bool VerifyDigitalSignature(uint8_t *buf, size_t len, uint8_t *sig, - size_t sigLen) + size_t sigLen) { /* ASN of PEM public key */ - BYTE binaryKey[1024]; + BYTE binaryKey[1024]; DWORD binaryKeyLen = sizeof(binaryKey); /* Windows X509 public key info from ASN */ LocalPtr<CERT_PUBLIC_KEY_INFO> publicPBLOB; - DWORD iPBLOBSize; + DWORD iPBLOBSize; /* RSA BLOB info from X509 public key */ LocalPtr<PUBLICKEYHEADER> rsaPublicBLOB; - DWORD rsaPublicBLOBSize; + DWORD rsaPublicBLOBSize; /* Handle to public key */ CryptKey keyOut; @@ -272,41 +260,26 @@ /* Signature in little-endian format */ vector<BYTE> reversedSig; - if (!CryptStringToBinaryA((LPCSTR)obs_pub, - obs_pub_len, - CRYPT_STRING_BASE64HEADER, - binaryKey, - &binaryKeyLen, - nullptr, - nullptr)) + if (!CryptStringToBinaryA((LPCSTR)obs_pub, obs_pub_len, + CRYPT_STRING_BASE64HEADER, binaryKey, + &binaryKeyLen, nullptr, nullptr)) return false; - if (!CryptDecodeObjectEx(X509_ASN_ENCODING, - X509_PUBLIC_KEY_INFO, - binaryKey, - binaryKeyLen, - CRYPT_ENCODE_ALLOC_FLAG, - nullptr, - &publicPBLOB, - &iPBLOBSize)) + if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_PUBLIC_KEY_INFO, + binaryKey, binaryKeyLen, + CRYPT_ENCODE_ALLOC_FLAG, nullptr, &publicPBLOB, + &iPBLOBSize)) return false; - if (!CryptDecodeObjectEx(X509_ASN_ENCODING, - RSA_CSP_PUBLICKEYBLOB, - publicPBLOB->PublicKey.pbData, - publicPBLOB->PublicKey.cbData, - CRYPT_ENCODE_ALLOC_FLAG, - nullptr, - &rsaPublicBLOB, - &rsaPublicBLOBSize)) + if (!CryptDecodeObjectEx(X509_ASN_ENCODING, RSA_CSP_PUBLICKEYBLOB, + publicPBLOB->PublicKey.pbData, + publicPBLOB->PublicKey.cbData, + CRYPT_ENCODE_ALLOC_FLAG, nullptr, + &rsaPublicBLOB, &rsaPublicBLOBSize)) return false; - if (!CryptImportKey(provider, - (const BYTE *)rsaPublicBLOB.get(), - rsaPublicBLOBSize, - 0, - 0, - &keyOut)) + if (!CryptImportKey(provider, (const BYTE *)rsaPublicBLOB.get(), + rsaPublicBLOBSize, 0, 0, &keyOut)) return false; if (!CryptCreateHash(provider, CALG_SHA_512, 0, 0, &hash)) @@ -321,19 +294,15 @@ for (size_t i = 0; i < sigLen; i++) reversedSig[i] = sig[sigLen - i - 1]; - if (!CryptVerifySignature(hash, - reversedSig.data(), - (DWORD)sigLen, - keyOut, - nullptr, - 0)) + if (!CryptVerifySignature(hash, reversedSig.data(), (DWORD)sigLen, + keyOut, nullptr, 0)) return false; return true; } static inline void HexToByteArray(const char *hexStr, size_t hexLen, - vector<uint8_t> &out) + vector<uint8_t> &out) { char ptr[3]; @@ -347,7 +316,7 @@ } static bool CheckDataSignature(const string &data, const char *name, - const char *hexSig, size_t sigLen) + const char *hexSig, size_t sigLen) try { if (sigLen == 0 || sigLen > 0xFFFF || (sigLen & 1) != 0) throw strprintf("Missing or invalid signature for %s", name); @@ -357,15 +326,13 @@ signature.reserve(sigLen); HexToByteArray(hexSig, sigLen, signature); - if (!VerifyDigitalSignature((uint8_t*)data.data(), - data.size(), - signature.data(), - signature.size())) + if (!VerifyDigitalSignature((uint8_t *)data.data(), data.size(), + signature.data(), signature.size())) throw strprintf("Signature check failed for %s", name); return true; -} catch (string text) { +} catch (string &text) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str()); return false; } @@ -374,12 +341,12 @@ static bool FetchUpdaterModule(const char *url) try { - long responseCode; - uint8_t updateFileHash[BLAKE2_HASH_LENGTH]; + long responseCode; + uint8_t updateFileHash[BLAKE2_HASH_LENGTH]; vector<string> extraHeaders; - BPtr<char> updateFilePath = GetConfigPathPtr( - "obs-studio\\updates\\updater.exe"); + BPtr<char> updateFilePath = + GetConfigPathPtr("obs-studio\\updates\\updater.exe"); if (CalculateFileHash(updateFilePath, updateFileHash)) { char hashString[BLAKE2_HASH_STR_LENGTH]; @@ -394,8 +361,8 @@ string error; string data; - bool success = GetRemoteFile(url, data, error, &responseCode, - nullptr, nullptr, extraHeaders, &signature); + bool success = GetRemoteFile(url, data, error, &responseCode, nullptr, + nullptr, extraHeaders, &signature); if (!success || (responseCode != 200 && responseCode != 304)) { if (responseCode == 404) @@ -407,7 +374,7 @@ /* A new file must be digitally signed */ if (responseCode == 200) { bool valid = CheckDataSignature(data, url, signature.data(), - signature.size()); + signature.size()); if (!valid) throw string("Invalid updater module signature"); @@ -417,7 +384,7 @@ return true; -} catch (string text) { +} catch (string &text) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str()); return false; } @@ -425,7 +392,7 @@ /* ------------------------------------------------------------------------ */ static bool ParseUpdateManifest(const char *manifest, bool *updatesAvailable, - string ¬es_str, int &updateVer) + string ¬es_str, int &updateVer) try { json_error_t error; @@ -442,10 +409,8 @@ int patch = root.GetInt("version_patch"); if (major == 0) - throw strprintf("Invalid version number: %d.%d.%d", - major, - minor, - patch); + throw strprintf("Invalid version number: %d.%d.%d", major, + minor, patch); json_t *notes = json_object_get(root, "notes"); if (!json_is_string(notes)) @@ -465,7 +430,7 @@ return true; -} catch (string text) { +} catch (string &text) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str()); return false; } @@ -491,8 +456,8 @@ /* NOTE: this is an arbitrary random number that we use to count the * number of unique OBS installations and is not associated with any * kind of identifiable information */ - const char *pguid = config_get_string(GetGlobalConfig(), - "General", "InstallGUID"); + const char *pguid = + config_get_string(GetGlobalConfig(), "General", "InstallGUID"); string guid; if (pguid) guid = pguid; @@ -501,9 +466,8 @@ GenerateGUID(guid); if (!guid.empty()) - config_set_string(GetGlobalConfig(), - "General", "InstallGUID", - guid.c_str()); + config_set_string(GetGlobalConfig(), "General", + "InstallGUID", guid.c_str()); } return guid; @@ -516,13 +480,12 @@ void AutoUpdateThread::info(const QString &title, const QString &text) { - QMetaObject::invokeMethod(this, "infoMsg", - Qt::BlockingQueuedConnection, - Q_ARG(QString, title), - Q_ARG(QString, text)); + QMetaObject::invokeMethod(this, "infoMsg", Qt::BlockingQueuedConnection, + Q_ARG(QString, title), Q_ARG(QString, text)); } -int AutoUpdateThread::queryUpdateSlot(bool localManualUpdate, const QString &text) +int AutoUpdateThread::queryUpdateSlot(bool localManualUpdate, + const QString &text) { OBSUpdate updateDlg(App()->GetMainWindow(), localManualUpdate, text); return updateDlg.exec(); @@ -533,17 +496,17 @@ int ret = OBSUpdate::No; QString text = text_utf8; QMetaObject::invokeMethod(this, "queryUpdateSlot", - Qt::BlockingQueuedConnection, - Q_RETURN_ARG(int, ret), - Q_ARG(bool, localManualUpdate), - Q_ARG(QString, text)); + Qt::BlockingQueuedConnection, + Q_RETURN_ARG(int, ret), + Q_ARG(bool, localManualUpdate), + Q_ARG(QString, text)); return ret; } static bool IsFileInUse(const wstring &file) { WinHandle f = CreateFile(file.c_str(), GENERIC_WRITE, 0, nullptr, - OPEN_EXISTING, 0, nullptr); + OPEN_EXISTING, 0, nullptr); if (!f.Valid()) { int err = GetLastError(); if (err == ERROR_SHARING_VIOLATION || @@ -557,35 +520,33 @@ static bool IsGameCaptureInUse() { wstring path = L"..\\..\\data\\obs-plugins\\win-capture\\graphics-hook"; - return IsFileInUse(path + L"32.dll") || - IsFileInUse(path + L"64.dll"); + return IsFileInUse(path + L"32.dll") || IsFileInUse(path + L"64.dll"); } void AutoUpdateThread::run() try { - long responseCode; + long responseCode; vector<string> extraHeaders; - string text; - string error; - string signature; - CryptProvider localProvider; - BYTE manifestHash[BLAKE2_HASH_LENGTH]; - bool updatesAvailable = false; - bool success; + string text; + string error; + string signature; + CryptProvider localProvider; + BYTE manifestHash[BLAKE2_HASH_LENGTH]; + bool updatesAvailable = false; + bool success; struct FinishedTrigger { inline ~FinishedTrigger() { QMetaObject::invokeMethod(App()->GetMainWindow(), - "updateCheckFinished"); + "updateCheckFinished"); } } finishedTrigger; - BPtr<char> manifestPath = GetConfigPathPtr( - "obs-studio\\updates\\manifest.json"); + BPtr<char> manifestPath = + GetConfigPathPtr("obs-studio\\updates\\manifest.json"); - auto ActiveOrGameCaptureLocked = [this] () - { + auto ActiveOrGameCaptureLocked = [this]() { if (obs_video_active()) { if (manualUpdate) info(QTStr("Updater.Running.Title"), @@ -611,11 +572,8 @@ /* ----------------------------------- * * create signature provider */ - if (!CryptAcquireContext(&localProvider, - nullptr, - MS_ENH_RSA_AES_PROV, - PROV_RSA_AES, - CRYPT_VERIFYCONTEXT)) + if (!CryptAcquireContext(&localProvider, nullptr, MS_ENH_RSA_AES_PROV, + PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) throw strprintf("CryptAcquireContext failed: %lu", GetLastError()); @@ -647,13 +605,14 @@ * get manifest from server */ success = GetRemoteFile(WIN_MANIFEST_URL, text, error, &responseCode, - nullptr, nullptr, extraHeaders, &signature); + nullptr, nullptr, extraHeaders, &signature); if (!success || (responseCode != 200 && responseCode != 304)) { if (responseCode == 404) return; - throw strprintf("Failed to fetch manifest file: %s", error.c_str()); + throw strprintf("Failed to fetch manifest file: %s", + error.c_str()); } /* ----------------------------------- * @@ -661,8 +620,8 @@ /* a new file must be digitally signed */ if (responseCode == 200) { - success = CheckDataSignature(text, "manifest", - signature.data(), signature.size()); + success = CheckDataSignature(text, "manifest", signature.data(), + signature.size()); if (!success) throw string("Invalid manifest signature"); } @@ -687,7 +646,7 @@ int updateVer = 0; success = ParseUpdateManifest(text.c_str(), &updatesAvailable, notes, - updateVer); + updateVer); if (!success) throw string("Failed to parse manifest"); @@ -702,7 +661,7 @@ * skip this version if set to skip */ int skipUpdateVer = config_get_int(GetGlobalConfig(), "General", - "SkipUpdateVersion"); + "SkipUpdateVersion"); if (!manualUpdate && updateVer == skipUpdateVer) return; @@ -727,13 +686,13 @@ if (!manualUpdate) { long long t = (long long)time(nullptr); config_set_int(GetGlobalConfig(), "General", - "LastUpdateCheck", t); + "LastUpdateCheck", t); } return; } else if (queryResult == OBSUpdate::Skip) { config_set_int(GetGlobalConfig(), "General", - "SkipUpdateVersion", updateVer); + "SkipUpdateVersion", updateVer); return; } @@ -749,8 +708,8 @@ /* ----------------------------------- * * execute updater */ - BPtr<char> updateFilePath = GetConfigPathPtr( - "obs-studio\\updates\\updater.exe"); + BPtr<char> updateFilePath = + GetConfigPathPtr("obs-studio\\updates\\updater.exe"); BPtr<wchar_t> wUpdateFilePath; size_t size = os_utf8_to_wcs_ptr(updateFilePath, 0, &wUpdateFilePath); @@ -773,7 +732,7 @@ execInfo.lpParameters = UPDATE_ARG_SUFFIX; execInfo.lpDirectory = cwd; - execInfo.nShow = SW_SHOWNORMAL; + execInfo.nShow = SW_SHOWNORMAL; if (!ShellExecuteEx(&execInfo)) { QString msg = QTStr("Updater.FailedToLaunch"); @@ -787,11 +746,11 @@ config_set_int(GetGlobalConfig(), "General", "LastUpdateCheck", 0); config_set_int(GetGlobalConfig(), "General", "SkipUpdateVersion", 0); config_set_string(GetGlobalConfig(), "General", "InstallGUID", - guid.c_str()); + guid.c_str()); QMetaObject::invokeMethod(App()->GetMainWindow(), "close"); -} catch (string text) { +} catch (string &text) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str()); } @@ -799,26 +758,23 @@ void WhatsNewInfoThread::run() try { - long responseCode; + long responseCode; vector<string> extraHeaders; - string text; - string error; - string signature; - CryptProvider localProvider; - BYTE whatsnewHash[BLAKE2_HASH_LENGTH]; - bool success; + string text; + string error; + string signature; + CryptProvider localProvider; + BYTE whatsnewHash[BLAKE2_HASH_LENGTH]; + bool success; - BPtr<char> whatsnewPath = GetConfigPathPtr( - "obs-studio\\updates\\whatsnew.json"); + BPtr<char> whatsnewPath = + GetConfigPathPtr("obs-studio\\updates\\whatsnew.json"); /* ----------------------------------- * * create signature provider */ - if (!CryptAcquireContext(&localProvider, - nullptr, - MS_ENH_RSA_AES_PROV, - PROV_RSA_AES, - CRYPT_VERIFYCONTEXT)) + if (!CryptAcquireContext(&localProvider, nullptr, MS_ENH_RSA_AES_PROV, + PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) throw strprintf("CryptAcquireContext failed: %lu", GetLastError()); @@ -851,7 +807,7 @@ * get json from server */ success = GetRemoteFile(WIN_WHATSNEW_URL, text, error, &responseCode, - nullptr, nullptr, extraHeaders, &signature); + nullptr, nullptr, extraHeaders, &signature); if (!success || (responseCode != 200 && responseCode != 304)) { if (responseCode == 404) @@ -865,8 +821,8 @@ * verify file signature */ if (responseCode == 200) { - success = CheckDataSignature(text, "whatsnew", - signature.data(), signature.size()); + success = CheckDataSignature(text, "whatsnew", signature.data(), + signature.size()); if (!success) throw string("Invalid whatsnew signature"); } @@ -889,6 +845,6 @@ emit Result(QString::fromUtf8(text.c_str())); -} catch (string text) { +} catch (string &text) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, text.c_str()); }
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-about.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-about.cpp
Changed
@@ -9,9 +9,7 @@ using namespace json11; -OBSAbout::OBSAbout(QWidget *parent) - : QDialog(parent), - ui(new Ui::OBSAbout) +OBSAbout::OBSAbout(QWidget *parent) : QDialog(parent), ui(new Ui::OBSAbout) { ui->setupUi(this); @@ -20,29 +18,30 @@ QString bitness; QString ver; - if(sizeof(void*) == 4) + if (sizeof(void *) == 4) bitness = " (32 bit)"; - else if(sizeof(void*) == 8) + else if (sizeof(void *) == 8) bitness = " (64 bit)"; #ifdef HAVE_OBSCONFIG_H - ver += OBS_VERSION; + ver += OBS_VERSION; #else - ver += LIBOBS_API_MAJOR_VER + "." + - LIBOBS_API_MINOR_VER + "." + - LIBOBS_API_PATCH_VER; + ver += LIBOBS_API_MAJOR_VER + "." + LIBOBS_API_MINOR_VER + "." + + LIBOBS_API_PATCH_VER; #endif ui->version->setText(ver + bitness); ui->contribute->setText(QTStr("About.Contribute")); - ui->donate->setText(" <a href='https://obsproject.com/donate'>" + - QTStr("About.Donate") + "</a>"); + ui->donate->setText( + " <a href='https://obsproject.com/donate'>" + + QTStr("About.Donate") + "</a>"); ui->donate->setTextInteractionFlags(Qt::TextBrowserInteraction); ui->donate->setOpenExternalLinks(true); - ui->getInvolved->setText(" <a href='https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst'>" + - QTStr("About.GetInvolved") + "</a>"); + ui->getInvolved->setText( + " <a href='https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst'>" + + QTStr("About.GetInvolved") + "</a>"); ui->getInvolved->setTextInteractionFlags(Qt::TextBrowserInteraction); ui->getInvolved->setOpenExternalLinks(true); @@ -66,12 +65,14 @@ OBSBasic *main = OBSBasic::Get(); if (main->patronJson.empty() && !main->patronJsonThread) { RemoteTextThread *thread = new RemoteTextThread( - "https://obsproject.com/patreon/about-box.json", - "application/json"); - QObject::connect(thread, &RemoteTextThread::Result, - main, &OBSBasic::UpdatePatronJson); - QObject::connect(thread, SIGNAL(Result(const QString &, const QString &)), - this, SLOT(ShowAbout())); + "https://obsproject.com/patreon/about-box.json", + "application/json"); + QObject::connect(thread, &RemoteTextThread::Result, main, + &OBSBasic::UpdatePatronJson); + QObject::connect( + thread, + SIGNAL(Result(const QString &, const QString &)), this, + SLOT(ShowAbout())); main->patronJsonThread.reset(thread); thread->start(); } else {
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-adv-audio.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-adv-audio.cpp
Changed
@@ -16,9 +16,9 @@ OBSBasicAdvAudio::OBSBasicAdvAudio(QWidget *parent) : QDialog(parent), sourceAddedSignal(obs_get_signal_handler(), "source_activate", - OBSSourceAdded, this), + OBSSourceAdded, this), sourceRemovedSignal(obs_get_signal_handler(), "source_deactivate", - OBSSourceRemoved, this) + OBSSourceRemoved, this) { QScrollArea *scrollArea; QVBoxLayout *vlayout; @@ -29,33 +29,33 @@ mainLayout = new QGridLayout; mainLayout->setContentsMargins(0, 0, 0, 0); label = new QLabel(QTStr("Basic.AdvAudio.Name")); - label->setAlignment(Qt::AlignHCenter); + label->setStyleSheet("font-weight: bold;"); mainLayout->addWidget(label, 0, idx++); label = new QLabel(QTStr("Basic.AdvAudio.Volume")); - label->setAlignment(Qt::AlignHCenter); + label->setStyleSheet("font-weight: bold;"); mainLayout->addWidget(label, 0, idx++); label = new QLabel(QTStr("Basic.AdvAudio.Mono")); - label->setAlignment(Qt::AlignHCenter); + label->setStyleSheet("font-weight: bold;"); mainLayout->addWidget(label, 0, idx++); label = new QLabel(QTStr("Basic.AdvAudio.Balance")); - label->setAlignment(Qt::AlignHCenter); + label->setStyleSheet("font-weight: bold;"); mainLayout->addWidget(label, 0, idx++); label = new QLabel(QTStr("Basic.AdvAudio.SyncOffset")); - label->setAlignment(Qt::AlignHCenter); + label->setStyleSheet("font-weight: bold;"); mainLayout->addWidget(label, 0, idx++); #if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO label = new QLabel(QTStr("Basic.AdvAudio.Monitoring")); - label->setAlignment(Qt::AlignHCenter); + label->setStyleSheet("font-weight: bold;"); mainLayout->addWidget(label, 0, idx++); #endif label = new QLabel(QTStr("Basic.AdvAudio.AudioTracks")); - label->setAlignment(Qt::AlignHCenter); + label->setStyleSheet("font-weight: bold;"); mainLayout->addWidget(label, 0, idx++); controlArea = new QWidget; controlArea->setLayout(mainLayout); controlArea->setSizePolicy(QSizePolicy::Preferred, - QSizePolicy::Preferred); + QSizePolicy::Preferred); vlayout = new QVBoxLayout; vlayout->addWidget(controlArea); @@ -80,14 +80,14 @@ vlayout->addLayout(buttonLayout); setLayout(vlayout); - connect(closeButton, &QPushButton::clicked, [this] () {close();}); + connect(closeButton, &QPushButton::clicked, [this]() { close(); }); installEventFilter(CreateShortcutFilter()); /* enum user scene/sources */ obs_enum_sources(EnumSources, this); - resize(1000, 340); + resize(1100, 340); setWindowTitle(QTStr("Basic.AdvAudio")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setSizeGripEnabled(true); @@ -97,7 +97,7 @@ OBSBasicAdvAudio::~OBSBasicAdvAudio() { - OBSBasic *main = reinterpret_cast<OBSBasic*>(parent()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(parent()); for (size_t i = 0; i < controls.size(); ++i) delete controls[i]; @@ -107,7 +107,7 @@ bool OBSBasicAdvAudio::EnumSources(void *param, obs_source_t *source) { - OBSBasicAdvAudio *dialog = reinterpret_cast<OBSBasicAdvAudio*>(param); + OBSBasicAdvAudio *dialog = reinterpret_cast<OBSBasicAdvAudio *>(param); uint32_t flags = obs_source_get_output_flags(source); if ((flags & OBS_SOURCE_AUDIO) != 0 && obs_source_active(source)) @@ -118,18 +118,18 @@ void OBSBasicAdvAudio::OBSSourceAdded(void *param, calldata_t *calldata) { - OBSSource source((obs_source_t*)calldata_ptr(calldata, "source")); + OBSSource source((obs_source_t *)calldata_ptr(calldata, "source")); - QMetaObject::invokeMethod(reinterpret_cast<OBSBasicAdvAudio*>(param), - "SourceAdded", Q_ARG(OBSSource, source)); + QMetaObject::invokeMethod(reinterpret_cast<OBSBasicAdvAudio *>(param), + "SourceAdded", Q_ARG(OBSSource, source)); } void OBSBasicAdvAudio::OBSSourceRemoved(void *param, calldata_t *calldata) { - OBSSource source((obs_source_t*)calldata_ptr(calldata, "source")); + OBSSource source((obs_source_t *)calldata_ptr(calldata, "source")); - QMetaObject::invokeMethod(reinterpret_cast<OBSBasicAdvAudio*>(param), - "SourceRemoved", Q_ARG(OBSSource, source)); + QMetaObject::invokeMethod(reinterpret_cast<OBSBasicAdvAudio *>(param), + "SourceRemoved", Q_ARG(OBSSource, source)); } inline void OBSBasicAdvAudio::AddAudioSource(obs_source_t *source)
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-adv-audio.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-adv-audio.hpp
Changed
@@ -18,7 +18,7 @@ OBSSignal sourceAddedSignal; OBSSignal sourceRemovedSignal; - std::vector<OBSAdvAudioCtrl*> controls; + std::vector<OBSAdvAudioCtrl *> controls; inline void AddAudioSource(obs_source_t *source);
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-auto-config-test.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-auto-config-test.cpp
Changed
@@ -15,7 +15,7 @@ #include "ui_AutoConfigTestPage.h" -#define wiz reinterpret_cast<AutoConfig*>(wizard()) +#define wiz reinterpret_cast<AutoConfig *>(wizard()) using namespace std; @@ -31,17 +31,14 @@ gs_eparam_t *randomvals[3] = { gs_effect_get_param_by_name(solid, "randomvals1"), gs_effect_get_param_by_name(solid, "randomvals2"), - gs_effect_get_param_by_name(solid, "randomvals3") - }; + gs_effect_get_param_by_name(solid, "randomvals3")}; struct vec4 r; for (int i = 0; i < 3; i++) { - vec4_set(&r, - rand_float(true) * 100.0f, - rand_float(true) * 100.0f, - rand_float(true) * 50000.0f + 10000.0f, - 0.0f); + vec4_set(&r, rand_float(true) * 100.0f, + rand_float(true) * 100.0f, + rand_float(true) * 50000.0f + 10000.0f, 0.0f); gs_effect_set_vec4(randomvals[i], &r); } @@ -86,37 +83,37 @@ /* ------------------------------------------------------------------------- */ -#define TEST_STR(x) "Basic.AutoConfig.TestPage." x -#define SUBTITLE_TESTING TEST_STR("Subtitle.Testing") -#define SUBTITLE_COMPLETE TEST_STR("Subtitle.Complete") -#define TEST_BW TEST_STR("TestingBandwidth") -#define TEST_BW_CONNECTING TEST_STR("TestingBandwidth.Connecting") -#define TEST_BW_CONNECT_FAIL TEST_STR("TestingBandwidth.ConnectFailed") -#define TEST_BW_SERVER TEST_STR("TestingBandwidth.Server") -#define TEST_RES TEST_STR("TestingRes") -#define TEST_RES_VAL TEST_STR("TestingRes.Resolution") -#define TEST_RES_FAIL TEST_STR("TestingRes.Fail") -#define TEST_SE TEST_STR("TestingStreamEncoder") -#define TEST_RE TEST_STR("TestingRecordingEncoder") -#define TEST_RESULT_SE TEST_STR("Result.StreamingEncoder") -#define TEST_RESULT_RE TEST_STR("Result.RecordingEncoder") +#define TEST_STR(x) "Basic.AutoConfig.TestPage." x +#define SUBTITLE_TESTING TEST_STR("Subtitle.Testing") +#define SUBTITLE_COMPLETE TEST_STR("Subtitle.Complete") +#define TEST_BW TEST_STR("TestingBandwidth") +#define TEST_BW_CONNECTING TEST_STR("TestingBandwidth.Connecting") +#define TEST_BW_CONNECT_FAIL TEST_STR("TestingBandwidth.ConnectFailed") +#define TEST_BW_SERVER TEST_STR("TestingBandwidth.Server") +#define TEST_RES TEST_STR("TestingRes") +#define TEST_RES_VAL TEST_STR("TestingRes.Resolution") +#define TEST_RES_FAIL TEST_STR("TestingRes.Fail") +#define TEST_SE TEST_STR("TestingStreamEncoder") +#define TEST_RE TEST_STR("TestingRecordingEncoder") +#define TEST_RESULT_SE TEST_STR("Result.StreamingEncoder") +#define TEST_RESULT_RE TEST_STR("Result.RecordingEncoder") void AutoConfigTestPage::StartBandwidthStage() { ui->progressLabel->setText(QTStr(TEST_BW)); - testThread = std::thread([this] () {TestBandwidthThread();}); + testThread = std::thread([this]() { TestBandwidthThread(); }); } void AutoConfigTestPage::StartStreamEncoderStage() { ui->progressLabel->setText(QTStr(TEST_SE)); - testThread = std::thread([this] () {TestStreamEncoderThread();}); + testThread = std::thread([this]() { TestStreamEncoderThread(); }); } void AutoConfigTestPage::StartRecordingEncoderStage() { ui->progressLabel->setText(QTStr(TEST_RE)); - testThread = std::thread([this] () {TestRecordingEncoderThread();}); + testThread = std::thread([this]() { TestRecordingEncoderThread(); }); } void AutoConfigTestPage::GetServers(std::vector<ServerInfo> &servers) @@ -176,21 +173,20 @@ */ QMetaObject::invokeMethod(this, "UpdateMessage", - Q_ARG(QString, QStringLiteral(""))); + Q_ARG(QString, QStringLiteral(""))); /* -----------------------------------*/ /* create obs objects */ - const char *serverType = wiz->customServer - ? "rtmp_custom" - : "rtmp_common"; + const char *serverType = wiz->customServer ? "rtmp_custom" + : "rtmp_common"; - OBSEncoder vencoder = obs_video_encoder_create("obs_x264", - "test_x264", nullptr, nullptr); - OBSEncoder aencoder = obs_audio_encoder_create("ffmpeg_aac", - "test_aac", nullptr, 0, nullptr); - OBSService service = obs_service_create(serverType, - "test_service", nullptr, nullptr); + OBSEncoder vencoder = obs_video_encoder_create("obs_x264", "test_x264", + nullptr, nullptr); + OBSEncoder aencoder = obs_audio_encoder_create("ffmpeg_aac", "test_aac", + nullptr, 0, nullptr); + OBSService service = obs_service_create(serverType, "test_service", + nullptr, nullptr); obs_encoder_release(vencoder); obs_encoder_release(aencoder); obs_service_release(service); @@ -218,14 +214,17 @@ if (wiz->service == AutoConfig::Service::Twitch) { string_depad_key(key); key += "?bandwidthtest"; - } - else if(wiz->serviceName == "Restream.io" || wiz->serviceName == "Restream.io - RTMP") { + } else if (wiz->serviceName == "Restream.io" || + wiz->serviceName == "Restream.io - RTMP") { string_depad_key(key); key += "?test=true"; + } else if (wiz->serviceName == "Restream.io - FTL") { + string_depad_key(key); + key += "?test"; } obs_data_set_string(service_settings, "service", - wiz->serviceName.c_str()); + wiz->serviceName.c_str()); obs_data_set_string(service_settings, "key", key.c_str()); obs_data_set_int(vencoder_settings, "bitrate", wiz->startingBitrate); @@ -235,9 +234,9 @@ obs_data_set_int(aencoder_settings, "bitrate", 32); - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); - const char *bind_ip = config_get_string(main->Config(), "Output", - "BindIP"); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); + const char *bind_ip = + config_get_string(main->Config(), "Output", "BindIP"); obs_data_set_string(output_settings, "bind_ip", bind_ip); /* -----------------------------------*/ @@ -251,12 +250,12 @@ /* just use the first server if it only has one alternate server, * or if using Mixer or Restream due to their "auto" servers */ - if (servers.size() < 3 || wiz->serviceName == "Mixer.com - FTL" || - wiz->serviceName.substr(0, 11)=="Restream.io") { + if (servers.size() < 3 || wiz->serviceName == "Mixer.com - FTL" || + wiz->serviceName.substr(0, 11) == "Restream.io") { servers.resize(1); } else if (wiz->service == AutoConfig::Service::Twitch && - wiz->twitchAuto) { + wiz->twitchAuto) { /* if using Twitch and "Auto" is available, test 3 closest * server */ servers.erase(servers.begin() + 1); @@ -267,8 +266,8 @@ /* apply service settings */ obs_service_update(service, service_settings); - obs_service_apply_encoder_settings(service, - vencoder_settings, aencoder_settings); + obs_service_apply_encoder_settings(service, vencoder_settings, + aencoder_settings); /* -----------------------------------*/ /* create output */ @@ -277,18 +276,17 @@ if (!output_type) output_type = "rtmp_output"; - OBSOutput output = obs_output_create(output_type, - "test_stream", nullptr, nullptr); + OBSOutput output = + obs_output_create(output_type, "test_stream", nullptr, nullptr); obs_output_release(output); obs_output_update(output, output_settings); - const char *audio_codec = - obs_output_get_supported_audio_codecs(output); + const char *audio_codec = obs_output_get_supported_audio_codecs(output); if (strcmp(audio_codec, "aac") != 0) { const char *id = FindAudioEncoderFromCodec(audio_codec); - aencoder = obs_audio_encoder_create(id, - "test_audio", nullptr, 0, nullptr); + aencoder = obs_audio_encoder_create(id, "test_audio", nullptr, + 0, nullptr); obs_encoder_release(aencoder); } @@ -308,16 +306,14 @@ /* -----------------------------------*/ /* connect signals */ - auto on_started = [&] () - { + auto on_started = [&]() { unique_lock<mutex> lock(m); connected = true; stopped = false; cv.notify_one(); }; - auto on_stopped = [&] () - { + auto on_stopped = [&]() { unique_lock<mutex> lock(m); connected = false; stopped = true; @@ -327,17 +323,15 @@ using on_started_t = decltype(on_started); using on_stopped_t = decltype(on_stopped); - auto pre_on_started = [] (void *data, calldata_t *) - { + auto pre_on_started = [](void *data, calldata_t *) { on_started_t &on_started = - *reinterpret_cast<on_started_t*>(data); + *reinterpret_cast<on_started_t *>(data); on_started(); }; - auto pre_on_stopped = [] (void *data, calldata_t *) - { + auto pre_on_stopped = [](void *data, calldata_t *) { on_stopped_t &on_stopped = - *reinterpret_cast<on_stopped_t*>(data); + *reinterpret_cast<on_stopped_t *>(data); on_stopped(); }; @@ -358,12 +352,13 @@ int per = int((i + 1) * 100 / servers.size()); QMetaObject::invokeMethod(this, "Progress", Q_ARG(int, per)); - QMetaObject::invokeMethod(this, "UpdateMessage", - Q_ARG(QString, QTStr(TEST_BW_CONNECTING) - .arg(server.name.c_str()))); + QMetaObject::invokeMethod( + this, "UpdateMessage", + Q_ARG(QString, QTStr(TEST_BW_CONNECTING) + .arg(server.name.c_str()))); obs_data_set_string(service_settings, "server", - server.address.c_str()); + server.address.c_str()); obs_service_update(service, service_settings); if (!obs_output_start(output)) @@ -385,9 +380,10 @@ if (!connected) continue; - QMetaObject::invokeMethod(this, "UpdateMessage", - Q_ARG(QString, QTStr(TEST_BW_SERVER) - .arg(server.name.c_str()))); + QMetaObject::invokeMethod( + this, "UpdateMessage", + Q_ARG(QString, + QTStr(TEST_BW_SERVER).arg(server.name.c_str()))); /* ignore first 2.5 seconds due to possible buffering skewing * the result */ @@ -418,10 +414,10 @@ uint64_t total_time = os_gettime_ns() - t_start; - int total_bytes = (int)obs_output_get_total_bytes(output) - - start_bytes; - uint64_t bitrate = (uint64_t)total_bytes * 8 - * 1000000000 / total_time / 1000; + int total_bytes = + (int)obs_output_get_total_bytes(output) - start_bytes; + uint64_t bitrate = (uint64_t)total_bytes * 8 * 1000000000 / + total_time / 1000; if (obs_output_get_frames_dropped(output) || (int)bitrate < (wiz->startingBitrate * 75 / 100)) { @@ -436,7 +432,8 @@ if (!success) { QMetaObject::invokeMethod(this, "Failure", - Q_ARG(QString, QTStr(TEST_BW_CONNECT_FAIL))); + Q_ARG(QString, + QTStr(TEST_BW_CONNECT_FAIL))); return; } @@ -480,7 +477,8 @@ return EstimateBitrateVal(cx, cy, fps_num, fps_den) / val; } -static long double EstimateUpperBitrate(int cx, int cy, int fps_num, int fps_den) +static long double EstimateUpperBitrate(int cx, int cy, int fps_num, + int fps_den) { long double val = EstimateBitrateVal(1280, 720, 30, 1) / 3000.0l; return EstimateBitrateVal(cx, cy, fps_num, fps_den) / val; @@ -520,17 +518,17 @@ { TestMode testMode; QMetaObject::invokeMethod(this, "UpdateMessage", - Q_ARG(QString, QStringLiteral(""))); + Q_ARG(QString, QStringLiteral(""))); /* -----------------------------------*/ /* create obs objects */ - OBSEncoder vencoder = obs_video_encoder_create("obs_x264", - "test_x264", nullptr, nullptr); - OBSEncoder aencoder = obs_audio_encoder_create("ffmpeg_aac", - "test_aac", nullptr, 0, nullptr); - OBSOutput output = obs_output_create("null_output", - "null", nullptr, nullptr); + OBSEncoder vencoder = obs_video_encoder_create("obs_x264", "test_x264", + nullptr, nullptr); + OBSEncoder aencoder = obs_audio_encoder_create("ffmpeg_aac", "test_aac", + nullptr, 0, nullptr); + OBSOutput output = + obs_output_create("null_output", "null", nullptr, nullptr); obs_output_release(output); obs_encoder_release(vencoder); obs_encoder_release(aencoder); @@ -547,7 +545,7 @@ if (wiz->type != AutoConfig::Type::Recording) { obs_data_set_int(vencoder_settings, "keyint_sec", 2); obs_data_set_int(vencoder_settings, "bitrate", - wiz->idealBitrate); + wiz->idealBitrate); obs_data_set_string(vencoder_settings, "rate_control", "CBR"); obs_data_set_string(vencoder_settings, "profile", "main"); obs_data_set_string(vencoder_settings, "preset", "veryfast"); @@ -573,18 +571,16 @@ /* -----------------------------------*/ /* connect signals */ - auto on_stopped = [&] () - { + auto on_stopped = [&]() { unique_lock<mutex> lock(m); cv.notify_one(); }; using on_stopped_t = decltype(on_stopped); - auto pre_on_stopped = [] (void *data, calldata_t *) - { + auto pre_on_stopped = [](void *data, calldata_t *) { on_stopped_t &on_stopped = - *reinterpret_cast<on_stopped_t*>(data); + *reinterpret_cast<on_stopped_t *>(data); on_stopped(); }; @@ -628,9 +624,8 @@ int i = 0; int count = 1; - auto testRes = [&] (long double div, int fps_num, int fps_den, - bool force) - { + auto testRes = [&](long double div, int fps_num, int fps_den, + bool force) { int per = ++i * 100 / count; QMetaObject::invokeMethod(this, "Progress", Q_ARG(int, per)); @@ -669,13 +664,13 @@ QString cxStr = QString::number(cx); QString cyStr = QString::number(cy); - QString fpsStr = (fps_den > 1) - ? QString::number(fps, 'f', 2) - : QString::number(fps, 'g', 2); + QString fpsStr = (fps_den > 1) ? QString::number(fps, 'f', 2) + : QString::number(fps, 'g', 2); - QMetaObject::invokeMethod(this, "UpdateMessage", - Q_ARG(QString, QTStr(TEST_RES_VAL) - .arg(cxStr, cyStr, fpsStr))); + QMetaObject::invokeMethod( + this, "UpdateMessage", + Q_ARG(QString, + QTStr(TEST_RES_VAL).arg(cxStr, cyStr, fpsStr))); unique_lock<mutex> ul(m); if (cancel) @@ -683,7 +678,8 @@ if (!obs_output_start(output)) { QMetaObject::invokeMethod(this, "Failure", - Q_ARG(QString, QTStr(TEST_RES_FAIL))); + Q_ARG(QString, + QTStr(TEST_RES_FAIL))); return false; } @@ -692,8 +688,8 @@ obs_output_stop(output); cv.wait(ul); - int skipped = (int)video_output_get_skipped_frames( - obs_get_video()); + int skipped = + (int)video_output_get_skipped_frames(obs_get_video()); if (force || skipped <= 10) results.emplace_back(cx, cy, fps_num, fps_den); @@ -702,23 +698,38 @@ if (wiz->specificFPSNum && wiz->specificFPSDen) { count = 5; - if (!testRes(1.0, 0, 0, false)) return false; - if (!testRes(1.5, 0, 0, false)) return false; - if (!testRes(1.0 / 0.6, 0, 0, false)) return false; - if (!testRes(2.0, 0, 0, false)) return false; - if (!testRes(2.25, 0, 0, true)) return false; + if (!testRes(1.0, 0, 0, false)) + return false; + if (!testRes(1.5, 0, 0, false)) + return false; + if (!testRes(1.0 / 0.6, 0, 0, false)) + return false; + if (!testRes(2.0, 0, 0, false)) + return false; + if (!testRes(2.25, 0, 0, true)) + return false; } else { count = 10; - if (!testRes(1.0, 60, 1, false)) return false; - if (!testRes(1.0, 30, 1, false)) return false; - if (!testRes(1.5, 60, 1, false)) return false; - if (!testRes(1.5, 30, 1, false)) return false; - if (!testRes(1.0 / 0.6, 60, 1, false)) return false; - if (!testRes(1.0 / 0.6, 30, 1, false)) return false; - if (!testRes(2.0, 60, 1, false)) return false; - if (!testRes(2.0, 30, 1, false)) return false; - if (!testRes(2.25, 60, 1, false)) return false; - if (!testRes(2.25, 30, 1, true)) return false; + if (!testRes(1.0, 60, 1, false)) + return false; + if (!testRes(1.0, 30, 1, false)) + return false; + if (!testRes(1.5, 60, 1, false)) + return false; + if (!testRes(1.5, 30, 1, false)) + return false; + if (!testRes(1.0 / 0.6, 60, 1, false)) + return false; + if (!testRes(1.0 / 0.6, 30, 1, false)) + return false; + if (!testRes(2.0, 60, 1, false)) + return false; + if (!testRes(2.0, 30, 1, false)) + return false; + if (!testRes(2.25, 60, 1, false)) + return false; + if (!testRes(2.25, 30, 1, true)) + return false; } /* -----------------------------------*/ @@ -744,7 +755,7 @@ wiz->idealFPSDen = result.fps_den; long double fUpperBitrate = EstimateUpperBitrate( - result.cx, result.cy, result.fps_num, result.fps_den); + result.cx, result.cy, result.fps_num, result.fps_den); int upperBitrate = int(floor(fUpperBitrate / 50.0l) * 50.0l); @@ -776,9 +787,8 @@ maxDataRate = 1280 * 720 * 30 + 1000; } - auto testRes = [&] (long double div, int fps_num, int fps_den, - bool force) - { + auto testRes = [&](long double div, int fps_num, int fps_den, + bool force) { if (results.size() >= 3) return; @@ -805,7 +815,8 @@ * ratio, so increase the minimum bitrate estimate for them. * NVENC currently is the exception because of the improvements * its made to its quality in recent generations. */ - if (!nvenc) minBitrate = minBitrate * 114 / 100; + if (!nvenc) + minBitrate = minBitrate * 114 / 100; if (wiz->type == AutoConfig::Type::Recording) force = true; @@ -919,9 +930,9 @@ #define ENCODER_TEXT(x) "Basic.Settings.Output.Simple.Encoder." x #define ENCODER_SOFTWARE ENCODER_TEXT("Software") -#define ENCODER_NVENC ENCODER_TEXT("Hardware.NVENC") -#define ENCODER_QSV ENCODER_TEXT("Hardware.QSV") -#define ENCODER_AMD ENCODER_TEXT("Hardware.AMD") +#define ENCODER_NVENC ENCODER_TEXT("Hardware.NVENC") +#define ENCODER_QSV ENCODER_TEXT("Hardware.QSV") +#define ENCODER_AMD ENCODER_TEXT("Hardware.AMD") #define QUALITY_SAME "Basic.Settings.Output.Simple.RecordingQuality.Stream" #define QUALITY_HIGH "Basic.Settings.Output.Simple.RecordingQuality.Small" @@ -933,8 +944,7 @@ QFormLayout *form = results; - auto encName = [] (AutoConfig::Encoder enc) -> QString - { + auto encName = [](AutoConfig::Encoder enc) -> QString { switch (enc) { case AutoConfig::Encoder::x264: return QTStr(ENCODER_SOFTWARE); @@ -951,18 +961,16 @@ return QTStr(ENCODER_SOFTWARE); }; - auto newLabel = [this] (const char *str) -> QLabel * - { + auto newLabel = [this](const char *str) -> QLabel * { return new QLabel(QTStr(str), this); }; if (wiz->type != AutoConfig::Type::Recording) { - const char *serverType = wiz->customServer - ? "rtmp_custom" - : "rtmp_common"; + const char *serverType = wiz->customServer ? "rtmp_custom" + : "rtmp_common"; - OBSService service = obs_service_create(serverType, - "temp_service", nullptr, nullptr); + OBSService service = obs_service_create( + serverType, "temp_service", nullptr, nullptr); obs_service_release(service); OBSData service_settings = obs_data_create(); @@ -971,44 +979,45 @@ obs_data_release(vencoder_settings); obs_data_set_int(vencoder_settings, "bitrate", - wiz->idealBitrate); + wiz->idealBitrate); obs_data_set_string(service_settings, "service", - wiz->serviceName.c_str()); + wiz->serviceName.c_str()); obs_service_update(service, service_settings); - obs_service_apply_encoder_settings(service, - vencoder_settings, nullptr); + obs_service_apply_encoder_settings(service, vencoder_settings, + nullptr); - wiz->idealBitrate = (int)obs_data_get_int(vencoder_settings, - "bitrate"); + wiz->idealBitrate = + (int)obs_data_get_int(vencoder_settings, "bitrate"); if (!wiz->customServer) form->addRow( newLabel("Basic.AutoConfig.StreamPage.Service"), new QLabel(wiz->serviceName.c_str(), - ui->finishPage)); + ui->finishPage)); form->addRow(newLabel("Basic.AutoConfig.StreamPage.Server"), - new QLabel(wiz->serverName.c_str(), ui->finishPage)); + new QLabel(wiz->serverName.c_str(), + ui->finishPage)); form->addRow(newLabel("Basic.Settings.Output.VideoBitrate"), - new QLabel(QString::number(wiz->idealBitrate), - ui->finishPage)); + new QLabel(QString::number(wiz->idealBitrate), + ui->finishPage)); form->addRow(newLabel(TEST_RESULT_SE), - new QLabel(encName(wiz->streamingEncoder), - ui->finishPage)); + new QLabel(encName(wiz->streamingEncoder), + ui->finishPage)); } - QString baseRes = QString("%1x%2").arg( - QString::number(wiz->baseResolutionCX), - QString::number(wiz->baseResolutionCY)); - QString scaleRes = QString("%1x%2").arg( - QString::number(wiz->idealResolutionCX), - QString::number(wiz->idealResolutionCY)); + QString baseRes = + QString("%1x%2").arg(QString::number(wiz->baseResolutionCX), + QString::number(wiz->baseResolutionCY)); + QString scaleRes = + QString("%1x%2").arg(QString::number(wiz->idealResolutionCX), + QString::number(wiz->idealResolutionCY)); if (wiz->recordingEncoder != AutoConfig::Encoder::Stream || wiz->recordingQuality != AutoConfig::Quality::Stream) form->addRow(newLabel(TEST_RESULT_RE), - new QLabel(encName(wiz->recordingEncoder), - ui->finishPage)); + new QLabel(encName(wiz->recordingEncoder), + ui->finishPage)); QString recQuality; @@ -1022,21 +1031,20 @@ } form->addRow(newLabel("Basic.Settings.Output.Simple.RecordingQuality"), - new QLabel(recQuality, ui->finishPage)); + new QLabel(recQuality, ui->finishPage)); long double fps = (long double)wiz->idealFPSNum / (long double)wiz->idealFPSDen; - QString fpsStr = (wiz->idealFPSDen > 1) - ? QString::number(fps, 'f', 2) - : QString::number(fps, 'g', 2); + QString fpsStr = (wiz->idealFPSDen > 1) ? QString::number(fps, 'f', 2) + : QString::number(fps, 'g', 2); form->addRow(newLabel("Basic.Settings.Video.BaseResolution"), - new QLabel(baseRes, ui->finishPage)); + new QLabel(baseRes, ui->finishPage)); form->addRow(newLabel("Basic.Settings.Video.ScaledResolution"), - new QLabel(scaleRes, ui->finishPage)); + new QLabel(scaleRes, ui->finishPage)); form->addRow(newLabel("Basic.Settings.Video.FPS"), - new QLabel(fpsStr, ui->finishPage)); + new QLabel(fpsStr, ui->finishPage)); } #define STARTING_SEPARATOR \ @@ -1103,8 +1111,7 @@ } AutoConfigTestPage::AutoConfigTestPage(QWidget *parent) - : QWizardPage (parent), - ui (new Ui_AutoConfigTestPage) + : QWizardPage(parent), ui(new Ui_AutoConfigTestPage) { ui->setupUi(this); setTitle(QTStr("Basic.AutoConfig.TestPage"));
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-auto-config.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-auto-config.cpp
Changed
@@ -20,10 +20,10 @@ struct QCef; struct QCefCookieManager; -extern QCef *cef; +extern QCef *cef; extern QCefCookieManager *panel_cookies; -#define wiz reinterpret_cast<AutoConfig*>(wizard()) +#define wiz reinterpret_cast<AutoConfig *>(wizard()) /* ------------------------------------------------------------------------- */ @@ -33,12 +33,12 @@ { char serviceJsonPath[512]; int ret = GetProfilePath(serviceJsonPath, sizeof(serviceJsonPath), - SERVICE_PATH); + SERVICE_PATH); if (ret <= 0) return OBSData(); - OBSData data = obs_data_create_from_json_file_safe(serviceJsonPath, - "bak"); + OBSData data = + obs_data_create_from_json_file_safe(serviceJsonPath, "bak"); obs_data_release(data); obs_data_set_default_string(data, "type", "rtmp_common"); @@ -51,7 +51,7 @@ } static void GetServiceInfo(std::string &type, std::string &service, - std::string &server, std::string &key) + std::string &server, std::string &key) { OBSData settings = OpenServiceSettings(type); @@ -63,8 +63,7 @@ /* ------------------------------------------------------------------------- */ AutoConfigStartPage::AutoConfigStartPage(QWidget *parent) - : QWizardPage (parent), - ui (new Ui_AutoConfigStartPage) + : QWizardPage(parent), ui(new Ui_AutoConfigStartPage) { ui->setupUi(this); setTitle(QTStr("Basic.AutoConfig.StartPage")); @@ -93,16 +92,15 @@ /* ------------------------------------------------------------------------- */ -#define RES_TEXT(x) "Basic.AutoConfig.VideoPage." x -#define RES_USE_CURRENT RES_TEXT("BaseResolution.UseCurrent") -#define RES_USE_DISPLAY RES_TEXT("BaseResolution.Display") -#define FPS_USE_CURRENT RES_TEXT("FPS.UseCurrent") -#define FPS_PREFER_HIGH_FPS RES_TEXT("FPS.PreferHighFPS") -#define FPS_PREFER_HIGH_RES RES_TEXT("FPS.PreferHighRes") +#define RES_TEXT(x) "Basic.AutoConfig.VideoPage." x +#define RES_USE_CURRENT RES_TEXT("BaseResolution.UseCurrent") +#define RES_USE_DISPLAY RES_TEXT("BaseResolution.Display") +#define FPS_USE_CURRENT RES_TEXT("FPS.UseCurrent") +#define FPS_PREFER_HIGH_FPS RES_TEXT("FPS.PreferHighFPS") +#define FPS_PREFER_HIGH_RES RES_TEXT("FPS.PreferHighRes") AutoConfigVideoPage::AutoConfigVideoPage(QWidget *parent) - : QWizardPage (parent), - ui (new Ui_AutoConfigVideoPage) + : QWizardPage(parent), ui(new Ui_AutoConfigVideoPage) { ui->setupUi(this); @@ -115,16 +113,15 @@ long double fpsVal = (long double)ovi.fps_num / (long double)ovi.fps_den; - QString fpsStr = (ovi.fps_den > 1) - ? QString::number(fpsVal, 'f', 2) - : QString::number(fpsVal, 'g', 2); + QString fpsStr = (ovi.fps_den > 1) ? QString::number(fpsVal, 'f', 2) + : QString::number(fpsVal, 'g', 2); ui->fps->addItem(QTStr(FPS_PREFER_HIGH_FPS), - (int)AutoConfig::FPSType::PreferHighFPS); + (int)AutoConfig::FPSType::PreferHighFPS); ui->fps->addItem(QTStr(FPS_PREFER_HIGH_RES), - (int)AutoConfig::FPSType::PreferHighRes); + (int)AutoConfig::FPSType::PreferHighRes); ui->fps->addItem(QTStr(FPS_USE_CURRENT).arg(fpsStr), - (int)AutoConfig::FPSType::UseCurrent); + (int)AutoConfig::FPSType::UseCurrent); ui->fps->addItem(QStringLiteral("30"), (int)AutoConfig::FPSType::fps30); ui->fps->addItem(QStringLiteral("60"), (int)AutoConfig::FPSType::fps60); ui->fps->setCurrentIndex(0); @@ -134,9 +131,9 @@ int encRes = int(ovi.base_width << 16) | int(ovi.base_height); ui->canvasRes->addItem(QTStr(RES_USE_CURRENT).arg(cxStr, cyStr), - (int)encRes); + (int)encRes); - QList<QScreen*> screens = QGuiApplication::screens(); + QList<QScreen *> screens = QGuiApplication::screens(); for (int i = 0; i < screens.size(); i++) { QScreen *screen = screens[i]; QSize as = screen->size(); @@ -144,19 +141,17 @@ encRes = int(as.width() << 16) | int(as.height()); QString str = QTStr(RES_USE_DISPLAY) - .arg(QString::number(i + 1), - QString::number(as.width()), - QString::number(as.height())); + .arg(QString::number(i + 1), + QString::number(as.width()), + QString::number(as.height())); ui->canvasRes->addItem(str, encRes); } - auto addRes = [&] (int cx, int cy) - { + auto addRes = [&](int cx, int cy) { encRes = (cx << 16) | cy; - QString str = QString("%1x%2").arg( - QString::number(cx), - QString::number(cy)); + QString str = QString("%1x%2").arg(QString::number(cx), + QString::number(cy)); ui->canvasRes->addItem(str, encRes); }; @@ -174,8 +169,8 @@ int AutoConfigVideoPage::nextId() const { return wiz->type == AutoConfig::Type::Recording - ? AutoConfig::TestPage - : AutoConfig::StreamPage; + ? AutoConfig::TestPage + : AutoConfig::StreamPage; } bool AutoConfigVideoPage::validatePage() @@ -223,12 +218,11 @@ enum class ListOpt : int { ShowAll = 1, - Custom + Custom, }; AutoConfigStreamPage::AutoConfigStreamPage(QWidget *parent) - : QWizardPage (parent), - ui (new Ui_AutoConfigStreamPage) + : QWizardPage(parent), ui(new Ui_AutoConfigStreamPage) { ui->setupUi(this); ui->bitrateLabel->setVisible(false); @@ -255,29 +249,29 @@ LoadServices(false); - connect(ui->service, SIGNAL(currentIndexChanged(int)), - this, SLOT(ServiceChanged())); - connect(ui->customServer, SIGNAL(textChanged(const QString &)), - this, SLOT(ServiceChanged())); - connect(ui->doBandwidthTest, SIGNAL(toggled(bool)), - this, SLOT(ServiceChanged())); + connect(ui->service, SIGNAL(currentIndexChanged(int)), this, + SLOT(ServiceChanged())); + connect(ui->customServer, SIGNAL(textChanged(const QString &)), this, + SLOT(ServiceChanged())); + connect(ui->doBandwidthTest, SIGNAL(toggled(bool)), this, + SLOT(ServiceChanged())); - connect(ui->service, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateServerList())); + connect(ui->service, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateServerList())); - connect(ui->service, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateKeyLink())); + connect(ui->service, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateKeyLink())); - connect(ui->key, SIGNAL(textChanged(const QString &)), - this, SLOT(UpdateCompleted())); - connect(ui->regionUS, SIGNAL(toggled(bool)), - this, SLOT(UpdateCompleted())); - connect(ui->regionEU, SIGNAL(toggled(bool)), - this, SLOT(UpdateCompleted())); - connect(ui->regionAsia, SIGNAL(toggled(bool)), - this, SLOT(UpdateCompleted())); - connect(ui->regionOther, SIGNAL(toggled(bool)), - this, SLOT(UpdateCompleted())); + connect(ui->key, SIGNAL(textChanged(const QString &)), this, + SLOT(UpdateCompleted())); + connect(ui->regionUS, SIGNAL(toggled(bool)), this, + SLOT(UpdateCompleted())); + connect(ui->regionEU, SIGNAL(toggled(bool)), this, + SLOT(UpdateCompleted())); + connect(ui->regionAsia, SIGNAL(toggled(bool)), this, + SLOT(UpdateCompleted())); + connect(ui->regionOther, SIGNAL(toggled(bool)), this, + SLOT(UpdateCompleted())); } AutoConfigStreamPage::~AutoConfigStreamPage() @@ -307,17 +301,16 @@ wiz->customServer = IsCustom(); - const char *serverType = wiz->customServer - ? "rtmp_custom" - : "rtmp_common"; + const char *serverType = wiz->customServer ? "rtmp_custom" + : "rtmp_common"; if (!wiz->customServer) { obs_data_set_string(service_settings, "service", - QT_TO_UTF8(ui->service->currentText())); + QT_TO_UTF8(ui->service->currentText())); } OBSService service = obs_service_create(serverType, "temp_service", - service_settings, nullptr); + service_settings, nullptr); obs_service_release(service); int bitrate = 10000; @@ -365,9 +358,8 @@ if (wiz->service != AutoConfig::Service::Twitch && wiz->bandwidthTest) { QMessageBox::StandardButton button; #define WARNING_TEXT(x) QTStr("Basic.AutoConfig.StreamPage.StreamWarning." x) - button = OBSMessageBox::question(this, - WARNING_TEXT("Title"), - WARNING_TEXT("Text")); + button = OBSMessageBox::question(this, WARNING_TEXT("Title"), + WARNING_TEXT("Text")); #undef WARNING_TEXT if (button == QMessageBox::No) @@ -391,7 +383,7 @@ void AutoConfigStreamPage::OnOAuthStreamKeyConnected() { #ifdef BROWSER_AVAILABLE - OAuthStreamKey *a = reinterpret_cast<OAuthStreamKey*>(auth.get()); + OAuthStreamKey *a = reinterpret_cast<OAuthStreamKey *>(auth.get()); if (a) { bool validKey = !a->key().empty(); @@ -440,9 +432,8 @@ { QMessageBox::StandardButton button; - button = OBSMessageBox::question(this, - QTStr(DISCONNECT_COMFIRM_TITLE), - QTStr(DISCONNECT_COMFIRM_TEXT)); + button = OBSMessageBox::question(this, QTStr(DISCONNECT_COMFIRM_TITLE), + QTStr(DISCONNECT_COMFIRM_TEXT)); if (button == QMessageBox::No) { return; @@ -479,14 +470,13 @@ void AutoConfigStreamPage::ServiceChanged() { - bool showMore = - ui->service->currentData().toInt() == (int)ListOpt::ShowAll; + bool showMore = ui->service->currentData().toInt() == + (int)ListOpt::ShowAll; if (showMore) return; std::string service = QT_TO_UTF8(ui->service->currentText()); - bool regionBased = service == "Twitch" || - service == "Smashcast"; + bool regionBased = service == "Twitch" || service == "Smashcast"; bool testBandwidth = ui->doBandwidthTest->isChecked(); bool custom = IsCustom(); @@ -496,9 +486,8 @@ if (cef) { if (lastService != service.c_str()) { bool can_auth = is_auth_service(service); - int page = can_auth - ? (int)Section::Connect - : (int)Section::StreamKey; + int page = can_auth ? (int)Section::Connect + : (int)Section::StreamKey; ui->stackedWidget->setCurrentIndex(page); ui->streamKeyWidget->setVisible(true); @@ -525,7 +514,7 @@ if (custom) { ui->streamkeyPageLayout->insertRow(1, ui->serverLabel, - ui->serverStackedWidget); + ui->serverStackedWidget); ui->region->setVisible(false); ui->serverStackedWidget->setCurrentIndex(1); @@ -533,8 +522,8 @@ ui->serverLabel->setVisible(true); } else { if (!testBandwidth) - ui->streamkeyPageLayout->insertRow(2, ui->serverLabel, - ui->serverStackedWidget); + ui->streamkeyPageLayout->insertRow( + 2, ui->serverLabel, ui->serverStackedWidget); ui->region->setVisible(regionBased && testBandwidth); ui->serverStackedWidget->setCurrentIndex(0); @@ -574,16 +563,32 @@ text += " <a href=\"https://"; text += "www.twitch.tv/broadcast/dashboard/streamkey"; text += "\">"; - text += QTStr("Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); + text += QTStr( + "Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); text += "</a>"; } else if (serviceName == "YouTube / YouTube Gaming") { text += " <a href=\"https://"; text += "www.youtube.com/live_dashboard"; text += "\">"; - text += QTStr("Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); + text += QTStr( + "Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); text += "</a>"; isYoutube = true; + } else if (serviceName.startsWith("Restream.io")) { + text += " <a href=\"https://"; + text += "restream.io/settings/streaming-setup?from=OBS"; + text += "\">"; + text += QTStr( + "Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); + text += "</a>"; + } else if (serviceName == "Facebook Live") { + text += " <a href=\"https://"; + text += "www.facebook.com/live/create"; + text += "\">"; + text += QTStr( + "Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); + text += "</a>"; } if (isYoutube) { @@ -632,9 +637,9 @@ QVariant((int)ListOpt::ShowAll)); } - ui->service->insertItem(0, - QTStr("Basic.AutoConfig.StreamPage.Service.Custom"), - QVariant((int)ListOpt::Custom)); + ui->service->insertItem( + 0, QTStr("Basic.AutoConfig.StreamPage.Service.Custom"), + QVariant((int)ListOpt::Custom)); if (!lastService.isEmpty()) { int idx = ui->service->findText(lastService); @@ -650,8 +655,8 @@ void AutoConfigStreamPage::UpdateServerList() { QString serviceName = ui->service->currentText(); - bool showMore = - ui->service->currentData().toInt() == (int)ListOpt::ShowAll; + bool showMore = ui->service->currentData().toInt() == + (int)ListOpt::ShowAll; if (showMore) { LoadServices(true); @@ -706,8 +711,7 @@ /* ------------------------------------------------------------------------- */ -AutoConfig::AutoConfig(QWidget *parent) - : QWizard(parent) +AutoConfig::AutoConfig(QWidget *parent) : QWizard(parent) { EnableThreadedMessageBoxes(true); @@ -718,7 +722,7 @@ proc_handler_call(ph, "twitch_ingests_refresh", &cd); calldata_free(&cd); - OBSBasic *main = reinterpret_cast<OBSBasic*>(parent); + OBSBasic *main = reinterpret_cast<OBSBasic *>(parent); main->EnableOutputs(false); installEventFilter(CreateShortcutFilter()); @@ -805,14 +809,15 @@ } else { streamPage->ui->customServer->setText(server.c_str()); int idx = streamPage->ui->service->findData( - QVariant((int)ListOpt::Custom)); + QVariant((int)ListOpt::Custom)); streamPage->ui->service->setCurrentIndex(idx); } if (!key.empty()) streamPage->ui->key->setText(key.c_str()); - int bitrate = config_get_int(main->Config(), "SimpleOutput", "VBitrate"); + int bitrate = + config_get_int(main->Config(), "SimpleOutput", "VBitrate"); streamPage->ui->bitrate->setValue(bitrate); streamPage->ServiceChanged(); @@ -825,13 +830,13 @@ * bitrate ratio that if NVENC is available, it makes sense to * just always prefer hardware encoding by default */ bool preferHardware = nvencAvailable || - os_get_physical_cores() <= 4; + os_get_physical_cores() <= 4; streamPage->ui->preferHardware->setChecked(preferHardware); } setOptions(0); setButtonText(QWizard::FinishButton, - QTStr("Basic.AutoConfig.ApplySettings")); + QTStr("Basic.AutoConfig.ApplySettings")); setButtonText(QWizard::BackButton, QTStr("Back")); setButtonText(QWizard::NextButton, QTStr("Next")); setButtonText(QWizard::CancelButton, QTStr("Cancel")); @@ -839,7 +844,7 @@ AutoConfig::~AutoConfig() { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); main->EnableOutputs(true); EnableThreadedMessageBoxes(false); } @@ -879,13 +884,13 @@ if (strcmp(server, "Default") == 0) { return true; } else if (astrcmp_n(server, "US-West:", 8) == 0 || - astrcmp_n(server, "US-East:", 8) == 0) { + astrcmp_n(server, "US-East:", 8) == 0) { return regionUS; } else if (astrcmp_n(server, "EU-", 3) == 0) { return regionEU; } else if (astrcmp_n(server, "South Korea:", 12) == 0 || - astrcmp_n(server, "Asia:", 5) == 0 || - astrcmp_n(server, "China:", 6) == 0) { + astrcmp_n(server, "Asia:", 5) == 0 || + astrcmp_n(server, "China:", 6) == 0) { return regionAsia; } else if (regionOther) { return true; @@ -924,14 +929,12 @@ void AutoConfig::SaveStreamSettings() { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); /* ---------------------------------- */ /* save service */ - const char *service_id = customServer - ? "rtmp_custom" - : "rtmp_common"; + const char *service_id = customServer ? "rtmp_custom" : "rtmp_common"; obs_service_t *oldService = main->GetService(); OBSData hotkeyData = obs_hotkeys_save_service(oldService); @@ -945,8 +948,8 @@ obs_data_set_string(settings, "server", server.c_str()); obs_data_set_string(settings, "key", key.c_str()); - OBSService newService = obs_service_create(service_id, - "default_service", settings, hotkeyData); + OBSService newService = obs_service_create( + service_id, "default_service", settings, hotkeyData); obs_service_release(newService); if (!newService) @@ -962,26 +965,26 @@ /* save stream settings */ config_set_int(main->Config(), "SimpleOutput", "VBitrate", - idealBitrate); + idealBitrate); config_set_string(main->Config(), "SimpleOutput", "StreamEncoder", - GetEncoderId(streamingEncoder)); + GetEncoderId(streamingEncoder)); config_remove_value(main->Config(), "SimpleOutput", "UseAdvanced"); } void AutoConfig::SaveSettings() { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); if (recordingEncoder != Encoder::Stream) config_set_string(main->Config(), "SimpleOutput", "RecEncoder", - GetEncoderId(recordingEncoder)); + GetEncoderId(recordingEncoder)); - const char *quality = recordingQuality == Quality::High - ? "Small" - : "Stream"; + const char *quality = recordingQuality == Quality::High ? "Small" + : "Stream"; config_set_string(main->Config(), "Output", "Mode", "Simple"); - config_set_string(main->Config(), "SimpleOutput", "RecQuality", quality); + config_set_string(main->Config(), "SimpleOutput", "RecQuality", + quality); config_set_int(main->Config(), "Video", "BaseCX", baseResolutionCX); config_set_int(main->Config(), "Video", "BaseCY", baseResolutionCY); config_set_int(main->Config(), "Video", "OutputCX", idealResolutionCX); @@ -990,7 +993,7 @@ if (fpsType != FPSType::UseCurrent) { config_set_uint(main->Config(), "Video", "FPSType", 0); config_set_string(main->Config(), "Video", "FPSCommon", - std::to_string(idealFPSNum).c_str()); + std::to_string(idealFPSNum).c_str()); } main->ResetVideo();
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-auto-config.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-auto-config.hpp
Changed
@@ -32,13 +32,13 @@ enum class Type { Invalid, Streaming, - Recording + Recording, }; enum class Service { Twitch, Smashcast, - Other + Other, }; enum class Encoder { @@ -46,12 +46,12 @@ NVENC, QSV, AMD, - Stream + Stream, }; enum class Quality { Stream, - High + High, }; enum class FPSType : int { @@ -59,7 +59,7 @@ PreferHighRes, UseCurrent, fps30, - fps60 + fps60, }; static inline const char *GetEncoderId(Encoder enc); @@ -119,7 +119,7 @@ StartPage, VideoPage, StreamPage, - TestPage + TestPage, }; }; @@ -216,7 +216,7 @@ BandwidthTest, StreamEncoder, RecordingEncoder, - Finished + Finished, }; Stage stage = Stage::Starting;
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-filters.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-filters.cpp
Changed
@@ -36,45 +36,39 @@ Q_DECLARE_METATYPE(OBSSource); OBSBasicFilters::OBSBasicFilters(QWidget *parent, OBSSource source_) - : QDialog (parent), - ui (new Ui::OBSBasicFilters), - source (source_), - addSignal (obs_source_get_signal_handler(source), - "filter_add", - OBSBasicFilters::OBSSourceFilterAdded, - this), - removeSignal (obs_source_get_signal_handler(source), - "filter_remove", - OBSBasicFilters::OBSSourceFilterRemoved, - this), - reorderSignal (obs_source_get_signal_handler(source), - "reorder_filters", - OBSBasicFilters::OBSSourceReordered, - this), - removeSourceSignal (obs_source_get_signal_handler(source), - "remove", - OBSBasicFilters::SourceRemoved, this), - renameSourceSignal (obs_source_get_signal_handler(source), - "rename", - OBSBasicFilters::SourceRenamed, this), - noPreviewMargin (13) -{ - main = reinterpret_cast<OBSBasic*>(parent); + : QDialog(parent), + ui(new Ui::OBSBasicFilters), + source(source_), + addSignal(obs_source_get_signal_handler(source), "filter_add", + OBSBasicFilters::OBSSourceFilterAdded, this), + removeSignal(obs_source_get_signal_handler(source), "filter_remove", + OBSBasicFilters::OBSSourceFilterRemoved, this), + reorderSignal(obs_source_get_signal_handler(source), + "reorder_filters", OBSBasicFilters::OBSSourceReordered, + this), + removeSourceSignal(obs_source_get_signal_handler(source), "remove", + OBSBasicFilters::SourceRemoved, this), + renameSourceSignal(obs_source_get_signal_handler(source), "rename", + OBSBasicFilters::SourceRenamed, this), + noPreviewMargin(13) +{ + main = reinterpret_cast<OBSBasic *>(parent); ui->setupUi(this); UpdateFilters(); ui->asyncFilters->setItemDelegate( - new VisibilityItemDelegate(ui->asyncFilters)); + new VisibilityItemDelegate(ui->asyncFilters)); ui->effectFilters->setItemDelegate( - new VisibilityItemDelegate(ui->effectFilters)); + new VisibilityItemDelegate(ui->effectFilters)); const char *name = obs_source_get_name(source); setWindowTitle(QTStr("Basic.Filters.Title").arg(QT_UTF8(name))); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); #ifndef QT_NO_SHORTCUT - ui->actionRemoveFilter->setShortcut(QApplication::translate("OBSBasicFilters", "Del", nullptr)); + ui->actionRemoveFilter->setShortcut( + QApplication::translate("OBSBasicFilters", "Del", nullptr)); #endif // QT_NO_SHORTCUT addAction(ui->actionRemoveFilter); @@ -84,33 +78,33 @@ installEventFilter(CreateShortcutFilter()); connect(ui->asyncFilters->itemDelegate(), - SIGNAL(closeEditor(QWidget*, - QAbstractItemDelegate::EndEditHint)), - this, - SLOT(AsyncFilterNameEdited(QWidget*, - QAbstractItemDelegate::EndEditHint))); + SIGNAL(closeEditor(QWidget *, + QAbstractItemDelegate::EndEditHint)), + this, + SLOT(AsyncFilterNameEdited( + QWidget *, QAbstractItemDelegate::EndEditHint))); connect(ui->effectFilters->itemDelegate(), - SIGNAL(closeEditor(QWidget*, - QAbstractItemDelegate::EndEditHint)), - this, - SLOT(EffectFilterNameEdited(QWidget*, - QAbstractItemDelegate::EndEditHint))); + SIGNAL(closeEditor(QWidget *, + QAbstractItemDelegate::EndEditHint)), + this, + SLOT(EffectFilterNameEdited( + QWidget *, QAbstractItemDelegate::EndEditHint))); QPushButton *close = ui->buttonBox->button(QDialogButtonBox::Close); connect(close, SIGNAL(clicked()), this, SLOT(close())); close->setDefault(true); - ui->buttonBox->button(QDialogButtonBox::Reset)->setText( - QTStr("Defaults")); + ui->buttonBox->button(QDialogButtonBox::Reset) + ->setText(QTStr("Defaults")); connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(ResetFilters())); uint32_t caps = obs_source_get_output_flags(source); - bool audio = (caps & OBS_SOURCE_AUDIO) != 0; + bool audio = (caps & OBS_SOURCE_AUDIO) != 0; bool audioOnly = (caps & OBS_SOURCE_VIDEO) == 0; - bool async = (caps & OBS_SOURCE_ASYNC) != 0; + bool async = (caps & OBS_SOURCE_ASYNC) != 0; if (!async && !audio) { ui->asyncWidget->setVisible(false); @@ -124,22 +118,22 @@ if (audioOnly || (audio && !async)) ui->asyncLabel->setText(QTStr("Basic.Filters.AudioFilters")); - auto addDrawCallback = [this] () - { + auto addDrawCallback = [this]() { obs_display_add_draw_callback(ui->preview->GetDisplay(), - OBSBasicFilters::DrawPreview, this); + OBSBasicFilters::DrawPreview, + this); }; enum obs_source_type type = obs_source_get_type(source); bool drawable_type = type == OBS_SOURCE_TYPE_INPUT || - type == OBS_SOURCE_TYPE_SCENE; + type == OBS_SOURCE_TYPE_SCENE; if ((caps & OBS_SOURCE_VIDEO) != 0) { ui->rightLayout->setContentsMargins(0, 0, 0, 0); ui->preview->show(); if (drawable_type) connect(ui->preview, &OBSQTDisplay::DisplayCreated, - addDrawCallback); + addDrawCallback); } else { ui->rightLayout->setContentsMargins(0, noPreviewMargin, 0, 0); ui->rightContainerLayout->insertStretch(1); @@ -187,14 +181,14 @@ obs_data_t *settings = obs_source_get_settings(filter); - view = new OBSPropertiesView(settings, filter, - (PropertiesReloadCallback)obs_source_properties, - (PropertiesUpdateCallback)obs_source_update); + view = new OBSPropertiesView( + settings, filter, + (PropertiesReloadCallback)obs_source_properties, + (PropertiesUpdateCallback)obs_source_update); updatePropertiesSignal.Connect(obs_source_get_signal_handler(filter), - "update_properties", - OBSBasicFilters::UpdateProperties, - this); + "update_properties", + OBSBasicFilters::UpdateProperties, this); obs_data_release(settings); @@ -206,8 +200,8 @@ void OBSBasicFilters::UpdateProperties(void *data, calldata_t *) { - QMetaObject::invokeMethod(static_cast<OBSBasicFilters*>(data)->view, - "ReloadProperties"); + QMetaObject::invokeMethod(static_cast<OBSBasicFilters *>(data)->view, + "ReloadProperties"); } void OBSBasicFilters::AddFilter(OBSSource filter) @@ -252,7 +246,7 @@ const char *filterId = obs_source_get_id(filter); blog(LOG_INFO, "User removed filter '%s' (%s) from source '%s'", - filterName, filterId, sourceName); + filterName, filterId, sourceName); main->SaveProject(); } @@ -265,8 +259,8 @@ inline FilterOrderInfo(OBSBasicFilters *window_) : window(window_) {} }; -void OBSBasicFilters::ReorderFilter(QListWidget *list, - obs_source_t *filter, size_t idx) +void OBSBasicFilters::ReorderFilter(QListWidget *list, obs_source_t *filter, + size_t idx) { int count = list->count(); @@ -280,10 +274,10 @@ bool sel = (list->currentRow() == i); listItem = TakeListItem(list, i); - if (listItem) { + if (listItem) { list->insertItem((int)idx, listItem); - SetupVisibilityItem(list, - listItem, filterItem); + SetupVisibilityItem(list, listItem, + filterItem); if (sel) list->setCurrentRow((int)idx); @@ -299,27 +293,28 @@ { FilterOrderInfo info(this); - obs_source_enum_filters(source, - [] (obs_source_t*, obs_source_t *filter, void *p) - { - FilterOrderInfo *info = - reinterpret_cast<FilterOrderInfo*>(p); - uint32_t flags; - bool async; - - flags = obs_source_get_output_flags(filter); - async = (flags & OBS_SOURCE_ASYNC) != 0; - - if (async) { - info->window->ReorderFilter( - info->window->ui->asyncFilters, - filter, info->asyncIdx++); - } else { - info->window->ReorderFilter( - info->window->ui->effectFilters, - filter, info->effectIdx++); - } - }, &info); + obs_source_enum_filters( + source, + [](obs_source_t *, obs_source_t *filter, void *p) { + FilterOrderInfo *info = + reinterpret_cast<FilterOrderInfo *>(p); + uint32_t flags; + bool async; + + flags = obs_source_get_output_flags(filter); + async = (flags & OBS_SOURCE_ASYNC) != 0; + + if (async) { + info->window->ReorderFilter( + info->window->ui->asyncFilters, filter, + info->asyncIdx++); + } else { + info->window->ReorderFilter( + info->window->ui->effectFilters, filter, + info->effectIdx++); + } + }, + &info); } void OBSBasicFilters::UpdateFilters() @@ -330,33 +325,34 @@ ClearListItems(ui->effectFilters); ClearListItems(ui->asyncFilters); - obs_source_enum_filters(source, - [] (obs_source_t*, obs_source_t *filter, void *p) - { - OBSBasicFilters *window = - reinterpret_cast<OBSBasicFilters*>(p); + obs_source_enum_filters( + source, + [](obs_source_t *, obs_source_t *filter, void *p) { + OBSBasicFilters *window = + reinterpret_cast<OBSBasicFilters *>(p); - window->AddFilter(filter); - }, this); + window->AddFilter(filter); + }, + this); main->SaveProject(); } static bool filter_compatible(bool async, uint32_t sourceFlags, - uint32_t filterFlags) + uint32_t filterFlags) { bool filterVideo = (filterFlags & OBS_SOURCE_VIDEO) != 0; bool filterAsync = (filterFlags & OBS_SOURCE_ASYNC) != 0; bool filterAudio = (filterFlags & OBS_SOURCE_AUDIO) != 0; - bool audio = (sourceFlags & OBS_SOURCE_AUDIO) != 0; - bool audioOnly = (sourceFlags & OBS_SOURCE_VIDEO) == 0; + bool audio = (sourceFlags & OBS_SOURCE_AUDIO) != 0; + bool audioOnly = (sourceFlags & OBS_SOURCE_VIDEO) == 0; bool asyncSource = (sourceFlags & OBS_SOURCE_ASYNC) != 0; if (async && ((audioOnly && filterVideo) || (!audio && !asyncSource))) return false; return (async && (filterAudio || filterAsync)) || - (!async && !filterAudio && !filterAsync); + (!async && !filterAudio && !filterAsync); } QMenu *OBSBasicFilters::CreateAddFilterPopupMenu(bool async) @@ -372,7 +368,8 @@ inline FilterInfo(const char *type_, const char *name_) : type(type_), name(name_) - {} + { + } }; vector<FilterInfo> types; @@ -396,17 +393,17 @@ QMenu *popup = new QMenu(QTStr("Add"), this); for (FilterInfo &type : types) { - uint32_t filterFlags = obs_get_source_output_flags( - type.type.c_str()); + uint32_t filterFlags = + obs_get_source_output_flags(type.type.c_str()); if (!filter_compatible(async, sourceFlags, filterFlags)) continue; - QAction *popupItem = new QAction(QT_UTF8(type.name.c_str()), - this); + QAction *popupItem = + new QAction(QT_UTF8(type.name.c_str()), this); popupItem->setData(QT_UTF8(type.type.c_str())); - connect(popupItem, SIGNAL(triggered(bool)), - this, SLOT(AddFilterFromAction())); + connect(popupItem, SIGNAL(triggered(bool)), this, + SLOT(AddFilterFromAction())); popup->addAction(popupItem); foundValues = true; @@ -426,40 +423,40 @@ obs_source_t *existing_filter; string name = obs_source_get_display_name(id); - bool success = NameDialog::AskForName(this, - QTStr("Basic.Filters.AddFilter.Title"), - QTStr("Basic.FIlters.AddFilter.Text"), name, - QT_UTF8(name.c_str())); + bool success = NameDialog::AskForName( + this, QTStr("Basic.Filters.AddFilter.Title"), + QTStr("Basic.FIlters.AddFilter.Text"), name, + QT_UTF8(name.c_str())); if (!success) return; if (name.empty()) { OBSMessageBox::warning(this, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); AddNewFilter(id); return; } - existing_filter = obs_source_get_filter_by_name(source, - name.c_str()); + existing_filter = + obs_source_get_filter_by_name(source, name.c_str()); if (existing_filter) { - OBSMessageBox::warning(this, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + OBSMessageBox::warning(this, QTStr("NameExists.Title"), + QTStr("NameExists.Text")); obs_source_release(existing_filter); AddNewFilter(id); return; } - obs_source_t *filter = obs_source_create(id, name.c_str(), - nullptr, nullptr); + obs_source_t *filter = + obs_source_create(id, name.c_str(), nullptr, nullptr); if (filter) { const char *sourceName = obs_source_get_name(source); - blog(LOG_INFO, "User added filter '%s' (%s) " - "to source '%s'", - name.c_str(), id, sourceName); + blog(LOG_INFO, + "User added filter '%s' (%s) " + "to source '%s'", + name.c_str(), id, sourceName); obs_source_filter_add(source, filter); obs_source_release(filter); @@ -469,7 +466,7 @@ void OBSBasicFilters::AddFilterFromAction() { - QAction *action = qobject_cast<QAction*>(sender()); + QAction *action = qobject_cast<QAction *>(sender()); if (!action) return; @@ -482,8 +479,8 @@ if (!event->isAccepted()) return; - obs_display_remove_draw_callback (ui->preview->GetDisplay(), - OBSBasicFilters::DrawPreview, this); + obs_display_remove_draw_callback(ui->preview->GetDisplay(), + OBSBasicFilters::DrawPreview, this); main->SaveProject(); } @@ -492,26 +489,26 @@ void OBSBasicFilters::OBSSourceFilterAdded(void *param, calldata_t *data) { - OBSBasicFilters *window = reinterpret_cast<OBSBasicFilters*>(param); - obs_source_t *filter = (obs_source_t*)calldata_ptr(data, "filter"); + OBSBasicFilters *window = reinterpret_cast<OBSBasicFilters *>(param); + obs_source_t *filter = (obs_source_t *)calldata_ptr(data, "filter"); QMetaObject::invokeMethod(window, "AddFilter", - Q_ARG(OBSSource, OBSSource(filter))); + Q_ARG(OBSSource, OBSSource(filter))); } void OBSBasicFilters::OBSSourceFilterRemoved(void *param, calldata_t *data) { - OBSBasicFilters *window = reinterpret_cast<OBSBasicFilters*>(param); - obs_source_t *filter = (obs_source_t*)calldata_ptr(data, "filter"); + OBSBasicFilters *window = reinterpret_cast<OBSBasicFilters *>(param); + obs_source_t *filter = (obs_source_t *)calldata_ptr(data, "filter"); QMetaObject::invokeMethod(window, "RemoveFilter", - Q_ARG(OBSSource, OBSSource(filter))); + Q_ARG(OBSSource, OBSSource(filter))); } void OBSBasicFilters::OBSSourceReordered(void *param, calldata_t *data) { - QMetaObject::invokeMethod(reinterpret_cast<OBSBasicFilters*>(param), - "ReorderFilters"); + QMetaObject::invokeMethod(reinterpret_cast<OBSBasicFilters *>(param), + "ReorderFilters"); UNUSED_PARAMETER(data); } @@ -520,8 +517,8 @@ { UNUSED_PARAMETER(data); - QMetaObject::invokeMethod(static_cast<OBSBasicFilters*>(param), - "close"); + QMetaObject::invokeMethod(static_cast<OBSBasicFilters *>(param), + "close"); } void OBSBasicFilters::SourceRenamed(void *param, calldata_t *data) @@ -529,13 +526,13 @@ const char *name = calldata_string(data, "new_name"); QString title = QTStr("Basic.Filters.Title").arg(QT_UTF8(name)); - QMetaObject::invokeMethod(static_cast<OBSBasicFilters*>(param), - "setWindowTitle", Q_ARG(QString, title)); + QMetaObject::invokeMethod(static_cast<OBSBasicFilters *>(param), + "setWindowTitle", Q_ARG(QString, title)); } void OBSBasicFilters::DrawPreview(void *data, uint32_t cx, uint32_t cy) { - OBSBasicFilters *window = static_cast<OBSBasicFilters*>(data); + OBSBasicFilters *window = static_cast<OBSBasicFilters *>(data); if (!window->source) return; @@ -543,8 +540,8 @@ uint32_t sourceCX = max(obs_source_get_width(window->source), 1u); uint32_t sourceCY = max(obs_source_get_height(window->source), 1u); - int x, y; - int newCX, newCY; + int x, y; + int newCX, newCY; float scale; GetScaleAndCenterPos(sourceCX, sourceCY, cx, cy, x, y, scale); @@ -567,15 +564,15 @@ static bool QueryRemove(QWidget *parent, obs_source_t *source) { - const char *name = obs_source_get_name(source); + const char *name = obs_source_get_name(source); QString text = QTStr("ConfirmRemove.Text"); text.replace("$1", QT_UTF8(name)); QMessageBox remove_source(parent); remove_source.setText(text); - QAbstractButton *Yes = remove_source.addButton(QTStr("Yes"), - QMessageBox::YesRole); + QAbstractButton *Yes = + remove_source.addButton(QTStr("Yes"), QMessageBox::YesRole); remove_source.addButton(QTStr("No"), QMessageBox::NoRole); remove_source.setIcon(QMessageBox::Question); remove_source.setWindowTitle(QTStr("ConfirmRemove.Title")); @@ -612,7 +609,7 @@ OBSSource filter = GetFilter(ui->asyncFilters->currentRow(), true); if (filter) obs_source_filter_set_order(source, filter, - OBS_ORDER_MOVE_DOWN); + OBS_ORDER_MOVE_DOWN); } void OBSBasicFilters::on_asyncFilters_GotFocus() @@ -654,7 +651,7 @@ OBSSource filter = GetFilter(ui->effectFilters->currentRow(), false); if (filter) obs_source_filter_set_order(source, filter, - OBS_ORDER_MOVE_DOWN); + OBS_ORDER_MOVE_DOWN); } void OBSBasicFilters::on_effectFilters_GotFocus() @@ -704,11 +701,11 @@ popup.addMenu(addMenu); if (item) { - const char *renameSlot = async ? - SLOT(RenameAsyncFilter()) : SLOT(RenameEffectFilter()); - const char *removeSlot = async ? - SLOT(on_removeAsyncFilter_clicked()) : - SLOT(on_removeEffectFilter_clicked()); + const char *renameSlot = async ? SLOT(RenameAsyncFilter()) + : SLOT(RenameEffectFilter()); + const char *removeSlot = + async ? SLOT(on_removeAsyncFilter_clicked()) + : SLOT(on_removeEffectFilter_clicked()); popup.addSeparator(); popup.addAction(QTStr("Rename"), this, renameSlot); @@ -721,9 +718,9 @@ void OBSBasicFilters::EditItem(QListWidgetItem *item, bool async) { Qt::ItemFlags flags = item->flags(); - OBSSource filter = item->data(Qt::UserRole).value<OBSSource>(); - const char *name = obs_source_get_name(filter); - QListWidget *list = async ? ui->asyncFilters : ui->effectFilters; + OBSSource filter = item->data(Qt::UserRole).value<OBSSource>(); + const char *name = obs_source_get_name(filter); + QListWidget *list = async ? ui->asyncFilters : ui->effectFilters; item->setText(QT_UTF8(name)); item->setFlags(flags | Qt::ItemIsEditable); @@ -733,13 +730,13 @@ } void OBSBasicFilters::on_asyncFilters_customContextMenuRequested( - const QPoint &pos) + const QPoint &pos) { CustomContextMenu(pos, true); } void OBSBasicFilters::on_effectFilters_customContextMenuRequested( - const QPoint &pos) + const QPoint &pos) { CustomContextMenu(pos, false); } @@ -758,7 +755,7 @@ { QListWidgetItem *listItem = list->currentItem(); OBSSource filter = listItem->data(Qt::UserRole).value<OBSSource>(); - QLineEdit *edit = qobject_cast<QLineEdit*>(editor); + QLineEdit *edit = qobject_cast<QLineEdit *>(editor); string name = QT_TO_UTF8(edit->text().trimmed()); const char *prevName = obs_source_get_name(filter); @@ -766,28 +763,29 @@ obs_source_t *foundFilter = nullptr; if (!sameName) - foundFilter = obs_source_get_filter_by_name(source, - name.c_str()); + foundFilter = + obs_source_get_filter_by_name(source, name.c_str()); if (foundFilter || name.empty() || sameName) { listItem->setText(QT_UTF8(prevName)); if (foundFilter) { OBSMessageBox::information(window(), - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + QTStr("NameExists.Title"), + QTStr("NameExists.Text")); obs_source_release(foundFilter); } else if (name.empty()) { OBSMessageBox::information(window(), - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); } } else { const char *sourceName = obs_source_get_name(source); - blog(LOG_INFO, "User renamed filter '%s' on source '%s' to '%s'", - prevName, sourceName, name.c_str()); + blog(LOG_INFO, + "User renamed filter '%s' on source '%s' to '%s'", + prevName, sourceName, name.c_str()); listItem->setText(QT_UTF8(name.c_str())); obs_source_set_name(filter, name.c_str()); @@ -797,15 +795,15 @@ SetupVisibilityItem(list, listItem, filter); } -void OBSBasicFilters::AsyncFilterNameEdited(QWidget *editor, - QAbstractItemDelegate::EndEditHint endHint) +void OBSBasicFilters::AsyncFilterNameEdited( + QWidget *editor, QAbstractItemDelegate::EndEditHint endHint) { FilterNameEdited(editor, ui->asyncFilters); UNUSED_PARAMETER(endHint); } -void OBSBasicFilters::EffectFilterNameEdited(QWidget *editor, - QAbstractItemDelegate::EndEditHint endHint) +void OBSBasicFilters::EffectFilterNameEdited( + QWidget *editor, QAbstractItemDelegate::EndEditHint endHint) { FilterNameEdited(editor, ui->effectFilters); UNUSED_PARAMETER(endHint);
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-filters.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-filters.hpp
Changed
@@ -105,9 +105,9 @@ void on_actionMoveDown_triggered(); void AsyncFilterNameEdited(QWidget *editor, - QAbstractItemDelegate::EndEditHint endHint); + QAbstractItemDelegate::EndEditHint endHint); void EffectFilterNameEdited(QWidget *editor, - QAbstractItemDelegate::EndEditHint endHint); + QAbstractItemDelegate::EndEditHint endHint); public: OBSBasicFilters(QWidget *parent, OBSSource source_);
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-interaction.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-interaction.cpp
Changed
@@ -29,20 +29,20 @@ using namespace std; OBSBasicInteraction::OBSBasicInteraction(QWidget *parent, OBSSource source_) - : QDialog (parent), - main (qobject_cast<OBSBasic*>(parent)), - ui (new Ui::OBSBasicInteraction), - source (source_), - removedSignal (obs_source_get_signal_handler(source), "remove", - OBSBasicInteraction::SourceRemoved, this), - renamedSignal (obs_source_get_signal_handler(source), "rename", - OBSBasicInteraction::SourceRenamed, this), - eventFilter (BuildEventFilter()) + : QDialog(parent), + main(qobject_cast<OBSBasic *>(parent)), + ui(new Ui::OBSBasicInteraction), + source(source_), + removedSignal(obs_source_get_signal_handler(source), "remove", + OBSBasicInteraction::SourceRemoved, this), + renamedSignal(obs_source_get_signal_handler(source), "rename", + OBSBasicInteraction::SourceRenamed, this), + eventFilter(BuildEventFilter()) { int cx = (int)config_get_int(App()->GlobalConfig(), "InteractionWindow", - "cx"); + "cx"); int cy = (int)config_get_int(App()->GlobalConfig(), "InteractionWindow", - "cy"); + "cy"); ui->setupUi(this); @@ -59,10 +59,10 @@ const char *name = obs_source_get_name(source); setWindowTitle(QTStr("Basic.InteractionWindow").arg(QT_UTF8(name))); - auto addDrawCallback = [this] () - { + auto addDrawCallback = [this]() { obs_display_add_draw_callback(ui->preview->GetDisplay(), - OBSBasicInteraction::DrawPreview, this); + OBSBasicInteraction::DrawPreview, + this); }; connect(ui->preview, &OBSQTDisplay::DisplayCreated, addDrawCallback); @@ -77,34 +77,32 @@ OBSEventFilter *OBSBasicInteraction::BuildEventFilter() { - return new OBSEventFilter( - [this](QObject *obj, QEvent *event) - { + return new OBSEventFilter([this](QObject *obj, QEvent *event) { UNUSED_PARAMETER(obj); - switch(event->type()) { + switch (event->type()) { case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: return this->HandleMouseClickEvent( - static_cast<QMouseEvent *>(event)); + static_cast<QMouseEvent *>(event)); case QEvent::MouseMove: case QEvent::Enter: case QEvent::Leave: return this->HandleMouseMoveEvent( - static_cast<QMouseEvent *>(event)); + static_cast<QMouseEvent *>(event)); case QEvent::Wheel: return this->HandleMouseWheelEvent( - static_cast<QWheelEvent *>(event)); + static_cast<QWheelEvent *>(event)); case QEvent::FocusIn: case QEvent::FocusOut: return this->HandleFocusEvent( - static_cast<QFocusEvent *>(event)); + static_cast<QFocusEvent *>(event)); case QEvent::KeyPress: case QEvent::KeyRelease: return this->HandleKeyEvent( - static_cast<QKeyEvent *>(event)); + static_cast<QKeyEvent *>(event)); default: return false; } @@ -113,8 +111,8 @@ void OBSBasicInteraction::SourceRemoved(void *data, calldata_t *params) { - QMetaObject::invokeMethod(static_cast<OBSBasicInteraction*>(data), - "close"); + QMetaObject::invokeMethod(static_cast<OBSBasicInteraction *>(data), + "close"); UNUSED_PARAMETER(params); } @@ -124,13 +122,13 @@ const char *name = calldata_string(params, "new_name"); QString title = QTStr("Basic.InteractionWindow").arg(QT_UTF8(name)); - QMetaObject::invokeMethod(static_cast<OBSBasicProperties*>(data), - "setWindowTitle", Q_ARG(QString, title)); + QMetaObject::invokeMethod(static_cast<OBSBasicProperties *>(data), + "setWindowTitle", Q_ARG(QString, title)); } void OBSBasicInteraction::DrawPreview(void *data, uint32_t cx, uint32_t cy) { - OBSBasicInteraction *window = static_cast<OBSBasicInteraction*>(data); + OBSBasicInteraction *window = static_cast<OBSBasicInteraction *>(data); if (!window->source) return; @@ -138,8 +136,8 @@ uint32_t sourceCX = max(obs_source_get_width(window->source), 1u); uint32_t sourceCY = max(obs_source_get_height(window->source), 1u); - int x, y; - int newCX, newCY; + int x, y; + int newCX, newCY; float scale; GetScaleAndCenterPos(sourceCX, sourceCY, cx, cy, x, y, scale); @@ -149,8 +147,7 @@ gs_viewport_push(); gs_projection_push(); - gs_ortho(0.0f, float(sourceCX), 0.0f, float(sourceCY), - -100.0f, 100.0f); + gs_ortho(0.0f, float(sourceCX), 0.0f, float(sourceCY), -100.0f, 100.0f); gs_set_viewport(x, y, newCX, newCY); obs_source_video_render(window->source); @@ -165,15 +162,18 @@ return; config_set_int(App()->GlobalConfig(), "InteractionWindow", "cx", - width()); + width()); config_set_int(App()->GlobalConfig(), "InteractionWindow", "cy", - height()); + height()); obs_display_remove_draw_callback(ui->preview->GetDisplay(), - OBSBasicInteraction::DrawPreview, this); + OBSBasicInteraction::DrawPreview, + this); } -static int TranslateQtKeyboardEventModifiers(QInputEvent *event, bool mouseEvent) { +static int TranslateQtKeyboardEventModifiers(QInputEvent *event, + bool mouseEvent) +{ int obsModifiers = INTERACT_NONE; if (event->modifiers().testFlag(Qt::ShiftModifier)) @@ -200,8 +200,7 @@ return obsModifiers; } -static int TranslateQtMouseEventModifiers( - QMouseEvent *event) +static int TranslateQtMouseEventModifiers(QMouseEvent *event) { int modifiers = TranslateQtKeyboardEventModifiers(event, true); @@ -215,19 +214,19 @@ return modifiers; } -bool OBSBasicInteraction::GetSourceRelativeXY( - int mouseX, int mouseY, int &relX, int &relY) +bool OBSBasicInteraction::GetSourceRelativeXY(int mouseX, int mouseY, int &relX, + int &relY) { QSize size = GetPixelSize(ui->preview); uint32_t sourceCX = max(obs_source_get_width(source), 1u); uint32_t sourceCY = max(obs_source_get_height(source), 1u); - int x, y; + int x, y; float scale; - GetScaleAndCenterPos(sourceCX, sourceCY, size.width(), size.height(), - x, y, scale); + GetScaleAndCenterPos(sourceCX, sourceCY, size.width(), size.height(), x, + y, scale); if (x > 0) { relX = int(float(mouseX - x) / scale); @@ -246,8 +245,7 @@ return true; } -bool OBSBasicInteraction::HandleMouseClickEvent( - QMouseEvent *event) +bool OBSBasicInteraction::HandleMouseClickEvent(QMouseEvent *event) { bool mouseUp = event->type() == QEvent::MouseButtonRelease; int clickCount = 1; @@ -271,8 +269,7 @@ button = MOUSE_RIGHT; break; default: - blog(LOG_WARNING, "unknown button type %d", - event->button()); + blog(LOG_WARNING, "unknown button type %d", event->button()); return false; } @@ -281,11 +278,11 @@ // clickCount = 2; bool insideSource = GetSourceRelativeXY(event->x(), event->y(), - mouseEvent.x, mouseEvent.y); + mouseEvent.x, mouseEvent.y); if (mouseUp || insideSource) obs_source_send_mouse_click(source, &mouseEvent, button, - mouseUp, clickCount); + mouseUp, clickCount); return true; } @@ -299,7 +296,7 @@ if (!mouseLeave) { mouseEvent.modifiers = TranslateQtMouseEventModifiers(event); mouseLeave = !GetSourceRelativeXY(event->x(), event->y(), - mouseEvent.x, mouseEvent.y); + mouseEvent.x, mouseEvent.y); } obs_source_send_mouse_move(source, &mouseEvent, mouseLeave); @@ -329,9 +326,9 @@ } if (GetSourceRelativeXY(event->x(), event->y(), mouseEvent.x, - mouseEvent.y)) + mouseEvent.y)) obs_source_send_mouse_wheel(source, &mouseEvent, xDelta, - yDelta); + yDelta); return true; }
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-interaction.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-interaction.hpp
Changed
@@ -35,12 +35,12 @@ Q_OBJECT private: - OBSBasic *main; + OBSBasic *main; std::unique_ptr<Ui::OBSBasicInteraction> ui; - OBSSource source; - OBSSignal removedSignal; - OBSSignal renamedSignal; + OBSSource source; + OBSSignal removedSignal; + OBSSignal renamedSignal; std::unique_ptr<OBSEventFilter> eventFilter; static void SourceRemoved(void *data, calldata_t *params); @@ -69,13 +69,10 @@ typedef std::function<bool(QObject *, QEvent *)> EventFilterFunc; -class OBSEventFilter : public QObject -{ +class OBSEventFilter : public QObject { Q_OBJECT public: - OBSEventFilter(EventFilterFunc filter_) - : filter(filter_) - {} + OBSEventFilter(EventFilterFunc filter_) : filter(filter_) {} protected: bool eventFilter(QObject *obj, QEvent *event)
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-main-browser.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-main-browser.cpp
Changed
@@ -30,7 +30,7 @@ struct QCef; struct QCefCookieManager; -extern QCef *cef; +extern QCef *cef; extern QCefCookieManager *panel_cookies; static std::string GenId() @@ -52,7 +52,8 @@ if (config_has_user_value(main->Config(), "Panels", "CookieId")) return; - config_set_string(main->Config(), "Panels", "CookieId", GenId().c_str()); + config_set_string(main->Config(), "Panels", "CookieId", + GenId().c_str()); } #ifdef BROWSER_AVAILABLE @@ -66,8 +67,8 @@ CheckExistingCookieId(); OBSBasic *main = OBSBasic::Get(); - const char *cookie_id = config_get_string(main->Config(), - "Panels", "CookieId"); + const char *cookie_id = + config_get_string(main->Config(), "Panels", "CookieId"); std::string sub_path; sub_path += "obs_profile_cookies/"; @@ -102,8 +103,8 @@ #ifdef BROWSER_AVAILABLE if (cef) { OBSBasic *main = OBSBasic::Get(); - std::string cookie_id = config_get_string(main->Config(), - "Panels", "CookieId"); + std::string cookie_id = + config_get_string(main->Config(), "Panels", "CookieId"); std::string src_path; src_path += "obs_profile_cookies/"; @@ -136,9 +137,9 @@ } config_set_string(config, "Panels", "CookieId", - cookie_id.c_str()); + cookie_id.c_str()); config_set_string(main->Config(), "Panels", "CookieId", - new_id.c_str()); + new_id.c_str()); } #else UNUSED_PARAMETER(config); @@ -155,10 +156,9 @@ return; } - ExecThreadedWithoutBlocking( - [] {cef->wait_for_browser_init();}, - QTStr("BrowserPanelInit.Title"), - QTStr("BrowserPanelInit.Text")); + ExecThreadedWithoutBlocking([] { cef->wait_for_browser_init(); }, + QTStr("BrowserPanelInit.Title"), + QTStr("BrowserPanelInit.Text")); InitPanelCookieManager(); #endif }
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-main-dropfiles.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-main-dropfiles.cpp
Changed
@@ -11,34 +11,29 @@ using namespace std; -static const char *textExtensions[] = { - "txt", "log", nullptr -}; +static const char *textExtensions[] = {"txt", "log", nullptr}; -static const char *imageExtensions[] = { - "bmp", "tga", "png", "jpg", "jpeg", "gif", nullptr -}; +static const char *imageExtensions[] = {"bmp", "tga", "png", "jpg", + "jpeg", "gif", nullptr}; -static const char *htmlExtensions[] = { - "htm", "html", nullptr -}; +static const char *htmlExtensions[] = {"htm", "html", nullptr}; static const char *mediaExtensions[] = { - "3ga", "669", "a52", "aac", "ac3", "adt", "adts", "aif", "aifc", - "aiff", "amb", "amr", "aob", "ape", "au", "awb", "caf", "dts", - "flac", "it", "kar", "m4a", "m4b", "m4p", "m5p", "mid", "mka", - "mlp", "mod", "mpa", "mp1", "mp2", "mp3", "mpc", "mpga", "mus", - "oga", "ogg", "oma", "opus", "qcp", "ra", "rmi", "s3m", "sid", - "spx", "tak", "thd", "tta", "voc", "vqf", "w64", "wav", "wma", - "wv", "xa", "xm", "3g2", "3gp", "3gp2", "3gpp", "amv", "asf", "avi", - "bik", "crf", "divx", "drc", "dv", "evo", "f4v", "flv", "gvi", - "gxf", "iso", "m1v", "m2v", "m2t", "m2ts", "m4v", "mkv", "mov", - "mp2", "mp2v", "mp4", "mp4v", "mpe", "mpeg", "mpeg1", "mpeg2", - "mpeg4", "mpg", "mpv2", "mts", "mtv", "mxf", "mxg", "nsv", "nuv", - "ogg", "ogm", "ogv", "ogx", "ps", "rec", "rm", "rmvb", "rpl", "thp", - "tod", "ts", "tts", "txd", "vob", "vro", "webm", "wm", "wmv", "wtv", - nullptr -}; + "3ga", "669", "a52", "aac", "ac3", "adt", "adts", "aif", + "aifc", "aiff", "amb", "amr", "aob", "ape", "au", "awb", + "caf", "dts", "flac", "it", "kar", "m4a", "m4b", "m4p", + "m5p", "mid", "mka", "mlp", "mod", "mpa", "mp1", "mp2", + "mp3", "mpc", "mpga", "mus", "oga", "ogg", "oma", "opus", + "qcp", "ra", "rmi", "s3m", "sid", "spx", "tak", "thd", + "tta", "voc", "vqf", "w64", "wav", "wma", "wv", "xa", + "xm", "3g2", "3gp", "3gp2", "3gpp", "amv", "asf", "avi", + "bik", "crf", "divx", "drc", "dv", "evo", "f4v", "flv", + "gvi", "gxf", "iso", "m1v", "m2v", "m2t", "m2ts", "m4v", + "mkv", "mov", "mp2", "mp2v", "mp4", "mp4v", "mpe", "mpeg", + "mpeg1", "mpeg2", "mpeg4", "mpg", "mpv2", "mts", "mtv", "mxf", + "mxg", "nsv", "nuv", "ogg", "ogm", "ogv", "ogx", "ps", + "rec", "rm", "rmvb", "rpl", "thp", "tod", "ts", "tts", + "txd", "vob", "vro", "webm", "wm", "wmv", "wtv", nullptr}; static string GenerateSourceName(const char *base) { @@ -50,7 +45,7 @@ if (inc) { name += " ("; - name += to_string(inc+1); + name += to_string(inc + 1); name += ")"; } @@ -62,7 +57,7 @@ void OBSBasic::AddDropSource(const char *data, DropType image) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); obs_data_t *settings = obs_data_create(); obs_source_t *source = nullptr; const char *type = nullptr; @@ -115,8 +110,8 @@ if (name.isEmpty()) name = obs_source_get_display_name(type); source = obs_source_create(type, - GenerateSourceName(QT_TO_UTF8(name)).c_str(), - settings, nullptr); + GenerateSourceName(QT_TO_UTF8(name)).c_str(), + settings, nullptr); if (source) { OBSScene scene = main->GetCurrentScene(); obs_scene_add(scene, source); @@ -143,7 +138,7 @@ void OBSBasic::dropEvent(QDropEvent *event) { - const QMimeData* mimeData = event->mimeData(); + const QMimeData *mimeData = event->mimeData(); if (mimeData->hasUrls()) { QList<QUrl> urls = mimeData->urls(); @@ -162,20 +157,20 @@ const char **cmp; -#define CHECK_SUFFIX(extensions, type) \ -cmp = extensions; \ -while (*cmp) { \ - if (strcmp(*cmp, suffix) == 0) { \ - AddDropSource(QT_TO_UTF8(file), type); \ - found = true; \ - break; \ - } \ -\ - cmp++; \ -} \ -\ -if (found) \ - continue; +#define CHECK_SUFFIX(extensions, type) \ + cmp = extensions; \ + while (*cmp) { \ + if (strcmp(*cmp, suffix) == 0) { \ + AddDropSource(QT_TO_UTF8(file), type); \ + found = true; \ + break; \ + } \ + \ + cmp++; \ + } \ + \ + if (found) \ + continue; CHECK_SUFFIX(textExtensions, DropType_Text); CHECK_SUFFIX(htmlExtensions, DropType_Html); @@ -188,4 +183,3 @@ AddDropSource(QT_TO_UTF8(mimeData->text()), DropType_RawText); } } -
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-main-outputs.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-main-outputs.cpp
Changed
@@ -12,38 +12,39 @@ volatile bool streaming_active = false; volatile bool recording_active = false; +volatile bool recording_paused = false; volatile bool replaybuf_active = false; static void OBSStreamStarting(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); - obs_output_t *obj = (obs_output_t*)calldata_ptr(params, "output"); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); + obs_output_t *obj = (obs_output_t *)calldata_ptr(params, "output"); int sec = (int)obs_output_get_active_delay(obj); if (sec == 0) return; output->delayActive = true; - QMetaObject::invokeMethod(output->main, - "StreamDelayStarting", Q_ARG(int, sec)); + QMetaObject::invokeMethod(output->main, "StreamDelayStarting", + Q_ARG(int, sec)); } static void OBSStreamStopping(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); - obs_output_t *obj = (obs_output_t*)calldata_ptr(params, "output"); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); + obs_output_t *obj = (obs_output_t *)calldata_ptr(params, "output"); int sec = (int)obs_output_get_active_delay(obj); if (sec == 0) QMetaObject::invokeMethod(output->main, "StreamStopping"); else - QMetaObject::invokeMethod(output->main, - "StreamDelayStopping", Q_ARG(int, sec)); + QMetaObject::invokeMethod(output->main, "StreamDelayStopping", + Q_ARG(int, sec)); } static void OBSStartStreaming(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); output->streamingActive = true; os_atomic_set_bool(&streaming_active, true); QMetaObject::invokeMethod(output->main, "StreamingStart"); @@ -53,7 +54,7 @@ static void OBSStopStreaming(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); int code = (int)calldata_int(params, "code"); const char *last_error = calldata_string(params, "last_error"); @@ -62,14 +63,14 @@ output->streamingActive = false; output->delayActive = false; os_atomic_set_bool(&streaming_active, false); - QMetaObject::invokeMethod(output->main, - "StreamingStop", Q_ARG(int, code), - Q_ARG(QString, arg_last_error)); + QMetaObject::invokeMethod(output->main, "StreamingStop", + Q_ARG(int, code), + Q_ARG(QString, arg_last_error)); } static void OBSStartRecording(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); output->recordingActive = true; os_atomic_set_bool(&recording_active, true); @@ -80,7 +81,7 @@ static void OBSStopRecording(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); int code = (int)calldata_int(params, "code"); const char *last_error = calldata_string(params, "last_error"); @@ -88,16 +89,17 @@ output->recordingActive = false; os_atomic_set_bool(&recording_active, false); - QMetaObject::invokeMethod(output->main, - "RecordingStop", Q_ARG(int, code), - Q_ARG(QString, arg_last_error)); + os_atomic_set_bool(&recording_paused, false); + QMetaObject::invokeMethod(output->main, "RecordingStop", + Q_ARG(int, code), + Q_ARG(QString, arg_last_error)); UNUSED_PARAMETER(params); } static void OBSRecordStopping(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); QMetaObject::invokeMethod(output->main, "RecordStopping"); UNUSED_PARAMETER(params); @@ -105,7 +107,7 @@ static void OBSStartReplayBuffer(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); output->replayBufferActive = true; os_atomic_set_bool(&replaybuf_active, true); @@ -116,20 +118,20 @@ static void OBSStopReplayBuffer(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); int code = (int)calldata_int(params, "code"); output->replayBufferActive = false; os_atomic_set_bool(&replaybuf_active, false); - QMetaObject::invokeMethod(output->main, - "ReplayBufferStop", Q_ARG(int, code)); + QMetaObject::invokeMethod(output->main, "ReplayBufferStop", + Q_ARG(int, code)); UNUSED_PARAMETER(params); } static void OBSReplayBufferStopping(void *data, calldata_t *params) { - BasicOutputHandler *output = static_cast<BasicOutputHandler*>(data); + BasicOutputHandler *output = static_cast<BasicOutputHandler *>(data); QMetaObject::invokeMethod(output->main, "ReplayBufferStopping"); UNUSED_PARAMETER(params); @@ -168,7 +170,7 @@ /* ------------------------------------------------------------------------ */ static bool CreateAACEncoder(OBSEncoder &res, string &id, int bitrate, - const char *name, size_t idx) + const char *name, size_t idx) { const char *id_ = GetAACEncoderForBitrate(bitrate); if (!id_) { @@ -194,20 +196,20 @@ /* ------------------------------------------------------------------------ */ struct SimpleOutput : BasicOutputHandler { - OBSEncoder aacStreaming; - OBSEncoder h264Streaming; - OBSEncoder aacRecording; - OBSEncoder h264Recording; + OBSEncoder aacStreaming; + OBSEncoder h264Streaming; + OBSEncoder aacRecording; + OBSEncoder h264Recording; - string aacRecEncID; - string aacStreamEncID; + string aacRecEncID; + string aacStreamEncID; - string videoEncoder; - string videoQuality; - bool usingRecordingPreset = false; - bool recordingConfigured = false; - bool ffmpegOutput = false; - bool lowCPUx264 = false; + string videoEncoder; + string videoQuality; + bool usingRecordingPreset = false; + bool recordingConfigured = false; + bool ffmpegOutput = false; + bool lowCPUx264 = false; SimpleOutput(OBSBasic *main_); @@ -247,8 +249,8 @@ void SimpleOutput::LoadRecordingPreset_Lossless() { - fileOutput = obs_output_create("ffmpeg_output", - "simple_ffmpeg_output", nullptr, nullptr); + fileOutput = obs_output_create("ffmpeg_output", "simple_ffmpeg_output", + nullptr, nullptr); if (!fileOutput) throw "Failed to create recording FFmpeg output " "(simple output)"; @@ -267,8 +269,8 @@ void SimpleOutput::LoadRecordingPreset_h264(const char *encoderId) { - h264Recording = obs_video_encoder_create(encoderId, - "simple_h264_recording", nullptr, nullptr); + h264Recording = obs_video_encoder_create( + encoderId, "simple_h264_recording", nullptr, nullptr); if (!h264Recording) throw "Failed to create h264 recording encoder (simple output)"; obs_encoder_release(h264Recording); @@ -276,8 +278,8 @@ void SimpleOutput::LoadStreamingPreset_h264(const char *encoderId) { - h264Streaming = obs_video_encoder_create(encoderId, - "simple_h264_stream", nullptr, nullptr); + h264Streaming = obs_video_encoder_create( + encoderId, "simple_h264_stream", nullptr, nullptr); if (!h264Streaming) throw "Failed to create h264 streaming encoder (simple output)"; obs_encoder_release(h264Streaming); @@ -285,10 +287,10 @@ void SimpleOutput::LoadRecordingPreset() { - const char *quality = config_get_string(main->Config(), "SimpleOutput", - "RecQuality"); - const char *encoder = config_get_string(main->Config(), "SimpleOutput", - "RecEncoder"); + const char *quality = + config_get_string(main->Config(), "SimpleOutput", "RecQuality"); + const char *encoder = + config_get_string(main->Config(), "SimpleOutput", "RecEncoder"); videoEncoder = encoder; videoQuality = quality; @@ -320,14 +322,14 @@ LoadRecordingPreset_h264("amd_amf_h264"); } else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0) { const char *id = EncoderAvailable("jim_nvenc") - ? "jim_nvenc" - : "ffmpeg_nvenc"; + ? "jim_nvenc" + : "ffmpeg_nvenc"; LoadRecordingPreset_h264(id); } usingRecordingPreset = true; if (!CreateAACEncoder(aacRecording, aacRecEncID, 192, - "simple_aac_recording", 0)) + "simple_aac_recording", 0)) throw "Failed to create aac recording encoder " "(simple output)"; } @@ -336,7 +338,7 @@ SimpleOutput::SimpleOutput(OBSBasic *main_) : BasicOutputHandler(main_) { const char *encoder = config_get_string(main->Config(), "SimpleOutput", - "StreamEncoder"); + "StreamEncoder"); if (strcmp(encoder, SIMPLE_ENCODER_QSV) == 0) { LoadStreamingPreset_h264("obs_qsv11"); @@ -345,9 +347,8 @@ LoadStreamingPreset_h264("amd_amf_h264"); } else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0) { - const char *id = EncoderAvailable("jim_nvenc") - ? "jim_nvenc" - : "ffmpeg_nvenc"; + const char *id = EncoderAvailable("jim_nvenc") ? "jim_nvenc" + : "ffmpeg_nvenc"; LoadStreamingPreset_h264(id); } else { @@ -355,20 +356,21 @@ } if (!CreateAACEncoder(aacStreaming, aacStreamEncID, GetAudioBitrate(), - "simple_aac", 0)) + "simple_aac", 0)) throw "Failed to create aac streaming encoder (simple output)"; LoadRecordingPreset(); if (!ffmpegOutput) { bool useReplayBuffer = config_get_bool(main->Config(), - "SimpleOutput", "RecRB"); + "SimpleOutput", "RecRB"); if (useReplayBuffer) { - const char *str = config_get_string(main->Config(), - "Hotkeys", "ReplayBuffer"); + const char *str = config_get_string( + main->Config(), "Hotkeys", "ReplayBuffer"); obs_data_t *hotkey = obs_data_create_from_json(str); replayBuffer = obs_output_create("replay_buffer", - Str("ReplayBuffer"), nullptr, hotkey); + Str("ReplayBuffer"), + nullptr, hotkey); obs_data_release(hotkey); if (!replayBuffer) @@ -380,15 +382,16 @@ obs_output_get_signal_handler(replayBuffer); startReplayBuffer.Connect(signal, "start", - OBSStartReplayBuffer, this); + OBSStartReplayBuffer, this); stopReplayBuffer.Connect(signal, "stop", - OBSStopReplayBuffer, this); + OBSStopReplayBuffer, this); replayBufferStopping.Connect(signal, "stopping", - OBSReplayBufferStopping, this); + OBSReplayBufferStopping, + this); } - fileOutput = obs_output_create("ffmpeg_muxer", - "simple_file_output", nullptr, nullptr); + fileOutput = obs_output_create( + "ffmpeg_muxer", "simple_file_output", nullptr, nullptr); if (!fileOutput) throw "Failed to create recording output " "(simple output)"; @@ -396,17 +399,17 @@ } startRecording.Connect(obs_output_get_signal_handler(fileOutput), - "start", OBSStartRecording, this); - stopRecording.Connect(obs_output_get_signal_handler(fileOutput), - "stop", OBSStopRecording, this); + "start", OBSStartRecording, this); + stopRecording.Connect(obs_output_get_signal_handler(fileOutput), "stop", + OBSStopRecording, this); recordStopping.Connect(obs_output_get_signal_handler(fileOutput), - "stopping", OBSRecordStopping, this); + "stopping", OBSRecordStopping, this); } int SimpleOutput::GetAudioBitrate() const { int bitrate = (int)config_get_uint(main->Config(), "SimpleOutput", - "ABitrate"); + "ABitrate"); return FindClosestAvailableAACBitrate(bitrate); } @@ -414,19 +417,19 @@ void SimpleOutput::Update() { obs_data_t *h264Settings = obs_data_create(); - obs_data_t *aacSettings = obs_data_create(); + obs_data_t *aacSettings = obs_data_create(); - int videoBitrate = config_get_uint(main->Config(), "SimpleOutput", - "VBitrate"); + int videoBitrate = + config_get_uint(main->Config(), "SimpleOutput", "VBitrate"); int audioBitrate = GetAudioBitrate(); - bool advanced = config_get_bool(main->Config(), "SimpleOutput", - "UseAdvanced"); + bool advanced = + config_get_bool(main->Config(), "SimpleOutput", "UseAdvanced"); bool enforceBitrate = config_get_bool(main->Config(), "SimpleOutput", - "EnforceBitrate"); - const char *custom = config_get_string(main->Config(), - "SimpleOutput", "x264Settings"); + "EnforceBitrate"); + const char *custom = config_get_string(main->Config(), "SimpleOutput", + "x264Settings"); const char *encoder = config_get_string(main->Config(), "SimpleOutput", - "StreamEncoder"); + "StreamEncoder"); const char *presetType; const char *preset; @@ -457,8 +460,8 @@ obs_data_set_string(aacSettings, "rate_control", "CBR"); obs_data_set_int(aacSettings, "bitrate", audioBitrate); - obs_service_apply_encoder_settings(main->GetService(), - h264Settings, aacSettings); + obs_service_apply_encoder_settings(main->GetService(), h264Settings, + aacSettings); if (advanced && !enforceBitrate) { obs_data_set_int(h264Settings, "bitrate", videoBitrate); @@ -470,10 +473,10 @@ if (format != VIDEO_FORMAT_NV12 && format != VIDEO_FORMAT_I420) obs_encoder_set_preferred_video_format(h264Streaming, - VIDEO_FORMAT_NV12); + VIDEO_FORMAT_NV12); obs_encoder_update(h264Streaming, h264Settings); - obs_encoder_update(aacStreaming, aacSettings); + obs_encoder_update(aacStreaming, aacSettings); obs_data_release(h264Settings); obs_data_release(aacSettings); @@ -518,7 +521,7 @@ obs_data_set_string(settings, "rate_control", "CRF"); obs_data_set_string(settings, "profile", "high"); obs_data_set_string(settings, "preset", - lowCPUx264 ? "ultrafast" : "veryfast"); + lowCPUx264 ? "ultrafast" : "veryfast"); obs_encoder_update(h264Recording, settings); @@ -580,7 +583,7 @@ } void SimpleOutput::UpdateStreamingSettings_amd(obs_data_t *settings, - int bitrate) + int bitrate) { // Static Properties obs_data_set_int(settings, "Usage", 0); @@ -646,15 +649,15 @@ { SimpleOutput::Update(); obs_encoder_set_video(h264Streaming, obs_get_video()); - obs_encoder_set_audio(aacStreaming, obs_get_audio()); + obs_encoder_set_audio(aacStreaming, obs_get_audio()); if (usingRecordingPreset) { if (ffmpegOutput) { obs_output_set_media(fileOutput, obs_get_video(), - obs_get_audio()); + obs_get_audio()); } else { obs_encoder_set_video(h264Recording, obs_get_video()); - obs_encoder_set_audio(aacRecording, obs_get_audio()); + obs_encoder_set_audio(aacRecording, obs_get_audio()); } } } @@ -696,59 +699,61 @@ startStreaming.Disconnect(); stopStreaming.Disconnect(); - streamOutput = obs_output_create(type, "simple_stream", - nullptr, nullptr); + streamOutput = obs_output_create(type, "simple_stream", nullptr, + nullptr); if (!streamOutput) { - blog(LOG_WARNING, "Creation of stream output type '%s' " - "failed!", type); + blog(LOG_WARNING, + "Creation of stream output type '%s' " + "failed!", + type); return false; } obs_output_release(streamOutput); streamDelayStarting.Connect( - obs_output_get_signal_handler(streamOutput), - "starting", OBSStreamStarting, this); + obs_output_get_signal_handler(streamOutput), "starting", + OBSStreamStarting, this); streamStopping.Connect( - obs_output_get_signal_handler(streamOutput), - "stopping", OBSStreamStopping, this); + obs_output_get_signal_handler(streamOutput), "stopping", + OBSStreamStopping, this); startStreaming.Connect( - obs_output_get_signal_handler(streamOutput), - "start", OBSStartStreaming, this); + obs_output_get_signal_handler(streamOutput), "start", + OBSStartStreaming, this); stopStreaming.Connect( - obs_output_get_signal_handler(streamOutput), - "stop", OBSStopStreaming, this); + obs_output_get_signal_handler(streamOutput), "stop", + OBSStopStreaming, this); - bool isEncoded = obs_output_get_flags(streamOutput) - & OBS_OUTPUT_ENCODED; + bool isEncoded = obs_output_get_flags(streamOutput) & + OBS_OUTPUT_ENCODED; if (isEncoded) { const char *codec = obs_output_get_supported_audio_codecs( - streamOutput); + streamOutput); if (!codec) { blog(LOG_WARNING, "Failed to load audio codec"); return false; } if (strcmp(codec, "aac") != 0) { - const char *id = FindAudioEncoderFromCodec( - codec); + const char *id = + FindAudioEncoderFromCodec(codec); int audioBitrate = GetAudioBitrate(); obs_data_t *settings = obs_data_create(); obs_data_set_int(settings, "bitrate", - audioBitrate); + audioBitrate); - aacStreaming = obs_audio_encoder_create(id, - "alt_audio_enc", nullptr, 0, - nullptr); + aacStreaming = obs_audio_encoder_create( + id, "alt_audio_enc", nullptr, 0, + nullptr); obs_encoder_release(aacStreaming); if (!aacStreaming) return false; obs_encoder_update(aacStreaming, settings); obs_encoder_set_audio(aacStreaming, - obs_get_audio()); + obs_get_audio()); obs_data_release(settings); } @@ -763,31 +768,32 @@ /* --------------------- */ - bool reconnect = config_get_bool(main->Config(), "Output", - "Reconnect"); - int retryDelay = config_get_uint(main->Config(), "Output", - "RetryDelay"); - int maxRetries = config_get_uint(main->Config(), "Output", - "MaxRetries"); - bool useDelay = config_get_bool(main->Config(), "Output", - "DelayEnable"); - int delaySec = config_get_int(main->Config(), "Output", - "DelaySec"); - bool preserveDelay = config_get_bool(main->Config(), "Output", - "DelayPreserve"); - const char *bindIP = config_get_string(main->Config(), "Output", - "BindIP"); + bool reconnect = config_get_bool(main->Config(), "Output", "Reconnect"); + int retryDelay = + config_get_uint(main->Config(), "Output", "RetryDelay"); + int maxRetries = + config_get_uint(main->Config(), "Output", "MaxRetries"); + bool useDelay = + config_get_bool(main->Config(), "Output", "DelayEnable"); + int delaySec = config_get_int(main->Config(), "Output", "DelaySec"); + bool preserveDelay = + config_get_bool(main->Config(), "Output", "DelayPreserve"); + const char *bindIP = + config_get_string(main->Config(), "Output", "BindIP"); bool enableNewSocketLoop = config_get_bool(main->Config(), "Output", - "NewSocketLoopEnable"); - bool enableLowLatencyMode = config_get_bool(main->Config(), "Output", - "LowLatencyEnable"); + "NewSocketLoopEnable"); + bool enableLowLatencyMode = + config_get_bool(main->Config(), "Output", "LowLatencyEnable"); + bool enableDynBitrate = + config_get_bool(main->Config(), "Output", "DynamicBitrate"); obs_data_t *settings = obs_data_create(); obs_data_set_string(settings, "bind_ip", bindIP); obs_data_set_bool(settings, "new_socket_loop_enabled", - enableNewSocketLoop); + enableNewSocketLoop); obs_data_set_bool(settings, "low_latency_mode_enabled", - enableLowLatencyMode); + enableLowLatencyMode); + obs_data_set_bool(settings, "dyn_bitrate", enableDynBitrate); obs_output_update(streamOutput, settings); obs_data_release(settings); @@ -795,10 +801,9 @@ maxRetries = 0; obs_output_set_delay(streamOutput, useDelay ? delaySec : 0, - preserveDelay ? OBS_OUTPUT_DELAY_PRESERVE : 0); + preserveDelay ? OBS_OUTPUT_DELAY_PRESERVE : 0); - obs_output_set_reconnect_settings(streamOutput, maxRetries, - retryDelay); + obs_output_set_reconnect_settings(streamOutput, maxRetries, retryDelay); if (obs_output_start(streamOutput)) { return true; @@ -812,8 +817,7 @@ lastError = string(); blog(LOG_WARNING, "Stream output type '%s' failed to start!%s%s", type, - hasLastError ? " Last Error: " : "", - hasLastError ? error : ""); + hasLastError ? " Last Error: " : "", hasLastError ? error : ""); return false; } @@ -871,37 +875,37 @@ bool SimpleOutput::ConfigureRecording(bool updateReplayBuffer) { - const char *path = config_get_string(main->Config(), - "SimpleOutput", "FilePath"); - const char *format = config_get_string(main->Config(), - "SimpleOutput", "RecFormat"); + const char *path = + config_get_string(main->Config(), "SimpleOutput", "FilePath"); + const char *format = + config_get_string(main->Config(), "SimpleOutput", "RecFormat"); const char *mux = config_get_string(main->Config(), "SimpleOutput", - "MuxerCustom"); + "MuxerCustom"); bool noSpace = config_get_bool(main->Config(), "SimpleOutput", - "FileNameWithoutSpace"); + "FileNameWithoutSpace"); const char *filenameFormat = config_get_string(main->Config(), "Output", - "FilenameFormatting"); - bool overwriteIfExists = config_get_bool(main->Config(), "Output", - "OverwriteIfExists"); + "FilenameFormatting"); + bool overwriteIfExists = + config_get_bool(main->Config(), "Output", "OverwriteIfExists"); const char *rbPrefix = config_get_string(main->Config(), "SimpleOutput", - "RecRBPrefix"); + "RecRBPrefix"); const char *rbSuffix = config_get_string(main->Config(), "SimpleOutput", - "RecRBSuffix"); - int rbTime = config_get_int(main->Config(), "SimpleOutput", - "RecRBTime"); - int rbSize = config_get_int(main->Config(), "SimpleOutput", - "RecRBSize"); + "RecRBSuffix"); + int rbTime = + config_get_int(main->Config(), "SimpleOutput", "RecRBTime"); + int rbSize = + config_get_int(main->Config(), "SimpleOutput", "RecRBSize"); os_dir_t *dir = path && path[0] ? os_opendir(path) : nullptr; if (!dir) { if (main->isVisible()) OBSMessageBox::warning(main, - QTStr("Output.BadPath.Title"), - QTStr("Output.BadPath.Text")); + QTStr("Output.BadPath.Title"), + QTStr("Output.BadPath.Text")); else main->SysTrayNotify(QTStr("Output.BadPath.Text"), - QSystemTrayIcon::Warning); + QSystemTrayIcon::Warning); return false; } @@ -915,7 +919,7 @@ strPath += "/"; strPath += GenerateSpecifiedFilename(ffmpegOutput ? "avi" : format, - noSpace, filenameFormat); + noSpace, filenameFormat); ensure_directory_exists(strPath); if (!overwriteIfExists) FindBestFilename(strPath, noSpace); @@ -946,10 +950,10 @@ obs_data_set_bool(settings, "allow_spaces", !noSpace); obs_data_set_int(settings, "max_time_sec", rbTime); obs_data_set_int(settings, "max_size_mb", - usingRecordingPreset ? rbSize : 0); + usingRecordingPreset ? rbSize : 0); } else { obs_data_set_string(settings, ffmpegOutput ? "url" : "path", - strPath.c_str()); + strPath.c_str()); } obs_data_set_string(settings, "muxer_settings", mux); @@ -968,7 +972,7 @@ UpdateRecording(); if (!ConfigureRecording(false)) return false; - if (!obs_output_start(fileOutput)) { + if (!obs_output_start(fileOutput)) { QString error_reason; const char *error = obs_output_get_last_error(fileOutput); if (error) @@ -976,8 +980,8 @@ else error_reason = QTStr("Output.StartFailedGeneric"); QMessageBox::critical(main, - QTStr("Output.StartRecordingFailed"), - error_reason); + QTStr("Output.StartRecordingFailed"), + error_reason); return false; } @@ -990,9 +994,8 @@ if (!ConfigureRecording(true)) return false; if (!obs_output_start(replayBuffer)) { - QMessageBox::critical(main, - QTStr("Output.StartReplayFailed"), - QTStr("Output.StartFailedGeneric")); + QMessageBox::critical(main, QTStr("Output.StartReplayFailed"), + QTStr("Output.StartFailedGeneric")); return false; } @@ -1041,18 +1044,17 @@ /* ------------------------------------------------------------------------ */ struct AdvancedOutput : BasicOutputHandler { - OBSEncoder aacTrack[MAX_AUDIO_MIXES]; - OBSEncoder h264Streaming; - OBSEncoder h264Recording; - - OBSEncoder streamAudioEnc; + OBSEncoder streamAudioEnc; + OBSEncoder aacTrack[MAX_AUDIO_MIXES]; + OBSEncoder h264Streaming; + OBSEncoder h264Recording; - bool ffmpegOutput; - bool ffmpegRecording; - bool useStreamEncoder; - bool usesBitrate = false; + bool ffmpegOutput; + bool ffmpegRecording; + bool useStreamEncoder; + bool usesBitrate = false; - string aacEncoderID[MAX_AUDIO_MIXES]; + string aacEncoderID[MAX_AUDIO_MIXES]; AdvancedOutput(OBSBasic *main_); @@ -1099,7 +1101,7 @@ } static void ApplyEncoderDefaults(OBSData &settings, - const obs_encoder_t *encoder) + const obs_encoder_t *encoder) { OBSData dataRet = obs_encoder_get_defaults(encoder); obs_data_release(dataRet); @@ -1111,15 +1113,16 @@ AdvancedOutput::AdvancedOutput(OBSBasic *main_) : BasicOutputHandler(main_) { - const char *recType = config_get_string(main->Config(), "AdvOut", - "RecType"); - const char *streamEncoder = config_get_string(main->Config(), "AdvOut", - "Encoder"); - const char *recordEncoder = config_get_string(main->Config(), "AdvOut", - "RecEncoder"); + const char *recType = + config_get_string(main->Config(), "AdvOut", "RecType"); + const char *streamEncoder = + config_get_string(main->Config(), "AdvOut", "Encoder"); + const char *recordEncoder = + config_get_string(main->Config(), "AdvOut", "RecEncoder"); ffmpegOutput = astrcmpi(recType, "FFmpeg") == 0; - ffmpegRecording = ffmpegOutput && + ffmpegRecording = + ffmpegOutput && config_get_bool(main->Config(), "AdvOut", "FFOutputToFile"); useStreamEncoder = astrcmpi(recordEncoder, "none") == 0; @@ -1127,60 +1130,61 @@ OBSData recordEncSettings = GetDataFromJsonFile("recordEncoder.json"); const char *rate_control = obs_data_get_string( - useStreamEncoder ? streamEncSettings : recordEncSettings, - "rate_control"); + useStreamEncoder ? streamEncSettings : recordEncSettings, + "rate_control"); if (!rate_control) rate_control = ""; usesBitrate = astrcmpi(rate_control, "CBR") == 0 || - astrcmpi(rate_control, "VBR") == 0 || - astrcmpi(rate_control, "ABR") == 0; + astrcmpi(rate_control, "VBR") == 0 || + astrcmpi(rate_control, "ABR") == 0; if (ffmpegOutput) { - fileOutput = obs_output_create("ffmpeg_output", - "adv_ffmpeg_output", nullptr, nullptr); + fileOutput = obs_output_create( + "ffmpeg_output", "adv_ffmpeg_output", nullptr, nullptr); if (!fileOutput) throw "Failed to create recording FFmpeg output " "(advanced output)"; obs_output_release(fileOutput); } else { - bool useReplayBuffer = config_get_bool(main->Config(), - "AdvOut", "RecRB"); + bool useReplayBuffer = + config_get_bool(main->Config(), "AdvOut", "RecRB"); if (useReplayBuffer) { - const char *str = config_get_string(main->Config(), - "Hotkeys", "ReplayBuffer"); + const char *str = config_get_string( + main->Config(), "Hotkeys", "ReplayBuffer"); obs_data_t *hotkey = obs_data_create_from_json(str); replayBuffer = obs_output_create("replay_buffer", - Str("ReplayBuffer"), nullptr, hotkey); + Str("ReplayBuffer"), + nullptr, hotkey); obs_data_release(hotkey); if (!replayBuffer) throw "Failed to create replay buffer output " - "(simple output)"; + "(simple output)"; obs_output_release(replayBuffer); signal_handler_t *signal = - obs_output_get_signal_handler( - replayBuffer); + obs_output_get_signal_handler(replayBuffer); startReplayBuffer.Connect(signal, "start", - OBSStartReplayBuffer, this); + OBSStartReplayBuffer, this); stopReplayBuffer.Connect(signal, "stop", - OBSStopReplayBuffer, this); + OBSStopReplayBuffer, this); replayBufferStopping.Connect(signal, "stopping", - OBSReplayBufferStopping, this); + OBSReplayBufferStopping, + this); } - fileOutput = obs_output_create("ffmpeg_muxer", - "adv_file_output", nullptr, nullptr); + fileOutput = obs_output_create( + "ffmpeg_muxer", "adv_file_output", nullptr, nullptr); if (!fileOutput) throw "Failed to create recording output " "(advanced output)"; obs_output_release(fileOutput); if (!useStreamEncoder) { - h264Recording = obs_video_encoder_create(recordEncoder, - "recording_h264", recordEncSettings, - nullptr); + h264Recording = obs_video_encoder_create( + recordEncoder, "recording_h264", + recordEncSettings, nullptr); if (!h264Recording) throw "Failed to create recording h264 " "encoder (advanced output)"; @@ -1188,8 +1192,8 @@ } } - h264Streaming = obs_video_encoder_create(streamEncoder, - "streaming_h264", streamEncSettings, nullptr); + h264Streaming = obs_video_encoder_create( + streamEncoder, "streaming_h264", streamEncSettings, nullptr); if (!h264Streaming) throw "Failed to create streaming h264 encoder " "(advanced output)"; @@ -1200,37 +1204,52 @@ sprintf(name, "adv_aac%d", i); if (!CreateAACEncoder(aacTrack[i], aacEncoderID[i], - GetAudioBitrate(i), name, i)) + GetAudioBitrate(i), name, i)) throw "Failed to create audio encoder " "(advanced output)"; } + std::string id; + int streamTrack = + config_get_int(main->Config(), "AdvOut", "TrackIndex") - 1; + if (!CreateAACEncoder(streamAudioEnc, id, GetAudioBitrate(streamTrack), + "avc_aac_stream", streamTrack)) + throw "Failed to create streaming audio encoder " + "(advanced output)"; + startRecording.Connect(obs_output_get_signal_handler(fileOutput), - "start", OBSStartRecording, this); - stopRecording.Connect(obs_output_get_signal_handler(fileOutput), - "stop", OBSStopRecording, this); + "start", OBSStartRecording, this); + stopRecording.Connect(obs_output_get_signal_handler(fileOutput), "stop", + OBSStopRecording, this); recordStopping.Connect(obs_output_get_signal_handler(fileOutput), - "stopping", OBSRecordStopping, this); + "stopping", OBSRecordStopping, this); } void AdvancedOutput::UpdateStreamSettings() { bool applyServiceSettings = config_get_bool(main->Config(), "AdvOut", - "ApplyServiceSettings"); + "ApplyServiceSettings"); + bool dynBitrate = + config_get_bool(main->Config(), "Output", "DynamicBitrate"); + const char *streamEncoder = + config_get_string(main->Config(), "AdvOut", "Encoder"); OBSData settings = GetDataFromJsonFile("streamEncoder.json"); ApplyEncoderDefaults(settings, h264Streaming); if (applyServiceSettings) - obs_service_apply_encoder_settings(main->GetService(), - settings, nullptr); + obs_service_apply_encoder_settings(main->GetService(), settings, + nullptr); + + if (dynBitrate && astrcmpi(streamEncoder, "jim_nvenc") == 0) + obs_data_set_bool(settings, "lookahead", false); video_t *video = obs_get_video(); enum video_format format = video_output_get_format(video); if (format != VIDEO_FORMAT_NV12 && format != VIDEO_FORMAT_I420) obs_encoder_set_preferred_video_format(h264Streaming, - VIDEO_FORMAT_NV12); + VIDEO_FORMAT_NV12); obs_encoder_update(h264Streaming, settings); } @@ -1251,10 +1270,11 @@ inline void AdvancedOutput::SetupStreaming() { - bool rescale = config_get_bool(main->Config(), "AdvOut", - "Rescale"); - const char *rescaleRes = config_get_string(main->Config(), "AdvOut", - "RescaleRes"); + bool rescale = config_get_bool(main->Config(), "AdvOut", "Rescale"); + const char *rescaleRes = + config_get_string(main->Config(), "AdvOut", "RescaleRes"); + int streamTrack = + config_get_int(main->Config(), "AdvOut", "TrackIndex") - 1; uint32_t caps = obs_encoder_get_caps(h264Streaming); unsigned int cx = 0; unsigned int cy = 0; @@ -1270,31 +1290,34 @@ } } + obs_output_set_audio_encoder(streamOutput, streamAudioEnc, streamTrack); obs_encoder_set_scaled_size(h264Streaming, cx, cy); obs_encoder_set_video(h264Streaming, obs_get_video()); } inline void AdvancedOutput::SetupRecording() { - const char *path = config_get_string(main->Config(), "AdvOut", - "RecFilePath"); - const char *mux = config_get_string(main->Config(), "AdvOut", - "RecMuxerCustom"); - bool rescale = config_get_bool(main->Config(), "AdvOut", - "RecRescale"); - const char *rescaleRes = config_get_string(main->Config(), "AdvOut", - "RecRescaleRes"); + const char *path = + config_get_string(main->Config(), "AdvOut", "RecFilePath"); + const char *mux = + config_get_string(main->Config(), "AdvOut", "RecMuxerCustom"); + bool rescale = config_get_bool(main->Config(), "AdvOut", "RecRescale"); + const char *rescaleRes = + config_get_string(main->Config(), "AdvOut", "RecRescaleRes"); int tracks = config_get_int(main->Config(), "AdvOut", "RecTracks"); obs_data_t *settings = obs_data_create(); unsigned int cx = 0; unsigned int cy = 0; int idx = 0; + if (tracks == 0) + tracks = config_get_int(main->Config(), "AdvOut", "TrackIndex"); + if (useStreamEncoder) { obs_output_set_video_encoder(fileOutput, h264Streaming); if (replayBuffer) obs_output_set_video_encoder(replayBuffer, - h264Streaming); + h264Streaming); } else { uint32_t caps = obs_encoder_get_caps(h264Recording); if ((caps & OBS_ENCODER_CAP_PASS_TEXTURE) != 0) { @@ -1313,16 +1336,16 @@ obs_output_set_video_encoder(fileOutput, h264Recording); if (replayBuffer) obs_output_set_video_encoder(replayBuffer, - h264Recording); + h264Recording); } for (int i = 0; i < MAX_AUDIO_MIXES; i++) { - if ((tracks & (1<<i)) != 0) { + if ((tracks & (1 << i)) != 0) { obs_output_set_audio_encoder(fileOutput, aacTrack[i], - idx); + idx); if (replayBuffer) obs_output_set_audio_encoder(replayBuffer, - aacTrack[i], idx); + aacTrack[i], idx); idx++; } } @@ -1338,36 +1361,31 @@ inline void AdvancedOutput::SetupFFmpeg() { const char *url = config_get_string(main->Config(), "AdvOut", "FFURL"); - int vBitrate = config_get_int(main->Config(), "AdvOut", - "FFVBitrate"); - int gopSize = config_get_int(main->Config(), "AdvOut", - "FFVGOPSize"); - bool rescale = config_get_bool(main->Config(), "AdvOut", - "FFRescale"); - const char *rescaleRes = config_get_string(main->Config(), "AdvOut", - "FFRescaleRes"); - const char *formatName = config_get_string(main->Config(), "AdvOut", - "FFFormat"); - const char *mimeType = config_get_string(main->Config(), "AdvOut", - "FFFormatMimeType"); - const char *muxCustom = config_get_string(main->Config(), "AdvOut", - "FFMCustom"); - const char *vEncoder = config_get_string(main->Config(), "AdvOut", - "FFVEncoder"); - int vEncoderId = config_get_int(main->Config(), "AdvOut", - "FFVEncoderId"); - const char *vEncCustom = config_get_string(main->Config(), "AdvOut", - "FFVCustom"); - int aBitrate = config_get_int(main->Config(), "AdvOut", - "FFABitrate"); - int aMixes = config_get_int(main->Config(), "AdvOut", - "FFAudioMixes"); - const char *aEncoder = config_get_string(main->Config(), "AdvOut", - "FFAEncoder"); - int aEncoderId = config_get_int(main->Config(), "AdvOut", - "FFAEncoderId"); - const char *aEncCustom = config_get_string(main->Config(), "AdvOut", - "FFACustom"); + int vBitrate = config_get_int(main->Config(), "AdvOut", "FFVBitrate"); + int gopSize = config_get_int(main->Config(), "AdvOut", "FFVGOPSize"); + bool rescale = config_get_bool(main->Config(), "AdvOut", "FFRescale"); + const char *rescaleRes = + config_get_string(main->Config(), "AdvOut", "FFRescaleRes"); + const char *formatName = + config_get_string(main->Config(), "AdvOut", "FFFormat"); + const char *mimeType = + config_get_string(main->Config(), "AdvOut", "FFFormatMimeType"); + const char *muxCustom = + config_get_string(main->Config(), "AdvOut", "FFMCustom"); + const char *vEncoder = + config_get_string(main->Config(), "AdvOut", "FFVEncoder"); + int vEncoderId = + config_get_int(main->Config(), "AdvOut", "FFVEncoderId"); + const char *vEncCustom = + config_get_string(main->Config(), "AdvOut", "FFVCustom"); + int aBitrate = config_get_int(main->Config(), "AdvOut", "FFABitrate"); + int aMixes = config_get_int(main->Config(), "AdvOut", "FFAudioMixes"); + const char *aEncoder = + config_get_string(main->Config(), "AdvOut", "FFAEncoder"); + int aEncoderId = + config_get_int(main->Config(), "AdvOut", "FFAEncoderId"); + const char *aEncCustom = + config_get_string(main->Config(), "AdvOut", "FFACustom"); obs_data_t *settings = obs_data_create(); obs_data_set_string(settings, "url", url); @@ -1403,7 +1421,7 @@ } static inline void SetEncoderName(obs_encoder_t *encoder, const char *name, - const char *defaultName) + const char *defaultName) { obs_encoder_set_name(encoder, (name && *name) ? name : defaultName); } @@ -1411,9 +1429,9 @@ inline void AdvancedOutput::UpdateAudioSettings() { bool applyServiceSettings = config_get_bool(main->Config(), "AdvOut", - "ApplyServiceSettings"); - int streamTrackIndex = config_get_int(main->Config(), "AdvOut", - "TrackIndex"); + "ApplyServiceSettings"); + int streamTrackIndex = + config_get_int(main->Config(), "AdvOut", "TrackIndex"); obs_data_t *settings[MAX_AUDIO_MIXES]; for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { @@ -1426,7 +1444,7 @@ cfg_name += to_string((int)i + 1); cfg_name += "Name"; const char *name = config_get_string(main->Config(), "AdvOut", - cfg_name.c_str()); + cfg_name.c_str()); string def_name = "Track"; def_name += to_string((int)i + 1); @@ -1434,11 +1452,18 @@ } for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { - if (applyServiceSettings && (int)(i + 1) == streamTrackIndex) - obs_service_apply_encoder_settings(main->GetService(), - nullptr, settings[i]); - obs_encoder_update(aacTrack[i], settings[i]); + + if ((int)(i + 1) == streamTrackIndex) { + if (applyServiceSettings) { + obs_service_apply_encoder_settings( + main->GetService(), nullptr, + settings[i]); + } + + obs_encoder_update(streamAudioEnc, settings[i]); + } + obs_data_release(settings[i]); } } @@ -1450,6 +1475,7 @@ obs_encoder_set_video(h264Recording, obs_get_video()); for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) obs_encoder_set_audio(aacTrack[i], obs_get_audio()); + obs_encoder_set_audio(streamAudioEnc, obs_get_audio()); SetupStreaming(); @@ -1462,9 +1488,8 @@ int AdvancedOutput::GetAudioBitrate(size_t i) const { static const char *names[] = { - "Track1Bitrate", "Track2Bitrate", - "Track3Bitrate", "Track4Bitrate", - "Track5Bitrate", "Track6Bitrate", + "Track1Bitrate", "Track2Bitrate", "Track3Bitrate", + "Track4Bitrate", "Track5Bitrate", "Track6Bitrate", }; int bitrate = (int)config_get_uint(main->Config(), "AdvOut", names[i]); return FindClosestAvailableAACBitrate(bitrate); @@ -1472,6 +1497,9 @@ bool AdvancedOutput::StartStreaming(obs_service_t *service) { + int streamTrack = + config_get_int(main->Config(), "AdvOut", "TrackIndex") - 1; + if (!useStreamEncoder || (!ffmpegOutput && !obs_output_active(fileOutput))) { UpdateStreamSettings(); @@ -1488,9 +1516,6 @@ /* --------------------- */ - int trackIndex = config_get_int(main->Config(), "AdvOut", - "TrackIndex"); - const char *type = obs_service_get_output_type(service); if (!type) type = "rtmp_output"; @@ -1502,64 +1527,62 @@ startStreaming.Disconnect(); stopStreaming.Disconnect(); - streamOutput = obs_output_create(type, "adv_stream", - nullptr, nullptr); + streamOutput = + obs_output_create(type, "adv_stream", nullptr, nullptr); if (!streamOutput) { - blog(LOG_WARNING, "Creation of stream output type '%s' " - "failed!", type); + blog(LOG_WARNING, + "Creation of stream output type '%s' " + "failed!", + type); return false; } obs_output_release(streamOutput); streamDelayStarting.Connect( - obs_output_get_signal_handler(streamOutput), - "starting", OBSStreamStarting, this); + obs_output_get_signal_handler(streamOutput), "starting", + OBSStreamStarting, this); streamStopping.Connect( - obs_output_get_signal_handler(streamOutput), - "stopping", OBSStreamStopping, this); + obs_output_get_signal_handler(streamOutput), "stopping", + OBSStreamStopping, this); startStreaming.Connect( - obs_output_get_signal_handler(streamOutput), - "start", OBSStartStreaming, this); + obs_output_get_signal_handler(streamOutput), "start", + OBSStartStreaming, this); stopStreaming.Connect( - obs_output_get_signal_handler(streamOutput), - "stop", OBSStopStreaming, this); + obs_output_get_signal_handler(streamOutput), "stop", + OBSStopStreaming, this); - bool isEncoded = obs_output_get_flags(streamOutput) - & OBS_OUTPUT_ENCODED; + bool isEncoded = obs_output_get_flags(streamOutput) & + OBS_OUTPUT_ENCODED; if (isEncoded) { const char *codec = obs_output_get_supported_audio_codecs( - streamOutput); + streamOutput); if (!codec) { blog(LOG_WARNING, "Failed to load audio codec"); return false; } - if (strcmp(codec, "aac") == 0) { - streamAudioEnc = aacTrack[trackIndex - 1]; - } else { - obs_data_t *settings = obs_data_create(); + if (strcmp(codec, "aac") != 0) { + OBSData settings = obs_encoder_get_settings( + streamAudioEnc); + obs_data_release(settings); + const char *id = FindAudioEncoderFromCodec(codec); - int audioBitrate = - GetAudioBitrate(trackIndex - 1); - - obs_data_set_int(settings, "bitrate", - audioBitrate); - streamAudioEnc = obs_audio_encoder_create(id, - "alt_audio_enc", nullptr, - trackIndex - 1, nullptr); + + streamAudioEnc = obs_audio_encoder_create( + id, "alt_audio_enc", nullptr, + streamTrack, nullptr); if (!streamAudioEnc) return false; + obs_encoder_release(streamAudioEnc); obs_encoder_update(streamAudioEnc, settings); obs_encoder_set_audio(streamAudioEnc, - obs_get_audio()); - - obs_data_release(settings); + obs_get_audio()); } } @@ -1576,25 +1599,27 @@ bool reconnect = config_get_bool(main->Config(), "Output", "Reconnect"); int retryDelay = config_get_int(main->Config(), "Output", "RetryDelay"); int maxRetries = config_get_int(main->Config(), "Output", "MaxRetries"); - bool useDelay = config_get_bool(main->Config(), "Output", - "DelayEnable"); - int delaySec = config_get_int(main->Config(), "Output", - "DelaySec"); - bool preserveDelay = config_get_bool(main->Config(), "Output", - "DelayPreserve"); - const char *bindIP = config_get_string(main->Config(), "Output", - "BindIP"); + bool useDelay = + config_get_bool(main->Config(), "Output", "DelayEnable"); + int delaySec = config_get_int(main->Config(), "Output", "DelaySec"); + bool preserveDelay = + config_get_bool(main->Config(), "Output", "DelayPreserve"); + const char *bindIP = + config_get_string(main->Config(), "Output", "BindIP"); bool enableNewSocketLoop = config_get_bool(main->Config(), "Output", - "NewSocketLoopEnable"); - bool enableLowLatencyMode = config_get_bool(main->Config(), "Output", - "LowLatencyEnable"); + "NewSocketLoopEnable"); + bool enableLowLatencyMode = + config_get_bool(main->Config(), "Output", "LowLatencyEnable"); + bool enableDynBitrate = + config_get_bool(main->Config(), "Output", "DynamicBitrate"); obs_data_t *settings = obs_data_create(); obs_data_set_string(settings, "bind_ip", bindIP); obs_data_set_bool(settings, "new_socket_loop_enabled", - enableNewSocketLoop); + enableNewSocketLoop); obs_data_set_bool(settings, "low_latency_mode_enabled", - enableLowLatencyMode); + enableLowLatencyMode); + obs_data_set_bool(settings, "dyn_bitrate", enableDynBitrate); obs_output_update(streamOutput, settings); obs_data_release(settings); @@ -1602,10 +1627,9 @@ maxRetries = 0; obs_output_set_delay(streamOutput, useDelay ? delaySec : 0, - preserveDelay ? OBS_OUTPUT_DELAY_PRESERVE : 0); + preserveDelay ? OBS_OUTPUT_DELAY_PRESERVE : 0); - obs_output_set_reconnect_settings(streamOutput, maxRetries, - retryDelay); + obs_output_set_reconnect_settings(streamOutput, maxRetries, retryDelay); if (obs_output_start(streamOutput)) { return true; @@ -1619,8 +1643,7 @@ lastError = string(); blog(LOG_WARNING, "Stream output type '%s' failed to start!%s%s", type, - hasLastError ? " Last Error: " : "", - hasLastError ? error : ""); + hasLastError ? " Last Error: " : "", hasLastError ? error : ""); return false; } @@ -1647,28 +1670,31 @@ if (!ffmpegOutput || ffmpegRecording) { path = config_get_string(main->Config(), "AdvOut", - ffmpegRecording ? "FFFilePath" : "RecFilePath"); + ffmpegRecording ? "FFFilePath" + : "RecFilePath"); recFormat = config_get_string(main->Config(), "AdvOut", - ffmpegRecording ? "FFExtension" : "RecFormat"); + ffmpegRecording ? "FFExtension" + : "RecFormat"); filenameFormat = config_get_string(main->Config(), "Output", - "FilenameFormatting"); + "FilenameFormatting"); overwriteIfExists = config_get_bool(main->Config(), "Output", - "OverwriteIfExists"); + "OverwriteIfExists"); noSpace = config_get_bool(main->Config(), "AdvOut", - ffmpegRecording ? - "FFFileNameWithoutSpace" : - "RecFileNameWithoutSpace"); + ffmpegRecording + ? "FFFileNameWithoutSpace" + : "RecFileNameWithoutSpace"); os_dir_t *dir = path && path[0] ? os_opendir(path) : nullptr; if (!dir) { if (main->isVisible()) - OBSMessageBox::warning(main, - QTStr("Output.BadPath.Title"), - QTStr("Output.BadPath.Text")); + OBSMessageBox::warning( + main, QTStr("Output.BadPath.Title"), + QTStr("Output.BadPath.Text")); else - main->SysTrayNotify(QTStr("Output.BadPath.Text"), - QSystemTrayIcon::Warning); + main->SysTrayNotify( + QTStr("Output.BadPath.Text"), + QSystemTrayIcon::Warning); return false; } @@ -1682,15 +1708,14 @@ strPath += "/"; strPath += GenerateSpecifiedFilename(recFormat, noSpace, - filenameFormat); + filenameFormat); ensure_directory_exists(strPath); if (!overwriteIfExists) FindBestFilename(strPath, noSpace); obs_data_t *settings = obs_data_create(); - obs_data_set_string(settings, - ffmpegRecording ? "url" : "path", - strPath.c_str()); + obs_data_set_string(settings, ffmpegRecording ? "url" : "path", + strPath.c_str()); obs_output_update(fileOutput, settings); @@ -1705,8 +1730,8 @@ else error_reason = QTStr("Output.StartFailedGeneric"); QMessageBox::critical(main, - QTStr("Output.StartRecordingFailed"), - error_reason); + QTStr("Output.StartRecordingFailed"), + error_reason); return false; } @@ -1739,36 +1764,37 @@ if (!ffmpegOutput || ffmpegRecording) { path = config_get_string(main->Config(), "AdvOut", - ffmpegRecording ? "FFFilePath" : "RecFilePath"); + ffmpegRecording ? "FFFilePath" + : "RecFilePath"); recFormat = config_get_string(main->Config(), "AdvOut", - ffmpegRecording ? "FFExtension" : "RecFormat"); + ffmpegRecording ? "FFExtension" + : "RecFormat"); filenameFormat = config_get_string(main->Config(), "Output", - "FilenameFormatting"); + "FilenameFormatting"); overwriteIfExists = config_get_bool(main->Config(), "Output", - "OverwriteIfExists"); + "OverwriteIfExists"); noSpace = config_get_bool(main->Config(), "AdvOut", - ffmpegRecording ? - "FFFileNameWithoutSpace" : - "RecFileNameWithoutSpace"); + ffmpegRecording + ? "FFFileNameWithoutSpace" + : "RecFileNameWithoutSpace"); rbPrefix = config_get_string(main->Config(), "SimpleOutput", - "RecRBPrefix"); + "RecRBPrefix"); rbSuffix = config_get_string(main->Config(), "SimpleOutput", - "RecRBSuffix"); - rbTime = config_get_int(main->Config(), "AdvOut", - "RecRBTime"); - rbSize = config_get_int(main->Config(), "AdvOut", - "RecRBSize"); + "RecRBSuffix"); + rbTime = config_get_int(main->Config(), "AdvOut", "RecRBTime"); + rbSize = config_get_int(main->Config(), "AdvOut", "RecRBSize"); os_dir_t *dir = path && path[0] ? os_opendir(path) : nullptr; if (!dir) { if (main->isVisible()) - OBSMessageBox::warning(main, - QTStr("Output.BadPath.Title"), - QTStr("Output.BadPath.Text")); + OBSMessageBox::warning( + main, QTStr("Output.BadPath.Title"), + QTStr("Output.BadPath.Text")); else - main->SysTrayNotify(QTStr("Output.BadPath.Text"), - QSystemTrayIcon::Warning); + main->SysTrayNotify( + QTStr("Output.BadPath.Text"), + QSystemTrayIcon::Warning); return false; } @@ -1782,7 +1808,7 @@ strPath += "/"; strPath += GenerateSpecifiedFilename(recFormat, noSpace, - filenameFormat); + filenameFormat); ensure_directory_exists(strPath); if (!overwriteIfExists) FindBestFilename(strPath, noSpace); @@ -1812,7 +1838,7 @@ obs_data_set_bool(settings, "allow_spaces", !noSpace); obs_data_set_int(settings, "max_time_sec", rbTime); obs_data_set_int(settings, "max_size_mb", - usesBitrate ? 0 : rbSize); + usesBitrate ? 0 : rbSize); obs_output_update(replayBuffer, settings); @@ -1821,8 +1847,8 @@ if (!obs_output_start(replayBuffer)) { QMessageBox::critical(main, - QTStr("Output.StartRecordingFailed"), - QTStr("Output.StartFailedGeneric")); + QTStr("Output.StartRecordingFailed"), + QTStr("Output.StartFailedGeneric")); return false; }
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-main-outputs.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-main-outputs.hpp
Changed
@@ -5,49 +5,49 @@ class OBSBasic; struct BasicOutputHandler { - OBSOutput fileOutput; - OBSOutput streamOutput; - OBSOutput replayBuffer; - bool streamingActive = false; - bool recordingActive = false; - bool delayActive = false; - bool replayBufferActive = false; - OBSBasic *main; - - std::string outputType; - std::string lastError; - - OBSSignal startRecording; - OBSSignal stopRecording; - OBSSignal startReplayBuffer; - OBSSignal stopReplayBuffer; - OBSSignal startStreaming; - OBSSignal stopStreaming; - OBSSignal streamDelayStarting; - OBSSignal streamStopping; - OBSSignal recordStopping; - OBSSignal replayBufferStopping; + OBSOutput fileOutput; + OBSOutput streamOutput; + OBSOutput replayBuffer; + bool streamingActive = false; + bool recordingActive = false; + bool delayActive = false; + bool replayBufferActive = false; + OBSBasic *main; + + std::string outputType; + std::string lastError; + + OBSSignal startRecording; + OBSSignal stopRecording; + OBSSignal startReplayBuffer; + OBSSignal stopReplayBuffer; + OBSSignal startStreaming; + OBSSignal stopStreaming; + OBSSignal streamDelayStarting; + OBSSignal streamStopping; + OBSSignal recordStopping; + OBSSignal replayBufferStopping; inline BasicOutputHandler(OBSBasic *main_) : main(main_) {} - virtual ~BasicOutputHandler() {}; + virtual ~BasicOutputHandler(){}; virtual bool StartStreaming(obs_service_t *service) = 0; virtual bool StartRecording() = 0; - virtual bool StartReplayBuffer() {return false;} + virtual bool StartReplayBuffer() { return false; } virtual void StopStreaming(bool force = false) = 0; virtual void StopRecording(bool force = false) = 0; - virtual void StopReplayBuffer(bool force = false) {(void)force;} + virtual void StopReplayBuffer(bool force = false) { (void)force; } virtual bool StreamingActive() const = 0; virtual bool RecordingActive() const = 0; - virtual bool ReplayBufferActive() const {return false;} + virtual bool ReplayBufferActive() const { return false; } virtual void Update() = 0; inline bool Active() const { return streamingActive || recordingActive || delayActive || - replayBufferActive; + replayBufferActive; } };
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-main-profiles.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-main-profiles.cpp
Changed
@@ -30,13 +30,13 @@ extern void CheckExistingCookieId(); extern void DeleteCookies(); -void EnumProfiles(std::function<bool (const char *, const char *)> &&cb) +void EnumProfiles(std::function<bool(const char *, const char *)> &&cb) { char path[512]; os_glob_t *glob; int ret = GetConfigPath(path, sizeof(path), - "obs-studio/basic/profiles/*"); + "obs-studio/basic/profiles/*"); if (ret <= 0) { blog(LOG_WARNING, "Failed to get profiles config path"); return; @@ -54,8 +54,7 @@ if (!glob->gl_pathv[i].directory) continue; - if (strcmp(dirName, ".") == 0 || - strcmp(dirName, "..") == 0) + if (strcmp(dirName, ".") == 0 || strcmp(dirName, "..") == 0) continue; std::string file = filePath; @@ -80,8 +79,7 @@ static bool ProfileExists(const char *findName) { bool found = false; - auto func = [&](const char *name, const char*) - { + auto func = [&](const char *name, const char *) { if (strcmp(name, findName) == 0) { found = true; return false; @@ -94,28 +92,28 @@ } static bool GetProfileName(QWidget *parent, std::string &name, - std::string &file, const char *title, const char *text, - const char *oldName = nullptr) + std::string &file, const char *title, + const char *text, const char *oldName = nullptr) { char path[512]; int ret; for (;;) { - bool success = NameDialog::AskForName(parent, title, text, - name, QT_UTF8(oldName)); + bool success = NameDialog::AskForName(parent, title, text, name, + QT_UTF8(oldName)); if (!success) { return false; } if (name.empty()) { OBSMessageBox::warning(parent, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); continue; } if (ProfileExists(name.c_str())) { OBSMessageBox::warning(parent, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + QTStr("NameExists.Title"), + QTStr("NameExists.Text")); continue; } break; @@ -123,7 +121,7 @@ if (!GetFileSafeName(name.c_str(), file)) { blog(LOG_WARNING, "Failed to create safe file name for '%s'", - name.c_str()); + name.c_str()); return false; } @@ -137,7 +135,7 @@ if (!GetClosestUnusedFileName(file, nullptr)) { blog(LOG_WARNING, "Failed to get closest file name for %s", - file.c_str()); + file.c_str()); return false; } @@ -170,13 +168,14 @@ if (glob->gl_pathv[i].directory) continue; - ret = snprintf(path, sizeof(path), "%s/%s", - to, strrchr(filePath, '/') + 1); + ret = snprintf(path, sizeof(path), "%s/%s", to, + strrchr(filePath, '/') + 1); if (ret > 0) { if (os_copyfile(filePath, path) != 0) { - blog(LOG_WARNING, "CopyProfile: Failed to " - "copy file %s to %s", - filePath, path); + blog(LOG_WARNING, + "CopyProfile: Failed to " + "copy file %s to %s", + filePath, path); } } } @@ -187,7 +186,7 @@ } bool OBSBasic::AddProfile(bool create_new, const char *title, const char *text, - const char *init_text, bool rename) + const char *init_text, bool rename) { std::string newName; std::string newDir; @@ -197,12 +196,12 @@ if (!GetProfileName(this, newName, newDir, title, text, init_text)) return false; - std::string curDir = config_get_string(App()->GlobalConfig(), - "Basic", "ProfileDir"); + std::string curDir = + config_get_string(App()->GlobalConfig(), "Basic", "ProfileDir"); char baseDir[512]; int ret = GetConfigPath(baseDir, sizeof(baseDir), - "obs-studio/basic/profiles/"); + "obs-studio/basic/profiles/"); if (ret <= 0) { blog(LOG_WARNING, "Failed to get profiles config path"); return false; @@ -213,7 +212,7 @@ if (os_mkdir(newPath.c_str()) < 0) { blog(LOG_WARNING, "Failed to create profile directory '%s'", - newDir.c_str()); + newDir.c_str()); return false; } @@ -224,14 +223,14 @@ if (config.Open(newPath.c_str(), CONFIG_OPEN_ALWAYS) != 0) { blog(LOG_ERROR, "Failed to open new config file '%s'", - newDir.c_str()); + newDir.c_str()); return false; } config_set_string(App()->GlobalConfig(), "Basic", "Profile", - newName.c_str()); + newName.c_str()); config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir", - newDir.c_str()); + newDir.c_str()); Auth::Save(); if (create_new) { @@ -253,7 +252,7 @@ ResetProfileData(); blog(LOG_INFO, "Created profile '%s' (%s, %s)", newName.c_str(), - create_new ? "clean" : "duplicate", newDir.c_str()); + create_new ? "clean" : "duplicate", newDir.c_str()); blog(LOG_INFO, "------------------------------------------------"); config_save_safe(App()->GlobalConfig(), "tmp", nullptr); @@ -280,14 +279,14 @@ ret = snprintf(profilePath, 512, "%s/%s/*", basePath, profileDir); if (ret <= 0) { blog(LOG_WARNING, "Failed to get path for profile dir '%s'", - profileDir); + profileDir); return; } os_glob_t *glob; if (os_glob(profilePath, 0, &glob) != 0) { blog(LOG_WARNING, "Failed to glob profile dir '%s'", - profileDir); + profileDir); return; } @@ -305,21 +304,20 @@ ret = snprintf(profilePath, 512, "%s/%s", basePath, profileDir); if (ret <= 0) { blog(LOG_WARNING, "Failed to get path for profile dir '%s'", - profileDir); + profileDir); return; } os_rmdir(profilePath); blog(LOG_INFO, "------------------------------------------------"); - blog(LOG_INFO, "Removed profile '%s' (%s)", - profileName, profileDir); + blog(LOG_INFO, "Removed profile '%s' (%s)", profileName, profileDir); blog(LOG_INFO, "------------------------------------------------"); } void OBSBasic::RefreshProfiles() { - QList<QAction*> menuActions = ui->profileMenu->actions(); + QList<QAction *> menuActions = ui->profileMenu->actions(); int count = 0; for (int i = 0; i < menuActions.count(); i++) { @@ -328,17 +326,16 @@ delete menuActions[i]; } - const char *curName = config_get_string(App()->GlobalConfig(), - "Basic", "Profile"); + const char *curName = + config_get_string(App()->GlobalConfig(), "Basic", "Profile"); - auto addProfile = [&](const char *name, const char *path) - { + auto addProfile = [&](const char *name, const char *path) { std::string file = strrchr(path, '/') + 1; QAction *action = new QAction(QT_UTF8(name), this); action->setProperty("file_name", QT_UTF8(path)); - connect(action, &QAction::triggered, - this, &OBSBasic::ChangeProfile); + connect(action, &QAction::triggered, this, + &OBSBasic::ChangeProfile); action->setCheckable(true); action->setChecked(strcmp(name, curName) == 0); @@ -364,15 +361,15 @@ /* load audio monitoring */ #if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO - const char *device_name = config_get_string(basicConfig, "Audio", - "MonitoringDeviceName"); - const char *device_id = config_get_string(basicConfig, "Audio", - "MonitoringDeviceId"); + const char *device_name = + config_get_string(basicConfig, "Audio", "MonitoringDeviceName"); + const char *device_id = + config_get_string(basicConfig, "Audio", "MonitoringDeviceId"); obs_set_audio_monitoring_device(device_name, device_id); blog(LOG_INFO, "Audio monitoring device:\n\tname: %s\n\tid: %s", - device_name, device_id); + device_name, device_id); #endif } @@ -388,14 +385,15 @@ void OBSBasic::on_actionRenameProfile_triggered() { - std::string curDir = config_get_string(App()->GlobalConfig(), - "Basic", "ProfileDir"); - std::string curName = config_get_string(App()->GlobalConfig(), - "Basic", "Profile"); + std::string curDir = + config_get_string(App()->GlobalConfig(), "Basic", "ProfileDir"); + std::string curName = + config_get_string(App()->GlobalConfig(), "Basic", "Profile"); /* Duplicate and delete in case there are any issues in the process */ bool success = AddProfile(false, Str("RenameProfile.Title"), - Str("AddProfile.Text"), curName.c_str(), true); + Str("AddProfile.Text"), curName.c_str(), + true); if (success) { DeleteProfile(curName.c_str(), curDir.c_str()); RefreshProfiles(); @@ -413,13 +411,12 @@ std::string newPath; ConfigFile config; - std::string oldDir = config_get_string(App()->GlobalConfig(), - "Basic", "ProfileDir"); - std::string oldName = config_get_string(App()->GlobalConfig(), - "Basic", "Profile"); + std::string oldDir = + config_get_string(App()->GlobalConfig(), "Basic", "ProfileDir"); + std::string oldName = + config_get_string(App()->GlobalConfig(), "Basic", "Profile"); - auto cb = [&](const char *name, const char *filePath) - { + auto cb = [&](const char *name, const char *filePath) { if (strcmp(oldName.c_str(), name) != 0) { newName = name; newPath = filePath; @@ -438,8 +435,8 @@ QString text = QTStr("ConfirmRemove.Text"); text.replace("$1", QT_UTF8(oldName.c_str())); - QMessageBox::StandardButton button = OBSMessageBox::question(this, - QTStr("ConfirmRemove.Title"), text); + QMessageBox::StandardButton button = OBSMessageBox::question( + this, QTStr("ConfirmRemove.Title"), text); if (button == QMessageBox::No) return; @@ -448,7 +445,7 @@ if (config.Open(newPath.c_str(), CONFIG_OPEN_ALWAYS) != 0) { blog(LOG_ERROR, "ChangeProfile: Failed to load file '%s'", - newPath.c_str()); + newPath.c_str()); return; } @@ -457,9 +454,8 @@ const char *newDir = strrchr(newPath.c_str(), '/') + 1; config_set_string(App()->GlobalConfig(), "Basic", "Profile", - newName.c_str()); - config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir", - newDir); + newName.c_str()); + config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir", newDir); Auth::Save(); auth.reset(); @@ -474,8 +470,8 @@ RefreshProfiles(); config_save_safe(App()->GlobalConfig(), "tmp", nullptr); - blog(LOG_INFO, "Switched to profile '%s' (%s)", - newName.c_str(), newDir); + blog(LOG_INFO, "Switched to profile '%s' (%s)", newName.c_str(), + newDir); blog(LOG_INFO, "------------------------------------------------"); UpdateTitleBar(); @@ -501,11 +497,8 @@ } QString dir = QFileDialog::getExistingDirectory( - this, - QTStr("Basic.MainMenu.Profile.Import"), - home, - QFileDialog::ShowDirsOnly | - QFileDialog::DontResolveSymlinks); + this, QTStr("Basic.MainMenu.Profile.Import"), home, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (!dir.isEmpty() && !dir.isNull()) { QString inputPath = QString::fromUtf8(path); @@ -517,18 +510,18 @@ if (!folder.exists()) { folder.mkpath(profileDir); QFile::copy(dir + "/basic.ini", - profileDir + "/basic.ini"); + profileDir + "/basic.ini"); QFile::copy(dir + "/service.json", - profileDir + "/service.json"); + profileDir + "/service.json"); QFile::copy(dir + "/streamEncoder.json", - profileDir + "/streamEncoder.json"); + profileDir + "/streamEncoder.json"); QFile::copy(dir + "/recordEncoder.json", - profileDir + "/recordEncoder.json"); + profileDir + "/recordEncoder.json"); RefreshProfiles(); } else { - OBSMessageBox::warning(this, - QTStr("Basic.MainMenu.Profile.Import"), - QTStr("Basic.MainMenu.Profile.Exists")); + OBSMessageBox::warning( + this, QTStr("Basic.MainMenu.Profile.Import"), + QTStr("Basic.MainMenu.Profile.Exists")); } } } @@ -539,9 +532,8 @@ QString home = QDir::homePath(); - QString currentProfile = - QString::fromUtf8(config_get_string(App()->GlobalConfig(), - "Basic", "ProfileDir")); + QString currentProfile = QString::fromUtf8(config_get_string( + App()->GlobalConfig(), "Basic", "ProfileDir")); int ret = GetConfigPath(path, 512, "obs-studio/basic/profiles/"); if (ret <= 0) { @@ -550,11 +542,8 @@ } QString dir = QFileDialog::getExistingDirectory( - this, - QTStr("Basic.MainMenu.Profile.Export"), - home, - QFileDialog::ShowDirsOnly | - QFileDialog::DontResolveSymlinks); + this, QTStr("Basic.MainMenu.Profile.Export"), home, + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (!dir.isEmpty() && !dir.isNull()) { QString outputDir = dir + "/" + currentProfile; @@ -571,26 +560,28 @@ QFile::remove(outputDir + "/service.json"); if (QFile::exists(outputDir + "/streamEncoder.json")) - QFile::remove(outputDir + "/streamEncoder.json"); + QFile::remove(outputDir + + "/streamEncoder.json"); if (QFile::exists(outputDir + "/recordEncoder.json")) - QFile::remove(outputDir + "/recordEncoder.json"); + QFile::remove(outputDir + + "/recordEncoder.json"); } QFile::copy(inputPath + currentProfile + "/basic.ini", - outputDir + "/basic.ini"); + outputDir + "/basic.ini"); QFile::copy(inputPath + currentProfile + "/service.json", - outputDir + "/service.json"); + outputDir + "/service.json"); QFile::copy(inputPath + currentProfile + "/streamEncoder.json", - outputDir + "/streamEncoder.json"); + outputDir + "/streamEncoder.json"); QFile::copy(inputPath + currentProfile + "/recordEncoder.json", - outputDir + "/recordEncoder.json"); + outputDir + "/recordEncoder.json"); } } void OBSBasic::ChangeProfile() { - QAction *action = reinterpret_cast<QAction*>(sender()); + QAction *action = reinterpret_cast<QAction *>(sender()); ConfigFile config; std::string path; @@ -601,8 +592,8 @@ if (path.empty()) return; - const char *oldName = config_get_string(App()->GlobalConfig(), - "Basic", "Profile"); + const char *oldName = + config_get_string(App()->GlobalConfig(), "Basic", "Profile"); if (action->text().compare(QT_UTF8(oldName)) == 0) { action->setChecked(true); return; @@ -613,7 +604,7 @@ if (config.Open(path.c_str(), CONFIG_OPEN_ALWAYS) != 0) { blog(LOG_ERROR, "ChangeProfile: Failed to load file '%s'", - path.c_str()); + path.c_str()); return; } @@ -623,8 +614,7 @@ const char *newDir = strrchr(path.c_str(), '/') + 1; config_set_string(App()->GlobalConfig(), "Basic", "Profile", newName); - config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir", - newDir); + config_set_string(App()->GlobalConfig(), "Basic", "ProfileDir", newDir); Auth::Save(); auth.reset(); @@ -642,8 +632,7 @@ CheckForSimpleModeX264Fallback(); - blog(LOG_INFO, "Switched to profile '%s' (%s)", - newName, newDir); + blog(LOG_INFO, "Switched to profile '%s' (%s)", newName, newDir); blog(LOG_INFO, "------------------------------------------------"); if (api) @@ -652,10 +641,10 @@ void OBSBasic::CheckForSimpleModeX264Fallback() { - const char *curStreamEncoder = config_get_string(basicConfig, - "SimpleOutput", "StreamEncoder"); - const char *curRecEncoder = config_get_string(basicConfig, - "SimpleOutput", "RecEncoder"); + const char *curStreamEncoder = + config_get_string(basicConfig, "SimpleOutput", "StreamEncoder"); + const char *curRecEncoder = + config_get_string(basicConfig, "SimpleOutput", "RecEncoder"); bool qsv_supported = false; bool amd_supported = false; bool nve_supported = false; @@ -672,8 +661,7 @@ nve_supported = true; } - auto CheckEncoder = [&] (const char *&name) - { + auto CheckEncoder = [&](const char *&name) { if (strcmp(name, SIMPLE_ENCODER_QSV) == 0) { if (!qsv_supported) { changed = true; @@ -698,13 +686,11 @@ }; if (!CheckEncoder(curStreamEncoder)) - config_set_string(basicConfig, - "SimpleOutput", "StreamEncoder", - curStreamEncoder); + config_set_string(basicConfig, "SimpleOutput", "StreamEncoder", + curStreamEncoder); if (!CheckEncoder(curRecEncoder)) - config_set_string(basicConfig, - "SimpleOutput", "RecEncoder", - curRecEncoder); + config_set_string(basicConfig, "SimpleOutput", "RecEncoder", + curRecEncoder); if (changed) config_save_safe(basicConfig, "tmp", nullptr); }
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-main-scene-collections.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-main-scene-collections.cpp
Changed
@@ -28,16 +28,16 @@ using namespace std; -void EnumSceneCollections(std::function<bool (const char *, const char *)> &&cb) +void EnumSceneCollections(std::function<bool(const char *, const char *)> &&cb) { char path[512]; os_glob_t *glob; int ret = GetConfigPath(path, sizeof(path), - "obs-studio/basic/scenes/*.json"); + "obs-studio/basic/scenes/*.json"); if (ret <= 0) { blog(LOG_WARNING, "Failed to get config path for scene " - "collections"); + "collections"); return; } @@ -52,8 +52,8 @@ if (glob->gl_pathv[i].directory) continue; - obs_data_t *data = obs_data_create_from_json_file_safe(filePath, - "bak"); + obs_data_t *data = + obs_data_create_from_json_file_safe(filePath, "bak"); std::string name = obs_data_get_string(data, "name"); /* if no name found, use the file name as the name @@ -75,8 +75,7 @@ static bool SceneCollectionExists(const char *findName) { bool found = false; - auto func = [&](const char *name, const char*) - { + auto func = [&](const char *name, const char *) { if (strcmp(name, findName) == 0) { found = true; return false; @@ -90,7 +89,8 @@ } static bool GetSceneCollectionName(QWidget *parent, std::string &name, - std::string &file, const char *oldName = nullptr) + std::string &file, + const char *oldName = nullptr) { bool rename = oldName != nullptr; const char *title; @@ -101,28 +101,28 @@ if (rename) { title = Str("Basic.Main.RenameSceneCollection.Title"); - text = Str("Basic.Main.AddSceneCollection.Text"); + text = Str("Basic.Main.AddSceneCollection.Text"); } else { title = Str("Basic.Main.AddSceneCollection.Title"); - text = Str("Basic.Main.AddSceneCollection.Text"); + text = Str("Basic.Main.AddSceneCollection.Text"); } for (;;) { - bool success = NameDialog::AskForName(parent, title, text, - name, QT_UTF8(oldName)); + bool success = NameDialog::AskForName(parent, title, text, name, + QT_UTF8(oldName)); if (!success) { return false; } if (name.empty()) { OBSMessageBox::warning(parent, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); continue; } if (SceneCollectionExists(name.c_str())) { OBSMessageBox::warning(parent, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + QTStr("NameExists.Title"), + QTStr("NameExists.Text")); continue; } break; @@ -130,7 +130,7 @@ if (!GetFileSafeName(name.c_str(), file)) { blog(LOG_WARNING, "Failed to create safe file name for '%s'", - name.c_str()); + name.c_str()); return false; } @@ -145,7 +145,7 @@ if (!GetClosestUnusedFileName(file, "json")) { blog(LOG_WARNING, "Failed to get closest file name for %s", - file.c_str()); + file.c_str()); return false; } @@ -171,9 +171,9 @@ SaveProjectNow(); config_set_string(App()->GlobalConfig(), "Basic", "SceneCollection", - name.c_str()); + name.c_str()); config_set_string(App()->GlobalConfig(), "Basic", "SceneCollectionFile", - file.c_str()); + file.c_str()); if (create_new) { CreateDefaultScene(false); } @@ -181,8 +181,7 @@ RefreshSceneCollections(); blog(LOG_INFO, "Added scene collection '%s' (%s, %s.json)", - name.c_str(), create_new ? "clean" : "duplicate", - file.c_str()); + name.c_str(), create_new ? "clean" : "duplicate", file.c_str()); blog(LOG_INFO, "------------------------------------------------"); UpdateTitleBar(); @@ -197,7 +196,7 @@ void OBSBasic::RefreshSceneCollections() { - QList<QAction*> menuActions = ui->sceneCollectionMenu->actions(); + QList<QAction *> menuActions = ui->sceneCollectionMenu->actions(); int count = 0; for (int i = 0; i < menuActions.count(); i++) { @@ -206,18 +205,17 @@ delete menuActions[i]; } - const char *cur_name = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollection"); + const char *cur_name = config_get_string(App()->GlobalConfig(), "Basic", + "SceneCollection"); - auto addCollection = [&](const char *name, const char *path) - { + auto addCollection = [&](const char *name, const char *path) { std::string file = strrchr(path, '/') + 1; file.erase(file.size() - 5, 5); QAction *action = new QAction(QT_UTF8(name), this); action->setProperty("file_name", QT_UTF8(path)); - connect(action, &QAction::triggered, - this, &OBSBasic::ChangeSceneCollection); + connect(action, &QAction::triggered, this, + &OBSBasic::ChangeSceneCollection); action->setCheckable(true); action->setChecked(strcmp(name, cur_name) == 0); @@ -243,7 +241,7 @@ ui->actionRemoveSceneCollection->setEnabled(count > 1); - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); main->ui->actionPasteFilters->setEnabled(false); main->ui->actionPasteRef->setEnabled(false); @@ -265,19 +263,19 @@ std::string name; std::string file; - std::string oldFile = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollectionFile"); - const char *oldName = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollection"); + std::string oldFile = config_get_string(App()->GlobalConfig(), "Basic", + "SceneCollectionFile"); + const char *oldName = config_get_string(App()->GlobalConfig(), "Basic", + "SceneCollection"); bool success = GetSceneCollectionName(this, name, file, oldName); if (!success) return; config_set_string(App()->GlobalConfig(), "Basic", "SceneCollection", - name.c_str()); + name.c_str()); config_set_string(App()->GlobalConfig(), "Basic", "SceneCollectionFile", - file.c_str()); + file.c_str()); SaveProjectNow(); char path[512]; @@ -295,7 +293,7 @@ blog(LOG_INFO, "------------------------------------------------"); blog(LOG_INFO, "Renamed scene collection to '%s' (%s.json)", - name.c_str(), file.c_str()); + name.c_str(), file.c_str()); blog(LOG_INFO, "------------------------------------------------"); UpdateTitleBar(); @@ -312,13 +310,12 @@ std::string newName; std::string newPath; - std::string oldFile = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollectionFile"); - std::string oldName = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollection"); + std::string oldFile = config_get_string(App()->GlobalConfig(), "Basic", + "SceneCollectionFile"); + std::string oldName = config_get_string(App()->GlobalConfig(), "Basic", + "SceneCollection"); - auto cb = [&](const char *name, const char *filePath) - { + auto cb = [&](const char *name, const char *filePath) { if (strcmp(oldName.c_str(), name) != 0) { newName = name; newPath = filePath; @@ -337,8 +334,8 @@ QString text = QTStr("ConfirmRemove.Text"); text.replace("$1", QT_UTF8(oldName.c_str())); - QMessageBox::StandardButton button = OBSMessageBox::question(this, - QTStr("ConfirmRemove.Title"), text); + QMessageBox::StandardButton button = OBSMessageBox::question( + this, QTStr("ConfirmRemove.Title"), text); if (button == QMessageBox::No) return; @@ -358,13 +355,13 @@ Load(newPath.c_str()); RefreshSceneCollections(); - const char *newFile = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollectionFile"); + const char *newFile = config_get_string(App()->GlobalConfig(), "Basic", + "SceneCollectionFile"); - blog(LOG_INFO, "Removed scene collection '%s' (%s.json), " - "switched to '%s' (%s.json)", - oldName.c_str(), oldFile.c_str(), - newName.c_str(), newFile); + blog(LOG_INFO, + "Removed scene collection '%s' (%s.json), " + "switched to '%s' (%s.json)", + oldName.c_str(), oldFile.c_str(), newName.c_str(), newFile); blog(LOG_INFO, "------------------------------------------------"); UpdateTitleBar(); @@ -388,10 +385,8 @@ } QString qfilePath = QFileDialog::getOpenFileName( - this, - QTStr("Basic.MainMenu.SceneCollection.Import"), - qhome, - "JSON Files (*.json)"); + this, QTStr("Basic.MainMenu.SceneCollection.Import"), qhome, + "JSON Files (*.json)"); QFileInfo finfo(qfilePath); QString qfilename = finfo.fileName(); @@ -416,23 +411,25 @@ obs_data_set_string(scenedata, "name", name.c_str()); if (!GetFileSafeName(name.c_str(), file)) { - blog(LOG_WARNING, "Failed to create " - "safe file name for '%s'", - name.c_str()); + blog(LOG_WARNING, + "Failed to create " + "safe file name for '%s'", + name.c_str()); return; } string filePath = path + file; if (!GetClosestUnusedFileName(filePath, "json")) { - blog(LOG_WARNING, "Failed to get " - "closest file name for %s", - file.c_str()); + blog(LOG_WARNING, + "Failed to get " + "closest file name for %s", + file.c_str()); return; } - obs_data_save_json_safe(scenedata, filePath.c_str(), - "tmp", "bak"); + obs_data_save_json_safe(scenedata, filePath.c_str(), "tmp", + "bak"); RefreshSceneCollections(); } } @@ -445,8 +442,8 @@ QString home = QDir::homePath(); - QString currentFile = QT_UTF8(config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollectionFile")); + QString currentFile = QT_UTF8(config_get_string( + App()->GlobalConfig(), "Basic", "SceneCollectionFile")); int ret = GetConfigPath(path, 512, "obs-studio/basic/scenes/"); if (ret <= 0) { @@ -455,10 +452,8 @@ } QString exportFile = QFileDialog::getSaveFileName( - this, - QTStr("Basic.MainMenu.SceneCollection.Export"), - home + "/" + currentFile, - "JSON Files (*.json)"); + this, QTStr("Basic.MainMenu.SceneCollection.Export"), + home + "/" + currentFile, "JSON Files (*.json)"); string file = QT_TO_UTF8(exportFile); @@ -472,7 +467,7 @@ void OBSBasic::ChangeSceneCollection() { - QAction *action = reinterpret_cast<QAction*>(sender()); + QAction *action = reinterpret_cast<QAction *>(sender()); std::string fileName; if (!action) @@ -482,8 +477,8 @@ if (fileName.empty()) return; - const char *oldName = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollection"); + const char *oldName = config_get_string(App()->GlobalConfig(), "Basic", + "SceneCollection"); if (action->text().compare(QT_UTF8(oldName)) == 0) { action->setChecked(true); return; @@ -494,13 +489,13 @@ Load(fileName.c_str()); RefreshSceneCollections(); - const char *newName = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollection"); - const char *newFile = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollectionFile"); + const char *newName = config_get_string(App()->GlobalConfig(), "Basic", + "SceneCollection"); + const char *newFile = config_get_string(App()->GlobalConfig(), "Basic", + "SceneCollectionFile"); - blog(LOG_INFO, "Switched to scene collection '%s' (%s.json)", - newName, newFile); + blog(LOG_INFO, "Switched to scene collection '%s' (%s.json)", newName, + newFile); blog(LOG_INFO, "------------------------------------------------"); UpdateTitleBar();
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-main-transitions.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-main-transitions.cpp
Changed
@@ -54,8 +54,8 @@ if (!obs_is_source_configurable(id)) { const char *name = obs_source_get_display_name(id); - obs_source_t *tr = obs_source_create_private( - id, name, NULL); + obs_source_t *tr = + obs_source_create_private(id, name, NULL); InitTransition(tr); transitions.emplace_back(tr); @@ -68,7 +68,7 @@ for (OBSSource &tr : transitions) { ui->transitions->addItem(QT_UTF8(obs_source_get_name(tr)), - QVariant::fromValue(OBSSource(tr))); + QVariant::fromValue(OBSSource(tr))); } } @@ -79,33 +79,33 @@ dstr_printf(hotkeyId, "OBSBasic.QuickTransition.%d", qt->id); hotkeyName = QTStr("QuickTransitions.HotkeyName") - .arg(MakeQuickTransitionText(qt)); + .arg(MakeQuickTransitionText(qt)); - auto quickTransition = [] (void *data, obs_hotkey_id, obs_hotkey_t*, - bool pressed) - { + auto quickTransition = [](void *data, obs_hotkey_id, obs_hotkey_t *, + bool pressed) { int id = (int)(uintptr_t)data; OBSBasic *main = - reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); if (pressed) QMetaObject::invokeMethod(main, - "TriggerQuickTransition", - Qt::QueuedConnection, - Q_ARG(int, id)); + "TriggerQuickTransition", + Qt::QueuedConnection, + Q_ARG(int, id)); }; qt->hotkey = obs_hotkey_register_frontend(hotkeyId->array, - QT_TO_UTF8(hotkeyName), quickTransition, - (void*)(uintptr_t)qt->id); + QT_TO_UTF8(hotkeyName), + quickTransition, + (void *)(uintptr_t)qt->id); } void QuickTransition::SourceRenamed(void *param, calldata_t *data) { - QuickTransition *qt = reinterpret_cast<QuickTransition*>(param); + QuickTransition *qt = reinterpret_cast<QuickTransition *>(param); QString hotkeyName = QTStr("QuickTransitions.HotkeyName") - .arg(MakeQuickTransitionText(qt)); + .arg(MakeQuickTransitionText(qt)); obs_hotkey_set_description(qt->hotkey, QT_TO_UTF8(hotkeyName)); @@ -135,23 +135,23 @@ void OBSBasic::InitTransition(obs_source_t *transition) { - auto onTransitionStop = [] (void *data, calldata_t*) { - OBSBasic *window = (OBSBasic*)data; + auto onTransitionStop = [](void *data, calldata_t *) { + OBSBasic *window = (OBSBasic *)data; QMetaObject::invokeMethod(window, "TransitionStopped", - Qt::QueuedConnection); + Qt::QueuedConnection); }; - auto onTransitionFullStop = [] (void *data, calldata_t*) { - OBSBasic *window = (OBSBasic*)data; + auto onTransitionFullStop = [](void *data, calldata_t *) { + OBSBasic *window = (OBSBasic *)data; QMetaObject::invokeMethod(window, "TransitionFullyStopped", - Qt::QueuedConnection); + Qt::QueuedConnection); }; signal_handler_t *handler = obs_source_get_signal_handler(transition); signal_handler_connect(handler, "transition_video_stop", - onTransitionStop, this); - signal_handler_connect(handler, "transition_stop", - onTransitionFullStop, this); + onTransitionStop, this); + signal_handler_connect(handler, "transition_stop", onTransitionFullStop, + this); } static inline OBSSource GetTransitionComboItem(QComboBox *combo, int idx) @@ -163,12 +163,12 @@ { /* non-configurable transitions are always available, so add them * to the "default quick transitions" list */ - quickTransitions.emplace_back( - GetTransitionComboItem(ui->transitions, 0), - 300, quickTransitionIdCounter++); - quickTransitions.emplace_back( - GetTransitionComboItem(ui->transitions, 1), - 300, quickTransitionIdCounter++); + quickTransitions.emplace_back(GetTransitionComboItem(ui->transitions, + 0), + 300, quickTransitionIdCounter++); + quickTransitions.emplace_back(GetTransitionComboItem(ui->transitions, + 1), + 300, quickTransitionIdCounter++); } void OBSBasic::LoadQuickTransitions(obs_data_array_t *array) @@ -188,13 +188,14 @@ obs_source_t *source = FindTransition(name); if (source) { quickTransitions.emplace_back(source, duration, - id); + id); if (quickTransitionIdCounter <= id) quickTransitionIdCounter = id + 1; int idx = (int)quickTransitions.size() - 1; - AddQuickTransitionHotkey(&quickTransitions[idx]); + AddQuickTransitionHotkey( + &quickTransitions[idx]); obs_hotkey_load(quickTransitions[idx].hotkey, hotkeys); } @@ -214,7 +215,7 @@ obs_data_array_t *hotkeys = obs_hotkey_save(qt.hotkey); obs_data_set_string(data, "name", - obs_source_get_name(qt.source)); + obs_source_get_name(qt.source)); obs_data_set_int(data, "duration", qt.duration); obs_data_set_array(data, "hotkeys", hotkeys); obs_data_set_int(data, "id", qt.id); @@ -231,8 +232,7 @@ obs_source_t *OBSBasic::FindTransition(const char *name) { for (int i = 0; i < ui->transitions->count(); i++) { - OBSSource tr = ui->transitions->itemData(i) - .value<OBSSource>(); + OBSSource tr = ui->transitions->itemData(i).value<OBSSource>(); const char *trName = obs_source_get_name(tr); if (strcmp(trName, name) == 0) @@ -292,7 +292,7 @@ } void OBSBasic::TransitionToScene(OBSSource source, bool force, bool direct, - bool quickTransition) + bool quickTransition) { obs_scene_t *scene = obs_scene_from_source(source); bool usingPreviewProgram = IsPreviewProgramMode(); @@ -317,10 +317,10 @@ } if (usingPreviewProgram && sceneDuplicationMode) { - scene = obs_scene_duplicate(scene, NULL, - editPropertiesMode ? - OBS_SCENE_DUP_PRIVATE_COPY : - OBS_SCENE_DUP_PRIVATE_REFS); + scene = obs_scene_duplicate( + scene, NULL, + editPropertiesMode ? OBS_SCENE_DUP_PRIVATE_COPY + : OBS_SCENE_DUP_PRIVATE_REFS); source = obs_scene_get_source(scene); } @@ -342,8 +342,8 @@ OBSData data = obs_source_get_private_settings(source); obs_data_release(data); - const char *trOverrideName = obs_data_get_string(data, - "transition"); + const char *trOverrideName = + obs_data_get_string(data, "transition"); int duration = ui->transitionDuration->value(); if (trOverrideName && *trOverrideName && !quickTransition) { @@ -351,18 +351,18 @@ if (trOverride) { transition = trOverride; - obs_data_set_default_int(data, - "transition_duration", 300); + obs_data_set_default_int( + data, "transition_duration", 300); - duration = (int)obs_data_get_int(data, - "transition_duration"); + duration = (int)obs_data_get_int( + data, "transition_duration"); OverrideTransition(trOverride); overridingTransition = true; } } - bool success = obs_transition_start(transition, - OBS_TRANSITION_MODE_AUTO, duration, source); + bool success = obs_transition_start( + transition, OBS_TRANSITION_MODE_AUTO, duration, source); if (!success) TransitionFullyStopped(); } @@ -432,12 +432,12 @@ void OBSBasic::AddTransition() { - QAction *action = reinterpret_cast<QAction*>(sender()); + QAction *action = reinterpret_cast<QAction *>(sender()); QString idStr = action->property("id").toString(); string name; - QString placeHolderText = QT_UTF8( - obs_source_get_display_name(QT_TO_UTF8(idStr))); + QString placeHolderText = + QT_UTF8(obs_source_get_display_name(QT_TO_UTF8(idStr))); QString format = placeHolderText + " (%1)"; obs_source_t *source = nullptr; int i = 1; @@ -447,40 +447,41 @@ } bool accepted = NameDialog::AskForName(this, - QTStr("TransitionNameDlg.Title"), - QTStr("TransitionNameDlg.Text"), - name, placeHolderText); + QTStr("TransitionNameDlg.Title"), + QTStr("TransitionNameDlg.Text"), + name, placeHolderText); if (accepted) { if (name.empty()) { OBSMessageBox::warning(this, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); AddTransition(); return; } source = FindTransition(name.c_str()); if (source) { - OBSMessageBox::warning(this, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + OBSMessageBox::warning(this, QTStr("NameExists.Title"), + QTStr("NameExists.Text")); AddTransition(); return; } source = obs_source_create_private(QT_TO_UTF8(idStr), - name.c_str(), NULL); + name.c_str(), NULL); InitTransition(source); - ui->transitions->addItem(QT_UTF8(name.c_str()), - QVariant::fromValue(OBSSource(source))); + ui->transitions->addItem( + QT_UTF8(name.c_str()), + QVariant::fromValue(OBSSource(source))); ui->transitions->setCurrentIndex(ui->transitions->count() - 1); CreatePropertiesWindow(source); obs_source_release(source); if (api) - api->on_event(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED); + api->on_event( + OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED); ClearQuickTransitionWidgets(); RefreshQuickTransitions(); @@ -500,8 +501,8 @@ QAction *action = new QAction(name, this); action->setProperty("id", id); - connect(action, SIGNAL(triggered()), - this, SLOT(AddTransition())); + connect(action, SIGNAL(triggered()), this, + SLOT(AddTransition())); menu.addAction(action); foundConfigurableTransitions = true; @@ -529,7 +530,8 @@ if (qt.button) qt.button->deleteLater(); RemoveQuickTransitionHotkey(&qt); - quickTransitions.erase(quickTransitions.begin() + i - 1); + quickTransitions.erase(quickTransitions.begin() + i - + 1); } } @@ -544,7 +546,7 @@ void OBSBasic::RenameTransition() { - QAction *action = reinterpret_cast<QAction*>(sender()); + QAction *action = reinterpret_cast<QAction *>(sender()); QVariant variant = action->property("transition"); obs_source_t *transition = variant.value<OBSSource>(); @@ -553,24 +555,23 @@ obs_source_t *source = nullptr; bool accepted = NameDialog::AskForName(this, - QTStr("TransitionNameDlg.Title"), - QTStr("TransitionNameDlg.Text"), - name, placeHolderText); + QTStr("TransitionNameDlg.Title"), + QTStr("TransitionNameDlg.Text"), + name, placeHolderText); if (accepted) { if (name.empty()) { OBSMessageBox::warning(this, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); RenameTransition(); return; } source = FindTransition(name.c_str()); if (source) { - OBSMessageBox::warning(this, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + OBSMessageBox::warning(this, QTStr("NameExists.Title"), + QTStr("NameExists.Text")); RenameTransition(); return; @@ -579,10 +580,12 @@ obs_source_set_name(transition, name.c_str()); int idx = ui->transitions->findData(variant); if (idx != -1) { - ui->transitions->setItemText(idx, QT_UTF8(name.c_str())); + ui->transitions->setItemText(idx, + QT_UTF8(name.c_str())); if (api) - api->on_event(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED); + api->on_event( + OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED); ClearQuickTransitionWidgets(); RefreshQuickTransitions(); @@ -597,9 +600,7 @@ if (!obs_source_configurable(source)) return; - auto properties = [&] () { - CreatePropertiesWindow(source); - }; + auto properties = [&]() { CreatePropertiesWindow(source); }; QMenu menu(this); @@ -643,8 +644,7 @@ SetCurrentScene(source, force, direct); } -template <typename T> -static T GetOBSRef(QListWidgetItem *item) +template<typename T> static T GetOBSRef(QListWidgetItem *item) { return item->data(static_cast<int>(QtDataRole::OBSRef)).value<T>(); } @@ -679,7 +679,8 @@ ui->scenes->setCurrentItem(item); ui->scenes->blockSignals(false); if (api) - api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED); + api->on_event( + OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED); break; } } @@ -689,8 +690,8 @@ bool userSwitched = (!force && !disableSaving); blog(LOG_INFO, "%s to scene '%s'", - userSwitched ? "User switched" : "Switched", - obs_source_get_name(scene)); + userSwitched ? "User switched" : "Switched", + obs_source_get_name(scene)); } void OBSBasic::CreateProgramDisplay() @@ -698,8 +699,8 @@ program = new OBSQTDisplay(); program->setContextMenuPolicy(Qt::CustomContextMenu); - connect(program.data(), &QWidget::customContextMenuRequested, - this, &OBSBasic::on_program_customContextMenuRequested); + connect(program.data(), &QWidget::customContextMenuRequested, this, + &OBSBasic::on_program_customContextMenuRequested); auto displayResize = [this]() { struct obs_video_info ovi; @@ -708,13 +709,11 @@ ResizeProgram(ovi.base_width, ovi.base_height); }; - connect(program.data(), &OBSQTDisplay::DisplayResized, - displayResize); + connect(program.data(), &OBSQTDisplay::DisplayResized, displayResize); - auto addDisplay = [this] (OBSQTDisplay *window) - { + auto addDisplay = [this](OBSQTDisplay *window) { obs_display_add_draw_callback(window->GetDisplay(), - OBSBasic::RenderProgram, this); + OBSBasic::RenderProgram, this); struct obs_video_info ovi; if (obs_get_video_info(&ovi)) @@ -723,8 +722,7 @@ connect(program.data(), &OBSQTDisplay::DisplayCreated, addDisplay); - program->setSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Expanding); + program->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); } void OBSBasic::TransitionClicked() @@ -771,16 +769,16 @@ programOptions->setLayout(layout); - auto onAdd = [this] () { + auto onAdd = [this]() { QScopedPointer<QMenu> menu(CreateTransitionMenu(this, nullptr)); menu->exec(QCursor::pos()); }; - auto onConfig = [this] () { + auto onConfig = [this]() { QMenu menu(this); QAction *action; - auto toggleEditProperties = [this] () { + auto toggleEditProperties = [this]() { editPropertiesMode = !editPropertiesMode; OBSSource actualScene = OBSGetStrongRef(programScene); @@ -788,11 +786,11 @@ TransitionToScene(actualScene, true); }; - auto toggleSwapScenesMode = [this] () { + auto toggleSwapScenesMode = [this]() { swapScenesMode = !swapScenesMode; }; - auto toggleSceneDuplication = [this] () { + auto toggleSceneDuplication = [this]() { sceneDuplicationMode = !sceneDuplicationMode; OBSSource actualScene = OBSGetStrongRef(programScene); @@ -800,20 +798,22 @@ TransitionToScene(actualScene, true); }; - auto showToolTip = [&] () { + auto showToolTip = [&]() { QAction *act = menu.activeAction(); QToolTip::showText(QCursor::pos(), act->toolTip(), - &menu, menu.actionGeometry(act)); + &menu, menu.actionGeometry(act)); }; - action = menu.addAction(QTStr("QuickTransitions.DuplicateScene")); + action = menu.addAction( + QTStr("QuickTransitions.DuplicateScene")); action->setToolTip(QTStr("QuickTransitions.DuplicateSceneTT")); action->setCheckable(true); action->setChecked(sceneDuplicationMode); connect(action, &QAction::triggered, toggleSceneDuplication); connect(action, &QAction::hovered, showToolTip); - action = menu.addAction(QTStr("QuickTransitions.EditProperties")); + action = menu.addAction( + QTStr("QuickTransitions.EditProperties")); action->setToolTip(QTStr("QuickTransitions.EditPropertiesTT")); action->setCheckable(true); action->setChecked(editPropertiesMode); @@ -831,8 +831,8 @@ menu.exec(QCursor::pos()); }; - connect(transitionButton.data(), &QAbstractButton::clicked, - this, &OBSBasic::TransitionClicked); + connect(transitionButton.data(), &QAbstractButton::clicked, this, + &OBSBasic::TransitionClicked); connect(addQuickTransition, &QAbstractButton::clicked, onAdd); connect(configTransitions, &QAbstractButton::clicked, onConfig); } @@ -868,8 +868,7 @@ duration->setSingleStep(50); duration->setValue(curDuration); - auto setTransition = [this] (QAction *action) - { + auto setTransition = [this](QAction *action) { int idx = action->property("transition_index").toInt(); OBSSource scene = GetCurrentSceneSource(); OBSData data = obs_source_get_private_settings(scene); @@ -886,8 +885,7 @@ obs_data_set_string(data, "transition", name); }; - auto setDuration = [this] (int duration) - { + auto setDuration = [this](int duration) { OBSSource scene = GetCurrentSceneSource(); OBSData data = obs_source_get_private_settings(scene); obs_data_release(data); @@ -895,8 +893,8 @@ obs_data_set_int(data, "transition_duration", duration); }; - connect(duration, (void (QSpinBox::*)(int))&QSpinBox::valueChanged, - setDuration); + connect(duration, (void (QSpinBox::*)(int)) & QSpinBox::valueChanged, + setDuration); for (int i = -1; i < ui->transitions->count(); i++) { const char *name = ""; @@ -918,7 +916,7 @@ action->setChecked(match); connect(action, &QAction::triggered, - std::bind(setTransition, action)); + std::bind(setTransition, action)); } QWidgetAction *durationAction = new QWidgetAction(menu); @@ -937,8 +935,8 @@ if (qt) { action = menu->addAction(QTStr("Remove")); action->setProperty("id", qt->id); - connect(action, &QAction::triggered, - this, &OBSBasic::QuickTransitionRemoveClicked); + connect(action, &QAction::triggered, this, + &OBSBasic::QuickTransitionRemoveClicked); menu->addSeparator(); } @@ -953,8 +951,9 @@ duration->setValue(qt ? qt->duration : 300); if (qt) { - connect(duration, (void (QSpinBox::*)(int))&QSpinBox::valueChanged, - this, &OBSBasic::QuickTransitionChangeDuration); + connect(duration, + (void (QSpinBox::*)(int)) & QSpinBox::valueChanged, + this, &OBSBasic::QuickTransitionChangeDuration); } for (int i = 0; i < ui->transitions->count(); i++) { @@ -966,12 +965,13 @@ if (qt) { action->setProperty("id", qt->id); connect(action, &QAction::triggered, this, - &OBSBasic::QuickTransitionChange); + &OBSBasic::QuickTransitionChange); } else { - action->setProperty("duration", - QVariant::fromValue<QWidget*>(duration)); + action->setProperty( + "duration", + QVariant::fromValue<QWidget *>(duration)); connect(action, &QAction::triggered, this, - &OBSBasic::AddQuickTransition); + &OBSBasic::AddQuickTransition); } } @@ -1004,11 +1004,11 @@ /* --------------------------------- */ button->setMenu(buttonMenu); - connect(button, &QAbstractButton::clicked, - this, &OBSBasic::QuickTransitionClicked); + connect(button, &QAbstractButton::clicked, this, + &OBSBasic::QuickTransitionClicked); QVBoxLayout *programLayout = - reinterpret_cast<QVBoxLayout*>(programOptions->layout()); + reinterpret_cast<QVBoxLayout *>(programOptions->layout()); int idx = 3; for (;; idx++) { @@ -1027,7 +1027,7 @@ void OBSBasic::AddQuickTransition() { int trIdx = sender()->property("transition_index").toInt(); - QSpinBox *duration = sender()->property("duration").value<QSpinBox*>(); + QSpinBox *duration = sender()->property("duration").value<QSpinBox *>(); OBSSource transition = GetTransitionComboItem(ui->transitions, trIdx); int id = quickTransitionIdCounter++; @@ -1048,7 +1048,7 @@ return; QVBoxLayout *programLayout = - reinterpret_cast<QVBoxLayout*>(programOptions->layout()); + reinterpret_cast<QVBoxLayout *>(programOptions->layout()); for (int idx = 0;; idx++) { QLayoutItem *item = programLayout->itemAt(idx); @@ -1118,7 +1118,7 @@ return; QVBoxLayout *programLayout = - reinterpret_cast<QVBoxLayout*>(programOptions->layout()); + reinterpret_cast<QVBoxLayout *>(programOptions->layout()); for (int idx = 0;; idx++) { QLayoutItem *item = programLayout->itemAt(idx); @@ -1152,7 +1152,7 @@ return; QVBoxLayout *programLayout = - reinterpret_cast<QVBoxLayout*>(programOptions->layout()); + reinterpret_cast<QVBoxLayout *>(programOptions->layout()); for (int idx = 0;; idx++) { QLayoutItem *item = programLayout->itemAt(idx); @@ -1173,7 +1173,7 @@ return; QVBoxLayout *programLayout = - reinterpret_cast<QVBoxLayout*>(programOptions->layout()); + reinterpret_cast<QVBoxLayout *>(programOptions->layout()); for (int idx = 0;; idx++) { QLayoutItem *item = programLayout->itemAt(idx); @@ -1209,10 +1209,11 @@ obs_scene_t *dup; if (sceneDuplicationMode) { - dup = obs_scene_duplicate(curScene, nullptr, - editPropertiesMode ? - OBS_SCENE_DUP_PRIVATE_COPY : - OBS_SCENE_DUP_PRIVATE_REFS); + dup = obs_scene_duplicate( + curScene, nullptr, + editPropertiesMode + ? OBS_SCENE_DUP_PRIVATE_COPY + : OBS_SCENE_DUP_PRIVATE_REFS); } else { dup = curScene; obs_scene_addref(dup); @@ -1235,7 +1236,7 @@ programLabel = new QLabel(QTStr("StudioMode.Program")); programLabel->setSizePolicy(QSizePolicy::Preferred, - QSizePolicy::Preferred); + QSizePolicy::Preferred); programLabel->setAlignment(Qt::AlignHCenter | Qt::AlignBottom); programLabel->setProperty("themeID", "previewProgramLabels"); @@ -1248,8 +1249,8 @@ programLayout->addWidget(programLabel); programLayout->addWidget(program); - bool labels = config_get_bool(GetGlobalConfig(), - "BasicWindow", "StudioModeLabels"); + bool labels = config_get_bool(GetGlobalConfig(), "BasicWindow", + "StudioModeLabels"); programLabel->setHidden(!labels); @@ -1257,14 +1258,15 @@ ui->previewLayout->addWidget(programOptions); ui->previewLayout->addWidget(programWidget); - ui->previewLayout->setAlignment(programOptions, Qt::AlignCenter); + ui->previewLayout->setAlignment(programOptions, + Qt::AlignCenter); if (api) api->on_event(OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED); blog(LOG_INFO, "Switched to Preview/Program mode"); blog(LOG_INFO, "-----------------------------" - "-------------------"); + "-------------------"); } else { OBSSource actualProgramScene = OBSGetStrongRef(programScene); if (!actualProgramScene) @@ -1299,7 +1301,7 @@ blog(LOG_INFO, "Switched to regular Preview mode"); blog(LOG_INFO, "-----------------------------" - "-------------------"); + "-------------------"); } ResetUI(); @@ -1310,7 +1312,7 @@ { GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_DEFAULT, "RenderProgram"); - OBSBasic *window = static_cast<OBSBasic*>(data); + OBSBasic *window = static_cast<OBSBasic *>(data); obs_video_info ovi; obs_get_video_info(&ovi); @@ -1324,13 +1326,11 @@ /* --------------------------------------- */ gs_ortho(0.0f, float(ovi.base_width), 0.0f, float(ovi.base_height), - -100.0f, 100.0f); - gs_set_viewport(window->programX, window->programY, - window->programCX, window->programCY); + -100.0f, 100.0f); + gs_set_viewport(window->programX, window->programY, window->programCX, + window->programCY); - window->DrawBackdrop(float(ovi.base_width), float(ovi.base_height)); - - obs_render_main_texture(); + obs_render_main_texture_src_color_only(); gs_load_vertexbuffer(nullptr); /* --------------------------------------- */ @@ -1351,9 +1351,9 @@ /* resize program panel to fix to the top section of the window */ targetSize = GetPixelSize(program); GetScaleAndCenterPos(int(cx), int(cy), - targetSize.width() - PREVIEW_EDGE_SIZE * 2, - targetSize.height() - PREVIEW_EDGE_SIZE * 2, - programX, programY, programScale); + targetSize.width() - PREVIEW_EDGE_SIZE * 2, + targetSize.height() - PREVIEW_EDGE_SIZE * 2, + programX, programY, programScale); programX += float(PREVIEW_EDGE_SIZE); programY += float(PREVIEW_EDGE_SIZE); @@ -1371,7 +1371,8 @@ obs_data_t *sourceData = obs_data_create(); obs_data_t *settings = obs_source_get_settings(tr); - obs_data_set_string(sourceData, "name", obs_source_get_name(tr)); + obs_data_set_string(sourceData, "name", + obs_source_get_name(tr)); obs_data_set_string(sourceData, "id", obs_obj_get_id(tr)); obs_data_set_obj(sourceData, "settings", settings); @@ -1394,14 +1395,15 @@ const char *id = obs_data_get_string(item, "id"); obs_data_t *settings = obs_data_get_obj(item, "settings"); - obs_source_t *source = obs_source_create_private(id, name, - settings); + obs_source_t *source = + obs_source_create_private(id, name, settings); if (!obs_obj_invalid(source)) { InitTransition(source); - ui->transitions->addItem(QT_UTF8(name), - QVariant::fromValue(OBSSource(source))); + ui->transitions->addItem( + QT_UTF8(name), + QVariant::fromValue(OBSSource(source))); ui->transitions->setCurrentIndex( - ui->transitions->count() - 1); + ui->transitions->count() - 1); } obs_data_release(settings);
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-main.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-main.cpp
Changed
@@ -83,15 +83,14 @@ struct QCef; struct QCefCookieManager; -QCef *cef = nullptr; +QCef *cef = nullptr; QCefCookieManager *panel_cookies = nullptr; void DestroyPanelCookieManager(); namespace { -template <typename OBSRef> -struct SignalContainer { +template<typename OBSRef> struct SignalContainer { OBSRef ref; vector<shared_ptr<OBSSignal>> handlers; }; @@ -106,17 +105,15 @@ Q_DECLARE_METATYPE(obs_order_movement); Q_DECLARE_METATYPE(SignalContainer<OBSScene>); -template <typename T> -static T GetOBSRef(QListWidgetItem *item) +template<typename T> static T GetOBSRef(QListWidgetItem *item) { return item->data(static_cast<int>(QtDataRole::OBSRef)).value<T>(); } -template <typename T> -static void SetOBSRef(QListWidgetItem *item, T &&val) +template<typename T> static void SetOBSRef(QListWidgetItem *item, T &&val) { item->setData(static_cast<int>(QtDataRole::OBSRef), - QVariant::fromValue(val)); + QVariant::fromValue(val)); } static void AddExtraModulePaths() @@ -124,29 +121,31 @@ char base_module_dir[512]; #if defined(_WIN32) || defined(__APPLE__) int ret = GetProgramDataPath(base_module_dir, sizeof(base_module_dir), - "obs-studio/plugins/%module%"); + "obs-studio/plugins/%module%"); #else int ret = GetConfigPath(base_module_dir, sizeof(base_module_dir), - "obs-studio/plugins/%module%"); + "obs-studio/plugins/%module%"); #endif if (ret <= 0) return; - string path = (char*)base_module_dir; + string path = base_module_dir; #if defined(__APPLE__) obs_add_module_path((path + "/bin").c_str(), (path + "/data").c_str()); - BPtr<char> config_bin = os_get_config_path_ptr("obs-studio/plugins/%module%/bin"); - BPtr<char> config_data = os_get_config_path_ptr("obs-studio/plugins/%module%/data"); + BPtr<char> config_bin = + os_get_config_path_ptr("obs-studio/plugins/%module%/bin"); + BPtr<char> config_data = + os_get_config_path_ptr("obs-studio/plugins/%module%/data"); obs_add_module_path(config_bin, config_data); #elif ARCH_BITS == 64 obs_add_module_path((path + "/bin/64bit").c_str(), - (path + "/data").c_str()); + (path + "/data").c_str()); #else obs_add_module_path((path + "/bin/32bit").c_str(), - (path + "/data").c_str()); + (path + "/data").c_str()); #endif } @@ -156,14 +155,13 @@ { int count = 0; - auto countSources = [] (void *param, obs_source_t *source) - { + auto countSources = [](void *param, obs_source_t *source) { if (!source) return true; uint32_t flags = obs_source_get_output_flags(source); if ((flags & OBS_SOURCE_VIDEO) != 0) - (*reinterpret_cast<int*>(param))++; + (*reinterpret_cast<int *>(param))++; return true; }; @@ -174,23 +172,20 @@ void assignDockToggle(QDockWidget *dock, QAction *action) { - auto handleWindowToggle = [action] (bool vis) - { + auto handleWindowToggle = [action](bool vis) { action->blockSignals(true); action->setChecked(vis); action->blockSignals(false); }; - auto handleMenuToggle = [dock] (bool check) - { + auto handleMenuToggle = [dock](bool check) { dock->blockSignals(true); dock->setVisible(check); dock->blockSignals(false); }; dock->connect(dock->toggleViewAction(), &QAction::toggled, - handleWindowToggle); - dock->connect(action, &QAction::toggled, - handleMenuToggle); + handleWindowToggle); + dock->connect(action, &QAction::toggled, handleMenuToggle); } extern void RegisterTwitchAuth(); @@ -198,8 +193,7 @@ extern void RegisterRestreamAuth(); OBSBasic::OBSBasic(QWidget *parent) - : OBSMainWindow (parent), - ui (new Ui::OBSBasic) + : OBSMainWindow(parent), ui(new Ui::OBSBasic) { setAttribute(Qt::WA_NativeWindow); @@ -218,7 +212,7 @@ api = InitializeAPIInterface(this); ui->setupUi(this); - ui->previewDisabledLabel->setVisible(false); + ui->previewDisabledWidget->setVisible(false); startingDockLayout = saveState(); @@ -235,23 +229,22 @@ char styleSheetPath[512]; int ret = GetProfilePath(styleSheetPath, sizeof(styleSheetPath), - "stylesheet.qss"); + "stylesheet.qss"); if (ret > 0) { if (QFile::exists(styleSheetPath)) { - QString path = QString("file:///") + - QT_UTF8(styleSheetPath); + QString path = + QString("file:///") + QT_UTF8(styleSheetPath); App()->setStyleSheet(path); } } - qRegisterMetaType<OBSScene> ("OBSScene"); + qRegisterMetaType<OBSScene>("OBSScene"); qRegisterMetaType<OBSSceneItem>("OBSSceneItem"); - qRegisterMetaType<OBSSource> ("OBSSource"); + qRegisterMetaType<OBSSource>("OBSSource"); qRegisterMetaType<obs_hotkey_id>("obs_hotkey_id"); - qRegisterMetaTypeStreamOperators< - std::vector<std::shared_ptr<OBSSignal>>>( - "std::vector<std::shared_ptr<OBSSignal>>"); + qRegisterMetaTypeStreamOperators<std::vector<std::shared_ptr<OBSSignal>>>( + "std::vector<std::shared_ptr<OBSSignal>>"); qRegisterMetaTypeStreamOperators<OBSScene>("OBSScene"); qRegisterMetaTypeStreamOperators<OBSSceneItem>("OBSSceneItem"); @@ -282,18 +275,22 @@ UpdateTitleBar(); connect(ui->scenes->itemDelegate(), - SIGNAL(closeEditor(QWidget*, - QAbstractItemDelegate::EndEditHint)), - this, - SLOT(SceneNameEdited(QWidget*, - QAbstractItemDelegate::EndEditHint))); + SIGNAL(closeEditor(QWidget *, + QAbstractItemDelegate::EndEditHint)), + this, + SLOT(SceneNameEdited(QWidget *, + QAbstractItemDelegate::EndEditHint))); cpuUsageInfo = os_cpu_usage_info_start(); cpuUsageTimer = new QTimer(this); - connect(cpuUsageTimer.data(), SIGNAL(timeout()), - ui->statusbar, SLOT(UpdateCPUUsage())); + connect(cpuUsageTimer.data(), SIGNAL(timeout()), ui->statusbar, + SLOT(UpdateCPUUsage())); cpuUsageTimer->start(3000); + diskFullTimer = new QTimer(this); + connect(diskFullTimer, SIGNAL(timeout()), this, + SLOT(CheckDiskSpaceRemaining())); + QAction *renameScene = new QAction(ui->scenesDock); renameScene->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(renameScene, SIGNAL(triggered()), this, SLOT(EditSceneName())); @@ -302,7 +299,7 @@ QAction *renameSource = new QAction(ui->sourcesDock); renameSource->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(renameSource, SIGNAL(triggered()), this, - SLOT(EditSceneItemName())); + SLOT(EditSceneItemName())); ui->sourcesDock->addAction(renameSource); #ifdef __APPLE__ @@ -319,8 +316,7 @@ renameSource->setShortcut({Qt::Key_F2}); #endif - auto addNudge = [this](const QKeySequence &seq, const char *s) - { + auto addNudge = [this](const QKeySequence &seq, const char *s) { QAction *nudge = new QAction(ui->preview); nudge->setShortcut(seq); nudge->setShortcutContext(Qt::WidgetShortcut); @@ -352,24 +348,24 @@ //restore parent window geometry const char *geometry = config_get_string(App()->GlobalConfig(), - "BasicWindow", "geometry"); + "BasicWindow", "geometry"); if (geometry != NULL) { - QByteArray byteArray = QByteArray::fromBase64( - QByteArray(geometry)); + QByteArray byteArray = + QByteArray::fromBase64(QByteArray(geometry)); restoreGeometry(byteArray); QRect windowGeometry = normalGeometry(); if (!WindowPositionValid(windowGeometry)) { QRect rect = App()->desktop()->geometry(); - setGeometry(QStyle::alignedRect( - Qt::LeftToRight, - Qt::AlignCenter, - size(), rect)); + setGeometry(QStyle::alignedRect(Qt::LeftToRight, + Qt::AlignCenter, size(), + rect)); } curPos = pos(); } else { - QRect desktopRect = QGuiApplication::primaryScreen()->geometry(); + QRect desktopRect = + QGuiApplication::primaryScreen()->geometry(); QSize adjSize = desktopRect.size() / 2 - size() / 2; curPos = QPoint(adjSize.width(), adjSize.height()); } @@ -382,17 +378,24 @@ ui->previewLabel->setProperty("themeID", "previewProgramLabels"); - bool labels = config_get_bool(GetGlobalConfig(), - "BasicWindow", "StudioModeLabels"); + bool labels = config_get_bool(GetGlobalConfig(), "BasicWindow", + "StudioModeLabels"); if (!previewProgramMode) ui->previewLabel->setHidden(true); else ui->previewLabel->setHidden(!labels); + + ui->previewDisabledWidget->setContextMenuPolicy(Qt::CustomContextMenu); + connect(ui->previewDisabledWidget, + SIGNAL(customContextMenuRequested(const QPoint &)), this, + SLOT(PreviewDisabledMenu(const QPoint &))); + connect(ui->enablePreviewButton, SIGNAL(clicked()), this, + SLOT(TogglePreview())); } static void SaveAudioDevice(const char *name, int channel, obs_data_t *parent, - vector<OBSSource> &audioSources) + vector<OBSSource> &audioSources) { obs_source_t *source = obs_get_output_source(channel); if (!source) @@ -409,10 +412,11 @@ } static obs_data_t *GenerateSaveData(obs_data_array_t *sceneOrder, - obs_data_array_t *quickTransitionData, int transitionDuration, - obs_data_array_t *transitions, - OBSScene &scene, OBSSource &curProgramScene, - obs_data_array_t *savedProjectorList) + obs_data_array_t *quickTransitionData, + int transitionDuration, + obs_data_array_t *transitions, + OBSScene &scene, OBSSource &curProgramScene, + obs_data_array_t *savedProjectorList) { obs_data_t *saveData = obs_data_create(); @@ -421,49 +425,49 @@ SaveAudioDevice(DESKTOP_AUDIO_1, 1, saveData, audioSources); SaveAudioDevice(DESKTOP_AUDIO_2, 2, saveData, audioSources); - SaveAudioDevice(AUX_AUDIO_1, 3, saveData, audioSources); - SaveAudioDevice(AUX_AUDIO_2, 4, saveData, audioSources); - SaveAudioDevice(AUX_AUDIO_3, 5, saveData, audioSources); - SaveAudioDevice(AUX_AUDIO_4, 6, saveData, audioSources); + SaveAudioDevice(AUX_AUDIO_1, 3, saveData, audioSources); + SaveAudioDevice(AUX_AUDIO_2, 4, saveData, audioSources); + SaveAudioDevice(AUX_AUDIO_3, 5, saveData, audioSources); + SaveAudioDevice(AUX_AUDIO_4, 6, saveData, audioSources); /* -------------------------------- */ /* save non-group sources */ - auto FilterAudioSources = [&](obs_source_t *source) - { + auto FilterAudioSources = [&](obs_source_t *source) { if (obs_source_is_group(source)) return false; return find(begin(audioSources), end(audioSources), source) == - end(audioSources); + end(audioSources); }; using FilterAudioSources_t = decltype(FilterAudioSources); obs_data_array_t *sourcesArray = obs_save_sources_filtered( - [](void *data, obs_source_t *source) - { - return (*static_cast<FilterAudioSources_t*>(data))(source); - }, static_cast<void*>(&FilterAudioSources)); + [](void *data, obs_source_t *source) { + return (*static_cast<FilterAudioSources_t *>(data))( + source); + }, + static_cast<void *>(&FilterAudioSources)); /* -------------------------------- */ /* save group sources separately */ /* saving separately ensures they won't be loaded in older versions */ obs_data_array_t *groupsArray = obs_save_sources_filtered( - [](void*, obs_source_t *source) - { - return obs_source_is_group(source); - }, nullptr); + [](void *, obs_source_t *source) { + return obs_source_is_group(source); + }, + nullptr); /* -------------------------------- */ obs_source_t *transition = obs_get_output_source(0); obs_source_t *currentScene = obs_scene_get_source(scene); - const char *sceneName = obs_source_get_name(currentScene); - const char *programName = obs_source_get_name(curProgramScene); + const char *sceneName = obs_source_get_name(currentScene); + const char *programName = obs_source_get_name(curProgramScene); - const char *sceneCollection = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollection"); + const char *sceneCollection = config_get_string( + App()->GlobalConfig(), "Basic", "SceneCollection"); obs_data_set_string(saveData, "current_scene", sceneName); obs_data_set_string(saveData, "current_program_scene", programName); @@ -478,7 +482,7 @@ obs_data_array_release(groupsArray); obs_data_set_string(saveData, "current_transition", - obs_source_get_name(transition)); + obs_source_get_name(transition)); obs_data_set_int(saveData, "transition_duration", transitionDuration); obs_source_release(transition); @@ -489,7 +493,7 @@ { // Themes need the QAction dynamic properties for (QAction *x : ui->scenesToolbar->actions()) { - QWidget* temp = ui->scenesToolbar->widgetForAction(x); + QWidget *temp = ui->scenesToolbar->widgetForAction(x); for (QByteArray &y : x->dynamicPropertyNames()) { temp->setProperty(y, x->property(y)); @@ -497,7 +501,7 @@ } for (QAction *x : ui->sourcesToolbar->actions()) { - QWidget* temp = ui->sourcesToolbar->widgetForAction(x); + QWidget *temp = ui->sourcesToolbar->widgetForAction(x); for (QByteArray &y : x->dynamicPropertyNames()) { temp->setProperty(y, x->property(y)); @@ -507,8 +511,8 @@ void OBSBasic::UpdateVolumeControlsDecayRate() { - double meterDecayRate = config_get_double(basicConfig, "Audio", - "MeterDecayRate"); + double meterDecayRate = + config_get_double(basicConfig, "Audio", "MeterDecayRate"); for (size_t i = 0; i < volumes.size(); i++) { volumes[i]->SetMeterDecayRate(meterDecayRate); @@ -517,8 +521,8 @@ void OBSBasic::UpdateVolumeControlsPeakMeterType() { - uint32_t peakMeterTypeIdx = config_get_uint(basicConfig, "Audio", - "PeakMeterType"); + uint32_t peakMeterTypeIdx = + config_get_uint(basicConfig, "Audio", "PeakMeterType"); enum obs_peak_meter_type peakMeterType; switch (peakMeterTypeIdx) { @@ -553,7 +557,7 @@ for (int i = 0; i < ui->scenes->count(); i++) { obs_data_t *data = obs_data_create(); obs_data_set_string(data, "name", - QT_TO_UTF8(ui->scenes->item(i)->text())); + QT_TO_UTF8(ui->scenes->item(i)->text())); obs_data_array_push_back(sceneOrder, data); obs_data_release(data); } @@ -584,9 +588,9 @@ } obs_data_set_int(data, "monitor", projector->GetMonitor()); obs_data_set_int(data, "type", static_cast<int>(type)); - obs_data_set_string(data, "geometry", - projector->saveGeometry().toBase64() - .constData()); + obs_data_set_string( + data, "geometry", + projector->saveGeometry().toBase64().constData()); obs_data_array_push_back(savedProjectors, data); obs_data_release(data); }; @@ -611,19 +615,19 @@ obs_data_array_t *transitions = SaveTransitions(); obs_data_array_t *quickTrData = SaveQuickTransitions(); obs_data_array_t *savedProjectorList = SaveProjectors(); - obs_data_t *saveData = GenerateSaveData(sceneOrder, quickTrData, - ui->transitionDuration->value(), transitions, - scene, curProgramScene, savedProjectorList); + obs_data_t *saveData = GenerateSaveData( + sceneOrder, quickTrData, ui->transitionDuration->value(), + transitions, scene, curProgramScene, savedProjectorList); obs_data_set_bool(saveData, "preview_locked", ui->preview->Locked()); obs_data_set_bool(saveData, "scaling_enabled", - ui->preview->IsFixedScaling()); + ui->preview->IsFixedScaling()); obs_data_set_int(saveData, "scaling_level", - ui->preview->GetScalingLevel()); + ui->preview->GetScalingLevel()); obs_data_set_double(saveData, "scaling_off_x", - ui->preview->GetScrollX()); + ui->preview->GetScrollX()); obs_data_set_double(saveData, "scaling_off_y", - ui->preview->GetScrollY()); + ui->preview->GetScrollY()); if (api) { obs_data_t *moduleObj = obs_data_create(); @@ -691,14 +695,14 @@ void OBSBasic::CreateFirstRunSources() { bool hasDesktopAudio = HasAudioDevices(App()->OutputAudioSource()); - bool hasInputAudio = HasAudioDevices(App()->InputAudioSource()); + bool hasInputAudio = HasAudioDevices(App()->InputAudioSource()); if (hasDesktopAudio) ResetAudioDevice(App()->OutputAudioSource(), "default", - Str("Basic.DesktopDevice1"), 1); + Str("Basic.DesktopDevice1"), 1); if (hasInputAudio) ResetAudioDevice(App()->InputAudioSource(), "default", - Str("Basic.AuxDevice1"), 3); + Str("Basic.AuxDevice1"), 3); } void OBSBasic::CreateDefaultScene(bool firstStart) @@ -711,7 +715,7 @@ ui->transitionDuration->setValue(300); SetTransition(fadeTransition); - obs_scene_t *scene = obs_scene_create(Str("Basic.Scene")); + obs_scene_t *scene = obs_scene_create(Str("Basic.Scene")); if (firstStart) CreateFirstRunSources(); @@ -765,10 +769,10 @@ SavedProjectorInfo *info = new SavedProjectorInfo(); info->monitor = obs_data_get_int(data, "monitor"); - info->type = static_cast<ProjectorType>(obs_data_get_int(data, - "type")); - info->geometry = std::string( - obs_data_get_string(data, "geometry")); + info->type = static_cast<ProjectorType>( + obs_data_get_int(data, "type")); + info->geometry = + std::string(obs_data_get_string(data, "geometry")); info->name = std::string(obs_data_get_string(data, "name")); savedProjectorsArray.emplace_back(info); @@ -776,7 +780,7 @@ } } -static void LogFilter(obs_source_t*, obs_source_t *filter, void *v_val) +static void LogFilter(obs_source_t *, obs_source_t *filter, void *v_val) { const char *name = obs_source_get_name(filter); const char *id = obs_source_get_id(filter); @@ -789,7 +793,7 @@ blog(LOG_INFO, "%s- filter: '%s' (%s)", indent.c_str(), name, id); } -static bool LogSceneItem(obs_scene_t*, obs_sceneitem_t *item, void *v_val) +static bool LogSceneItem(obs_scene_t *, obs_sceneitem_t *item, void *v_val) { obs_source_t *source = obs_sceneitem_get_source(item); const char *name = obs_source_get_name(source); @@ -808,15 +812,17 @@ if (monitoring_type != OBS_MONITORING_TYPE_NONE) { const char *type = (monitoring_type == OBS_MONITORING_TYPE_MONITOR_ONLY) - ? "monitor only" - : "monitor and output"; + ? "monitor only" + : "monitor and output"; blog(LOG_INFO, " %s- monitoring: %s", indent.c_str(), type); } int child_indent = 1 + indent_count; - obs_source_enum_filters(source, LogFilter, (void*)(intptr_t)child_indent); + obs_source_enum_filters(source, LogFilter, + (void *)(intptr_t)child_indent); if (obs_sceneitem_is_group(item)) - obs_sceneitem_group_enum_items(item, LogSceneItem, (void*)(intptr_t)child_indent); + obs_sceneitem_group_enum_items(item, LogSceneItem, + (void *)(intptr_t)child_indent); return true; } @@ -833,8 +839,8 @@ const char *name = obs_source_get_name(source); blog(LOG_INFO, "- scene '%s':", name); - obs_scene_enum_items(scene, LogSceneItem, (void*)(intptr_t)1); - obs_source_enum_filters(source, LogFilter, (void*)(intptr_t)1); + obs_scene_enum_items(scene, LogSceneItem, (void *)(intptr_t)1); + obs_source_enum_filters(source, LogFilter, (void *)(intptr_t)1); } blog(LOG_INFO, "------------------------------------------------"); @@ -861,15 +867,14 @@ api->on_preload(modulesObj); obs_data_array_t *sceneOrder = obs_data_get_array(data, "scene_order"); - obs_data_array_t *sources = obs_data_get_array(data, "sources"); - obs_data_array_t *groups = obs_data_get_array(data, "groups"); - obs_data_array_t *transitions= obs_data_get_array(data, "transitions"); - const char *sceneName = obs_data_get_string(data, - "current_scene"); - const char *programSceneName = obs_data_get_string(data, - "current_program_scene"); - const char *transitionName = obs_data_get_string(data, - "current_transition"); + obs_data_array_t *sources = obs_data_get_array(data, "sources"); + obs_data_array_t *groups = obs_data_get_array(data, "groups"); + obs_data_array_t *transitions = obs_data_get_array(data, "transitions"); + const char *sceneName = obs_data_get_string(data, "current_scene"); + const char *programSceneName = + obs_data_get_string(data, "current_program_scene"); + const char *transitionName = + obs_data_get_string(data, "current_transition"); if (!opt_starting_scene.empty()) { programSceneName = opt_starting_scene.c_str(); @@ -885,24 +890,24 @@ transitionName = obs_source_get_name(fadeTransition); const char *curSceneCollection = config_get_string( - App()->GlobalConfig(), "Basic", "SceneCollection"); + App()->GlobalConfig(), "Basic", "SceneCollection"); obs_data_set_default_string(data, "name", curSceneCollection); - const char *name = obs_data_get_string(data, "name"); - obs_source_t *curScene; - obs_source_t *curProgramScene; - obs_source_t *curTransition; + const char *name = obs_data_get_string(data, "name"); + obs_source_t *curScene; + obs_source_t *curProgramScene; + obs_source_t *curTransition; if (!name || !*name) name = curSceneCollection; LoadAudioDevice(DESKTOP_AUDIO_1, 1, data); LoadAudioDevice(DESKTOP_AUDIO_2, 2, data); - LoadAudioDevice(AUX_AUDIO_1, 3, data); - LoadAudioDevice(AUX_AUDIO_2, 4, data); - LoadAudioDevice(AUX_AUDIO_3, 5, data); - LoadAudioDevice(AUX_AUDIO_4, 6, data); + LoadAudioDevice(AUX_AUDIO_1, 3, data); + LoadAudioDevice(AUX_AUDIO_2, 4, data); + LoadAudioDevice(AUX_AUDIO_3, 5, data); + LoadAudioDevice(AUX_AUDIO_4, 6, data); if (!sources) { sources = groups; @@ -935,8 +940,8 @@ * fall back to original settings */ if (!opt_starting_scene.empty() && (!curScene || !curProgramScene)) { sceneName = obs_data_get_string(data, "current_scene"); - programSceneName = obs_data_get_string(data, - "current_program_scene"); + programSceneName = + obs_data_get_string(data, "current_program_scene"); obs_source_release(curScene); obs_source_release(curProgramScene); opt_starting_scene.clear(); @@ -961,11 +966,11 @@ /* ------------------- */ bool projectorSave = config_get_bool(GetGlobalConfig(), "BasicWindow", - "SaveProjectors"); + "SaveProjectors"); if (projectorSave) { - obs_data_array_t *savedProjectors = obs_data_get_array(data, - "saved_projectors"); + obs_data_array_t *savedProjectors = + obs_data_get_array(data, "saved_projectors"); if (savedProjectors) { LoadSavedProjectors(savedProjectors); @@ -982,12 +987,12 @@ file_base.erase(file_base.size() - 5, 5); config_set_string(App()->GlobalConfig(), "Basic", "SceneCollection", - name); + name); config_set_string(App()->GlobalConfig(), "Basic", "SceneCollectionFile", - file_base.c_str()); + file_base.c_str()); - obs_data_array_t *quickTransitionData = obs_data_get_array(data, - "quick_transitions"); + obs_data_array_t *quickTransitionData = + obs_data_get_array(data, "quick_transitions"); LoadQuickTransitions(quickTransitionData); obs_data_array_release(quickTransitionData); @@ -1024,20 +1029,21 @@ if (opt_start_streaming) { blog(LOG_INFO, "Starting stream due to command line parameter"); QMetaObject::invokeMethod(this, "StartStreaming", - Qt::QueuedConnection); + Qt::QueuedConnection); opt_start_streaming = false; } if (opt_start_recording) { - blog(LOG_INFO, "Starting recording due to command line parameter"); + blog(LOG_INFO, + "Starting recording due to command line parameter"); QMetaObject::invokeMethod(this, "StartRecording", - Qt::QueuedConnection); + Qt::QueuedConnection); opt_start_recording = false; } if (opt_start_replaybuffer) { QMetaObject::invokeMethod(this, "StartReplayBuffer", - Qt::QueuedConnection); + Qt::QueuedConnection); opt_start_replaybuffer = false; } @@ -1063,11 +1069,11 @@ char serviceJsonPath[512]; int ret = GetProfilePath(serviceJsonPath, sizeof(serviceJsonPath), - SERVICE_PATH); + SERVICE_PATH); if (ret <= 0) return; - obs_data_t *data = obs_data_create(); + obs_data_t *data = obs_data_create(); obs_data_t *settings = obs_service_get_settings(service); obs_data_set_string(data, "type", obs_service_get_type(service)); @@ -1086,12 +1092,12 @@ char serviceJsonPath[512]; int ret = GetProfilePath(serviceJsonPath, sizeof(serviceJsonPath), - SERVICE_PATH); + SERVICE_PATH); if (ret <= 0) return false; - obs_data_t *data = obs_data_create_from_json_file_safe(serviceJsonPath, - "bak"); + obs_data_t *data = + obs_data_create_from_json_file_safe(serviceJsonPath, "bak"); obs_data_set_default_string(data, "type", "rtmp_common"); type = obs_data_get_string(data, "type"); @@ -1100,7 +1106,7 @@ obs_data_t *hotkey_data = obs_data_get_obj(data, "hotkeys"); service = obs_service_create(type, "default_service", settings, - hotkey_data); + hotkey_data); obs_service_release(service); obs_data_release(hotkey_data); @@ -1118,7 +1124,7 @@ return true; service = obs_service_create("rtmp_common", "default_service", nullptr, - nullptr); + nullptr); if (!service) return false; obs_service_release(service); @@ -1126,31 +1132,19 @@ return true; } -static const double scaled_vals[] = -{ - 1.0, - 1.25, - (1.0/0.75), - 1.5, - (1.0/0.6), - 1.75, - 2.0, - 2.25, - 2.5, - 2.75, - 3.0, - 0.0 -}; +static const double scaled_vals[] = {1.0, 1.25, (1.0 / 0.75), 1.5, + (1.0 / 0.6), 1.75, 2.0, 2.25, + 2.5, 2.75, 3.0, 0.0}; extern void CheckExistingCookieId(); bool OBSBasic::InitBasicConfigDefaults() { - QList<QScreen*> screens = QGuiApplication::screens(); + QList<QScreen *> screens = QGuiApplication::screens(); if (!screens.size()) { OBSErrorBox(NULL, "There appears to be no monitors. Er, this " - "technically shouldn't be possible."); + "technically shouldn't be possible."); return false; } @@ -1159,8 +1153,8 @@ uint32_t cx = primaryScreen->size().width(); uint32_t cy = primaryScreen->size().height(); - bool oldResolutionDefaults = config_get_bool(App()->GlobalConfig(), - "General", "Pre19Defaults"); + bool oldResolutionDefaults = config_get_bool( + App()->GlobalConfig(), "General", "Pre19Defaults"); /* use 1920x1080 for new default base res if main monitor is above * 1920x1080, but don't apply for people from older builds -- only to @@ -1178,9 +1172,9 @@ !config_has_user_value(basicConfig, "AdvOut", "Pre22.1Settings")) { int track = (int)config_get_int(basicConfig, "AdvOut", - "FFAudioTrack"); + "FFAudioTrack"); config_set_int(basicConfig, "AdvOut", "FFAudioMixes", - 1LL << (track - 1)); + 1LL << (track - 1)); config_set_bool(basicConfig, "AdvOut", "Pre22.1Settings", true); changed = true; } @@ -1190,8 +1184,8 @@ if (config_has_user_value(basicConfig, "AdvOut", "RecTrackIndex") && !config_has_user_value(basicConfig, "AdvOut", "RecTracks")) { - uint64_t track = config_get_uint(basicConfig, "AdvOut", - "RecTrackIndex"); + uint64_t track = + config_get_uint(basicConfig, "AdvOut", "RecTrackIndex"); track = 1ULL << (track - 1); config_set_uint(basicConfig, "AdvOut", "RecTracks", track); config_remove_value(basicConfig, "AdvOut", "RecTrackIndex"); @@ -1208,72 +1202,66 @@ config_set_default_string(basicConfig, "Output", "Mode", "Simple"); config_set_default_string(basicConfig, "SimpleOutput", "FilePath", - GetDefaultVideoSavePath().c_str()); + GetDefaultVideoSavePath().c_str()); config_set_default_string(basicConfig, "SimpleOutput", "RecFormat", - "flv"); - config_set_default_uint (basicConfig, "SimpleOutput", "VBitrate", - 2500); - config_set_default_uint (basicConfig, "SimpleOutput", "ABitrate", 160); - config_set_default_bool (basicConfig, "SimpleOutput", "UseAdvanced", - false); - config_set_default_bool (basicConfig, "SimpleOutput", "EnforceBitrate", - true); + "mkv"); + config_set_default_uint(basicConfig, "SimpleOutput", "VBitrate", 2500); + config_set_default_uint(basicConfig, "SimpleOutput", "ABitrate", 160); + config_set_default_bool(basicConfig, "SimpleOutput", "UseAdvanced", + false); + config_set_default_bool(basicConfig, "SimpleOutput", "EnforceBitrate", + true); config_set_default_string(basicConfig, "SimpleOutput", "Preset", - "veryfast"); + "veryfast"); config_set_default_string(basicConfig, "SimpleOutput", "NVENCPreset", - "hq"); + "hq"); config_set_default_string(basicConfig, "SimpleOutput", "RecQuality", - "Stream"); + "Stream"); config_set_default_bool(basicConfig, "SimpleOutput", "RecRB", false); config_set_default_int(basicConfig, "SimpleOutput", "RecRBTime", 20); config_set_default_int(basicConfig, "SimpleOutput", "RecRBSize", 512); config_set_default_string(basicConfig, "SimpleOutput", "RecRBPrefix", - "Replay"); + "Replay"); - config_set_default_bool (basicConfig, "AdvOut", "ApplyServiceSettings", - true); - config_set_default_bool (basicConfig, "AdvOut", "UseRescale", false); - config_set_default_uint (basicConfig, "AdvOut", "TrackIndex", 1); + config_set_default_bool(basicConfig, "AdvOut", "ApplyServiceSettings", + true); + config_set_default_bool(basicConfig, "AdvOut", "UseRescale", false); + config_set_default_uint(basicConfig, "AdvOut", "TrackIndex", 1); config_set_default_string(basicConfig, "AdvOut", "Encoder", "obs_x264"); config_set_default_string(basicConfig, "AdvOut", "RecType", "Standard"); config_set_default_string(basicConfig, "AdvOut", "RecFilePath", - GetDefaultVideoSavePath().c_str()); - config_set_default_string(basicConfig, "AdvOut", "RecFormat", "flv"); - config_set_default_bool (basicConfig, "AdvOut", "RecUseRescale", - false); - config_set_default_uint (basicConfig, "AdvOut", "RecTracks", (1<<0)); - config_set_default_string(basicConfig, "AdvOut", "RecEncoder", - "none"); + GetDefaultVideoSavePath().c_str()); + config_set_default_string(basicConfig, "AdvOut", "RecFormat", "mkv"); + config_set_default_bool(basicConfig, "AdvOut", "RecUseRescale", false); + config_set_default_uint(basicConfig, "AdvOut", "RecTracks", (1 << 0)); + config_set_default_string(basicConfig, "AdvOut", "RecEncoder", "none"); - config_set_default_bool (basicConfig, "AdvOut", "FFOutputToFile", - true); + config_set_default_bool(basicConfig, "AdvOut", "FFOutputToFile", true); config_set_default_string(basicConfig, "AdvOut", "FFFilePath", - GetDefaultVideoSavePath().c_str()); + GetDefaultVideoSavePath().c_str()); config_set_default_string(basicConfig, "AdvOut", "FFExtension", "mp4"); - config_set_default_uint (basicConfig, "AdvOut", "FFVBitrate", 2500); - config_set_default_uint (basicConfig, "AdvOut", "FFVGOPSize", 250); - config_set_default_bool (basicConfig, "AdvOut", "FFUseRescale", - false); - config_set_default_bool (basicConfig, "AdvOut", "FFIgnoreCompat", - false); - config_set_default_uint (basicConfig, "AdvOut", "FFABitrate", 160); - config_set_default_uint (basicConfig, "AdvOut", "FFAudioMixes", 1); - - config_set_default_uint (basicConfig, "AdvOut", "Track1Bitrate", 160); - config_set_default_uint (basicConfig, "AdvOut", "Track2Bitrate", 160); - config_set_default_uint (basicConfig, "AdvOut", "Track3Bitrate", 160); - config_set_default_uint (basicConfig, "AdvOut", "Track4Bitrate", 160); - config_set_default_uint (basicConfig, "AdvOut", "Track5Bitrate", 160); - config_set_default_uint (basicConfig, "AdvOut", "Track6Bitrate", 160); - - config_set_default_bool (basicConfig, "AdvOut", "RecRB", false); - config_set_default_uint (basicConfig, "AdvOut", "RecRBTime", 20); - config_set_default_int (basicConfig, "AdvOut", "RecRBSize", 512); + config_set_default_uint(basicConfig, "AdvOut", "FFVBitrate", 2500); + config_set_default_uint(basicConfig, "AdvOut", "FFVGOPSize", 250); + config_set_default_bool(basicConfig, "AdvOut", "FFUseRescale", false); + config_set_default_bool(basicConfig, "AdvOut", "FFIgnoreCompat", false); + config_set_default_uint(basicConfig, "AdvOut", "FFABitrate", 160); + config_set_default_uint(basicConfig, "AdvOut", "FFAudioMixes", 1); + + config_set_default_uint(basicConfig, "AdvOut", "Track1Bitrate", 160); + config_set_default_uint(basicConfig, "AdvOut", "Track2Bitrate", 160); + config_set_default_uint(basicConfig, "AdvOut", "Track3Bitrate", 160); + config_set_default_uint(basicConfig, "AdvOut", "Track4Bitrate", 160); + config_set_default_uint(basicConfig, "AdvOut", "Track5Bitrate", 160); + config_set_default_uint(basicConfig, "AdvOut", "Track6Bitrate", 160); + + config_set_default_bool(basicConfig, "AdvOut", "RecRB", false); + config_set_default_uint(basicConfig, "AdvOut", "RecRBTime", 20); + config_set_default_int(basicConfig, "AdvOut", "RecRBSize", 512); - config_set_default_uint (basicConfig, "Video", "BaseCX", cx); - config_set_default_uint (basicConfig, "Video", "BaseCY", cy); + config_set_default_uint(basicConfig, "Video", "BaseCX", cx); + config_set_default_uint(basicConfig, "Video", "BaseCY", cy); /* don't allow BaseCX/BaseCY to be susceptible to defaults changing */ if (!config_has_user_value(basicConfig, "Video", "BaseCX") || @@ -1284,21 +1272,21 @@ } config_set_default_string(basicConfig, "Output", "FilenameFormatting", - "%CCYY-%MM-%DD %hh-%mm-%ss"); + "%CCYY-%MM-%DD %hh-%mm-%ss"); - config_set_default_bool (basicConfig, "Output", "DelayEnable", false); - config_set_default_uint (basicConfig, "Output", "DelaySec", 20); - config_set_default_bool (basicConfig, "Output", "DelayPreserve", true); - - config_set_default_bool (basicConfig, "Output", "Reconnect", true); - config_set_default_uint (basicConfig, "Output", "RetryDelay", 10); - config_set_default_uint (basicConfig, "Output", "MaxRetries", 20); + config_set_default_bool(basicConfig, "Output", "DelayEnable", false); + config_set_default_uint(basicConfig, "Output", "DelaySec", 20); + config_set_default_bool(basicConfig, "Output", "DelayPreserve", true); + + config_set_default_bool(basicConfig, "Output", "Reconnect", true); + config_set_default_uint(basicConfig, "Output", "RetryDelay", 10); + config_set_default_uint(basicConfig, "Output", "MaxRetries", 20); config_set_default_string(basicConfig, "Output", "BindIP", "default"); - config_set_default_bool (basicConfig, "Output", "NewSocketLoopEnable", - false); - config_set_default_bool (basicConfig, "Output", "LowLatencyEnable", - false); + config_set_default_bool(basicConfig, "Output", "NewSocketLoopEnable", + false); + config_set_default_bool(basicConfig, "Output", "LowLatencyEnable", + false); int i = 0; uint32_t scale_cx = cx; @@ -1312,8 +1300,8 @@ scale_cy = uint32_t(double(cy) / scale); } - config_set_default_uint (basicConfig, "Video", "OutputCX", scale_cx); - config_set_default_uint (basicConfig, "Video", "OutputCY", scale_cy); + config_set_default_uint(basicConfig, "Video", "OutputCX", scale_cx); + config_set_default_uint(basicConfig, "Video", "OutputCY", scale_cy); /* don't allow OutputCX/OutputCY to be susceptible to defaults * changing */ @@ -1324,28 +1312,29 @@ config_save_safe(basicConfig, "tmp", nullptr); } - config_set_default_uint (basicConfig, "Video", "FPSType", 0); + config_set_default_uint(basicConfig, "Video", "FPSType", 0); config_set_default_string(basicConfig, "Video", "FPSCommon", "30"); - config_set_default_uint (basicConfig, "Video", "FPSInt", 30); - config_set_default_uint (basicConfig, "Video", "FPSNum", 30); - config_set_default_uint (basicConfig, "Video", "FPSDen", 1); + config_set_default_uint(basicConfig, "Video", "FPSInt", 30); + config_set_default_uint(basicConfig, "Video", "FPSNum", 30); + config_set_default_uint(basicConfig, "Video", "FPSDen", 1); config_set_default_string(basicConfig, "Video", "ScaleType", "bicubic"); config_set_default_string(basicConfig, "Video", "ColorFormat", "NV12"); config_set_default_string(basicConfig, "Video", "ColorSpace", "601"); config_set_default_string(basicConfig, "Video", "ColorRange", - "Partial"); + "Partial"); config_set_default_string(basicConfig, "Audio", "MonitoringDeviceId", - "default"); - config_set_default_string(basicConfig, "Audio", "MonitoringDeviceName", - Str("Basic.Settings.Advanced.Audio.MonitoringDevice" - ".Default")); - config_set_default_uint (basicConfig, "Audio", "SampleRate", 44100); + "default"); + config_set_default_string( + basicConfig, "Audio", "MonitoringDeviceName", + Str("Basic.Settings.Advanced.Audio.MonitoringDevice" + ".Default")); + config_set_default_uint(basicConfig, "Audio", "SampleRate", 44100); config_set_default_string(basicConfig, "Audio", "ChannelSetup", - "Stereo"); + "Stereo"); config_set_default_double(basicConfig, "Audio", "MeterDecayRate", - VOLUME_METER_DECAY_FAST); - config_set_default_uint (basicConfig, "Audio", "PeakMeterType", 0); + VOLUME_METER_DECAY_FAST); + config_set_default_uint(basicConfig, "Audio", "PeakMeterType", 0); CheckExistingCookieId(); @@ -1356,14 +1345,16 @@ void OBSBasic::InitBasicConfigDefaults2() { - bool oldEncDefaults = config_get_bool(App()->GlobalConfig(), - "General", "Pre23Defaults"); + bool oldEncDefaults = config_get_bool(App()->GlobalConfig(), "General", + "Pre23Defaults"); bool useNV = EncoderAvailable("ffmpeg_nvenc") && !oldEncDefaults; config_set_default_string(basicConfig, "SimpleOutput", "StreamEncoder", - useNV ? SIMPLE_ENCODER_NVENC : SIMPLE_ENCODER_X264); + useNV ? SIMPLE_ENCODER_NVENC + : SIMPLE_ENCODER_X264); config_set_default_string(basicConfig, "SimpleOutput", "RecEncoder", - useNV ? SIMPLE_ENCODER_NVENC : SIMPLE_ENCODER_X264); + useNV ? SIMPLE_ENCODER_NVENC + : SIMPLE_ENCODER_X264); } bool OBSBasic::InitBasicConfig() @@ -1397,7 +1388,7 @@ if (config_get_string(basicConfig, "General", "Name") == nullptr) { const char *curName = config_get_string(App()->GlobalConfig(), - "Basic", "Profile"); + "Basic", "Profile"); config_set_string(basicConfig, "General", "Name", curName); basicConfig.SaveSafe("tmp"); @@ -1412,15 +1403,16 @@ signalHandlers.reserve(signalHandlers.size() + 6); signalHandlers.emplace_back(obs_get_signal_handler(), "source_create", - OBSBasic::SourceCreated, this); + OBSBasic::SourceCreated, this); signalHandlers.emplace_back(obs_get_signal_handler(), "source_remove", - OBSBasic::SourceRemoved, this); + OBSBasic::SourceRemoved, this); signalHandlers.emplace_back(obs_get_signal_handler(), "source_activate", - OBSBasic::SourceActivated, this); - signalHandlers.emplace_back(obs_get_signal_handler(), "source_deactivate", - OBSBasic::SourceDeactivated, this); + OBSBasic::SourceActivated, this); + signalHandlers.emplace_back(obs_get_signal_handler(), + "source_deactivate", + OBSBasic::SourceDeactivated, this); signalHandlers.emplace_back(obs_get_signal_handler(), "source_rename", - OBSBasic::SourceRenamed, this); + OBSBasic::SourceRenamed, this); } void OBSBasic::InitPrimitives() @@ -1458,7 +1450,7 @@ boxBottom = gs_render_save(); gs_render_start(true); - for (int i = 0; i <= 360; i += (360/20)) { + for (int i = 0; i <= 360; i += (360 / 20)) { float pos = RAD(float(i)); gs_vertex2f(cosf(pos), sinf(pos)); } @@ -1484,47 +1476,45 @@ if (!outputHandler || !outputHandler->Active()) { outputHandler.reset(); - outputHandler.reset(advOut ? - CreateAdvancedOutputHandler(this) : - CreateSimpleOutputHandler(this)); + outputHandler.reset(advOut ? CreateAdvancedOutputHandler(this) + : CreateSimpleOutputHandler(this)); delete replayBufferButton; if (outputHandler->replayBuffer) { replayBufferButton = new QPushButton( - QTStr("Basic.Main.StartReplayBuffer"), - this); + QTStr("Basic.Main.StartReplayBuffer"), this); replayBufferButton->setCheckable(true); connect(replayBufferButton.data(), - &QPushButton::clicked, - this, - &OBSBasic::ReplayBufferClicked); + &QPushButton::clicked, this, + &OBSBasic::ReplayBufferClicked); - replayBufferButton->setProperty("themeID", "replayBufferButton"); + replayBufferButton->setProperty("themeID", + "replayBufferButton"); ui->buttonsVLayout->insertWidget(2, replayBufferButton); } if (sysTrayReplayBuffer) sysTrayReplayBuffer->setEnabled( - !!outputHandler->replayBuffer); + !!outputHandler->replayBuffer); } else { outputHandler->Update(); } } static void AddProjectorMenuMonitors(QMenu *parent, QObject *target, - const char *slot); + const char *slot); #define STARTUP_SEPARATOR \ "==== Startup complete ===============================================" #define SHUTDOWN_SEPARATOR \ "==== Shutting down ==================================================" -#define UNSUPPORTED_ERROR \ +#define UNSUPPORTED_ERROR \ "Failed to initialize video:\n\nRequired graphics API functionality " \ "not found. Your GPU may not be supported." -#define UNKNOWN_ERROR \ +#define UNKNOWN_ERROR \ "Failed to initialize video. Your GPU may not be supported, " \ "or your graphics drivers may need to be updated." @@ -1532,8 +1522,8 @@ { ProfileScope("OBSBasic::OBSInit"); - const char *sceneCollection = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollectionFile"); + const char *sceneCollection = config_get_string( + App()->GlobalConfig(), "Basic", "SceneCollectionFile"); char savePath[512]; char fileName[512]; int ret; @@ -1542,7 +1532,7 @@ throw "Failed to get scene collection name"; ret = snprintf(fileName, 512, "obs-studio/basic/scenes/%s.json", - sceneCollection); + sceneCollection); if (ret <= 0) throw "Failed to create scene collection file name"; @@ -1571,15 +1561,15 @@ /* load audio monitoring */ #if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO - const char *device_name = config_get_string(basicConfig, "Audio", - "MonitoringDeviceName"); - const char *device_id = config_get_string(basicConfig, "Audio", - "MonitoringDeviceId"); + const char *device_name = + config_get_string(basicConfig, "Audio", "MonitoringDeviceName"); + const char *device_id = + config_get_string(basicConfig, "Audio", "MonitoringDeviceId"); obs_set_audio_monitoring_device(device_name, device_id); blog(LOG_INFO, "Audio monitoring device:\n\tname: %s\n\tid: %s", - device_name, device_id); + device_name, device_id); #endif InitOBSCallbacks(); @@ -1611,29 +1601,30 @@ InitPrimitives(); - sceneDuplicationMode = config_get_bool(App()->GlobalConfig(), - "BasicWindow", "SceneDuplicationMode"); - swapScenesMode = config_get_bool(App()->GlobalConfig(), - "BasicWindow", "SwapScenesMode"); - editPropertiesMode = config_get_bool(App()->GlobalConfig(), - "BasicWindow", "EditPropertiesMode"); + sceneDuplicationMode = config_get_bool( + App()->GlobalConfig(), "BasicWindow", "SceneDuplicationMode"); + swapScenesMode = config_get_bool(App()->GlobalConfig(), "BasicWindow", + "SwapScenesMode"); + editPropertiesMode = config_get_bool( + App()->GlobalConfig(), "BasicWindow", "EditPropertiesMode"); if (!opt_studio_mode) { SetPreviewProgramMode(config_get_bool(App()->GlobalConfig(), - "BasicWindow", "PreviewProgramMode")); + "BasicWindow", + "PreviewProgramMode")); } else { SetPreviewProgramMode(true); opt_studio_mode = false; } -#define SET_VISIBILITY(name, control) \ - do { \ - if (config_has_user_value(App()->GlobalConfig(), \ - "BasicWindow", name)) { \ +#define SET_VISIBILITY(name, control) \ + do { \ + if (config_has_user_value(App()->GlobalConfig(), \ + "BasicWindow", name)) { \ bool visible = config_get_bool(App()->GlobalConfig(), \ - "BasicWindow", name); \ - ui->control->setChecked(visible); \ - } \ + "BasicWindow", name); \ + ui->control->setChecked(visible); \ + } \ } while (false) SET_VISIBILITY("ShowListboxToolbars", toggleListboxToolbars); @@ -1650,19 +1641,19 @@ TimedCheckForUpdates(); loaded = true; - previewEnabled = config_get_bool(App()->GlobalConfig(), - "BasicWindow", "PreviewEnabled"); + previewEnabled = config_get_bool(App()->GlobalConfig(), "BasicWindow", + "PreviewEnabled"); if (!previewEnabled && !IsPreviewProgramMode()) QMetaObject::invokeMethod(this, "EnablePreviewDisplay", - Qt::QueuedConnection, - Q_ARG(bool, previewEnabled)); + Qt::QueuedConnection, + Q_ARG(bool, previewEnabled)); #ifdef _WIN32 uint32_t winVer = GetWindowsVersion(); if (winVer > 0 && winVer < 0x602) { - bool disableAero = config_get_bool(basicConfig, "Video", - "DisableAero"); + bool disableAero = + config_get_bool(basicConfig, "Video", "DisableAero"); SetAeroEnabled(!disableAero); } #endif @@ -1671,10 +1662,9 @@ RefreshProfiles(); disableSaving--; - auto addDisplay = [this] (OBSQTDisplay *window) - { + auto addDisplay = [this](OBSQTDisplay *window) { obs_display_add_draw_callback(window->GetDisplay(), - OBSBasic::RenderMain, this); + OBSBasic::RenderMain, this); struct obs_video_info ovi; if (obs_get_video_info(&ovi)) @@ -1689,7 +1679,7 @@ #endif bool alwaysOnTop = config_get_bool(App()->GlobalConfig(), "BasicWindow", - "AlwaysOnTop"); + "AlwaysOnTop"); if (alwaysOnTop || opt_always_on_top) { SetAlwaysOnTop(this, true); ui->actionAlwaysOnTop->setChecked(true); @@ -1703,8 +1693,25 @@ OBSBasicStats *statsDlg = new OBSBasicStats(statsDock, false); statsDock->setWidget(statsDlg); - const char *dockStateStr = config_get_string(App()->GlobalConfig(), - "BasicWindow", "DockState"); + /* ----------------------------- */ + /* add custom browser docks */ + +#ifdef BROWSER_AVAILABLE + if (cef) { + QAction *action = new QAction(QTStr("Basic.MainMenu." + "View.Docks." + "CustomBrowserDocks")); + ui->viewMenuDocks->insertAction(ui->toggleScenes, action); + connect(action, &QAction::triggered, this, + &OBSBasic::ManageExtraBrowserDocks); + ui->viewMenuDocks->insertSeparator(ui->toggleScenes); + + LoadExtraBrowserDocks(); + } +#endif + + const char *dockStateStr = config_get_string( + App()->GlobalConfig(), "BasicWindow", "DockState"); if (!dockStateStr) { on_resetUI_triggered(); } else { @@ -1714,22 +1721,22 @@ on_resetUI_triggered(); } - bool pre23Defaults = config_get_bool(App()->GlobalConfig(), - "General", "Pre23Defaults"); + bool pre23Defaults = config_get_bool(App()->GlobalConfig(), "General", + "Pre23Defaults"); if (pre23Defaults) { - bool resetDockLock23 = config_get_bool(App()->GlobalConfig(), - "General", "ResetDockLock23"); + bool resetDockLock23 = config_get_bool( + App()->GlobalConfig(), "General", "ResetDockLock23"); if (!resetDockLock23) { - config_set_bool(App()->GlobalConfig(), - "General", "ResetDockLock23", true); + config_set_bool(App()->GlobalConfig(), "General", + "ResetDockLock23", true); config_remove_value(App()->GlobalConfig(), - "BasicWindow", "DocksLocked"); + "BasicWindow", "DocksLocked"); config_save_safe(App()->GlobalConfig(), "tmp", nullptr); } } - bool docksLocked = config_get_bool(App()->GlobalConfig(), - "BasicWindow", "DocksLocked"); + bool docksLocked = config_get_bool(App()->GlobalConfig(), "BasicWindow", + "DocksLocked"); on_lockUI_toggled(docksLocked); ui->lockUI->blockSignals(true); ui->lockUI->setChecked(docksLocked); @@ -1743,9 +1750,9 @@ fullscreenInterface = true; bool has_last_version = config_has_user_value(App()->GlobalConfig(), - "General", "LastVersion"); - bool first_run = config_get_bool(App()->GlobalConfig(), "General", - "FirstRun"); + "General", "LastVersion"); + bool first_run = + config_get_bool(App()->GlobalConfig(), "General", "FirstRun"); if (!first_run) { config_set_bool(App()->GlobalConfig(), "General", "FirstRun", @@ -1757,23 +1764,22 @@ QString msg; msg = QTStr("Basic.FirstStartup.RunWizard"); - QMessageBox::StandardButton button = - OBSMessageBox::question(this, QTStr("Basic.AutoConfig"), - msg); + QMessageBox::StandardButton button = OBSMessageBox::question( + this, QTStr("Basic.AutoConfig"), msg); if (button == QMessageBox::Yes) { QMetaObject::invokeMethod(this, - "on_autoConfigure_triggered", - Qt::QueuedConnection); + "on_autoConfigure_triggered", + Qt::QueuedConnection); } else { msg = QTStr("Basic.FirstStartup.RunWizard.NoClicked"); - OBSMessageBox::information(this, - QTStr("Basic.AutoConfig"), msg); + OBSMessageBox::information( + this, QTStr("Basic.AutoConfig"), msg); } } ToggleMixerLayout(config_get_bool(App()->GlobalConfig(), "BasicWindow", - "VerticalVolControl")); + "VerticalVolControl")); if (config_get_bool(basicConfig, "General", "OpenStatsOnStartup")) on_stats_triggered(); @@ -1788,11 +1794,11 @@ multiviewProjectorMenu = new QMenu(QTStr("MultiviewProjector")); ui->viewMenu->addMenu(multiviewProjectorMenu); AddProjectorMenuMonitors(multiviewProjectorMenu, this, - SLOT(OpenMultiviewProjector())); + SLOT(OpenMultiviewProjector())); connect(ui->viewMenu->menuAction(), &QAction::hovered, this, - &OBSBasic::UpdateMultiviewProjectorMenu); - ui->viewMenu->addAction(QTStr("MultiviewWindowed"), - this, SLOT(OpenMultiviewWindow())); + &OBSBasic::UpdateMultiviewProjectorMenu); + ui->viewMenu->addAction(QTStr("MultiviewWindowed"), this, + SLOT(OpenMultiviewWindow())); #if !defined(_WIN32) && !defined(__APPLE__) delete ui->actionShowCrashLogs; @@ -1809,8 +1815,7 @@ #ifdef __APPLE__ QMetaObject::invokeMethod(this, "DeferredSysTrayLoad", - Qt::QueuedConnection, - Q_ARG(int, 10)); + Qt::QueuedConnection, Q_ARG(int, 10)); #endif } @@ -1824,8 +1829,8 @@ if (cef) { WhatsNewInfoThread *wnit = new WhatsNewInfoThread(); if (wnit) { - connect(wnit, &WhatsNewInfoThread::Result, - this, &OBSBasic::ReceivedIntroJson); + connect(wnit, &WhatsNewInfoThread::Result, this, + &OBSBasic::ReceivedIntroJson); } if (wnit) { introCheckThread.reset(wnit); @@ -1841,8 +1846,8 @@ { if (--requeueCount > 0) { QMetaObject::invokeMethod(this, "DeferredSysTrayLoad", - Qt::QueuedConnection, - Q_ARG(int, requeueCount)); + Qt::QueuedConnection, + Q_ARG(int, requeueCount)); return; } @@ -1882,8 +1887,7 @@ rc == OBS_RELEASE_CANDIDATE) { #else if (major == LIBOBS_API_MAJOR_VER && - minor == LIBOBS_API_MINOR_VER && - rc == 0) { + minor == LIBOBS_API_MINOR_VER && rc == 0) { #endif info_url = url; info_increment = increment; @@ -1897,10 +1901,10 @@ #if OBS_RELEASE_CANDIDATE > 0 uint32_t lastVersion = config_get_int(App()->GlobalConfig(), "General", - "LastRCVersion"); + "LastRCVersion"); #else - uint32_t lastVersion = config_get_int(App()->GlobalConfig(), "General", - "LastVersion"); + uint32_t lastVersion = + config_get_int(App()->GlobalConfig(), "General", "LastVersion"); #endif int current_version_increment = -1; @@ -1911,19 +1915,18 @@ if ((lastVersion & ~0xFFFF) < (LIBOBS_API_VER & ~0xFFFF)) { #endif config_set_int(App()->GlobalConfig(), "General", - "InfoIncrement", -1); + "InfoIncrement", -1); } else { current_version_increment = config_get_int( - App()->GlobalConfig(), "General", - "InfoIncrement"); + App()->GlobalConfig(), "General", "InfoIncrement"); } if (info_increment <= current_version_increment) { return; } - config_set_int(App()->GlobalConfig(), "General", - "InfoIncrement", info_increment); + config_set_int(App()->GlobalConfig(), "General", "InfoIncrement", + info_increment); /* Don't show What's New dialog for new users */ #if !defined(OBS_RELEASE_CANDIDATE) || OBS_RELEASE_CANDIDATE == 0 @@ -1932,7 +1935,7 @@ } #endif cef->init_browser(); - ExecuteFuncSafeBlock([] {cef->wait_for_browser_init();}); + ExecuteFuncSafeBlock([] { cef->wait_for_browser_init(); }); QDialog *dlg = new QDialog(this); dlg->setAttribute(Qt::WA_DeleteOnClose, true); @@ -1948,12 +1951,11 @@ return; } - connect(cefWidget, SIGNAL(titleChanged(const QString &)), - dlg, SLOT(setWindowTitle(const QString &))); + connect(cefWidget, SIGNAL(titleChanged(const QString &)), dlg, + SLOT(setWindowTitle(const QString &))); QPushButton *close = new QPushButton(QTStr("Close")); - connect(close, &QAbstractButton::clicked, - dlg, &QDialog::accept); + connect(close, &QAbstractButton::clicked, dlg, &QDialog::accept); QHBoxLayout *bottomLayout = new QHBoxLayout(); bottomLayout->addStretch(); @@ -1977,7 +1979,7 @@ { multiviewProjectorMenu->clear(); AddProjectorMenuMonitors(multiviewProjectorMenu, this, - SLOT(OpenMultiviewProjector())); + SLOT(OpenMultiviewProjector())); } void OBSBasic::InitHotkeys() @@ -1985,52 +1987,53 @@ ProfileScope("OBSBasic::InitHotkeys"); struct obs_hotkeys_translations t = {}; - t.insert = Str("Hotkeys.Insert"); - t.del = Str("Hotkeys.Delete"); - t.home = Str("Hotkeys.Home"); - t.end = Str("Hotkeys.End"); - t.page_up = Str("Hotkeys.PageUp"); - t.page_down = Str("Hotkeys.PageDown"); - t.num_lock = Str("Hotkeys.NumLock"); - t.scroll_lock = Str("Hotkeys.ScrollLock"); - t.caps_lock = Str("Hotkeys.CapsLock"); - t.backspace = Str("Hotkeys.Backspace"); - t.tab = Str("Hotkeys.Tab"); - t.print = Str("Hotkeys.Print"); - t.pause = Str("Hotkeys.Pause"); - t.left = Str("Hotkeys.Left"); - t.right = Str("Hotkeys.Right"); - t.up = Str("Hotkeys.Up"); - t.down = Str("Hotkeys.Down"); + t.insert = Str("Hotkeys.Insert"); + t.del = Str("Hotkeys.Delete"); + t.home = Str("Hotkeys.Home"); + t.end = Str("Hotkeys.End"); + t.page_up = Str("Hotkeys.PageUp"); + t.page_down = Str("Hotkeys.PageDown"); + t.num_lock = Str("Hotkeys.NumLock"); + t.scroll_lock = Str("Hotkeys.ScrollLock"); + t.caps_lock = Str("Hotkeys.CapsLock"); + t.backspace = Str("Hotkeys.Backspace"); + t.tab = Str("Hotkeys.Tab"); + t.print = Str("Hotkeys.Print"); + t.pause = Str("Hotkeys.Pause"); + t.left = Str("Hotkeys.Left"); + t.right = Str("Hotkeys.Right"); + t.up = Str("Hotkeys.Up"); + t.down = Str("Hotkeys.Down"); #ifdef _WIN32 - t.meta = Str("Hotkeys.Windows"); + t.meta = Str("Hotkeys.Windows"); #else - t.meta = Str("Hotkeys.Super"); + t.meta = Str("Hotkeys.Super"); #endif - t.menu = Str("Hotkeys.Menu"); - t.space = Str("Hotkeys.Space"); - t.numpad_num = Str("Hotkeys.NumpadNum"); - t.numpad_multiply = Str("Hotkeys.NumpadMultiply"); - t.numpad_divide = Str("Hotkeys.NumpadDivide"); - t.numpad_plus = Str("Hotkeys.NumpadAdd"); - t.numpad_minus = Str("Hotkeys.NumpadSubtract"); - t.numpad_decimal = Str("Hotkeys.NumpadDecimal"); - t.apple_keypad_num = Str("Hotkeys.AppleKeypadNum"); - t.apple_keypad_multiply = Str("Hotkeys.AppleKeypadMultiply"); - t.apple_keypad_divide = Str("Hotkeys.AppleKeypadDivide"); - t.apple_keypad_plus = Str("Hotkeys.AppleKeypadAdd"); - t.apple_keypad_minus = Str("Hotkeys.AppleKeypadSubtract"); - t.apple_keypad_decimal = Str("Hotkeys.AppleKeypadDecimal"); - t.apple_keypad_equal = Str("Hotkeys.AppleKeypadEqual"); - t.mouse_num = Str("Hotkeys.MouseButton"); - t.escape = Str("Hotkeys.Escape"); + t.menu = Str("Hotkeys.Menu"); + t.space = Str("Hotkeys.Space"); + t.numpad_num = Str("Hotkeys.NumpadNum"); + t.numpad_multiply = Str("Hotkeys.NumpadMultiply"); + t.numpad_divide = Str("Hotkeys.NumpadDivide"); + t.numpad_plus = Str("Hotkeys.NumpadAdd"); + t.numpad_minus = Str("Hotkeys.NumpadSubtract"); + t.numpad_decimal = Str("Hotkeys.NumpadDecimal"); + t.apple_keypad_num = Str("Hotkeys.AppleKeypadNum"); + t.apple_keypad_multiply = Str("Hotkeys.AppleKeypadMultiply"); + t.apple_keypad_divide = Str("Hotkeys.AppleKeypadDivide"); + t.apple_keypad_plus = Str("Hotkeys.AppleKeypadAdd"); + t.apple_keypad_minus = Str("Hotkeys.AppleKeypadSubtract"); + t.apple_keypad_decimal = Str("Hotkeys.AppleKeypadDecimal"); + t.apple_keypad_equal = Str("Hotkeys.AppleKeypadEqual"); + t.mouse_num = Str("Hotkeys.MouseButton"); + t.escape = Str("Hotkeys.Escape"); obs_hotkeys_set_translations(&t); obs_hotkeys_set_audio_hotkeys_translations(Str("Mute"), Str("Unmute"), - Str("Push-to-mute"), Str("Push-to-talk")); + Str("Push-to-mute"), + Str("Push-to-talk")); - obs_hotkeys_set_sceneitem_hotkeys_translations( - Str("SceneItemShow"), Str("SceneItemHide")); + obs_hotkeys_set_sceneitem_hotkeys_translations(Str("SceneItemShow"), + Str("SceneItemHide")); obs_hotkey_enable_callback_rerouting(true); obs_hotkey_set_callback_routing_func(OBSBasic::HotkeyTriggered, this); @@ -2043,19 +2046,19 @@ void OBSBasic::HotkeyTriggered(void *data, obs_hotkey_id id, bool pressed) { - OBSBasic &basic = *static_cast<OBSBasic*>(data); + OBSBasic &basic = *static_cast<OBSBasic *>(data); QMetaObject::invokeMethod(&basic, "ProcessHotkey", - Q_ARG(obs_hotkey_id, id), Q_ARG(bool, pressed)); + Q_ARG(obs_hotkey_id, id), + Q_ARG(bool, pressed)); } void OBSBasic::CreateHotkeys() { ProfileScope("OBSBasic::CreateHotkeys"); - auto LoadHotkeyData = [&](const char *name) -> OBSData - { - const char *info = config_get_string(basicConfig, - "Hotkeys", name); + auto LoadHotkeyData = [&](const char *name) -> OBSData { + const char *info = + config_get_string(basicConfig, "Hotkeys", name); if (!info) return {}; @@ -2068,8 +2071,7 @@ return res; }; - auto LoadHotkey = [&](obs_hotkey_id id, const char *name) - { + auto LoadHotkey = [&](obs_hotkey_id id, const char *name) { obs_data_array_t *array = obs_data_get_array(LoadHotkeyData(name), "bindings"); @@ -2078,8 +2080,7 @@ }; auto LoadHotkeyPair = [&](obs_hotkey_pair_id id, const char *name0, - const char *name1) - { + const char *name1) { obs_data_array_t *array0 = obs_data_get_array(LoadHotkeyData(name0), "bindings"); obs_data_array_t *array1 = @@ -2090,117 +2091,116 @@ obs_data_array_release(array1); }; -#define MAKE_CALLBACK(pred, method, log_action) \ - [](void *data, obs_hotkey_pair_id, obs_hotkey_t*, bool pressed) \ - { \ - OBSBasic &basic = *static_cast<OBSBasic*>(data); \ - if ((pred) && pressed) { \ - blog(LOG_INFO, log_action " due to hotkey"); \ - method(); \ - return true; \ - } \ - return false; \ +#define MAKE_CALLBACK(pred, method, log_action) \ + [](void *data, obs_hotkey_pair_id, obs_hotkey_t *, bool pressed) { \ + OBSBasic &basic = *static_cast<OBSBasic *>(data); \ + if ((pred) && pressed) { \ + blog(LOG_INFO, log_action " due to hotkey"); \ + method(); \ + return true; \ + } \ + return false; \ } streamingHotkeys = obs_hotkey_pair_register_frontend( - "OBSBasic.StartStreaming", - Str("Basic.Main.StartStreaming"), - "OBSBasic.StopStreaming", - Str("Basic.Main.StopStreaming"), - MAKE_CALLBACK(!basic.outputHandler->StreamingActive() && - basic.ui->streamButton->isEnabled(), - basic.StartStreaming, "Starting stream"), - MAKE_CALLBACK(basic.outputHandler->StreamingActive() && - basic.ui->streamButton->isEnabled(), - basic.StopStreaming, "Stopping stream"), - this, this); - LoadHotkeyPair(streamingHotkeys, - "OBSBasic.StartStreaming", "OBSBasic.StopStreaming"); + "OBSBasic.StartStreaming", Str("Basic.Main.StartStreaming"), + "OBSBasic.StopStreaming", Str("Basic.Main.StopStreaming"), + MAKE_CALLBACK(!basic.outputHandler->StreamingActive() && + basic.ui->streamButton->isEnabled(), + basic.StartStreaming, "Starting stream"), + MAKE_CALLBACK(basic.outputHandler->StreamingActive() && + basic.ui->streamButton->isEnabled(), + basic.StopStreaming, "Stopping stream"), + this, this); + LoadHotkeyPair(streamingHotkeys, "OBSBasic.StartStreaming", + "OBSBasic.StopStreaming"); - auto cb = [] (void *data, obs_hotkey_id, obs_hotkey_t*, bool pressed) - { - OBSBasic &basic = *static_cast<OBSBasic*>(data); + auto cb = [](void *data, obs_hotkey_id, obs_hotkey_t *, bool pressed) { + OBSBasic &basic = *static_cast<OBSBasic *>(data); if (basic.outputHandler->StreamingActive() && pressed) { basic.ForceStopStreaming(); } }; forceStreamingStopHotkey = obs_hotkey_register_frontend( - "OBSBasic.ForceStopStreaming", - Str("Basic.Main.ForceStopStreaming"), - cb, this); - LoadHotkey(forceStreamingStopHotkey, - "OBSBasic.ForceStopStreaming"); + "OBSBasic.ForceStopStreaming", + Str("Basic.Main.ForceStopStreaming"), cb, this); + LoadHotkey(forceStreamingStopHotkey, "OBSBasic.ForceStopStreaming"); recordingHotkeys = obs_hotkey_pair_register_frontend( - "OBSBasic.StartRecording", - Str("Basic.Main.StartRecording"), - "OBSBasic.StopRecording", - Str("Basic.Main.StopRecording"), - MAKE_CALLBACK(!basic.outputHandler->RecordingActive() && - !basic.ui->recordButton->isChecked(), - basic.StartRecording, "Starting recording"), - MAKE_CALLBACK(basic.outputHandler->RecordingActive() && - basic.ui->recordButton->isChecked(), - basic.StopRecording, "Stopping recording"), - this, this); - LoadHotkeyPair(recordingHotkeys, - "OBSBasic.StartRecording", "OBSBasic.StopRecording"); + "OBSBasic.StartRecording", Str("Basic.Main.StartRecording"), + "OBSBasic.StopRecording", Str("Basic.Main.StopRecording"), + MAKE_CALLBACK(!basic.outputHandler->RecordingActive() && + !basic.ui->recordButton->isChecked(), + basic.StartRecording, "Starting recording"), + MAKE_CALLBACK(basic.outputHandler->RecordingActive() && + basic.ui->recordButton->isChecked(), + basic.StopRecording, "Stopping recording"), + this, this); + LoadHotkeyPair(recordingHotkeys, "OBSBasic.StartRecording", + "OBSBasic.StopRecording"); + + pauseHotkeys = obs_hotkey_pair_register_frontend( + "OBSBasic.PauseRecording", Str("Basic.Main.PauseRecording"), + "OBSBasic.UnpauseRecording", Str("Basic.Main.UnpauseRecording"), + MAKE_CALLBACK(basic.pause && !basic.pause->isChecked(), + basic.PauseRecording, "Pausing recording"), + MAKE_CALLBACK(basic.pause && basic.pause->isChecked(), + basic.UnpauseRecording, "Unpausing recording"), + this, this); + LoadHotkeyPair(pauseHotkeys, "OBSBasic.PauseRecording", + "OBSBasic.UnpauseRecording"); replayBufHotkeys = obs_hotkey_pair_register_frontend( - "OBSBasic.StartReplayBuffer", - Str("Basic.Main.StartReplayBuffer"), - "OBSBasic.StopReplayBuffer", - Str("Basic.Main.StopReplayBuffer"), - MAKE_CALLBACK(!basic.outputHandler->ReplayBufferActive(), - basic.StartReplayBuffer, "Starting replay buffer"), - MAKE_CALLBACK(basic.outputHandler->ReplayBufferActive(), - basic.StopReplayBuffer, "Stopping replay buffer"), - this, this); - LoadHotkeyPair(replayBufHotkeys, - "OBSBasic.StartReplayBuffer", "OBSBasic.StopReplayBuffer"); + "OBSBasic.StartReplayBuffer", + Str("Basic.Main.StartReplayBuffer"), + "OBSBasic.StopReplayBuffer", Str("Basic.Main.StopReplayBuffer"), + MAKE_CALLBACK(!basic.outputHandler->ReplayBufferActive(), + basic.StartReplayBuffer, + "Starting replay buffer"), + MAKE_CALLBACK(basic.outputHandler->ReplayBufferActive(), + basic.StopReplayBuffer, "Stopping replay buffer"), + this, this); + LoadHotkeyPair(replayBufHotkeys, "OBSBasic.StartReplayBuffer", + "OBSBasic.StopReplayBuffer"); togglePreviewHotkeys = obs_hotkey_pair_register_frontend( - "OBSBasic.EnablePreview", - Str("Basic.Main.PreviewConextMenu.Enable"), - "OBSBasic.DisablePreview", - Str("Basic.Main.Preview.Disable"), - MAKE_CALLBACK(!basic.previewEnabled, - basic.EnablePreview, "Enabling preview"), - MAKE_CALLBACK(basic.previewEnabled, - basic.DisablePreview, "Disabling preview"), - this, this); - LoadHotkeyPair(togglePreviewHotkeys, - "OBSBasic.EnablePreview", "OBSBasic.DisablePreview"); + "OBSBasic.EnablePreview", + Str("Basic.Main.PreviewConextMenu.Enable"), + "OBSBasic.DisablePreview", Str("Basic.Main.Preview.Disable"), + MAKE_CALLBACK(!basic.previewEnabled, basic.EnablePreview, + "Enabling preview"), + MAKE_CALLBACK(basic.previewEnabled, basic.DisablePreview, + "Disabling preview"), + this, this); + LoadHotkeyPair(togglePreviewHotkeys, "OBSBasic.EnablePreview", + "OBSBasic.DisablePreview"); #undef MAKE_CALLBACK - auto togglePreviewProgram = [] (void *data, obs_hotkey_id, - obs_hotkey_t*, bool pressed) - { + auto togglePreviewProgram = [](void *data, obs_hotkey_id, + obs_hotkey_t *, bool pressed) { if (pressed) - QMetaObject::invokeMethod(static_cast<OBSBasic*>(data), - "on_modeSwitch_clicked", - Qt::QueuedConnection); + QMetaObject::invokeMethod(static_cast<OBSBasic *>(data), + "on_modeSwitch_clicked", + Qt::QueuedConnection); }; togglePreviewProgramHotkey = obs_hotkey_register_frontend( - "OBSBasic.TogglePreviewProgram", - Str("Basic.TogglePreviewProgramMode"), - togglePreviewProgram, this); + "OBSBasic.TogglePreviewProgram", + Str("Basic.TogglePreviewProgramMode"), togglePreviewProgram, + this); LoadHotkey(togglePreviewProgramHotkey, "OBSBasic.TogglePreviewProgram"); - auto transition = [] (void *data, obs_hotkey_id, obs_hotkey_t*, - bool pressed) - { + auto transition = [](void *data, obs_hotkey_id, obs_hotkey_t *, + bool pressed) { if (pressed) - QMetaObject::invokeMethod(static_cast<OBSBasic*>(data), - "TransitionClicked", - Qt::QueuedConnection); + QMetaObject::invokeMethod(static_cast<OBSBasic *>(data), + "TransitionClicked", + Qt::QueuedConnection); }; transitionHotkey = obs_hotkey_register_frontend( - "OBSBasic.Transition", - Str("Transition"), transition, this); + "OBSBasic.Transition", Str("Transition"), transition, this); LoadHotkey(transitionHotkey, "OBSBasic.Transition"); } @@ -2208,6 +2208,7 @@ { obs_hotkey_pair_unregister(streamingHotkeys); obs_hotkey_pair_unregister(recordingHotkeys); + obs_hotkey_pair_unregister(pauseHotkeys); obs_hotkey_pair_unregister(replayBufHotkeys); obs_hotkey_pair_unregister(togglePreviewHotkeys); obs_hotkey_unregister(forceStreamingStopHotkey); @@ -2272,7 +2273,7 @@ delete about; obs_display_remove_draw_callback(ui->preview->GetDisplay(), - OBSBasic::RenderMain, this); + OBSBasic::RenderMain, this); obs_enter_graphics(); gs_vertexbuffer_destroy(box); @@ -2293,10 +2294,10 @@ QApplication::sendPostedEvents(this); config_set_int(App()->GlobalConfig(), "General", "LastVersion", - LIBOBS_API_VER); + LIBOBS_API_VER); #if OBS_RELEASE_CANDIDATE > 0 config_set_int(App()->GlobalConfig(), "General", "LastRCVersion", - OBS_RELEASE_CANDIDATE_VER); + OBS_RELEASE_CANDIDATE_VER); #endif bool alwaysOnTop = IsAlwaysOnTop(this); @@ -2307,21 +2308,21 @@ alwaysOnTop); config_set_bool(App()->GlobalConfig(), "BasicWindow", "SceneDuplicationMode", sceneDuplicationMode); - config_set_bool(App()->GlobalConfig(), "BasicWindow", - "SwapScenesMode", swapScenesMode); + config_set_bool(App()->GlobalConfig(), "BasicWindow", "SwapScenesMode", + swapScenesMode); config_set_bool(App()->GlobalConfig(), "BasicWindow", "EditPropertiesMode", editPropertiesMode); config_set_bool(App()->GlobalConfig(), "BasicWindow", "PreviewProgramMode", IsPreviewProgramMode()); - config_set_bool(App()->GlobalConfig(), "BasicWindow", - "DocksLocked", ui->lockUI->isChecked()); + config_set_bool(App()->GlobalConfig(), "BasicWindow", "DocksLocked", + ui->lockUI->isChecked()); config_save_safe(App()->GlobalConfig(), "tmp", nullptr); #ifdef _WIN32 uint32_t winVer = GetWindowsVersion(); if (winVer > 0 && winVer < 0x602) { - bool disableAero = config_get_bool(basicConfig, "Video", - "DisableAero"); + bool disableAero = + config_get_bool(basicConfig, "Video", "DisableAero"); if (disableAero) { SetAeroEnabled(true); } @@ -2351,7 +2352,7 @@ projectChanged = true; QMetaObject::invokeMethod(this, "SaveProjectDeferred", - Qt::QueuedConnection); + Qt::QueuedConnection); } void OBSBasic::SaveProjectDeferred() @@ -2364,8 +2365,8 @@ projectChanged = false; - const char *sceneCollection = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollectionFile"); + const char *sceneCollection = config_get_string( + App()->GlobalConfig(), "Basic", "SceneCollectionFile"); char savePath[512]; char fileName[512]; int ret; @@ -2374,7 +2375,7 @@ return; ret = snprintf(fileName, 512, "obs-studio/basic/scenes/%s.json", - sceneCollection); + sceneCollection); if (ret <= 0) return; @@ -2422,8 +2423,9 @@ ui->actionScaleWindow->setChecked(false); ui->actionScaleCanvas->setChecked(scalingAmount == 1.0f); - ui->actionScaleOutput->setChecked( - scalingAmount == float(ovi.output_width) / float(ovi.base_width)); + ui->actionScaleOutput->setChecked(scalingAmount == + float(ovi.output_width) / + float(ovi.base_width)); } void OBSBasic::CreateInteractionWindow(obs_source_t *source) @@ -2460,27 +2462,28 @@ void OBSBasic::AddScene(OBSSource source) { - const char *name = obs_source_get_name(source); + const char *name = obs_source_get_name(source); obs_scene_t *scene = obs_scene_from_source(source); QListWidgetItem *item = new QListWidgetItem(QT_UTF8(name)); SetOBSRef(item, OBSScene(scene)); ui->scenes->addItem(item); - obs_hotkey_register_source(source, "OBSBasic.SelectScene", - Str("Basic.Hotkeys.SelectScene"), - [](void *data, - obs_hotkey_id, obs_hotkey_t*, bool pressed) - { - OBSBasic *main = - reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); - - auto potential_source = static_cast<obs_source_t*>(data); - auto source = obs_source_get_ref(potential_source); - if (source && pressed) - main->SetCurrentScene(source); - obs_source_release(source); - }, static_cast<obs_source_t*>(source)); + obs_hotkey_register_source( + source, "OBSBasic.SelectScene", + Str("Basic.Hotkeys.SelectScene"), + [](void *data, obs_hotkey_id, obs_hotkey_t *, bool pressed) { + OBSBasic *main = reinterpret_cast<OBSBasic *>( + App()->GetMainWindow()); + + auto potential_source = + static_cast<obs_source_t *>(data); + auto source = obs_source_get_ref(potential_source); + if (source && pressed) + main->SetCurrentScene(source); + obs_source_release(source); + }, + static_cast<obs_source_t *>(source)); signal_handler_t *handler = obs_source_get_signal_handler(source); @@ -2488,41 +2491,42 @@ container.ref = scene; container.handlers.assign({ std::make_shared<OBSSignal>(handler, "item_add", - OBSBasic::SceneItemAdded, this), + OBSBasic::SceneItemAdded, this), std::make_shared<OBSSignal>(handler, "item_select", - OBSBasic::SceneItemSelected, this), + OBSBasic::SceneItemSelected, this), std::make_shared<OBSSignal>(handler, "item_deselect", - OBSBasic::SceneItemDeselected, this), + OBSBasic::SceneItemDeselected, + this), std::make_shared<OBSSignal>(handler, "reorder", - OBSBasic::SceneReordered, this), + OBSBasic::SceneReordered, this), }); item->setData(static_cast<int>(QtDataRole::OBSSignals), - QVariant::fromValue(container)); + QVariant::fromValue(container)); /* if the scene already has items (a duplicated scene) add them */ - auto addSceneItem = [this] (obs_sceneitem_t *item) - { + auto addSceneItem = [this](obs_sceneitem_t *item) { AddSceneItem(item); }; using addSceneItem_t = decltype(addSceneItem); - obs_scene_enum_items(scene, - [] (obs_scene_t*, obs_sceneitem_t *item, void *param) - { - addSceneItem_t *func; - func = reinterpret_cast<addSceneItem_t*>(param); - (*func)(item); - return true; - }, &addSceneItem); + obs_scene_enum_items( + scene, + [](obs_scene_t *, obs_sceneitem_t *item, void *param) { + addSceneItem_t *func; + func = reinterpret_cast<addSceneItem_t *>(param); + (*func)(item); + return true; + }, + &addSceneItem); SaveProject(); if (!disableSaving) { obs_source_t *source = obs_scene_get_source(scene); blog(LOG_INFO, "User added scene '%s'", - obs_source_get_name(source)); + obs_source_get_name(source)); OBSProjector::UpdateMultiviewProjectors(); } @@ -2558,7 +2562,7 @@ if (!disableSaving) { blog(LOG_INFO, "User Removed scene '%s'", - obs_source_get_name(source)); + obs_source_get_name(source)); OBSProjector::UpdateMultiviewProjectors(); } @@ -2570,7 +2574,7 @@ static bool select_one(obs_scene_t *scene, obs_sceneitem_t *item, void *param) { obs_sceneitem_t *selectedItem = - reinterpret_cast<obs_sceneitem_t*>(param); + reinterpret_cast<obs_sceneitem_t *>(param); if (obs_sceneitem_is_group(item)) obs_sceneitem_group_enum_items(item, select_one, param); @@ -2582,7 +2586,7 @@ void OBSBasic::AddSceneItem(OBSSceneItem item) { - obs_scene_t *scene = obs_sceneitem_get_scene(item); + obs_scene_t *scene = obs_sceneitem_get_scene(item); if (GetCurrentScene() == scene) ui->sources->Add(item); @@ -2593,11 +2597,12 @@ obs_source_t *sceneSource = obs_scene_get_source(scene); obs_source_t *itemSource = obs_sceneitem_get_source(item); blog(LOG_INFO, "User added source '%s' (%s) to scene '%s'", - obs_source_get_name(itemSource), - obs_source_get_id(itemSource), - obs_source_get_name(sceneSource)); - - obs_scene_enum_items(scene, select_one, (obs_sceneitem_t*)item); + obs_source_get_name(itemSource), + obs_source_get_id(itemSource), + obs_source_get_name(sceneSource)); + + obs_scene_enum_items(scene, select_one, + (obs_sceneitem_t *)item); } } @@ -2610,7 +2615,7 @@ if (!scene) return; - QList<QListWidgetItem*> items = + QList<QListWidgetItem *> items = ui->scenes->findItems(QT_UTF8(name), Qt::MatchExactly); if (items.count()) { @@ -2621,15 +2626,16 @@ OBSScene curScene = GetOBSRef<OBSScene>(ui->scenes->currentItem()); if (api && scene != curScene) - api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED); + api->on_event( + OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED); } } } static void RenameListValues(QListWidget *listWidget, const QString &newName, - const QString &prevName) + const QString &prevName) { - QList<QListWidgetItem*> items = + QList<QListWidgetItem *> items = listWidget->findItems(prevName, Qt::MatchExactly); for (int i = 0; i < items.count(); i++) @@ -2637,9 +2643,9 @@ } void OBSBasic::RenameSources(OBSSource source, QString newName, - QString prevName) + QString prevName) { - RenameListValues(ui->scenes, newName, prevName); + RenameListValues(ui->scenes, newName, prevName); for (size_t i = 0; i < volumes.size(); i++) { if (volumes[i]->GetName().compare(prevName) == 0) @@ -2683,8 +2689,8 @@ void OBSBasic::GetAudioSourceFilters() { - QAction *action = reinterpret_cast<QAction*>(sender()); - VolControl *vol = action->property("volControl").value<VolControl*>(); + QAction *action = reinterpret_cast<QAction *>(sender()); + VolControl *vol = action->property("volControl").value<VolControl *>(); obs_source_t *source = vol->GetSource(); CreateFiltersWindow(source); @@ -2692,8 +2698,8 @@ void OBSBasic::GetAudioSourceProperties() { - QAction *action = reinterpret_cast<QAction*>(sender()); - VolControl *vol = action->property("volControl").value<VolControl*>(); + QAction *action = reinterpret_cast<QAction *>(sender()); + VolControl *vol = action->property("volControl").value<VolControl *>(); obs_source_t *source = vol->GetSource(); CreatePropertiesWindow(source); @@ -2701,8 +2707,8 @@ void OBSBasic::HideAudioControl() { - QAction *action = reinterpret_cast<QAction*>(sender()); - VolControl *vol = action->property("volControl").value<VolControl*>(); + QAction *action = reinterpret_cast<QAction *>(sender()); + VolControl *vol = action->property("volControl").value<VolControl *>(); obs_source_t *source = vol->GetSource(); if (!SourceMixerHidden(source)) { @@ -2713,7 +2719,7 @@ void OBSBasic::UnhideAllAudioControls() { - auto UnhideAudioMixer = [this] (obs_source_t *source) /* -- */ + auto UnhideAudioMixer = [this](obs_source_t *source) /* -- */ { if (!obs_source_active(source)) return true; @@ -2727,10 +2733,8 @@ using UnhideAudioMixer_t = decltype(UnhideAudioMixer); - auto PreEnum = [] (void *data, obs_source_t *source) -> bool /* -- */ - { - return (*reinterpret_cast<UnhideAudioMixer_t *>(data))(source); - }; + auto PreEnum = [](void *data, obs_source_t *source) -> bool /* -- */ + { return (*reinterpret_cast<UnhideAudioMixer_t *>(data))(source); }; obs_enum_sources(PreEnum, &UnhideAudioMixer); } @@ -2751,26 +2755,25 @@ void OBSBasic::MixerRenameSource() { - QAction *action = reinterpret_cast<QAction*>(sender()); - VolControl *vol = action->property("volControl").value<VolControl*>(); + QAction *action = reinterpret_cast<QAction *>(sender()); + VolControl *vol = action->property("volControl").value<VolControl *>(); OBSSource source = vol->GetSource(); const char *prevName = obs_source_get_name(source); for (;;) { string name; - bool accepted = NameDialog::AskForName(this, - QTStr("Basic.Main.MixerRename.Title"), - QTStr("Basic.Main.MixerRename.Text"), - name, - QT_UTF8(prevName)); + bool accepted = NameDialog::AskForName( + this, QTStr("Basic.Main.MixerRename.Title"), + QTStr("Basic.Main.MixerRename.Text"), name, + QT_UTF8(prevName)); if (!accepted) return; if (name.empty()) { OBSMessageBox::warning(this, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); continue; } @@ -2778,9 +2781,8 @@ obs_source_release(sourceTest); if (sourceTest) { - OBSMessageBox::warning(this, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + OBSMessageBox::warning(this, QTStr("NameExists.Title"), + QTStr("NameExists.Text")); continue; } @@ -2791,7 +2793,7 @@ void OBSBasic::VolControlContextMenu() { - VolControl *vol = reinterpret_cast<VolControl*>(sender()); + VolControl *vol = reinterpret_cast<VolControl *>(sender()); /* ------------------- */ @@ -2808,60 +2810,52 @@ QAction toggleControlLayoutAction(QTStr("VerticalLayout"), this); toggleControlLayoutAction.setCheckable(true); - toggleControlLayoutAction.setChecked(config_get_bool(GetGlobalConfig(), - "BasicWindow", "VerticalVolControl")); + toggleControlLayoutAction.setChecked(config_get_bool( + GetGlobalConfig(), "BasicWindow", "VerticalVolControl")); /* ------------------- */ - connect(&hideAction, &QAction::triggered, - this, &OBSBasic::HideAudioControl, - Qt::DirectConnection); - connect(&unhideAllAction, &QAction::triggered, - this, &OBSBasic::UnhideAllAudioControls, - Qt::DirectConnection); - connect(&mixerRenameAction, &QAction::triggered, - this, &OBSBasic::MixerRenameSource, - Qt::DirectConnection); - - connect(©FiltersAction, &QAction::triggered, - this, &OBSBasic::AudioMixerCopyFilters, - Qt::DirectConnection); - connect(&pasteFiltersAction, &QAction::triggered, - this, &OBSBasic::AudioMixerPasteFilters, - Qt::DirectConnection); - - connect(&filtersAction, &QAction::triggered, - this, &OBSBasic::GetAudioSourceFilters, - Qt::DirectConnection); - connect(&propertiesAction, &QAction::triggered, - this, &OBSBasic::GetAudioSourceProperties, - Qt::DirectConnection); - connect(&advPropAction, &QAction::triggered, - this, &OBSBasic::on_actionAdvAudioProperties_triggered, - Qt::DirectConnection); + connect(&hideAction, &QAction::triggered, this, + &OBSBasic::HideAudioControl, Qt::DirectConnection); + connect(&unhideAllAction, &QAction::triggered, this, + &OBSBasic::UnhideAllAudioControls, Qt::DirectConnection); + connect(&mixerRenameAction, &QAction::triggered, this, + &OBSBasic::MixerRenameSource, Qt::DirectConnection); + + connect(©FiltersAction, &QAction::triggered, this, + &OBSBasic::AudioMixerCopyFilters, Qt::DirectConnection); + connect(&pasteFiltersAction, &QAction::triggered, this, + &OBSBasic::AudioMixerPasteFilters, Qt::DirectConnection); + + connect(&filtersAction, &QAction::triggered, this, + &OBSBasic::GetAudioSourceFilters, Qt::DirectConnection); + connect(&propertiesAction, &QAction::triggered, this, + &OBSBasic::GetAudioSourceProperties, Qt::DirectConnection); + connect(&advPropAction, &QAction::triggered, this, + &OBSBasic::on_actionAdvAudioProperties_triggered, + Qt::DirectConnection); /* ------------------- */ connect(&toggleControlLayoutAction, &QAction::changed, this, - &OBSBasic::ToggleVolControlLayout, - Qt::DirectConnection); + &OBSBasic::ToggleVolControlLayout, Qt::DirectConnection); /* ------------------- */ hideAction.setProperty("volControl", - QVariant::fromValue<VolControl*>(vol)); + QVariant::fromValue<VolControl *>(vol)); mixerRenameAction.setProperty("volControl", - QVariant::fromValue<VolControl*>(vol)); + QVariant::fromValue<VolControl *>(vol)); copyFiltersAction.setProperty("volControl", - QVariant::fromValue<VolControl*>(vol)); + QVariant::fromValue<VolControl *>(vol)); pasteFiltersAction.setProperty("volControl", - QVariant::fromValue<VolControl*>(vol)); + QVariant::fromValue<VolControl *>(vol)); filtersAction.setProperty("volControl", - QVariant::fromValue<VolControl*>(vol)); + QVariant::fromValue<VolControl *>(vol)); propertiesAction.setProperty("volControl", - QVariant::fromValue<VolControl*>(vol)); + QVariant::fromValue<VolControl *>(vol)); /* ------------------- */ @@ -2904,24 +2898,22 @@ QAction toggleControlLayoutAction(QTStr("VerticalLayout"), this); toggleControlLayoutAction.setCheckable(true); - toggleControlLayoutAction.setChecked(config_get_bool(GetGlobalConfig(), - "BasicWindow", "VerticalVolControl")); + toggleControlLayoutAction.setChecked(config_get_bool( + GetGlobalConfig(), "BasicWindow", "VerticalVolControl")); /* ------------------- */ - connect(&unhideAllAction, &QAction::triggered, - this, &OBSBasic::UnhideAllAudioControls, - Qt::DirectConnection); - - connect(&advPropAction, &QAction::triggered, - this, &OBSBasic::on_actionAdvAudioProperties_triggered, - Qt::DirectConnection); + connect(&unhideAllAction, &QAction::triggered, this, + &OBSBasic::UnhideAllAudioControls, Qt::DirectConnection); + + connect(&advPropAction, &QAction::triggered, this, + &OBSBasic::on_actionAdvAudioProperties_triggered, + Qt::DirectConnection); /* ------------------- */ connect(&toggleControlLayoutAction, &QAction::changed, this, - &OBSBasic::ToggleVolControlLayout, - Qt::DirectConnection); + &OBSBasic::ToggleVolControlLayout, Qt::DirectConnection); /* ------------------- */ @@ -2948,7 +2940,7 @@ void OBSBasic::ToggleVolControlLayout() { bool vertical = !config_get_bool(GetGlobalConfig(), "BasicWindow", - "VerticalVolControl"); + "VerticalVolControl"); config_set_bool(GetGlobalConfig(), "BasicWindow", "VerticalVolControl", vertical); ToggleMixerLayout(vertical); @@ -2971,15 +2963,15 @@ return; bool vertical = config_get_bool(GetGlobalConfig(), "BasicWindow", - "VerticalVolControl"); + "VerticalVolControl"); VolControl *vol = new VolControl(source, true, vertical); - double meterDecayRate = config_get_double(basicConfig, "Audio", - "MeterDecayRate"); + double meterDecayRate = + config_get_double(basicConfig, "Audio", "MeterDecayRate"); vol->SetMeterDecayRate(meterDecayRate); - uint32_t peakMeterTypeIdx = config_get_uint(basicConfig, "Audio", - "PeakMeterType"); + uint32_t peakMeterTypeIdx = + config_get_uint(basicConfig, "Audio", "PeakMeterType"); enum obs_peak_meter_type peakMeterType; switch (peakMeterTypeIdx) { @@ -2998,10 +2990,10 @@ vol->setContextMenuPolicy(Qt::CustomContextMenu); - connect(vol, &QWidget::customContextMenuRequested, - this, &OBSBasic::VolControlContextMenu); - connect(vol, &VolControl::ConfigClicked, - this, &OBSBasic::VolControlContextMenu); + connect(vol, &QWidget::customContextMenuRequested, this, + &OBSBasic::VolControlContextMenu); + connect(vol, &VolControl::ConfigClicked, this, + &OBSBasic::VolControlContextMenu); InsertQObjectByName(volumes, vol); @@ -3032,21 +3024,21 @@ if (count == 1) { OBSMessageBox::information(this, - QTStr("FinalScene.Title"), - QTStr("FinalScene.Text")); + QTStr("FinalScene.Title"), + QTStr("FinalScene.Text")); return false; } } - const char *name = obs_source_get_name(source); + const char *name = obs_source_get_name(source); QString text = QTStr("ConfirmRemove.Text"); text.replace("$1", QT_UTF8(name)); QMessageBox remove_source(this); remove_source.setText(text); - QAbstractButton *Yes = remove_source.addButton(QTStr("Yes"), - QMessageBox::YesRole); + QAbstractButton *Yes = + remove_source.addButton(QTStr("Yes"), QMessageBox::YesRole); remove_source.addButton(QTStr("No"), QMessageBox::NoRole); remove_source.setIcon(QMessageBox::Question); remove_source.setWindowTitle(QTStr("ConfirmRemove.Title")); @@ -3055,7 +3047,7 @@ return Yes == remove_source.clickedButton(); } -#define UPDATE_CHECK_INTERVAL (60*60*24*4) /* 4 days */ +#define UPDATE_CHECK_INTERVAL (60 * 60 * 24 * 4) /* 4 days */ #ifdef UPDATE_SPARKLE void init_sparkle_updater(bool update_to_undeployed); @@ -3065,25 +3057,25 @@ void OBSBasic::TimedCheckForUpdates() { if (!config_get_bool(App()->GlobalConfig(), "General", - "EnableAutoUpdates")) + "EnableAutoUpdates")) return; #ifdef UPDATE_SPARKLE init_sparkle_updater(config_get_bool(App()->GlobalConfig(), "General", - "UpdateToUndeployed")); + "UpdateToUndeployed")); #elif _WIN32 long long lastUpdate = config_get_int(App()->GlobalConfig(), "General", - "LastUpdateCheck"); - uint32_t lastVersion = config_get_int(App()->GlobalConfig(), "General", - "LastVersion"); + "LastUpdateCheck"); + uint32_t lastVersion = + config_get_int(App()->GlobalConfig(), "General", "LastVersion"); if (lastVersion < LIBOBS_API_VER) { lastUpdate = 0; config_set_int(App()->GlobalConfig(), "General", - "LastUpdateCheck", 0); + "LastUpdateCheck", 0); } - long long t = (long long)time(nullptr); + long long t = (long long)time(nullptr); long long secs = t - lastUpdate; if (secs > UPDATE_CHECK_INTERVAL) @@ -3134,33 +3126,31 @@ for (;;) { string name; - bool accepted = NameDialog::AskForName(this, - QTStr("Basic.Main.AddSceneDlg.Title"), - QTStr("Basic.Main.AddSceneDlg.Text"), - name, - placeHolderText); + bool accepted = NameDialog::AskForName( + this, QTStr("Basic.Main.AddSceneDlg.Title"), + QTStr("Basic.Main.AddSceneDlg.Text"), name, + placeHolderText); if (!accepted) return; if (name.empty()) { OBSMessageBox::warning(this, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); continue; } obs_source_t *source = obs_get_source_by_name(name.c_str()); if (source) { - OBSMessageBox::warning(this, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + OBSMessageBox::warning(this, QTStr("NameExists.Title"), + QTStr("NameExists.Text")); obs_source_release(source); continue; } - obs_scene_t *scene = obs_scene_duplicate(curScene, - name.c_str(), OBS_SCENE_DUP_REFS); + obs_scene_t *scene = obs_scene_duplicate(curScene, name.c_str(), + OBS_SCENE_DUP_REFS); source = obs_scene_get_source(scene); SetCurrentScene(source, true); obs_scene_release(scene); @@ -3178,7 +3168,8 @@ obs_source_remove(source); if (api) - api->on_event(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED); + api->on_event( + OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED); } } } @@ -3206,102 +3197,101 @@ void OBSBasic::SceneReordered(void *data, calldata_t *params) { - OBSBasic *window = static_cast<OBSBasic*>(data); + OBSBasic *window = static_cast<OBSBasic *>(data); - obs_scene_t *scene = (obs_scene_t*)calldata_ptr(params, "scene"); + obs_scene_t *scene = (obs_scene_t *)calldata_ptr(params, "scene"); QMetaObject::invokeMethod(window, "ReorderSources", - Q_ARG(OBSScene, OBSScene(scene))); + Q_ARG(OBSScene, OBSScene(scene))); } void OBSBasic::SceneItemAdded(void *data, calldata_t *params) { - OBSBasic *window = static_cast<OBSBasic*>(data); + OBSBasic *window = static_cast<OBSBasic *>(data); - obs_sceneitem_t *item = (obs_sceneitem_t*)calldata_ptr(params, "item"); + obs_sceneitem_t *item = (obs_sceneitem_t *)calldata_ptr(params, "item"); QMetaObject::invokeMethod(window, "AddSceneItem", - Q_ARG(OBSSceneItem, OBSSceneItem(item))); + Q_ARG(OBSSceneItem, OBSSceneItem(item))); } void OBSBasic::SceneItemSelected(void *data, calldata_t *params) { - OBSBasic *window = static_cast<OBSBasic*>(data); + OBSBasic *window = static_cast<OBSBasic *>(data); - obs_scene_t *scene = (obs_scene_t*)calldata_ptr(params, "scene"); - obs_sceneitem_t *item = (obs_sceneitem_t*)calldata_ptr(params, "item"); + obs_scene_t *scene = (obs_scene_t *)calldata_ptr(params, "scene"); + obs_sceneitem_t *item = (obs_sceneitem_t *)calldata_ptr(params, "item"); QMetaObject::invokeMethod(window, "SelectSceneItem", - Q_ARG(OBSScene, scene), Q_ARG(OBSSceneItem, item), - Q_ARG(bool, true)); + Q_ARG(OBSScene, scene), + Q_ARG(OBSSceneItem, item), Q_ARG(bool, true)); } void OBSBasic::SceneItemDeselected(void *data, calldata_t *params) { - OBSBasic *window = static_cast<OBSBasic*>(data); + OBSBasic *window = static_cast<OBSBasic *>(data); - obs_scene_t *scene = (obs_scene_t*)calldata_ptr(params, "scene"); - obs_sceneitem_t *item = (obs_sceneitem_t*)calldata_ptr(params, "item"); + obs_scene_t *scene = (obs_scene_t *)calldata_ptr(params, "scene"); + obs_sceneitem_t *item = (obs_sceneitem_t *)calldata_ptr(params, "item"); QMetaObject::invokeMethod(window, "SelectSceneItem", - Q_ARG(OBSScene, scene), Q_ARG(OBSSceneItem, item), - Q_ARG(bool, false)); - + Q_ARG(OBSScene, scene), + Q_ARG(OBSSceneItem, item), + Q_ARG(bool, false)); } void OBSBasic::SourceCreated(void *data, calldata_t *params) { - obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source"); + obs_source_t *source = (obs_source_t *)calldata_ptr(params, "source"); if (obs_scene_from_source(source) != NULL) - QMetaObject::invokeMethod(static_cast<OBSBasic*>(data), - "AddScene", WaitConnection(), - Q_ARG(OBSSource, OBSSource(source))); + QMetaObject::invokeMethod(static_cast<OBSBasic *>(data), + "AddScene", WaitConnection(), + Q_ARG(OBSSource, OBSSource(source))); } void OBSBasic::SourceRemoved(void *data, calldata_t *params) { - obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source"); + obs_source_t *source = (obs_source_t *)calldata_ptr(params, "source"); if (obs_scene_from_source(source) != NULL) - QMetaObject::invokeMethod(static_cast<OBSBasic*>(data), - "RemoveScene", - Q_ARG(OBSSource, OBSSource(source))); + QMetaObject::invokeMethod(static_cast<OBSBasic *>(data), + "RemoveScene", + Q_ARG(OBSSource, OBSSource(source))); } void OBSBasic::SourceActivated(void *data, calldata_t *params) { - obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source"); - uint32_t flags = obs_source_get_output_flags(source); + obs_source_t *source = (obs_source_t *)calldata_ptr(params, "source"); + uint32_t flags = obs_source_get_output_flags(source); if (flags & OBS_SOURCE_AUDIO) - QMetaObject::invokeMethod(static_cast<OBSBasic*>(data), - "ActivateAudioSource", - Q_ARG(OBSSource, OBSSource(source))); + QMetaObject::invokeMethod(static_cast<OBSBasic *>(data), + "ActivateAudioSource", + Q_ARG(OBSSource, OBSSource(source))); } void OBSBasic::SourceDeactivated(void *data, calldata_t *params) { - obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source"); - uint32_t flags = obs_source_get_output_flags(source); + obs_source_t *source = (obs_source_t *)calldata_ptr(params, "source"); + uint32_t flags = obs_source_get_output_flags(source); if (flags & OBS_SOURCE_AUDIO) - QMetaObject::invokeMethod(static_cast<OBSBasic*>(data), - "DeactivateAudioSource", - Q_ARG(OBSSource, OBSSource(source))); + QMetaObject::invokeMethod(static_cast<OBSBasic *>(data), + "DeactivateAudioSource", + Q_ARG(OBSSource, OBSSource(source))); } void OBSBasic::SourceRenamed(void *data, calldata_t *params) { - obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source"); - const char *newName = calldata_string(params, "new_name"); + obs_source_t *source = (obs_source_t *)calldata_ptr(params, "source"); + const char *newName = calldata_string(params, "new_name"); const char *prevName = calldata_string(params, "prev_name"); - QMetaObject::invokeMethod(static_cast<OBSBasic*>(data), - "RenameSources", - Q_ARG(OBSSource, source), - Q_ARG(QString, QT_UTF8(newName)), - Q_ARG(QString, QT_UTF8(prevName))); + QMetaObject::invokeMethod(static_cast<OBSBasic *>(data), + "RenameSources", Q_ARG(OBSSource, source), + Q_ARG(QString, QT_UTF8(newName)), + Q_ARG(QString, QT_UTF8(prevName))); blog(LOG_INFO, "Source '%s' renamed to '%s'", prevName, newName); } @@ -3313,9 +3303,9 @@ GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_DEFAULT, "DrawBackdrop"); - gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_SOLID); - gs_eparam_t *color = gs_effect_get_param_by_name(solid, "color"); - gs_technique_t *tech = gs_effect_get_technique(solid, "Solid"); + gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_SOLID); + gs_eparam_t *color = gs_effect_get_param_by_name(solid, "color"); + gs_technique_t *tech = gs_effect_get_technique(solid, "Solid"); vec4 colorVal; vec4_set(&colorVal, 0.0f, 0.0f, 0.0f, 1.0f); @@ -3343,7 +3333,7 @@ { GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_DEFAULT, "RenderMain"); - OBSBasic *window = static_cast<OBSBasic*>(data); + OBSBasic *window = static_cast<OBSBasic *>(data); obs_video_info ovi; obs_get_video_info(&ovi); @@ -3357,40 +3347,38 @@ obs_display_t *display = window->ui->preview->GetDisplay(); uint32_t width, height; obs_display_size(display, &width, &height); - float right = float(width) - window->previewX; + float right = float(width) - window->previewX; float bottom = float(height) - window->previewY; - gs_ortho(-window->previewX, right, - -window->previewY, bottom, - -100.0f, 100.0f); + gs_ortho(-window->previewX, right, -window->previewY, bottom, -100.0f, + 100.0f); window->ui->preview->DrawOverflow(); /* --------------------------------------- */ gs_ortho(0.0f, float(ovi.base_width), 0.0f, float(ovi.base_height), - -100.0f, 100.0f); - gs_set_viewport(window->previewX, window->previewY, - window->previewCX, window->previewCY); - - window->DrawBackdrop(float(ovi.base_width), float(ovi.base_height)); + -100.0f, 100.0f); + gs_set_viewport(window->previewX, window->previewY, window->previewCX, + window->previewCY); if (window->IsPreviewProgramMode()) { + window->DrawBackdrop(float(ovi.base_width), + float(ovi.base_height)); + OBSScene scene = window->GetCurrentScene(); obs_source_t *source = obs_scene_get_source(scene); if (source) obs_source_video_render(source); } else { - obs_render_main_texture(); + obs_render_main_texture_src_color_only(); } gs_load_vertexbuffer(nullptr); /* --------------------------------------- */ - - gs_ortho(-window->previewX, right, - -window->previewY, bottom, - -100.0f, 100.0f); + gs_ortho(-window->previewX, right, -window->previewY, bottom, -100.0f, + 100.0f); gs_reset_viewport(); window->ui->preview->DrawSceneEditing(); @@ -3411,8 +3399,8 @@ obs_service_t *OBSBasic::GetService() { if (!service) { - service = obs_service_create("rtmp_common", NULL, NULL, - nullptr); + service = + obs_service_create("rtmp_common", NULL, NULL, nullptr); obs_service_release(service); } return service; @@ -3456,13 +3444,15 @@ static inline enum obs_scale_type GetScaleType(ConfigFile &basicConfig) { - const char *scaleTypeStr = config_get_string(basicConfig, - "Video", "ScaleType"); + const char *scaleTypeStr = + config_get_string(basicConfig, "Video", "ScaleType"); if (astrcmpi(scaleTypeStr, "bilinear") == 0) return OBS_SCALE_BILINEAR; else if (astrcmpi(scaleTypeStr, "lanczos") == 0) return OBS_SCALE_LANCZOS; + else if (astrcmpi(scaleTypeStr, "area") == 0) + return OBS_SCALE_AREA; else return OBS_SCALE_BICUBIC; } @@ -3489,11 +3479,11 @@ void OBSBasic::ResetUI() { - bool studioPortraitLayout = config_get_bool(GetGlobalConfig(), - "BasicWindow", "StudioPortraitLayout"); + bool studioPortraitLayout = config_get_bool( + GetGlobalConfig(), "BasicWindow", "StudioPortraitLayout"); - bool labels = config_get_bool(GetGlobalConfig(), - "BasicWindow", "StudioModeLabels"); + bool labels = config_get_bool(GetGlobalConfig(), "BasicWindow", + "StudioModeLabels"); if (studioPortraitLayout) ui->previewLayout->setDirection(QBoxLayout::TopToBottom); @@ -3519,31 +3509,31 @@ GetConfigFPS(ovi.fps_num, ovi.fps_den); - const char *colorFormat = config_get_string(basicConfig, "Video", - "ColorFormat"); - const char *colorSpace = config_get_string(basicConfig, "Video", - "ColorSpace"); - const char *colorRange = config_get_string(basicConfig, "Video", - "ColorRange"); + const char *colorFormat = + config_get_string(basicConfig, "Video", "ColorFormat"); + const char *colorSpace = + config_get_string(basicConfig, "Video", "ColorSpace"); + const char *colorRange = + config_get_string(basicConfig, "Video", "ColorRange"); ovi.graphics_module = App()->GetRenderModule(); - ovi.base_width = (uint32_t)config_get_uint(basicConfig, - "Video", "BaseCX"); - ovi.base_height = (uint32_t)config_get_uint(basicConfig, - "Video", "BaseCY"); - ovi.output_width = (uint32_t)config_get_uint(basicConfig, - "Video", "OutputCX"); - ovi.output_height = (uint32_t)config_get_uint(basicConfig, - "Video", "OutputCY"); - ovi.output_format = GetVideoFormatFromName(colorFormat); - ovi.colorspace = astrcmpi(colorSpace, "601") == 0 ? - VIDEO_CS_601 : VIDEO_CS_709; - ovi.range = astrcmpi(colorRange, "Full") == 0 ? - VIDEO_RANGE_FULL : VIDEO_RANGE_PARTIAL; - ovi.adapter = config_get_uint(App()->GlobalConfig(), - "Video", "AdapterIdx"); + ovi.base_width = + (uint32_t)config_get_uint(basicConfig, "Video", "BaseCX"); + ovi.base_height = + (uint32_t)config_get_uint(basicConfig, "Video", "BaseCY"); + ovi.output_width = + (uint32_t)config_get_uint(basicConfig, "Video", "OutputCX"); + ovi.output_height = + (uint32_t)config_get_uint(basicConfig, "Video", "OutputCY"); + ovi.output_format = GetVideoFormatFromName(colorFormat); + ovi.colorspace = astrcmpi(colorSpace, "601") == 0 ? VIDEO_CS_601 + : VIDEO_CS_709; + ovi.range = astrcmpi(colorRange, "Full") == 0 ? VIDEO_RANGE_FULL + : VIDEO_RANGE_PARTIAL; + ovi.adapter = + config_get_uint(App()->GlobalConfig(), "Video", "AdapterIdx"); ovi.gpu_conversion = true; - ovi.scale_type = GetScaleType(basicConfig); + ovi.scale_type = GetScaleType(basicConfig); if (ovi.base_width == 0 || ovi.base_height == 0) { ovi.base_width = 1920; @@ -3565,17 +3555,17 @@ if (IS_WIN32 && ret != OBS_VIDEO_SUCCESS) { if (ret == OBS_VIDEO_CURRENTLY_ACTIVE) { blog(LOG_WARNING, "Tried to reset when " - "already active"); + "already active"); return ret; } /* Try OpenGL if DirectX fails on windows */ if (astrcmpi(ovi.graphics_module, DL_OPENGL) != 0) { - blog(LOG_WARNING, "Failed to initialize obs video (%d) " - "with graphics_module='%s', retrying " - "with graphics_module='%s'", - ret, ovi.graphics_module, - DL_OPENGL); + blog(LOG_WARNING, + "Failed to initialize obs video (%d) " + "with graphics_module='%s', retrying " + "with graphics_module='%s'", + ret, ovi.graphics_module, DL_OPENGL); ovi.graphics_module = DL_OPENGL; ret = AttemptToResetVideo(&ovi); } @@ -3598,11 +3588,11 @@ ProfileScope("OBSBasic::ResetAudio"); struct obs_audio_info ai; - ai.samples_per_sec = config_get_uint(basicConfig, "Audio", - "SampleRate"); + ai.samples_per_sec = + config_get_uint(basicConfig, "Audio", "SampleRate"); - const char *channelSetupStr = config_get_string(basicConfig, - "Audio", "ChannelSetup"); + const char *channelSetupStr = + config_get_string(basicConfig, "Audio", "ChannelSetup"); if (strcmp(channelSetupStr, "Mono") == 0) ai.speakers = SPEAKERS_MONO; @@ -3623,7 +3613,7 @@ } void OBSBasic::ResetAudioDevice(const char *sourceId, const char *deviceId, - const char *deviceDesc, int channel) + const char *deviceDesc, int channel) { bool disable = deviceId && strcmp(deviceId, "disabled") == 0; obs_source_t *source; @@ -3635,11 +3625,11 @@ obs_set_output_source(channel, nullptr); } else { settings = obs_source_get_settings(source); - const char *oldId = obs_data_get_string(settings, - "device_id"); + const char *oldId = + obs_data_get_string(settings, "device_id"); if (strcmp(oldId, deviceId) != 0) { obs_data_set_string(settings, "device_id", - deviceId); + deviceId); obs_source_update(source, settings); } obs_data_release(settings); @@ -3651,7 +3641,7 @@ settings = obs_data_create(); obs_data_set_string(settings, "device_id", deviceId); source = obs_source_create(sourceId, deviceDesc, settings, - nullptr); + nullptr); obs_data_release(settings); obs_set_output_source(channel, source); @@ -3661,7 +3651,7 @@ void OBSBasic::ResizePreview(uint32_t cx, uint32_t cy) { - QSize targetSize; + QSize targetSize; bool isFixedScaling; obs_video_info ovi; @@ -3673,18 +3663,20 @@ if (isFixedScaling) { previewScale = ui->preview->GetScalingAmount(); - GetCenterPosFromFixedScale(int(cx), int(cy), - targetSize.width() - PREVIEW_EDGE_SIZE * 2, - targetSize.height() - PREVIEW_EDGE_SIZE * 2, - previewX, previewY, previewScale); + GetCenterPosFromFixedScale( + int(cx), int(cy), + targetSize.width() - PREVIEW_EDGE_SIZE * 2, + targetSize.height() - PREVIEW_EDGE_SIZE * 2, previewX, + previewY, previewScale); previewX += ui->preview->GetScrollX(); previewY += ui->preview->GetScrollY(); } else { GetScaleAndCenterPos(int(cx), int(cy), - targetSize.width() - PREVIEW_EDGE_SIZE * 2, - targetSize.height() - PREVIEW_EDGE_SIZE * 2, - previewX, previewY, previewScale); + targetSize.width() - PREVIEW_EDGE_SIZE * 2, + targetSize.height() - + PREVIEW_EDGE_SIZE * 2, + previewX, previewY, previewScale); } previewX += float(PREVIEW_EDGE_SIZE); @@ -3693,7 +3685,7 @@ void OBSBasic::CloseDialogs() { - QList<QDialog*> childDialogs = this->findChildren<QDialog *>(); + QList<QDialog *> childDialogs = this->findChildren<QDialog *>(); if (!childDialogs.isEmpty()) { for (int i = 0; i < childDialogs.size(); ++i) { childDialogs.at(i)->close(); @@ -3709,8 +3701,10 @@ projector.clear(); } - if (!stats.isNull()) stats->close(); //call close to save Stats geometry - if (!remux.isNull()) remux->close(); + if (!stats.isNull()) + stats->close(); //call close to save Stats geometry + if (!remux.isNull()) + remux->close(); } void OBSBasic::EnumDialogs() @@ -3720,7 +3714,7 @@ visMsgBoxes.clear(); /* fill list of Visible dialogs and Modal dialogs */ - QList<QDialog*> dialogs = findChildren<QDialog*>(); + QList<QDialog *> dialogs = findChildren<QDialog *>(); for (QDialog *dialog : dialogs) { if (dialog->isVisible()) visDialogs.append(dialog); @@ -3729,7 +3723,7 @@ } /* fill list of Visible message boxes */ - QList<QMessageBox*> msgBoxes = findChildren<QMessageBox*>(); + QList<QMessageBox *> msgBoxes = findChildren<QMessageBox *>(); for (QMessageBox *msgbox : msgBoxes) { if (msgbox->isVisible()) visMsgBoxes.append(msgbox); @@ -3758,8 +3752,7 @@ swapScene = nullptr; programScene = nullptr; - auto cb = [](void *unused, obs_source_t *source) - { + auto cb = [](void *unused, obs_source_t *source) { obs_source_remove(source); UNUSED_PARAMETER(unused); return true; @@ -3788,16 +3781,16 @@ } if (isVisible()) - config_set_string(App()->GlobalConfig(), - "BasicWindow", "geometry", - saveGeometry().toBase64().constData()); + config_set_string(App()->GlobalConfig(), "BasicWindow", + "geometry", + saveGeometry().toBase64().constData()); if (outputHandler && outputHandler->Active()) { SetShowing(true); QMessageBox::StandardButton button = OBSMessageBox::question( - this, QTStr("ConfirmExit.Title"), - QTStr("ConfirmExit.Text")); + this, QTStr("ConfirmExit.Title"), + QTStr("ConfirmExit.Text")); if (button == QMessageBox::No) { event->ignore(); @@ -3824,9 +3817,15 @@ SaveProjectNow(); auth.reset(); - config_set_string(App()->GlobalConfig(), - "BasicWindow", "DockState", - saveState().toBase64().constData()); + delete extraBrowsers; + + config_set_string(App()->GlobalConfig(), "BasicWindow", "DockState", + saveState().toBase64().constData()); + +#ifdef BROWSER_AVAILABLE + SaveExtraBrowserDocks(); + ClearExtraBrowserDocks(); +#endif if (api) api->on_event(OBS_FRONTEND_EVENT_EXIT); @@ -3842,11 +3841,8 @@ void OBSBasic::changeEvent(QEvent *event) { - if (event->type() == QEvent::WindowStateChange && - isMinimized() && - trayIcon && - trayIcon->isVisible() && - sysTrayMinimizeToTray()) { + if (event->type() == QEvent::WindowStateChange && isMinimized() && + trayIcon && trayIcon->isVisible() && sysTrayMinimizeToTray()) { ToggleShowHide(); } @@ -3856,12 +3852,16 @@ { const char *mode = config_get_string(basicConfig, "Output", "Mode"); const char *type = config_get_string(basicConfig, "AdvOut", "RecType"); - const char *adv_path = strcmp(type, "Standard") ? - config_get_string(basicConfig, "AdvOut", "FFFilePath") : - config_get_string(basicConfig, "AdvOut", "RecFilePath"); - const char *path = strcmp(mode, "Advanced") ? - config_get_string(basicConfig, "SimpleOutput", "FilePath") : - adv_path; + const char *adv_path = + strcmp(type, "Standard") + ? config_get_string(basicConfig, "AdvOut", "FFFilePath") + : config_get_string(basicConfig, "AdvOut", + "RecFilePath"); + const char *path = strcmp(mode, "Advanced") + ? config_get_string(basicConfig, + "SimpleOutput", + "FilePath") + : adv_path; QDesktopServices::openUrl(QUrl::fromLocalFile(path)); } @@ -3874,9 +3874,12 @@ } const char *mode = config_get_string(basicConfig, "Output", "Mode"); - const char *path = strcmp(mode, "Advanced") ? - config_get_string(basicConfig, "SimpleOutput", "FilePath") : - config_get_string(basicConfig, "AdvOut", "RecFilePath"); + const char *path = strcmp(mode, "Advanced") + ? config_get_string(basicConfig, + "SimpleOutput", + "FilePath") + : config_get_string(basicConfig, "AdvOut", + "RecFilePath"); OBSRemux *remuxDlg; remuxDlg = new OBSRemux(path, this); @@ -3893,7 +3896,7 @@ * once per second until we've exit any known sub-loops. */ if (os_atomic_load_long(&insideEventLoop) != 0) { QTimer::singleShot(1000, this, - SLOT(on_action_Settings_triggered())); + SLOT(on_action_Settings_triggered())); return; } @@ -3921,8 +3924,8 @@ advAudioWindow->show(); advAudioWindow->setAttribute(Qt::WA_DeleteOnClose, true); - connect(advAudioWindow, SIGNAL(destroyed()), - this, SLOT(on_advAudioProps_destroyed())); + connect(advAudioWindow, SIGNAL(destroyed()), this, + SLOT(on_advAudioProps_destroyed())); } void OBSBasic::on_advAudioProps_clicked() @@ -3936,7 +3939,7 @@ } void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current, - QListWidgetItem *prev) + QListWidgetItem *prev) { obs_source_t *source = NULL; @@ -3961,7 +3964,7 @@ void OBSBasic::EditSceneName() { QListWidgetItem *item = ui->scenes->currentItem(); - Qt::ItemFlags flags = item->flags(); + Qt::ItemFlags flags = item->flags(); item->setFlags(flags | Qt::ItemIsEditable); ui->scenes->editItem(item); @@ -3969,19 +3972,19 @@ } static void AddProjectorMenuMonitors(QMenu *parent, QObject *target, - const char *slot) + const char *slot) { QAction *action; - QList<QScreen*> screens = QGuiApplication::screens(); + QList<QScreen *> screens = QGuiApplication::screens(); for (int i = 0; i < screens.size(); i++) { QRect screenGeometry = screens[i]->geometry(); - QString str = QString("%1 %2: %3x%4 @ %5,%6"). - arg(QTStr("Display"), - QString::number(i + 1), - QString::number(screenGeometry.width()), - QString::number(screenGeometry.height()), - QString::number(screenGeometry.x()), - QString::number(screenGeometry.y())); + QString str = + QString("%1 %2: %3x%4 @ %5,%6") + .arg(QTStr("Display"), QString::number(i + 1), + QString::number(screenGeometry.width()), + QString::number(screenGeometry.height()), + QString::number(screenGeometry.x()), + QString::number(screenGeometry.y())); action = parent->addAction(str, target, slot); action->setProperty("monitor", i); @@ -3994,31 +3997,30 @@ QMenu popup(this); QMenu order(QTStr("Basic.MainMenu.Edit.Order"), this); - popup.addAction(QTStr("Add"), - this, SLOT(on_actionAddScene_triggered())); + popup.addAction(QTStr("Add"), this, + SLOT(on_actionAddScene_triggered())); if (item) { - QAction *pasteFilters = new QAction( - QTStr("Paste.Filters"), this); + QAction *pasteFilters = + new QAction(QTStr("Paste.Filters"), this); pasteFilters->setEnabled(copyFiltersString); connect(pasteFilters, SIGNAL(triggered()), this, - SLOT(ScenePasteFilters())); + SLOT(ScenePasteFilters())); popup.addSeparator(); - popup.addAction(QTStr("Duplicate"), - this, SLOT(DuplicateSelectedScene())); - popup.addAction(QTStr("Copy.Filters"), - this, SLOT(SceneCopyFilters())); + popup.addAction(QTStr("Duplicate"), this, + SLOT(DuplicateSelectedScene())); + popup.addAction(QTStr("Copy.Filters"), this, + SLOT(SceneCopyFilters())); popup.addAction(pasteFilters); popup.addSeparator(); - popup.addAction(QTStr("Rename"), - this, SLOT(EditSceneName())); - popup.addAction(QTStr("Remove"), - this, SLOT(RemoveSelectedScene())); + popup.addAction(QTStr("Rename"), this, SLOT(EditSceneName())); + popup.addAction(QTStr("Remove"), this, + SLOT(RemoveSelectedScene())); popup.addSeparator(); - order.addAction(QTStr("Basic.MainMenu.Edit.Order.MoveUp"), - this, SLOT(on_actionSceneUp_triggered())); + order.addAction(QTStr("Basic.MainMenu.Edit.Order.MoveUp"), this, + SLOT(on_actionSceneUp_triggered())); order.addAction(QTStr("Basic.MainMenu.Edit.Order.MoveDown"), this, SLOT(on_actionSceneDown_triggered())); order.addSeparator(); @@ -4033,12 +4035,11 @@ delete sceneProjectorMenu; sceneProjectorMenu = new QMenu(QTStr("SceneProjector")); AddProjectorMenuMonitors(sceneProjectorMenu, this, - SLOT(OpenSceneProjector())); + SLOT(OpenSceneProjector())); popup.addMenu(sceneProjectorMenu); QAction *sceneWindow = popup.addAction( - QTStr("SceneWindow"), - this, SLOT(OpenSceneWindow())); + QTStr("SceneWindow"), this, SLOT(OpenSceneWindow())); popup.addAction(sceneWindow); popup.addSeparator(); @@ -4053,31 +4054,28 @@ /* ---------------------- */ - QAction *multiviewAction = popup.addAction( - QTStr("ShowInMultiview")); + QAction *multiviewAction = + popup.addAction(QTStr("ShowInMultiview")); OBSSource source = GetCurrentSceneSource(); OBSData data = obs_source_get_private_settings(source); obs_data_release(data); - obs_data_set_default_bool(data, "show_in_multiview", - true); + obs_data_set_default_bool(data, "show_in_multiview", true); bool show = obs_data_get_bool(data, "show_in_multiview"); multiviewAction->setCheckable(true); multiviewAction->setChecked(show); - auto showInMultiview = [] (OBSData data) - { - bool show = obs_data_get_bool(data, - "show_in_multiview"); - obs_data_set_bool(data, "show_in_multiview", - !show); + auto showInMultiview = [](OBSData data) { + bool show = + obs_data_get_bool(data, "show_in_multiview"); + obs_data_set_bool(data, "show_in_multiview", !show); OBSProjector::UpdateMultiviewProjectors(); }; connect(multiviewAction, &QAction::triggered, - std::bind(showInMultiview, data)); + std::bind(showInMultiview, data)); } popup.exec(QCursor::pos()); @@ -4096,26 +4094,23 @@ placeHolderText = format.arg(++i); } - bool accepted = NameDialog::AskForName(this, - QTStr("Basic.Main.AddSceneDlg.Title"), - QTStr("Basic.Main.AddSceneDlg.Text"), - name, - placeHolderText); + bool accepted = NameDialog::AskForName( + this, QTStr("Basic.Main.AddSceneDlg.Title"), + QTStr("Basic.Main.AddSceneDlg.Text"), name, placeHolderText); if (accepted) { if (name.empty()) { OBSMessageBox::warning(this, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); on_actionAddScene_triggered(); return; } obs_source_t *source = obs_get_source_by_name(name.c_str()); if (source) { - OBSMessageBox::warning(this, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + OBSMessageBox::warning(this, QTStr("NameExists.Title"), + QTStr("NameExists.Text")); obs_source_release(source); on_actionAddScene_triggered(); @@ -4131,7 +4126,7 @@ void OBSBasic::on_actionRemoveScene_triggered() { - OBSScene scene = GetCurrentScene(); + OBSScene scene = GetCurrentScene(); obs_source_t *source = obs_scene_get_source(scene); if (source && QueryRemoveSource(source)) @@ -4178,7 +4173,7 @@ void OBSBasic::MoveSceneToBottom() { ChangeSceneIndex(false, ui->scenes->count() - 1, - ui->scenes->count() - 1); + ui->scenes->count() - 1); } void OBSBasic::EditSceneItemName() @@ -4189,7 +4184,7 @@ void OBSBasic::SetDeinterlacingMode() { - QAction *action = reinterpret_cast<QAction*>(sender()); + QAction *action = reinterpret_cast<QAction *>(sender()); obs_deinterlace_mode mode = (obs_deinterlace_mode)action->property("mode").toInt(); OBSSceneItem sceneItem = GetCurrentSceneItem(); @@ -4200,7 +4195,7 @@ void OBSBasic::SetDeinterlacingOrder() { - QAction *action = reinterpret_cast<QAction*>(sender()); + QAction *action = reinterpret_cast<QAction *>(sender()); obs_deinterlace_field_order order = (obs_deinterlace_field_order)action->property("order").toInt(); OBSSceneItem sceneItem = GetCurrentSceneItem(); @@ -4217,34 +4212,34 @@ obs_source_get_deinterlace_field_order(source); QAction *action; -#define ADD_MODE(name, mode) \ - action = menu->addAction(QTStr("" name), this, \ - SLOT(SetDeinterlacingMode())); \ - action->setProperty("mode", (int)mode); \ - action->setCheckable(true); \ +#define ADD_MODE(name, mode) \ + action = menu->addAction(QTStr("" name), this, \ + SLOT(SetDeinterlacingMode())); \ + action->setProperty("mode", (int)mode); \ + action->setCheckable(true); \ action->setChecked(deinterlaceMode == mode); - ADD_MODE("Disable", OBS_DEINTERLACE_MODE_DISABLE); - ADD_MODE("Deinterlacing.Discard", OBS_DEINTERLACE_MODE_DISCARD); - ADD_MODE("Deinterlacing.Retro", OBS_DEINTERLACE_MODE_RETRO); - ADD_MODE("Deinterlacing.Blend", OBS_DEINTERLACE_MODE_BLEND); - ADD_MODE("Deinterlacing.Blend2x", OBS_DEINTERLACE_MODE_BLEND_2X); - ADD_MODE("Deinterlacing.Linear", OBS_DEINTERLACE_MODE_LINEAR); + ADD_MODE("Disable", OBS_DEINTERLACE_MODE_DISABLE); + ADD_MODE("Deinterlacing.Discard", OBS_DEINTERLACE_MODE_DISCARD); + ADD_MODE("Deinterlacing.Retro", OBS_DEINTERLACE_MODE_RETRO); + ADD_MODE("Deinterlacing.Blend", OBS_DEINTERLACE_MODE_BLEND); + ADD_MODE("Deinterlacing.Blend2x", OBS_DEINTERLACE_MODE_BLEND_2X); + ADD_MODE("Deinterlacing.Linear", OBS_DEINTERLACE_MODE_LINEAR); ADD_MODE("Deinterlacing.Linear2x", OBS_DEINTERLACE_MODE_LINEAR_2X); - ADD_MODE("Deinterlacing.Yadif", OBS_DEINTERLACE_MODE_YADIF); - ADD_MODE("Deinterlacing.Yadif2x", OBS_DEINTERLACE_MODE_YADIF_2X); + ADD_MODE("Deinterlacing.Yadif", OBS_DEINTERLACE_MODE_YADIF); + ADD_MODE("Deinterlacing.Yadif2x", OBS_DEINTERLACE_MODE_YADIF_2X); #undef ADD_MODE menu->addSeparator(); -#define ADD_ORDER(name, order) \ +#define ADD_ORDER(name, order) \ action = menu->addAction(QTStr("Deinterlacing." name), this, \ - SLOT(SetDeinterlacingOrder())); \ - action->setProperty("order", (int)order); \ - action->setCheckable(true); \ + SLOT(SetDeinterlacingOrder())); \ + action->setProperty("order", (int)order); \ + action->setCheckable(true); \ action->setChecked(deinterlaceOrder == order); - ADD_ORDER("TopFieldFirst", OBS_DEINTERLACE_FIELD_ORDER_TOP); + ADD_ORDER("TopFieldFirst", OBS_DEINTERLACE_FIELD_ORDER_TOP); ADD_ORDER("BottomFieldFirst", OBS_DEINTERLACE_FIELD_ORDER_BOTTOM); #undef ADD_ORDER @@ -4253,7 +4248,7 @@ void OBSBasic::SetScaleFilter() { - QAction *action = reinterpret_cast<QAction*>(sender()); + QAction *action = reinterpret_cast<QAction *>(sender()); obs_scale_type mode = (obs_scale_type)action->property("mode").toInt(); OBSSceneItem sceneItem = GetCurrentSceneItem(); @@ -4265,37 +4260,39 @@ obs_scale_type scaleFilter = obs_sceneitem_get_scale_filter(item); QAction *action; -#define ADD_MODE(name, mode) \ - action = menu->addAction(QTStr("" name), this, \ - SLOT(SetScaleFilter())); \ - action->setProperty("mode", (int)mode); \ - action->setCheckable(true); \ +#define ADD_MODE(name, mode) \ + action = \ + menu->addAction(QTStr("" name), this, SLOT(SetScaleFilter())); \ + action->setProperty("mode", (int)mode); \ + action->setCheckable(true); \ action->setChecked(scaleFilter == mode); - ADD_MODE("Disable", OBS_SCALE_DISABLE); - ADD_MODE("ScaleFiltering.Point", OBS_SCALE_POINT); + ADD_MODE("Disable", OBS_SCALE_DISABLE); + ADD_MODE("ScaleFiltering.Point", OBS_SCALE_POINT); ADD_MODE("ScaleFiltering.Bilinear", OBS_SCALE_BILINEAR); - ADD_MODE("ScaleFiltering.Bicubic", OBS_SCALE_BICUBIC); - ADD_MODE("ScaleFiltering.Lanczos", OBS_SCALE_LANCZOS); - ADD_MODE("ScaleFiltering.Area", OBS_SCALE_AREA); + ADD_MODE("ScaleFiltering.Bicubic", OBS_SCALE_BICUBIC); + ADD_MODE("ScaleFiltering.Lanczos", OBS_SCALE_LANCZOS); + ADD_MODE("ScaleFiltering.Area", OBS_SCALE_AREA); #undef ADD_MODE return menu; } -QMenu *OBSBasic::AddBackgroundColorMenu(QMenu *menu, QWidgetAction *widgetAction, - ColorSelect *select, obs_sceneitem_t *item) +QMenu *OBSBasic::AddBackgroundColorMenu(QMenu *menu, + QWidgetAction *widgetAction, + ColorSelect *select, + obs_sceneitem_t *item) { QAction *action; menu->setStyleSheet(QString( - "*[bgColor=\"1\"]{background-color:rgba(255,68,68,33%);}" \ - "*[bgColor=\"2\"]{background-color:rgba(255,255,68,33%);}" \ - "*[bgColor=\"3\"]{background-color:rgba(68,255,68,33%);}" \ - "*[bgColor=\"4\"]{background-color:rgba(68,255,255,33%);}" \ - "*[bgColor=\"5\"]{background-color:rgba(68,68,255,33%);}" \ - "*[bgColor=\"6\"]{background-color:rgba(255,68,255,33%);}" \ - "*[bgColor=\"7\"]{background-color:rgba(68,68,68,33%);}" \ + "*[bgColor=\"1\"]{background-color:rgba(255,68,68,33%);}" + "*[bgColor=\"2\"]{background-color:rgba(255,255,68,33%);}" + "*[bgColor=\"3\"]{background-color:rgba(68,255,68,33%);}" + "*[bgColor=\"4\"]{background-color:rgba(68,255,255,33%);}" + "*[bgColor=\"5\"]{background-color:rgba(68,68,255,33%);}" + "*[bgColor=\"6\"]{background-color:rgba(255,68,255,33%);}" + "*[bgColor=\"7\"]{background-color:rgba(68,68,68,33%);}" "*[bgColor=\"8\"]{background-color:rgba(255,255,255,33%);}")); obs_data_t *privData = obs_sceneitem_get_private_settings(item); @@ -4304,14 +4301,13 @@ obs_data_set_default_int(privData, "color-preset", 0); int preset = obs_data_get_int(privData, "color-preset"); - action = menu->addAction(QTStr("Clear"), this, - + SLOT(ColorChange())); + action = menu->addAction(QTStr("Clear"), this, +SLOT(ColorChange())); action->setCheckable(true); action->setProperty("bgColor", 0); action->setChecked(preset == 0); action = menu->addAction(QTStr("CustomColor"), this, - + SLOT(ColorChange())); + +SLOT(ColorChange())); action->setCheckable(true); action->setProperty("bgColor", 1); action->setChecked(preset == 1); @@ -4323,8 +4319,8 @@ for (int i = 1; i < 9; i++) { stringstream button; button << "preset" << i; - QPushButton *colorButton = select->findChild<QPushButton *>( - button.str().c_str()); + QPushButton *colorButton = + select->findChild<QPushButton *>(button.str().c_str()); if (preset == i + 1) colorButton->setStyleSheet("border: 2px solid black"); @@ -4339,8 +4335,7 @@ } ColorSelect::ColorSelect(QWidget *parent) - : QWidget(parent), - ui(new Ui::ColorSelect) + : QWidget(parent), ui(new Ui::ColorSelect) { ui->setupUi(this); } @@ -4358,11 +4353,11 @@ if (preview) { QAction *action = popup.addAction( - QTStr("Basic.Main.PreviewConextMenu.Enable"), - this, SLOT(TogglePreview())); + QTStr("Basic.Main.PreviewConextMenu.Enable"), this, + SLOT(TogglePreview())); action->setCheckable(true); action->setChecked( - obs_display_enabled(ui->preview->GetDisplay())); + obs_display_enabled(ui->preview->GetDisplay())); if (IsPreviewProgramMode()) action->setEnabled(false); @@ -4371,13 +4366,13 @@ previewProjectorSource = new QMenu(QTStr("PreviewProjector")); AddProjectorMenuMonitors(previewProjectorSource, this, - SLOT(OpenPreviewProjector())); + SLOT(OpenPreviewProjector())); popup.addMenu(previewProjectorSource); - QAction *previewWindow = popup.addAction( - QTStr("PreviewWindow"), - this, SLOT(OpenPreviewWindow())); + QAction *previewWindow = + popup.addAction(QTStr("PreviewWindow"), this, + SLOT(OpenPreviewWindow())); popup.addAction(previewWindow); @@ -4393,13 +4388,13 @@ if (ui->sources->MultipleBaseSelected()) { popup.addSeparator(); - popup.addAction(QTStr("Basic.Main.GroupItems"), - ui->sources, SLOT(GroupSelectedItems())); + popup.addAction(QTStr("Basic.Main.GroupItems"), ui->sources, + SLOT(GroupSelectedItems())); } else if (ui->sources->GroupsSelected()) { popup.addSeparator(); - popup.addAction(QTStr("Basic.Main.Ungroup"), - ui->sources, SLOT(UngroupSelectedGroups())); + popup.addAction(QTStr("Basic.Main.Ungroup"), ui->sources, + SLOT(UngroupSelectedGroups())); } popup.addSeparator(); @@ -4421,16 +4416,15 @@ obs_source_t *source = obs_sceneitem_get_source(sceneItem); uint32_t flags = obs_source_get_output_flags(source); bool isAsyncVideo = (flags & OBS_SOURCE_ASYNC_VIDEO) == - OBS_SOURCE_ASYNC_VIDEO; - bool hasAudio = (flags & OBS_SOURCE_AUDIO) == - OBS_SOURCE_AUDIO; + OBS_SOURCE_ASYNC_VIDEO; + bool hasAudio = (flags & OBS_SOURCE_AUDIO) == OBS_SOURCE_AUDIO; QAction *action; colorMenu = new QMenu(QTStr("ChangeBG")); colorWidgetAction = new QWidgetAction(colorMenu); colorSelect = new ColorSelect(colorMenu); - popup.addMenu(AddBackgroundColorMenu(colorMenu, - colorWidgetAction, colorSelect, sceneItem)); + popup.addMenu(AddBackgroundColorMenu( + colorMenu, colorWidgetAction, colorSelect, sceneItem)); popup.addAction(QTStr("Rename"), this, SLOT(EditSceneItemName())); popup.addAction(QTStr("Remove"), this, @@ -4441,33 +4435,33 @@ sourceProjector = new QMenu(QTStr("SourceProjector")); AddProjectorMenuMonitors(sourceProjector, this, - SLOT(OpenSourceProjector())); + SLOT(OpenSourceProjector())); QAction *sourceWindow = popup.addAction( - QTStr("SourceWindow"), - this, SLOT(OpenSourceWindow())); + QTStr("SourceWindow"), this, SLOT(OpenSourceWindow())); popup.addAction(sourceWindow); popup.addSeparator(); if (hasAudio) { - QAction *actionHideMixer = popup.addAction( - QTStr("HideMixer"), - this, SLOT(ToggleHideMixer())); + QAction *actionHideMixer = + popup.addAction(QTStr("HideMixer"), this, + SLOT(ToggleHideMixer())); actionHideMixer->setCheckable(true); actionHideMixer->setChecked(SourceMixerHidden(source)); } if (isAsyncVideo) { deinterlaceMenu = new QMenu(QTStr("Deinterlacing")); - popup.addMenu(AddDeinterlacingMenu(deinterlaceMenu, source)); + popup.addMenu( + AddDeinterlacingMenu(deinterlaceMenu, source)); popup.addSeparator(); } - QAction *resizeOutput = popup.addAction( - QTStr("ResizeOutputSizeOfSource"), this, - SLOT(ResizeOutputSizeOfSource())); + QAction *resizeOutput = + popup.addAction(QTStr("ResizeOutputSizeOfSource"), this, + SLOT(ResizeOutputSizeOfSource())); int width = obs_source_get_width(source); int height = obs_source_get_height(source); @@ -4478,7 +4472,8 @@ resizeOutput->setEnabled(false); scaleFilteringMenu = new QMenu(QTStr("ScaleFiltering")); - popup.addMenu(AddScaleFilteringMenu(scaleFilteringMenu, sceneItem)); + popup.addMenu( + AddScaleFilteringMenu(scaleFilteringMenu, sceneItem)); popup.addSeparator(); popup.addMenu(sourceProjector); @@ -4486,13 +4481,12 @@ popup.addSeparator(); action = popup.addAction(QTStr("Interact"), this, - SLOT(on_actionInteract_triggered())); + SLOT(on_actionInteract_triggered())); action->setEnabled(obs_source_get_output_flags(source) & - OBS_SOURCE_INTERACTION); + OBS_SOURCE_INTERACTION); - popup.addAction(QTStr("Filters"), this, - SLOT(OpenFilters())); + popup.addAction(QTStr("Filters"), this, SLOT(OpenFilters())); popup.addAction(QTStr("Properties"), this, SLOT(on_actionSourceProperties_triggered())); @@ -4519,8 +4513,9 @@ return; if (IsPreviewProgramMode()) { - bool doubleClickSwitch = config_get_bool(App()->GlobalConfig(), - "BasicWindow", "TransitionOnDoubleClick"); + bool doubleClickSwitch = + config_get_bool(App()->GlobalConfig(), "BasicWindow", + "TransitionOnDoubleClick"); if (doubleClickSwitch) { OBSScene scene = GetCurrentScene(); @@ -4551,26 +4546,24 @@ QMenu *popup = new QMenu(QTStr("Add"), this); QMenu *deprecated = new QMenu(QTStr("Deprecated"), popup); - auto getActionAfter = [] (QMenu *menu, const QString &name) - { - QList<QAction*> actions = menu->actions(); + auto getActionAfter = [](QMenu *menu, const QString &name) { + QList<QAction *> actions = menu->actions(); for (QAction *menuAction : actions) { if (menuAction->text().compare(name) >= 0) return menuAction; } - return (QAction*)nullptr; + return (QAction *)nullptr; }; - auto addSource = [this, getActionAfter] (QMenu *popup, - const char *type, const char *name) - { + auto addSource = [this, getActionAfter](QMenu *popup, const char *type, + const char *name) { QString qname = QT_UTF8(name); QAction *popupItem = new QAction(qname, this); popupItem->setData(QT_UTF8(type)); - connect(popupItem, SIGNAL(triggered(bool)), - this, SLOT(AddSourceFromAction())); + connect(popupItem, SIGNAL(triggered(bool)), this, + SLOT(AddSourceFromAction())); QAction *after = getActionAfter(popup, qname); popup->insertAction(after, popupItem); @@ -4597,8 +4590,8 @@ popup->addSeparator(); QAction *addGroup = new QAction(QTStr("Group"), this); addGroup->setData(QT_UTF8("group")); - connect(addGroup, SIGNAL(triggered(bool)), - this, SLOT(AddSourceFromAction())); + connect(addGroup, SIGNAL(triggered(bool)), this, + SLOT(AddSourceFromAction())); popup->addAction(addGroup); if (!foundDeprecated) { @@ -4620,7 +4613,7 @@ void OBSBasic::AddSourceFromAction() { - QAction *action = qobject_cast<QAction*>(sender()); + QAction *action = qobject_cast<QAction *>(sender()); if (!action) return; @@ -4631,9 +4624,9 @@ { if (!GetCurrentScene()) { // Tell the user he needs a scene first (help beginners). - OBSMessageBox::information(this, - QTStr("Basic.Main.AddSourceHelp.Title"), - QTStr("Basic.Main.AddSourceHelp.Text")); + OBSMessageBox::information( + this, QTStr("Basic.Main.AddSourceHelp.Title"), + QTStr("Basic.Main.AddSourceHelp.Text")); return; } @@ -4650,7 +4643,7 @@ static bool remove_items(obs_scene_t *, obs_sceneitem_t *item, void *param) { vector<OBSSceneItem> &items = - *reinterpret_cast<vector<OBSSceneItem>*>(param); + *reinterpret_cast<vector<OBSSceneItem> *>(param); if (obs_sceneitem_selected(item)) { items.emplace_back(item); @@ -4669,15 +4662,14 @@ if (!items.size()) return; - auto removeMultiple = [this] (size_t count) - { + auto removeMultiple = [this](size_t count) { QString text = QTStr("ConfirmRemove.TextMultiple") - .arg(QString::number(count)); + .arg(QString::number(count)); QMessageBox remove_items(this); remove_items.setText(text); - QAbstractButton *Yes = remove_items.addButton(QTStr("Yes"), - QMessageBox::YesRole); + QAbstractButton *Yes = remove_items.addButton( + QTStr("Yes"), QMessageBox::YesRole); remove_items.addButton(QTStr("No"), QMessageBox::NoRole); remove_items.setIcon(QMessageBox::Question); remove_items.setWindowTitle(QTStr("ConfirmRemove.Title")); @@ -4760,7 +4752,7 @@ if (GetConfigPath(logDir, sizeof(logDir), subdir) <= 0) return nullptr; - string path = (char*)logDir; + string path = logDir; path += "/"; path += log; @@ -4784,22 +4776,21 @@ ui->menuLogFiles->setEnabled(false); stringstream ss; - ss << "OBS " << App()->GetVersionString() - << " log file uploaded at " << CurrentDateTimeString() - << "\n\n" << fileString; - + ss << "OBS " << App()->GetVersionString() << " log file uploaded at " + << CurrentDateTimeString() << "\n\n" + << fileString; if (logUploadThread) { logUploadThread->wait(); } - RemoteTextThread *thread = new RemoteTextThread( - "https://obsproject.com/logs/upload", - "text/plain", ss.str().c_str()); + RemoteTextThread *thread = + new RemoteTextThread("https://obsproject.com/logs/upload", + "text/plain", ss.str().c_str()); logUploadThread.reset(thread); - connect(thread, &RemoteTextThread::Result, - this, &OBSBasic::logUploadFinished); + connect(thread, &RemoteTextThread::Result, this, + &OBSBasic::logUploadFinished); logUploadThread->start(); } @@ -4829,9 +4820,9 @@ if (GetConfigPath(logDir, sizeof(logDir), "obs-studio/logs") <= 0) return; - const char* log = App()->GetCurrentLog(); + const char *log = App()->GetCurrentLog(); - string path = (char*)logDir; + string path = logDir; path += "/"; path += log; @@ -4864,9 +4855,9 @@ ui->menuLogFiles->setEnabled(true); if (text.isEmpty()) { - OBSMessageBox::critical(this, - QTStr("LogReturnDialog.ErrorUploadingLog"), - error); + OBSMessageBox::critical( + this, QTStr("LogReturnDialog.ErrorUploadingLog"), + error); return; } @@ -4880,26 +4871,26 @@ } static void RenameListItem(OBSBasic *parent, QListWidget *listWidget, - obs_source_t *source, const string &name) + obs_source_t *source, const string &name) { const char *prevName = obs_source_get_name(source); if (name == prevName) return; - obs_source_t *foundSource = obs_get_source_by_name(name.c_str()); - QListWidgetItem *listItem = listWidget->currentItem(); + obs_source_t *foundSource = obs_get_source_by_name(name.c_str()); + QListWidgetItem *listItem = listWidget->currentItem(); if (foundSource || name.empty()) { listItem->setText(QT_UTF8(prevName)); if (foundSource) { OBSMessageBox::warning(parent, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + QTStr("NameExists.Title"), + QTStr("NameExists.Text")); } else if (name.empty()) { OBSMessageBox::warning(parent, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); } obs_source_release(foundSource); @@ -4910,11 +4901,11 @@ } void OBSBasic::SceneNameEdited(QWidget *editor, - QAbstractItemDelegate::EndEditHint endHint) + QAbstractItemDelegate::EndEditHint endHint) { - OBSScene scene = GetCurrentScene(); - QLineEdit *edit = qobject_cast<QLineEdit*>(editor); - string text = QT_TO_UTF8(edit->text().trimmed()); + OBSScene scene = GetCurrentScene(); + QLineEdit *edit = qobject_cast<QLineEdit *>(editor); + string text = QT_TO_UTF8(edit->text().trimmed()); if (!scene) return; @@ -4978,9 +4969,10 @@ } if (!outputHandler->StartStreaming(service)) { - QString message = !outputHandler->lastError.empty() - ? QTStr(outputHandler->lastError.c_str()) - : QTStr("Output.StartFailedGeneric"); + QString message = + !outputHandler->lastError.empty() + ? QTStr(outputHandler->lastError.c_str()) + : QTStr("Output.StartFailedGeneric"); ui->streamButton->setText(QTStr("Basic.Main.StartStreaming")); ui->streamButton->setEnabled(true); ui->streamButton->setChecked(false); @@ -4991,17 +4983,17 @@ } QMessageBox::critical(this, QTStr("Output.StartStreamFailed"), - message); + message); return; } - bool recordWhenStreaming = config_get_bool(GetGlobalConfig(), - "BasicWindow", "RecordWhenStreaming"); + bool recordWhenStreaming = config_get_bool( + GetGlobalConfig(), "BasicWindow", "RecordWhenStreaming"); if (recordWhenStreaming) StartRecording(); - bool replayBufferWhileStreaming = config_get_bool(GetGlobalConfig(), - "BasicWindow", "ReplayBufferWhileStreaming"); + bool replayBufferWhileStreaming = config_get_bool( + GetGlobalConfig(), "BasicWindow", "ReplayBufferWhileStreaming"); if (replayBufferWhileStreaming) StartReplayBuffer(); } @@ -5010,7 +5002,7 @@ static inline void UpdateProcessPriority() { const char *priority = config_get_string(App()->GlobalConfig(), - "General", "ProcessPriority"); + "General", "ProcessPriority"); if (priority && strcmp(priority, "Normal") != 0) SetProcessPriority(priority); } @@ -5018,13 +5010,17 @@ static inline void ClearProcessPriority() { const char *priority = config_get_string(App()->GlobalConfig(), - "General", "ProcessPriority"); + "General", "ProcessPriority"); if (priority && strcmp(priority, "Normal") != 0) SetProcessPriority("Normal"); } #else -#define UpdateProcessPriority() do {} while(false) -#define ClearProcessPriority() do {} while(false) +#define UpdateProcessPriority() \ + do { \ + } while (false) +#define ClearProcessPriority() \ + do { \ + } while (false) #endif inline void OBSBasic::OnActivate() @@ -5036,8 +5032,9 @@ UpdateProcessPriority(); if (trayIcon) - trayIcon->setIcon(QIcon::fromTheme("obs-tray-active", - QIcon(":/res/images/tray_active.png"))); + trayIcon->setIcon(QIcon::fromTheme( + "obs-tray-active", + QIcon(":/res/images/tray_active.png"))); } } @@ -5050,8 +5047,8 @@ ClearProcessPriority(); if (trayIcon) - trayIcon->setIcon(QIcon::fromTheme("obs-tray", - QIcon(":/res/images/obs.png"))); + trayIcon->setIcon(QIcon::fromTheme( + "obs-tray", QIcon(":/res/images/obs.png"))); } } @@ -5064,17 +5061,19 @@ OnDeactivate(); - bool recordWhenStreaming = config_get_bool(GetGlobalConfig(), - "BasicWindow", "RecordWhenStreaming"); - bool keepRecordingWhenStreamStops = config_get_bool(GetGlobalConfig(), - "BasicWindow", "KeepRecordingWhenStreamStops"); + bool recordWhenStreaming = config_get_bool( + GetGlobalConfig(), "BasicWindow", "RecordWhenStreaming"); + bool keepRecordingWhenStreamStops = + config_get_bool(GetGlobalConfig(), "BasicWindow", + "KeepRecordingWhenStreamStops"); if (recordWhenStreaming && !keepRecordingWhenStreamStops) StopRecording(); - bool replayBufferWhileStreaming = config_get_bool(GetGlobalConfig(), - "BasicWindow", "ReplayBufferWhileStreaming"); - bool keepReplayBufferStreamStops = config_get_bool(GetGlobalConfig(), - "BasicWindow", "KeepReplayBufferStreamStops"); + bool replayBufferWhileStreaming = config_get_bool( + GetGlobalConfig(), "BasicWindow", "ReplayBufferWhileStreaming"); + bool keepReplayBufferStreamStops = + config_get_bool(GetGlobalConfig(), "BasicWindow", + "KeepReplayBufferStreamStops"); if (replayBufferWhileStreaming && !keepReplayBufferStreamStops) StopReplayBuffer(); } @@ -5088,17 +5087,19 @@ OnDeactivate(); - bool recordWhenStreaming = config_get_bool(GetGlobalConfig(), - "BasicWindow", "RecordWhenStreaming"); - bool keepRecordingWhenStreamStops = config_get_bool(GetGlobalConfig(), - "BasicWindow", "KeepRecordingWhenStreamStops"); + bool recordWhenStreaming = config_get_bool( + GetGlobalConfig(), "BasicWindow", "RecordWhenStreaming"); + bool keepRecordingWhenStreamStops = + config_get_bool(GetGlobalConfig(), "BasicWindow", + "KeepRecordingWhenStreamStops"); if (recordWhenStreaming && !keepRecordingWhenStreamStops) StopRecording(); - bool replayBufferWhileStreaming = config_get_bool(GetGlobalConfig(), - "BasicWindow", "ReplayBufferWhileStreaming"); - bool keepReplayBufferStreamStops = config_get_bool(GetGlobalConfig(), - "BasicWindow", "KeepReplayBufferStreamStops"); + bool replayBufferWhileStreaming = config_get_bool( + GetGlobalConfig(), "BasicWindow", "ReplayBufferWhileStreaming"); + bool keepReplayBufferStreamStops = + config_get_bool(GetGlobalConfig(), "BasicWindow", + "KeepReplayBufferStreamStops"); if (replayBufferWhileStreaming && !keepReplayBufferStreamStops) StopReplayBuffer(); } @@ -5118,10 +5119,10 @@ startStreamMenu->deleteLater(); startStreamMenu = new QMenu(); - startStreamMenu->addAction(QTStr("Basic.Main.StopStreaming"), - this, SLOT(StopStreaming())); - startStreamMenu->addAction(QTStr("Basic.Main.ForceStopStreaming"), - this, SLOT(ForceStopStreaming())); + startStreamMenu->addAction(QTStr("Basic.Main.StopStreaming"), this, + SLOT(StopStreaming())); + startStreamMenu->addAction(QTStr("Basic.Main.ForceStopStreaming"), this, + SLOT(ForceStopStreaming())); ui->streamButton->setMenu(startStreamMenu); ui->statusbar->StreamDelayStarting(sec); @@ -5144,10 +5145,10 @@ startStreamMenu->deleteLater(); startStreamMenu = new QMenu(); - startStreamMenu->addAction(QTStr("Basic.Main.StartStreaming"), - this, SLOT(StartStreaming())); - startStreamMenu->addAction(QTStr("Basic.Main.ForceStopStreaming"), - this, SLOT(ForceStopStreaming())); + startStreamMenu->addAction(QTStr("Basic.Main.StartStreaming"), this, + SLOT(StartStreaming())); + startStreamMenu->addAction(QTStr("Basic.Main.ForceStopStreaming"), this, + SLOT(ForceStopStreaming())); ui->streamButton->setMenu(startStreamMenu); ui->statusbar->StreamDelayStopping(sec); @@ -5228,7 +5229,7 @@ if (use_last_error && !last_error.isEmpty()) dstr_printf(errorMessage, "%s\n\n%s", errorDescription, - QT_TO_UTF8(last_error)); + QT_TO_UTF8(last_error)); else dstr_copy(errorMessage, errorDescription); @@ -5252,17 +5253,18 @@ blog(LOG_INFO, STREAMING_STOP); if (encode_error) { - OBSMessageBox::information(this, - QTStr("Output.StreamEncodeError.Title"), - QTStr("Output.StreamEncodeError.Msg")); + OBSMessageBox::information( + this, QTStr("Output.StreamEncodeError.Title"), + QTStr("Output.StreamEncodeError.Msg")); } else if (code != OBS_OUTPUT_SUCCESS && isVisible()) { OBSMessageBox::information(this, - QTStr("Output.ConnectFail.Title"), - QT_UTF8(errorMessage)); + QTStr("Output.ConnectFail.Title"), + QT_UTF8(errorMessage)); } else if (code != OBS_OUTPUT_SUCCESS && !isVisible()) { - SysTrayNotify(QT_UTF8(errorDescription), QSystemTrayIcon::Warning); + SysTrayNotify(QT_UTF8(errorDescription), + QSystemTrayIcon::Warning); } if (!startStreamMenu.isNull()) { @@ -5277,14 +5279,16 @@ const char *mode = config_get_string(basicConfig, "Output", "Mode"); bool advanced = astrcmpi(mode, "Advanced") == 0; - const char *path = !advanced - ? config_get_string(basicConfig, "SimpleOutput", "FilePath") - : config_get_string(basicConfig, "AdvOut", "RecFilePath"); + const char *path = !advanced ? config_get_string(basicConfig, + "SimpleOutput", + "FilePath") + : config_get_string(basicConfig, "AdvOut", + "RecFilePath"); /* do not save if using FFmpeg output in advanced output mode */ if (advanced) { - const char *type = config_get_string(basicConfig, "AdvOut", - "RecType"); + const char *type = + config_get_string(basicConfig, "AdvOut", "RecType"); if (astrcmpi(type, "FFmpeg") == 0) { return; } @@ -5320,6 +5324,12 @@ if (disableOutputsRef) return; + if (LowDiskSpace()) { + DiskSpaceMessage(); + ui->recordButton->setChecked(false); + return; + } + if (api) api->on_event(OBS_FRONTEND_EVENT_RECORDING_STARTING); @@ -5364,7 +5374,11 @@ if (api) api->on_event(OBS_FRONTEND_EVENT_RECORDING_STARTED); + if (!diskFullTimer->isActive()) + diskFullTimer->start(1000); + OnActivate(); + UpdatePause(); blog(LOG_INFO, RECORDING_START); } @@ -5381,19 +5395,18 @@ blog(LOG_INFO, RECORDING_STOP); if (code == OBS_OUTPUT_UNSUPPORTED && isVisible()) { - OBSMessageBox::critical(this, - QTStr("Output.RecordFail.Title"), - QTStr("Output.RecordFail.Unsupported")); + OBSMessageBox::critical(this, QTStr("Output.RecordFail.Title"), + QTStr("Output.RecordFail.Unsupported")); } else if (code == OBS_OUTPUT_ENCODE_ERROR && isVisible()) { - OBSMessageBox::warning(this, - QTStr("Output.RecordError.Title"), - QTStr("Output.RecordError.EncodeErrorMsg")); + OBSMessageBox::warning( + this, QTStr("Output.RecordError.Title"), + QTStr("Output.RecordError.EncodeErrorMsg")); } else if (code == OBS_OUTPUT_NO_SPACE && isVisible()) { OBSMessageBox::warning(this, - QTStr("Output.RecordNoSpace.Title"), - QTStr("Output.RecordNoSpace.Msg")); + QTStr("Output.RecordNoSpace.Title"), + QTStr("Output.RecordNoSpace.Msg")); } else if (code != OBS_OUTPUT_SUCCESS && isVisible()) { @@ -5405,38 +5418,75 @@ if (use_last_error && !last_error.isEmpty()) dstr_printf(errorMessage, "%s\n\n%s", errorDescription, - QT_TO_UTF8(last_error)); + QT_TO_UTF8(last_error)); else dstr_copy(errorMessage, errorDescription); - OBSMessageBox::critical(this, - QTStr("Output.RecordError.Title"), - QT_UTF8(errorMessage)); + OBSMessageBox::critical(this, QTStr("Output.RecordError.Title"), + QT_UTF8(errorMessage)); } else if (code == OBS_OUTPUT_UNSUPPORTED && !isVisible()) { SysTrayNotify(QTStr("Output.RecordFail.Unsupported"), - QSystemTrayIcon::Warning); + QSystemTrayIcon::Warning); } else if (code == OBS_OUTPUT_NO_SPACE && !isVisible()) { SysTrayNotify(QTStr("Output.RecordNoSpace.Msg"), - QSystemTrayIcon::Warning); + QSystemTrayIcon::Warning); } else if (code != OBS_OUTPUT_SUCCESS && !isVisible()) { SysTrayNotify(QTStr("Output.RecordError.Msg"), - QSystemTrayIcon::Warning); + QSystemTrayIcon::Warning); } if (api) api->on_event(OBS_FRONTEND_EVENT_RECORDING_STOPPED); + if (diskFullTimer->isActive()) + diskFullTimer->stop(); + if (remuxAfterRecord) AutoRemux(); OnDeactivate(); + UpdatePause(false); } #define RP_NO_HOTKEY_TITLE QTStr("Output.ReplayBuffer.NoHotkey.Title") -#define RP_NO_HOTKEY_TEXT QTStr("Output.ReplayBuffer.NoHotkey.Msg") +#define RP_NO_HOTKEY_TEXT QTStr("Output.ReplayBuffer.NoHotkey.Msg") + +extern volatile bool recording_paused; +extern volatile bool replaybuf_active; + +void OBSBasic::ShowReplayBufferPauseWarning() +{ + auto msgBox = []() { + QMessageBox msgbox(App()->GetMainWindow()); + msgbox.setWindowTitle(QTStr("Output.ReplayBuffer." + "PauseWarning.Title")); + msgbox.setText(QTStr("Output.ReplayBuffer." + "PauseWarning.Text")); + msgbox.setIcon(QMessageBox::Icon::Information); + msgbox.addButton(QMessageBox::Ok); + + QCheckBox *cb = new QCheckBox(QTStr("DoNotShowAgain")); + msgbox.setCheckBox(cb); + + msgbox.exec(); + + if (cb->isChecked()) { + config_set_bool(App()->GlobalConfig(), "General", + "WarnedAboutReplayBufferPausing", true); + config_save_safe(App()->GlobalConfig(), "tmp", nullptr); + } + }; + + bool warned = config_get_bool(App()->GlobalConfig(), "General", + "WarnedAboutReplayBufferPausing"); + if (!warned) { + QMetaObject::invokeMethod(App(), "Exec", Qt::QueuedConnection, + Q_ARG(VoidFunc, msgBox)); + } +} void OBSBasic::StartReplayBuffer() { @@ -5452,18 +5502,23 @@ return; } + if (LowDiskSpace()) { + DiskSpaceMessage(); + replayBufferButton->setChecked(false); + return; + } + obs_output_t *output = outputHandler->replayBuffer; obs_data_t *hotkeys = obs_hotkeys_save_output(output); - obs_data_array_t *bindings = obs_data_get_array(hotkeys, - "ReplayBuffer.Save"); + obs_data_array_t *bindings = + obs_data_get_array(hotkeys, "ReplayBuffer.Save"); size_t count = obs_data_array_count(bindings); obs_data_array_release(bindings); obs_data_release(hotkeys); if (!count) { - OBSMessageBox::information(this, - RP_NO_HOTKEY_TITLE, - RP_NO_HOTKEY_TEXT); + OBSMessageBox::information(this, RP_NO_HOTKEY_TITLE, + RP_NO_HOTKEY_TEXT); replayBufferButton->setChecked(false); return; } @@ -5472,8 +5527,12 @@ api->on_event(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTING); SaveProject(); - if (!outputHandler->StartReplayBuffer()) + + if (!outputHandler->StartReplayBuffer()) { replayBufferButton->setChecked(false); + } else if (os_atomic_load_bool(&recording_paused)) { + ShowReplayBufferPauseWarning(); + } } void OBSBasic::ReplayBufferStopping() @@ -5532,8 +5591,8 @@ return; calldata_t cd = {0}; - proc_handler_t *ph = obs_output_get_proc_handler( - outputHandler->replayBuffer); + proc_handler_t *ph = + obs_output_get_proc_handler(outputHandler->replayBuffer); proc_handler_call(ph, "save", &cd); calldata_free(&cd); } @@ -5552,31 +5611,29 @@ blog(LOG_INFO, REPLAY_BUFFER_STOP); if (code == OBS_OUTPUT_UNSUPPORTED && isVisible()) { - OBSMessageBox::critical(this, - QTStr("Output.RecordFail.Title"), - QTStr("Output.RecordFail.Unsupported")); + OBSMessageBox::critical(this, QTStr("Output.RecordFail.Title"), + QTStr("Output.RecordFail.Unsupported")); } else if (code == OBS_OUTPUT_NO_SPACE && isVisible()) { OBSMessageBox::warning(this, - QTStr("Output.RecordNoSpace.Title"), - QTStr("Output.RecordNoSpace.Msg")); + QTStr("Output.RecordNoSpace.Title"), + QTStr("Output.RecordNoSpace.Msg")); } else if (code != OBS_OUTPUT_SUCCESS && isVisible()) { - OBSMessageBox::critical(this, - QTStr("Output.RecordError.Title"), - QTStr("Output.RecordError.Msg")); + OBSMessageBox::critical(this, QTStr("Output.RecordError.Title"), + QTStr("Output.RecordError.Msg")); } else if (code == OBS_OUTPUT_UNSUPPORTED && !isVisible()) { SysTrayNotify(QTStr("Output.RecordFail.Unsupported"), - QSystemTrayIcon::Warning); + QSystemTrayIcon::Warning); } else if (code == OBS_OUTPUT_NO_SPACE && !isVisible()) { SysTrayNotify(QTStr("Output.RecordNoSpace.Msg"), - QSystemTrayIcon::Warning); + QSystemTrayIcon::Warning); } else if (code != OBS_OUTPUT_SUCCESS && !isVisible()) { SysTrayNotify(QTStr("Output.RecordError.Msg"), - QSystemTrayIcon::Warning); + QSystemTrayIcon::Warning); } if (api) @@ -5596,8 +5653,8 @@ QMessageBox messageBox(this); messageBox.setWindowTitle(QTStr("NoSources.Title")); messageBox.setText(msg); - QAbstractButton *Yes = messageBox.addButton(QTStr("Yes"), - QMessageBox::YesRole); + QAbstractButton *Yes = messageBox.addButton( + QTStr("Yes"), QMessageBox::YesRole); messageBox.addButton(QTStr("No"), QMessageBox::NoRole); messageBox.setIcon(QMessageBox::Question); messageBox.exec(); @@ -5613,13 +5670,13 @@ { if (outputHandler->StreamingActive()) { bool confirm = config_get_bool(GetGlobalConfig(), "BasicWindow", - "WarnBeforeStoppingStream"); + "WarnBeforeStoppingStream"); if (confirm && isVisible()) { QMessageBox::StandardButton button = - OBSMessageBox::question(this, - QTStr("ConfirmStop.Title"), - QTStr("ConfirmStop.Text")); + OBSMessageBox::question( + this, QTStr("ConfirmStop.Title"), + QTStr("ConfirmStop.Text")); if (button == QMessageBox::No) { ui->streamButton->setChecked(true); @@ -5635,7 +5692,7 @@ } bool confirm = config_get_bool(GetGlobalConfig(), "BasicWindow", - "WarnBeforeStartingStream"); + "WarnBeforeStartingStream"); obs_data_t *settings = obs_service_get_settings(service); bool bwtest = obs_data_get_bool(settings, "bwtest"); @@ -5643,9 +5700,9 @@ if (bwtest && isVisible()) { QMessageBox::StandardButton button = - OBSMessageBox::question(this, - QTStr("ConfirmBWTest.Title"), - QTStr("ConfirmBWTest.Text")); + OBSMessageBox::question( + this, QTStr("ConfirmBWTest.Title"), + QTStr("ConfirmBWTest.Text")); if (button == QMessageBox::No) { ui->streamButton->setChecked(false); @@ -5653,9 +5710,9 @@ } } else if (confirm && isVisible()) { QMessageBox::StandardButton button = - OBSMessageBox::question(this, - QTStr("ConfirmStart.Title"), - QTStr("ConfirmStart.Text")); + OBSMessageBox::question( + this, QTStr("ConfirmStart.Title"), + QTStr("ConfirmStart.Text")); if (button == QMessageBox::No) { ui->streamButton->setChecked(false); @@ -5670,6 +5727,20 @@ void OBSBasic::on_recordButton_clicked() { if (outputHandler->RecordingActive()) { + bool confirm = config_get_bool(GetGlobalConfig(), "BasicWindow", + "WarnBeforeStoppingRecord"); + + if (confirm && isVisible()) { + QMessageBox::StandardButton button = + OBSMessageBox::question( + this, QTStr("ConfirmStopRecord.Title"), + QTStr("ConfirmStopRecord.Text")); + + if (button == QMessageBox::No) { + ui->recordButton->setChecked(true); + return; + } + } StopRecording(); } else { if (!NoSourcesConfirmation()) { @@ -5738,46 +5809,43 @@ UNUSED_PARAMETER(pos); } -void OBSBasic::on_program_customContextMenuRequested(const QPoint&) +void OBSBasic::on_program_customContextMenuRequested(const QPoint &) { QMenu popup(this); QPointer<QMenu> studioProgramProjector; - studioProgramProjector = new QMenu( - QTStr("StudioProgramProjector")); + studioProgramProjector = new QMenu(QTStr("StudioProgramProjector")); AddProjectorMenuMonitors(studioProgramProjector, this, - SLOT(OpenStudioProgramProjector())); + SLOT(OpenStudioProgramProjector())); popup.addMenu(studioProgramProjector); - QAction *studioProgramWindow = popup.addAction( - QTStr("StudioProgramWindow"), - this, SLOT(OpenStudioProgramWindow())); + QAction *studioProgramWindow = + popup.addAction(QTStr("StudioProgramWindow"), this, + SLOT(OpenStudioProgramWindow())); popup.addAction(studioProgramWindow); popup.exec(QCursor::pos()); } -void OBSBasic::on_previewDisabledLabel_customContextMenuRequested( - const QPoint &pos) +void OBSBasic::PreviewDisabledMenu(const QPoint &pos) { QMenu popup(this); delete previewProjectorMain; - QAction *action = popup.addAction( - QTStr("Basic.Main.PreviewConextMenu.Enable"), - this, SLOT(TogglePreview())); + QAction *action = + popup.addAction(QTStr("Basic.Main.PreviewConextMenu.Enable"), + this, SLOT(TogglePreview())); action->setCheckable(true); action->setChecked(obs_display_enabled(ui->preview->GetDisplay())); previewProjectorMain = new QMenu(QTStr("PreviewProjector")); AddProjectorMenuMonitors(previewProjectorMain, this, - SLOT(OpenPreviewProjector())); + SLOT(OpenPreviewProjector())); - QAction *previewWindow = popup.addAction( - QTStr("PreviewWindow"), - this, SLOT(OpenPreviewWindow())); + QAction *previewWindow = popup.addAction(QTStr("PreviewWindow"), this, + SLOT(OpenPreviewWindow())); popup.addMenu(previewProjectorMain); popup.addAction(previewWindow); @@ -5797,7 +5865,7 @@ #endif QMetaObject::invokeMethod(this, "ToggleAlwaysOnTop", - Qt::QueuedConnection); + Qt::QueuedConnection); } void OBSBasic::ToggleAlwaysOnTop() @@ -5899,8 +5967,7 @@ void OBSBasic::on_actionCopyTransform_triggered() { - auto func = [](obs_scene_t *scene, obs_sceneitem_t *item, void *param) - { + auto func = [](obs_scene_t *scene, obs_sceneitem_t *item, void *param) { if (!obs_sceneitem_selected(item)) return true; @@ -5920,8 +5987,7 @@ void OBSBasic::on_actionPasteTransform_triggered() { - auto func = [](obs_scene_t *scene, obs_sceneitem_t *item, void *param) - { + auto func = [](obs_scene_t *scene, obs_sceneitem_t *item, void *param) { if (!obs_sceneitem_selected(item)) return true; @@ -5980,8 +6046,7 @@ vec3_set(&tl, M_INFINITE, M_INFINITE, 0.0f); vec3_set(&br, -M_INFINITE, -M_INFINITE, 0.0f); - auto GetMinPos = [&] (float x, float y) - { + auto GetMinPos = [&](float x, float y) { vec3 pos; vec3_set(&pos, x, y, 0.0f); vec3_transform(&pos, &pos, &boxTransform); @@ -6015,21 +6080,23 @@ } static bool RotateSelectedSources(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { if (obs_sceneitem_is_group(item)) obs_sceneitem_group_enum_items(item, RotateSelectedSources, - param); + param); if (!obs_sceneitem_selected(item)) return true; - float rot = *reinterpret_cast<float*>(param); + float rot = *reinterpret_cast<float *>(param); vec3 tl = GetItemTL(item); rot += obs_sceneitem_get_rot(item); - if (rot >= 360.0f) rot -= 360.0f; - else if (rot <= -360.0f) rot += 360.0f; + if (rot >= 360.0f) + rot -= 360.0f; + else if (rot <= -360.0f) + rot += 360.0f; obs_sceneitem_set_rot(item, rot); obs_sceneitem_force_update_transform(item); @@ -6059,13 +6126,13 @@ } static bool MultiplySelectedItemScale(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { - vec2 &mul = *reinterpret_cast<vec2*>(param); + vec2 &mul = *reinterpret_cast<vec2 *>(param); if (obs_sceneitem_is_group(item)) obs_sceneitem_group_enum_items(item, MultiplySelectedItemScale, - param); + param); if (!obs_sceneitem_selected(item)) return true; @@ -6089,7 +6156,7 @@ vec2 scale; vec2_set(&scale, -1.0f, 1.0f); obs_scene_enum_items(GetCurrentScene(), MultiplySelectedItemScale, - &scale); + &scale); } void OBSBasic::on_actionFlipVertical_triggered() @@ -6097,17 +6164,18 @@ vec2 scale; vec2_set(&scale, 1.0f, -1.0f); obs_scene_enum_items(GetCurrentScene(), MultiplySelectedItemScale, - &scale); + &scale); } static bool CenterAlignSelectedItems(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { - obs_bounds_type boundsType = *reinterpret_cast<obs_bounds_type*>(param); + obs_bounds_type boundsType = + *reinterpret_cast<obs_bounds_type *>(param); if (obs_sceneitem_is_group(item)) obs_sceneitem_group_enum_items(item, CenterAlignSelectedItems, - param); + param); if (!obs_sceneitem_selected(item)) return true; @@ -6120,8 +6188,8 @@ itemInfo.alignment = OBS_ALIGN_LEFT | OBS_ALIGN_TOP; itemInfo.rot = 0.0f; - vec2_set(&itemInfo.bounds, - float(ovi.base_width), float(ovi.base_height)); + vec2_set(&itemInfo.bounds, float(ovi.base_width), + float(ovi.base_height)); itemInfo.bounds_type = boundsType; itemInfo.bounds_alignment = OBS_ALIGN_CENTER; @@ -6135,25 +6203,25 @@ { obs_bounds_type boundsType = OBS_BOUNDS_SCALE_INNER; obs_scene_enum_items(GetCurrentScene(), CenterAlignSelectedItems, - &boundsType); + &boundsType); } void OBSBasic::on_actionStretchToScreen_triggered() { obs_bounds_type boundsType = OBS_BOUNDS_STRETCH; obs_scene_enum_items(GetCurrentScene(), CenterAlignSelectedItems, - &boundsType); + &boundsType); } enum class CenterType { Scene, Vertical, - Horizontal + Horizontal, }; static bool center_to_scene(obs_scene_t *, obs_sceneitem_t *item, void *param) { - CenterType centerType = *reinterpret_cast<CenterType*>(param); + CenterType centerType = *reinterpret_cast<CenterType *>(param); vec3 tl, br, itemCenter, screenCenter, offset; obs_video_info ovi; @@ -6161,7 +6229,7 @@ if (obs_sceneitem_is_group(item)) obs_sceneitem_group_enum_items(item, center_to_scene, - ¢erType); + ¢erType); if (!obs_sceneitem_selected(item)) return true; @@ -6170,13 +6238,13 @@ if (centerType == CenterType::Scene) vec3_set(&screenCenter, float(ovi.base_width), - float(ovi.base_height), 0.0f); + float(ovi.base_height), 0.0f); else if (centerType == CenterType::Vertical) vec3_set(&screenCenter, float(oti.bounds.x), - float(ovi.base_height), 0.0f); + float(ovi.base_height), 0.0f); else if (centerType == CenterType::Horizontal) vec3_set(&screenCenter, float(ovi.base_width), - float(oti.bounds.y), 0.0f); + float(oti.bounds.y), 0.0f); vec3_mulf(&screenCenter, &screenCenter, 0.5f); @@ -6220,7 +6288,7 @@ { obs_display_set_enabled(ui->preview->GetDisplay(), enable); ui->preview->setVisible(enable); - ui->previewDisabledLabel->setVisible(!enable); + ui->previewDisabledWidget->setVisible(!enable); } void OBSBasic::TogglePreview() @@ -6247,12 +6315,12 @@ EnablePreviewDisplay(false); } -static bool nudge_callback(obs_scene_t*, obs_sceneitem_t *item, void *param) +static bool nudge_callback(obs_scene_t *, obs_sceneitem_t *item, void *param) { if (obs_sceneitem_locked(item)) return true; - struct vec2 &offset = *reinterpret_cast<struct vec2*>(param); + struct vec2 &offset = *reinterpret_cast<struct vec2 *>(param); struct vec2 pos; if (!obs_sceneitem_selected(item)) { @@ -6269,7 +6337,7 @@ struct vec2 new_offset; vec2_set(&new_offset, offset3.x, offset3.y); obs_sceneitem_group_enum_items(item, nudge_callback, - &new_offset); + &new_offset); } return true; @@ -6290,29 +6358,49 @@ vec2_set(&offset, 0.0f, 0.0f); switch (dir) { - case MoveDir::Up: offset.y = (float)-dist; break; - case MoveDir::Down: offset.y = (float) dist; break; - case MoveDir::Left: offset.x = (float)-dist; break; - case MoveDir::Right: offset.x = (float) dist; break; + case MoveDir::Up: + offset.y = (float)-dist; + break; + case MoveDir::Down: + offset.y = (float)dist; + break; + case MoveDir::Left: + offset.x = (float)-dist; + break; + case MoveDir::Right: + offset.x = (float)dist; + break; } obs_scene_enum_items(GetCurrentScene(), nudge_callback, &offset); } -void OBSBasic::NudgeUp() {Nudge(1, MoveDir::Up);} -void OBSBasic::NudgeDown() {Nudge(1, MoveDir::Down);} -void OBSBasic::NudgeLeft() {Nudge(1, MoveDir::Left);} -void OBSBasic::NudgeRight() {Nudge(1, MoveDir::Right);} +void OBSBasic::NudgeUp() +{ + Nudge(1, MoveDir::Up); +} +void OBSBasic::NudgeDown() +{ + Nudge(1, MoveDir::Down); +} +void OBSBasic::NudgeLeft() +{ + Nudge(1, MoveDir::Left); +} +void OBSBasic::NudgeRight() +{ + Nudge(1, MoveDir::Right); +} OBSProjector *OBSBasic::OpenProjector(obs_source_t *source, int monitor, - QString title, ProjectorType type) + QString title, ProjectorType type) { /* seriously? 10 monitors? */ if (monitor > 9 || monitor > QGuiApplication::screens().size() - 1) return nullptr; - OBSProjector *projector = new OBSProjector(nullptr, source, monitor, - title, type); + OBSProjector *projector = + new OBSProjector(nullptr, source, monitor, title, type); if (monitor < 0) { for (auto &projPtr : windowProjectors) { @@ -6354,7 +6442,7 @@ return; OpenProjector(obs_sceneitem_get_source(item), monitor, nullptr, - ProjectorType::Source); + ProjectorType::Source); } void OBSBasic::OpenMultiviewProjector() @@ -6371,19 +6459,19 @@ return; OpenProjector(obs_scene_get_source(scene), monitor, nullptr, - ProjectorType::Scene); + ProjectorType::Scene); } void OBSBasic::OpenStudioProgramWindow() { OpenProjector(nullptr, -1, QTStr("StudioProgramWindow"), - ProjectorType::StudioProgram); + ProjectorType::StudioProgram); } void OBSBasic::OpenPreviewWindow() { OpenProjector(nullptr, -1, QTStr("PreviewWindow"), - ProjectorType::Preview); + ProjectorType::Preview); } void OBSBasic::OpenSourceWindow() @@ -6396,13 +6484,13 @@ QString title = QString::fromUtf8(obs_source_get_name(source)); OpenProjector(obs_sceneitem_get_source(item), -1, title, - ProjectorType::Source); + ProjectorType::Source); } void OBSBasic::OpenMultiviewWindow() { OpenProjector(nullptr, -1, QTStr("MultiviewWindowed"), - ProjectorType::Multiview); + ProjectorType::Multiview); } void OBSBasic::OpenSceneWindow() @@ -6415,7 +6503,7 @@ QString title = QString::fromUtf8(obs_source_get_name(source)); OpenProjector(obs_scene_get_source(scene), -1, title, - ProjectorType::Scene); + ProjectorType::Scene); } void OBSBasic::OpenSavedProjectors() @@ -6425,52 +6513,52 @@ switch (info->type) { case ProjectorType::Source: case ProjectorType::Scene: { - OBSSource source = obs_get_source_by_name( - info->name.c_str()); + OBSSource source = + obs_get_source_by_name(info->name.c_str()); if (!source) continue; QString title = nullptr; if (info->monitor < 0) title = QString::fromUtf8( - obs_source_get_name(source)); + obs_source_get_name(source)); projector = OpenProjector(source, info->monitor, title, - info->type); + info->type); obs_source_release(source); break; } case ProjectorType::Preview: { projector = OpenProjector(nullptr, info->monitor, - QTStr("PreviewWindow"), - ProjectorType::Preview); + QTStr("PreviewWindow"), + ProjectorType::Preview); break; } case ProjectorType::StudioProgram: { projector = OpenProjector(nullptr, info->monitor, - QTStr("StudioProgramWindow"), - ProjectorType::StudioProgram); + QTStr("StudioProgramWindow"), + ProjectorType::StudioProgram); break; } case ProjectorType::Multiview: { projector = OpenProjector(nullptr, info->monitor, - QTStr("MultiviewWindowed"), - ProjectorType::Multiview); + QTStr("MultiviewWindowed"), + ProjectorType::Multiview); break; } } if (projector && !info->geometry.empty() && info->monitor < 0) { QByteArray byteArray = QByteArray::fromBase64( - QByteArray(info->geometry.c_str())); + QByteArray(info->geometry.c_str())); projector->restoreGeometry(byteArray); if (!WindowPositionValid(projector->normalGeometry())) { QRect rect = App()->desktop()->geometry(); projector->setGeometry(QStyle::alignedRect( - Qt::LeftToRight, - Qt::AlignCenter, size(), rect)); + Qt::LeftToRight, Qt::AlignCenter, + size(), rect)); } } } @@ -6490,10 +6578,10 @@ { stringstream name; - const char *profile = config_get_string(App()->GlobalConfig(), - "Basic", "Profile"); - const char *sceneCollection = config_get_string(App()->GlobalConfig(), - "Basic", "SceneCollection"); + const char *profile = + config_get_string(App()->GlobalConfig(), "Basic", "Profile"); + const char *sceneCollection = config_get_string( + App()->GlobalConfig(), "Basic", "SceneCollection"); name << "OBS "; if (previewProgramMode) @@ -6512,8 +6600,8 @@ int OBSBasic::GetProfilePath(char *path, size_t size, const char *file) const { char profiles_path[512]; - const char *profile = config_get_string(App()->GlobalConfig(), - "Basic", "ProfileDir"); + const char *profile = + config_get_string(App()->GlobalConfig(), "Basic", "ProfileDir"); int ret; if (!profile) @@ -6536,7 +6624,7 @@ void OBSBasic::on_resetUI_triggered() { /* prune deleted extra docks */ - for (int i = extraDocks.size() - 1; i >= 0 ; i--) { + for (int i = extraDocks.size() - 1; i >= 0; i--) { if (!extraDocks[i]) { extraDocks.removeAt(i); } @@ -6544,23 +6632,21 @@ if (extraDocks.size()) { QMessageBox::StandardButton button = QMessageBox::question( - this, - QTStr("ResetUIWarning.Title"), - QTStr("ResetUIWarning.Text")); + this, QTStr("ResetUIWarning.Title"), + QTStr("ResetUIWarning.Text")); if (button == QMessageBox::No) return; } /* undock/hide/center extra docks */ - for (int i = extraDocks.size() - 1; i >= 0 ; i--) { + for (int i = extraDocks.size() - 1; i >= 0; i--) { if (extraDocks[i]) { extraDocks[i]->setVisible(true); extraDocks[i]->setFloating(true); - extraDocks[i]->move( - frameGeometry().topLeft() + - rect().center() - - extraDocks[i]->rect().center()); + extraDocks[i]->move(frameGeometry().topLeft() + + rect().center() - + extraDocks[i]->rect().center()); extraDocks[i]->setVisible(false); } } @@ -6578,21 +6664,11 @@ int mixerSize = cx - (cx22_5 * 2 + cx5 * 2); - QList<QDockWidget*> docks { - ui->scenesDock, - ui->sourcesDock, - ui->mixerDock, - ui->transitionsDock, - ui->controlsDock - }; + QList<QDockWidget *> docks{ui->scenesDock, ui->sourcesDock, + ui->mixerDock, ui->transitionsDock, + ui->controlsDock}; - QList<int> sizes { - cx22_5, - cx22_5, - mixerSize, - cx5, - cx5 - }; + QList<int> sizes{cx22_5, cx22_5, mixerSize, cx5, cx5}; ui->scenesDock->setVisible(true); ui->sourcesDock->setVisible(true); @@ -6609,9 +6685,9 @@ void OBSBasic::on_lockUI_toggled(bool lock) { - QDockWidget::DockWidgetFeatures features = lock - ? QDockWidget::NoDockWidgetFeatures - : QDockWidget::AllDockWidgetFeatures; + QDockWidget::DockWidgetFeatures features = + lock ? QDockWidget::NoDockWidgetFeatures + : QDockWidget::AllDockWidgetFeatures; QDockWidget::DockWidgetFeatures mainFeatures = features; mainFeatures &= ~QDockWidget::QDockWidget::DockWidgetClosable; @@ -6623,7 +6699,7 @@ ui->controlsDock->setFeatures(mainFeatures); statsDock->setFeatures(features); - for (int i = extraDocks.size() - 1; i >= 0 ; i--) { + for (int i = extraDocks.size() - 1; i >= 0; i--) { if (!extraDocks[i]) { extraDocks.removeAt(i); } else { @@ -6645,8 +6721,8 @@ { ui->statusbar->setVisible(visible); - config_set_bool(App()->GlobalConfig(), "BasicWindow", - "ShowStatusBar", visible); + config_set_bool(App()->GlobalConfig(), "BasicWindow", "ShowStatusBar", + visible); } void OBSBasic::on_actionLockPreview_triggered() @@ -6672,7 +6748,7 @@ QString::number(ovi.output_height)); action->setText(text); action->setVisible(!(ovi.output_width == ovi.base_width && - ovi.output_height == ovi.base_height)); + ovi.output_height == ovi.base_height)); UpdatePreviewScalingMenu(); } @@ -6699,8 +6775,8 @@ ui->preview->SetFixedScaling(true); float scalingAmount = float(ovi.output_width) / float(ovi.base_width); // log base ZOOM_SENSITIVITY of x = log(x) / log(ZOOM_SENSITIVITY) - int32_t approxScalingLevel = int32_t( - round(log(scalingAmount) / log(ZOOM_SENSITIVITY))); + int32_t approxScalingLevel = + int32_t(round(log(scalingAmount) / log(ZOOM_SENSITIVITY))); ui->preview->SetScalingLevel(approxScalingLevel); ui->preview->SetScalingAmount(scalingAmount); emit ui->preview->DisplayResized(); @@ -6709,9 +6785,9 @@ void OBSBasic::SetShowing(bool showing) { if (!showing && isVisible()) { - config_set_string(App()->GlobalConfig(), - "BasicWindow", "geometry", - saveGeometry().toBase64().constData()); + config_set_string(App()->GlobalConfig(), "BasicWindow", + "geometry", + saveGeometry().toBase64().constData()); /* hide all visible child dialogs */ visDlgPositions.clear(); @@ -6766,7 +6842,7 @@ * bar. */ if (sysTrayMinimizeToTray()) { Qt::WindowStates state; - state = windowState() & ~Qt::WindowMinimized; + state = windowState() & ~Qt::WindowMinimized; state |= Qt::WindowActive; setWindowState(state); } @@ -6787,28 +6863,27 @@ void OBSBasic::SystemTrayInit() { - trayIcon.reset(new QSystemTrayIcon(QIcon::fromTheme("obs-tray", - QIcon(":/res/images/obs.png")), this)); + trayIcon.reset(new QSystemTrayIcon( + QIcon::fromTheme("obs-tray", QIcon(":/res/images/obs.png")), + this)); trayIcon->setToolTip("OBS Studio"); - showHide = new QAction(QTStr("Basic.SystemTray.Show"), - trayIcon.data()); + showHide = new QAction(QTStr("Basic.SystemTray.Show"), trayIcon.data()); sysTrayStream = new QAction(QTStr("Basic.Main.StartStreaming"), - trayIcon.data()); + trayIcon.data()); sysTrayRecord = new QAction(QTStr("Basic.Main.StartRecording"), - trayIcon.data()); + trayIcon.data()); sysTrayReplayBuffer = new QAction(QTStr("Basic.Main.StartReplayBuffer"), - trayIcon.data()); - exit = new QAction(QTStr("Exit"), - trayIcon.data()); + trayIcon.data()); + exit = new QAction(QTStr("Exit"), trayIcon.data()); trayMenu = new QMenu; previewProjector = new QMenu(QTStr("PreviewProjector")); studioProgramProjector = new QMenu(QTStr("StudioProgramProjector")); AddProjectorMenuMonitors(previewProjector, this, - SLOT(OpenPreviewProjector())); + SLOT(OpenPreviewProjector())); AddProjectorMenuMonitors(studioProgramProjector, this, - SLOT(OpenStudioProgramProjector())); + SLOT(OpenStudioProgramProjector())); trayMenu->addAction(showHide); trayMenu->addMenu(previewProjector); trayMenu->addMenu(studioProgramProjector); @@ -6823,19 +6898,16 @@ sysTrayReplayBuffer->setEnabled(false); connect(trayIcon.data(), - SIGNAL(activated(QSystemTrayIcon::ActivationReason)), - this, - SLOT(IconActivated(QSystemTrayIcon::ActivationReason))); - connect(showHide, SIGNAL(triggered()), - this, SLOT(ToggleShowHide())); - connect(sysTrayStream, SIGNAL(triggered()), - this, SLOT(on_streamButton_clicked())); - connect(sysTrayRecord, SIGNAL(triggered()), - this, SLOT(on_recordButton_clicked())); - connect(sysTrayReplayBuffer.data(), &QAction::triggered, - this, &OBSBasic::ReplayBufferClicked); - connect(exit, SIGNAL(triggered()), - this, SLOT(close())); + SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, + SLOT(IconActivated(QSystemTrayIcon::ActivationReason))); + connect(showHide, SIGNAL(triggered()), this, SLOT(ToggleShowHide())); + connect(sysTrayStream, SIGNAL(triggered()), this, + SLOT(on_streamButton_clicked())); + connect(sysTrayRecord, SIGNAL(triggered()), this, + SLOT(on_recordButton_clicked())); + connect(sysTrayReplayBuffer.data(), &QAction::triggered, this, + &OBSBasic::ReplayBufferClicked); + connect(exit, SIGNAL(triggered()), this, SLOT(close())); } void OBSBasic::IconActivated(QSystemTrayIcon::ActivationReason reason) @@ -6844,20 +6916,20 @@ previewProjector->clear(); studioProgramProjector->clear(); AddProjectorMenuMonitors(previewProjector, this, - SLOT(OpenPreviewProjector())); + SLOT(OpenPreviewProjector())); AddProjectorMenuMonitors(studioProgramProjector, this, - SLOT(OpenStudioProgramProjector())); + SLOT(OpenStudioProgramProjector())); if (reason == QSystemTrayIcon::Trigger) ToggleShowHide(); } void OBSBasic::SysTrayNotify(const QString &text, - QSystemTrayIcon::MessageIcon n) + QSystemTrayIcon::MessageIcon n) { if (trayIcon && QSystemTrayIcon::supportsMessages()) { QSystemTrayIcon::MessageIcon icon = - QSystemTrayIcon::MessageIcon(n); + QSystemTrayIcon::MessageIcon(n); trayIcon->showMessage("OBS Studio", text, icon, 10000); } } @@ -6869,18 +6941,18 @@ if (!trayIcon && !firstStarted) return; - bool sysTrayWhenStarted = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SysTrayWhenStarted"); - bool sysTrayEnabled = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SysTrayEnabled"); + bool sysTrayWhenStarted = config_get_bool( + GetGlobalConfig(), "BasicWindow", "SysTrayWhenStarted"); + bool sysTrayEnabled = config_get_bool(GetGlobalConfig(), "BasicWindow", + "SysTrayEnabled"); if (firstStarted) SystemTrayInit(); if (!sysTrayWhenStarted && !sysTrayEnabled) { trayIcon->hide(); - } else if ((sysTrayWhenStarted && sysTrayEnabled) - || opt_minimize_tray) { + } else if ((sysTrayWhenStarted && sysTrayEnabled) || + opt_minimize_tray) { trayIcon->show(); if (firstStarted) { QTimer::singleShot(50, this, SLOT(hide())); @@ -6907,8 +6979,8 @@ bool OBSBasic::sysTrayMinimizeToTray() { - return config_get_bool(GetGlobalConfig(), - "BasicWindow", "SysTrayMinimizeToTray"); + return config_get_bool(GetGlobalConfig(), "BasicWindow", + "SysTrayMinimizeToTray"); } void OBSBasic::on_actionCopySource_triggered() @@ -6952,8 +7024,8 @@ void OBSBasic::AudioMixerCopyFilters() { - QAction *action = reinterpret_cast<QAction*>(sender()); - VolControl *vol = action->property("volControl").value<VolControl*>(); + QAction *action = reinterpret_cast<QAction *>(sender()); + VolControl *vol = action->property("volControl").value<VolControl *>(); obs_source_t *source = vol->GetSource(); copyFiltersString = obs_source_get_name(source); @@ -6961,8 +7033,8 @@ void OBSBasic::AudioMixerPasteFilters() { - QAction *action = reinterpret_cast<QAction*>(sender()); - VolControl *vol = action->property("volControl").value<VolControl*>(); + QAction *action = reinterpret_cast<QAction *>(sender()); + VolControl *vol = action->property("volControl").value<VolControl *>(); obs_source_t *dstSource = vol->GetSource(); OBSSource source = obs_get_source_by_name(copyFiltersString); @@ -7021,24 +7093,22 @@ } static void ConfirmColor(SourceTree *sources, const QColor &color, - QModelIndexList selectedItems) + QModelIndexList selectedItems) { for (int x = 0; x < selectedItems.count(); x++) { - SourceTreeItem *treeItem = sources - ->GetItemWidget(selectedItems[x].row()); - treeItem->setStyleSheet("background: " - + color.name(QColor::HexArgb)); + SourceTreeItem *treeItem = + sources->GetItemWidget(selectedItems[x].row()); + treeItem->setStyleSheet("background: " + + color.name(QColor::HexArgb)); treeItem->style()->unpolish(treeItem); treeItem->style()->polish(treeItem); - OBSSceneItem sceneItem = sources->Get( - selectedItems[x].row()); + OBSSceneItem sceneItem = sources->Get(selectedItems[x].row()); obs_data_t *privData = obs_sceneitem_get_private_settings(sceneItem); obs_data_set_int(privData, "color-preset", 1); obs_data_set_string(privData, "color", - QT_TO_UTF8(color.name( - QColor::HexArgb))); + QT_TO_UTF8(color.name(QColor::HexArgb))); obs_data_release(privData); } } @@ -7047,8 +7117,8 @@ { QModelIndexList selectedItems = ui->sources->selectionModel()->selectedIndexes(); - QAction *action = qobject_cast<QAction*>(sender()); - QPushButton *colorButton = qobject_cast<QPushButton*>(sender()); + QAction *action = qobject_cast<QAction *>(sender()); + QPushButton *colorButton = qobject_cast<QPushButton *>(sender()); if (selectedItems.count() == 0) return; @@ -7057,15 +7127,15 @@ int preset = colorButton->property("bgColor").value<int>(); for (int x = 0; x < selectedItems.count(); x++) { - SourceTreeItem *treeItem = ui->sources - ->GetItemWidget(selectedItems[x].row()); + SourceTreeItem *treeItem = ui->sources->GetItemWidget( + selectedItems[x].row()); treeItem->setStyleSheet(""); treeItem->setProperty("bgColor", preset); treeItem->style()->unpolish(treeItem); treeItem->style()->polish(treeItem); - OBSSceneItem sceneItem = ui->sources->Get( - selectedItems[x].row()); + OBSSceneItem sceneItem = + ui->sources->Get(selectedItems[x].row()); obs_data_t *privData = obs_sceneitem_get_private_settings(sceneItem); obs_data_set_int(privData, "color-preset", preset + 1); @@ -7076,8 +7146,10 @@ for (int i = 1; i < 9; i++) { stringstream button; button << "preset" << i; - QPushButton *cButton = colorButton->parentWidget() - ->findChild<QPushButton *>(button.str().c_str()); + QPushButton *cButton = + colorButton->parentWidget() + ->findChild<QPushButton *>( + button.str().c_str()); cButton->setStyleSheet("border: 1px solid black"); } @@ -7090,24 +7162,25 @@ SourceTreeItem *curTreeItem = GetItemWidgetFromSceneItem(curSceneItem); obs_data_t *curPrivData = - obs_sceneitem_get_private_settings(curSceneItem); + obs_sceneitem_get_private_settings( + curSceneItem); - int oldPreset = obs_data_get_int( - curPrivData, "color-preset"); + int oldPreset = + obs_data_get_int(curPrivData, "color-preset"); const QString oldSheet = curTreeItem->styleSheet(); auto liveChangeColor = [=](const QColor &color) { if (color.isValid()) { curTreeItem->setStyleSheet( - "background: " - + color.name(QColor::HexArgb)); + "background: " + + color.name(QColor::HexArgb)); } }; auto changedColor = [=](const QColor &color) { if (color.isValid()) { ConfirmColor(ui->sources, color, - selectedItems); + selectedItems); } }; @@ -7122,7 +7195,7 @@ } else { curTreeItem->setStyleSheet(""); curTreeItem->setProperty("bgColor", - oldPreset - 1); + oldPreset - 1); } curTreeItem->style()->unpolish(curTreeItem); @@ -7132,31 +7205,30 @@ QColorDialog::ColorDialogOptions options = QColorDialog::ShowAlphaChannel; - const char *oldColor = obs_data_get_string(curPrivData, - "color"); + const char *oldColor = + obs_data_get_string(curPrivData, "color"); const char *customColor = *oldColor != 0 ? oldColor - : "#55FF0000"; + : "#55FF0000"; #ifdef __APPLE__ options |= QColorDialog::DontUseNativeDialog; #endif QColorDialog *colorDialog = new QColorDialog(this); colorDialog->setOptions(options); - colorDialog->setCurrentColor( - QColor(customColor)); + colorDialog->setCurrentColor(QColor(customColor)); connect(colorDialog, &QColorDialog::currentColorChanged, - liveChangeColor); + liveChangeColor); connect(colorDialog, &QColorDialog::colorSelected, - changedColor); - connect(colorDialog, &QColorDialog::rejected, - rejected); + changedColor); + connect(colorDialog, &QColorDialog::rejected, rejected); colorDialog->open(); obs_data_release(curPrivData); } else { for (int x = 0; x < selectedItems.count(); x++) { - SourceTreeItem *treeItem = ui->sources - ->GetItemWidget(selectedItems[x].row()); + SourceTreeItem *treeItem = + ui->sources->GetItemWidget( + selectedItems[x].row()); treeItem->setStyleSheet("background: none"); treeItem->setProperty("bgColor", preset); treeItem->style()->unpolish(treeItem); @@ -7168,7 +7240,7 @@ obs_sceneitem_get_private_settings( sceneItem); obs_data_set_int(privData, "color-preset", - preset); + preset); obs_data_set_string(privData, "color", ""); obs_data_release(privData); } @@ -7176,8 +7248,7 @@ } } -SourceTreeItem *OBSBasic::GetItemWidgetFromSceneItem( - obs_sceneitem_t *sceneItem) +SourceTreeItem *OBSBasic::GetItemWidgetFromSceneItem(obs_sceneitem_t *sceneItem) { int i = 0; SourceTreeItem *treeItem = ui->sources->GetItemWidget(i); @@ -7188,7 +7259,7 @@ treeItem = ui->sources->GetItemWidget(i); item = ui->sources->Get(i); } - if(treeItem) + if (treeItem) return treeItem; return nullptr; @@ -7229,15 +7300,14 @@ void OBSBasic::ResizeOutputSizeOfSource() { - if (ui->streamButton->isChecked() || ui->recordButton->isChecked() || - (replayBufferButton && replayBufferButton->isChecked())) + if (obs_video_active()) return; QMessageBox resize_output(this); - resize_output.setText(QTStr("ResizeOutputSizeOfSource.Text") + - "\n\n" + QTStr("ResizeOutputSizeOfSource.Continue")); - QAbstractButton *Yes = resize_output.addButton(QTStr("Yes"), - QMessageBox::YesRole); + resize_output.setText(QTStr("ResizeOutputSizeOfSource.Text") + "\n\n" + + QTStr("ResizeOutputSizeOfSource.Continue")); + QAbstractButton *Yes = + resize_output.addButton(QTStr("Yes"), QMessageBox::YesRole); resize_output.addButton(QTStr("No"), QMessageBox::NoRole); resize_output.setIcon(QMessageBox::Warning); resize_output.setWindowTitle(QTStr("ResizeOutputSizeOfSource")); @@ -7268,14 +7338,14 @@ extraDocks.push_back(dock); bool lock = ui->lockUI->isChecked(); - QDockWidget::DockWidgetFeatures features = lock - ? QDockWidget::NoDockWidgetFeatures - : QDockWidget::AllDockWidgetFeatures; + QDockWidget::DockWidgetFeatures features = + lock ? QDockWidget::NoDockWidgetFeatures + : QDockWidget::AllDockWidgetFeatures; dock->setFeatures(features); /* prune deleted docks */ - for (int i = extraDocks.size() - 1; i >= 0 ; i--) { + for (int i = extraDocks.size() - 1; i >= 0; i--) { if (!extraDocks[i]) { extraDocks.removeAt(i); } @@ -7286,7 +7356,7 @@ OBSBasic *OBSBasic::Get() { - return reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + return reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); } bool OBSBasic::StreamingActive() @@ -7316,10 +7386,10 @@ } void SceneRenameDelegate::setEditorData(QWidget *editor, - const QModelIndex &index) const + const QModelIndex &index) const { QStyledItemDelegate::setEditorData(editor, index); - QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor); + QLineEdit *lineEdit = qobject_cast<QLineEdit *>(editor); if (lineEdit) lineEdit->selectAll(); } @@ -7329,7 +7399,7 @@ if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); if (keyEvent->key() == Qt::Key_Escape) { - QLineEdit *lineEdit = qobject_cast<QLineEdit*>(editor); + QLineEdit *lineEdit = qobject_cast<QLineEdit *>(editor); if (lineEdit) lineEdit->undo(); } @@ -7345,3 +7415,144 @@ patronJson = QT_TO_UTF8(text); } + +void OBSBasic::PauseRecording() +{ + if (!pause || !outputHandler || !outputHandler->fileOutput) + return; + + obs_output_t *output = outputHandler->fileOutput; + + if (obs_output_pause(output, true)) { + pause->setAccessibleName(QTStr("Basic.Main.UnpauseRecording")); + pause->setToolTip(QTStr("Basic.Main.UnpauseRecording")); + pause->blockSignals(true); + pause->setChecked(true); + pause->blockSignals(false); + os_atomic_set_bool(&recording_paused, true); + + if (api) + api->on_event(OBS_FRONTEND_EVENT_RECORDING_PAUSED); + + if (os_atomic_load_bool(&replaybuf_active)) + ShowReplayBufferPauseWarning(); + } +} + +void OBSBasic::UnpauseRecording() +{ + if (!pause || !outputHandler || !outputHandler->fileOutput) + return; + + obs_output_t *output = outputHandler->fileOutput; + + if (obs_output_pause(output, false)) { + pause->setAccessibleName(QTStr("Basic.Main.PauseRecording")); + pause->setToolTip(QTStr("Basic.Main.PauseRecording")); + pause->blockSignals(true); + pause->setChecked(false); + pause->blockSignals(false); + os_atomic_set_bool(&recording_paused, false); + + if (api) + api->on_event(OBS_FRONTEND_EVENT_RECORDING_UNPAUSED); + } +} + +void OBSBasic::PauseToggled() +{ + if (!pause || !outputHandler || !outputHandler->fileOutput) + return; + + obs_output_t *output = outputHandler->fileOutput; + bool enable = !obs_output_paused(output); + + if (enable) + PauseRecording(); + else + UnpauseRecording(); +} + +void OBSBasic::UpdatePause(bool activate) +{ + if (!activate || !outputHandler || !outputHandler->RecordingActive()) { + pause.reset(); + return; + } + + const char *mode = config_get_string(basicConfig, "Output", "Mode"); + bool adv = astrcmpi(mode, "Advanced") == 0; + bool shared; + + if (adv) { + const char *recType = + config_get_string(basicConfig, "AdvOut", "RecType"); + + if (astrcmpi(recType, "FFmpeg") == 0) { + shared = config_get_bool(basicConfig, "AdvOut", + "FFOutputToFile"); + } else { + const char *recordEncoder = config_get_string( + basicConfig, "AdvOut", "RecEncoder"); + shared = astrcmpi(recordEncoder, "none") == 0; + } + } else { + const char *quality = config_get_string( + basicConfig, "SimpleOutput", "RecQuality"); + shared = strcmp(quality, "Stream") == 0; + } + + if (!shared) { + pause.reset(new QPushButton()); + pause->setAccessibleName(QTStr("Basic.Main.PauseRecording")); + pause->setToolTip(QTStr("Basic.Main.PauseRecording")); + pause->setCheckable(true); + pause->setChecked(false); + pause->setProperty("themeID", + QVariant(QStringLiteral("pauseIconSmall"))); + connect(pause.data(), &QAbstractButton::clicked, this, + &OBSBasic::PauseToggled); + ui->recordingLayout->addWidget(pause.data()); + } else { + pause.reset(); + } +} + +#define MBYTE (1024ULL * 1024ULL) +#define MBYTES_LEFT_STOP_REC 50ULL +#define MAX_BYTES_LEFT (MBYTES_LEFT_STOP_REC * MBYTE) + +void OBSBasic::DiskSpaceMessage() +{ + blog(LOG_ERROR, "Recording stopped because of low disk space"); + + OBSMessageBox::critical(this, QTStr("Output.RecordNoSpace.Title"), + QTStr("Output.RecordNoSpace.Msg")); +} + +bool OBSBasic::LowDiskSpace() +{ + const char *mode = config_get_string(Config(), "Output", "Mode"); + const char *path = + strcmp(mode, "Advanced") + ? config_get_string(Config(), "SimpleOutput", + "FilePath") + : config_get_string(Config(), "AdvOut", "RecFilePath"); + + uint64_t num_bytes = os_get_free_disk_space(path); + + if (num_bytes < (MAX_BYTES_LEFT)) + return true; + else + return false; +} + +void OBSBasic::CheckDiskSpaceRemaining() +{ + if (LowDiskSpace()) { + StopRecording(); + StopReplayBuffer(); + + DiskSpaceMessage(); + } +}
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-main.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-main.hpp
Changed
@@ -53,16 +53,16 @@ #define DESKTOP_AUDIO_1 Str("DesktopAudioDevice1") #define DESKTOP_AUDIO_2 Str("DesktopAudioDevice2") -#define AUX_AUDIO_1 Str("AuxAudioDevice1") -#define AUX_AUDIO_2 Str("AuxAudioDevice2") -#define AUX_AUDIO_3 Str("AuxAudioDevice3") -#define AUX_AUDIO_4 Str("AuxAudioDevice4") +#define AUX_AUDIO_1 Str("AuxAudioDevice1") +#define AUX_AUDIO_2 Str("AuxAudioDevice2") +#define AUX_AUDIO_3 Str("AuxAudioDevice3") +#define AUX_AUDIO_4 Str("AuxAudioDevice4") -#define SIMPLE_ENCODER_X264 "x264" -#define SIMPLE_ENCODER_X264_LOWCPU "x264_lowcpu" -#define SIMPLE_ENCODER_QSV "qsv" -#define SIMPLE_ENCODER_NVENC "nvenc" -#define SIMPLE_ENCODER_AMD "amd" +#define SIMPLE_ENCODER_X264 "x264" +#define SIMPLE_ENCODER_X264_LOWCPU "x264_lowcpu" +#define SIMPLE_ENCODER_QSV "qsv" +#define SIMPLE_ENCODER_NVENC "nvenc" +#define SIMPLE_ENCODER_AMD "amd" #define PREVIEW_EDGE_SIZE 10 @@ -89,13 +89,14 @@ inline QuickTransition() {} inline QuickTransition(OBSSource source_, int duration_, int id_) - : source (source_), - duration (duration_), - id (id_), - renamedSignal (std::make_shared<OBSSignal>( - obs_source_get_signal_handler(source), - "rename", SourceRenamed, this)) - {} + : source(source_), + duration(duration_), + id(id_), + renamedSignal(std::make_shared<OBSSignal>( + obs_source_get_signal_handler(source), "rename", + SourceRenamed, this)) + { + } private: static void SourceRenamed(void *param, calldata_t *data); @@ -122,21 +123,19 @@ friend class Auth; friend class AutoConfig; friend class AutoConfigStreamPage; + friend class RecordButton; + friend class ExtraBrowsersModel; + friend class ExtraBrowsersDelegate; friend struct OBSStudioAPI; - enum class MoveDir { - Up, - Down, - Left, - Right - }; + enum class MoveDir { Up, Down, Left, Right }; enum DropType { DropType_RawText, DropType_Text, DropType_Image, DropType_Media, - DropType_Html + DropType_Html, }; private: @@ -144,7 +143,7 @@ std::shared_ptr<Auth> auth; - std::vector<VolControl*> volumes; + std::vector<VolControl *> volumes; std::vector<OBSSignal> signalHandlers; @@ -172,7 +171,9 @@ QPointer<QDockWidget> statsDock; QPointer<OBSAbout> about; - QPointer<QTimer> cpuUsageTimer; + QPointer<QTimer> cpuUsageTimer; + QPointer<QTimer> diskFullTimer; + os_cpu_usage_info_t *cpuUsageInfo = nullptr; OBSService service; @@ -188,48 +189,50 @@ gs_vertbuffer_t *boxBottom = nullptr; gs_vertbuffer_t *circle = nullptr; - bool sceneChanging = false; - bool ignoreSelectionUpdate = false; + bool sceneChanging = false; + bool ignoreSelectionUpdate = false; - int previewX = 0, previewY = 0; - int previewCX = 0, previewCY = 0; - float previewScale = 0.0f; + int previewX = 0, previewY = 0; + int previewCX = 0, previewCY = 0; + float previewScale = 0.0f; - ConfigFile basicConfig; + ConfigFile basicConfig; - std::vector<SavedProjectorInfo*> savedProjectorsArray; + std::vector<SavedProjectorInfo *> savedProjectorsArray; QPointer<QWidget> projectors[10]; QList<QPointer<QWidget>> windowProjectors; QPointer<QWidget> stats; QPointer<QWidget> remux; + QPointer<QWidget> extraBrowsers; QPointer<QMenu> startStreamMenu; QPointer<QPushButton> transitionButton; QPointer<QPushButton> replayBufferButton; + QScopedPointer<QPushButton> pause; QScopedPointer<QSystemTrayIcon> trayIcon; - QPointer<QAction> sysTrayStream; - QPointer<QAction> sysTrayRecord; - QPointer<QAction> sysTrayReplayBuffer; - QPointer<QAction> showHide; - QPointer<QAction> exit; - QPointer<QMenu> trayMenu; - QPointer<QMenu> previewProjector; - QPointer<QMenu> studioProgramProjector; - QPointer<QMenu> multiviewProjectorMenu; - QPointer<QMenu> previewProjectorSource; - QPointer<QMenu> previewProjectorMain; - QPointer<QMenu> sceneProjectorMenu; - QPointer<QMenu> sourceProjector; - QPointer<QMenu> scaleFilteringMenu; - QPointer<QMenu> colorMenu; - QPointer<QWidgetAction> colorWidgetAction; - QPointer<ColorSelect> colorSelect; - QPointer<QMenu> deinterlaceMenu; - QPointer<QMenu> perSceneTransitionMenu; - QPointer<QObject> shortcutFilter; + QPointer<QAction> sysTrayStream; + QPointer<QAction> sysTrayRecord; + QPointer<QAction> sysTrayReplayBuffer; + QPointer<QAction> showHide; + QPointer<QAction> exit; + QPointer<QMenu> trayMenu; + QPointer<QMenu> previewProjector; + QPointer<QMenu> studioProgramProjector; + QPointer<QMenu> multiviewProjectorMenu; + QPointer<QMenu> previewProjectorSource; + QPointer<QMenu> previewProjectorMain; + QPointer<QMenu> sceneProjectorMenu; + QPointer<QMenu> sourceProjector; + QPointer<QMenu> scaleFilteringMenu; + QPointer<QMenu> colorMenu; + QPointer<QWidgetAction> colorWidgetAction; + QPointer<ColorSelect> colorSelect; + QPointer<QMenu> deinterlaceMenu; + QPointer<QMenu> perSceneTransitionMenu; + QPointer<QObject> shortcutFilter; QPointer<QWidget> programWidget; QPointer<QVBoxLayout> programLayout; @@ -238,47 +241,47 @@ QScopedPointer<QThread> patronJsonThread; std::string patronJson; - void UpdateMultiviewProjectorMenu(); + void UpdateMultiviewProjectorMenu(); - void DrawBackdrop(float cx, float cy); + void DrawBackdrop(float cx, float cy); - void SetupEncoders(); + void SetupEncoders(); - void CreateFirstRunSources(); - void CreateDefaultScene(bool firstStart); + void CreateFirstRunSources(); + void CreateDefaultScene(bool firstStart); - void UpdateVolumeControlsDecayRate(); - void UpdateVolumeControlsPeakMeterType(); - void ClearVolumeControls(); + void UpdateVolumeControlsDecayRate(); + void UpdateVolumeControlsPeakMeterType(); + void ClearVolumeControls(); - void UploadLog(const char *subdir, const char *file); + void UploadLog(const char *subdir, const char *file); - void Save(const char *file); - void Load(const char *file); + void Save(const char *file); + void Load(const char *file); - void InitHotkeys(); - void CreateHotkeys(); - void ClearHotkeys(); + void InitHotkeys(); + void CreateHotkeys(); + void ClearHotkeys(); - bool InitService(); + bool InitService(); - bool InitBasicConfigDefaults(); - void InitBasicConfigDefaults2(); - bool InitBasicConfig(); + bool InitBasicConfigDefaults(); + void InitBasicConfigDefaults2(); + bool InitBasicConfig(); - void InitOBSCallbacks(); + void InitOBSCallbacks(); - void InitPrimitives(); + void InitPrimitives(); - void OnFirstLoad(); + void OnFirstLoad(); - OBSSceneItem GetSceneItem(QListWidgetItem *item); - OBSSceneItem GetCurrentSceneItem(); + OBSSceneItem GetSceneItem(QListWidgetItem *item); + OBSSceneItem GetCurrentSceneItem(); - bool QueryRemoveSource(obs_source_t *source); + bool QueryRemoveSource(obs_source_t *source); - void TimedCheckForUpdates(); - void CheckForUpdates(bool manualUpdate); + void TimedCheckForUpdates(); + void CheckForUpdates(bool manualUpdate); void GetFPSCommon(uint32_t &num, uint32_t &den) const; void GetFPSInteger(uint32_t &num, uint32_t &den) const; @@ -293,8 +296,8 @@ void ChangeSceneIndex(bool relative, int idx, int invalidIdx); void TempFileOutput(const char *path, int vBitrate, int aBitrate); - void TempStreamOutput(const char *url, const char *key, - int vBitrate, int aBitrate); + void TempStreamOutput(const char *url, const char *key, int vBitrate, + int aBitrate); void CloseDialogs(); void ClearSceneData(); @@ -302,7 +305,7 @@ void Nudge(int dist, MoveDir dir); OBSProjector *OpenProjector(obs_source_t *source, int monitor, - QString title, ProjectorType type); + QString title, ProjectorType type); void GetAudioSourceFilters(); void GetAudioSourceProperties(); @@ -327,8 +330,8 @@ int GetTopSelectedSourceItem(); - obs_hotkey_pair_id streamingHotkeys, recordingHotkeys, - replayBufHotkeys, togglePreviewHotkeys; + obs_hotkey_pair_id streamingHotkeys, recordingHotkeys, pauseHotkeys, + replayBufHotkeys, togglePreviewHotkeys; obs_hotkey_id forceStreamingStopHotkey; void InitDefaultTransitions(); @@ -368,7 +371,7 @@ void SetPreviewProgramMode(bool enabled); void ResizeProgram(uint32_t cx, uint32_t cy); void SetCurrentScene(obs_scene_t *scene, bool force = false, - bool direct = false); + bool direct = false); static void RenderProgram(void *data, uint32_t cx, uint32_t cy); std::vector<QuickTransition> quickTransitions; @@ -386,8 +389,8 @@ int quickTransitionIdCounter = 1; bool overridingTransition = false; - int programX = 0, programY = 0; - int programCX = 0, programCY = 0; + int programX = 0, programY = 0; + int programCX = 0, programCY = 0; float programScale = 0.0f; int disableOutputsRef = 0; @@ -407,9 +410,9 @@ void EnumDialogs(); - QList<QDialog*> visDialogs; - QList<QDialog*> modalDialogs; - QList<QMessageBox*> visMsgBoxes; + QList<QDialog *> visDialogs; + QList<QDialog *> modalDialogs; + QList<QMessageBox *> visMsgBoxes; QList<QPoint> visDlgPositions; @@ -422,6 +425,19 @@ bool NoSourcesConfirmation(); +#ifdef BROWSER_AVAILABLE + QList<QSharedPointer<QDockWidget>> extraBrowserDocks; + QList<QSharedPointer<QAction>> extraBrowserDockActions; + QStringList extraBrowserDockTargets; + + void ClearExtraBrowserDocks(); + void LoadExtraBrowserDocks(); + void SaveExtraBrowserDocks(); + void ManageExtraBrowserDocks(); + void AddExtraBrowserDock(const QString &title, const QString &url, + bool firstCreate); +#endif + public slots: void DeferSaveBegin(); void DeferSaveEnd(); @@ -444,6 +460,7 @@ void RecordStopping(); void RecordingStop(int code, QString last_error); + void ShowReplayBufferPauseWarning(); void StartReplayBuffer(); void StopReplayBuffer(); @@ -457,18 +474,21 @@ void SetTransition(OBSSource transition); void TransitionToScene(OBSScene scene, bool force = false, - bool direct = false); + bool direct = false); void TransitionToScene(OBSSource scene, bool force = false, - bool direct = false, bool quickTransition = false); + bool direct = false, + bool quickTransition = false); void SetCurrentScene(OBSSource scene, bool force = false, - bool direct = false); + bool direct = false); - bool AddSceneCollection( - bool create_new, - const QString &name = QString()); + bool AddSceneCollection(bool create_new, + const QString &name = QString()); void UpdatePatronJson(const QString &text, const QString &error); + void PauseRecording(); + void UnpauseRecording(); + private slots: void AddSceneItem(OBSSceneItem item); void AddScene(OBSSource source); @@ -538,6 +558,8 @@ void SceneCopyFilters(); void ScenePasteFilters(); + void CheckDiskSpaceRemaining(); + private: /* OBS Callbacks */ static void SceneReordered(void *data, calldata_t *params); @@ -562,6 +584,11 @@ void AutoRemux(); + void UpdatePause(bool activate = true); + + bool LowDiskSpace(); + void DiskSpaceMessage(); + public: OBSSource GetProgramSource(); OBSScene GetCurrentScene(); @@ -575,7 +602,7 @@ } obs_service_t *GetService(); - void SetService(obs_service_t *service); + void SetService(obs_service_t *service); int GetTransitionDuration(); @@ -588,29 +615,26 @@ bool Active() const; void ResetUI(); - int ResetVideo(); + int ResetVideo(); bool ResetAudio(); void ResetOutputs(); void ResetAudioDevice(const char *sourceId, const char *deviceId, - const char *deviceDesc, int channel); + const char *deviceDesc, int channel); void NewProject(); void LoadProject(); inline void GetDisplayRect(int &x, int &y, int &cx, int &cy) { - x = previewX; - y = previewY; + x = previewX; + y = previewY; cx = previewCX; cy = previewCY; } - inline bool SavingDisabled() const - { - return disableSaving; - } + inline bool SavingDisabled() const { return disableSaving; } inline double GetCPUUsage() const { @@ -620,7 +644,7 @@ void SaveService(); bool LoadService(); - inline Auth *GetAuth() {return auth.get();} + inline Auth *GetAuth() { return auth.get(); } inline void EnableOutputs(bool enable) { @@ -635,7 +659,8 @@ QMenu *AddDeinterlacingMenu(QMenu *menu, obs_source_t *source); QMenu *AddScaleFilteringMenu(QMenu *menu, obs_sceneitem_t *item); QMenu *AddBackgroundColorMenu(QMenu *menu, QWidgetAction *widgetAction, - ColorSelect *select, obs_sceneitem_t *item); + ColorSelect *select, + obs_sceneitem_t *item); void CreateSourcePopupMenu(int idx, bool preview); void UpdateTitleBar(); @@ -691,7 +716,7 @@ void on_actionHorizontalCenter_triggered(); void on_scenes_currentItemChanged(QListWidgetItem *current, - QListWidgetItem *prev); + QListWidgetItem *prev); void on_scenes_customContextMenuRequested(const QPoint &pos); void on_actionAddScene_triggered(); void on_actionRemoveScene_triggered(); @@ -728,8 +753,7 @@ void on_preview_customContextMenuRequested(const QPoint &pos); void on_program_customContextMenuRequested(const QPoint &pos); - void on_previewDisabledLabel_customContextMenuRequested( - const QPoint &pos); + void PreviewDisabledMenu(const QPoint &pos); void on_actionNewSceneCollection_triggered(); void on_actionDupSceneCollection_triggered(); @@ -766,6 +790,8 @@ void on_resetUI_triggered(); void on_lockUI_toggled(bool lock); + void PauseToggled(); + void logUploadFinished(const QString &text, const QString &error); void updateCheckFinished(); @@ -779,7 +805,7 @@ void EditSceneItemName(); void SceneNameEdited(QWidget *editor, - QAbstractItemDelegate::EndEditHint endHint); + QAbstractItemDelegate::EndEditHint endHint); void OpenSceneFilters(); void OpenFilters(); @@ -825,8 +851,8 @@ virtual config_t *Config() const override; - virtual int GetProfilePath(char *path, size_t size, const char *file) - const override; + virtual int GetProfilePath(char *path, size_t size, + const char *file) const override; static void InitBrowserPanelSafeBlock(); @@ -839,8 +865,8 @@ public: SceneRenameDelegate(QObject *parent); - virtual void setEditorData(QWidget *editor, const QModelIndex &index) - const override; + virtual void setEditorData(QWidget *editor, + const QModelIndex &index) const override; protected: virtual bool eventFilter(QObject *editor, QEvent *event) override;
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-preview.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-preview.cpp
Changed
@@ -11,7 +11,7 @@ #include "obs-app.hpp" #include "platform.hpp" -#define HANDLE_RADIUS 4.0f +#define HANDLE_RADIUS 4.0f #define HANDLE_SEL_RADIUS (HANDLE_RADIUS * 1.5f) #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) #define SUPPORTS_FRACTIONAL_SCALING @@ -28,16 +28,19 @@ OBSBasicPreview::~OBSBasicPreview() { - if (overflow) { - obs_enter_graphics(); + obs_enter_graphics(); + + if (overflow) gs_texture_destroy(overflow); - obs_leave_graphics(); - } + if (rectFill) + gs_vertexbuffer_destroy(rectFill); + + obs_leave_graphics(); } vec2 OBSBasicPreview::GetMouseEventPos(QMouseEvent *event) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); #ifdef SUPPORTS_FRACTIONAL_SCALING float pixelRatio = main->devicePixelRatioF(); #else @@ -46,28 +49,44 @@ float scale = pixelRatio / main->previewScale; vec2 pos; vec2_set(&pos, - (float(event->x()) - main->previewX / pixelRatio) * scale, - (float(event->y()) - main->previewY / pixelRatio) * scale); + (float(event->x()) - main->previewX / pixelRatio) * scale, + (float(event->y()) - main->previewY / pixelRatio) * scale); return pos; } struct SceneFindData { - const vec2 &pos; + const vec2 &pos; OBSSceneItem item; - bool selectBelow; + bool selectBelow; obs_sceneitem_t *group = nullptr; SceneFindData(const SceneFindData &) = delete; SceneFindData(SceneFindData &&) = delete; - SceneFindData& operator=(const SceneFindData &) = delete; - SceneFindData& operator=(SceneFindData &&) = delete; + SceneFindData &operator=(const SceneFindData &) = delete; + SceneFindData &operator=(SceneFindData &&) = delete; inline SceneFindData(const vec2 &pos_, bool selectBelow_) - : pos (pos_), - selectBelow (selectBelow_) - {} + : pos(pos_), selectBelow(selectBelow_) + { + } +}; + +struct SceneFindBoxData { + const vec2 &startPos; + const vec2 &pos; + std::vector<obs_sceneitem_t *> sceneItems; + + SceneFindBoxData(const SceneFindData &) = delete; + SceneFindBoxData(SceneFindData &&) = delete; + SceneFindBoxData &operator=(const SceneFindData &) = delete; + SceneFindBoxData &operator=(SceneFindData &&) = delete; + + inline SceneFindBoxData(const vec2 &startPos_, const vec2 &pos_) + : startPos(startPos_), pos(pos_) + { + } }; static bool SceneItemHasVideo(obs_sceneitem_t *item) @@ -77,21 +96,21 @@ return (flags & OBS_SOURCE_VIDEO) != 0; } -static bool CloseFloat(float a, float b, float epsilon=0.01) +static bool CloseFloat(float a, float b, float epsilon = 0.01) { using std::abs; - return abs(a-b) <= epsilon; + return abs(a - b) <= epsilon; } static bool FindItemAtPos(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { - SceneFindData *data = reinterpret_cast<SceneFindData*>(param); - matrix4 transform; - matrix4 invTransform; - vec3 transformedPos; - vec3 pos3; - vec3 pos3_; + SceneFindData *data = reinterpret_cast<SceneFindData *>(param); + matrix4 transform; + matrix4 invTransform; + vec3 transformedPos; + vec3 pos3; + vec3 pos3_; if (!SceneItemHasVideo(item)) return true; @@ -147,54 +166,50 @@ vec3 OBSBasicPreview::GetSnapOffset(const vec3 &tl, const vec3 &br) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); vec2 screenSize = GetOBSScreenSize(); vec3 clampOffset; vec3_zero(&clampOffset); - const bool snap = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SnappingEnabled"); + const bool snap = config_get_bool(GetGlobalConfig(), "BasicWindow", + "SnappingEnabled"); if (snap == false) return clampOffset; - const bool screenSnap = config_get_bool(GetGlobalConfig(), - "BasicWindow", "ScreenSnapping"); - const bool centerSnap = config_get_bool(GetGlobalConfig(), - "BasicWindow", "CenterSnapping"); + const bool screenSnap = config_get_bool( + GetGlobalConfig(), "BasicWindow", "ScreenSnapping"); + const bool centerSnap = config_get_bool( + GetGlobalConfig(), "BasicWindow", "CenterSnapping"); const float clampDist = config_get_double(GetGlobalConfig(), - "BasicWindow", "SnapDistance") / main->previewScale; + "BasicWindow", + "SnapDistance") / + main->previewScale; const float centerX = br.x - (br.x - tl.x) / 2.0f; const float centerY = br.y - (br.y - tl.y) / 2.0f; // Left screen edge. - if (screenSnap && - fabsf(tl.x) < clampDist) + if (screenSnap && fabsf(tl.x) < clampDist) clampOffset.x = -tl.x; // Right screen edge. - if (screenSnap && - fabsf(clampOffset.x) < EPSILON && + if (screenSnap && fabsf(clampOffset.x) < EPSILON && fabsf(screenSize.x - br.x) < clampDist) clampOffset.x = screenSize.x - br.x; // Horizontal center. - if (centerSnap && - fabsf(screenSize.x - (br.x - tl.x)) > clampDist && + if (centerSnap && fabsf(screenSize.x - (br.x - tl.x)) > clampDist && fabsf(screenSize.x / 2.0f - centerX) < clampDist) clampOffset.x = screenSize.x / 2.0f - centerX; // Top screen edge. - if (screenSnap && - fabsf(tl.y) < clampDist) + if (screenSnap && fabsf(tl.y) < clampDist) clampOffset.y = -tl.y; // Bottom screen edge. - if (screenSnap && - fabsf(clampOffset.y) < EPSILON && + if (screenSnap && fabsf(clampOffset.y) < EPSILON && fabsf(screenSize.y - br.y) < clampDist) clampOffset.y = screenSize.y - br.y; // Vertical center. - if (centerSnap && - fabsf(screenSize.y - (br.y - tl.y)) > clampDist && + if (centerSnap && fabsf(screenSize.y - (br.y - tl.y)) > clampDist && fabsf(screenSize.y / 2.0f - centerY) < clampDist) clampOffset.y = screenSize.y / 2.0f - centerY; @@ -203,7 +218,7 @@ OBSSceneItem OBSBasicPreview::GetItemAtPos(const vec2 &pos, bool selectBelow) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); if (!scene) @@ -215,12 +230,12 @@ } static bool CheckItemSelected(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { - SceneFindData *data = reinterpret_cast<SceneFindData*>(param); - matrix4 transform; - vec3 transformedPos; - vec3 pos3; + SceneFindData *data = reinterpret_cast<SceneFindData *>(param); + matrix4 transform; + vec3 transformedPos; + vec3 pos3; if (!SceneItemHasVideo(item)) return true; @@ -240,7 +255,8 @@ if (data->group) { matrix4 parent_transform; - obs_sceneitem_get_draw_transform(data->group, &parent_transform); + obs_sceneitem_get_draw_transform(data->group, + &parent_transform); matrix4_mul(&transform, &transform, &parent_transform); } @@ -261,7 +277,7 @@ bool OBSBasicPreview::SelectedAtPos(const vec2 &pos) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); if (!scene) @@ -273,46 +289,45 @@ } struct HandleFindData { - const vec2 &pos; - const float radius; - matrix4 parent_xform; + const vec2 &pos; + const float radius; + matrix4 parent_xform; OBSSceneItem item; - ItemHandle handle = ItemHandle::None; + ItemHandle handle = ItemHandle::None; HandleFindData(const HandleFindData &) = delete; HandleFindData(HandleFindData &&) = delete; - HandleFindData& operator=(const HandleFindData &) = delete; - HandleFindData& operator=(HandleFindData &&) = delete; + HandleFindData &operator=(const HandleFindData &) = delete; + HandleFindData &operator=(HandleFindData &&) = delete; inline HandleFindData(const vec2 &pos_, float scale) - : pos (pos_), - radius (HANDLE_SEL_RADIUS / scale) + : pos(pos_), radius(HANDLE_SEL_RADIUS / scale) { matrix4_identity(&parent_xform); } inline HandleFindData(const HandleFindData &hfd, - obs_sceneitem_t *parent) - : pos (hfd.pos), - radius (hfd.radius), - item (hfd.item), - handle (hfd.handle) + obs_sceneitem_t *parent) + : pos(hfd.pos), + radius(hfd.radius), + item(hfd.item), + handle(hfd.handle) { obs_sceneitem_get_draw_transform(parent, &parent_xform); } }; static bool FindHandleAtPos(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { - HandleFindData &data = *reinterpret_cast<HandleFindData*>(param); + HandleFindData &data = *reinterpret_cast<HandleFindData *>(param); if (!obs_sceneitem_selected(item)) { if (obs_sceneitem_is_group(item)) { HandleFindData newData(data, item); obs_sceneitem_group_enum_items(item, FindHandleAtPos, - &newData); + &newData); data.item = newData.item; data.handle = newData.handle; } @@ -320,16 +335,15 @@ return true; } - matrix4 transform; - vec3 pos3; - float closestHandle = data.radius; + matrix4 transform; + vec3 pos3; + float closestHandle = data.radius; vec3_set(&pos3, data.pos.x, data.pos.y, 0.0f); obs_sceneitem_get_box_transform(item, &transform); - auto TestHandle = [&] (float x, float y, ItemHandle handle) - { + auto TestHandle = [&](float x, float y, ItemHandle handle) { vec3 handlePos = GetTransformedPos(x, y, transform); vec3_transform(&handlePos, &handlePos, &data.parent_xform); @@ -337,8 +351,8 @@ if (dist < data.radius) { if (dist < closestHandle) { closestHandle = dist; - data.handle = handle; - data.item = item; + data.handle = handle; + data.item = item; } } }; @@ -370,10 +384,12 @@ obs_sceneitem_get_scale(item, &scale); obs_sceneitem_get_crop(item, &crop); - size.x = float(obs_source_get_width(source) - - crop.left - crop.right) * scale.x; - size.y = float(obs_source_get_height(source) - - crop.top - crop.bottom) * scale.y; + size.x = float(obs_source_get_width(source) - crop.left - + crop.right) * + scale.x; + size.y = float(obs_source_get_height(source) - crop.top - + crop.bottom) * + scale.y; } return size; @@ -381,7 +397,7 @@ void OBSBasicPreview::GetStretchHandleData(const vec2 &pos) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); if (!scene) @@ -397,13 +413,13 @@ HandleFindData data(scaled_pos, scale); obs_scene_enum_items(scene, FindHandleAtPos, &data); - stretchItem = std::move(data.item); - stretchHandle = data.handle; + stretchItem = std::move(data.item); + stretchHandle = data.handle; if (stretchHandle != ItemHandle::None) { matrix4 boxTransform; - vec3 itemUL; - float itemRot; + vec3 itemUL; + float itemRot; stretchItemSize = GetItemSize(stretchItem); @@ -413,32 +429,31 @@ /* build the item space conversion matrices */ matrix4_identity(&itemToScreen); - matrix4_rotate_aa4f(&itemToScreen, &itemToScreen, - 0.0f, 0.0f, 1.0f, RAD(itemRot)); - matrix4_translate3f(&itemToScreen, &itemToScreen, - itemUL.x, itemUL.y, 0.0f); + matrix4_rotate_aa4f(&itemToScreen, &itemToScreen, 0.0f, 0.0f, + 1.0f, RAD(itemRot)); + matrix4_translate3f(&itemToScreen, &itemToScreen, itemUL.x, + itemUL.y, 0.0f); matrix4_identity(&screenToItem); - matrix4_translate3f(&screenToItem, &screenToItem, - -itemUL.x, -itemUL.y, 0.0f); - matrix4_rotate_aa4f(&screenToItem, &screenToItem, - 0.0f, 0.0f, 1.0f, RAD(-itemRot)); + matrix4_translate3f(&screenToItem, &screenToItem, -itemUL.x, + -itemUL.y, 0.0f); + matrix4_rotate_aa4f(&screenToItem, &screenToItem, 0.0f, 0.0f, + 1.0f, RAD(-itemRot)); obs_sceneitem_get_crop(stretchItem, &startCrop); obs_sceneitem_get_pos(stretchItem, &startItemPos); obs_source_t *source = obs_sceneitem_get_source(stretchItem); cropSize.x = float(obs_source_get_width(source) - - startCrop.left - startCrop.right); + startCrop.left - startCrop.right); cropSize.y = float(obs_source_get_height(source) - - startCrop.top - startCrop.bottom); + startCrop.top - startCrop.bottom); stretchGroup = obs_sceneitem_get_group(scene, stretchItem); if (stretchGroup) { obs_sceneitem_get_draw_transform(stretchGroup, - &invGroupTransform); - matrix4_inv(&invGroupTransform, - &invGroupTransform); + &invGroupTransform); + matrix4_inv(&invGroupTransform, &invGroupTransform); obs_sceneitem_defer_group_resize_begin(stretchGroup); } } @@ -480,8 +495,8 @@ void OBSBasicPreview::wheelEvent(QWheelEvent *event) { - if (scrollMode && IsFixedScaling() - && event->orientation() == Qt::Vertical) { + if (scrollMode && IsFixedScaling() && + event->orientation() == Qt::Vertical) { if (event->delta() > 0) SetScalingLevel(scalingLevel + 1); else if (event->delta() < 0) @@ -512,7 +527,7 @@ return; } - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); #ifdef SUPPORTS_FRACTIONAL_SCALING float pixelRatio = main->devicePixelRatioF(); #else @@ -522,6 +537,8 @@ float y = float(event->y()) - main->previewY / pixelRatio; Qt::KeyboardModifiers modifiers = QGuiApplication::keyboardModifiers(); bool altDown = (modifiers & Qt::AltModifier); + bool shiftDown = (modifiers & Qt::ShiftModifier); + bool ctrlDown = (modifiers & Qt::ControlModifier); OBSQTDisplay::mousePressEvent(event); @@ -532,9 +549,25 @@ if (event->button() == Qt::LeftButton) mouseDown = true; + { + std::lock_guard<std::mutex> lock(selectMutex); + selectedItems.clear(); + } + if (altDown) cropping = true; + if (altDown || shiftDown || ctrlDown) { + vec2 s; + SceneFindBoxData data(s, s); + + obs_scene_enum_items(main->GetCurrentScene(), FindSelected, + &data); + + std::lock_guard<std::mutex> lock(selectMutex); + selectedItems = data.sceneItems; + } + vec2_set(&startPos, x, y); GetStretchHandleData(startPos); @@ -544,12 +577,14 @@ mouseOverItems = SelectedAtPos(startPos); vec2_zero(&lastMoveOffset); + + mousePos = startPos; } static bool select_one(obs_scene_t *scene, obs_sceneitem_t *item, void *param) { obs_sceneitem_t *selectedItem = - reinterpret_cast<obs_sceneitem_t*>(param); + reinterpret_cast<obs_sceneitem_t *>(param); if (obs_sceneitem_is_group(item)) obs_sceneitem_group_enum_items(item, select_one, param); @@ -561,12 +596,12 @@ void OBSBasicPreview::DoSelect(const vec2 &pos) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); - OBSScene scene = main->GetCurrentScene(); - OBSSceneItem item = GetItemAtPos(pos, true); + OBSScene scene = main->GetCurrentScene(); + OBSSceneItem item = GetItemAtPos(pos, true); - obs_scene_enum_items(scene, select_one, (obs_sceneitem_t*)item); + obs_scene_enum_items(scene, select_one, (obs_sceneitem_t *)item); } void OBSBasicPreview::DoCtrlSelect(const vec2 &pos) @@ -605,18 +640,54 @@ if (!mouseMoved) ProcessClick(pos); + if (selectionBox) { + Qt::KeyboardModifiers modifiers = + QGuiApplication::keyboardModifiers(); + + bool altDown = modifiers & Qt::AltModifier; + bool shiftDown = modifiers & Qt::ShiftModifier; + bool ctrlDown = modifiers & Qt::ControlModifier; + + std::lock_guard<std::mutex> lock(selectMutex); + if (altDown || ctrlDown || shiftDown) { + for (int i = 0; i < selectedItems.size(); i++) { + obs_sceneitem_select(selectedItems[i], + true); + } + } + + for (int i = 0; i < hoveredPreviewItems.size(); i++) { + bool select = true; + obs_sceneitem_t *item = hoveredPreviewItems[i]; + + if (altDown) { + select = false; + } else if (ctrlDown) { + select = !obs_sceneitem_selected(item); + } + + obs_sceneitem_select(hoveredPreviewItems[i], + select); + } + } + if (stretchGroup) { obs_sceneitem_defer_group_resize_end(stretchGroup); } - stretchItem = nullptr; + stretchItem = nullptr; stretchGroup = nullptr; - mouseDown = false; - mouseMoved = false; - cropping = false; + mouseDown = false; + mouseMoved = false; + cropping = false; + selectionBox = false; OBSSceneItem item = GetItemAtPos(pos, true); - hoveredPreviewItem = item; + + std::lock_guard<std::mutex> lock(selectMutex); + hoveredPreviewItems.clear(); + hoveredPreviewItems.push_back(item); + selectedItems.clear(); } } @@ -626,13 +697,13 @@ }; static bool AddItemBounds(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { - SelectedItemBounds *data = reinterpret_cast<SelectedItemBounds*>(param); + SelectedItemBounds *data = + reinterpret_cast<SelectedItemBounds *>(param); vec3 t[4]; - auto add_bounds = [data, &t] () - { + auto add_bounds = [data, &t]() { for (const vec3 &v : t) { if (data->first) { vec3_copy(&data->tl, &v); @@ -686,9 +757,9 @@ }; static bool GetSourceSnapOffset(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { - OffsetData *data = reinterpret_cast<OffsetData*>(param); + OffsetData *data = reinterpret_cast<OffsetData *>(param); if (obs_sceneitem_selected(item)) return true; @@ -696,12 +767,10 @@ matrix4 boxTransform; obs_sceneitem_get_box_transform(item, &boxTransform); - vec3 t[4] = { - GetTransformedPos(0.0f, 0.0f, boxTransform), - GetTransformedPos(1.0f, 0.0f, boxTransform), - GetTransformedPos(0.0f, 1.0f, boxTransform), - GetTransformedPos(1.0f, 1.0f, boxTransform) - }; + vec3 t[4] = {GetTransformedPos(0.0f, 0.0f, boxTransform), + GetTransformedPos(1.0f, 0.0f, boxTransform), + GetTransformedPos(0.0f, 1.0f, boxTransform), + GetTransformedPos(1.0f, 1.0f, boxTransform)}; bool first = true; vec3 tl, br; @@ -719,15 +788,15 @@ } // Snap to other source edges -#define EDGE_SNAP(l, r, x, y) \ - do { \ - double dist = fabsf(l.x - data->r.x); \ - if (dist < data->clampDist && \ - fabsf(data->offset.x) < EPSILON && \ - data->tl.y < br.y && \ - data->br.y > tl.y && \ - (fabsf(data->offset.x) > dist || data->offset.x < EPSILON)) \ - data->offset.x = l.x - data->r.x; \ +#define EDGE_SNAP(l, r, x, y) \ + do { \ + double dist = fabsf(l.x - data->r.x); \ + if (dist < data->clampDist && \ + fabsf(data->offset.x) < EPSILON && data->tl.y < br.y && \ + data->br.y > tl.y && \ + (fabsf(data->offset.x) > dist || \ + data->offset.x < EPSILON)) \ + data->offset.x = l.x - data->r.x; \ } while (false) EDGE_SNAP(tl, br, x, y); @@ -742,7 +811,7 @@ void OBSBasicPreview::SnapItemMovement(vec2 &offset) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); SelectedItemBounds data; @@ -755,10 +824,10 @@ vec3 snapOffset = GetSnapOffset(data.tl, data.br); - const bool snap = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SnappingEnabled"); - const bool sourcesSnap = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SourceSnapping"); + const bool snap = config_get_bool(GetGlobalConfig(), "BasicWindow", + "SnappingEnabled"); + const bool sourcesSnap = config_get_bool( + GetGlobalConfig(), "BasicWindow", "SourceSnapping"); if (snap == false) return; if (sourcesSnap == false) { @@ -768,7 +837,9 @@ } const float clampDist = config_get_double(GetGlobalConfig(), - "BasicWindow", "SnapDistance") / main->previewScale; + "BasicWindow", + "SnapDistance") / + main->previewScale; OffsetData offsetData; offsetData.clampDist = clampDist; @@ -794,7 +865,7 @@ return true; bool selected = obs_sceneitem_selected(item); - vec2 *offset = reinterpret_cast<vec2*>(param); + vec2 *offset = reinterpret_cast<vec2 *>(param); if (obs_sceneitem_is_group(item) && !selected) { matrix4 transform; @@ -822,7 +893,7 @@ void OBSBasicPreview::MoveItems(const vec2 &pos) { Qt::KeyboardModifiers modifiers = QGuiApplication::keyboardModifiers(); - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); vec2 offset, moveOffset; @@ -837,6 +908,191 @@ obs_scene_enum_items(scene, move_items, &moveOffset); } +static bool CounterClockwise(float x1, float x2, float x3, float y1, float y2, + float y3) +{ + return (y3 - y1) * (x2 - x1) > (y2 - y1) * (x3 - x1); +} + +static bool IntersectLine(float x1, float x2, float x3, float x4, float y1, + float y2, float y3, float y4) +{ + bool a = CounterClockwise(x1, x2, x3, y1, y2, y3); + bool b = CounterClockwise(x1, x2, x4, y1, y2, y4); + bool c = CounterClockwise(x3, x4, x1, y3, y4, y1); + bool d = CounterClockwise(x3, x4, x2, y3, y4, y2); + + return (a != b) && (c != d); +} + +static bool IntersectBox(matrix4 transform, float x1, float x2, float y1, + float y2) +{ + float x3, x4, y3, y4; + + x3 = transform.t.x; + y3 = transform.t.y; + x4 = x3 + transform.x.x; + y4 = y3 + transform.x.y; + + if (IntersectLine(x1, x1, x3, x4, y1, y2, y3, y4) || + IntersectLine(x1, x2, x3, x4, y1, y1, y3, y4) || + IntersectLine(x2, x2, x3, x4, y1, y2, y3, y4) || + IntersectLine(x1, x2, x3, x4, y2, y2, y3, y4)) + return true; + + x4 = x3 + transform.y.x; + y4 = y3 + transform.y.y; + + if (IntersectLine(x1, x1, x3, x4, y1, y2, y3, y4) || + IntersectLine(x1, x2, x3, x4, y1, y1, y3, y4) || + IntersectLine(x2, x2, x3, x4, y1, y2, y3, y4) || + IntersectLine(x1, x2, x3, x4, y2, y2, y3, y4)) + return true; + + x3 = transform.t.x + transform.x.x; + y3 = transform.t.y + transform.x.y; + x4 = x3 + transform.y.x; + y4 = y3 + transform.y.y; + + if (IntersectLine(x1, x1, x3, x4, y1, y2, y3, y4) || + IntersectLine(x1, x2, x3, x4, y1, y1, y3, y4) || + IntersectLine(x2, x2, x3, x4, y1, y2, y3, y4) || + IntersectLine(x1, x2, x3, x4, y2, y2, y3, y4)) + return true; + + x3 = transform.t.x + transform.y.x; + y3 = transform.t.y + transform.y.y; + x4 = x3 + transform.x.x; + y4 = y3 + transform.x.y; + + if (IntersectLine(x1, x1, x3, x4, y1, y2, y3, y4) || + IntersectLine(x1, x2, x3, x4, y1, y1, y3, y4) || + IntersectLine(x2, x2, x3, x4, y1, y2, y3, y4) || + IntersectLine(x1, x2, x3, x4, y2, y2, y3, y4)) + return true; + + return false; +} +#undef PI + +bool OBSBasicPreview::FindSelected(obs_scene_t *scene, obs_sceneitem_t *item, + void *param) +{ + SceneFindBoxData *data = reinterpret_cast<SceneFindBoxData *>(param); + + if (obs_sceneitem_selected(item)) + data->sceneItems.push_back(item); + + UNUSED_PARAMETER(scene); + return true; +} + +static bool FindItemsInBox(obs_scene_t *scene, obs_sceneitem_t *item, + void *param) +{ + SceneFindBoxData *data = reinterpret_cast<SceneFindBoxData *>(param); + matrix4 transform; + matrix4 invTransform; + vec3 transformedPos; + vec3 pos3; + vec3 pos3_; + + float x1 = std::min(data->startPos.x, data->pos.x); + float x2 = std::max(data->startPos.x, data->pos.x); + float y1 = std::min(data->startPos.y, data->pos.y); + float y2 = std::max(data->startPos.y, data->pos.y); + + if (!SceneItemHasVideo(item)) + return true; + if (obs_sceneitem_locked(item)) + return true; + if (!obs_sceneitem_visible(item)) + return true; + + vec3_set(&pos3, data->pos.x, data->pos.y, 0.0f); + + obs_sceneitem_get_box_transform(item, &transform); + + matrix4_inv(&invTransform, &transform); + vec3_transform(&transformedPos, &pos3, &invTransform); + vec3_transform(&pos3_, &transformedPos, &transform); + + if (CloseFloat(pos3.x, pos3_.x) && CloseFloat(pos3.y, pos3_.y) && + transformedPos.x >= 0.0f && transformedPos.x <= 1.0f && + transformedPos.y >= 0.0f && transformedPos.y <= 1.0f) { + + data->sceneItems.push_back(item); + return true; + } + + if (transform.t.x > x1 && transform.t.x < x2 && transform.t.y > y1 && + transform.t.y < y2) { + + data->sceneItems.push_back(item); + return true; + } + + if (transform.t.x + transform.x.x > x1 && + transform.t.x + transform.x.x < x2 && + transform.t.y + transform.x.y > y1 && + transform.t.y + transform.x.y < y2) { + + data->sceneItems.push_back(item); + return true; + } + + if (transform.t.x + transform.y.x > x1 && + transform.t.x + transform.y.x < x2 && + transform.t.y + transform.y.y > y1 && + transform.t.y + transform.y.y < y2) { + + data->sceneItems.push_back(item); + return true; + } + + if (transform.t.x + transform.x.x + transform.y.x > x1 && + transform.t.x + transform.x.x + transform.y.x < x2 && + transform.t.y + transform.x.y + transform.y.y > y1 && + transform.t.y + transform.x.y + transform.y.y < y2) { + + data->sceneItems.push_back(item); + return true; + } + + if (transform.t.x + 0.5 * (transform.x.x + transform.y.x) > x1 && + transform.t.x + 0.5 * (transform.x.x + transform.y.x) < x2 && + transform.t.y + 0.5 * (transform.x.y + transform.y.y) > y1 && + transform.t.y + 0.5 * (transform.x.y + transform.y.y) < y2) { + + data->sceneItems.push_back(item); + return true; + } + + if (IntersectBox(transform, x1, x2, y1, y2)) { + data->sceneItems.push_back(item); + return true; + } + + UNUSED_PARAMETER(scene); + return true; +} + +void OBSBasicPreview::BoxItems(const vec2 &startPos, const vec2 &pos) +{ + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); + + OBSScene scene = main->GetCurrentScene(); + if (!scene) + return; + + SceneFindBoxData data(startPos, pos); + obs_scene_enum_items(scene, FindItemsInBox, &data); + + std::lock_guard<std::mutex> lock(selectMutex); + hoveredPreviewItems = data.sceneItems; +} + vec3 OBSBasicPreview::CalculateStretchPos(const vec3 &tl, const vec3 &br) { uint32_t alignment = obs_sceneitem_get_alignment(stretchItem); @@ -862,14 +1118,14 @@ } void OBSBasicPreview::ClampAspect(vec3 &tl, vec3 &br, vec2 &size, - const vec2 &baseSize) + const vec2 &baseSize) { - float baseAspect = baseSize.x / baseSize.y; - float aspect = size.x / size.y; + float baseAspect = baseSize.x / baseSize.y; + float aspect = size.x / size.y; uint32_t stretchFlags = (uint32_t)stretchHandle; - if (stretchHandle == ItemHandle::TopLeft || - stretchHandle == ItemHandle::TopRight || + if (stretchHandle == ItemHandle::TopLeft || + stretchHandle == ItemHandle::TopRight || stretchHandle == ItemHandle::BottomLeft || stretchHandle == ItemHandle::BottomRight) { if (aspect < baseAspect) { @@ -887,7 +1143,7 @@ } } else if (stretchHandle == ItemHandle::TopCenter || - stretchHandle == ItemHandle::BottomCenter) { + stretchHandle == ItemHandle::BottomCenter) { if ((size.y >= 0.0f && size.x >= 0.0f) || (size.y <= 0.0f && size.x <= 0.0f)) size.x = size.y * baseAspect; @@ -895,7 +1151,7 @@ size.x = size.y * baseAspect * -1.0f; } else if (stretchHandle == ItemHandle::CenterLeft || - stretchHandle == ItemHandle::CenterRight) { + stretchHandle == ItemHandle::CenterRight) { if ((size.y >= 0.0f && size.x >= 0.0f) || (size.y <= 0.0f && size.x <= 0.0f)) size.y = size.x / baseAspect; @@ -920,12 +1176,12 @@ void OBSBasicPreview::SnapStretchingToScreen(vec3 &tl, vec3 &br) { uint32_t stretchFlags = (uint32_t)stretchHandle; - vec3 newTL = GetTransformedPos(tl.x, tl.y, itemToScreen); - vec3 newTR = GetTransformedPos(br.x, tl.y, itemToScreen); - vec3 newBL = GetTransformedPos(tl.x, br.y, itemToScreen); - vec3 newBR = GetTransformedPos(br.x, br.y, itemToScreen); - vec3 boundingTL; - vec3 boundingBR; + vec3 newTL = GetTransformedPos(tl.x, tl.y, itemToScreen); + vec3 newTR = GetTransformedPos(br.x, tl.y, itemToScreen); + vec3 newBL = GetTransformedPos(tl.x, br.y, itemToScreen); + vec3 newBR = GetTransformedPos(br.x, br.y, itemToScreen); + vec3 boundingTL; + vec3 boundingBR; vec3_copy(&boundingTL, &newTL); vec3_min(&boundingTL, &boundingTL, &newTR); @@ -984,14 +1240,12 @@ vec2 max_tl; vec2 max_br; - vec2_set(&max_tl, - float(-crop.left) * scale.x, - float(-crop.top) * scale.y); - vec2_set(&max_br, - stretchItemSize.x + crop.right * scale.x, - stretchItemSize.y + crop.bottom * scale.y); + vec2_set(&max_tl, float(-crop.left) * scale.x, + float(-crop.top) * scale.y); + vec2_set(&max_br, stretchItemSize.x + crop.right * scale.x, + stretchItemSize.y + crop.bottom * scale.y); - typedef std::function<float (float, float)> minmax_func_t; + typedef std::function<float(float, float)> minmax_func_t; minmax_func_t min_x = scale.x < 0.0f ? maxfunc : minfunc; minmax_func_t min_y = scale.y < 0.0f ? maxfunc : minfunc; @@ -1021,8 +1275,8 @@ pos3.y = br.y = max_y(pos3.y, minY); } -#define ALIGN_X (ITEM_LEFT|ITEM_RIGHT) -#define ALIGN_Y (ITEM_TOP|ITEM_BOTTOM) +#define ALIGN_X (ITEM_LEFT | ITEM_RIGHT) +#define ALIGN_Y (ITEM_TOP | ITEM_BOTTOM) vec3 newPos; vec3_zero(&newPos); @@ -1049,12 +1303,14 @@ if (stretchFlags & ITEM_LEFT) crop.left += int(std::round(tl.x / scale.x)); else if (stretchFlags & ITEM_RIGHT) - crop.right += int(std::round((stretchItemSize.x - br.x) / scale.x)); + crop.right += + int(std::round((stretchItemSize.x - br.x) / scale.x)); if (stretchFlags & ITEM_TOP) crop.top += int(std::round(tl.y / scale.y)); else if (stretchFlags & ITEM_BOTTOM) - crop.bottom += int(std::round((stretchItemSize.y - br.y) / scale.y)); + crop.bottom += + int(std::round((stretchItemSize.y - br.y) / scale.y)); vec3_transform(&newPos, &newPos, &itemToScreen); newPos.x = std::round(newPos.x); @@ -1075,7 +1331,7 @@ obs_sceneitem_defer_update_begin(stretchItem); obs_sceneitem_set_crop(stretchItem, &crop); if (boundsType == OBS_BOUNDS_NONE) - obs_sceneitem_set_pos(stretchItem, (vec2*)&newPos); + obs_sceneitem_set_pos(stretchItem, (vec2 *)&newPos); obs_sceneitem_defer_update_end(stretchItem); } @@ -1109,19 +1365,20 @@ obs_source_t *source = obs_sceneitem_get_source(stretchItem); vec2 baseSize; - vec2_set(&baseSize, - float(obs_source_get_width(source)), - float(obs_source_get_height(source))); + vec2_set(&baseSize, float(obs_source_get_width(source)), + float(obs_source_get_height(source))); vec2 size; - vec2_set(&size,br. x - tl.x, br.y - tl.y); + vec2_set(&size, br.x - tl.x, br.y - tl.y); if (boundsType != OBS_BOUNDS_NONE) { if (shiftDown) ClampAspect(tl, br, size, baseSize); - if (tl.x > br.x) std::swap(tl.x, br.x); - if (tl.y > br.y) std::swap(tl.y, br.y); + if (tl.x > br.x) + std::swap(tl.x, br.x); + if (tl.y > br.y) + std::swap(tl.y, br.y); vec2_abs(&size, &size); @@ -1163,8 +1420,6 @@ return; if (mouseDown) { - hoveredPreviewItem = nullptr; - vec2 pos = GetMouseEventPos(event); if (!mouseMoved && !mouseOverItems && @@ -1177,16 +1432,18 @@ pos.y = std::round(pos.y); if (stretchHandle != ItemHandle::None) { - OBSBasic *main = reinterpret_cast<OBSBasic*>( - App()->GetMainWindow()); + selectionBox = false; + + OBSBasic *main = reinterpret_cast<OBSBasic *>( + App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); - obs_sceneitem_t *group = obs_sceneitem_get_group( - scene, stretchItem); + obs_sceneitem_t *group = + obs_sceneitem_get_group(scene, stretchItem); if (group) { vec3 group_pos; vec3_set(&group_pos, pos.x, pos.y, 0.0f); vec3_transform(&group_pos, &group_pos, - &invGroupTransform); + &invGroupTransform); pos.x = group_pos.x; pos.y = group_pos.y; } @@ -1197,23 +1454,32 @@ StretchItem(pos); } else if (mouseOverItems) { + selectionBox = false; MoveItems(pos); + } else { + selectionBox = true; + if (!mouseMoved) + DoSelect(startPos); + BoxItems(startPos, pos); } mouseMoved = true; + mousePos = pos; } else { vec2 pos = GetMouseEventPos(event); OBSSceneItem item = GetItemAtPos(pos, true); - hoveredPreviewItem = item; + std::lock_guard<std::mutex> lock(selectMutex); + hoveredPreviewItems.clear(); + hoveredPreviewItems.push_back(item); } } -void OBSBasicPreview::leaveEvent(QEvent *event) +void OBSBasicPreview::leaveEvent(QEvent *) { - hoveredPreviewItem = nullptr; - - UNUSED_PARAMETER(event); + std::lock_guard<std::mutex> lock(selectMutex); + if (!selectionBox) + hoveredPreviewItems.clear(); } static void DrawSquareAtPos(float x, float y) @@ -1230,13 +1496,13 @@ gs_matrix_translate(&pos); gs_matrix_translate3f(-HANDLE_RADIUS, -HANDLE_RADIUS, 0.0f); - gs_matrix_scale3f(HANDLE_RADIUS*2, HANDLE_RADIUS*2, 1.0f); + gs_matrix_scale3f(HANDLE_RADIUS * 2, HANDLE_RADIUS * 2, 1.0f); gs_draw(GS_TRISTRIP, 0, 0); gs_matrix_pop(); } static void DrawLine(float x1, float y1, float x2, float y2, float thickness, - vec2 scale) + vec2 scale) { float ySide = (y1 == y2) ? (y1 < 0.5f ? 1.0f : -1.0f) : 0.0f; float xSide = (x1 == x2) ? (x1 < 0.5f ? 1.0f : -1.0f) : 0.0f; @@ -1245,9 +1511,9 @@ gs_vertex2f(x1, y1); gs_vertex2f(x1 + (xSide * (thickness / scale.x)), - y1 + (ySide * (thickness / scale.y))); + y1 + (ySide * (thickness / scale.y))); gs_vertex2f(x2 + (xSide * (thickness / scale.x)), - y2 + (ySide * (thickness / scale.y))); + y2 + (ySide * (thickness / scale.y))); gs_vertex2f(x2, y2); gs_vertex2f(x1, y1); @@ -1292,14 +1558,12 @@ static inline bool crop_enabled(const obs_sceneitem_crop *crop) { - return crop->left > 0 || - crop->top > 0 || - crop->right > 0 || + return crop->left > 0 || crop->top > 0 || crop->right > 0 || crop->bottom > 0; } bool OBSBasicPreview::DrawSelectedOverflow(obs_scene_t *scene, - obs_sceneitem_t *item, void *param) + obs_sceneitem_t *item, void *param) { if (obs_sceneitem_locked(item)) return true; @@ -1308,7 +1572,7 @@ return true; bool select = config_get_bool(GetGlobalConfig(), "BasicWindow", - "OverflowSelectionHidden"); + "OverflowSelectionHidden"); if (!select && !obs_sceneitem_visible(item)) return true; @@ -1319,17 +1583,18 @@ gs_matrix_push(); gs_matrix_mul(&mat); - obs_sceneitem_group_enum_items(item, DrawSelectedOverflow, param); + obs_sceneitem_group_enum_items(item, DrawSelectedOverflow, + param); gs_matrix_pop(); } bool always = config_get_bool(GetGlobalConfig(), "BasicWindow", - "OverflowAlwaysVisible"); + "OverflowAlwaysVisible"); if (!always && !obs_sceneitem_selected(item)) return true; - OBSBasicPreview *prev = reinterpret_cast<OBSBasicPreview*>(param); + OBSBasicPreview *prev = reinterpret_cast<OBSBasicPreview *>(param); matrix4 boxTransform; matrix4 invBoxTransform; @@ -1343,14 +1608,13 @@ {{{1.f, 1.f, 0.f}}}, }; - bool visible = std::all_of(std::begin(bounds), std::end(bounds), - [&](const vec3 &b) - { - vec3 pos; - vec3_transform(&pos, &b, &boxTransform); - vec3_transform(&pos, &pos, &invBoxTransform); - return CloseFloat(pos.x, b.x) && CloseFloat(pos.y, b.y); - }); + bool visible = std::all_of( + std::begin(bounds), std::end(bounds), [&](const vec3 &b) { + vec3 pos; + vec3_transform(&pos, &b, &boxTransform); + vec3_transform(&pos, &pos, &invBoxTransform); + return CloseFloat(pos.x, b.x) && CloseFloat(pos.y, b.y); + }); if (!visible) return true; @@ -1360,9 +1624,9 @@ obs_transform_info info; obs_sceneitem_get_info(item, &info); - gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_REPEAT); - gs_eparam_t *image = gs_effect_get_param_by_name(solid, "image"); - gs_eparam_t *scale = gs_effect_get_param_by_name(solid, "scale"); + gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_REPEAT); + gs_eparam_t *image = gs_effect_get_param_by_name(solid, "image"); + gs_eparam_t *scale = gs_effect_get_param_by_name(solid, "scale"); vec2 s; vec2_set(&s, boxTransform.x.x / 96, boxTransform.y.y / 96); @@ -1389,7 +1653,7 @@ } bool OBSBasicPreview::DrawSelectedItem(obs_scene_t *scene, - obs_sceneitem_t *item, void *param) + obs_sceneitem_t *item, void *param) { if (obs_sceneitem_locked(item)) return true; @@ -1407,11 +1671,20 @@ gs_matrix_pop(); } - OBSBasicPreview *prev = reinterpret_cast<OBSBasicPreview*>(param); + OBSBasicPreview *prev = reinterpret_cast<OBSBasicPreview *>(param); OBSBasic *main = OBSBasic::Get(); - bool hovered = prev->hoveredPreviewItem == item || - prev->hoveredListItem == item; + bool hovered = false; + { + std::lock_guard<std::mutex> lock(prev->selectMutex); + for (int i = 0; i < prev->hoveredPreviewItems.size(); i++) { + if (prev->hoveredPreviewItems[i] == item) { + hovered = true; + break; + } + } + } + bool selected = obs_sceneitem_selected(item); if (!selected && !hovered) @@ -1437,14 +1710,13 @@ vec4_set(&green, 0.0f, 1.0f, 0.0f, 1.0f); vec4_set(&blue, 0.0f, 0.5f, 1.0f, 1.0f); - bool visible = std::all_of(std::begin(bounds), std::end(bounds), - [&](const vec3 &b) - { - vec3 pos; - vec3_transform(&pos, &b, &boxTransform); - vec3_transform(&pos, &pos, &invBoxTransform); - return CloseFloat(pos.x, b.x) && CloseFloat(pos.y, b.y); - }); + bool visible = std::all_of( + std::begin(bounds), std::end(bounds), [&](const vec3 &b) { + vec3 pos; + vec3_transform(&pos, &b, &boxTransform); + vec3_transform(&pos, &pos, &invBoxTransform); + return CloseFloat(pos.x, b.x) && CloseFloat(pos.y, b.y); + }); if (!visible) return true; @@ -1471,17 +1743,17 @@ gs_eparam_t *colParam = gs_effect_get_param_by_name(eff, "color"); if (info.bounds_type == OBS_BOUNDS_NONE && crop_enabled(&crop)) { -#define DRAW_SIDE(side, x1, y1, x2, y2) \ - if (hovered && !selected) \ - gs_effect_set_vec4(colParam, &blue); \ - else if (crop.side > 0) \ - gs_effect_set_vec4(colParam, &green); \ - DrawLine(x1, y1, x2, y2, HANDLE_RADIUS / 2, boxScale); \ - gs_effect_set_vec4(colParam, &red); - - DRAW_SIDE(left, 0.0f, 0.0f, 0.0f, 1.0f); - DRAW_SIDE(top, 0.0f, 0.0f, 1.0f, 0.0f); - DRAW_SIDE(right, 1.0f, 0.0f, 1.0f, 1.0f); +#define DRAW_SIDE(side, x1, y1, x2, y2) \ + if (hovered && !selected) \ + gs_effect_set_vec4(colParam, &blue); \ + else if (crop.side > 0) \ + gs_effect_set_vec4(colParam, &green); \ + DrawLine(x1, y1, x2, y2, HANDLE_RADIUS / 2, boxScale); \ + gs_effect_set_vec4(colParam, &red); + + DRAW_SIDE(left, 0.0f, 0.0f, 0.0f, 1.0f); + DRAW_SIDE(top, 0.0f, 0.0f, 1.0f, 0.0f); + DRAW_SIDE(right, 1.0f, 0.0f, 1.0f, 1.0f); DRAW_SIDE(bottom, 0.0f, 1.0f, 1.0f, 1.0f); #undef DRAW_SIDE } else { @@ -1516,13 +1788,51 @@ return true; } +bool OBSBasicPreview::DrawSelectionBox(float x1, float y1, float x2, float y2, + gs_vertbuffer_t *rectFill) +{ + x1 = std::round(x1); + x2 = std::round(x2); + y1 = std::round(y1); + y2 = std::round(y2); + + gs_effect_t *eff = gs_get_effect(); + gs_eparam_t *colParam = gs_effect_get_param_by_name(eff, "color"); + + vec4 fillColor; + vec4_set(&fillColor, 0.7f, 0.7f, 0.7f, 0.5f); + + vec4 borderColor; + vec4_set(&borderColor, 1.0f, 1.0f, 1.0f, 1.0f); + + vec2 scale; + vec2_set(&scale, std::abs(x2 - x1), std::abs(y2 - y1)); + + gs_matrix_push(); + gs_matrix_identity(); + + gs_matrix_translate3f(x1, y1, 0.0f); + gs_matrix_scale3f(x2 - x1, y2 - y1, 1.0f); + + gs_effect_set_vec4(colParam, &fillColor); + gs_load_vertexbuffer(rectFill); + gs_draw(GS_TRISTRIP, 0, 0); + + gs_effect_set_vec4(colParam, &borderColor); + DrawRect(HANDLE_RADIUS / 2, scale); + + gs_matrix_pop(); + + return true; +} + void OBSBasicPreview::DrawOverflow() { if (locked) return; bool hidden = config_get_bool(GetGlobalConfig(), "BasicWindow", - "OverflowHidden"); + "OverflowHidden"); if (hidden) return; @@ -1535,7 +1845,7 @@ overflow = gs_texture_create_from_file(path.c_str()); } - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); @@ -1558,10 +1868,10 @@ GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_DEFAULT, "DrawSceneEditing"); - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); - gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_SOLID); - gs_technique_t *tech = gs_effect_get_technique(solid, "Solid"); + gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_SOLID); + gs_technique_t *tech = gs_effect_get_technique(solid, "Solid"); vec4 color; vec4_set(&color, 1.0f, 0.0f, 0.0f, 1.0f); @@ -1579,6 +1889,26 @@ gs_matrix_pop(); } + if (selectionBox) { + if (!rectFill) { + gs_render_start(true); + + gs_vertex2f(0.0f, 0.0f); + gs_vertex2f(1.0f, 0.0f); + gs_vertex2f(1.0f, 1.0f); + gs_vertex2f(1.0f, 1.0f); + gs_vertex2f(0.0f, 0.0f); + gs_vertex2f(0.0f, 1.0f); + + rectFill = gs_render_save(); + } + + DrawSelectionBox(startPos.x * main->previewScale, + startPos.y * main->previewScale, + mousePos.x * main->previewScale, + mousePos.y * main->previewScale, rectFill); + } + gs_load_vertexbuffer(nullptr); gs_technique_end_pass(tech); @@ -1592,13 +1922,16 @@ vec2_zero(&scrollingOffset); } -void OBSBasicPreview::SetScalingLevel(int32_t newScalingLevelVal) { - float newScalingAmountVal = pow(ZOOM_SENSITIVITY, float(newScalingLevelVal)); +void OBSBasicPreview::SetScalingLevel(int32_t newScalingLevelVal) +{ + float newScalingAmountVal = + pow(ZOOM_SENSITIVITY, float(newScalingLevelVal)); scalingLevel = newScalingLevelVal; SetScalingAmount(newScalingAmountVal); } -void OBSBasicPreview::SetScalingAmount(float newScalingAmountVal) { +void OBSBasicPreview::SetScalingAmount(float newScalingAmountVal) +{ scrollingOffset.x *= newScalingAmountVal / scalingAmount; scrollingOffset.y *= newScalingAmountVal / scalingAmount; scalingAmount = newScalingAmountVal;
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-preview.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-preview.hpp
Changed
@@ -3,72 +3,84 @@ #include <obs.hpp> #include <graphics/vec2.h> #include <graphics/matrix4.h> +#include <util/threading.h> +#include <mutex> +#include <vector> #include "qt-display.hpp" #include "obs-app.hpp" class OBSBasic; class QMouseEvent; -#define ITEM_LEFT (1<<0) -#define ITEM_RIGHT (1<<1) -#define ITEM_TOP (1<<2) -#define ITEM_BOTTOM (1<<3) +#define ITEM_LEFT (1 << 0) +#define ITEM_RIGHT (1 << 1) +#define ITEM_TOP (1 << 2) +#define ITEM_BOTTOM (1 << 3) #define ZOOM_SENSITIVITY 1.125f enum class ItemHandle : uint32_t { - None = 0, - TopLeft = ITEM_TOP | ITEM_LEFT, - TopCenter = ITEM_TOP, - TopRight = ITEM_TOP | ITEM_RIGHT, - CenterLeft = ITEM_LEFT, - CenterRight = ITEM_RIGHT, - BottomLeft = ITEM_BOTTOM | ITEM_LEFT, + None = 0, + TopLeft = ITEM_TOP | ITEM_LEFT, + TopCenter = ITEM_TOP, + TopRight = ITEM_TOP | ITEM_RIGHT, + CenterLeft = ITEM_LEFT, + CenterRight = ITEM_RIGHT, + BottomLeft = ITEM_BOTTOM | ITEM_LEFT, BottomCenter = ITEM_BOTTOM, - BottomRight = ITEM_BOTTOM | ITEM_RIGHT + BottomRight = ITEM_BOTTOM | ITEM_RIGHT, }; class OBSBasicPreview : public OBSQTDisplay { Q_OBJECT friend class SourceTree; + friend class SourceTreeItem; private: obs_sceneitem_crop startCrop; - vec2 startItemPos; - vec2 cropSize; + vec2 startItemPos; + vec2 cropSize; OBSSceneItem stretchGroup; OBSSceneItem stretchItem; - ItemHandle stretchHandle = ItemHandle::None; - vec2 stretchItemSize; - matrix4 screenToItem; - matrix4 itemToScreen; - matrix4 invGroupTransform; + ItemHandle stretchHandle = ItemHandle::None; + vec2 stretchItemSize; + matrix4 screenToItem; + matrix4 itemToScreen; + matrix4 invGroupTransform; gs_texture_t *overflow = nullptr; - - vec2 startPos; - vec2 lastMoveOffset; - vec2 scrollingFrom; - vec2 scrollingOffset; - bool mouseDown = false; - bool mouseMoved = false; - bool mouseOverItems = false; - bool cropping = false; - bool locked = false; - bool scrollMode = false; - bool fixedScaling = false; - int32_t scalingLevel = 0; - float scalingAmount = 1.0f; - - obs_sceneitem_t *hoveredPreviewItem = nullptr; - obs_sceneitem_t *hoveredListItem = nullptr; + gs_vertbuffer_t *rectFill = nullptr; + + vec2 startPos; + vec2 mousePos; + vec2 lastMoveOffset; + vec2 scrollingFrom; + vec2 scrollingOffset; + bool mouseDown = false; + bool mouseMoved = false; + bool mouseOverItems = false; + bool cropping = false; + bool locked = false; + bool scrollMode = false; + bool fixedScaling = false; + bool selectionBox = false; + int32_t scalingLevel = 0; + float scalingAmount = 1.0f; + + std::vector<obs_sceneitem_t *> hoveredPreviewItems; + std::vector<obs_sceneitem_t *> selectedItems; + std::mutex selectMutex; static vec2 GetMouseEventPos(QMouseEvent *event); + static bool FindSelected(obs_scene_t *scene, obs_sceneitem_t *item, + void *param); static bool DrawSelectedOverflow(obs_scene_t *scene, - obs_sceneitem_t *item, void *param); + obs_sceneitem_t *item, void *param); static bool DrawSelectedItem(obs_scene_t *scene, obs_sceneitem_t *item, - void *param); + void *param); + static bool DrawSelectionBox(float x1, float y1, float x2, float y2, + gs_vertbuffer_t *box); static OBSSceneItem GetItemAtPos(const vec2 &pos, bool selectBelow); static bool SelectedAtPos(const vec2 &pos); @@ -88,6 +100,7 @@ static void SnapItemMovement(vec2 &offset); void MoveItems(const vec2 &pos); + void BoxItems(const vec2 &startPos, const vec2 &pos); void ProcessClick(const vec2 &pos); @@ -110,11 +123,14 @@ void DrawOverflow(); void DrawSceneEditing(); - inline void SetLocked(bool newLockedVal) {locked = newLockedVal;} - inline void ToggleLocked() {locked = !locked;} - inline bool Locked() const {return locked;} + inline void SetLocked(bool newLockedVal) { locked = newLockedVal; } + inline void ToggleLocked() { locked = !locked; } + inline bool Locked() const { return locked; } - inline void SetFixedScaling(bool newFixedScalingVal) { fixedScaling = newFixedScalingVal; } + inline void SetFixedScaling(bool newFixedScalingVal) + { + fixedScaling = newFixedScalingVal; + } inline bool IsFixedScaling() const { return fixedScaling; } void SetScalingLevel(int32_t newScalingLevelVal); @@ -123,14 +139,17 @@ inline float GetScalingAmount() const { return scalingAmount; } void ResetScrollingOffset(); - inline void SetScrollingOffset(float x, float y) {vec2_set(&scrollingOffset, x, y);} - inline float GetScrollX() const {return scrollingOffset.x;} - inline float GetScrollY() const {return scrollingOffset.y;} + inline void SetScrollingOffset(float x, float y) + { + vec2_set(&scrollingOffset, x, y); + } + inline float GetScrollX() const { return scrollingOffset.x; } + inline float GetScrollY() const { return scrollingOffset.y; } /* use libobs allocator for alignment because the matrices itemToScreen * and screenToItem may contain SSE data, which will cause SSE * instructions to crash if the data is not aligned to at least a 16 * byte boundary. */ - static inline void* operator new(size_t size) {return bmalloc(size);} - static inline void operator delete(void* ptr) {bfree(ptr);} + static inline void *operator new(size_t size) { return bmalloc(size); } + static inline void operator delete(void *ptr) { bfree(ptr); } };
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-properties.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-properties.cpp
Changed
@@ -29,39 +29,38 @@ using namespace std; -static void CreateTransitionScene(OBSSource scene, char *text, uint32_t color); +static void CreateTransitionScene(OBSSource scene, const char *text, + uint32_t color); OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_) - : QDialog (parent), - preview (new OBSQTDisplay(this)), - main (qobject_cast<OBSBasic*>(parent)), - acceptClicked (false), - source (source_), - removedSignal (obs_source_get_signal_handler(source), - "remove", OBSBasicProperties::SourceRemoved, - this), - renamedSignal (obs_source_get_signal_handler(source), - "rename", OBSBasicProperties::SourceRenamed, - this), - oldSettings (obs_data_create()), - buttonBox (new QDialogButtonBox(this)) + : QDialog(parent), + preview(new OBSQTDisplay(this)), + main(qobject_cast<OBSBasic *>(parent)), + acceptClicked(false), + source(source_), + removedSignal(obs_source_get_signal_handler(source), "remove", + OBSBasicProperties::SourceRemoved, this), + renamedSignal(obs_source_get_signal_handler(source), "rename", + OBSBasicProperties::SourceRenamed, this), + oldSettings(obs_data_create()), + buttonBox(new QDialogButtonBox(this)) { int cx = (int)config_get_int(App()->GlobalConfig(), "PropertiesWindow", - "cx"); + "cx"); int cy = (int)config_get_int(App()->GlobalConfig(), "PropertiesWindow", - "cy"); + "cy"); enum obs_source_type type = obs_source_get_type(source); buttonBox->setObjectName(QStringLiteral("buttonBox")); buttonBox->setStandardButtons(QDialogButtonBox::Ok | - QDialogButtonBox::Cancel | - QDialogButtonBox::RestoreDefaults); + QDialogButtonBox::Cancel | + QDialogButtonBox::RestoreDefaults); buttonBox->button(QDialogButtonBox::Ok)->setText(QTStr("OK")); buttonBox->button(QDialogButtonBox::Cancel)->setText(QTStr("Cancel")); - buttonBox->button(QDialogButtonBox::RestoreDefaults)-> - setText(QTStr("Defaults")); + buttonBox->button(QDialogButtonBox::RestoreDefaults) + ->setText(QTStr("Defaults")); if (cx > 400 && cy > 400) resize(cx, cy); @@ -79,14 +78,15 @@ obs_data_apply(oldSettings, settings); obs_data_release(settings); - view = new OBSPropertiesView(settings, source, - (PropertiesReloadCallback)obs_source_properties, - (PropertiesUpdateCallback)obs_source_update); + view = new OBSPropertiesView( + settings, source, + (PropertiesReloadCallback)obs_source_properties, + (PropertiesUpdateCallback)obs_source_update); view->setMinimumHeight(150); preview->setMinimumSize(20, 150); - preview->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Expanding)); + preview->setSizePolicy( + QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); // Create a QSplitter to keep a unified workflow here. windowSplitter = new QSplitter(Qt::Orientation::Vertical, this); @@ -102,8 +102,8 @@ if (type == OBS_SOURCE_TYPE_TRANSITION) { AddPreviewButton(); - connect(view, SIGNAL(PropertiesRefreshed()), - this, SLOT(AddPreviewButton())); + connect(view, SIGNAL(PropertiesRefreshed()), this, + SLOT(AddPreviewButton())); } layout()->addWidget(buttonBox); @@ -118,35 +118,35 @@ obs_source_inc_showing(source); updatePropertiesSignal.Connect(obs_source_get_signal_handler(source), - "update_properties", - OBSBasicProperties::UpdateProperties, - this); + "update_properties", + OBSBasicProperties::UpdateProperties, + this); - auto addDrawCallback = [this] () - { + auto addDrawCallback = [this]() { obs_display_add_draw_callback(preview->GetDisplay(), - OBSBasicProperties::DrawPreview, this); + OBSBasicProperties::DrawPreview, + this); }; - auto addTransitionDrawCallback = [this] () - { - obs_display_add_draw_callback(preview->GetDisplay(), + auto addTransitionDrawCallback = [this]() { + obs_display_add_draw_callback( + preview->GetDisplay(), OBSBasicProperties::DrawTransitionPreview, this); }; uint32_t caps = obs_source_get_output_flags(source); bool drawable_type = type == OBS_SOURCE_TYPE_INPUT || - type == OBS_SOURCE_TYPE_SCENE; + type == OBS_SOURCE_TYPE_SCENE; bool drawable_preview = (caps & OBS_SOURCE_VIDEO) != 0; if (drawable_preview && drawable_type) { preview->show(); connect(preview.data(), &OBSQTDisplay::DisplayCreated, - addDrawCallback); + addDrawCallback); } else if (type == OBS_SOURCE_TYPE_TRANSITION) { - sourceA = obs_source_create_private("scene", "sourceA", - nullptr); - sourceB = obs_source_create_private("scene", "sourceB", - nullptr); + sourceA = + obs_source_create_private("scene", "sourceA", nullptr); + sourceB = + obs_source_create_private("scene", "sourceB", nullptr); obs_source_release(sourceA); obs_source_release(sourceB); @@ -166,7 +166,7 @@ obs_data_t *settings = obs_source_get_settings(source); sourceClone = obs_source_create_private( - obs_source_get_id(source), "clone", settings); + obs_source_get_id(source), "clone", settings); obs_source_release(sourceClone); obs_source_inc_active(sourceClone); @@ -174,8 +174,7 @@ obs_data_release(settings); - auto updateCallback = [=]() - { + auto updateCallback = [=]() { obs_data_t *settings = obs_source_get_settings(source); obs_source_update(sourceClone, settings); @@ -210,15 +209,14 @@ void OBSBasicProperties::AddPreviewButton() { - QPushButton *playButton = new QPushButton( - QTStr("PreviewTransition"), this); + QPushButton *playButton = + new QPushButton(QTStr("PreviewTransition"), this); VScrollArea *area = view; area->widget()->layout()->addWidget(playButton); playButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - auto play = [=] () - { + auto play = [=]() { OBSSource start; OBSSource end; @@ -231,9 +229,8 @@ } obs_transition_set(sourceClone, start); - obs_transition_start(sourceClone, - OBS_TRANSITION_MODE_AUTO, - main->GetTransitionDuration(), end); + obs_transition_start(sourceClone, OBS_TRANSITION_MODE_AUTO, + main->GetTransitionDuration(), end); direction = !direction; start = nullptr; @@ -273,8 +270,8 @@ const char *text_source_id = "text_ft2_source"; #endif - obs_source_t *txtSource = obs_source_create_private(text_source_id, - name, settings); + obs_source_t *txtSource = + obs_source_create_private(text_source_id, name, settings); obs_data_release(font); obs_data_release(settings); @@ -282,28 +279,29 @@ return txtSource; } -static void CreateTransitionScene(OBSSource scene, char *text, uint32_t color) +static void CreateTransitionScene(OBSSource scene, const char *text, + uint32_t color) { obs_data_t *settings = obs_data_create(); obs_data_set_int(settings, "width", obs_source_get_width(scene)); obs_data_set_int(settings, "height", obs_source_get_height(scene)); obs_data_set_int(settings, "color", color); - obs_source_t *colorBG = obs_source_create_private("color_source", - "background", settings); + obs_source_t *colorBG = obs_source_create_private( + "color_source", "background", settings); obs_scene_add(obs_scene_from_source(scene), colorBG); obs_source_t *label = CreateLabel(text, obs_source_get_height(scene)); - obs_sceneitem_t *item = obs_scene_add(obs_scene_from_source(scene), - label); + obs_sceneitem_t *item = + obs_scene_add(obs_scene_from_source(scene), label); vec2 size; vec2_set(&size, obs_source_get_width(scene), #ifdef _WIN32 - obs_source_get_height(scene)); + obs_source_get_height(scene)); #else - obs_source_get_height(scene) * 0.8); + obs_source_get_height(scene) * 0.8); #endif obs_sceneitem_set_bounds(item, &size); @@ -316,8 +314,8 @@ void OBSBasicProperties::SourceRemoved(void *data, calldata_t *params) { - QMetaObject::invokeMethod(static_cast<OBSBasicProperties*>(data), - "close"); + QMetaObject::invokeMethod(static_cast<OBSBasicProperties *>(data), + "close"); UNUSED_PARAMETER(params); } @@ -327,14 +325,14 @@ const char *name = calldata_string(params, "new_name"); QString title = QTStr("Basic.PropertiesWindow").arg(QT_UTF8(name)); - QMetaObject::invokeMethod(static_cast<OBSBasicProperties*>(data), - "setWindowTitle", Q_ARG(QString, title)); + QMetaObject::invokeMethod(static_cast<OBSBasicProperties *>(data), + "setWindowTitle", Q_ARG(QString, title)); } void OBSBasicProperties::UpdateProperties(void *data, calldata_t *) { - QMetaObject::invokeMethod(static_cast<OBSBasicProperties*>(data)->view, - "ReloadProperties"); + QMetaObject::invokeMethod(static_cast<OBSBasicProperties *>(data)->view, + "ReloadProperties"); } void OBSBasicProperties::on_buttonBox_clicked(QAbstractButton *button) @@ -374,7 +372,7 @@ void OBSBasicProperties::DrawPreview(void *data, uint32_t cx, uint32_t cy) { - OBSBasicProperties *window = static_cast<OBSBasicProperties*>(data); + OBSBasicProperties *window = static_cast<OBSBasicProperties *>(data); if (!window->source) return; @@ -382,8 +380,8 @@ uint32_t sourceCX = max(obs_source_get_width(window->source), 1u); uint32_t sourceCY = max(obs_source_get_height(window->source), 1u); - int x, y; - int newCX, newCY; + int x, y; + int newCX, newCY; float scale; GetScaleAndCenterPos(sourceCX, sourceCY, cx, cy, x, y, scale); @@ -393,8 +391,7 @@ gs_viewport_push(); gs_projection_push(); - gs_ortho(0.0f, float(sourceCX), 0.0f, float(sourceCY), - -100.0f, 100.0f); + gs_ortho(0.0f, float(sourceCX), 0.0f, float(sourceCY), -100.0f, 100.0f); gs_set_viewport(x, y, newCX, newCY); obs_source_video_render(window->source); @@ -404,9 +401,9 @@ } void OBSBasicProperties::DrawTransitionPreview(void *data, uint32_t cx, - uint32_t cy) + uint32_t cy) { - OBSBasicProperties *window = static_cast<OBSBasicProperties*>(data); + OBSBasicProperties *window = static_cast<OBSBasicProperties *>(data); if (!window->source) return; @@ -414,8 +411,8 @@ uint32_t sourceCX = max(obs_source_get_width(window->source), 1u); uint32_t sourceCY = max(obs_source_get_height(window->source), 1u); - int x, y; - int newCX, newCY; + int x, y; + int newCX, newCY; float scale; GetScaleAndCenterPos(sourceCX, sourceCY, cx, cy, x, y, scale); @@ -425,8 +422,7 @@ gs_viewport_push(); gs_projection_push(); - gs_ortho(0.0f, float(sourceCX), 0.0f, float(sourceCY), - -100.0f, 100.0f); + gs_ortho(0.0f, float(sourceCX), 0.0f, float(sourceCY), -100.0f, 100.0f); gs_set_viewport(x, y, newCX, newCY); obs_source_video_render(window->sourceClone); @@ -438,13 +434,14 @@ void OBSBasicProperties::Cleanup() { config_set_int(App()->GlobalConfig(), "PropertiesWindow", "cx", - width()); + width()); config_set_int(App()->GlobalConfig(), "PropertiesWindow", "cy", - height()); + height()); obs_display_remove_draw_callback(preview->GetDisplay(), - OBSBasicProperties::DrawPreview, this); - obs_display_remove_draw_callback(preview->GetDisplay(), + OBSBasicProperties::DrawPreview, this); + obs_display_remove_draw_callback( + preview->GetDisplay(), OBSBasicProperties::DrawTransitionPreview, this); } @@ -497,11 +494,10 @@ { QMessageBox::StandardButton button; - button = OBSMessageBox::question(this, - QTStr("Basic.PropertiesWindow.ConfirmTitle"), - QTStr("Basic.PropertiesWindow.Confirm"), - QMessageBox::Save | QMessageBox::Discard | - QMessageBox::Cancel); + button = OBSMessageBox::question( + this, QTStr("Basic.PropertiesWindow.ConfirmTitle"), + QTStr("Basic.PropertiesWindow.Confirm"), + QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); switch (button) { case QMessageBox::Save:
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-properties.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-properties.hpp
Changed
@@ -33,32 +33,31 @@ private: QPointer<OBSQTDisplay> preview; - OBSBasic *main; - bool acceptClicked; - - OBSSource source; - OBSSignal removedSignal; - OBSSignal renamedSignal; - OBSSignal updatePropertiesSignal; - OBSData oldSettings; + OBSBasic *main; + bool acceptClicked; + + OBSSource source; + OBSSignal removedSignal; + OBSSignal renamedSignal; + OBSSignal updatePropertiesSignal; + OBSData oldSettings; OBSPropertiesView *view; QDialogButtonBox *buttonBox; QSplitter *windowSplitter; - OBSSource sourceA; - OBSSource sourceB; - OBSSource sourceClone; - bool direction = true; + OBSSource sourceA; + OBSSource sourceB; + OBSSource sourceClone; + bool direction = true; static void SourceRemoved(void *data, calldata_t *params); static void SourceRenamed(void *data, calldata_t *params); static void UpdateProperties(void *data, calldata_t *params); static void DrawPreview(void *data, uint32_t cx, uint32_t cy); - static void DrawTransitionPreview(void *data, uint32_t cx, - uint32_t cy); + static void DrawTransitionPreview(void *data, uint32_t cx, uint32_t cy); void UpdateCallback(void *obj, obs_data_t *settings); bool ConfirmQuit(); - int CheckSettings(); + int CheckSettings(); void Cleanup(); private slots:
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-settings-stream.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-settings-stream.cpp
Changed
@@ -14,7 +14,7 @@ struct QCef; struct QCefCookieManager; -extern QCef *cef; +extern QCef *cef; extern QCefCookieManager *panel_cookies; enum class ListOpt : int { @@ -54,10 +54,10 @@ LoadServices(false); - connect(ui->service, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateServerList())); - connect(ui->service, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateKeyLink())); + connect(ui->service, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateServerList())); + connect(ui->service, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateKeyLink())); } void OBSBasicSettings::LoadStream1Settings() @@ -78,8 +78,10 @@ ui->customServer->setText(server); bool use_auth = obs_data_get_bool(settings, "use_auth"); - const char *username = obs_data_get_string(settings, "username"); - const char *password = obs_data_get_string(settings, "password"); + const char *username = + obs_data_get_string(settings, "username"); + const char *password = + obs_data_get_string(settings, "password"); ui->authUsername->setText(QT_UTF8(username)); ui->authPw->setText(QT_UTF8(password)); ui->useAuth->setChecked(use_auth); @@ -126,9 +128,7 @@ void OBSBasicSettings::SaveStream1Settings() { bool customServer = IsCustomService(); - const char *service_id = customServer - ? "rtmp_custom" - : "rtmp_common"; + const char *service_id = customServer ? "rtmp_custom" : "rtmp_common"; obs_service_t *oldService = main->GetService(); OBSData hotkeyData = obs_hotkeys_save_service(oldService); @@ -139,27 +139,30 @@ if (!customServer) { obs_data_set_string(settings, "service", - QT_TO_UTF8(ui->service->currentText())); - obs_data_set_string(settings, "server", - QT_TO_UTF8(ui->server->currentData().toString())); + QT_TO_UTF8(ui->service->currentText())); + obs_data_set_string( + settings, "server", + QT_TO_UTF8(ui->server->currentData().toString())); } else { obs_data_set_string(settings, "server", - QT_TO_UTF8(ui->customServer->text())); + QT_TO_UTF8(ui->customServer->text())); obs_data_set_bool(settings, "use_auth", - ui->useAuth->isChecked()); + ui->useAuth->isChecked()); if (ui->useAuth->isChecked()) { - obs_data_set_string(settings, "username", - QT_TO_UTF8(ui->authUsername->text())); + obs_data_set_string( + settings, "username", + QT_TO_UTF8(ui->authUsername->text())); obs_data_set_string(settings, "password", - QT_TO_UTF8(ui->authPw->text())); + QT_TO_UTF8(ui->authPw->text())); } } - obs_data_set_bool(settings, "bwtest", ui->bandwidthTestEnable->isChecked()); + obs_data_set_bool(settings, "bwtest", + ui->bandwidthTestEnable->isChecked()); obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text())); - OBSService newService = obs_service_create(service_id, - "default_service", settings, hotkeyData); + OBSService newService = obs_service_create( + service_id, "default_service", settings, hotkeyData); obs_service_release(newService); if (!newService) @@ -185,13 +188,29 @@ text += " <a href=\"https://"; text += "www.twitch.tv/broadcast/dashboard/streamkey"; text += "\">"; - text += QTStr("Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); + text += QTStr( + "Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); text += "</a>"; } else if (serviceName == "YouTube / YouTube Gaming") { text += " <a href=\"https://"; text += "www.youtube.com/live_dashboard"; text += "\">"; - text += QTStr("Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); + text += QTStr( + "Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); + text += "</a>"; + } else if (serviceName.startsWith("Restream.io")) { + text += " <a href=\"https://"; + text += "restream.io/settings/streaming-setup?from=OBS"; + text += "\">"; + text += QTStr( + "Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); + text += "</a>"; + } else if (serviceName == "Facebook Live") { + text += " <a href=\"https://"; + text += "www.facebook.com/live/create"; + text += "\">"; + text += QTStr( + "Basic.AutoConfig.StreamPage.StreamKey.LinkToSite"); text += "</a>"; } @@ -234,9 +253,9 @@ QVariant((int)ListOpt::ShowAll)); } - ui->service->insertItem(0, - QTStr("Basic.AutoConfig.StreamPage.Service.Custom"), - QVariant((int)ListOpt::Custom)); + ui->service->insertItem( + 0, QTStr("Basic.AutoConfig.StreamPage.Service.Custom"), + QVariant((int)ListOpt::Custom)); if (!lastService.isEmpty()) { int idx = ui->service->findText(lastService); @@ -256,8 +275,8 @@ void OBSBasicSettings::on_service_currentIndexChanged(int) { - bool showMore = - ui->service->currentData().toInt() == (int)ListOpt::ShowAll; + bool showMore = ui->service->currentData().toInt() == + (int)ListOpt::ShowAll; if (showMore) return; @@ -273,8 +292,8 @@ QString key = ui->key->text(); bool can_auth = is_auth_service(service); int page = can_auth && (!loading || key.isEmpty()) - ? (int)Section::Connect - : (int)Section::StreamKey; + ? (int)Section::Connect + : (int)Section::StreamKey; ui->streamStackWidget->setCurrentIndex(page); ui->streamKeyWidget->setVisible(true); @@ -296,7 +315,7 @@ if (custom) { ui->streamkeyPageLayout->insertRow(1, ui->serverLabel, - ui->serverStackedWidget); + ui->serverStackedWidget); ui->serverStackedWidget->setCurrentIndex(1); ui->serverStackedWidget->setVisible(true); @@ -320,8 +339,8 @@ void OBSBasicSettings::UpdateServerList() { QString serviceName = ui->service->currentText(); - bool showMore = - ui->service->currentData().toInt() == (int)ListOpt::ShowAll; + bool showMore = ui->service->currentData().toInt() == + (int)ListOpt::ShowAll; if (showMore) { LoadServices(true); @@ -386,17 +405,18 @@ if (!custom) { obs_data_set_string(settings, "service", - QT_TO_UTF8(ui->service->currentText())); - obs_data_set_string(settings, "server", - QT_TO_UTF8(ui->server->currentData().toString())); + QT_TO_UTF8(ui->service->currentText())); + obs_data_set_string( + settings, "server", + QT_TO_UTF8(ui->server->currentData().toString())); } else { obs_data_set_string(settings, "server", - QT_TO_UTF8(ui->customServer->text())); + QT_TO_UTF8(ui->customServer->text())); } obs_data_set_string(settings, "key", QT_TO_UTF8(ui->key->text())); - OBSService newService = obs_service_create(service_id, - "temp_service", settings, nullptr); + OBSService newService = obs_service_create(service_id, "temp_service", + settings, nullptr); obs_service_release(newService); return newService; @@ -405,7 +425,7 @@ void OBSBasicSettings::OnOAuthStreamKeyConnected() { #ifdef BROWSER_AVAILABLE - OAuthStreamKey *a = reinterpret_cast<OAuthStreamKey*>(auth.get()); + OAuthStreamKey *a = reinterpret_cast<OAuthStreamKey *>(auth.get()); if (a) { bool validKey = !a->key().empty(); @@ -461,9 +481,8 @@ { QMessageBox::StandardButton button; - button = OBSMessageBox::question(this, - QTStr(DISCONNECT_COMFIRM_TITLE), - QTStr(DISCONNECT_COMFIRM_TEXT)); + button = OBSMessageBox::question(this, QTStr(DISCONNECT_COMFIRM_TITLE), + QTStr(DISCONNECT_COMFIRM_TEXT)); if (button == QMessageBox::No) { return;
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-settings.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-settings.cpp
Changed
@@ -65,8 +65,10 @@ inline FormatDesc() = default; inline FormatDesc(const char *name, const char *mimeType, - const ff_format_desc *desc = nullptr) - : name(name), mimeType(mimeType), desc(desc) {} + const ff_format_desc *desc = nullptr) + : name(name), mimeType(mimeType), desc(desc) + { + } bool operator==(const FormatDesc &f) const { @@ -154,12 +156,12 @@ } static inline bool SetInvalidValue(QComboBox *combo, const char *name, - const char *data = nullptr) + const char *data = nullptr) { combo->insertItem(0, name, data); QStandardItemModel *model = - dynamic_cast<QStandardItemModel*>(combo->model()); + dynamic_cast<QStandardItemModel *>(combo->model()); if (!model) return false; @@ -182,7 +184,7 @@ static int FindEncoder(QComboBox *combo, const char *name, int id) { CodecDesc codecDesc(name, id); - for(int i = 0; i < combo->count(); i++) { + for (int i = 0; i < combo->count(); i++) { QVariant v = combo->itemData(i); if (!v.isNull()) { if (codecDesc == v.value<CodecDesc>()) { @@ -195,7 +197,7 @@ } static CodecDesc GetDefaultCodecDesc(const ff_format_desc *formatDesc, - ff_codec_type codecType) + ff_codec_type codecType) { int id = 0; switch (codecType) { @@ -210,7 +212,7 @@ } return CodecDesc(ff_format_desc_get_default_name(formatDesc, codecType), - id); + id); } #ifdef _WIN32 @@ -220,7 +222,7 @@ } #endif -static void PopulateAACBitrates(initializer_list<QComboBox*> boxes) +static void PopulateAACBitrates(initializer_list<QComboBox *> boxes) { auto &bitrateMap = GetAACEncoderBitrateMap(); if (bitrateMap.empty()) @@ -229,7 +231,7 @@ vector<pair<QString, QString>> pairs; for (auto &entry : bitrateMap) pairs.emplace_back(QString::number(entry.first), - obs_encoder_get_display_name(entry.second)); + obs_encoder_get_display_name(entry.second)); for (auto box : boxes) { QString currentText = box->currentText(); @@ -238,23 +240,23 @@ for (auto &pair : pairs) { box->addItem(pair.first); box->setItemData(box->count() - 1, pair.second, - Qt::ToolTipRole); + Qt::ToolTipRole); } box->setCurrentText(currentText); } } -void RestrictResetBitrates(initializer_list<QComboBox*> boxes, - int maxbitrate); +void RestrictResetBitrates(initializer_list<QComboBox *> boxes, int maxbitrate); void OBSBasicSettings::HookWidget(QWidget *widget, const char *signal, - const char *slot) + const char *slot) { QObject::connect(widget, signal, this, slot); widget->setProperty("changed", QVariant(false)); } +/* clang-format off */ #define COMBO_CHANGED SIGNAL(currentIndexChanged(int)) #define EDIT_CHANGED SIGNAL(textChanged(const QString &)) #define CBEDIT_CHANGED SIGNAL(editTextChanged(const QString &)) @@ -273,11 +275,12 @@ #define VIDEO_CHANGED SLOT(VideoChanged()) #define ADV_CHANGED SLOT(AdvancedChanged()) #define ADV_RESTART SLOT(AdvancedChangedRestart()) +/* clang-format on */ OBSBasicSettings::OBSBasicSettings(QWidget *parent) - : QDialog (parent), - main (qobject_cast<OBSBasic*>(parent)), - ui (new Ui::OBSBasicSettings) + : QDialog(parent), + main(qobject_cast<OBSBasic *>(parent)), + ui(new Ui::OBSBasicSettings) { string path; @@ -289,19 +292,21 @@ main->EnableOutputs(false); - PopulateAACBitrates({ui->simpleOutputABitrate, - ui->advOutTrack1Bitrate, ui->advOutTrack2Bitrate, - ui->advOutTrack3Bitrate, ui->advOutTrack4Bitrate, - ui->advOutTrack5Bitrate, ui->advOutTrack6Bitrate}); + PopulateAACBitrates({ui->simpleOutputABitrate, ui->advOutTrack1Bitrate, + ui->advOutTrack2Bitrate, ui->advOutTrack3Bitrate, + ui->advOutTrack4Bitrate, ui->advOutTrack5Bitrate, + ui->advOutTrack6Bitrate}); ui->listWidget->setAttribute(Qt::WA_MacShowFocusRect, false); + /* clang-format off */ HookWidget(ui->language, COMBO_CHANGED, GENERAL_CHANGED); HookWidget(ui->theme, COMBO_CHANGED, GENERAL_CHANGED); HookWidget(ui->enableAutoUpdates, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->openStatsOnStartup, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->warnBeforeStreamStart,CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->warnBeforeStreamStop, CHECK_CHANGED, GENERAL_CHANGED); + HookWidget(ui->warnBeforeRecordStop, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->hideProjectorCursor, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->projectorAlwaysOnTop, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->recordWhenStreaming, CHECK_CHANGED, GENERAL_CHANGED); @@ -459,8 +464,20 @@ HookWidget(ui->bindToIP, COMBO_CHANGED, ADV_CHANGED); HookWidget(ui->enableNewSocketLoop, CHECK_CHANGED, ADV_CHANGED); HookWidget(ui->enableLowLatencyMode, CHECK_CHANGED, ADV_CHANGED); - HookWidget(ui->disableFocusHotkeys, CHECK_CHANGED, ADV_CHANGED); + HookWidget(ui->hotkeyFocusType, COMBO_CHANGED, ADV_CHANGED); HookWidget(ui->autoRemux, CHECK_CHANGED, ADV_CHANGED); + HookWidget(ui->dynBitrate, CHECK_CHANGED, ADV_CHANGED); + /* clang-format on */ + +#define ADD_HOTKEY_FOCUS_TYPE(s) \ + ui->hotkeyFocusType->addItem( \ + QTStr("Basic.Settings.Advanced.Hotkeys." s), s) + + ADD_HOTKEY_FOCUS_TYPE("NeverDisableHotkeys"); + ADD_HOTKEY_FOCUS_TYPE("DisableHotkeysInFocus"); + ADD_HOTKEY_FOCUS_TYPE("DisableHotkeysOutOfFocus"); + +#undef ADD_HOTKEY_FOCUS_TYPE ui->simpleOutputVBitrate->setSingleStep(50); ui->simpleOutputVBitrate->setSuffix(" Kbps"); @@ -482,30 +499,29 @@ uint32_t winVer = GetWindowsVersion(); if (winVer > 0 && winVer < 0x602) { toggleAero = new QCheckBox( - QTStr("Basic.Settings.Video.DisableAero"), - this); - QFormLayout *videoLayout = - reinterpret_cast<QFormLayout*>(ui->videoPage->layout()); + QTStr("Basic.Settings.Video.DisableAero"), this); + QFormLayout *videoLayout = reinterpret_cast<QFormLayout *>( + ui->videoPage->layout()); videoLayout->addRow(nullptr, toggleAero); HookWidget(toggleAero, CHECK_CHANGED, VIDEO_CHANGED); - connect(toggleAero, &QAbstractButton::toggled, - this, &OBSBasicSettings::ToggleDisableAero); + connect(toggleAero, &QAbstractButton::toggled, this, + &OBSBasicSettings::ToggleDisableAero); } -#define PROCESS_PRIORITY(val) \ - {"Basic.Settings.Advanced.General.ProcessPriority." ## val , val} +#define PROCESS_PRIORITY(val) \ + { \ + "Basic.Settings.Advanced.General.ProcessPriority."##val, val \ + } static struct ProcessPriority { const char *name; const char *val; - } processPriorities[] = { - PROCESS_PRIORITY("High"), - PROCESS_PRIORITY("AboveNormal"), - PROCESS_PRIORITY("Normal"), - PROCESS_PRIORITY("BelowNormal"), - PROCESS_PRIORITY("Idle") - }; + } processPriorities[] = {PROCESS_PRIORITY("High"), + PROCESS_PRIORITY("AboveNormal"), + PROCESS_PRIORITY("Normal"), + PROCESS_PRIORITY("BelowNormal"), + PROCESS_PRIORITY("Idle")}; #undef PROCESS_PRIORITY for (ProcessPriority pri : processPriorities) @@ -549,26 +565,26 @@ ui->resetOSXVSync = nullptr; #endif - connect(ui->streamDelaySec, SIGNAL(valueChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); - connect(ui->outputMode, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); - connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); + connect(ui->streamDelaySec, SIGNAL(valueChanged(int)), this, + SLOT(UpdateStreamDelayEstimate())); + connect(ui->outputMode, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateStreamDelayEstimate())); + connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), this, + SLOT(UpdateStreamDelayEstimate())); connect(ui->simpleOutputABitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); - connect(ui->advOutTrack1Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); - connect(ui->advOutTrack2Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); - connect(ui->advOutTrack3Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); - connect(ui->advOutTrack4Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); - connect(ui->advOutTrack5Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); - connect(ui->advOutTrack6Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(UpdateStreamDelayEstimate())); + this, SLOT(UpdateStreamDelayEstimate())); + connect(ui->advOutTrack1Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateStreamDelayEstimate())); + connect(ui->advOutTrack2Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateStreamDelayEstimate())); + connect(ui->advOutTrack3Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateStreamDelayEstimate())); + connect(ui->advOutTrack4Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateStreamDelayEstimate())); + connect(ui->advOutTrack5Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateStreamDelayEstimate())); + connect(ui->advOutTrack6Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(UpdateStreamDelayEstimate())); //Apply button disabled until change. EnableApplyButton(false); @@ -582,11 +598,10 @@ LoadColorRanges(); LoadFormats(); - auto ReloadAudioSources = [](void *data, calldata_t *param) - { - auto settings = static_cast<OBSBasicSettings*>(data); - auto source = static_cast<obs_source_t*>(calldata_ptr(param, - "source")); + auto ReloadAudioSources = [](void *data, calldata_t *param) { + auto settings = static_cast<OBSBasicSettings *>(data); + auto source = static_cast<obs_source_t *>( + calldata_ptr(param, "source")); if (!source) return; @@ -595,31 +610,31 @@ return; QMetaObject::invokeMethod(settings, "ReloadAudioSources", - Qt::QueuedConnection); + Qt::QueuedConnection); }; sourceCreated.Connect(obs_get_signal_handler(), "source_create", - ReloadAudioSources, this); + ReloadAudioSources, this); channelChanged.Connect(obs_get_signal_handler(), "channel_change", - ReloadAudioSources, this); + ReloadAudioSources, this); - auto ReloadHotkeys = [](void *data, calldata_t*) - { - auto settings = static_cast<OBSBasicSettings*>(data); + auto ReloadHotkeys = [](void *data, calldata_t *) { + auto settings = static_cast<OBSBasicSettings *>(data); QMetaObject::invokeMethod(settings, "ReloadHotkeys"); }; hotkeyRegistered.Connect(obs_get_signal_handler(), "hotkey_register", - ReloadHotkeys, this); + ReloadHotkeys, this); - auto ReloadHotkeysIgnore = [](void *data, calldata_t *param) - { - auto settings = static_cast<OBSBasicSettings*>(data); - auto key = static_cast<obs_hotkey_t*>( - calldata_ptr(param,"key")); + auto ReloadHotkeysIgnore = [](void *data, calldata_t *param) { + auto settings = static_cast<OBSBasicSettings *>(data); + auto key = + static_cast<obs_hotkey_t *>(calldata_ptr(param, "key")); QMetaObject::invokeMethod(settings, "ReloadHotkeys", - Q_ARG(obs_hotkey_id, obs_hotkey_get_id(key))); + Q_ARG(obs_hotkey_id, + obs_hotkey_get_id(key))); }; hotkeyUnregistered.Connect(obs_get_signal_handler(), - "hotkey_unregister", ReloadHotkeysIgnore, this); + "hotkey_unregister", ReloadHotkeysIgnore, + this); FillSimpleRecordingValues(); FillSimpleStreamingValues(); @@ -627,72 +642,72 @@ FillAudioMonitoringDevices(); #endif - connect(ui->channelSetup, SIGNAL(currentIndexChanged(int)), - this, SLOT(SurroundWarning(int))); - connect(ui->channelSetup, SIGNAL(currentIndexChanged(int)), - this, SLOT(SpeakerLayoutChanged(int))); - connect(ui->simpleOutRecQuality, SIGNAL(currentIndexChanged(int)), - this, SLOT(SimpleRecordingQualityChanged())); - connect(ui->simpleOutRecQuality, SIGNAL(currentIndexChanged(int)), - this, SLOT(SimpleRecordingQualityLosslessWarning(int))); - connect(ui->simpleOutRecFormat, SIGNAL(currentIndexChanged(int)), - this, SLOT(SimpleRecordingEncoderChanged())); - connect(ui->simpleOutStrEncoder, SIGNAL(currentIndexChanged(int)), - this, SLOT(SimpleStreamingEncoderChanged())); - connect(ui->simpleOutStrEncoder, SIGNAL(currentIndexChanged(int)), - this, SLOT(SimpleRecordingEncoderChanged())); - connect(ui->simpleOutRecEncoder, SIGNAL(currentIndexChanged(int)), - this, SLOT(SimpleRecordingEncoderChanged())); - connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), - this, SLOT(SimpleRecordingEncoderChanged())); + connect(ui->channelSetup, SIGNAL(currentIndexChanged(int)), this, + SLOT(SurroundWarning(int))); + connect(ui->channelSetup, SIGNAL(currentIndexChanged(int)), this, + SLOT(SpeakerLayoutChanged(int))); + connect(ui->simpleOutRecQuality, SIGNAL(currentIndexChanged(int)), this, + SLOT(SimpleRecordingQualityChanged())); + connect(ui->simpleOutRecQuality, SIGNAL(currentIndexChanged(int)), this, + SLOT(SimpleRecordingQualityLosslessWarning(int))); + connect(ui->simpleOutRecFormat, SIGNAL(currentIndexChanged(int)), this, + SLOT(SimpleRecordingEncoderChanged())); + connect(ui->simpleOutStrEncoder, SIGNAL(currentIndexChanged(int)), this, + SLOT(SimpleStreamingEncoderChanged())); + connect(ui->simpleOutStrEncoder, SIGNAL(currentIndexChanged(int)), this, + SLOT(SimpleRecordingEncoderChanged())); + connect(ui->simpleOutRecEncoder, SIGNAL(currentIndexChanged(int)), this, + SLOT(SimpleRecordingEncoderChanged())); + connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), this, + SLOT(SimpleRecordingEncoderChanged())); connect(ui->simpleOutputABitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(SimpleRecordingEncoderChanged())); - connect(ui->simpleOutAdvanced, SIGNAL(toggled(bool)), - this, SLOT(SimpleRecordingEncoderChanged())); - connect(ui->simpleOutEnforce, SIGNAL(toggled(bool)), - this, SLOT(SimpleRecordingEncoderChanged())); - connect(ui->simpleReplayBuf, SIGNAL(toggled(bool)), - this, SLOT(SimpleReplayBufferChanged())); - connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), - this, SLOT(SimpleReplayBufferChanged())); + this, SLOT(SimpleRecordingEncoderChanged())); + connect(ui->simpleOutAdvanced, SIGNAL(toggled(bool)), this, + SLOT(SimpleRecordingEncoderChanged())); + connect(ui->simpleOutEnforce, SIGNAL(toggled(bool)), this, + SLOT(SimpleRecordingEncoderChanged())); + connect(ui->simpleReplayBuf, SIGNAL(toggled(bool)), this, + SLOT(SimpleReplayBufferChanged())); + connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), this, + SLOT(SimpleReplayBufferChanged())); connect(ui->simpleOutputABitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(SimpleReplayBufferChanged())); - connect(ui->simpleRBSecMax, SIGNAL(valueChanged(int)), - this, SLOT(SimpleReplayBufferChanged())); - connect(ui->advReplayBuf, SIGNAL(toggled(bool)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutRecTrack1, SIGNAL(toggled(bool)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutRecTrack2, SIGNAL(toggled(bool)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutRecTrack3, SIGNAL(toggled(bool)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutRecTrack4, SIGNAL(toggled(bool)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutRecTrack5, SIGNAL(toggled(bool)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutRecTrack6, SIGNAL(toggled(bool)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutTrack1Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutTrack2Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutTrack3Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutTrack4Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutTrack5Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutTrack6Bitrate, SIGNAL(currentIndexChanged(int)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutRecType, SIGNAL(currentIndexChanged(int)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advOutRecEncoder, SIGNAL(currentIndexChanged(int)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->advRBSecMax, SIGNAL(valueChanged(int)), - this, SLOT(AdvReplayBufferChanged())); - connect(ui->listWidget, SIGNAL(currentRowChanged(int)), - this, SLOT(SimpleRecordingEncoderChanged())); + this, SLOT(SimpleReplayBufferChanged())); + connect(ui->simpleRBSecMax, SIGNAL(valueChanged(int)), this, + SLOT(SimpleReplayBufferChanged())); + connect(ui->advReplayBuf, SIGNAL(toggled(bool)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutRecTrack1, SIGNAL(toggled(bool)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutRecTrack2, SIGNAL(toggled(bool)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutRecTrack3, SIGNAL(toggled(bool)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutRecTrack4, SIGNAL(toggled(bool)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutRecTrack5, SIGNAL(toggled(bool)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutRecTrack6, SIGNAL(toggled(bool)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutTrack1Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutTrack2Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutTrack3Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutTrack4Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutTrack5Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutTrack6Bitrate, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutRecType, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advOutRecEncoder, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->advRBSecMax, SIGNAL(valueChanged(int)), this, + SLOT(AdvReplayBufferChanged())); + connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this, + SLOT(SimpleRecordingEncoderChanged())); // Get Bind to IP Addresses obs_properties_t *ppts = obs_get_output_properties("rtmp_output"); @@ -712,20 +727,22 @@ LoadSettings(false); // Add warning checks to advanced output recording section controls - connect(ui->advOutRecTrack1, SIGNAL(clicked()), - this, SLOT(AdvOutRecCheckWarnings())); - connect(ui->advOutRecTrack2, SIGNAL(clicked()), - this, SLOT(AdvOutRecCheckWarnings())); - connect(ui->advOutRecTrack3, SIGNAL(clicked()), - this, SLOT(AdvOutRecCheckWarnings())); - connect(ui->advOutRecTrack4, SIGNAL(clicked()), - this, SLOT(AdvOutRecCheckWarnings())); - connect(ui->advOutRecTrack5, SIGNAL(clicked()), - this, SLOT(AdvOutRecCheckWarnings())); - connect(ui->advOutRecTrack6, SIGNAL(clicked()), - this, SLOT(AdvOutRecCheckWarnings())); - connect(ui->advOutRecFormat, SIGNAL(currentIndexChanged(int)), - this, SLOT(AdvOutRecCheckWarnings())); + connect(ui->advOutRecTrack1, SIGNAL(clicked()), this, + SLOT(AdvOutRecCheckWarnings())); + connect(ui->advOutRecTrack2, SIGNAL(clicked()), this, + SLOT(AdvOutRecCheckWarnings())); + connect(ui->advOutRecTrack3, SIGNAL(clicked()), this, + SLOT(AdvOutRecCheckWarnings())); + connect(ui->advOutRecTrack4, SIGNAL(clicked()), this, + SLOT(AdvOutRecCheckWarnings())); + connect(ui->advOutRecTrack5, SIGNAL(clicked()), this, + SLOT(AdvOutRecCheckWarnings())); + connect(ui->advOutRecTrack6, SIGNAL(clicked()), this, + SLOT(AdvOutRecCheckWarnings())); + connect(ui->advOutRecFormat, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvOutRecCheckWarnings())); + connect(ui->advOutRecEncoder, SIGNAL(currentIndexChanged(int)), this, + SLOT(AdvOutRecCheckWarnings())); AdvOutRecCheckWarnings(); ui->buttonBox->button(QDialogButtonBox::Apply)->setIcon(QIcon()); @@ -736,59 +753,60 @@ UpdateAutomaticReplayBufferCheckboxes(); - App()->EnableInFocusHotkeys(false); + App()->DisableHotkeys(); } OBSBasicSettings::~OBSBasicSettings() { - bool disableHotkeysInFocus = config_get_bool(App()->GlobalConfig(), - "General", "DisableHotkeysInFocus"); delete ui->filenameFormatting->completer(); main->EnableOutputs(true); - App()->EnableInFocusHotkeys(!disableHotkeysInFocus); + + App()->UpdateHotkeyFocusSetting(); EnableThreadedMessageBoxes(false); } void OBSBasicSettings::SaveCombo(QComboBox *widget, const char *section, - const char *value) + const char *value) { if (WidgetChanged(widget)) config_set_string(main->Config(), section, value, - QT_TO_UTF8(widget->currentText())); + QT_TO_UTF8(widget->currentText())); } void OBSBasicSettings::SaveComboData(QComboBox *widget, const char *section, - const char *value) + const char *value) { if (WidgetChanged(widget)) { QString str = GetComboData(widget); config_set_string(main->Config(), section, value, - QT_TO_UTF8(str)); + QT_TO_UTF8(str)); } } void OBSBasicSettings::SaveCheckBox(QAbstractButton *widget, - const char *section, const char *value, bool invert) + const char *section, const char *value, + bool invert) { if (WidgetChanged(widget)) { bool checked = widget->isChecked(); - if (invert) checked = !checked; + if (invert) + checked = !checked; config_set_bool(main->Config(), section, value, checked); } } void OBSBasicSettings::SaveEdit(QLineEdit *widget, const char *section, - const char *value) + const char *value) { if (WidgetChanged(widget)) config_set_string(main->Config(), section, value, - QT_TO_UTF8(widget->text())); + QT_TO_UTF8(widget->text())); } void OBSBasicSettings::SaveSpinBox(QSpinBox *widget, const char *section, - const char *value) + const char *value) { if (WidgetChanged(widget)) config_set_int(main->Config(), section, value, widget->value()); @@ -799,8 +817,8 @@ void OBSBasicSettings::LoadEncoderTypes() { - const char *type; - size_t idx = 0; + const char *type; + size_t idx = 0; ui->advOutRecEncoder->addItem(TEXT_USE_STREAM_ENC, "none"); @@ -812,12 +830,12 @@ if (obs_get_encoder_type(type) != OBS_ENCODER_VIDEO) continue; - const char* streaming_codecs[] = { + const char *streaming_codecs[] = { "h264", //"hevc", }; bool is_streaming_codec = false; - for (const char* test_codec : streaming_codecs) { + for (const char *test_codec : streaming_codecs) { if (strcmp(codec, test_codec) == 0) { is_streaming_codec = true; break; @@ -836,7 +854,7 @@ } #define CS_PARTIAL_STR QTStr("Basic.Settings.Advanced.Video.ColorRange.Partial") -#define CS_FULL_STR QTStr("Basic.Settings.Advanced.Video.ColorRange.Full") +#define CS_FULL_STR QTStr("Basic.Settings.Advanced.Video.ColorRange.Full") void OBSBasicSettings::LoadColorRanges() { @@ -846,10 +864,8 @@ #define AV_FORMAT_DEFAULT_STR \ QTStr("Basic.Settings.Output.Adv.FFmpeg.FormatDefault") -#define AUDIO_STR \ - QTStr("Basic.Settings.Output.Adv.FFmpeg.FormatAudio") -#define VIDEO_STR \ - QTStr("Basic.Settings.Output.Adv.FFmpeg.FormatVideo") +#define AUDIO_STR QTStr("Basic.Settings.Output.Adv.FFmpeg.FormatAudio") +#define VIDEO_STR QTStr("Basic.Settings.Output.Adv.FFmpeg.FormatVideo") void OBSBasicSettings::LoadFormats() { @@ -858,20 +874,19 @@ formats.reset(ff_format_supported()); const ff_format_desc *format = formats.get(); - while(format != nullptr) { + while (format != nullptr) { bool audio = ff_format_desc_has_audio(format); bool video = ff_format_desc_has_video(format); FormatDesc formatDesc(ff_format_desc_name(format), - ff_format_desc_mime_type(format), - format); + ff_format_desc_mime_type(format), format); if (audio || video) { QString itemText(ff_format_desc_name(format)); if (audio ^ video) itemText += QString(" (%1)").arg( - audio ? AUDIO_STR : VIDEO_STR); + audio ? AUDIO_STR : VIDEO_STR); - ui->advOutFFFormat->addItem(itemText, - qVariantFromValue(formatDesc)); + ui->advOutFFFormat->addItem( + itemText, qVariantFromValue(formatDesc)); } format = ff_format_desc_next(format); @@ -889,10 +904,10 @@ QString itemText(ff_codec_desc_name(codec_desc)); if (ff_codec_desc_is_alias(codec_desc)) itemText += QString(" (%1)").arg( - ff_codec_desc_base_name(codec_desc)); + ff_codec_desc_base_name(codec_desc)); CodecDesc cd(ff_codec_desc_name(codec_desc), - ff_codec_desc_id(codec_desc)); + ff_codec_desc_id(codec_desc)); combo->addItem(itemText, qVariantFromValue(cd)); } @@ -901,7 +916,7 @@ QTStr("Basic.Settings.Output.Adv.FFmpeg.AVEncoderDefault") static void AddDefaultCodec(QComboBox *combo, const ff_format_desc *formatDesc, - ff_codec_type codecType) + ff_codec_type codecType) { CodecDesc cd = GetDefaultCodecDesc(formatDesc, codecType); @@ -910,7 +925,7 @@ combo->removeItem(existingIdx); combo->addItem(QString("%1 (%2)").arg(cd.name, AV_ENCODER_DEFAULT_STR), - qVariantFromValue(cd)); + qVariantFromValue(cd)); } #define AV_ENCODER_DISABLE_STR \ @@ -927,12 +942,12 @@ return; bool ignore_compatability = ui->advOutFFIgnoreCompat->isChecked(); - OBSFFCodecDesc codecDescs(ff_codec_supported(formatDesc, - ignore_compatability)); + OBSFFCodecDesc codecDescs( + ff_codec_supported(formatDesc, ignore_compatability)); const ff_codec_desc *codec = codecDescs.get(); - while(codec != nullptr) { + while (codec != nullptr) { switch (ff_codec_desc_type(codec)) { case FF_CODEC_AUDIO: AddCodec(ui->advOutFFAEncoder, codec); @@ -976,7 +991,7 @@ int idx = ui->language->count(); ui->language->addItem(QT_UTF8(locale.second.c_str()), - QT_UTF8(locale.first.c_str())); + QT_UTF8(locale.first.c_str())); if (locale.first == currentLang) ui->language->setCurrentIndex(idx); @@ -995,7 +1010,7 @@ string themeDir; char userThemeDir[512]; int ret = GetConfigPath(userThemeDir, sizeof(userThemeDir), - "obs-studio/themes/"); + "obs-studio/themes/"); GetDataFilePath("themes/", themeDir); /* Check user dir first. */ @@ -1004,7 +1019,7 @@ QDir::Files); while (it.hasNext()) { it.next(); - QString name = it.fileName().section(".",0,0); + QString name = it.fileName().section(".", 0, 0); ui->theme->addItem(name); uniqueSet.insert(name); } @@ -1017,10 +1032,10 @@ /* Check shipped themes. */ QDirIterator uIt(QString(themeDir.c_str()), QStringList() << "*.qss", - QDir::Files); + QDir::Files); while (uIt.hasNext()) { uIt.next(); - QString name = uIt.fileName().section(".",0,0); + QString name = uIt.fileName().section(".", 0, 0); if (name == DEFAULT_THEME) name = defaultTheme; @@ -1047,137 +1062,142 @@ LoadThemeList(); #if defined(_WIN32) || defined(__APPLE__) - bool enableAutoUpdates = config_get_bool(GetGlobalConfig(), - "General", "EnableAutoUpdates"); + bool enableAutoUpdates = config_get_bool(GetGlobalConfig(), "General", + "EnableAutoUpdates"); ui->enableAutoUpdates->setChecked(enableAutoUpdates); #endif - bool openStatsOnStartup = config_get_bool(main->Config(), - "General", "OpenStatsOnStartup"); + bool openStatsOnStartup = config_get_bool(main->Config(), "General", + "OpenStatsOnStartup"); ui->openStatsOnStartup->setChecked(openStatsOnStartup); - bool recordWhenStreaming = config_get_bool(GetGlobalConfig(), - "BasicWindow", "RecordWhenStreaming"); + bool recordWhenStreaming = config_get_bool( + GetGlobalConfig(), "BasicWindow", "RecordWhenStreaming"); ui->recordWhenStreaming->setChecked(recordWhenStreaming); - bool keepRecordStreamStops = config_get_bool(GetGlobalConfig(), - "BasicWindow", "KeepRecordingWhenStreamStops"); + bool keepRecordStreamStops = + config_get_bool(GetGlobalConfig(), "BasicWindow", + "KeepRecordingWhenStreamStops"); ui->keepRecordStreamStops->setChecked(keepRecordStreamStops); - bool replayWhileStreaming = config_get_bool(GetGlobalConfig(), - "BasicWindow", "ReplayBufferWhileStreaming"); + bool replayWhileStreaming = config_get_bool( + GetGlobalConfig(), "BasicWindow", "ReplayBufferWhileStreaming"); ui->replayWhileStreaming->setChecked(replayWhileStreaming); - bool keepReplayStreamStops = config_get_bool(GetGlobalConfig(), - "BasicWindow", "KeepReplayBufferStreamStops"); + bool keepReplayStreamStops = + config_get_bool(GetGlobalConfig(), "BasicWindow", + "KeepReplayBufferStreamStops"); ui->keepReplayStreamStops->setChecked(keepReplayStreamStops); - bool systemTrayEnabled = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SysTrayEnabled"); + bool systemTrayEnabled = config_get_bool( + GetGlobalConfig(), "BasicWindow", "SysTrayEnabled"); ui->systemTrayEnabled->setChecked(systemTrayEnabled); - bool systemTrayWhenStarted = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SysTrayWhenStarted"); + bool systemTrayWhenStarted = config_get_bool( + GetGlobalConfig(), "BasicWindow", "SysTrayWhenStarted"); ui->systemTrayWhenStarted->setChecked(systemTrayWhenStarted); - bool systemTrayAlways = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SysTrayMinimizeToTray"); + bool systemTrayAlways = config_get_bool( + GetGlobalConfig(), "BasicWindow", "SysTrayMinimizeToTray"); ui->systemTrayAlways->setChecked(systemTrayAlways); - bool saveProjectors = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SaveProjectors"); + bool saveProjectors = config_get_bool(GetGlobalConfig(), "BasicWindow", + "SaveProjectors"); ui->saveProjectors->setChecked(saveProjectors); - bool snappingEnabled = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SnappingEnabled"); + bool snappingEnabled = config_get_bool(GetGlobalConfig(), "BasicWindow", + "SnappingEnabled"); ui->snappingEnabled->setChecked(snappingEnabled); - bool screenSnapping = config_get_bool(GetGlobalConfig(), - "BasicWindow", "ScreenSnapping"); + bool screenSnapping = config_get_bool(GetGlobalConfig(), "BasicWindow", + "ScreenSnapping"); ui->screenSnapping->setChecked(screenSnapping); - bool centerSnapping = config_get_bool(GetGlobalConfig(), - "BasicWindow", "CenterSnapping"); + bool centerSnapping = config_get_bool(GetGlobalConfig(), "BasicWindow", + "CenterSnapping"); ui->centerSnapping->setChecked(centerSnapping); - bool sourceSnapping = config_get_bool(GetGlobalConfig(), - "BasicWindow", "SourceSnapping"); + bool sourceSnapping = config_get_bool(GetGlobalConfig(), "BasicWindow", + "SourceSnapping"); ui->sourceSnapping->setChecked(sourceSnapping); double snapDistance = config_get_double(GetGlobalConfig(), - "BasicWindow", "SnapDistance"); + "BasicWindow", "SnapDistance"); ui->snapDistance->setValue(snapDistance); - bool warnBeforeStreamStart = config_get_bool(GetGlobalConfig(), - "BasicWindow", "WarnBeforeStartingStream"); + bool warnBeforeStreamStart = config_get_bool( + GetGlobalConfig(), "BasicWindow", "WarnBeforeStartingStream"); ui->warnBeforeStreamStart->setChecked(warnBeforeStreamStart); - bool warnBeforeStreamStop = config_get_bool(GetGlobalConfig(), - "BasicWindow", "WarnBeforeStoppingStream"); + bool warnBeforeStreamStop = config_get_bool( + GetGlobalConfig(), "BasicWindow", "WarnBeforeStoppingStream"); ui->warnBeforeStreamStop->setChecked(warnBeforeStreamStop); - bool hideProjectorCursor = config_get_bool(GetGlobalConfig(), - "BasicWindow", "HideProjectorCursor"); + bool warnBeforeRecordStop = config_get_bool( + GetGlobalConfig(), "BasicWindow", "WarnBeforeStoppingRecord"); + ui->warnBeforeRecordStop->setChecked(warnBeforeRecordStop); + + bool hideProjectorCursor = config_get_bool( + GetGlobalConfig(), "BasicWindow", "HideProjectorCursor"); ui->hideProjectorCursor->setChecked(hideProjectorCursor); - bool projectorAlwaysOnTop = config_get_bool(GetGlobalConfig(), - "BasicWindow", "ProjectorAlwaysOnTop"); + bool projectorAlwaysOnTop = config_get_bool( + GetGlobalConfig(), "BasicWindow", "ProjectorAlwaysOnTop"); ui->projectorAlwaysOnTop->setChecked(projectorAlwaysOnTop); - bool overflowHide = config_get_bool(GetGlobalConfig(), - "BasicWindow", "OverflowHidden"); + bool overflowHide = config_get_bool(GetGlobalConfig(), "BasicWindow", + "OverflowHidden"); ui->overflowHide->setChecked(overflowHide); - bool overflowAlwaysVisible = config_get_bool(GetGlobalConfig(), - "BasicWindow", "OverflowAlwaysVisible"); + bool overflowAlwaysVisible = config_get_bool( + GetGlobalConfig(), "BasicWindow", "OverflowAlwaysVisible"); ui->overflowAlwaysVisible->setChecked(overflowAlwaysVisible); - bool overflowSelectionHide = config_get_bool(GetGlobalConfig(), - "BasicWindow", "OverflowSelectionHidden"); + bool overflowSelectionHide = config_get_bool( + GetGlobalConfig(), "BasicWindow", "OverflowSelectionHidden"); ui->overflowSelectionHide->setChecked(overflowSelectionHide); - bool doubleClickSwitch = config_get_bool(GetGlobalConfig(), - "BasicWindow", "TransitionOnDoubleClick"); + bool doubleClickSwitch = config_get_bool( + GetGlobalConfig(), "BasicWindow", "TransitionOnDoubleClick"); ui->doubleClickSwitch->setChecked(doubleClickSwitch); - bool studioPortraitLayout = config_get_bool(GetGlobalConfig(), - "BasicWindow", "StudioPortraitLayout"); + bool studioPortraitLayout = config_get_bool( + GetGlobalConfig(), "BasicWindow", "StudioPortraitLayout"); ui->studioPortraitLayout->setChecked(studioPortraitLayout); - bool prevProgLabels = config_get_bool(GetGlobalConfig(), - "BasicWindow", "StudioModeLabels"); + bool prevProgLabels = config_get_bool(GetGlobalConfig(), "BasicWindow", + "StudioModeLabels"); ui->prevProgLabelToggle->setChecked(prevProgLabels); - bool multiviewMouseSwitch = config_get_bool(GetGlobalConfig(), - "BasicWindow", "MultiviewMouseSwitch"); + bool multiviewMouseSwitch = config_get_bool( + GetGlobalConfig(), "BasicWindow", "MultiviewMouseSwitch"); ui->multiviewMouseSwitch->setChecked(multiviewMouseSwitch); - bool multiviewDrawNames = config_get_bool(GetGlobalConfig(), - "BasicWindow", "MultiviewDrawNames"); + bool multiviewDrawNames = config_get_bool( + GetGlobalConfig(), "BasicWindow", "MultiviewDrawNames"); ui->multiviewDrawNames->setChecked(multiviewDrawNames); - bool multiviewDrawAreas = config_get_bool(GetGlobalConfig(), - "BasicWindow", "MultiviewDrawAreas"); + bool multiviewDrawAreas = config_get_bool( + GetGlobalConfig(), "BasicWindow", "MultiviewDrawAreas"); ui->multiviewDrawAreas->setChecked(multiviewDrawAreas); - ui->multiviewLayout->addItem(QTStr( - "Basic.Settings.General.MultiviewLayout.Horizontal.Top"), - static_cast<int>(MultiviewLayout::HORIZONTAL_TOP_8_SCENES)); - ui->multiviewLayout->addItem(QTStr( - "Basic.Settings.General.MultiviewLayout.Horizontal.Bottom"), - static_cast<int>(MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES)); - ui->multiviewLayout->addItem(QTStr( - "Basic.Settings.General.MultiviewLayout.Vertical.Left"), - static_cast<int>(MultiviewLayout::VERTICAL_LEFT_8_SCENES)); - ui->multiviewLayout->addItem(QTStr( - "Basic.Settings.General.MultiviewLayout.Vertical.Right"), - static_cast<int>(MultiviewLayout::VERTICAL_RIGHT_8_SCENES)); - ui->multiviewLayout->addItem(QTStr( - "Basic.Settings.General.MultiviewLayout.Horizontal.Extended.Top"), - static_cast<int>(MultiviewLayout::HORIZONTAL_TOP_24_SCENES)); - - ui->multiviewLayout->setCurrentIndex( - config_get_int(GetGlobalConfig(), "BasicWindow", - "MultiviewLayout")); + ui->multiviewLayout->addItem( + QTStr("Basic.Settings.General.MultiviewLayout.Horizontal.Top"), + static_cast<int>(MultiviewLayout::HORIZONTAL_TOP_8_SCENES)); + ui->multiviewLayout->addItem( + QTStr("Basic.Settings.General.MultiviewLayout.Horizontal.Bottom"), + static_cast<int>(MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES)); + ui->multiviewLayout->addItem( + QTStr("Basic.Settings.General.MultiviewLayout.Vertical.Left"), + static_cast<int>(MultiviewLayout::VERTICAL_LEFT_8_SCENES)); + ui->multiviewLayout->addItem( + QTStr("Basic.Settings.General.MultiviewLayout.Vertical.Right"), + static_cast<int>(MultiviewLayout::VERTICAL_RIGHT_8_SCENES)); + ui->multiviewLayout->addItem( + QTStr("Basic.Settings.General.MultiviewLayout.Horizontal.Extended.Top"), + static_cast<int>(MultiviewLayout::HORIZONTAL_TOP_24_SCENES)); + + ui->multiviewLayout->setCurrentIndex(config_get_int( + GetGlobalConfig(), "BasicWindow", "MultiviewLayout")); loading = false; } @@ -1185,8 +1205,8 @@ void OBSBasicSettings::LoadRendererList() { #ifdef _WIN32 - const char *renderer = config_get_string(GetGlobalConfig(), "Video", - "Renderer"); + const char *renderer = + config_get_string(GetGlobalConfig(), "Video", "Renderer"); ui->renderer->addItem(QT_UTF8("Direct3D 11")); if (opt_allow_opengl || strcmp(renderer, "OpenGL") == 0) @@ -1216,22 +1236,10 @@ } /* some nice default output resolution vals */ -static const double vals[] = -{ - 1.0, - 1.25, - (1.0/0.75), - 1.5, - (1.0/0.6), - 1.75, - 2.0, - 2.25, - 2.5, - 2.75, - 3.0 -}; +static const double vals[] = {1.0, 1.25, (1.0 / 0.75), 1.5, (1.0 / 0.6), 1.75, + 2.0, 2.25, 2.5, 2.75, 3.0}; -static const size_t numVals = sizeof(vals)/sizeof(double); +static const size_t numVals = sizeof(vals) / sizeof(double); void OBSBasicSettings::ResetDownscales(uint32_t cx, uint32_t cy) { @@ -1260,8 +1268,8 @@ out_cy = cy; oldOutputRes = ui->baseResolution->lineEdit()->text(); } else { - oldOutputRes = QString::number(out_cx) + "x" + - QString::number(out_cy); + oldOutputRes = + QString::number(out_cx) + "x" + QString::number(out_cy); } for (size_t idx = 0; idx < numVals; idx++) { @@ -1296,7 +1304,7 @@ string res = ResString(cx, cy); - float baseAspect = float(cx) / float(cy); + float baseAspect = float(cx) / float(cy); float outputAspect = float(out_cx) / float(out_cy); bool closeAspect = close_float(baseAspect, outputAspect, 0.01f); @@ -1327,24 +1335,29 @@ void OBSBasicSettings::LoadDownscaleFilters() { ui->downscaleFilter->addItem( - QTStr("Basic.Settings.Video.DownscaleFilter.Bilinear"), - QT_UTF8("bilinear")); + QTStr("Basic.Settings.Video.DownscaleFilter.Bilinear"), + QT_UTF8("bilinear")); + ui->downscaleFilter->addItem( + QTStr("Basic.Settings.Video.DownscaleFilter.Area"), + QT_UTF8("area")); ui->downscaleFilter->addItem( - QTStr("Basic.Settings.Video.DownscaleFilter.Bicubic"), - QT_UTF8("bicubic")); + QTStr("Basic.Settings.Video.DownscaleFilter.Bicubic"), + QT_UTF8("bicubic")); ui->downscaleFilter->addItem( - QTStr("Basic.Settings.Video.DownscaleFilter.Lanczos"), - QT_UTF8("lanczos")); + QTStr("Basic.Settings.Video.DownscaleFilter.Lanczos"), + QT_UTF8("lanczos")); - const char *scaleType = config_get_string(main->Config(), - "Video", "ScaleType"); + const char *scaleType = + config_get_string(main->Config(), "Video", "ScaleType"); if (astrcmpi(scaleType, "bilinear") == 0) ui->downscaleFilter->setCurrentIndex(0); else if (astrcmpi(scaleType, "lanczos") == 0) - ui->downscaleFilter->setCurrentIndex(2); - else + ui->downscaleFilter->setCurrentIndex(3); + else if (astrcmpi(scaleType, "area") == 0) ui->downscaleFilter->setCurrentIndex(1); + else + ui->downscaleFilter->setCurrentIndex(2); } void OBSBasicSettings::LoadResolutionLists() @@ -1356,14 +1369,13 @@ ui->baseResolution->clear(); - auto addRes = [this] (int cx, int cy) - { + auto addRes = [this](int cx, int cy) { QString res = ResString(cx, cy).c_str(); if (ui->baseResolution->findText(res) == -1) ui->baseResolution->addItem(res); }; - for (QScreen* screen: QGuiApplication::screens()) { + for (QScreen *screen : QGuiApplication::screens()) { QSize as = screen->size(); addRes(as.width(), as.height()); } @@ -1383,11 +1395,12 @@ static inline void LoadFPSCommon(OBSBasic *main, Ui::OBSBasicSettings *ui) { - const char *val = config_get_string(main->Config(), "Video", - "FPSCommon"); + const char *val = + config_get_string(main->Config(), "Video", "FPSCommon"); int idx = ui->fpsCommon->findText(val); - if (idx == -1) idx = 4; + if (idx == -1) + idx = 4; ui->fpsCommon->setCurrentIndex(idx); } @@ -1412,9 +1425,9 @@ LoadFPSInteger(main, ui.get()); LoadFPSFraction(main, ui.get()); - uint32_t fpsType = config_get_uint(main->Config(), "Video", - "FPSType"); - if (fpsType > 2) fpsType = 0; + uint32_t fpsType = config_get_uint(main->Config(), "Video", "FPSType"); + if (fpsType > 2) + fpsType = 0; ui->fpsType->setCurrentIndex(fpsType); ui->fpsTypes->setCurrentIndex(fpsType); @@ -1427,7 +1440,7 @@ if (obs_video_active()) { ui->videoPage->setEnabled(false); ui->videoMsg->setText( - QTStr("Basic.Settings.Video.CurrentlyActive")); + QTStr("Basic.Settings.Video.CurrentlyActive")); } LoadResolutionLists(); @@ -1436,8 +1449,8 @@ #ifdef _WIN32 if (toggleAero) { - bool disableAero = config_get_bool(main->Config(), "Video", - "DisableAero"); + bool disableAero = + config_get_bool(main->Config(), "Video", "DisableAero"); toggleAero->setChecked(disableAero); aeroWasDisabled = disableAero; @@ -1449,14 +1462,8 @@ static inline bool IsSurround(const char *speakers) { - static const char *surroundLayouts[] = { - "2.1", - "4.0", - "4.1", - "5.1", - "7.1", - nullptr - }; + static const char *surroundLayouts[] = {"2.1", "4.0", "4.1", + "5.1", "7.1", nullptr}; if (!speakers || !*speakers) return false; @@ -1473,44 +1480,44 @@ void OBSBasicSettings::LoadSimpleOutputSettings() { - const char *path = config_get_string(main->Config(), "SimpleOutput", - "FilePath"); + const char *path = + config_get_string(main->Config(), "SimpleOutput", "FilePath"); bool noSpace = config_get_bool(main->Config(), "SimpleOutput", - "FileNameWithoutSpace"); - const char *format = config_get_string(main->Config(), "SimpleOutput", - "RecFormat"); - int videoBitrate = config_get_uint(main->Config(), "SimpleOutput", - "VBitrate"); - const char *streamEnc = config_get_string(main->Config(), "SimpleOutput", - "StreamEncoder"); - int audioBitrate = config_get_uint(main->Config(), "SimpleOutput", - "ABitrate"); - bool advanced = config_get_bool(main->Config(), "SimpleOutput", - "UseAdvanced"); + "FileNameWithoutSpace"); + const char *format = + config_get_string(main->Config(), "SimpleOutput", "RecFormat"); + int videoBitrate = + config_get_uint(main->Config(), "SimpleOutput", "VBitrate"); + const char *streamEnc = config_get_string( + main->Config(), "SimpleOutput", "StreamEncoder"); + int audioBitrate = + config_get_uint(main->Config(), "SimpleOutput", "ABitrate"); + bool advanced = + config_get_bool(main->Config(), "SimpleOutput", "UseAdvanced"); bool enforceBitrate = config_get_bool(main->Config(), "SimpleOutput", - "EnforceBitrate"); - const char *preset = config_get_string(main->Config(), "SimpleOutput", - "Preset"); - const char *qsvPreset = config_get_string(main->Config(), "SimpleOutput", - "QSVPreset"); + "EnforceBitrate"); + const char *preset = + config_get_string(main->Config(), "SimpleOutput", "Preset"); + const char *qsvPreset = + config_get_string(main->Config(), "SimpleOutput", "QSVPreset"); const char *nvPreset = config_get_string(main->Config(), "SimpleOutput", - "NVENCPreset"); - const char* amdPreset = config_get_string(main->Config(), "SimpleOutput", - "AMDPreset"); + "NVENCPreset"); + const char *amdPreset = + config_get_string(main->Config(), "SimpleOutput", "AMDPreset"); const char *custom = config_get_string(main->Config(), "SimpleOutput", - "x264Settings"); - const char *recQual = config_get_string(main->Config(), "SimpleOutput", - "RecQuality"); - const char *recEnc = config_get_string(main->Config(), "SimpleOutput", - "RecEncoder"); - const char *muxCustom = config_get_string(main->Config(), - "SimpleOutput", "MuxerCustom"); - bool replayBuf = config_get_bool(main->Config(), "SimpleOutput", - "RecRB"); - int rbTime = config_get_int(main->Config(), "SimpleOutput", - "RecRBTime"); - int rbSize = config_get_int(main->Config(), "SimpleOutput", - "RecRBSize"); + "x264Settings"); + const char *recQual = + config_get_string(main->Config(), "SimpleOutput", "RecQuality"); + const char *recEnc = + config_get_string(main->Config(), "SimpleOutput", "RecEncoder"); + const char *muxCustom = config_get_string( + main->Config(), "SimpleOutput", "MuxerCustom"); + bool replayBuf = + config_get_bool(main->Config(), "SimpleOutput", "RecRB"); + int rbTime = + config_get_int(main->Config(), "SimpleOutput", "RecRBTime"); + int rbSize = + config_get_int(main->Config(), "SimpleOutput", "RecRBSize"); curPreset = preset; curQSVPreset = qsvPreset; @@ -1526,30 +1533,33 @@ int idx = ui->simpleOutRecFormat->findText(format); ui->simpleOutRecFormat->setCurrentIndex(idx); - const char *speakers = config_get_string(main->Config(), "Audio", - "ChannelSetup"); + const char *speakers = + config_get_string(main->Config(), "Audio", "ChannelSetup"); // restrict list of bitrates when multichannel is OFF if (!IsSurround(speakers)) RestrictResetBitrates({ui->simpleOutputABitrate}, 320); SetComboByName(ui->simpleOutputABitrate, - std::to_string(audioBitrate).c_str()); + std::to_string(audioBitrate).c_str()); ui->simpleOutAdvanced->setChecked(advanced); ui->simpleOutEnforce->setChecked(enforceBitrate); ui->simpleOutCustom->setText(custom); idx = ui->simpleOutRecQuality->findData(QString(recQual)); - if (idx == -1) idx = 0; + if (idx == -1) + idx = 0; ui->simpleOutRecQuality->setCurrentIndex(idx); idx = ui->simpleOutStrEncoder->findData(QString(streamEnc)); - if (idx == -1) idx = 0; + if (idx == -1) + idx = 0; ui->simpleOutStrEncoder->setCurrentIndex(idx); idx = ui->simpleOutRecEncoder->findData(QString(recEnc)); - if (idx == -1) idx = 0; + if (idx == -1) + idx = 0; ui->simpleOutRecEncoder->setCurrentIndex(idx); ui->simpleOutMuxCustom->setText(muxCustom); @@ -1563,22 +1573,20 @@ void OBSBasicSettings::LoadAdvOutputStreamingSettings() { - bool rescale = config_get_bool(main->Config(), "AdvOut", - "Rescale"); - const char *rescaleRes = config_get_string(main->Config(), "AdvOut", - "RescaleRes"); - int trackIndex = config_get_int(main->Config(), "AdvOut", - "TrackIndex"); + bool rescale = config_get_bool(main->Config(), "AdvOut", "Rescale"); + const char *rescaleRes = + config_get_string(main->Config(), "AdvOut", "RescaleRes"); + int trackIndex = config_get_int(main->Config(), "AdvOut", "TrackIndex"); bool applyServiceSettings = config_get_bool(main->Config(), "AdvOut", - "ApplyServiceSettings"); + "ApplyServiceSettings"); ui->advOutApplyService->setChecked(applyServiceSettings); ui->advOutUseRescale->setChecked(rescale); ui->advOutRescale->setEnabled(rescale); ui->advOutRescale->setCurrentText(rescaleRes); - QStringList specList = QTStr("FilenameFormatting.completer").split( - QRegularExpression("\n")); + QStringList specList = QTStr("FilenameFormatting.completer") + .split(QRegularExpression("\n")); QCompleter *specCompleter = new QCompleter(specList); specCompleter->setCaseSensitivity(Qt::CaseSensitive); specCompleter->setFilterMode(Qt::MatchContains); @@ -1586,17 +1594,30 @@ ui->filenameFormatting->setToolTip(QTStr("FilenameFormatting.TT")); switch (trackIndex) { - case 1: ui->advOutTrack1->setChecked(true); break; - case 2: ui->advOutTrack2->setChecked(true); break; - case 3: ui->advOutTrack3->setChecked(true); break; - case 4: ui->advOutTrack4->setChecked(true); break; - case 5: ui->advOutTrack5->setChecked(true); break; - case 6: ui->advOutTrack6->setChecked(true); break; + case 1: + ui->advOutTrack1->setChecked(true); + break; + case 2: + ui->advOutTrack2->setChecked(true); + break; + case 3: + ui->advOutTrack3->setChecked(true); + break; + case 4: + ui->advOutTrack4->setChecked(true); + break; + case 5: + ui->advOutTrack5->setChecked(true); + break; + case 6: + ui->advOutTrack6->setChecked(true); + break; } } -OBSPropertiesView *OBSBasicSettings::CreateEncoderPropertyView( - const char *encoder, const char *path, bool changed) +OBSPropertiesView * +OBSBasicSettings::CreateEncoderPropertyView(const char *encoder, + const char *path, bool changed) { obs_data_t *settings = obs_encoder_defaults(encoder); OBSPropertiesView *view; @@ -1604,18 +1625,18 @@ if (path) { char encoderJsonPath[512]; int ret = GetProfilePath(encoderJsonPath, - sizeof(encoderJsonPath), path); + sizeof(encoderJsonPath), path); if (ret > 0) { obs_data_t *data = obs_data_create_from_json_file_safe( - encoderJsonPath, "bak"); + encoderJsonPath, "bak"); obs_data_apply(settings, data); obs_data_release(data); } } - view = new OBSPropertiesView(settings, encoder, - (PropertiesReloadCallback)obs_get_encoder_properties, - 170); + view = new OBSPropertiesView( + settings, encoder, + (PropertiesReloadCallback)obs_get_encoder_properties, 170); view->setFrameShape(QFrame::StyledPanel); view->setProperty("changed", QVariant(changed)); QObject::connect(view, SIGNAL(Changed()), this, SLOT(OutputsChanged())); @@ -1626,18 +1647,18 @@ void OBSBasicSettings::LoadAdvOutputStreamingEncoderProperties() { - const char *type = config_get_string(main->Config(), "AdvOut", - "Encoder"); + const char *type = + config_get_string(main->Config(), "AdvOut", "Encoder"); delete streamEncoderProps; - streamEncoderProps = CreateEncoderPropertyView(type, - "streamEncoder.json"); + streamEncoderProps = + CreateEncoderPropertyView(type, "streamEncoder.json"); ui->advOutputStreamTab->layout()->addWidget(streamEncoderProps); - connect(streamEncoderProps, SIGNAL(Changed()), - this, SLOT(UpdateStreamDelayEstimate())); - connect(streamEncoderProps, SIGNAL(Changed()), - this, SLOT(AdvReplayBufferChanged())); + connect(streamEncoderProps, SIGNAL(Changed()), this, + SLOT(UpdateStreamDelayEstimate())); + connect(streamEncoderProps, SIGNAL(Changed()), this, + SLOT(AdvReplayBufferChanged())); curAdvStreamEncoder = type; @@ -1647,7 +1668,7 @@ const char *name = obs_encoder_get_display_name(type); ui->advOutEncoder->insertItem(0, QT_UTF8(name), - QT_UTF8(type)); + QT_UTF8(type)); SetComboByValue(ui->advOutEncoder, type); } } @@ -1657,20 +1678,19 @@ void OBSBasicSettings::LoadAdvOutputRecordingSettings() { - const char *type = config_get_string(main->Config(), "AdvOut", - "RecType"); - const char *format = config_get_string(main->Config(), "AdvOut", - "RecFormat"); - const char *path = config_get_string(main->Config(), "AdvOut", - "RecFilePath"); + const char *type = + config_get_string(main->Config(), "AdvOut", "RecType"); + const char *format = + config_get_string(main->Config(), "AdvOut", "RecFormat"); + const char *path = + config_get_string(main->Config(), "AdvOut", "RecFilePath"); bool noSpace = config_get_bool(main->Config(), "AdvOut", - "RecFileNameWithoutSpace"); - bool rescale = config_get_bool(main->Config(), "AdvOut", - "RecRescale"); - const char *rescaleRes = config_get_string(main->Config(), "AdvOut", - "RecRescaleRes"); - const char *muxCustom = config_get_string(main->Config(), "AdvOut", - "RecMuxerCustom"); + "RecFileNameWithoutSpace"); + bool rescale = config_get_bool(main->Config(), "AdvOut", "RecRescale"); + const char *rescaleRes = + config_get_string(main->Config(), "AdvOut", "RecRescaleRes"); + const char *muxCustom = + config_get_string(main->Config(), "AdvOut", "RecMuxerCustom"); int tracks = config_get_int(main->Config(), "AdvOut", "RecTracks"); int typeIndex = (astrcmpi(type, "FFmpeg") == 0) ? 1 : 0; @@ -1684,28 +1704,28 @@ int idx = ui->advOutRecFormat->findText(format); ui->advOutRecFormat->setCurrentIndex(idx); - ui->advOutRecTrack1->setChecked(tracks & (1<<0)); - ui->advOutRecTrack2->setChecked(tracks & (1<<1)); - ui->advOutRecTrack3->setChecked(tracks & (1<<2)); - ui->advOutRecTrack4->setChecked(tracks & (1<<3)); - ui->advOutRecTrack5->setChecked(tracks & (1<<4)); - ui->advOutRecTrack6->setChecked(tracks & (1<<5)); + ui->advOutRecTrack1->setChecked(tracks & (1 << 0)); + ui->advOutRecTrack2->setChecked(tracks & (1 << 1)); + ui->advOutRecTrack3->setChecked(tracks & (1 << 2)); + ui->advOutRecTrack4->setChecked(tracks & (1 << 3)); + ui->advOutRecTrack5->setChecked(tracks & (1 << 4)); + ui->advOutRecTrack6->setChecked(tracks & (1 << 5)); } void OBSBasicSettings::LoadAdvOutputRecordingEncoderProperties() { - const char *type = config_get_string(main->Config(), "AdvOut", - "RecEncoder"); + const char *type = + config_get_string(main->Config(), "AdvOut", "RecEncoder"); delete recordEncoderProps; recordEncoderProps = nullptr; if (astrcmpi(type, "none") != 0) { - recordEncoderProps = CreateEncoderPropertyView(type, - "recordEncoder.json"); + recordEncoderProps = + CreateEncoderPropertyView(type, "recordEncoder.json"); ui->advOutRecStandard->layout()->addWidget(recordEncoderProps); - connect(recordEncoderProps, SIGNAL(Changed()), - this, SLOT(AdvReplayBufferChanged())); + connect(recordEncoderProps, SIGNAL(Changed()), this, + SLOT(AdvReplayBufferChanged())); } curAdvRecordEncoder = type; @@ -1716,18 +1736,18 @@ const char *name = obs_encoder_get_display_name(type); ui->advOutRecEncoder->insertItem(1, QT_UTF8(name), - QT_UTF8(type)); + QT_UTF8(type)); SetComboByValue(ui->advOutRecEncoder, type); } } } static void SelectFormat(QComboBox *combo, const char *name, - const char *mimeType) + const char *mimeType) { FormatDesc formatDesc(name, mimeType); - for(int i = 0; i < combo->count(); i++) { + for (int i = 0; i < combo->count(); i++) { QVariant v = combo->itemData(i); if (!v.isNull()) { if (formatDesc == v.value<FormatDesc>()) { @@ -1749,45 +1769,43 @@ void OBSBasicSettings::LoadAdvOutputFFmpegSettings() { - bool saveFile = config_get_bool(main->Config(), "AdvOut", - "FFOutputToFile"); - const char *path = config_get_string(main->Config(), "AdvOut", - "FFFilePath"); + bool saveFile = + config_get_bool(main->Config(), "AdvOut", "FFOutputToFile"); + const char *path = + config_get_string(main->Config(), "AdvOut", "FFFilePath"); bool noSpace = config_get_bool(main->Config(), "AdvOut", - "FFFileNameWithoutSpace"); + "FFFileNameWithoutSpace"); const char *url = config_get_string(main->Config(), "AdvOut", "FFURL"); - const char *format = config_get_string(main->Config(), "AdvOut", - "FFFormat"); - const char *mimeType = config_get_string(main->Config(), "AdvOut", - "FFFormatMimeType"); - const char *muxCustom = config_get_string(main->Config(), "AdvOut", - "FFMCustom"); - int videoBitrate = config_get_int(main->Config(), "AdvOut", - "FFVBitrate"); - int gopSize = config_get_int(main->Config(), "AdvOut", - "FFVGOPSize"); - bool rescale = config_get_bool(main->Config(), "AdvOut", - "FFRescale"); - bool codecCompat = config_get_bool(main->Config(), "AdvOut", - "FFIgnoreCompat"); - const char *rescaleRes = config_get_string(main->Config(), "AdvOut", - "FFRescaleRes"); - const char *vEncoder = config_get_string(main->Config(), "AdvOut", - "FFVEncoder"); - int vEncoderId = config_get_int(main->Config(), "AdvOut", - "FFVEncoderId"); - const char *vEncCustom = config_get_string(main->Config(), "AdvOut", - "FFVCustom"); - int audioBitrate = config_get_int(main->Config(), "AdvOut", - "FFABitrate"); - int audioMixes = config_get_int(main->Config(), "AdvOut", - "FFAudioMixes"); - const char *aEncoder = config_get_string(main->Config(), "AdvOut", - "FFAEncoder"); - int aEncoderId = config_get_int(main->Config(), "AdvOut", - "FFAEncoderId"); - const char *aEncCustom = config_get_string(main->Config(), "AdvOut", - "FFACustom"); + const char *format = + config_get_string(main->Config(), "AdvOut", "FFFormat"); + const char *mimeType = + config_get_string(main->Config(), "AdvOut", "FFFormatMimeType"); + const char *muxCustom = + config_get_string(main->Config(), "AdvOut", "FFMCustom"); + int videoBitrate = + config_get_int(main->Config(), "AdvOut", "FFVBitrate"); + int gopSize = config_get_int(main->Config(), "AdvOut", "FFVGOPSize"); + bool rescale = config_get_bool(main->Config(), "AdvOut", "FFRescale"); + bool codecCompat = + config_get_bool(main->Config(), "AdvOut", "FFIgnoreCompat"); + const char *rescaleRes = + config_get_string(main->Config(), "AdvOut", "FFRescaleRes"); + const char *vEncoder = + config_get_string(main->Config(), "AdvOut", "FFVEncoder"); + int vEncoderId = + config_get_int(main->Config(), "AdvOut", "FFVEncoderId"); + const char *vEncCustom = + config_get_string(main->Config(), "AdvOut", "FFVCustom"); + int audioBitrate = + config_get_int(main->Config(), "AdvOut", "FFABitrate"); + int audioMixes = + config_get_int(main->Config(), "AdvOut", "FFAudioMixes"); + const char *aEncoder = + config_get_string(main->Config(), "AdvOut", "FFAEncoder"); + int aEncoderId = + config_get_int(main->Config(), "AdvOut", "FFAEncoderId"); + const char *aEncCustom = + config_get_string(main->Config(), "AdvOut", "FFACustom"); ui->advOutFFType->setCurrentIndex(saveFile ? 0 : 1); ui->advOutFFRecPath->setText(QT_UTF8(path)); @@ -1817,30 +1835,30 @@ void OBSBasicSettings::LoadAdvOutputAudioSettings() { - int track1Bitrate = config_get_uint(main->Config(), "AdvOut", - "Track1Bitrate"); - int track2Bitrate = config_get_uint(main->Config(), "AdvOut", - "Track2Bitrate"); - int track3Bitrate = config_get_uint(main->Config(), "AdvOut", - "Track3Bitrate"); - int track4Bitrate = config_get_uint(main->Config(), "AdvOut", - "Track4Bitrate"); - int track5Bitrate = config_get_uint(main->Config(), "AdvOut", - "Track5Bitrate"); - int track6Bitrate = config_get_uint(main->Config(), "AdvOut", - "Track6Bitrate"); - const char *name1 = config_get_string(main->Config(), "AdvOut", - "Track1Name"); - const char *name2 = config_get_string(main->Config(), "AdvOut", - "Track2Name"); - const char *name3 = config_get_string(main->Config(), "AdvOut", - "Track3Name"); - const char *name4 = config_get_string(main->Config(), "AdvOut", - "Track4Name"); - const char *name5 = config_get_string(main->Config(), "AdvOut", - "Track5Name"); - const char *name6 = config_get_string(main->Config(), "AdvOut", - "Track6Name"); + int track1Bitrate = + config_get_uint(main->Config(), "AdvOut", "Track1Bitrate"); + int track2Bitrate = + config_get_uint(main->Config(), "AdvOut", "Track2Bitrate"); + int track3Bitrate = + config_get_uint(main->Config(), "AdvOut", "Track3Bitrate"); + int track4Bitrate = + config_get_uint(main->Config(), "AdvOut", "Track4Bitrate"); + int track5Bitrate = + config_get_uint(main->Config(), "AdvOut", "Track5Bitrate"); + int track6Bitrate = + config_get_uint(main->Config(), "AdvOut", "Track6Bitrate"); + const char *name1 = + config_get_string(main->Config(), "AdvOut", "Track1Name"); + const char *name2 = + config_get_string(main->Config(), "AdvOut", "Track2Name"); + const char *name3 = + config_get_string(main->Config(), "AdvOut", "Track3Name"); + const char *name4 = + config_get_string(main->Config(), "AdvOut", "Track4Name"); + const char *name5 = + config_get_string(main->Config(), "AdvOut", "Track5Name"); + const char *name6 = + config_get_string(main->Config(), "AdvOut", "Track6Name"); track1Bitrate = FindClosestAvailableAACBitrate(track1Bitrate); track2Bitrate = FindClosestAvailableAACBitrate(track2Bitrate); @@ -1850,31 +1868,30 @@ track6Bitrate = FindClosestAvailableAACBitrate(track6Bitrate); // restrict list of bitrates when multichannel is OFF - const char *speakers = config_get_string(main->Config(), "Audio", - "ChannelSetup"); + const char *speakers = + config_get_string(main->Config(), "Audio", "ChannelSetup"); // restrict list of bitrates when multichannel is OFF if (!IsSurround(speakers)) { - RestrictResetBitrates({ui->advOutTrack1Bitrate, - ui->advOutTrack2Bitrate, - ui->advOutTrack3Bitrate, - ui->advOutTrack4Bitrate, - ui->advOutTrack5Bitrate, - ui->advOutTrack6Bitrate}, 320); + RestrictResetBitrates( + {ui->advOutTrack1Bitrate, ui->advOutTrack2Bitrate, + ui->advOutTrack3Bitrate, ui->advOutTrack4Bitrate, + ui->advOutTrack5Bitrate, ui->advOutTrack6Bitrate}, + 320); } SetComboByName(ui->advOutTrack1Bitrate, - std::to_string(track1Bitrate).c_str()); + std::to_string(track1Bitrate).c_str()); SetComboByName(ui->advOutTrack2Bitrate, - std::to_string(track2Bitrate).c_str()); + std::to_string(track2Bitrate).c_str()); SetComboByName(ui->advOutTrack3Bitrate, - std::to_string(track3Bitrate).c_str()); + std::to_string(track3Bitrate).c_str()); SetComboByName(ui->advOutTrack4Bitrate, - std::to_string(track4Bitrate).c_str()); + std::to_string(track4Bitrate).c_str()); SetComboByName(ui->advOutTrack5Bitrate, - std::to_string(track5Bitrate).c_str()); + std::to_string(track5Bitrate).c_str()); SetComboByName(ui->advOutTrack6Bitrate, - std::to_string(track6Bitrate).c_str()); + std::to_string(track6Bitrate).c_str()); ui->advOutTrack1Name->setText(name1); ui->advOutTrack2Name->setText(name2); @@ -1916,12 +1933,11 @@ loading = false; } -void OBSBasicSettings::SetAdvOutputFFmpegEnablement( - ff_codec_type encoderType, bool enabled, - bool enableEncoder) +void OBSBasicSettings::SetAdvOutputFFmpegEnablement(ff_codec_type encoderType, + bool enabled, + bool enableEncoder) { - bool rescale = config_get_bool(main->Config(), "AdvOut", - "FFRescale"); + bool rescale = config_get_bool(main->Config(), "AdvOut", "FFRescale"); switch (encoderType) { case FF_CODEC_VIDEO: @@ -1948,13 +1964,13 @@ } static inline void LoadListValue(QComboBox *widget, const char *text, - const char *val) + const char *val) { widget->addItem(QT_UTF8(text), QT_UTF8(val)); } void OBSBasicSettings::LoadListValues(QComboBox *widget, obs_property_t *prop, - int index) + int index) { size_t count = obs_property_list_item_count(prop); @@ -1972,7 +1988,7 @@ for (size_t i = 0; i < count; i++) { const char *name = obs_property_list_item_name(prop, i); - const char *val = obs_property_list_item_string(prop, i); + const char *val = obs_property_list_item_string(prop, i); LoadListValue(widget, name, val); } @@ -1983,9 +1999,9 @@ widget->setCurrentIndex(idx); } else { widget->insertItem(0, - QTStr("Basic.Settings.Audio." - "UnknownAudioDevice"), - var); + QTStr("Basic.Settings.Audio." + "UnknownAudioDevice"), + var); widget->setCurrentIndex(0); } } @@ -1998,15 +2014,15 @@ void OBSBasicSettings::LoadAudioDevices() { - const char *input_id = App()->InputAudioSource(); + const char *input_id = App()->InputAudioSource(); const char *output_id = App()->OutputAudioSource(); obs_properties_t *input_props = obs_get_source_properties(input_id); obs_properties_t *output_props = obs_get_source_properties(output_id); if (input_props) { - obs_property_t *inputs = obs_properties_get(input_props, - "device_id"); + obs_property_t *inputs = + obs_properties_get(input_props, "device_id"); LoadListValues(ui->auxAudioDevice1, inputs, 3); LoadListValues(ui->auxAudioDevice2, inputs, 4); LoadListValues(ui->auxAudioDevice3, inputs, 5); @@ -2015,8 +2031,8 @@ } if (output_props) { - obs_property_t *outputs = obs_properties_get(output_props, - "device_id"); + obs_property_t *outputs = + obs_properties_get(output_props, "device_id"); LoadListValues(ui->desktopAudioDevice1, outputs, 1); LoadListValues(ui->desktopAudioDevice2, outputs, 2); obs_properties_destroy(output_props); @@ -2044,11 +2060,10 @@ ui->audioSourceLayout->addRow(widget); const char *enablePtm = Str("Basic.Settings.Audio.EnablePushToMute"); - const char *ptmDelay = Str("Basic.Settings.Audio.PushToMuteDelay"); + const char *ptmDelay = Str("Basic.Settings.Audio.PushToMuteDelay"); const char *enablePtt = Str("Basic.Settings.Audio.EnablePushToTalk"); - const char *pttDelay = Str("Basic.Settings.Audio.PushToTalkDelay"); - auto AddSource = [&](obs_source_t *source) - { + const char *pttDelay = Str("Basic.Settings.Audio.PushToTalkDelay"); + auto AddSource = [&](obs_source_t *source) { if (!(obs_source_get_output_flags(source) & OBS_SOURCE_AUDIO)) return true; @@ -2079,72 +2094,79 @@ pttSB->setValue(obs_source_get_push_to_talk_delay(source)); form->addRow(pttDelay, pttSB); - HookWidget(ptmCB, CHECK_CHANGED, AUDIO_CHANGED); + HookWidget(ptmCB, CHECK_CHANGED, AUDIO_CHANGED); HookWidget(ptmSB, SCROLL_CHANGED, AUDIO_CHANGED); - HookWidget(pttCB, CHECK_CHANGED, AUDIO_CHANGED); + HookWidget(pttCB, CHECK_CHANGED, AUDIO_CHANGED); HookWidget(pttSB, SCROLL_CHANGED, AUDIO_CHANGED); audioSourceSignals.reserve(audioSourceSignals.size() + 4); auto handler = obs_source_get_signal_handler(source); - audioSourceSignals.emplace_back(handler, "push_to_mute_changed", - [](void *data, calldata_t *param) - { - QMetaObject::invokeMethod(static_cast<QObject*>(data), - "setCheckedSilently", - Q_ARG(bool, calldata_bool(param, "enabled"))); - }, ptmCB); - audioSourceSignals.emplace_back(handler, "push_to_mute_delay", - [](void *data, calldata_t *param) - { - QMetaObject::invokeMethod(static_cast<QObject*>(data), - "setValueSilently", - Q_ARG(int, calldata_int(param, "delay"))); - }, ptmSB); - audioSourceSignals.emplace_back(handler, "push_to_talk_changed", - [](void *data, calldata_t *param) - { - QMetaObject::invokeMethod(static_cast<QObject*>(data), - "setCheckedSilently", - Q_ARG(bool, calldata_bool(param, "enabled"))); - }, pttCB); - audioSourceSignals.emplace_back(handler, "push_to_talk_delay", - [](void *data, calldata_t *param) - { - QMetaObject::invokeMethod(static_cast<QObject*>(data), - "setValueSilently", - Q_ARG(int, calldata_int(param, "delay"))); - }, pttSB); + audioSourceSignals.emplace_back( + handler, "push_to_mute_changed", + [](void *data, calldata_t *param) { + QMetaObject::invokeMethod( + static_cast<QObject *>(data), + "setCheckedSilently", + Q_ARG(bool, + calldata_bool(param, "enabled"))); + }, + ptmCB); + audioSourceSignals.emplace_back( + handler, "push_to_mute_delay", + [](void *data, calldata_t *param) { + QMetaObject::invokeMethod( + static_cast<QObject *>(data), + "setValueSilently", + Q_ARG(int, + calldata_int(param, "delay"))); + }, + ptmSB); + audioSourceSignals.emplace_back( + handler, "push_to_talk_changed", + [](void *data, calldata_t *param) { + QMetaObject::invokeMethod( + static_cast<QObject *>(data), + "setCheckedSilently", + Q_ARG(bool, + calldata_bool(param, "enabled"))); + }, + pttCB); + audioSourceSignals.emplace_back( + handler, "push_to_talk_delay", + [](void *data, calldata_t *param) { + QMetaObject::invokeMethod( + static_cast<QObject *>(data), + "setValueSilently", + Q_ARG(int, + calldata_int(param, "delay"))); + }, + pttSB); - audioSources.emplace_back(OBSGetWeakRef(source), - ptmCB, pttSB, pttCB, pttSB); + audioSources.emplace_back(OBSGetWeakRef(source), ptmCB, pttSB, + pttCB, pttSB); auto label = new OBSSourceLabel(source); label->setMinimumSize(QSize(170, 0)); - label->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); + label->setAlignment(Qt::AlignRight | Qt::AlignTrailing | + Qt::AlignVCenter); connect(label, &OBSSourceLabel::Removed, - [=]() - { - LoadAudioSources(); - }); + [=]() { LoadAudioSources(); }); connect(label, &OBSSourceLabel::Destroyed, - [=]() - { - LoadAudioSources(); - }); + [=]() { LoadAudioSources(); }); layout->addRow(label, form); return true; }; using AddSource_t = decltype(AddSource); - obs_enum_sources([](void *data, obs_source_t *source) - { - auto &AddSource = *static_cast<AddSource_t*>(data); - AddSource(source); - return true; - }, static_cast<void*>(&AddSource)); - + obs_enum_sources( + [](void *data, obs_source_t *source) { + auto &AddSource = *static_cast<AddSource_t *>(data); + AddSource(source); + return true; + }, + static_cast<void *>(&AddSource)); if (layout->rowCount() == 0) ui->audioHotkeysGroupBox->hide(); @@ -2154,14 +2176,14 @@ void OBSBasicSettings::LoadAudioSettings() { - uint32_t sampleRate = config_get_uint(main->Config(), "Audio", - "SampleRate"); - const char *speakers = config_get_string(main->Config(), "Audio", - "ChannelSetup"); - double meterDecayRate = config_get_double(main->Config(), "Audio", - "MeterDecayRate"); - uint32_t peakMeterTypeIdx = config_get_uint(main->Config(), "Audio", - "PeakMeterType"); + uint32_t sampleRate = + config_get_uint(main->Config(), "Audio", "SampleRate"); + const char *speakers = + config_get_string(main->Config(), "Audio", "ChannelSetup"); + double meterDecayRate = + config_get_double(main->Config(), "Audio", "MeterDecayRate"); + uint32_t peakMeterTypeIdx = + config_get_uint(main->Config(), "Audio", "PeakMeterType"); loading = true; @@ -2207,48 +2229,44 @@ void OBSBasicSettings::LoadAdvancedSettings() { - const char *videoColorFormat = config_get_string(main->Config(), - "Video", "ColorFormat"); - const char *videoColorSpace = config_get_string(main->Config(), - "Video", "ColorSpace"); - const char *videoColorRange = config_get_string(main->Config(), - "Video", "ColorRange"); + const char *videoColorFormat = + config_get_string(main->Config(), "Video", "ColorFormat"); + const char *videoColorSpace = + config_get_string(main->Config(), "Video", "ColorSpace"); + const char *videoColorRange = + config_get_string(main->Config(), "Video", "ColorRange"); #if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO const char *monDevName = config_get_string(main->Config(), "Audio", - "MonitoringDeviceName"); + "MonitoringDeviceName"); const char *monDevId = config_get_string(main->Config(), "Audio", - "MonitoringDeviceId"); + "MonitoringDeviceId"); #endif - bool enableDelay = config_get_bool(main->Config(), "Output", - "DelayEnable"); - int delaySec = config_get_int(main->Config(), "Output", - "DelaySec"); - bool preserveDelay = config_get_bool(main->Config(), "Output", - "DelayPreserve"); - bool reconnect = config_get_bool(main->Config(), "Output", - "Reconnect"); - int retryDelay = config_get_int(main->Config(), "Output", - "RetryDelay"); - int maxRetries = config_get_int(main->Config(), "Output", - "MaxRetries"); + bool enableDelay = + config_get_bool(main->Config(), "Output", "DelayEnable"); + int delaySec = config_get_int(main->Config(), "Output", "DelaySec"); + bool preserveDelay = + config_get_bool(main->Config(), "Output", "DelayPreserve"); + bool reconnect = config_get_bool(main->Config(), "Output", "Reconnect"); + int retryDelay = config_get_int(main->Config(), "Output", "RetryDelay"); + int maxRetries = config_get_int(main->Config(), "Output", "MaxRetries"); const char *filename = config_get_string(main->Config(), "Output", - "FilenameFormatting"); - bool overwriteIfExists = config_get_bool(main->Config(), "Output", - "OverwriteIfExists"); - const char *bindIP = config_get_string(main->Config(), "Output", - "BindIP"); + "FilenameFormatting"); + bool overwriteIfExists = + config_get_bool(main->Config(), "Output", "OverwriteIfExists"); + const char *bindIP = + config_get_string(main->Config(), "Output", "BindIP"); const char *rbPrefix = config_get_string(main->Config(), "SimpleOutput", - "RecRBPrefix"); + "RecRBPrefix"); const char *rbSuffix = config_get_string(main->Config(), "SimpleOutput", - "RecRBSuffix"); - bool replayBuf = config_get_bool(main->Config(), "AdvOut", - "RecRB"); - int rbTime = config_get_int(main->Config(), "AdvOut", - "RecRBTime"); - int rbSize = config_get_int(main->Config(), "AdvOut", - "RecRBSize"); - bool autoRemux = config_get_bool(main->Config(), "Video", - "AutoRemux"); + "RecRBSuffix"); + bool replayBuf = config_get_bool(main->Config(), "AdvOut", "RecRB"); + int rbTime = config_get_int(main->Config(), "AdvOut", "RecRBTime"); + int rbSize = config_get_int(main->Config(), "AdvOut", "RecRBSize"); + bool autoRemux = config_get_bool(main->Config(), "Video", "AutoRemux"); + const char *hotkeyFocusType = config_get_string( + App()->GlobalConfig(), "General", "HotkeyFocusType"); + bool dynBitrate = + config_get_bool(main->Config(), "Output", "DynamicBitrate"); loading = true; @@ -2276,7 +2294,7 @@ ui->streamDelayPreserve->setChecked(preserveDelay); ui->streamDelayEnable->setChecked(enableDelay); ui->autoRemux->setChecked(autoRemux); - + ui->dynBitrate->setChecked(dynBitrate); SetComboByName(ui->colorFormat, videoColorFormat); SetComboByName(ui->colorSpace, videoColorSpace); @@ -2290,24 +2308,24 @@ } #ifdef __APPLE__ - bool disableOSXVSync = config_get_bool(App()->GlobalConfig(), - "Video", "DisableOSXVSync"); - bool resetOSXVSync = config_get_bool(App()->GlobalConfig(), - "Video", "ResetOSXVSyncOnExit"); + bool disableOSXVSync = config_get_bool(App()->GlobalConfig(), "Video", + "DisableOSXVSync"); + bool resetOSXVSync = config_get_bool(App()->GlobalConfig(), "Video", + "ResetOSXVSyncOnExit"); ui->disableOSXVSync->setChecked(disableOSXVSync); ui->resetOSXVSync->setChecked(resetOSXVSync); ui->resetOSXVSync->setEnabled(disableOSXVSync); #elif _WIN32 - bool disableAudioDucking = config_get_bool(App()->GlobalConfig(), - "Audio", "DisableAudioDucking"); + bool disableAudioDucking = config_get_bool( + App()->GlobalConfig(), "Audio", "DisableAudioDucking"); ui->disableAudioDucking->setChecked(disableAudioDucking); - const char *processPriority = config_get_string(App()->GlobalConfig(), - "General", "ProcessPriority"); + const char *processPriority = config_get_string( + App()->GlobalConfig(), "General", "ProcessPriority"); bool enableNewSocketLoop = config_get_bool(main->Config(), "Output", - "NewSocketLoopEnable"); - bool enableLowLatencyMode = config_get_bool(main->Config(), "Output", - "LowLatencyEnable"); + "NewSocketLoopEnable"); + bool enableLowLatencyMode = + config_get_bool(main->Config(), "Output", "LowLatencyEnable"); int idx = ui->processPriority->findData(processPriority); if (idx == -1) @@ -2317,23 +2335,22 @@ ui->enableNewSocketLoop->setChecked(enableNewSocketLoop); ui->enableLowLatencyMode->setChecked(enableLowLatencyMode); - bool browserHWAccel = config_get_bool(App()->GlobalConfig(), - "General", "BrowserHWAccel"); + bool browserHWAccel = config_get_bool(App()->GlobalConfig(), "General", + "BrowserHWAccel"); ui->browserHWAccel->setChecked(browserHWAccel); #endif - bool disableFocusHotkeys = config_get_bool(App()->GlobalConfig(), - "General", "DisableHotkeysInFocus"); - ui->disableFocusHotkeys->setChecked(disableFocusHotkeys); + SetComboByValue(ui->hotkeyFocusType, hotkeyFocusType); loading = false; } #define TRUNCATE_TEXT_LENGTH 80 -template <typename Func> -static inline void LayoutHotkey(obs_hotkey_id id, obs_hotkey_t *key, Func &&fun, - const map<obs_hotkey_id, vector<obs_key_combination_t>> &keys) +template<typename Func> +static inline void +LayoutHotkey(obs_hotkey_id id, obs_hotkey_t *key, Func &&fun, + const map<obs_hotkey_id, vector<obs_key_combination_t>> &keys) { auto *label = new OBSHotkeyLabel; QString text = QT_UTF8(obs_hotkey_get_description(key)); @@ -2353,7 +2370,7 @@ hw = new OBSHotkeyWidget(id, obs_hotkey_get_name(key)); else hw = new OBSHotkeyWidget(id, obs_hotkey_get_name(key), - combos->second); + combos->second); hw->label = label; label->widget = hw; @@ -2361,13 +2378,13 @@ fun(key, label, hw); } -template <typename Func, typename T> +template<typename Func, typename T> static QLabel *makeLabel(T &t, Func &&getName) { return new QLabel(getName(t)); } -template <typename Func> +template<typename Func> static QLabel *makeLabel(const OBSSource &source, Func &&) { OBSSourceLabel *label = new OBSSourceLabel(source); @@ -2385,30 +2402,26 @@ return label; } -template <typename Func, typename T> -static inline void AddHotkeys(QFormLayout &layout, - Func &&getName, std::vector< - std::tuple<T, QPointer<QLabel>, QPointer<QWidget>> - > &hotkeys) +template<typename Func, typename T> +static inline void AddHotkeys( + QFormLayout &layout, Func &&getName, + std::vector<std::tuple<T, QPointer<QLabel>, QPointer<QWidget>>> &hotkeys) { if (hotkeys.empty()) return; layout.setItem(layout.rowCount(), QFormLayout::SpanningRole, - new QSpacerItem(0, 10)); + new QSpacerItem(0, 10)); - using tuple_type = - std::tuple<T, QPointer<QLabel>, QPointer<QWidget>>; + using tuple_type = std::tuple<T, QPointer<QLabel>, QPointer<QWidget>>; stable_sort(begin(hotkeys), end(hotkeys), - [&](const tuple_type &a, const tuple_type &b) - { - const auto &o_a = get<0>(a); - const auto &o_b = get<0>(b); - return o_a != o_b && - string(getName(o_a)) < - getName(o_b); - }); + [&](const tuple_type &a, const tuple_type &b) { + const auto &o_a = get<0>(a); + const auto &o_b = get<0>(b); + return o_a != o_b && + string(getName(o_a)) < getName(o_b); + }); string prevName; for (const auto &hotkey : hotkeys) { @@ -2417,8 +2430,8 @@ if (prevName != name) { prevName = name; layout.setItem(layout.rowCount(), - QFormLayout::SpanningRole, - new QSpacerItem(0, 10)); + QFormLayout::SpanningRole, + new QSpacerItem(0, 10)); layout.addRow(makeLabel(o, getName)); } @@ -2435,22 +2448,24 @@ using keys_t = map<obs_hotkey_id, vector<obs_key_combination_t>>; keys_t keys; - obs_enum_hotkey_bindings([](void *data, - size_t, obs_hotkey_binding_t *binding) - { - auto &keys = *static_cast<keys_t*>(data); - - keys[obs_hotkey_binding_get_hotkey_id(binding)].emplace_back( - obs_hotkey_binding_get_key_combination(binding)); + obs_enum_hotkey_bindings( + [](void *data, size_t, obs_hotkey_binding_t *binding) { + auto &keys = *static_cast<keys_t *>(data); + + keys[obs_hotkey_binding_get_hotkey_id(binding)] + .emplace_back( + obs_hotkey_binding_get_key_combination( + binding)); - return true; - }, &keys); + return true; + }, + &keys); auto layout = new QFormLayout(); layout->setVerticalSpacing(0); layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); - layout->setLabelAlignment( - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); + layout->setLabelAlignment(Qt::AlignRight | Qt::AlignTrailing | + Qt::AlignVCenter); auto widget = new QWidget(); widget->setLayout(layout); @@ -2476,11 +2491,11 @@ auto label = layout->itemAt(i, QFormLayout::LabelRole); if (label) { OBSHotkeyLabel *item = - qobject_cast<OBSHotkeyLabel*>( - label->widget()); - if(item) { - if (item->text().toLower() - .contains(text.toLower())) + qobject_cast<OBSHotkeyLabel *>( + label->widget()); + if (item) { + if (item->text().toLower().contains( + text.toLower())) setRowVisible(i, true, label); else setRowVisible(i, false, label); @@ -2489,8 +2504,7 @@ } }; - connect(filter, &QLineEdit::textChanged, - this, searchFunction); + connect(filter, &QLineEdit::textChanged, this, searchFunction); filterLayout->addWidget(filterLabel, 0, 0); filterLayout->addWidget(filter, 0, 1); @@ -2507,21 +2521,20 @@ using sources_elem_t = tuple<OBSSource, QPointer<QLabel>, QPointer<QWidget>>; vector<encoders_elem_t> encoders; - vector<outputs_elem_t> outputs; + vector<outputs_elem_t> outputs; vector<services_elem_t> services; - vector<sources_elem_t> scenes; - vector<sources_elem_t> sources; + vector<sources_elem_t> scenes; + vector<sources_elem_t> sources; vector<obs_hotkey_id> pairIds; - map<obs_hotkey_id, pair<obs_hotkey_id, OBSHotkeyLabel*>> pairLabels; + map<obs_hotkey_id, pair<obs_hotkey_id, OBSHotkeyLabel *>> pairLabels; using std::move; auto HandleEncoder = [&](void *registerer, OBSHotkeyLabel *label, - OBSHotkeyWidget *hw) - { + OBSHotkeyWidget *hw) { auto weak_encoder = - static_cast<obs_weak_encoder_t*>(registerer); + static_cast<obs_weak_encoder_t *>(registerer); auto encoder = OBSGetStrongRef(weak_encoder); if (!encoder) @@ -2532,9 +2545,8 @@ }; auto HandleOutput = [&](void *registerer, OBSHotkeyLabel *label, - OBSHotkeyWidget *hw) - { - auto weak_output = static_cast<obs_weak_output_t*>(registerer); + OBSHotkeyWidget *hw) { + auto weak_output = static_cast<obs_weak_output_t *>(registerer); auto output = OBSGetStrongRef(weak_output); if (!output) @@ -2545,10 +2557,9 @@ }; auto HandleService = [&](void *registerer, OBSHotkeyLabel *label, - OBSHotkeyWidget *hw) - { + OBSHotkeyWidget *hw) { auto weak_service = - static_cast<obs_weak_service_t*>(registerer); + static_cast<obs_weak_service_t *>(registerer); auto service = OBSGetStrongRef(weak_service); if (!service) @@ -2559,9 +2570,8 @@ }; auto HandleSource = [&](void *registerer, OBSHotkeyLabel *label, - OBSHotkeyWidget *hw) - { - auto weak_source = static_cast<obs_weak_source_t*>(registerer); + OBSHotkeyWidget *hw) { + auto weak_source = static_cast<obs_weak_source_t *>(registerer); auto source = OBSGetStrongRef(weak_source); if (!source) @@ -2576,15 +2586,14 @@ }; auto RegisterHotkey = [&](obs_hotkey_t *key, OBSHotkeyLabel *label, - OBSHotkeyWidget *hw) - { + OBSHotkeyWidget *hw) { auto registerer_type = obs_hotkey_get_registerer_type(key); - void *registerer = obs_hotkey_get_registerer(key); + void *registerer = obs_hotkey_get_registerer(key); obs_hotkey_id partner = obs_hotkey_get_pair_partner_id(key); if (partner != OBS_INVALID_HOTKEY_ID) { pairLabels.emplace(obs_hotkey_get_id(key), - make_pair(partner, label)); + make_pair(partner, label)); pairIds.push_back(obs_hotkey_get_id(key)); } @@ -2616,21 +2625,22 @@ break; } - hotkeys.emplace_back(registerer_type == - OBS_HOTKEY_REGISTERER_FRONTEND, hw); - connect(hw, &OBSHotkeyWidget::KeyChanged, - this, &OBSBasicSettings::HotkeysChanged); + hotkeys.emplace_back( + registerer_type == OBS_HOTKEY_REGISTERER_FRONTEND, hw); + connect(hw, &OBSHotkeyWidget::KeyChanged, this, + &OBSBasicSettings::HotkeysChanged); }; auto data = make_tuple(RegisterHotkey, std::move(keys), ignoreKey); using data_t = decltype(data); - obs_enum_hotkeys([](void *data, obs_hotkey_id id, obs_hotkey_t *key) - { - data_t &d = *static_cast<data_t*>(data); - if (id != get<2>(d)) - LayoutHotkey(id, key, get<0>(d), get<1>(d)); - return true; - }, &data); + obs_enum_hotkeys( + [](void *data, obs_hotkey_id id, obs_hotkey_t *key) { + data_t &d = *static_cast<data_t *>(data); + if (id != get<2>(d)) + LayoutHotkey(id, key, get<0>(d), get<1>(d)); + return true; + }, + &data); for (auto keyId : pairIds) { auto data1 = pairLabels.find(keyId); @@ -2654,9 +2664,10 @@ auto name2 = label2->text(); auto Update = [&](OBSHotkeyLabel *label, const QString &name, - OBSHotkeyLabel *other, const QString &otherName) - { - QString string = other->property("fullName").value<QString>(); + OBSHotkeyLabel *other, + const QString &otherName) { + QString string = + other->property("fullName").value<QString>(); if (string.isEmpty() || string.isNull()) string = otherName; @@ -2702,7 +2713,7 @@ if (WidgetChanged(ui->language)) config_set_string(GetGlobalConfig(), "General", "Language", - language.c_str()); + language.c_str()); int themeIndex = ui->theme->currentIndex(); QString themeData = ui->theme->itemText(themeIndex); @@ -2728,8 +2739,7 @@ ui->enableAutoUpdates->isChecked()); #endif if (WidgetChanged(ui->openStatsOnStartup)) - config_set_bool(main->Config(), "General", - "OpenStatsOnStartup", + config_set_bool(main->Config(), "General", "OpenStatsOnStartup", ui->openStatsOnStartup->isChecked()); if (WidgetChanged(ui->snappingEnabled)) config_set_bool(GetGlobalConfig(), "BasicWindow", @@ -2749,20 +2759,19 @@ ui->sourceSnapping->isChecked()); if (WidgetChanged(ui->snapDistance)) config_set_double(GetGlobalConfig(), "BasicWindow", - "SnapDistance", - ui->snapDistance->value()); + "SnapDistance", ui->snapDistance->value()); if (WidgetChanged(ui->overflowAlwaysVisible)) config_set_bool(GetGlobalConfig(), "BasicWindow", - "OverflowAlwaysVisible", - ui->overflowAlwaysVisible->isChecked()); + "OverflowAlwaysVisible", + ui->overflowAlwaysVisible->isChecked()); if (WidgetChanged(ui->overflowHide)) config_set_bool(GetGlobalConfig(), "BasicWindow", - "OverflowHidden", - ui->overflowHide->isChecked()); + "OverflowHidden", + ui->overflowHide->isChecked()); if (WidgetChanged(ui->overflowSelectionHide)) config_set_bool(GetGlobalConfig(), "BasicWindow", - "OverflowSelectionHidden", - ui->overflowSelectionHide->isChecked()); + "OverflowSelectionHidden", + ui->overflowSelectionHide->isChecked()); if (WidgetChanged(ui->doubleClickSwitch)) config_set_bool(GetGlobalConfig(), "BasicWindow", "TransitionOnDoubleClick", @@ -2774,9 +2783,11 @@ config_set_bool(GetGlobalConfig(), "BasicWindow", "WarnBeforeStoppingStream", ui->warnBeforeStreamStop->isChecked()); - config_set_bool(GetGlobalConfig(), "BasicWindow", - "HideProjectorCursor", + "WarnBeforeStoppingRecord", + ui->warnBeforeRecordStop->isChecked()); + + config_set_bool(GetGlobalConfig(), "BasicWindow", "HideProjectorCursor", ui->hideProjectorCursor->isChecked()); config_set_bool(GetGlobalConfig(), "BasicWindow", "ProjectorAlwaysOnTop", @@ -2793,12 +2804,12 @@ if (WidgetChanged(ui->replayWhileStreaming)) config_set_bool(GetGlobalConfig(), "BasicWindow", - "ReplayBufferWhileStreaming", - ui->replayWhileStreaming->isChecked()); + "ReplayBufferWhileStreaming", + ui->replayWhileStreaming->isChecked()); if (WidgetChanged(ui->keepReplayStreamStops)) config_set_bool(GetGlobalConfig(), "BasicWindow", - "KeepReplayBufferStreamStops", - ui->keepReplayStreamStops->isChecked()); + "KeepReplayBufferStreamStops", + ui->keepReplayStreamStops->isChecked()); if (WidgetChanged(ui->systemTrayEnabled)) config_set_bool(GetGlobalConfig(), "BasicWindow", @@ -2811,8 +2822,8 @@ ui->systemTrayWhenStarted->isChecked()); if (WidgetChanged(ui->systemTrayAlways)) - config_set_bool(GetGlobalConfig(), - "BasicWindow", "SysTrayMinimizeToTray", + config_set_bool(GetGlobalConfig(), "BasicWindow", + "SysTrayMinimizeToTray", ui->systemTrayAlways->isChecked()); if (WidgetChanged(ui->saveProjectors)) @@ -2860,8 +2871,8 @@ if (WidgetChanged(ui->multiviewLayout)) { config_set_int(GetGlobalConfig(), "BasicWindow", - "MultiviewLayout", - ui->multiviewLayout->currentData().toInt()); + "MultiviewLayout", + ui->multiviewLayout->currentData().toInt()); multiviewChanged = true; } @@ -2871,9 +2882,9 @@ void OBSBasicSettings::SaveVideoSettings() { - QString baseResolution = ui->baseResolution->currentText(); + QString baseResolution = ui->baseResolution->currentText(); QString outputResolution = ui->outputResolution->currentText(); - int fpsType = ui->fpsType->currentIndex(); + int fpsType = ui->fpsType->currentIndex(); uint32_t cx = 0, cy = 0; /* ------------------- */ @@ -2909,18 +2920,18 @@ void OBSBasicSettings::SaveAdvancedSettings() { - QString lastMonitoringDevice = config_get_string(main->Config(), - "Audio", "MonitoringDeviceId"); + QString lastMonitoringDevice = config_get_string( + main->Config(), "Audio", "MonitoringDeviceId"); #ifdef _WIN32 if (WidgetChanged(ui->renderer)) config_set_string(App()->GlobalConfig(), "Video", "Renderer", - QT_TO_UTF8(ui->renderer->currentText())); + QT_TO_UTF8(ui->renderer->currentText())); std::string priority = QT_TO_UTF8(ui->processPriority->currentData().toString()); config_set_string(App()->GlobalConfig(), "General", "ProcessPriority", - priority.c_str()); + priority.c_str()); if (main->Active()) SetProcessPriority(priority.c_str()); @@ -2928,24 +2939,26 @@ SaveCheckBox(ui->enableLowLatencyMode, "Output", "LowLatencyEnable"); bool browserHWAccel = ui->browserHWAccel->isChecked(); - config_set_bool(App()->GlobalConfig(), "General", - "BrowserHWAccel", browserHWAccel); + config_set_bool(App()->GlobalConfig(), "General", "BrowserHWAccel", + browserHWAccel); #endif - bool disableFocusHotkeys = ui->disableFocusHotkeys->isChecked(); - config_set_bool(App()->GlobalConfig(), "General", - "DisableHotkeysInFocus", disableFocusHotkeys); + if (WidgetChanged(ui->hotkeyFocusType)) { + QString str = GetComboData(ui->hotkeyFocusType); + config_set_string(App()->GlobalConfig(), "General", + "HotkeyFocusType", QT_TO_UTF8(str)); + } #ifdef __APPLE__ if (WidgetChanged(ui->disableOSXVSync)) { bool disable = ui->disableOSXVSync->isChecked(); - config_set_bool(App()->GlobalConfig(), - "Video", "DisableOSXVSync", disable); + config_set_bool(App()->GlobalConfig(), "Video", + "DisableOSXVSync", disable); EnableOSXVSync(!disable); } if (WidgetChanged(ui->resetOSXVSync)) - config_set_bool(App()->GlobalConfig(), - "Video", "ResetOSXVSyncOnExit", + config_set_bool(App()->GlobalConfig(), "Video", + "ResetOSXVSyncOnExit", ui->resetOSXVSync->isChecked()); #endif @@ -2960,8 +2973,8 @@ #ifdef _WIN32 if (WidgetChanged(ui->disableAudioDucking)) { bool disable = ui->disableAudioDucking->isChecked(); - config_set_bool(App()->GlobalConfig(), - "Audio", "DisableAudioDucking", disable); + config_set_bool(App()->GlobalConfig(), "Audio", + "DisableAudioDucking", disable); DisableAudioDucking(disable); } #endif @@ -2978,18 +2991,19 @@ SaveSpinBox(ui->reconnectMaxRetries, "Output", "MaxRetries"); SaveComboData(ui->bindToIP, "Output", "BindIP"); SaveCheckBox(ui->autoRemux, "Video", "AutoRemux"); + SaveCheckBox(ui->dynBitrate, "Output", "DynamicBitrate"); #if defined(_WIN32) || defined(__APPLE__) || HAVE_PULSEAUDIO QString newDevice = ui->monitoringDevice->currentData().toString(); if (lastMonitoringDevice != newDevice) { obs_set_audio_monitoring_device( - QT_TO_UTF8(ui->monitoringDevice->currentText()), - QT_TO_UTF8(newDevice)); + QT_TO_UTF8(ui->monitoringDevice->currentText()), + QT_TO_UTF8(newDevice)); blog(LOG_INFO, "Audio monitoring device:\n\tname: %s\n\tid: %s", - QT_TO_UTF8(ui->monitoringDevice->currentText()), - QT_TO_UTF8(newDevice)); + QT_TO_UTF8(ui->monitoringDevice->currentText()), + QT_TO_UTF8(newDevice)); } #endif } @@ -3021,27 +3035,30 @@ if (ret > 0) { obs_data_t *settings = view->GetSettings(); if (settings) { - obs_data_save_json_safe(settings, full_path, - "tmp", "bak"); + obs_data_save_json_safe(settings, full_path, "tmp", + "bak"); } } } static void SaveTrackIndex(config_t *config, const char *section, - const char *name, - QAbstractButton *check1, - QAbstractButton *check2, - QAbstractButton *check3, - QAbstractButton *check4, - QAbstractButton *check5, - QAbstractButton *check6) -{ - if (check1->isChecked()) config_set_int(config, section, name, 1); - else if (check2->isChecked()) config_set_int(config, section, name, 2); - else if (check3->isChecked()) config_set_int(config, section, name, 3); - else if (check4->isChecked()) config_set_int(config, section, name, 4); - else if (check5->isChecked()) config_set_int(config, section, name, 5); - else if (check6->isChecked()) config_set_int(config, section, name, 6); + const char *name, QAbstractButton *check1, + QAbstractButton *check2, QAbstractButton *check3, + QAbstractButton *check4, QAbstractButton *check5, + QAbstractButton *check6) +{ + if (check1->isChecked()) + config_set_int(config, section, name, 1); + else if (check2->isChecked()) + config_set_int(config, section, name, 2); + else if (check3->isChecked()) + config_set_int(config, section, name, 3); + else if (check4->isChecked()) + config_set_int(config, section, name, 4); + else if (check5->isChecked()) + config_set_int(config, section, name, 5); + else if (check6->isChecked()) + config_set_int(config, section, name, 6); } void OBSBasicSettings::SaveFormat(QComboBox *combo) @@ -3050,9 +3067,9 @@ if (!v.isNull()) { FormatDesc desc = v.value<FormatDesc>(); config_set_string(main->Config(), "AdvOut", "FFFormat", - desc.name); + desc.name); config_set_string(main->Config(), "AdvOut", "FFFormatMimeType", - desc.mimeType); + desc.mimeType); const char *ext = ff_format_desc_extensions(desc.desc); string extStr = ext ? ext : ""; @@ -3062,26 +3079,26 @@ *comma = 0; config_set_string(main->Config(), "AdvOut", "FFExtension", - extStr.c_str()); + extStr.c_str()); } else { config_set_string(main->Config(), "AdvOut", "FFFormat", - nullptr); + nullptr); config_set_string(main->Config(), "AdvOut", "FFFormatMimeType", - nullptr); + nullptr); config_remove_value(main->Config(), "AdvOut", "FFExtension"); } } void OBSBasicSettings::SaveEncoder(QComboBox *combo, const char *section, - const char *value) + const char *value) { QVariant v = combo->currentData(); CodecDesc cd; if (!v.isNull()) cd = v.value<CodecDesc>(); config_set_int(main->Config(), section, - QT_TO_UTF8(QString("%1Id").arg(value)), cd.id); + QT_TO_UTF8(QString("%1Id").arg(value)), cd.id); if (cd.id != 0) config_set_string(main->Config(), section, value, cd.name); else @@ -3091,7 +3108,7 @@ void OBSBasicSettings::SaveOutputSettings() { config_set_string(main->Config(), "Output", "Mode", - OutputModeFromIdx(ui->outputMode->currentIndex())); + OutputModeFromIdx(ui->outputMode->currentIndex())); QString encoder = ui->simpleOutStrEncoder->currentData().toString(); const char *presetType; @@ -3128,13 +3145,12 @@ SaveComboData(ui->advOutEncoder, "AdvOut", "Encoder"); SaveCheckBox(ui->advOutUseRescale, "AdvOut", "Rescale"); SaveCombo(ui->advOutRescale, "AdvOut", "RescaleRes"); - SaveTrackIndex(main->Config(), "AdvOut", "TrackIndex", - ui->advOutTrack1, ui->advOutTrack2, - ui->advOutTrack3, ui->advOutTrack4, - ui->advOutTrack5, ui->advOutTrack6); + SaveTrackIndex(main->Config(), "AdvOut", "TrackIndex", ui->advOutTrack1, + ui->advOutTrack2, ui->advOutTrack3, ui->advOutTrack4, + ui->advOutTrack5, ui->advOutTrack6); config_set_string(main->Config(), "AdvOut", "RecType", - RecTypeFromIdx(ui->advOutRecType->currentIndex())); + RecTypeFromIdx(ui->advOutRecType->currentIndex())); curAdvRecordEncoder = GetComboData(ui->advOutRecEncoder); @@ -3146,13 +3162,14 @@ SaveCombo(ui->advOutRecRescale, "AdvOut", "RecRescaleRes"); SaveEdit(ui->advOutMuxCustom, "AdvOut", "RecMuxerCustom"); - config_set_int(main->Config(), "AdvOut", "RecTracks", - (ui->advOutRecTrack1->isChecked() ? (1<<0) : 0) | - (ui->advOutRecTrack2->isChecked() ? (1<<1) : 0) | - (ui->advOutRecTrack3->isChecked() ? (1<<2) : 0) | - (ui->advOutRecTrack4->isChecked() ? (1<<3) : 0) | - (ui->advOutRecTrack5->isChecked() ? (1<<4) : 0) | - (ui->advOutRecTrack6->isChecked() ? (1<<5) : 0)); + config_set_int( + main->Config(), "AdvOut", "RecTracks", + (ui->advOutRecTrack1->isChecked() ? (1 << 0) : 0) | + (ui->advOutRecTrack2->isChecked() ? (1 << 1) : 0) | + (ui->advOutRecTrack3->isChecked() ? (1 << 2) : 0) | + (ui->advOutRecTrack4->isChecked() ? (1 << 3) : 0) | + (ui->advOutRecTrack5->isChecked() ? (1 << 4) : 0) | + (ui->advOutRecTrack6->isChecked() ? (1 << 5) : 0)); config_set_bool(main->Config(), "AdvOut", "FFOutputToFile", ui->advOutFFType->currentIndex() == 0 ? true : false); @@ -3171,8 +3188,9 @@ SaveSpinBox(ui->advOutFFABitrate, "AdvOut", "FFABitrate"); SaveEncoder(ui->advOutFFAEncoder, "AdvOut", "FFAEncoder"); SaveEdit(ui->advOutFFACfg, "AdvOut", "FFACustom"); - config_set_int(main->Config(), "AdvOut", "FFAudioMixes", - (ui->advOutFFTrack1->isChecked() ? (1 << 0) : 0) | + config_set_int( + main->Config(), "AdvOut", "FFAudioMixes", + (ui->advOutFFTrack1->isChecked() ? (1 << 0) : 0) | (ui->advOutFFTrack2->isChecked() ? (1 << 1) : 0) | (ui->advOutFFTrack3->isChecked() ? (1 << 2) : 0) | (ui->advOutFFTrack4->isChecked() ? (1 << 3) : 0) | @@ -3202,8 +3220,8 @@ void OBSBasicSettings::SaveAudioSettings() { - QString sampleRateStr = ui->sampleRate->currentText(); - int channelSetupIdx = ui->channelSetup->currentIndex(); + QString sampleRateStr = ui->sampleRate->currentText(); + int channelSetupIdx = ui->channelSetup->currentIndex(); const char *channelSetup; switch (channelSetupIdx) { @@ -3244,7 +3262,7 @@ if (WidgetChanged(ui->channelSetup)) config_set_string(main->Config(), "Audio", "ChannelSetup", - channelSetup); + channelSetup); if (WidgetChanged(ui->meterDecayRate)) { double meterDecayRate; @@ -3263,7 +3281,7 @@ break; } config_set_double(main->Config(), "Audio", "MeterDecayRate", - meterDecayRate); + meterDecayRate); main->UpdateVolumeControlsDecayRate(); } @@ -3277,14 +3295,14 @@ } for (auto &audioSource : audioSources) { - auto source = OBSGetStrongRef(get<0>(audioSource)); + auto source = OBSGetStrongRef(get<0>(audioSource)); if (!source) continue; - auto &ptmCB = get<1>(audioSource); - auto &ptmSB = get<2>(audioSource); - auto &pttCB = get<3>(audioSource); - auto &pttSB = get<4>(audioSource); + auto &ptmCB = get<1>(audioSource); + auto &ptmSB = get<2>(audioSource); + auto &pttCB = get<3>(audioSource); + auto &pttSB = get<4>(audioSource); obs_source_enable_push_to_mute(source, ptmCB->isChecked()); obs_source_set_push_to_mute_delay(source, ptmSB->value()); @@ -3294,27 +3312,21 @@ } auto UpdateAudioDevice = [this](bool input, QComboBox *combo, - const char *name, int index) - { - main->ResetAudioDevice( - input ? App()->InputAudioSource() - : App()->OutputAudioSource(), - QT_TO_UTF8(GetComboData(combo)), - Str(name), index); + const char *name, int index) { + main->ResetAudioDevice(input ? App()->InputAudioSource() + : App()->OutputAudioSource(), + QT_TO_UTF8(GetComboData(combo)), + Str(name), index); }; UpdateAudioDevice(false, ui->desktopAudioDevice1, - "Basic.DesktopDevice1", 1); + "Basic.DesktopDevice1", 1); UpdateAudioDevice(false, ui->desktopAudioDevice2, - "Basic.DesktopDevice2", 2); - UpdateAudioDevice(true, ui->auxAudioDevice1, - "Basic.AuxDevice1", 3); - UpdateAudioDevice(true, ui->auxAudioDevice2, - "Basic.AuxDevice2", 4); - UpdateAudioDevice(true, ui->auxAudioDevice3, - "Basic.AuxDevice3", 5); - UpdateAudioDevice(true, ui->auxAudioDevice4, - "Basic.AuxDevice4", 6); + "Basic.DesktopDevice2", 2); + UpdateAudioDevice(true, ui->auxAudioDevice1, "Basic.AuxDevice1", 3); + UpdateAudioDevice(true, ui->auxAudioDevice2, "Basic.AuxDevice2", 4); + UpdateAudioDevice(true, ui->auxAudioDevice3, "Basic.AuxDevice3", 5); + UpdateAudioDevice(true, ui->auxAudioDevice4, "Basic.AuxDevice4", 6); main->SaveProject(); } @@ -3350,15 +3362,14 @@ const char *id = obs_obj_get_id(main->outputHandler->replayBuffer); if (strcmp(id, "replay_buffer") == 0) { obs_data_t *hotkeys = obs_hotkeys_save_output( - main->outputHandler->replayBuffer); + main->outputHandler->replayBuffer); config_set_string(config, "Hotkeys", "ReplayBuffer", - obs_data_get_json(hotkeys)); + obs_data_get_json(hotkeys)); obs_data_release(hotkeys); } } -#define MINOR_SEPARATOR \ - "------------------------------------------------" +#define MINOR_SEPARATOR "------------------------------------------------" static void AddChangedVal(std::string &changed, const char *str) { @@ -3417,11 +3428,10 @@ { QMessageBox::StandardButton button; - button = OBSMessageBox::question(this, - QTStr("Basic.Settings.ConfirmTitle"), - QTStr("Basic.Settings.Confirm"), - QMessageBox::Yes | QMessageBox::No | - QMessageBox::Cancel); + button = OBSMessageBox::question( + this, QTStr("Basic.Settings.ConfirmTitle"), + QTStr("Basic.Settings.Confirm"), + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if (button == QMessageBox::Cancel) { return false; @@ -3496,11 +3506,10 @@ void OBSBasicSettings::on_simpleOutputBrowse_clicked() { - QString dir = QFileDialog::getExistingDirectory(this, - QTStr("Basic.Settings.Output.SelectDirectory"), - ui->simpleOutputPath->text(), - QFileDialog::ShowDirsOnly | - QFileDialog::DontResolveSymlinks); + QString dir = QFileDialog::getExistingDirectory( + this, QTStr("Basic.Settings.Output.SelectDirectory"), + ui->simpleOutputPath->text(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir.isEmpty()) return; @@ -3509,11 +3518,10 @@ void OBSBasicSettings::on_advOutRecPathBrowse_clicked() { - QString dir = QFileDialog::getExistingDirectory(this, - QTStr("Basic.Settings.Output.SelectDirectory"), - ui->advOutRecPath->text(), - QFileDialog::ShowDirsOnly | - QFileDialog::DontResolveSymlinks); + QString dir = QFileDialog::getExistingDirectory( + this, QTStr("Basic.Settings.Output.SelectDirectory"), + ui->advOutRecPath->text(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir.isEmpty()) return; @@ -3522,11 +3530,10 @@ void OBSBasicSettings::on_advOutFFPathBrowse_clicked() { - QString dir = QFileDialog::getExistingDirectory(this, - QTStr("Basic.Settings.Output.SelectDirectory"), - ui->advOutRecPath->text(), - QFileDialog::ShowDirsOnly | - QFileDialog::DontResolveSymlinks); + QString dir = QFileDialog::getExistingDirectory( + this, QTStr("Basic.Settings.Output.SelectDirectory"), + ui->advOutRecPath->text(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir.isEmpty()) return; @@ -3541,9 +3548,8 @@ delete streamEncoderProps; streamEncoderProps = CreateEncoderPropertyView( - QT_TO_UTF8(encoder), - loadSettings ? "streamEncoder.json" : nullptr, - true); + QT_TO_UTF8(encoder), + loadSettings ? "streamEncoder.json" : nullptr, true); ui->advOutputStreamTab->layout()->addWidget(streamEncoderProps); } @@ -3580,12 +3586,11 @@ if (!loading) { recordEncoderProps = CreateEncoderPropertyView( - QT_TO_UTF8(encoder), - loadSettings ? "recordEncoder.json" : nullptr, - true); + QT_TO_UTF8(encoder), + loadSettings ? "recordEncoder.json" : nullptr, true); ui->advOutRecStandard->layout()->addWidget(recordEncoderProps); - connect(recordEncoderProps, SIGNAL(Changed()), - this, SLOT(AdvReplayBufferChanged())); + connect(recordEncoderProps, SIGNAL(Changed()), this, + SLOT(AdvReplayBufferChanged())); } uint32_t caps = obs_get_encoder_caps(QT_TO_UTF8(encoder)); @@ -3604,7 +3609,7 @@ { /* Little hack to reload codecs when checked */ on_advOutFFFormat_currentIndexChanged( - ui->advOutFFFormat->currentIndex()); + ui->advOutFFFormat->currentIndex()); } #define DEFAULT_CONTAINER_STR \ @@ -3616,24 +3621,24 @@ if (!itemDataVariant.isNull()) { FormatDesc desc = itemDataVariant.value<FormatDesc>(); - SetAdvOutputFFmpegEnablement(FF_CODEC_AUDIO, - ff_format_desc_has_audio(desc.desc), - false); - SetAdvOutputFFmpegEnablement(FF_CODEC_VIDEO, - ff_format_desc_has_video(desc.desc), - false); + SetAdvOutputFFmpegEnablement( + FF_CODEC_AUDIO, ff_format_desc_has_audio(desc.desc), + false); + SetAdvOutputFFmpegEnablement( + FF_CODEC_VIDEO, ff_format_desc_has_video(desc.desc), + false); ReloadCodecs(desc.desc); - ui->advOutFFFormatDesc->setText(ff_format_desc_long_name( - desc.desc)); + ui->advOutFFFormatDesc->setText( + ff_format_desc_long_name(desc.desc)); CodecDesc defaultAudioCodecDesc = GetDefaultCodecDesc(desc.desc, FF_CODEC_AUDIO); CodecDesc defaultVideoCodecDesc = GetDefaultCodecDesc(desc.desc, FF_CODEC_VIDEO); SelectEncoder(ui->advOutFFAEncoder, defaultAudioCodecDesc.name, - defaultAudioCodecDesc.id); + defaultAudioCodecDesc.id); SelectEncoder(ui->advOutFFVEncoder, defaultVideoCodecDesc.name, - defaultVideoCodecDesc.id); + defaultVideoCodecDesc.id); } else { ReloadCodecs(nullptr); ui->advOutFFFormatDesc->setText(DEFAULT_CONTAINER_STR); @@ -3645,8 +3650,9 @@ const QVariant itemDataVariant = ui->advOutFFAEncoder->itemData(idx); if (!itemDataVariant.isNull()) { CodecDesc desc = itemDataVariant.value<CodecDesc>(); - SetAdvOutputFFmpegEnablement(FF_CODEC_AUDIO, - desc.id != 0 || desc.name != nullptr, true); + SetAdvOutputFFmpegEnablement( + FF_CODEC_AUDIO, desc.id != 0 || desc.name != nullptr, + true); } } @@ -3655,8 +3661,9 @@ const QVariant itemDataVariant = ui->advOutFFVEncoder->itemData(idx); if (!itemDataVariant.isNull()) { CodecDesc desc = itemDataVariant.value<CodecDesc>(); - SetAdvOutputFFmpegEnablement(FF_CODEC_VIDEO, - desc.id != 0 || desc.name != nullptr, true); + SetAdvOutputFFmpegEnablement( + FF_CODEC_VIDEO, desc.id != 0 || desc.name != nullptr, + true); } } @@ -3673,14 +3680,14 @@ ui->advancedMsg2->setText(QString()); else ui->advancedMsg2->setText( - QTStr("Basic.Settings.Advanced.FormatWarning")); + QTStr("Basic.Settings.Advanced.FormatWarning")); } #define INVALID_RES_STR "Basic.Settings.Video.InvalidResolution" static bool ValidResolutions(Ui::OBSBasicSettings *ui) { - QString baseRes = ui->baseResolution->lineEdit()->text(); + QString baseRes = ui->baseResolution->lineEdit()->text(); QString outputRes = ui->outputResolution->lineEdit()->text(); uint32_t cx, cy; @@ -3707,15 +3714,12 @@ } } - void OBSBasicSettings::on_filenameFormatting_textEdited(const QString &text) { #ifdef __APPLE__ - size_t invalidLocation = - text.toStdString().find_first_of(":"); -#elif _WIN32 - size_t invalidLocation = - text.toStdString().find_first_of("<>:\"|?*"); + size_t invalidLocation = text.toStdString().find_first_of(":"); +#elif _WIN32 + size_t invalidLocation = text.toStdString().find_first_of("<>:\"|?*"); #else size_t invalidLocation = string::npos; UNUSED_PARAMETER(text); @@ -3802,34 +3806,30 @@ bool surround = IsSurround(speakerLayout.c_str()); if (surround) { - QString warning = - QTStr(MULTI_CHANNEL_WARNING ".Enabled") + - QStringLiteral("\n\n") + - QTStr(MULTI_CHANNEL_WARNING); + QString warning = QTStr(MULTI_CHANNEL_WARNING ".Enabled") + + QStringLiteral("\n\n") + + QTStr(MULTI_CHANNEL_WARNING); /* * Display all bitrates */ ui->audioMsg_2->setText(warning); - PopulateAACBitrates({ui->simpleOutputABitrate, - ui->advOutTrack1Bitrate, - ui->advOutTrack2Bitrate, - ui->advOutTrack3Bitrate, - ui->advOutTrack4Bitrate, - ui->advOutTrack5Bitrate, - ui->advOutTrack6Bitrate}); + PopulateAACBitrates( + {ui->simpleOutputABitrate, ui->advOutTrack1Bitrate, + ui->advOutTrack2Bitrate, ui->advOutTrack3Bitrate, + ui->advOutTrack4Bitrate, ui->advOutTrack5Bitrate, + ui->advOutTrack6Bitrate}); } else { /* * Reset audio bitrate for simple and adv mode, update list of * bitrates and save setting. */ ui->audioMsg_2->setText(QString()); - RestrictResetBitrates({ui->simpleOutputABitrate, - ui->advOutTrack1Bitrate, - ui->advOutTrack2Bitrate, - ui->advOutTrack3Bitrate, - ui->advOutTrack4Bitrate, - ui->advOutTrack5Bitrate, - ui->advOutTrack6Bitrate}, 320); + RestrictResetBitrates( + {ui->simpleOutputABitrate, ui->advOutTrack1Bitrate, + ui->advOutTrack2Bitrate, ui->advOutTrack3Bitrate, + ui->advOutTrack4Bitrate, ui->advOutTrack5Bitrate, + ui->advOutTrack6Bitrate}, + 320); SaveCombo(ui->simpleOutputABitrate, "SimpleOutput", "ABitrate"); SaveCombo(ui->advOutTrack1Bitrate, "AdvOut", "Track1Bitrate"); @@ -3846,23 +3846,23 @@ * displayed when multichannel OFF */ -void RestrictResetBitrates(initializer_list<QComboBox*> boxes, int maxbitrate) +void RestrictResetBitrates(initializer_list<QComboBox *> boxes, int maxbitrate) { for (auto box : boxes) { int idx = box->currentIndex(); int max_bitrate = FindClosestAvailableAACBitrate(maxbitrate); int count = box->count(); - int max_idx = box->findText(QT_UTF8(std::to_string - (max_bitrate).c_str())); + int max_idx = box->findText( + QT_UTF8(std::to_string(max_bitrate).c_str())); for (int i = (count - 1); i > max_idx; i--) box->removeItem(i); if (idx > max_idx) { - int default_bitrate = FindClosestAvailableAACBitrate( - maxbitrate / 2); - int default_idx = box->findText(QT_UTF8(std::to_string - (default_bitrate).c_str())); + int default_bitrate = + FindClosestAvailableAACBitrate(maxbitrate / 2); + int default_idx = box->findText(QT_UTF8( + std::to_string(default_bitrate).c_str())); box->setCurrentIndex(default_idx); box->setProperty("changed", QVariant(true)); @@ -3887,7 +3887,7 @@ if (!loading) { advancedChanged = true; ui->advancedMsg->setText( - QTStr("Basic.Settings.ProgramRestart")); + QTStr("Basic.Settings.ProgramRestart")); sender()->setProperty("changed", QVariant(true)); EnableApplyButton(true); } @@ -3917,12 +3917,12 @@ if (loading) return; - hotkeysChanged = any_of(begin(hotkeys), end(hotkeys), - [](const pair<bool, QPointer<OBSHotkeyWidget>> &hotkey) - { - const auto &hw = *hotkey.second; - return hw.Changed(); - }); + hotkeysChanged = + any_of(begin(hotkeys), end(hotkeys), + [](const pair<bool, QPointer<OBSHotkeyWidget>> &hotkey) { + const auto &hw = *hotkey.second; + return hw.Changed(); + }); if (hotkeysChanged) EnableApplyButton(true); @@ -3944,20 +3944,14 @@ void OBSBasicSettings::AdvOutRecCheckWarnings() { - auto Checked = [](QCheckBox *box) - { - return box->isChecked() ? 1 : 0; - }; + auto Checked = [](QCheckBox *box) { return box->isChecked() ? 1 : 0; }; QString errorMsg; QString warningMsg; uint32_t tracks = - Checked(ui->advOutRecTrack1) + - Checked(ui->advOutRecTrack2) + - Checked(ui->advOutRecTrack3) + - Checked(ui->advOutRecTrack4) + - Checked(ui->advOutRecTrack5) + - Checked(ui->advOutRecTrack6); + Checked(ui->advOutRecTrack1) + Checked(ui->advOutRecTrack2) + + Checked(ui->advOutRecTrack3) + Checked(ui->advOutRecTrack4) + + Checked(ui->advOutRecTrack5) + Checked(ui->advOutRecTrack6); if (tracks == 0) { errorMsg = QTStr("OutputWarnings.NoTracksSelected"); @@ -3966,33 +3960,37 @@ warningMsg = QTStr("OutputWarnings.MultiTrackRecording"); } + bool useStreamEncoder = ui->advOutRecEncoder->currentIndex() == 0; + if (useStreamEncoder) { + if (!warningMsg.isEmpty()) + warningMsg += "\n\n"; + warningMsg += QTStr("OutputWarnings.CannotPause"); + } + if (ui->advOutRecFormat->currentText().compare("mp4") == 0 || ui->advOutRecFormat->currentText().compare("mov") == 0) { if (!warningMsg.isEmpty()) warningMsg += "\n\n"; warningMsg += QTStr("OutputWarnings.MP4Recording"); ui->autoRemux->setText( - QTStr("Basic.Settings.Advanced.AutoRemux") - + " " + - QTStr("Basic.Settings.Advanced.AutoRemux.MP4")); + QTStr("Basic.Settings.Advanced.AutoRemux") + " " + + QTStr("Basic.Settings.Advanced.AutoRemux.MP4")); } else { ui->autoRemux->setText( - QTStr("Basic.Settings.Advanced.AutoRemux")); + QTStr("Basic.Settings.Advanced.AutoRemux")); } delete advOutRecWarning; if (!errorMsg.isEmpty() || !warningMsg.isEmpty()) { advOutRecWarning = new QLabel( - errorMsg.isEmpty() ? warningMsg : errorMsg, - this); + errorMsg.isEmpty() ? warningMsg : errorMsg, this); advOutRecWarning->setObjectName( - errorMsg.isEmpty() ? "warningLabel" : - "errorLabel"); + errorMsg.isEmpty() ? "warningLabel" : "errorLabel"); advOutRecWarning->setWordWrap(true); - QFormLayout *formLayout = reinterpret_cast<QFormLayout*>( - ui->advOutRecTopContainer->layout()); + QFormLayout *formLayout = reinterpret_cast<QFormLayout *>( + ui->advOutRecTopContainer->layout()); formLayout->addRow(nullptr, advOutRecWarning); } @@ -4027,12 +4025,24 @@ QString aBitrateText; switch (trackIndex) { - case 1: aBitrateText = ui->advOutTrack1Bitrate->currentText(); break; - case 2: aBitrateText = ui->advOutTrack2Bitrate->currentText(); break; - case 3: aBitrateText = ui->advOutTrack3Bitrate->currentText(); break; - case 4: aBitrateText = ui->advOutTrack4Bitrate->currentText(); break; - case 5: aBitrateText = ui->advOutTrack5Bitrate->currentText(); break; - case 6: aBitrateText = ui->advOutTrack6Bitrate->currentText(); break; + case 1: + aBitrateText = ui->advOutTrack1Bitrate->currentText(); + break; + case 2: + aBitrateText = ui->advOutTrack2Bitrate->currentText(); + break; + case 3: + aBitrateText = ui->advOutTrack3Bitrate->currentText(); + break; + case 4: + aBitrateText = ui->advOutTrack4Bitrate->currentText(); + break; + case 5: + aBitrateText = ui->advOutTrack5Bitrate->currentText(); + break; + case 6: + aBitrateText = ui->advOutTrack6Bitrate->currentText(); + break; } int seconds = ui->streamDelaySec->value(); @@ -4068,11 +4078,10 @@ void OBSBasicSettings::FillSimpleRecordingValues() { -#define ADD_QUALITY(str) \ - ui->simpleOutRecQuality->addItem( \ - QTStr("Basic.Settings.Output.Simple.RecordingQuality." \ - str), \ - QString(str)); +#define ADD_QUALITY(str) \ + ui->simpleOutRecQuality->addItem( \ + QTStr("Basic.Settings.Output.Simple.RecordingQuality." str), \ + QString(str)); #define ENCODER_STR(str) QTStr("Basic.Settings.Output.Simple.Encoder." str) ADD_QUALITY("Stream"); @@ -4080,44 +4089,35 @@ ADD_QUALITY("HQ"); ADD_QUALITY("Lossless"); - ui->simpleOutRecEncoder->addItem( - ENCODER_STR("Software"), - QString(SIMPLE_ENCODER_X264)); - ui->simpleOutRecEncoder->addItem( - ENCODER_STR("SoftwareLowCPU"), - QString(SIMPLE_ENCODER_X264_LOWCPU)); + ui->simpleOutRecEncoder->addItem(ENCODER_STR("Software"), + QString(SIMPLE_ENCODER_X264)); + ui->simpleOutRecEncoder->addItem(ENCODER_STR("SoftwareLowCPU"), + QString(SIMPLE_ENCODER_X264_LOWCPU)); if (EncoderAvailable("obs_qsv11")) - ui->simpleOutRecEncoder->addItem( - ENCODER_STR("Hardware.QSV"), - QString(SIMPLE_ENCODER_QSV)); + ui->simpleOutRecEncoder->addItem(ENCODER_STR("Hardware.QSV"), + QString(SIMPLE_ENCODER_QSV)); if (EncoderAvailable("ffmpeg_nvenc")) - ui->simpleOutRecEncoder->addItem( - ENCODER_STR("Hardware.NVENC"), - QString(SIMPLE_ENCODER_NVENC)); + ui->simpleOutRecEncoder->addItem(ENCODER_STR("Hardware.NVENC"), + QString(SIMPLE_ENCODER_NVENC)); if (EncoderAvailable("amd_amf_h264")) - ui->simpleOutRecEncoder->addItem( - ENCODER_STR("Hardware.AMD"), - QString(SIMPLE_ENCODER_AMD)); + ui->simpleOutRecEncoder->addItem(ENCODER_STR("Hardware.AMD"), + QString(SIMPLE_ENCODER_AMD)); #undef ADD_QUALITY } void OBSBasicSettings::FillSimpleStreamingValues() { - ui->simpleOutStrEncoder->addItem( - ENCODER_STR("Software"), - QString(SIMPLE_ENCODER_X264)); + ui->simpleOutStrEncoder->addItem(ENCODER_STR("Software"), + QString(SIMPLE_ENCODER_X264)); if (EncoderAvailable("obs_qsv11")) - ui->simpleOutStrEncoder->addItem( - ENCODER_STR("Hardware.QSV"), - QString(SIMPLE_ENCODER_QSV)); + ui->simpleOutStrEncoder->addItem(ENCODER_STR("Hardware.QSV"), + QString(SIMPLE_ENCODER_QSV)); if (EncoderAvailable("ffmpeg_nvenc")) - ui->simpleOutStrEncoder->addItem( - ENCODER_STR("Hardware.NVENC"), - QString(SIMPLE_ENCODER_NVENC)); + ui->simpleOutStrEncoder->addItem(ENCODER_STR("Hardware.NVENC"), + QString(SIMPLE_ENCODER_NVENC)); if (EncoderAvailable("amd_amf_h264")) - ui->simpleOutStrEncoder->addItem( - ENCODER_STR("Hardware.AMD"), - QString(SIMPLE_ENCODER_AMD)); + ui->simpleOutStrEncoder->addItem(ENCODER_STR("Hardware.AMD"), + QString(SIMPLE_ENCODER_AMD)); #undef ENCODER_STR } @@ -4125,15 +4125,15 @@ { QComboBox *cb = ui->monitoringDevice; - auto enum_devices = [] (void *param, const char *name, const char *id) - { - QComboBox *cb = (QComboBox*)param; + auto enum_devices = [](void *param, const char *name, const char *id) { + QComboBox *cb = (QComboBox *)param; cb->addItem(name, id); return true; }; cb->addItem(QTStr("Basic.Settings.Advanced.Audio.MonitoringDevice" - ".Default"), "default"); + ".Default"), + "default"); obs_enum_audio_monitoring_devices(enum_devices, cb); } @@ -4178,7 +4178,7 @@ size_t num = obs_property_list_item_count(p); for (size_t i = 0; i < num; i++) { const char *name = obs_property_list_item_name(p, i); - const char *val = obs_property_list_item_string(p, i); + const char *val = obs_property_list_item_string(p, i); /* bluray is for ideal bluray disc recording settings, * not streaming */ @@ -4240,8 +4240,8 @@ break; } ui->replayWhileStreaming->setEnabled(state); - ui->keepReplayStreamStops->setEnabled(state && - ui->replayWhileStreaming->isChecked()); + ui->keepReplayStreamStops->setEnabled( + state && ui->replayWhileStreaming->isChecked()); } void OBSBasicSettings::SimpleReplayBufferChanged() @@ -4258,14 +4258,14 @@ int abitrate = ui->simpleOutputABitrate->currentText().toInt(); int seconds = ui->simpleRBSecMax->value(); - int64_t memMB = int64_t(seconds) * int64_t(vbitrate + abitrate) * - 1000 / 8 / 1024 / 1024; - if (memMB < 1) memMB = 1; + int64_t memMB = int64_t(seconds) * int64_t(vbitrate + abitrate) * 1000 / + 8 / 1024 / 1024; + if (memMB < 1) + memMB = 1; if (streamQuality) ui->simpleRBEstimate->setText( - QTStr(ESTIMATE_STR).arg( - QString::number(int(memMB)))); + QTStr(ESTIMATE_STR).arg(QString::number(int(memMB)))); else ui->simpleRBEstimate->setText(QTStr(ESTIMATE_UNKNOWN_STR)); @@ -4295,10 +4295,11 @@ char encoderJsonPath[512]; int ret = GetProfilePath(encoderJsonPath, - sizeof(encoderJsonPath), "recordEncoder.json"); + sizeof(encoderJsonPath), + "recordEncoder.json"); if (ret > 0) { obs_data_t *data = obs_data_create_from_json_file_safe( - encoderJsonPath, "bak"); + encoderJsonPath, "bak"); obs_data_apply(settings, data); obs_data_release(data); } @@ -4330,14 +4331,14 @@ int seconds = ui->advRBSecMax->value(); - int64_t memMB = int64_t(seconds) * int64_t(vbitrate + abitrate) * - 1000 / 8 / 1024 / 1024; + int64_t memMB = int64_t(seconds) * int64_t(vbitrate + abitrate) * 1000 / + 8 / 1024 / 1024; if (memMB < 1) memMB = 1; bool varRateControl = (astrcmpi(rateControl, "CBR") == 0 || - astrcmpi(rateControl, "VBR") == 0 || - astrcmpi(rateControl, "ABR") == 0); + astrcmpi(rateControl, "VBR") == 0 || + astrcmpi(rateControl, "ABR") == 0); if (vbitrate == 0) varRateControl = false; @@ -4346,12 +4347,12 @@ if (varRateControl) ui->advRBEstimate->setText( - QTStr(ESTIMATE_STR).arg( - QString::number(int(memMB)))); + QTStr(ESTIMATE_STR).arg(QString::number(int(memMB)))); else ui->advRBEstimate->setText(QTStr(ESTIMATE_UNKNOWN_STR)); - ui->advReplayBufferGroupBox->setVisible(!lossless && replayBufferEnabled); + ui->advReplayBufferGroupBox->setVisible(!lossless && + replayBufferEnabled); ui->advReplayBuf->setEnabled(!lossless); UpdateAutomaticReplayBufferCheckboxes(); @@ -4380,24 +4381,25 @@ obs_data_t *videoSettings = obs_data_create(); obs_data_t *audioSettings = obs_data_create(); int oldVBitrate = ui->simpleOutputVBitrate->value(); - int oldABitrate = ui->simpleOutputABitrate->currentText().toInt(); + int oldABitrate = + ui->simpleOutputABitrate->currentText().toInt(); obs_data_set_int(videoSettings, "bitrate", oldVBitrate); obs_data_set_int(audioSettings, "bitrate", oldABitrate); obs_service_apply_encoder_settings(service, videoSettings, - audioSettings); + audioSettings); int newVBitrate = obs_data_get_int(videoSettings, "bitrate"); int newABitrate = obs_data_get_int(audioSettings, "bitrate"); if (newVBitrate < oldVBitrate) warning = SIMPLE_OUTPUT_WARNING("VideoBitrate") - .arg(newVBitrate); + .arg(newVBitrate); if (newABitrate < oldABitrate) { if (!warning.isEmpty()) warning += "\n\n"; warning += SIMPLE_OUTPUT_WARNING("AudioBitrate") - .arg(newABitrate); + .arg(newABitrate); } obs_data_release(videoSettings); @@ -4416,27 +4418,31 @@ QString streamEnc = ui->simpleOutStrEncoder->currentData().toString(); bool x264RecEnc = (enc == SIMPLE_ENCODER_X264 || - enc == SIMPLE_ENCODER_X264_LOWCPU); + enc == SIMPLE_ENCODER_X264_LOWCPU); if (streamEnc == SIMPLE_ENCODER_X264 && x264RecEnc) { if (!warning.isEmpty()) warning += "\n\n"; warning += SIMPLE_OUTPUT_WARNING("Encoder"); } + } else { + if (!warning.isEmpty()) + warning += "\n\n"; + warning += SIMPLE_OUTPUT_WARNING("CannotPause"); } - if (ui->simpleOutRecFormat->currentText().compare("mp4") == 0 || - ui->simpleOutRecFormat->currentText().compare("mov") == 0) { + if (qual != "Lossless" && + (ui->simpleOutRecFormat->currentText().compare("mp4") == 0 || + ui->simpleOutRecFormat->currentText().compare("mov") == 0)) { if (!warning.isEmpty()) warning += "\n\n"; warning += QTStr("OutputWarnings.MP4Recording"); ui->autoRemux->setText( - QTStr("Basic.Settings.Advanced.AutoRemux") - + " " + - QTStr("Basic.Settings.Advanced.AutoRemux.MP4")); + QTStr("Basic.Settings.Advanced.AutoRemux") + " " + + QTStr("Basic.Settings.Advanced.AutoRemux.MP4")); } else { ui->autoRemux->setText( - QTStr("Basic.Settings.Advanced.AutoRemux")); + QTStr("Basic.Settings.Advanced.AutoRemux")); } if (warning.isEmpty()) @@ -4467,21 +4473,21 @@ if (surround && !wasSurround) { QMessageBox::StandardButton button; - QString warningString = - QTStr("Basic.Settings.ProgramRestart") + - QStringLiteral("\n\n") + - QTStr(MULTI_CHANNEL_WARNING) + - QStringLiteral("\n\n") + - QTStr(MULTI_CHANNEL_WARNING ".Confirm"); - - button = OBSMessageBox::question(this, - QTStr(MULTI_CHANNEL_WARNING ".Title"), - warningString); + QString warningString = QTStr("Basic.Settings.ProgramRestart") + + QStringLiteral("\n\n") + + QTStr(MULTI_CHANNEL_WARNING) + + QStringLiteral("\n\n") + + QTStr(MULTI_CHANNEL_WARNING ".Confirm"); + + button = OBSMessageBox::question( + this, QTStr(MULTI_CHANNEL_WARNING ".Title"), + warningString); if (button == QMessageBox::No) { - QMetaObject::invokeMethod(ui->channelSetup, - "setCurrentIndex", Qt::QueuedConnection, - Q_ARG(int, lastChannelSetupIdx)); + QMetaObject::invokeMethod( + ui->channelSetup, "setCurrentIndex", + Qt::QueuedConnection, + Q_ARG(int, lastChannelSetupIdx)); return; } } @@ -4504,19 +4510,19 @@ if (qual == "Lossless") { QMessageBox::StandardButton button; - QString warningString = - SIMPLE_OUTPUT_WARNING("Lossless") + - QString("\n\n") + - SIMPLE_OUTPUT_WARNING("Lossless.Msg"); - - button = OBSMessageBox::question(this, - SIMPLE_OUTPUT_WARNING("Lossless.Title"), - warningString); + QString warningString = SIMPLE_OUTPUT_WARNING("Lossless") + + QString("\n\n") + + SIMPLE_OUTPUT_WARNING("Lossless.Msg"); + + button = OBSMessageBox::question( + this, SIMPLE_OUTPUT_WARNING("Lossless.Title"), + warningString); if (button == QMessageBox::No) { - QMetaObject::invokeMethod(ui->simpleOutRecQuality, - "setCurrentIndex", Qt::QueuedConnection, - Q_ARG(int, lastSimpleRecQualityIdx)); + QMetaObject::invokeMethod( + ui->simpleOutRecQuality, "setCurrentIndex", + Qt::QueuedConnection, + Q_ARG(int, lastSimpleRecQualityIdx)); return; } } @@ -4534,6 +4540,41 @@ #endif } +QIcon OBSBasicSettings::GetGeneralIcon() const +{ + return generalIcon; +} + +QIcon OBSBasicSettings::GetStreamIcon() const +{ + return streamIcon; +} + +QIcon OBSBasicSettings::GetOutputIcon() const +{ + return outputIcon; +} + +QIcon OBSBasicSettings::GetAudioIcon() const +{ + return audioIcon; +} + +QIcon OBSBasicSettings::GetVideoIcon() const +{ + return videoIcon; +} + +QIcon OBSBasicSettings::GetHotkeysIcon() const +{ + return hotkeysIcon; +} + +QIcon OBSBasicSettings::GetAdvancedIcon() const +{ + return advancedIcon; +} + void OBSBasicSettings::SetGeneralIcon(const QIcon &icon) { ui->listWidget->item(0)->setIcon(icon);
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-settings.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-settings.hpp
Changed
@@ -40,9 +40,9 @@ #include "ui_OBSBasicSettings.h" -#define VOLUME_METER_DECAY_FAST 23.53 -#define VOLUME_METER_DECAY_MEDIUM 11.76 -#define VOLUME_METER_DECAY_SLOW 8.57 +#define VOLUME_METER_DECAY_FAST 23.53 +#define VOLUME_METER_DECAY_MEDIUM 11.76 +#define VOLUME_METER_DECAY_SLOW 8.57 class SilentUpdateCheckBox : public QCheckBox { Q_OBJECT @@ -68,8 +68,7 @@ } }; -class OBSFFDeleter -{ +class OBSFFDeleter { public: void operator()(const ff_format_desc *format) { @@ -80,27 +79,25 @@ ff_codec_desc_free(codec); } }; -using OBSFFCodecDesc = std::unique_ptr<const ff_codec_desc, - OBSFFDeleter>; -using OBSFFFormatDesc = std::unique_ptr<const ff_format_desc, - OBSFFDeleter>; +using OBSFFCodecDesc = std::unique_ptr<const ff_codec_desc, OBSFFDeleter>; +using OBSFFFormatDesc = std::unique_ptr<const ff_format_desc, OBSFFDeleter>; class OBSBasicSettings : public QDialog { Q_OBJECT - Q_PROPERTY(QIcon generalIcon WRITE SetGeneralIcon - NOTIFY SetGeneralIcon) - Q_PROPERTY(QIcon streamIcon WRITE SetStreamIcon - NOTIFY SetStreamIcon) - Q_PROPERTY(QIcon outputIcon WRITE SetOutputIcon - NOTIFY SetOutputIcon) - Q_PROPERTY(QIcon audioIcon WRITE SetAudioIcon - NOTIFY SetAudioIcon) - Q_PROPERTY(QIcon videoIcon WRITE SetVideoIcon - NOTIFY SetVideoIcon) - Q_PROPERTY(QIcon hotkeysIcon WRITE SetHotkeysIcon - NOTIFY SetHotkeysIcon) - Q_PROPERTY(QIcon advancedIcon WRITE SetAdvancedIcon - NOTIFY SetAdvancedIcon) + Q_PROPERTY(QIcon generalIcon READ GetGeneralIcon WRITE SetGeneralIcon + DESIGNABLE true) + Q_PROPERTY(QIcon streamIcon READ GetStreamIcon WRITE SetStreamIcon + DESIGNABLE true) + Q_PROPERTY(QIcon outputIcon READ GetOutputIcon WRITE SetOutputIcon + DESIGNABLE true) + Q_PROPERTY(QIcon audioIcon READ GetAudioIcon WRITE SetAudioIcon + DESIGNABLE true) + Q_PROPERTY(QIcon videoIcon READ GetVideoIcon WRITE SetVideoIcon + DESIGNABLE true) + Q_PROPERTY(QIcon hotkeysIcon READ GetHotkeysIcon WRITE SetHotkeysIcon + DESIGNABLE true) + Q_PROPERTY(QIcon advancedIcon READ GetAdvancedIcon WRITE SetAdvancedIcon + DESIGNABLE true) private: OBSBasic *main; @@ -116,7 +113,7 @@ bool videoChanged = false; bool hotkeysChanged = false; bool advancedChanged = false; - int pageIndex = 0; + int pageIndex = 0; bool loading = true; std::string savedTheme; @@ -141,9 +138,9 @@ QString curAdvRecordEncoder; using AudioSource_t = - std::tuple<OBSWeakSource, - QPointer<QCheckBox>, QPointer<QSpinBox>, - QPointer<QCheckBox>, QPointer<QSpinBox>>; + std::tuple<OBSWeakSource, QPointer<QCheckBox>, + QPointer<QSpinBox>, QPointer<QCheckBox>, + QPointer<QSpinBox>>; std::vector<AudioSource_t> audioSources; std::vector<OBSSignal> audioSourceSignals; OBSSignal sourceCreated; @@ -157,24 +154,24 @@ uint32_t outputCY = 0; void SaveCombo(QComboBox *widget, const char *section, - const char *value); + const char *value); void SaveComboData(QComboBox *widget, const char *section, - const char *value); + const char *value); void SaveCheckBox(QAbstractButton *widget, const char *section, - const char *value, bool invert = false); + const char *value, bool invert = false); void SaveEdit(QLineEdit *widget, const char *section, - const char *value); + const char *value); void SaveSpinBox(QSpinBox *widget, const char *section, - const char *value); + const char *value); void SaveFormat(QComboBox *combo); void SaveEncoder(QComboBox *combo, const char *section, - const char *value); + const char *value); inline bool Changed() const { return generalChanged || outputsChanged || stream1Changed || - audioChanged || videoChanged || advancedChanged || - hotkeysChanged; + audioChanged || videoChanged || advancedChanged || + hotkeysChanged; } inline void EnableApplyButton(bool en) @@ -187,10 +184,10 @@ generalChanged = false; stream1Changed = false; outputsChanged = false; - audioChanged = false; - videoChanged = false; + audioChanged = false; + videoChanged = false; hotkeysChanged = false; - advancedChanged= false; + advancedChanged = false; EnableApplyButton(false); } @@ -214,12 +211,14 @@ void LoadOutputSettings(); void LoadAudioSettings(); void LoadVideoSettings(); - void LoadHotkeySettings(obs_hotkey_id ignoreKey=OBS_INVALID_HOTKEY_ID); + void + LoadHotkeySettings(obs_hotkey_id ignoreKey = OBS_INVALID_HOTKEY_ID); void LoadAdvancedSettings(); void LoadSettings(bool changedOnly); OBSPropertiesView *CreateEncoderPropertyView(const char *encoder, - const char *path, bool changed = false); + const char *path, + bool changed = false); /* general */ void LoadLanguageList(); @@ -241,8 +240,8 @@ void on_disconnectAccount_clicked(); void on_useStreamKey_clicked(); void on_useAuth_toggled(); -private: +private: /* output */ void LoadSimpleOutputSettings(); void LoadAdvOutputStreamingSettings(); @@ -251,9 +250,9 @@ void LoadAdvOutputRecordingEncoderProperties(); void LoadAdvOutputFFmpegSettings(); void LoadAdvOutputAudioSettings(); - void SetAdvOutputFFmpegEnablement( - ff_codec_type encoderType, bool enabled, - bool enableEncode = false); + void SetAdvOutputFFmpegEnablement(ff_codec_type encoderType, + bool enabled, + bool enableEncode = false); /* audio */ void LoadListValues(QComboBox *widget, obs_property_t *prop, int index); @@ -285,6 +284,22 @@ void RecalcOutputResPixels(const char *resText); + QIcon generalIcon; + QIcon streamIcon; + QIcon outputIcon; + QIcon audioIcon; + QIcon videoIcon; + QIcon hotkeysIcon; + QIcon advancedIcon; + + QIcon GetGeneralIcon() const; + QIcon GetStreamIcon() const; + QIcon GetOutputIcon() const; + QIcon GetAudioIcon() const; + QIcon GetVideoIcon() const; + QIcon GetHotkeysIcon() const; + QIcon GetAdvancedIcon() const; + private slots: void on_theme_activated(int idx); @@ -323,7 +338,7 @@ void VideoChangedResolution(); void VideoChangedRestart(); void HotkeysChanged(); - void ReloadHotkeys(obs_hotkey_id ignoreKey=OBS_INVALID_HOTKEY_ID); + void ReloadHotkeys(obs_hotkey_id ignoreKey = OBS_INVALID_HOTKEY_ID); void AdvancedChanged(); void AdvancedChangedRestart();
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-source-select.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-source-select.cpp
Changed
@@ -28,9 +28,10 @@ bool OBSBasicSourceSelect::EnumSources(void *data, obs_source_t *source) { - OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data); + OBSBasicSourceSelect *window = + static_cast<OBSBasicSourceSelect *>(data); const char *name = obs_source_get_name(source); - const char *id = obs_source_get_id(source); + const char *id = obs_source_get_id(source); if (strcmp(id, window->id) == 0) window->ui->sourceList->addItem(QT_UTF8(name)); @@ -40,13 +41,14 @@ bool OBSBasicSourceSelect::EnumGroups(void *data, obs_source_t *source) { - OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data); + OBSBasicSourceSelect *window = + static_cast<OBSBasicSourceSelect *>(data); const char *name = obs_source_get_name(source); - const char *id = obs_source_get_id(source); + const char *id = obs_source_get_id(source); if (strcmp(id, window->id) == 0) { - OBSBasic *main = reinterpret_cast<OBSBasic*>( - App()->GetMainWindow()); + OBSBasic *main = + reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); obs_sceneitem_t *existing = obs_scene_get_group(scene, name); @@ -59,25 +61,27 @@ void OBSBasicSourceSelect::OBSSourceAdded(void *data, calldata_t *calldata) { - OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data); - obs_source_t *source = (obs_source_t*)calldata_ptr(calldata, "source"); + OBSBasicSourceSelect *window = + static_cast<OBSBasicSourceSelect *>(data); + obs_source_t *source = (obs_source_t *)calldata_ptr(calldata, "source"); QMetaObject::invokeMethod(window, "SourceAdded", - Q_ARG(OBSSource, source)); + Q_ARG(OBSSource, source)); } void OBSBasicSourceSelect::OBSSourceRemoved(void *data, calldata_t *calldata) { - OBSBasicSourceSelect *window = static_cast<OBSBasicSourceSelect*>(data); - obs_source_t *source = (obs_source_t*)calldata_ptr(calldata, "source"); + OBSBasicSourceSelect *window = + static_cast<OBSBasicSourceSelect *>(data); + obs_source_t *source = (obs_source_t *)calldata_ptr(calldata, "source"); QMetaObject::invokeMethod(window, "SourceRemoved", - Q_ARG(OBSSource, source)); + Q_ARG(OBSSource, source)); } void OBSBasicSourceSelect::SourceAdded(OBSSource source) { - const char *name = obs_source_get_name(source); + const char *name = obs_source_get_name(source); const char *sourceId = obs_source_get_id(source); if (strcmp(sourceId, id) != 0) @@ -88,13 +92,13 @@ void OBSBasicSourceSelect::SourceRemoved(OBSSource source) { - const char *name = obs_source_get_name(source); + const char *name = obs_source_get_name(source); const char *sourceId = obs_source_get_id(source); if (strcmp(sourceId, id) != 0) return; - QList<QListWidgetItem*> items = + QList<QListWidgetItem *> items = ui->sourceList->findItems(name, Qt::MatchFixedString); if (!items.count()) @@ -120,8 +124,8 @@ dstr_copy(&new_name, name); for (;;) { - obs_source_t *existing_source = obs_get_source_by_name( - new_name.array); + obs_source_t *existing_source = + obs_get_source_by_name(new_name.array); if (!existing_source) break; @@ -135,7 +139,7 @@ static void AddExisting(const char *name, bool visible, bool duplicate) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSScene scene = main->GetCurrentScene(); if (!scene) return; @@ -166,19 +170,18 @@ } bool AddNew(QWidget *parent, const char *id, const char *name, - const bool visible, OBSSource &newSource) + const bool visible, OBSSource &newSource) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); - OBSScene scene = main->GetCurrentScene(); - bool success = false; + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); + OBSScene scene = main->GetCurrentScene(); + bool success = false; if (!scene) return false; obs_source_t *source = obs_get_source_by_name(name); if (source) { - OBSMessageBox::information(parent, - QTStr("NameExists.Title"), - QTStr("NameExists.Text")); + OBSMessageBox::information(parent, QTStr("NameExists.Title"), + QTStr("NameExists.Text")); } else { source = obs_source_create(id, name, NULL, nullptr); @@ -194,6 +197,14 @@ newSource = source; + /* set monitoring if source monitors by default */ + uint32_t flags = obs_source_get_output_flags(source); + if ((flags & OBS_SOURCE_MONITOR_BY_DEFAULT) != 0) { + obs_source_set_monitoring_type( + source, + OBS_MONITORING_TYPE_MONITOR_ONLY); + } + success = true; } } @@ -216,13 +227,13 @@ } else { if (ui->sourceName->text().isEmpty()) { OBSMessageBox::warning(this, - QTStr("NoNameEntered.Title"), - QTStr("NoNameEntered.Text")); + QTStr("NoNameEntered.Title"), + QTStr("NoNameEntered.Text")); return; } if (!AddNew(this, id, QT_TO_UTF8(ui->sourceName->text()), - visible, newSource)) + visible, newSource)) return; } @@ -243,16 +254,13 @@ Q_DECLARE_METATYPE(OBSScene); -template <typename T> -static inline T GetOBSRef(QListWidgetItem *item) +template<typename T> static inline T GetOBSRef(QListWidgetItem *item) { return item->data(static_cast<int>(QtDataRole::OBSRef)).value<T>(); } OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_) - : QDialog (parent), - ui (new Ui::OBSBasicSourceSelect), - id (id_) + : QDialog(parent), ui(new Ui::OBSBasicSourceSelect), id(id_) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -271,14 +279,14 @@ } ui->sourceName->setText(text); - ui->sourceName->setFocus(); //Fixes deselect of text. + ui->sourceName->setFocus(); //Fixes deselect of text. ui->sourceName->selectAll(); installEventFilter(CreateShortcutFilter()); if (strcmp(id_, "scene") == 0) { - OBSBasic *main = reinterpret_cast<OBSBasic*>( - App()->GetMainWindow()); + OBSBasic *main = + reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSSource curSceneSource = main->GetCurrentSceneSource(); ui->selectExisting->setChecked(true);
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-stats.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-stats.cpp
Changed
@@ -45,10 +45,10 @@ } OBSBasicStats::OBSBasicStats(QWidget *parent, bool closeable) - : QWidget (parent), - cpu_info (os_cpu_usage_info_start()), - timer (this), - recTimeLeft (this) + : QWidget(parent), + cpu_info(os_cpu_usage_info_start()), + timer(this), + recTimeLeft(this) { QVBoxLayout *mainLayout = new QVBoxLayout(); QGridLayout *topLayout = new QGridLayout(); @@ -58,15 +58,13 @@ int row = 0; - auto newStatBare = [&] (QString name, QWidget *label, int col) - { + auto newStatBare = [&](QString name, QWidget *label, int col) { QLabel *typeLabel = new QLabel(name, this); topLayout->addWidget(typeLabel, row, col); topLayout->addWidget(label, row++, col + 1); }; - auto newStat = [&] (const char *strLoc, QWidget *label, int col) - { + auto newStat = [&](const char *strLoc, QWidget *label, int col) { std::string str = "Basic.Stats."; str += strLoc; newStatBare(QTStr(str.c_str()), label, col); @@ -97,20 +95,19 @@ /* --------------------------------------------- */ QPushButton *closeButton = nullptr; - if(closeable) + if (closeable) closeButton = new QPushButton(QTStr("Close")); QPushButton *resetButton = new QPushButton(QTStr("Reset")); QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addStretch(); buttonLayout->addWidget(resetButton); - if(closeable) + if (closeable) buttonLayout->addWidget(closeButton); /* --------------------------------------------- */ int col = 0; - auto addOutputCol = [&] (const char *loc) - { + auto addOutputCol = [&](const char *loc) { QLabel *label = new QLabel(QTStr(loc), this); label->setStyleSheet("font-weight: bold"); outputLayout->addWidget(label, 0, col++); @@ -148,10 +145,10 @@ setLayout(mainLayout); /* --------------------------------------------- */ - if(closeable) + if (closeable) connect(closeButton, &QPushButton::clicked, - [this] () {close();}); - connect(resetButton, &QPushButton::clicked, [this] () {Reset();}); + [this]() { close(); }); + connect(resetButton, &QPushButton::clicked, [this]() { Reset(); }); delete shortcutFilter; shortcutFilter = CreateShortcutFilter(); @@ -165,7 +162,8 @@ setWindowModality(Qt::NonModal); setAttribute(Qt::WA_DeleteOnClose, true); - QObject::connect(&timer, &QTimer::timeout, this, &OBSBasicStats::Update); + QObject::connect(&timer, &QTimer::timeout, this, + &OBSBasicStats::Update); timer.setInterval(TIMER_INTERVAL); if (isVisible()) @@ -174,25 +172,24 @@ Update(); QObject::connect(&recTimeLeft, &QTimer::timeout, this, - &OBSBasicStats::RecordingTimeLeft); + &OBSBasicStats::RecordingTimeLeft); recTimeLeft.setInterval(REC_TIME_LEFT_INTERVAL); - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); - const char *geometry = config_get_string(main->Config(), - "Stats", "geometry"); + const char *geometry = + config_get_string(main->Config(), "Stats", "geometry"); if (geometry != NULL) { - QByteArray byteArray = QByteArray::fromBase64( - QByteArray(geometry)); + QByteArray byteArray = + QByteArray::fromBase64(QByteArray(geometry)); restoreGeometry(byteArray); QRect windowGeometry = normalGeometry(); if (!WindowPositionValid(windowGeometry)) { QRect rect = App()->desktop()->geometry(); - setGeometry(QStyle::alignedRect( - Qt::LeftToRight, - Qt::AlignCenter, - size(), rect)); + setGeometry(QStyle::alignedRect(Qt::LeftToRight, + Qt::AlignCenter, size(), + rect)); } } @@ -201,11 +198,10 @@ void OBSBasicStats::closeEvent(QCloseEvent *event) { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); if (isVisible()) { - config_set_string(main->Config(), - "Stats", "geometry", - saveGeometry().toBase64().constData()); + config_set_string(main->Config(), "Stats", "geometry", + saveGeometry().toBase64().constData()); config_save_safe(main->Config(), "tmp", nullptr); } @@ -254,15 +250,15 @@ void OBSBasicStats::InitializeValues() { video_t *video = obs_get_video(); - first_encoded = video_output_get_total_frames(video); - first_skipped = video_output_get_skipped_frames(video); + first_encoded = video_output_get_total_frames(video); + first_skipped = video_output_get_skipped_frames(video); first_rendered = obs_get_total_frames(); - first_lagged = obs_get_lagged_frames(); + first_lagged = obs_get_lagged_frames(); } void OBSBasicStats::Update() { - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); /* TODO: Un-hardcode */ @@ -302,9 +298,12 @@ /* ------------------ */ const char *mode = config_get_string(main->Config(), "Output", "Mode"); - const char *path = strcmp(mode, "Advanced") ? - config_get_string(main->Config(), "SimpleOutput", "FilePath") : - config_get_string(main->Config(), "AdvOut", "RecFilePath"); + const char *path = strcmp(mode, "Advanced") + ? config_get_string(main->Config(), + "SimpleOutput", + "FilePath") + : config_get_string(main->Config(), "AdvOut", + "RecFilePath"); #define MBYTE (1024ULL * 1024ULL) #define GBYTE (1024ULL * 1024ULL * 1024ULL) @@ -370,14 +369,14 @@ total_skipped -= first_skipped; num = total_encoded - ? (long double)total_skipped / (long double)total_encoded - : 0.0l; + ? (long double)total_skipped / (long double)total_encoded + : 0.0l; num *= 100.0l; - str = QString("%1 / %2 (%3%)").arg( - QString::number(total_skipped), - QString::number(total_encoded), - QString::number(num, 'f', 1)); + str = QString("%1 / %2 (%3%)") + .arg(QString::number(total_skipped), + QString::number(total_encoded), + QString::number(num, 'f', 1)); skippedFrames->setText(str); if (num > 5.0l) @@ -390,24 +389,24 @@ /* ------------------ */ uint32_t total_rendered = obs_get_total_frames(); - uint32_t total_lagged = obs_get_lagged_frames(); + uint32_t total_lagged = obs_get_lagged_frames(); if (total_rendered < first_rendered || total_lagged < first_lagged) { first_rendered = total_rendered; - first_lagged = total_lagged; + first_lagged = total_lagged; } total_rendered -= first_rendered; - total_lagged -= first_lagged; + total_lagged -= first_lagged; num = total_rendered - ? (long double)total_lagged / (long double)total_rendered - : 0.0l; + ? (long double)total_lagged / (long double)total_rendered + : 0.0l; num *= 100.0l; - str = QString("%1 / %2 (%3%)").arg( - QString::number(total_lagged), - QString::number(total_rendered), - QString::number(num, 'f', 1)); + str = QString("%1 / %2 (%3%)") + .arg(QString::number(total_lagged), + QString::number(total_rendered), + QString::number(num, 'f', 1)); missedFrames->setText(str); if (num > 5.0l) @@ -444,21 +443,21 @@ void OBSBasicStats::RecordingTimeLeft() { - long double averageBitrate = accumulate(bitrates.begin(), - bitrates.end(), 0.0) / - (long double)bitrates.size(); + long double averageBitrate = + accumulate(bitrates.begin(), bitrates.end(), 0.0) / + (long double)bitrates.size(); long double bytesPerSec = (averageBitrate / 8.0l) * 1000.0l; long double secondsUntilFull = (long double)num_bytes / bytesPerSec; bitrates.clear(); int totalMinutes = (int)secondsUntilFull / 60; - int minutes = totalMinutes % 60; - int hours = totalMinutes / 60; + int minutes = totalMinutes % 60; + int hours = totalMinutes / 60; QString text; - text.sprintf("%d %s, %d %s", hours, QT_TO_UTF8(QTStr("Hours")), - minutes, QT_TO_UTF8(QTStr("Minutes"))); + text.sprintf("%d %s, %d %s", hours, QT_TO_UTF8(QTStr("Hours")), minutes, + QT_TO_UTF8(QTStr("Minutes"))); recordTimeLeft->setText(text); recordTimeLeft->setMinimumWidth(recordTimeLeft->width()); } @@ -467,10 +466,10 @@ { timer.start(); - first_encoded = 0xFFFFFFFF; - first_skipped = 0xFFFFFFFF; + first_encoded = 0xFFFFFFFF; + first_skipped = 0xFFFFFFFF; first_rendered = 0xFFFFFFFF; - first_lagged = 0xFFFFFFFF; + first_lagged = 0xFFFFFFFF; OBSOutput strOutput = obs_frontend_get_streaming_output(); OBSOutput recOutput = obs_frontend_get_recording_output(); @@ -494,8 +493,8 @@ lastBytesSent = 0; uint64_t bitsBetween = (bytesSent - lastBytesSent) * 8; - long double timePassed = (long double)(curTime - lastBytesSentTime) / - 1000000000.0l; + long double timePassed = + (long double)(curTime - lastBytesSentTime) / 1000000000.0l; kbps = (long double)bitsBetween / timePassed / 1000.0l; if (timePassed < 0.01l) @@ -509,9 +508,9 @@ str = QTStr("Basic.Stats.Status.Recording"); } else { if (active) { - bool reconnecting = output - ? obs_output_reconnecting(output) - : false; + bool reconnecting = + output ? obs_output_reconnecting(output) + : false; if (reconnecting) { str = QTStr("Basic.Stats.Status.Reconnecting"); @@ -529,30 +528,29 @@ long double num = (long double)totalBytes / (1024.0l * 1024.0l); megabytesSent->setText( - QString("%1 MB").arg(QString::number(num, 'f', 1))); - bitrate->setText( - QString("%1 kb/s").arg(QString::number(kbps, 'f', 0))); + QString("%1 MB").arg(QString::number(num, 'f', 1))); + bitrate->setText(QString("%1 kb/s").arg(QString::number(kbps, 'f', 0))); if (!rec) { int total = output ? obs_output_get_total_frames(output) : 0; - int dropped = output ? obs_output_get_frames_dropped(output) : 0; + int dropped = output ? obs_output_get_frames_dropped(output) + : 0; if (total < first_total || dropped < first_dropped) { - first_total = 0; + first_total = 0; first_dropped = 0; } - total -= first_total; + total -= first_total; dropped -= first_dropped; - num = total - ? (long double)dropped / (long double)total * 100.0l - : 0.0l; + num = total ? (long double)dropped / (long double)total * 100.0l + : 0.0l; - str = QString("%1 / %2 (%3%)").arg( - QString::number(dropped), - QString::number(total), - QString::number(num, 'f', 1)); + str = QString("%1 / %2 (%3%)") + .arg(QString::number(dropped), + QString::number(total), + QString::number(num, 'f', 1)); droppedFrames->setText(str); if (num > 5.0l) @@ -563,7 +561,7 @@ setThemeID(droppedFrames, ""); } - lastBytesSent = bytesSent; + lastBytesSent = bytesSent; lastBytesSentTime = curTime; } @@ -572,7 +570,7 @@ if (!output) return; - first_total = obs_output_get_total_frames(output); + first_total = obs_output_get_total_frames(output); first_dropped = obs_output_get_frames_dropped(output); }
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-status-bar.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-status-bar.cpp
Changed
@@ -8,16 +8,16 @@ #include "window-basic-main-outputs.hpp" OBSBasicStatusBar::OBSBasicStatusBar(QWidget *parent) - : QStatusBar (parent), - delayInfo (new QLabel), - droppedFrames (new QLabel), - streamTime (new QLabel), - recordTime (new QLabel), - cpuUsage (new QLabel), - transparentPixmap (20, 20), - greenPixmap (20, 20), - grayPixmap (20, 20), - redPixmap (20, 20) + : QStatusBar(parent), + delayInfo(new QLabel), + droppedFrames(new QLabel), + streamTime(new QLabel), + recordTime(new QLabel), + cpuUsage(new QLabel), + transparentPixmap(20, 20), + greenPixmap(20, 20), + grayPixmap(20, 20), + redPixmap(20, 20) { streamTime->setText(QString("LIVE: 00:00:00")); recordTime->setText(QString("REC: 00:00:00")); @@ -74,11 +74,11 @@ { if (!active) { refreshTimer = new QTimer(this); - connect(refreshTimer, SIGNAL(timeout()), - this, SLOT(UpdateStatusBar())); + connect(refreshTimer, SIGNAL(timeout()), this, + SLOT(UpdateStatusBar())); int skipped = video_output_get_skipped_frames(obs_get_video()); - int total = video_output_get_total_frames(obs_get_video()); + int total = video_output_get_total_frames(obs_get_video()); totalStreamSeconds = 0; totalRecordSeconds = 0; @@ -97,7 +97,7 @@ void OBSBasicStatusBar::Deactivate() { - OBSBasic *main = qobject_cast<OBSBasic*>(parent()); + OBSBasic *main = qobject_cast<OBSBasic *>(parent()); if (!main) return; @@ -145,7 +145,7 @@ } else if (delaySecStarting && delaySecStopping) { msg = QTStr("Basic.StatusBar.DelayStartingStoppingIn"); msg = msg.arg(QString::number(delaySecStopping), - QString::number(delaySecStarting)); + QString::number(delaySecStarting)); } else { msg = QTStr("Basic.StatusBar.Delay"); msg = msg.arg(QString::number(delaySecTotal)); @@ -165,7 +165,7 @@ if (++bitrateUpdateSeconds < BITRATE_UPDATE_SECONDS) return; - uint64_t bytesSent = obs_output_get_total_bytes(streamOutput); + uint64_t bytesSent = obs_output_get_total_bytes(streamOutput); uint64_t bytesSentTime = os_gettime_ns(); if (bytesSent < lastBytesSent) @@ -173,28 +173,27 @@ if (bytesSent == 0) lastBytesSent = 0; - uint64_t bitsBetween = (bytesSent - lastBytesSent) * 8; + uint64_t bitsBetween = (bytesSent - lastBytesSent) * 8; - double timePassed = double(bytesSentTime - lastBytesSentTime) / - 1000000000.0; + double timePassed = + double(bytesSentTime - lastBytesSentTime) / 1000000000.0; double kbitsPerSec = double(bitsBetween) / timePassed / 1000.0; QString text; - text += QString("kb/s: ") + - QString::number(kbitsPerSec, 'f', 0); + text += QString("kb/s: ") + QString::number(kbitsPerSec, 'f', 0); kbps->setText(text); kbps->setMinimumWidth(kbps->width()); - lastBytesSent = bytesSent; - lastBytesSentTime = bytesSentTime; + lastBytesSent = bytesSent; + lastBytesSentTime = bytesSentTime; bitrateUpdateSeconds = 0; } void OBSBasicStatusBar::UpdateCPUUsage() { - OBSBasic *main = qobject_cast<OBSBasic*>(parent()); + OBSBasic *main = qobject_cast<OBSBasic *>(parent()); if (!main) return; @@ -211,10 +210,10 @@ { totalStreamSeconds++; - int seconds = totalStreamSeconds % 60; + int seconds = totalStreamSeconds % 60; int totalMinutes = totalStreamSeconds / 60; - int minutes = totalMinutes % 60; - int hours = totalMinutes / 60; + int minutes = totalMinutes % 60; + int hours = totalMinutes / 60; QString text; text.sprintf("LIVE: %02d:%02d:%02d", hours, minutes, seconds); @@ -223,8 +222,8 @@ if (reconnectTimeout > 0) { QString msg = QTStr("Basic.StatusBar.Reconnecting") - .arg(QString::number(retries), - QString::number(reconnectTimeout)); + .arg(QString::number(retries), + QString::number(reconnectTimeout)); showMessage(msg); reconnectTimeout--; @@ -242,17 +241,28 @@ } } +extern volatile bool recording_paused; + void OBSBasicStatusBar::UpdateRecordTime() { - totalRecordSeconds++; + bool paused = os_atomic_load_bool(&recording_paused); - int seconds = totalRecordSeconds % 60; - int totalMinutes = totalRecordSeconds / 60; - int minutes = totalMinutes % 60; - int hours = totalMinutes / 60; + if (!paused) + totalRecordSeconds++; QString text; - text.sprintf("REC: %02d:%02d:%02d", hours, minutes, seconds); + + if (paused) { + text = QStringLiteral("REC: PAUSED"); + } else { + int seconds = totalRecordSeconds % 60; + int totalMinutes = totalRecordSeconds / 60; + int minutes = totalMinutes % 60; + int hours = totalMinutes / 60; + + text.sprintf("REC: %02d:%02d:%02d", hours, minutes, seconds); + } + recordTime->setText(text); recordTime->setMinimumWidth(recordTime->width()); } @@ -263,8 +273,8 @@ return; int totalDropped = obs_output_get_frames_dropped(streamOutput); - int totalFrames = obs_output_get_total_frames(streamOutput); - double percent = (double)totalDropped / (double)totalFrames * 100.0; + int totalFrames = obs_output_get_total_frames(streamOutput); + double percent = (double)totalDropped / (double)totalFrames * 100.0; if (!totalFrames) return; @@ -293,11 +303,13 @@ QPixmap pixmap(20, 20); float red = avgCongestion * 2.0f; - if (red > 1.0f) red = 1.0f; + if (red > 1.0f) + red = 1.0f; red *= 255.0; float green = (1.0f - avgCongestion) * 2.0f; - if (green > 1.0f) green = 1.0f; + if (green > 1.0f) + green = 1.0f; green *= 255.0; pixmap.fill(QColor(int(red), int(green), 0)); @@ -310,17 +322,18 @@ void OBSBasicStatusBar::OBSOutputReconnect(void *data, calldata_t *params) { OBSBasicStatusBar *statusBar = - reinterpret_cast<OBSBasicStatusBar*>(data); + reinterpret_cast<OBSBasicStatusBar *>(data); int seconds = (int)calldata_int(params, "timeout_sec"); QMetaObject::invokeMethod(statusBar, "Reconnect", Q_ARG(int, seconds)); UNUSED_PARAMETER(params); } -void OBSBasicStatusBar::OBSOutputReconnectSuccess(void *data, calldata_t *params) +void OBSBasicStatusBar::OBSOutputReconnectSuccess(void *data, + calldata_t *params) { OBSBasicStatusBar *statusBar = - reinterpret_cast<OBSBasicStatusBar*>(data); + reinterpret_cast<OBSBasicStatusBar *>(data); QMetaObject::invokeMethod(statusBar, "ReconnectSuccess"); UNUSED_PARAMETER(params); @@ -328,12 +341,12 @@ void OBSBasicStatusBar::Reconnect(int seconds) { - OBSBasic *main = qobject_cast<OBSBasic*>(parent()); + OBSBasic *main = qobject_cast<OBSBasic *>(parent()); if (!retries) main->SysTrayNotify( - QTStr("Basic.SystemTray.Message.Reconnecting"), - QSystemTrayIcon::Warning); + QTStr("Basic.SystemTray.Message.Reconnecting"), + QSystemTrayIcon::Warning); reconnectTimeout = seconds; @@ -347,18 +360,18 @@ void OBSBasicStatusBar::ReconnectClear() { - retries = 0; - reconnectTimeout = 0; + retries = 0; + reconnectTimeout = 0; bitrateUpdateSeconds = -1; - lastBytesSent = 0; - lastBytesSentTime = os_gettime_ns(); - delaySecTotal = 0; + lastBytesSent = 0; + lastBytesSentTime = os_gettime_ns(); + delaySecTotal = 0; UpdateDelayMsg(); } void OBSBasicStatusBar::ReconnectSuccess() { - OBSBasic *main = qobject_cast<OBSBasic*>(parent()); + OBSBasic *main = qobject_cast<OBSBasic *>(parent()); QString msg = QTStr("Basic.StatusBar.ReconnectSuccessful"); showMessage(msg, 4000); @@ -373,7 +386,7 @@ void OBSBasicStatusBar::UpdateStatusBar() { - OBSBasic *main = qobject_cast<OBSBasic*>(parent()); + OBSBasic *main = qobject_cast<OBSBasic *>(parent()); UpdateBandwidth(); @@ -386,10 +399,10 @@ UpdateDroppedFrames(); int skipped = video_output_get_skipped_frames(obs_get_video()); - int total = video_output_get_total_frames(obs_get_video()); + int total = video_output_get_total_frames(obs_get_video()); skipped -= startSkippedFrameCount; - total -= startTotalFrameCount; + total -= startTotalFrameCount; int diff = skipped - lastSkippedFrameCount; double percentage = double(skipped) / double(total) * 100.0; @@ -398,7 +411,7 @@ showMessage(QTStr("HighResourceUsage"), 4000); if (!main->isVisible() && overloadedNotify) { main->SysTrayNotify(QTStr("HighResourceUsage"), - QSystemTrayIcon::Warning); + QSystemTrayIcon::Warning); overloadedNotify = false; } } @@ -408,7 +421,7 @@ void OBSBasicStatusBar::StreamDelayStarting(int sec) { - OBSBasic *main = qobject_cast<OBSBasic*>(parent()); + OBSBasic *main = qobject_cast<OBSBasic *>(parent()); if (!main || !main->outputHandler) return; @@ -430,12 +443,13 @@ streamOutput = output; signal_handler_connect(obs_output_get_signal_handler(streamOutput), - "reconnect", OBSOutputReconnect, this); + "reconnect", OBSOutputReconnect, this); signal_handler_connect(obs_output_get_signal_handler(streamOutput), - "reconnect_success", OBSOutputReconnectSuccess, this); + "reconnect_success", OBSOutputReconnectSuccess, + this); - retries = 0; - lastBytesSent = 0; + retries = 0; + lastBytesSent = 0; lastBytesSentTime = os_gettime_ns(); Activate(); } @@ -444,12 +458,11 @@ { if (streamOutput) { signal_handler_disconnect( - obs_output_get_signal_handler(streamOutput), - "reconnect", OBSOutputReconnect, this); + obs_output_get_signal_handler(streamOutput), + "reconnect", OBSOutputReconnect, this); signal_handler_disconnect( - obs_output_get_signal_handler(streamOutput), - "reconnect_success", OBSOutputReconnectSuccess, - this); + obs_output_get_signal_handler(streamOutput), + "reconnect_success", OBSOutputReconnectSuccess, this); ReconnectClear(); streamOutput = nullptr;
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-status-bar.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-status-bar.hpp
Changed
@@ -39,7 +39,7 @@ int startTotalFrameCount = 0; int lastSkippedFrameCount = 0; - int bitrateUpdateSeconds = 0; + int bitrateUpdateSeconds = 0; uint64_t lastBytesSent = 0; uint64_t lastBytesSentTime = 0;
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-transform.cpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-transform.cpp
Changed
@@ -6,7 +6,7 @@ static bool find_sel(obs_scene_t *, obs_sceneitem_t *item, void *param) { - OBSSceneItem &dst = *reinterpret_cast<OBSSceneItem*>(param); + OBSSceneItem &dst = *reinterpret_cast<OBSSceneItem *>(param); if (obs_sceneitem_selected(item)) { dst = item; @@ -30,38 +30,36 @@ } void OBSBasicTransform::HookWidget(QWidget *widget, const char *signal, - const char *slot) + const char *slot) { QObject::connect(widget, signal, this, slot); } -#define COMBO_CHANGED SIGNAL(currentIndexChanged(int)) +#define COMBO_CHANGED SIGNAL(currentIndexChanged(int)) #define ISCROLL_CHANGED SIGNAL(valueChanged(int)) #define DSCROLL_CHANGED SIGNAL(valueChanged(double)) OBSBasicTransform::OBSBasicTransform(OBSBasic *parent) - : QDialog (parent), - ui (new Ui::OBSBasicTransform), - main (parent) + : QDialog(parent), ui(new Ui::OBSBasicTransform), main(parent) { ui->setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - HookWidget(ui->positionX, DSCROLL_CHANGED, SLOT(OnControlChanged())); - HookWidget(ui->positionY, DSCROLL_CHANGED, SLOT(OnControlChanged())); - HookWidget(ui->rotation, DSCROLL_CHANGED, SLOT(OnControlChanged())); - HookWidget(ui->sizeX, DSCROLL_CHANGED, SLOT(OnControlChanged())); - HookWidget(ui->sizeY, DSCROLL_CHANGED, SLOT(OnControlChanged())); - HookWidget(ui->align, COMBO_CHANGED, SLOT(OnControlChanged())); - HookWidget(ui->boundsType, COMBO_CHANGED, SLOT(OnBoundsType(int))); - HookWidget(ui->boundsAlign, COMBO_CHANGED, SLOT(OnControlChanged())); - HookWidget(ui->boundsWidth, DSCROLL_CHANGED, SLOT(OnControlChanged())); + HookWidget(ui->positionX, DSCROLL_CHANGED, SLOT(OnControlChanged())); + HookWidget(ui->positionY, DSCROLL_CHANGED, SLOT(OnControlChanged())); + HookWidget(ui->rotation, DSCROLL_CHANGED, SLOT(OnControlChanged())); + HookWidget(ui->sizeX, DSCROLL_CHANGED, SLOT(OnControlChanged())); + HookWidget(ui->sizeY, DSCROLL_CHANGED, SLOT(OnControlChanged())); + HookWidget(ui->align, COMBO_CHANGED, SLOT(OnControlChanged())); + HookWidget(ui->boundsType, COMBO_CHANGED, SLOT(OnBoundsType(int))); + HookWidget(ui->boundsAlign, COMBO_CHANGED, SLOT(OnControlChanged())); + HookWidget(ui->boundsWidth, DSCROLL_CHANGED, SLOT(OnControlChanged())); HookWidget(ui->boundsHeight, DSCROLL_CHANGED, SLOT(OnControlChanged())); - HookWidget(ui->cropLeft, ISCROLL_CHANGED, SLOT(OnCropChanged())); - HookWidget(ui->cropRight, ISCROLL_CHANGED, SLOT(OnCropChanged())); - HookWidget(ui->cropTop, ISCROLL_CHANGED, SLOT(OnCropChanged())); - HookWidget(ui->cropBottom, ISCROLL_CHANGED, SLOT(OnCropChanged())); + HookWidget(ui->cropLeft, ISCROLL_CHANGED, SLOT(OnCropChanged())); + HookWidget(ui->cropRight, ISCROLL_CHANGED, SLOT(OnCropChanged())); + HookWidget(ui->cropTop, ISCROLL_CHANGED, SLOT(OnCropChanged())); + HookWidget(ui->cropBottom, ISCROLL_CHANGED, SLOT(OnCropChanged())); ui->buttonBox->button(QDialogButtonBox::Close)->setDefault(true); @@ -76,7 +74,7 @@ SetItem(item); channelChangedSignal.Connect(obs_get_signal_handler(), "channel_change", - OBSChannelChanged, this); + OBSChannelChanged, this); } void OBSBasicTransform::SetScene(OBSScene scene) @@ -88,23 +86,24 @@ if (scene) { OBSSource source = obs_scene_get_source(scene); - signal_handler_t *signal = obs_source_get_signal_handler(source); + signal_handler_t *signal = + obs_source_get_signal_handler(source); transformSignal.Connect(signal, "item_transform", - OBSSceneItemTransform, this); - removeSignal.Connect(signal, "item_remove", - OBSSceneItemRemoved, this); - selectSignal.Connect(signal, "item_select", - OBSSceneItemSelect, this); + OBSSceneItemTransform, this); + removeSignal.Connect(signal, "item_remove", OBSSceneItemRemoved, + this); + selectSignal.Connect(signal, "item_select", OBSSceneItemSelect, + this); deselectSignal.Connect(signal, "item_deselect", - OBSSceneItemDeselect, this); + OBSSceneItemDeselect, this); } } void OBSBasicTransform::SetItem(OBSSceneItem newItem) { QMetaObject::invokeMethod(this, "SetItemQt", - Q_ARG(OBSSceneItem, OBSSceneItem(newItem))); + Q_ARG(OBSSceneItem, OBSSceneItem(newItem))); } void OBSBasicTransform::SetItemQt(OBSSceneItem newItem) @@ -118,9 +117,10 @@ void OBSBasicTransform::OBSChannelChanged(void *param, calldata_t *data) { - OBSBasicTransform *window = reinterpret_cast<OBSBasicTransform*>(param); + OBSBasicTransform *window = + reinterpret_cast<OBSBasicTransform *>(param); uint32_t channel = (uint32_t)calldata_int(data, "channel"); - OBSSource source = (obs_source_t*)calldata_ptr(data, "source"); + OBSSource source = (obs_source_t *)calldata_ptr(data, "source"); if (channel == 0) { OBSScene scene = obs_scene_from_source(source); @@ -135,8 +135,9 @@ void OBSBasicTransform::OBSSceneItemTransform(void *param, calldata_t *data) { - OBSBasicTransform *window = reinterpret_cast<OBSBasicTransform*>(param); - OBSSceneItem item = (obs_sceneitem_t*)calldata_ptr(data, "item"); + OBSBasicTransform *window = + reinterpret_cast<OBSBasicTransform *>(param); + OBSSceneItem item = (obs_sceneitem_t *)calldata_ptr(data, "item"); if (item == window->item && !window->ignoreTransformSignal) QMetaObject::invokeMethod(window, "RefreshControls"); @@ -144,9 +145,10 @@ void OBSBasicTransform::OBSSceneItemRemoved(void *param, calldata_t *data) { - OBSBasicTransform *window = reinterpret_cast<OBSBasicTransform*>(param); - OBSScene scene = (obs_scene_t*)calldata_ptr(data, "scene"); - OBSSceneItem item = (obs_sceneitem_t*)calldata_ptr(data, "item"); + OBSBasicTransform *window = + reinterpret_cast<OBSBasicTransform *>(param); + OBSScene scene = (obs_scene_t *)calldata_ptr(data, "scene"); + OBSSceneItem item = (obs_sceneitem_t *)calldata_ptr(data, "item"); if (item == window->item) window->SetItem(FindASelectedItem(scene)); @@ -154,8 +156,9 @@ void OBSBasicTransform::OBSSceneItemSelect(void *param, calldata_t *data) { - OBSBasicTransform *window = reinterpret_cast<OBSBasicTransform*>(param); - OBSSceneItem item = (obs_sceneitem_t*)calldata_ptr(data, "item"); + OBSBasicTransform *window = + reinterpret_cast<OBSBasicTransform *>(param); + OBSSceneItem item = (obs_sceneitem_t *)calldata_ptr(data, "item"); if (item != window->item) window->SetItem(item); @@ -163,25 +166,24 @@ void OBSBasicTransform::OBSSceneItemDeselect(void *param, calldata_t *data) { - OBSBasicTransform *window = reinterpret_cast<OBSBasicTransform*>(param); - OBSScene scene = (obs_scene_t*)calldata_ptr(data, "scene"); - OBSSceneItem item = (obs_sceneitem_t*)calldata_ptr(data, "item"); + OBSBasicTransform *window = + reinterpret_cast<OBSBasicTransform *>(param); + OBSScene scene = (obs_scene_t *)calldata_ptr(data, "scene"); + OBSSceneItem item = (obs_sceneitem_t *)calldata_ptr(data, "item"); if (item == window->item) window->SetItem(FindASelectedItem(scene)); } -static const uint32_t listToAlign[] = { - OBS_ALIGN_TOP | OBS_ALIGN_LEFT, - OBS_ALIGN_TOP, - OBS_ALIGN_TOP | OBS_ALIGN_RIGHT, - OBS_ALIGN_LEFT, - OBS_ALIGN_CENTER, - OBS_ALIGN_RIGHT, - OBS_ALIGN_BOTTOM | OBS_ALIGN_LEFT, - OBS_ALIGN_BOTTOM, - OBS_ALIGN_BOTTOM | OBS_ALIGN_RIGHT -}; +static const uint32_t listToAlign[] = {OBS_ALIGN_TOP | OBS_ALIGN_LEFT, + OBS_ALIGN_TOP, + OBS_ALIGN_TOP | OBS_ALIGN_RIGHT, + OBS_ALIGN_LEFT, + OBS_ALIGN_CENTER, + OBS_ALIGN_RIGHT, + OBS_ALIGN_BOTTOM | OBS_ALIGN_LEFT, + OBS_ALIGN_BOTTOM, + OBS_ALIGN_BOTTOM | OBS_ALIGN_RIGHT}; static int AlignToList(uint32_t align) { @@ -207,10 +209,10 @@ obs_sceneitem_get_crop(item, &crop); obs_source_t *source = obs_sceneitem_get_source(item); - float width = float(obs_source_get_width(source)); + float width = float(obs_source_get_width(source)); float height = float(obs_source_get_height(source)); - int alignIndex = AlignToList(osi.alignment); + int alignIndex = AlignToList(osi.alignment); int boundsAlignIndex = AlignToList(osi.bounds_alignment); ignoreItemChange = true; @@ -238,8 +240,8 @@ if (index == -1) return; - obs_bounds_type type = (obs_bounds_type)index; - bool enable = (type != OBS_BOUNDS_NONE); + obs_bounds_type type = (obs_bounds_type)index; + bool enable = (type != OBS_BOUNDS_NONE); ui->boundsAlign->setEnabled(enable); ui->boundsWidth->setEnabled(enable); @@ -249,7 +251,7 @@ obs_bounds_type lastType = obs_sceneitem_get_bounds_type(item); if (lastType == OBS_BOUNDS_NONE) { OBSSource source = obs_sceneitem_get_source(item); - int width = (int)obs_source_get_width(source); + int width = (int)obs_source_get_width(source); int height = (int)obs_source_get_height(source); ui->boundsWidth->setValue(width); @@ -266,21 +268,21 @@ return; obs_source_t *source = obs_sceneitem_get_source(item); - double width = double(obs_source_get_width(source)); + double width = double(obs_source_get_width(source)); double height = double(obs_source_get_height(source)); obs_transform_info oti; - oti.pos.x = float(ui->positionX->value()); - oti.pos.y = float(ui->positionY->value()); - oti.rot = float(ui->rotation->value()); - oti.scale.x = float(ui->sizeX->value() / width); - oti.scale.y = float(ui->sizeY->value() / height); - oti.alignment = listToAlign[ui->align->currentIndex()]; - - oti.bounds_type = (obs_bounds_type)ui->boundsType->currentIndex(); + oti.pos.x = float(ui->positionX->value()); + oti.pos.y = float(ui->positionY->value()); + oti.rot = float(ui->rotation->value()); + oti.scale.x = float(ui->sizeX->value() / width); + oti.scale.y = float(ui->sizeY->value() / height); + oti.alignment = listToAlign[ui->align->currentIndex()]; + + oti.bounds_type = (obs_bounds_type)ui->boundsType->currentIndex(); oti.bounds_alignment = listToAlign[ui->boundsAlign->currentIndex()]; - oti.bounds.x = float(ui->boundsWidth->value()); - oti.bounds.y = float(ui->boundsHeight->value()); + oti.bounds.x = float(ui->boundsWidth->value()); + oti.bounds.y = float(ui->boundsHeight->value()); ignoreTransformSignal = true; obs_sceneitem_set_info(item, &oti); @@ -293,9 +295,9 @@ return; obs_sceneitem_crop crop; - crop.left = uint32_t(ui->cropLeft->value()); - crop.right = uint32_t(ui->cropRight->value()); - crop.top = uint32_t(ui->cropTop->value()); + crop.left = uint32_t(ui->cropLeft->value()); + crop.right = uint32_t(ui->cropRight->value()); + crop.top = uint32_t(ui->cropTop->value()); crop.bottom = uint32_t(ui->cropBottom->value()); ignoreTransformSignal = true;
View file
obs-studio-23.2.1.tar.xz/UI/window-basic-transform.hpp -> obs-studio-24.0.0.tar.xz/UI/window-basic-transform.hpp
Changed
@@ -13,16 +13,16 @@ private: std::unique_ptr<Ui::OBSBasicTransform> ui; - OBSBasic *main; + OBSBasic *main; OBSSceneItem item; - OBSSignal channelChangedSignal; - OBSSignal transformSignal; - OBSSignal removeSignal; - OBSSignal selectSignal; - OBSSignal deselectSignal; - - bool ignoreTransformSignal = false; - bool ignoreItemChange = false; + OBSSignal channelChangedSignal; + OBSSignal transformSignal; + OBSSignal removeSignal; + OBSSignal selectSignal; + OBSSignal deselectSignal; + + bool ignoreTransformSignal = false; + bool ignoreItemChange = false; void HookWidget(QWidget *widget, const char *signal, const char *slot);
View file
obs-studio-24.0.0.tar.xz/UI/window-dock-browser.cpp
Added
@@ -0,0 +1,20 @@ +#include "window-dock-browser.hpp" +#include <QCloseEvent> + +void BrowserDock::closeEvent(QCloseEvent *event) +{ + OBSDock::closeEvent(event); + + if (!event->isAccepted()) { + return; + } + + static int panel_version = -1; + if (panel_version == -1) { + panel_version = obs_browser_qcef_version(); + } + + if (panel_version >= 2) { + cefWidget->closeBrowser(); + } +}
View file
obs-studio-24.0.0.tar.xz/UI/window-dock-browser.hpp
Added
@@ -0,0 +1,23 @@ +#pragma once + +#include "window-dock.hpp" +#include <QScopedPointer> + +#include <browser-panel.hpp> +extern QCef *cef; +extern QCefCookieManager *panel_cookies; + +class BrowserDock : public OBSDock { +public: + inline BrowserDock() : OBSDock() {} + + QScopedPointer<QCefWidget> cefWidget; + + inline void SetWidget(QCefWidget *widget_) + { + setWidget(widget_); + cefWidget.reset(widget_); + } + + void closeEvent(QCloseEvent *event) override; +};
View file
obs-studio-23.2.1.tar.xz/UI/window-dock.cpp -> obs-studio-24.0.0.tar.xz/UI/window-dock.cpp
Changed
@@ -6,8 +6,7 @@ void OBSDock::closeEvent(QCloseEvent *event) { - auto msgBox = [] () - { + auto msgBox = []() { QMessageBox msgbox(App()->GetMainWindow()); msgbox.setWindowTitle(QTStr("DockCloseWarning.Title")); msgbox.setText(QTStr("DockCloseWarning.Text")); @@ -27,11 +26,10 @@ }; bool warned = config_get_bool(App()->GlobalConfig(), "General", - "WarnedAboutClosingDocks"); + "WarnedAboutClosingDocks"); if (!warned) { - QMetaObject::invokeMethod(App(), "Exec", - Qt::QueuedConnection, - Q_ARG(VoidFunc, msgBox)); + QMetaObject::invokeMethod(App(), "Exec", Qt::QueuedConnection, + Q_ARG(VoidFunc, msgBox)); } QDockWidget::closeEvent(event);
View file
obs-studio-24.0.0.tar.xz/UI/window-extra-browsers.cpp
Added
@@ -0,0 +1,562 @@ +#include "window-extra-browsers.hpp" +#include "window-dock-browser.hpp" +#include "window-basic-main.hpp" +#include "qt-wrappers.hpp" + +#include <QLineEdit> +#include <QHBoxLayout> + +#include <json11.hpp> + +#include "ui_OBSExtraBrowsers.h" + +using namespace json11; + +#define OBJ_NAME_SUFFIX "_extraBrowser" + +enum class Column : int { + Title, + Url, + Delete, + + Count, +}; + +/* ------------------------------------------------------------------------- */ + +void ExtraBrowsersModel::Reset() +{ + items.clear(); + + OBSBasic *main = OBSBasic::Get(); + + for (int i = 0; i < main->extraBrowserDocks.size(); i++) { + BrowserDock *dock = reinterpret_cast<BrowserDock *>( + main->extraBrowserDocks[i].data()); + + Item item; + item.prevIdx = i; + item.title = dock->windowTitle(); + item.url = main->extraBrowserDockTargets[i]; + items.push_back(item); + } +} + +int ExtraBrowsersModel::rowCount(const QModelIndex &) const +{ + int count = items.size() + 1; + return count; +} + +int ExtraBrowsersModel::columnCount(const QModelIndex &) const +{ + return (int)Column::Count; +} + +QVariant ExtraBrowsersModel::data(const QModelIndex &index, int role) const +{ + int column = index.column(); + int idx = index.row(); + int count = items.size(); + bool validRole = role == Qt::DisplayRole || + role == Qt::AccessibleTextRole; + + if (!validRole) + return QVariant(); + + if (idx >= 0 && idx < count) { + switch (column) { + case (int)Column::Title: + return items[idx].title; + case (int)Column::Url: + return items[idx].url; + } + } else if (idx == count) { + switch (column) { + case (int)Column::Title: + return newTitle; + case (int)Column::Url: + return newURL; + } + } + + return QVariant(); +} + +QVariant ExtraBrowsersModel::headerData(int section, + Qt::Orientation orientation, + int role) const +{ + bool validRole = role == Qt::DisplayRole || + role == Qt::AccessibleTextRole; + + if (validRole && orientation == Qt::Orientation::Horizontal) { + switch (section) { + case (int)Column::Title: + return QTStr("ExtraBrowsers.DockName"); + case (int)Column::Url: + return QStringLiteral("URL"); + } + } + + return QVariant(); +} + +Qt::ItemFlags ExtraBrowsersModel::flags(const QModelIndex &index) const +{ + Qt::ItemFlags flags = QAbstractTableModel::flags(index); + + if (index.column() != (int)Column::Delete) + flags |= Qt::ItemIsEditable; + + return flags; +} + +class DelButton : public QPushButton { +public: + inline DelButton(QModelIndex index_) : QPushButton(), index(index_) {} + + QPersistentModelIndex index; +}; + +class EditWidget : public QLineEdit { +public: + inline EditWidget(QWidget *parent, QModelIndex index_) + : QLineEdit(parent), index(index_) + { + } + + QPersistentModelIndex index; +}; + +void ExtraBrowsersModel::AddDeleteButton(int idx) +{ + QTableView *widget = reinterpret_cast<QTableView *>(parent()); + + QModelIndex index = createIndex(idx, (int)Column::Delete, nullptr); + + QPushButton *del = new DelButton(index); + del->setProperty("themeID", "trashIcon"); + del->setObjectName("extraPanelDelete"); + del->setFixedSize(QSize(20, 20)); + connect(del, &QPushButton::clicked, this, + &ExtraBrowsersModel::DeleteItem); + + widget->setIndexWidget(index, del); + widget->setRowHeight(idx, 20); + widget->setColumnWidth(idx, 20); +} + +void ExtraBrowsersModel::CheckToAdd() +{ + if (newTitle.isEmpty() || newURL.isEmpty()) + return; + + int idx = items.size() + 1; + beginInsertRows(QModelIndex(), idx, idx); + + Item item; + item.prevIdx = -1; + item.title = newTitle; + item.url = newURL; + items.push_back(item); + + newTitle = ""; + newURL = ""; + + endInsertRows(); + + AddDeleteButton(idx - 1); +} + +void ExtraBrowsersModel::UpdateItem(Item &item) +{ + int idx = item.prevIdx; + + OBSBasic *main = OBSBasic::Get(); + BrowserDock *dock = reinterpret_cast<BrowserDock *>( + main->extraBrowserDocks[idx].data()); + dock->setWindowTitle(item.title); + dock->setObjectName(item.title + OBJ_NAME_SUFFIX); + main->extraBrowserDockActions[idx]->setText(item.title); + + if (main->extraBrowserDockTargets[idx] != item.url) { + dock->cefWidget->setURL(QT_TO_UTF8(item.url)); + main->extraBrowserDockTargets[idx] = item.url; + } +} + +void ExtraBrowsersModel::DeleteItem() +{ + QTableView *widget = reinterpret_cast<QTableView *>(parent()); + + DelButton *del = reinterpret_cast<DelButton *>(sender()); + int row = del->index.row(); + + /* there's some sort of internal bug in Qt and deleting certain index + * widgets or "editors" that can cause a crash inside Qt if the widget + * is not manually removed, at least on 5.7 */ + widget->setIndexWidget(del->index, nullptr); + del->deleteLater(); + + /* --------- */ + + beginRemoveRows(QModelIndex(), row, row); + + int prevIdx = items[row].prevIdx; + items.removeAt(row); + + if (prevIdx != -1) { + int i = 0; + for (; i < deleted.size() && deleted[i] < prevIdx; i++) + ; + deleted.insert(i, prevIdx); + } + + endRemoveRows(); +} + +void ExtraBrowsersModel::Apply() +{ + OBSBasic *main = OBSBasic::Get(); + + for (Item &item : items) { + if (item.prevIdx != -1) { + UpdateItem(item); + } else { + main->AddExtraBrowserDock(item.title, item.url, true); + } + } + + for (int i = deleted.size() - 1; i >= 0; i--) { + int idx = deleted[i]; + main->extraBrowserDockActions.removeAt(idx); + main->extraBrowserDockTargets.removeAt(idx); + main->extraBrowserDocks.removeAt(idx); + } + + deleted.clear(); + + Reset(); +} + +void ExtraBrowsersModel::TabSelection(bool forward) +{ + QListView *widget = reinterpret_cast<QListView *>(parent()); + QItemSelectionModel *selModel = widget->selectionModel(); + + QModelIndex sel = selModel->currentIndex(); + int row = sel.row(); + int col = sel.column(); + + switch (sel.column()) { + case (int)Column::Title: + if (!forward) { + if (row == 0) { + return; + } + + row -= 1; + } + + col += 1; + break; + + case (int)Column::Url: + if (forward) { + if (row == items.size()) { + return; + } + + row += 1; + } + + col -= 1; + } + + sel = createIndex(row, col, nullptr); + selModel->setCurrentIndex(sel, QItemSelectionModel::Clear); +} + +void ExtraBrowsersModel::Init() +{ + for (int i = 0; i < items.count(); i++) + AddDeleteButton(i); +} + +/* ------------------------------------------------------------------------- */ + +QWidget *ExtraBrowsersDelegate::createEditor(QWidget *parent, + const QStyleOptionViewItem &, + const QModelIndex &index) const +{ + QLineEdit *text = new EditWidget(parent, index); + text->installEventFilter(const_cast<ExtraBrowsersDelegate *>(this)); + text->setSizePolicy(QSizePolicy(QSizePolicy::Policy::Expanding, + QSizePolicy::Policy::Expanding, + QSizePolicy::ControlType::LineEdit)); + return text; +} + +void ExtraBrowsersDelegate::setEditorData(QWidget *editor, + const QModelIndex &index) const +{ + QLineEdit *text = reinterpret_cast<QLineEdit *>(editor); + text->blockSignals(true); + text->setText(index.data().toString()); + text->blockSignals(false); +} + +bool ExtraBrowsersDelegate::eventFilter(QObject *object, QEvent *event) +{ + QLineEdit *edit = qobject_cast<QLineEdit *>(object); + if (!edit) + return false; + + if (LineEditCanceled(event)) { + RevertText(edit); + } + if (LineEditChanged(event)) { + UpdateText(edit); + + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); + if (keyEvent->key() == Qt::Key_Tab) { + model->TabSelection(true); + } else if (keyEvent->key() == Qt::Key_Backtab) { + model->TabSelection(false); + } + } + return true; + } + + return false; +} + +bool ExtraBrowsersDelegate::ValidName(const QString &name) const +{ + for (auto &item : model->items) { + if (name.compare(item.title, Qt::CaseInsensitive) == 0) { + return false; + } + } + return true; +} + +void ExtraBrowsersDelegate::RevertText(QLineEdit *edit_) +{ + EditWidget *edit = reinterpret_cast<EditWidget *>(edit_); + int row = edit->index.row(); + int col = edit->index.column(); + bool newItem = (row == model->items.size()); + + QString oldText; + if (col == (int)Column::Title) { + oldText = newItem ? model->newTitle : model->items[row].title; + } else { + oldText = newItem ? model->newURL : model->items[row].url; + } + + edit->setText(oldText); +} + +bool ExtraBrowsersDelegate::UpdateText(QLineEdit *edit_) +{ + EditWidget *edit = reinterpret_cast<EditWidget *>(edit_); + int row = edit->index.row(); + int col = edit->index.column(); + bool newItem = (row == model->items.size()); + + QString text = edit->text().trimmed(); + + if (!newItem && text.isEmpty()) { + return false; + } + + if (col == (int)Column::Title) { + QString oldText = newItem ? model->newTitle + : model->items[row].title; + bool same = oldText.compare(text, Qt::CaseInsensitive) == 0; + + if (!same && !ValidName(text)) { + edit->setText(oldText); + return false; + } + } + + if (!newItem) { + /* if edited existing item, update it*/ + switch (col) { + case (int)Column::Title: + model->items[row].title = text; + break; + case (int)Column::Url: + model->items[row].url = text; + break; + } + } else { + /* if both new values filled out, create new one */ + switch (col) { + case (int)Column::Title: + model->newTitle = text; + break; + case (int)Column::Url: + model->newURL = text; + break; + } + + model->CheckToAdd(); + } + + emit commitData(edit); + return true; +} + +/* ------------------------------------------------------------------------- */ + +OBSExtraBrowsers::OBSExtraBrowsers(QWidget *parent) + : QDialog(parent), ui(new Ui::OBSExtraBrowsers) +{ + ui->setupUi(this); + + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + + model = new ExtraBrowsersModel(ui->table); + + ui->table->setModel(model); + ui->table->setItemDelegateForColumn((int)Column::Title, + new ExtraBrowsersDelegate(model)); + ui->table->setItemDelegateForColumn((int)Column::Url, + new ExtraBrowsersDelegate(model)); + ui->table->horizontalHeader()->setSectionResizeMode( + QHeaderView::ResizeMode::Stretch); + ui->table->horizontalHeader()->setSectionResizeMode( + (int)Column::Delete, QHeaderView::ResizeMode::Fixed); + ui->table->setEditTriggers( + QAbstractItemView::EditTrigger::CurrentChanged); +} + +OBSExtraBrowsers::~OBSExtraBrowsers() +{ + delete ui; +} + +void OBSExtraBrowsers::closeEvent(QCloseEvent *event) +{ + QDialog::closeEvent(event); + model->Apply(); +} + +void OBSExtraBrowsers::on_apply_clicked() +{ + model->Apply(); +} + +/* ------------------------------------------------------------------------- */ + +void OBSBasic::ClearExtraBrowserDocks() +{ + extraBrowserDockTargets.clear(); + extraBrowserDockActions.clear(); + extraBrowserDocks.clear(); +} + +void OBSBasic::LoadExtraBrowserDocks() +{ + const char *jsonStr = config_get_string( + App()->GlobalConfig(), "BasicWindow", "ExtraBrowserDocks"); + + std::string err; + Json json = Json::parse(jsonStr, err); + if (!err.empty()) + return; + + Json::array array = json.array_items(); + for (Json &item : array) { + std::string title = item["title"].string_value(); + std::string url = item["url"].string_value(); + + AddExtraBrowserDock(title.c_str(), url.c_str(), false); + } +} + +void OBSBasic::SaveExtraBrowserDocks() +{ + Json::array array; + for (int i = 0; i < extraBrowserDocks.size(); i++) { + QAction *action = extraBrowserDockActions[i].data(); + QString url = extraBrowserDockTargets[i]; + Json::object obj{ + {"title", QT_TO_UTF8(action->text())}, + {"url", QT_TO_UTF8(url)}, + }; + array.push_back(obj); + } + + std::string output = Json(array).dump(); + config_set_string(App()->GlobalConfig(), "BasicWindow", + "ExtraBrowserDocks", output.c_str()); +} + +void OBSBasic::ManageExtraBrowserDocks() +{ + if (!extraBrowsers.isNull()) { + extraBrowsers->show(); + extraBrowsers->raise(); + return; + } + + extraBrowsers = new OBSExtraBrowsers(this); + extraBrowsers->show(); +} + +void OBSBasic::AddExtraBrowserDock(const QString &title, const QString &url, + bool firstCreate) +{ + static int panel_version = -1; + if (panel_version == -1) { + panel_version = obs_browser_qcef_version(); + } + + BrowserDock *dock = new BrowserDock(); + dock->setObjectName(title + OBJ_NAME_SUFFIX); + dock->resize(460, 600); + dock->setMinimumSize(150, 150); + dock->setWindowTitle(title); + dock->setAllowedAreas(Qt::AllDockWidgetAreas); + + QCefWidget *browser = + cef->create_widget(nullptr, QT_TO_UTF8(url), nullptr); + if (browser && panel_version >= 1) + browser->allowAllPopups(true); + + dock->SetWidget(browser); + + addDockWidget(Qt::RightDockWidgetArea, dock); + + if (firstCreate) { + dock->setFloating(true); + + QPoint curPos = pos(); + QSize wSizeD2 = size() / 2; + QSize dSizeD2 = dock->size() / 2; + + curPos.setX(curPos.x() + wSizeD2.width() - dSizeD2.width()); + curPos.setY(curPos.y() + wSizeD2.height() - dSizeD2.height()); + + dock->move(curPos); + dock->setVisible(true); + } + + QAction *action = AddDockWidget(dock); + if (firstCreate) { + action->blockSignals(true); + action->setChecked(true); + action->blockSignals(false); + } + + extraBrowserDocks.push_back(QSharedPointer<QDockWidget>(dock)); + extraBrowserDockActions.push_back(QSharedPointer<QAction>(action)); + extraBrowserDockTargets.push_back(url); +}
View file
obs-studio-24.0.0.tar.xz/UI/window-extra-browsers.hpp
Added
@@ -0,0 +1,95 @@ +#pragma once + +#include <QDialog> +#include <QScopedPointer> +#include <QAbstractTableModel> +#include <QStyledItemDelegate> + +class Ui_OBSExtraBrowsers; +class ExtraBrowsersModel; + +class QCefWidget; + +class OBSExtraBrowsers : public QDialog { + Q_OBJECT + + Ui_OBSExtraBrowsers *ui; + ExtraBrowsersModel *model; + +public: + OBSExtraBrowsers(QWidget *parent); + ~OBSExtraBrowsers(); + + void closeEvent(QCloseEvent *event) override; + +public slots: + void on_apply_clicked(); +}; + +class ExtraBrowsersModel : public QAbstractTableModel { + Q_OBJECT + +public: + inline ExtraBrowsersModel(QObject *parent = nullptr) + : QAbstractTableModel(parent) + { + Reset(); + QMetaObject::invokeMethod(this, "Init", Qt::QueuedConnection); + } + + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int + columnCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, int role) const override; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const override; + Qt::ItemFlags flags(const QModelIndex &index) const override; + + struct Item { + int prevIdx; + QString title; + QString url; + }; + + void TabSelection(bool forward); + + void AddDeleteButton(int idx); + void Reset(); + void CheckToAdd(); + void UpdateItem(Item &item); + void DeleteItem(); + void Apply(); + + QVector<Item> items; + QVector<int> deleted; + + QString newTitle; + QString newURL; + +public slots: + void Init(); +}; + +class ExtraBrowsersDelegate : public QStyledItemDelegate { + Q_OBJECT + +public: + inline ExtraBrowsersDelegate(ExtraBrowsersModel *model_) + : QStyledItemDelegate(nullptr), model(model_) + { + } + + QWidget *createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const override; + + void setEditorData(QWidget *editor, + const QModelIndex &index) const override; + + bool eventFilter(QObject *object, QEvent *event) override; + void RevertText(QLineEdit *edit); + bool UpdateText(QLineEdit *edit); + bool ValidName(const QString &text) const; + + ExtraBrowsersModel *model; +};
View file
obs-studio-23.2.1.tar.xz/UI/window-log-reply.cpp -> obs-studio-24.0.0.tar.xz/UI/window-log-reply.cpp
Changed
@@ -20,8 +20,7 @@ #include "obs-app.hpp" OBSLogReply::OBSLogReply(QWidget *parent, const QString &url) - : QDialog (parent), - ui (new Ui::OBSLogReply) + : QDialog(parent), ui(new Ui::OBSLogReply) { ui->setupUi(this); ui->urlEdit->setText(url);
View file
obs-studio-23.2.1.tar.xz/UI/window-main.hpp -> obs-studio-24.0.0.tar.xz/UI/window-main.hpp
Changed
@@ -10,9 +10,9 @@ public: inline OBSMainWindow(QWidget *parent) : QMainWindow(parent) {} - virtual config_t *Config() const=0; - virtual void OBSInit()=0; + virtual config_t *Config() const = 0; + virtual void OBSInit() = 0; - virtual int GetProfilePath(char *path, size_t size, const char *file) - const=0; + virtual int GetProfilePath(char *path, size_t size, + const char *file) const = 0; };
View file
obs-studio-23.2.1.tar.xz/UI/window-namedialog.cpp -> obs-studio-24.0.0.tar.xz/UI/window-namedialog.cpp
Changed
@@ -23,8 +23,7 @@ using namespace std; NameDialog::NameDialog(QWidget *parent) - : QDialog (parent), - ui (new Ui::NameDialog) + : QDialog(parent), ui(new Ui::NameDialog) { ui->setupUi(this); @@ -37,15 +36,16 @@ } bool NameDialog::AskForName(QWidget *parent, const QString &title, - const QString &text, string &str, const QString &placeHolder, - int maxSize) + const QString &text, string &str, + const QString &placeHolder, int maxSize) { if (maxSize <= 0 || maxSize > 32767) - maxSize = 256; + maxSize = 170; NameDialog dialog(parent); dialog.setWindowTitle(title); - dialog.setWindowFlags(dialog.windowFlags() & ~Qt::WindowContextHelpButtonHint); + dialog.setWindowFlags(dialog.windowFlags() & + ~Qt::WindowContextHelpButtonHint); dialog.ui->label->setText(text); dialog.ui->userText->setMaxLength(maxSize); dialog.ui->userText->setText(placeHolder);
View file
obs-studio-23.2.1.tar.xz/UI/window-namedialog.hpp -> obs-studio-24.0.0.tar.xz/UI/window-namedialog.hpp
Changed
@@ -33,7 +33,7 @@ NameDialog(QWidget *parent); static bool AskForName(QWidget *parent, const QString &title, - const QString &text, std::string &str, - const QString &placeHolder = QString(""), - int maxSize = 256); + const QString &text, std::string &str, + const QString &placeHolder = QString(""), + int maxSize = 170); };
View file
obs-studio-23.2.1.tar.xz/UI/window-projector.cpp -> obs-studio-24.0.0.tar.xz/UI/window-projector.cpp
Changed
@@ -12,26 +12,25 @@ static QList<OBSProjector *> windowedProjectors; static QList<OBSProjector *> multiviewProjectors; static bool updatingMultiview = false, drawLabel, drawSafeArea, mouseSwitching, - transitionOnDoubleClick; + transitionOnDoubleClick; static MultiviewLayout multiviewLayout; static size_t maxSrcs, numSrcs; OBSProjector::OBSProjector(QWidget *widget, obs_source_t *source_, int monitor, - QString title, ProjectorType type_) - : OBSQTDisplay (widget, - Qt::Window), - source (source_), - removedSignal (obs_source_get_signal_handler(source), - "remove", OBSSourceRemoved, this) + QString title, ProjectorType type_) + : OBSQTDisplay(widget, Qt::Window), + source(source_), + removedSignal(obs_source_get_signal_handler(source), "remove", + OBSSourceRemoved, this) { projectorTitle = std::move(title); - savedMonitor = monitor; - isWindow = savedMonitor < 0; - type = type_; + savedMonitor = monitor; + isWindow = savedMonitor < 0; + type = type_; if (isWindow) { - setWindowIcon(QIcon::fromTheme("obs", - QIcon(":/res/images/obs.png"))); + setWindowIcon( + QIcon::fromTheme("obs", QIcon(":/res/images/obs.png"))); UpdateProjectorTitle(projectorTitle); windowedProjectors.push_back(this); @@ -39,7 +38,7 @@ resize(480, 270); } else { setWindowFlags(Qt::FramelessWindowHint | - Qt::X11BypassWindowManagerHint); + Qt::X11BypassWindowManagerHint); QScreen *screen = QGuiApplication::screens()[savedMonitor]; setGeometry(screen->geometry()); @@ -48,11 +47,11 @@ action->setShortcut(Qt::Key_Escape); addAction(action); connect(action, SIGNAL(triggered()), this, - SLOT(EscapeTriggered())); + SLOT(EscapeTriggered())); } - SetAlwaysOnTop(this, config_get_bool(GetGlobalConfig(), - "BasicWindow", "ProjectorAlwaysOnTop")); + SetAlwaysOnTop(this, config_get_bool(GetGlobalConfig(), "BasicWindow", + "ProjectorAlwaysOnTop")); setAttribute(Qt::WA_DeleteOnClose, true); @@ -61,18 +60,18 @@ installEventFilter(CreateShortcutFilter()); - auto addDrawCallback = [this] () - { + auto addDrawCallback = [this]() { bool isMultiview = type == ProjectorType::Multiview; - obs_display_add_draw_callback(GetDisplay(), - isMultiview ? OBSRenderMultiview : OBSRender, - this); + obs_display_add_draw_callback( + GetDisplay(), + isMultiview ? OBSRenderMultiview : OBSRender, this); + obs_display_set_background_color(GetDisplay(), 0x000000); }; connect(this, &OBSQTDisplay::DisplayCreated, addDrawCallback); - bool hideCursor = config_get_bool(GetGlobalConfig(), - "BasicWindow", "HideProjectorCursor"); + bool hideCursor = config_get_bool(GetGlobalConfig(), "BasicWindow", + "HideProjectorCursor"); if (hideCursor && !isWindow && type != ProjectorType::Multiview) { QPixmap empty(16, 16); empty.fill(Qt::transparent); @@ -96,7 +95,7 @@ gs_vertex2f(graphicsSafePercentage, graphicsSafePercentage); gs_vertex2f(graphicsSafePercentage, 1 - graphicsSafePercentage); gs_vertex2f(1 - graphicsSafePercentage, - 1 - graphicsSafePercentage); + 1 - graphicsSafePercentage); gs_vertex2f(1 - graphicsSafePercentage, graphicsSafePercentage); gs_vertex2f(graphicsSafePercentage, graphicsSafePercentage); graphicsSafeMargin = gs_render_save(); @@ -105,11 +104,11 @@ gs_render_start(true); gs_vertex2f(fourByThreeSafePercentage, graphicsSafePercentage); gs_vertex2f(1 - fourByThreeSafePercentage, - graphicsSafePercentage); - gs_vertex2f(1 - fourByThreeSafePercentage, 1 - - graphicsSafePercentage); + graphicsSafePercentage); + gs_vertex2f(1 - fourByThreeSafePercentage, + 1 - graphicsSafePercentage); gs_vertex2f(fourByThreeSafePercentage, - 1 - graphicsSafePercentage); + 1 - graphicsSafePercentage); gs_vertex2f(fourByThreeSafePercentage, graphicsSafePercentage); fourByThreeSafeMargin = gs_render_save(); @@ -154,8 +153,9 @@ OBSProjector::~OBSProjector() { bool isMultiview = type == ProjectorType::Multiview; - obs_display_remove_draw_callback(GetDisplay(), - isMultiview ? OBSRenderMultiview : OBSRender, this); + obs_display_remove_draw_callback( + GetDisplay(), isMultiview ? OBSRenderMultiview : OBSRender, + this); if (source) obs_source_dec_showing(source); @@ -189,7 +189,7 @@ static OBSSource CreateLabel(const char *name, size_t h) { obs_data_t *settings = obs_data_create(); - obs_data_t *font = obs_data_create(); + obs_data_t *font = obs_data_create(); std::string text; text += " "; @@ -216,8 +216,8 @@ const char *text_source_id = "text_ft2_source"; #endif - OBSSource txtSource = obs_source_create_private(text_source_id, name, - settings); + OBSSource txtSource = + obs_source_create_private(text_source_id, name, settings); obs_source_release(txtSource); obs_data_release(font); @@ -245,7 +245,7 @@ } static inline void startRegion(int vX, int vY, int vCX, int vCY, float oL, - float oR, float oT, float oB) + float oR, float oT, float oB) { gs_projection_push(); gs_viewport_push(); @@ -266,10 +266,10 @@ if (updatingMultiview || !window->ready) return; - OBSBasic *main = (OBSBasic *)obs_frontend_get_main_window(); - uint32_t targetCX, targetCY; - int x, y; - float scale; + OBSBasic *main = (OBSBasic *)obs_frontend_get_main_window(); + uint32_t targetCX, targetCY; + int x, y; + float scale; targetCX = (uint32_t)window->fw; targetCY = (uint32_t)window->fh; @@ -281,8 +281,7 @@ bool studioMode = main->IsPreviewProgramMode(); auto renderVB = [&](gs_vertbuffer_t *vb, int cx, int cy, - uint32_t colorVal) - { + uint32_t colorVal) { if (!vb) return; @@ -303,18 +302,15 @@ gs_matrix_pop(); }; - auto drawBox = [&](float cx, float cy, uint32_t colorVal) - { + auto drawBox = [&](float cx, float cy, uint32_t colorVal) { gs_effect_set_color(window->color, colorVal); while (gs_effect_loop(window->solid, "Solid")) gs_draw_sprite(nullptr, 0, (uint32_t)cx, (uint32_t)cy); }; - auto setRegion = [&](float bx, float by, float cx, - float cy) - { - float vX = int(x + bx * scale); - float vY = int(y + by * scale); + auto setRegion = [&](float bx, float by, float cx, float cy) { + float vX = int(x + bx * scale); + float vY = int(y + by * scale); float vCX = int(cx * scale); float vCY = int(cy * scale); @@ -326,23 +322,22 @@ startRegion(vX, vY, vCX, vCY, oL, oR, oT, oB); }; - auto calcBaseSource = [&](size_t i) - { + auto calcBaseSource = [&](size_t i) { switch (multiviewLayout) { case MultiviewLayout::HORIZONTAL_TOP_24_SCENES: window->sourceX = (i % 6) * window->scenesCX; - window->sourceY = window->pvwprgCY + - (i / 6) * window->scenesCY; + window->sourceY = + window->pvwprgCY + (i / 6) * window->scenesCY; break; case MultiviewLayout::VERTICAL_LEFT_8_SCENES: window->sourceX = window->pvwprgCX; - window->sourceY = (i / 2 ) * window->scenesCY; + window->sourceY = (i / 2) * window->scenesCY; if (i % 2 != 0) window->sourceX += window->scenesCX; break; case MultiviewLayout::VERTICAL_RIGHT_8_SCENES: window->sourceX = 0; - window->sourceY = (i / 2 ) * window->scenesCY; + window->sourceY = (i / 2) * window->scenesCY; if (i % 2 != 0) window->sourceX = window->scenesCX; break; @@ -351,8 +346,8 @@ window->sourceX = (float(i) * window->scenesCX); window->sourceY = 0; } else { - window->sourceX = (float(i - 4) * - window->scenesCX); + window->sourceX = + (float(i - 4) * window->scenesCX); window->sourceY = window->scenesCY; } break; @@ -361,22 +356,21 @@ window->sourceX = (float(i) * window->scenesCX); window->sourceY = window->pvwprgCY; } else { - window->sourceX = (float(i - 4) * - window->scenesCX); - window->sourceY = window->pvwprgCY + - window->scenesCY; + window->sourceX = + (float(i - 4) * window->scenesCX); + window->sourceY = + window->pvwprgCY + window->scenesCY; } } window->siX = window->sourceX + window->thickness; window->siY = window->sourceY + window->thickness; }; - auto calcPreviewProgram = [&](bool program) - { + auto calcPreviewProgram = [&](bool program) { switch (multiviewLayout) { case MultiviewLayout::HORIZONTAL_TOP_24_SCENES: - window->sourceX = window->thickness + - window->pvwprgCX / 2; + window->sourceX = + window->thickness + window->pvwprgCX / 2; window->sourceY = window->thickness; window->labelX = window->offset + window->pvwprgCX / 2; window->labelY = window->pvwprgCY * 0.85f; @@ -428,8 +422,7 @@ }; auto paintAreaWithColor = [&](float tx, float ty, float cx, float cy, - uint32_t color) - { + uint32_t color) { gs_matrix_push(); gs_matrix_translate3f(tx, ty, 0.0f); drawBox(cx, cy, color); @@ -438,7 +431,7 @@ // Define the whole usable region for the multiview startRegion(x, y, targetCX * scale, targetCY * scale, 0.0f, window->fw, - 0.0f, window->fh); + 0.0f, window->fh); // Change the background color to highlight all sources drawBox(window->fw, window->fh, outerColor); @@ -453,11 +446,11 @@ if (i >= numSrcs) { // Just paint the background and continue paintAreaWithColor(window->sourceX, window->sourceY, - window->scenesCX, window->scenesCY, - outerColor); + window->scenesCX, window->scenesCY, + outerColor); paintAreaWithColor(window->siX, window->siY, - window->siCX, window->siCY, - backgroundColor); + window->siCX, window->siCY, + backgroundColor); continue; } @@ -472,9 +465,10 @@ // Paint the background paintAreaWithColor(window->sourceX, window->sourceY, - window->scenesCX, window->scenesCY, colorVal); + window->scenesCX, window->scenesCY, + colorVal); paintAreaWithColor(window->siX, window->siY, window->siCX, - window->siCY, backgroundColor); + window->siCY, backgroundColor); /* ----------- */ @@ -500,13 +494,14 @@ window->offset = labelOffset(label, window->scenesCX); gs_matrix_push(); - gs_matrix_translate3f(window->sourceX + window->offset, - (window->scenesCY * 0.85f) + window->sourceY, - 0.0f); + gs_matrix_translate3f( + window->sourceX + window->offset, + (window->scenesCY * 0.85f) + window->sourceY, 0.0f); gs_matrix_scale3f(window->ppiScaleX, window->ppiScaleY, 1.0f); drawBox(obs_source_get_width(label), - obs_source_get_height(label) + - int(window->sourceY * 0.015f), labelColor); + obs_source_get_height(label) + + int(window->sourceY * 0.015f), + labelColor); obs_source_video_render(label); gs_matrix_pop(); } @@ -520,25 +515,25 @@ // Paint the background paintAreaWithColor(window->sourceX, window->sourceY, window->ppiCX, - window->ppiCY, backgroundColor); + window->ppiCY, backgroundColor); // Scale and Draw the preview gs_matrix_push(); gs_matrix_translate3f(window->sourceX, window->sourceY, 0.0f); gs_matrix_scale3f(window->ppiScaleX, window->ppiScaleY, 1.0f); setRegion(window->sourceX, window->sourceY, window->ppiCX, - window->ppiCY); + window->ppiCY); if (studioMode) obs_source_video_render(previewSrc); else obs_render_main_texture(); if (drawSafeArea) { renderVB(window->actionSafeMargin, targetCX, targetCY, - outerColor); + outerColor); renderVB(window->graphicsSafeMargin, targetCX, targetCY, - outerColor); + outerColor); renderVB(window->fourByThreeSafeMargin, targetCX, targetCY, - outerColor); + outerColor); renderVB(window->leftLine, targetCX, targetCY, outerColor); renderVB(window->topLine, targetCX, targetCY, outerColor); renderVB(window->rightLine, targetCX, targetCY, outerColor); @@ -554,8 +549,9 @@ gs_matrix_translate3f(window->labelX, window->labelY, 0.0f); gs_matrix_scale3f(window->ppiScaleX, window->ppiScaleY, 1.0f); drawBox(obs_source_get_width(previewLabel), - obs_source_get_height(previewLabel) + - int(window->pvwprgCX * 0.015f), labelColor); + obs_source_get_height(previewLabel) + + int(window->pvwprgCX * 0.015f), + labelColor); obs_source_video_render(previewLabel); gs_matrix_pop(); } @@ -568,14 +564,14 @@ calcPreviewProgram(true); paintAreaWithColor(window->sourceX, window->sourceY, window->ppiCX, - window->ppiCY, backgroundColor); + window->ppiCY, backgroundColor); // Scale and Draw the program gs_matrix_push(); gs_matrix_translate3f(window->sourceX, window->sourceY, 0.0f); gs_matrix_scale3f(window->ppiScaleX, window->ppiScaleY, 1.0f); setRegion(window->sourceX, window->sourceY, window->ppiCX, - window->ppiCY); + window->ppiCY); obs_render_main_texture(); endRegion(); gs_matrix_pop(); @@ -588,8 +584,9 @@ gs_matrix_translate3f(window->labelX, window->labelY, 0.0f); gs_matrix_scale3f(window->ppiScaleX, window->ppiScaleY, 1.0f); drawBox(obs_source_get_width(programLabel), - obs_source_get_height(programLabel) + - int(window->pvwprgCX * 0.015f), labelColor); + obs_source_get_height(programLabel) + + int(window->pvwprgCX * 0.015f), + labelColor); obs_source_video_render(programLabel); gs_matrix_pop(); } @@ -598,13 +595,15 @@ if (multiviewLayout == MultiviewLayout::HORIZONTAL_TOP_24_SCENES) { // Just paint the background for now paintAreaWithColor(window->thickness, window->thickness, - window->siCX, window->siCY * 2 + - window->thicknessx2, backgroundColor); - paintAreaWithColor(window->thickness + 2.5 * ( - window->thicknessx2 + window->ppiCX), - window->thickness, window->siCX, - window->siCY * 2 + window->thicknessx2, - backgroundColor); + window->siCX, + window->siCY * 2 + window->thicknessx2, + backgroundColor); + paintAreaWithColor( + window->thickness + + 2.5 * (window->thicknessx2 + window->ppiCX), + window->thickness, window->siCX, + window->siCY * 2 + window->thicknessx2, + backgroundColor); } endRegion(); @@ -612,19 +611,19 @@ void OBSProjector::OBSRender(void *data, uint32_t cx, uint32_t cy) { - OBSProjector *window = reinterpret_cast<OBSProjector*>(data); + OBSProjector *window = reinterpret_cast<OBSProjector *>(data); if (!window->ready) return; - OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow()); + OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow()); OBSSource source = window->source; uint32_t targetCX; uint32_t targetCY; - int x, y; - int newCX, newCY; - float scale; + int x, y; + int newCX, newCY; + float scale; if (source) { targetCX = std::max(obs_source_get_width(source), 1u); @@ -642,7 +641,7 @@ newCY = int(scale * float(targetCY)); startRegion(x, y, newCX, newCY, 0.0f, float(targetCX), 0.0f, - float(targetCY)); + float(targetCY)); if (window->type == ProjectorType::Preview && main->IsPreviewProgramMode()) { @@ -666,7 +665,7 @@ void OBSProjector::OBSSourceRemoved(void *data, calldata_t *params) { - OBSProjector *window = reinterpret_cast<OBSProjector*>(data); + OBSProjector *window = reinterpret_cast<OBSProjector *>(data); window->deleteLater(); @@ -679,12 +678,12 @@ QWidget *rec = QApplication::activeWindow(); if (!rec) return pos; - int cx = rec->width(); - int cy = rec->height(); - int minX = 0; - int minY = 0; - int maxX = cx; - int maxY = cy; + int cx = rec->width(); + int cy = rec->height(); + int minX = 0; + int minY = 0; + int maxX = cx; + int maxY = cy; switch (multiviewLayout) { case MultiviewLayout::HORIZONTAL_TOP_24_SCENES: @@ -796,7 +795,7 @@ if (!transitionOnDoubleClick) return; - OBSBasic *main = (OBSBasic*)obs_frontend_get_main_window(); + OBSBasic *main = (OBSBasic *)obs_frontend_get_main_window(); if (!main->IsPreviewProgramMode()) return; @@ -834,7 +833,7 @@ if (!src) return; - OBSBasic *main = (OBSBasic*)obs_frontend_get_main_window(); + OBSBasic *main = (OBSBasic *)obs_frontend_get_main_window(); if (main->GetCurrentSceneSource() != src) main->SetCurrentScene(src, false); } @@ -853,60 +852,60 @@ struct obs_video_info ovi; obs_get_video_info(&ovi); - uint32_t w = ovi.base_width; - uint32_t h = ovi.base_height; - fw = float(w); - fh = float(h); - ratio = fw / fh; + uint32_t w = ovi.base_width; + uint32_t h = ovi.base_height; + fw = float(w); + fh = float(h); + ratio = fw / fh; struct obs_frontend_source_list scenes = {}; obs_frontend_get_scenes(&scenes); - multiviewLabels.emplace_back(CreateLabel(Str("StudioMode.Preview"), - h / 2)); - multiviewLabels.emplace_back(CreateLabel(Str("StudioMode.Program"), - h / 2)); + multiviewLabels.emplace_back( + CreateLabel(Str("StudioMode.Preview"), h / 2)); + multiviewLabels.emplace_back( + CreateLabel(Str("StudioMode.Program"), h / 2)); multiviewLayout = static_cast<MultiviewLayout>(config_get_int( - GetGlobalConfig(), "BasicWindow", "MultiviewLayout")); + GetGlobalConfig(), "BasicWindow", "MultiviewLayout")); - drawLabel = config_get_bool(GetGlobalConfig(), - "BasicWindow", "MultiviewDrawNames"); + drawLabel = config_get_bool(GetGlobalConfig(), "BasicWindow", + "MultiviewDrawNames"); drawSafeArea = config_get_bool(GetGlobalConfig(), "BasicWindow", - "MultiviewDrawAreas"); + "MultiviewDrawAreas"); mouseSwitching = config_get_bool(GetGlobalConfig(), "BasicWindow", - "MultiviewMouseSwitch"); + "MultiviewMouseSwitch"); - transitionOnDoubleClick = config_get_bool(GetGlobalConfig(), - "BasicWindow", "TransitionOnDoubleClick"); + transitionOnDoubleClick = config_get_bool( + GetGlobalConfig(), "BasicWindow", "TransitionOnDoubleClick"); - switch(multiviewLayout) { + switch (multiviewLayout) { case MultiviewLayout::HORIZONTAL_TOP_24_SCENES: - pvwprgCX = fw / 3; - pvwprgCY = fh / 3; + pvwprgCX = fw / 3; + pvwprgCY = fh / 3; maxSrcs = 24; break; default: - pvwprgCX = fw / 2; - pvwprgCY = fh / 2; + pvwprgCX = fw / 2; + pvwprgCY = fh / 2; maxSrcs = 8; } - ppiCX = pvwprgCX - thicknessx2; - ppiCY = pvwprgCY - thicknessx2; + ppiCX = pvwprgCX - thicknessx2; + ppiCY = pvwprgCY - thicknessx2; ppiScaleX = (pvwprgCX - thicknessx2) / fw; ppiScaleY = (pvwprgCY - thicknessx2) / fh; scenesCX = pvwprgCX / 2; scenesCY = pvwprgCY / 2; - siCX = scenesCX - thicknessx2; - siCY = scenesCY - thicknessx2; - siScaleX = (scenesCX - thicknessx2) / fw; - siScaleY = (scenesCY - thicknessx2) / fh; + siCX = scenesCX - thicknessx2; + siCY = scenesCY - thicknessx2; + siScaleX = (scenesCX - thicknessx2) / fw; + siScaleY = (scenesCY - thicknessx2) / fh; numSrcs = 0; size_t i = 0; @@ -926,7 +925,7 @@ obs_source_inc_showing(src); std::string name = std::to_string(numSrcs) + " - " + - obs_source_get_name(src); + obs_source_get_name(src); multiviewLabels.emplace_back(CreateLabel(name.c_str(), h / 3)); }
View file
obs-studio-23.2.1.tar.xz/UI/window-projector.hpp -> obs-studio-24.0.0.tar.xz/UI/window-projector.hpp
Changed
@@ -8,7 +8,7 @@ Scene, Preview, StudioProgram, - Multiview + Multiview, }; class QMouseEvent; @@ -18,7 +18,7 @@ HORIZONTAL_BOTTOM_8_SCENES = 1, VERTICAL_LEFT_8_SCENES = 2, VERTICAL_RIGHT_8_SCENES = 3, - HORIZONTAL_TOP_24_SCENES = 4 + HORIZONTAL_TOP_24_SCENES = 4, }; class OBSProjector : public OBSQTDisplay { @@ -41,34 +41,34 @@ ProjectorType type = ProjectorType::Source; std::vector<OBSWeakSource> multiviewScenes; std::vector<OBSSource> multiviewLabels; - gs_vertbuffer_t *actionSafeMargin = nullptr; - gs_vertbuffer_t *graphicsSafeMargin = nullptr; + gs_vertbuffer_t *actionSafeMargin = nullptr; + gs_vertbuffer_t *graphicsSafeMargin = nullptr; gs_vertbuffer_t *fourByThreeSafeMargin = nullptr; - gs_vertbuffer_t *leftLine = nullptr; - gs_vertbuffer_t *topLine = nullptr; - gs_vertbuffer_t *rightLine = nullptr; + gs_vertbuffer_t *leftLine = nullptr; + gs_vertbuffer_t *topLine = nullptr; + gs_vertbuffer_t *rightLine = nullptr; gs_effect_t *solid = nullptr; gs_eparam_t *color = nullptr; // Multiview position helpers float thickness = 4; - float offset, thicknessx2 = thickness * 2, pvwprgCX, - pvwprgCY, sourceX, sourceY, labelX, labelY, scenesCX, scenesCY, - ppiCX, ppiCY, siX, siY, siCX, siCY, ppiScaleX, ppiScaleY, - siScaleX, siScaleY, fw, fh, ratio; + float offset, thicknessx2 = thickness * 2, pvwprgCX, pvwprgCY, sourceX, + sourceY, labelX, labelY, scenesCX, scenesCY, ppiCX, ppiCY, + siX, siY, siCX, siCY, ppiScaleX, ppiScaleY, siScaleX, + siScaleY, fw, fh, ratio; - float lineLength = 0.1f; + float lineLength = 0.1f; // Rec. ITU-R BT.1848-1 / EBU R 95 - float actionSafePercentage = 0.035f; // 3.5% - float graphicsSafePercentage = 0.05f; // 5.0% + float actionSafePercentage = 0.035f; // 3.5% + float graphicsSafePercentage = 0.05f; // 5.0% float fourByThreeSafePercentage = 0.1625f; // 16.25% bool ready = false; // argb colors - static const uint32_t outerColor = 0xFFD0D0D0; - static const uint32_t labelColor = 0xD91F1F1F; + static const uint32_t outerColor = 0xFFD0D0D0; + static const uint32_t labelColor = 0xD91F1F1F; static const uint32_t backgroundColor = 0xFF000000; - static const uint32_t previewColor = 0xFF00D000; - static const uint32_t programColor = 0xFFD00000; + static const uint32_t previewColor = 0xFF00D000; + static const uint32_t programColor = 0xFFD00000; void UpdateMultiview(); void UpdateProjectorTitle(QString name); @@ -78,7 +78,7 @@ public: OBSProjector(QWidget *widget, obs_source_t *source_, int monitor, - QString title, ProjectorType type_); + QString title, ProjectorType type_); ~OBSProjector(); OBSSource GetSource();
View file
obs-studio-23.2.1.tar.xz/UI/window-remux.cpp -> obs-studio-24.0.0.tar.xz/UI/window-remux.cpp
Changed
@@ -48,33 +48,29 @@ Count }; -enum RemuxEntryRole { - EntryStateRole = Qt::UserRole, - NewPathsToProcessRole -}; +enum RemuxEntryRole { EntryStateRole = Qt::UserRole, NewPathsToProcessRole }; /********************************************************** Delegate - Presents cells in the grid. **********************************************************/ -RemuxEntryPathItemDelegate::RemuxEntryPathItemDelegate(bool isOutput, - const QString &defaultPath) - : QStyledItemDelegate(), - isOutput(isOutput), - defaultPath(defaultPath) +RemuxEntryPathItemDelegate::RemuxEntryPathItemDelegate( + bool isOutput, const QString &defaultPath) + : QStyledItemDelegate(), isOutput(isOutput), defaultPath(defaultPath) { } -QWidget *RemuxEntryPathItemDelegate::createEditor(QWidget *parent, - const QStyleOptionViewItem & /* option */, - const QModelIndex &index) const +QWidget *RemuxEntryPathItemDelegate::createEditor( + QWidget *parent, const QStyleOptionViewItem & /* option */, + const QModelIndex &index) const { - RemuxEntryState state = index.model() + RemuxEntryState state = + index.model() ->index(index.row(), RemuxEntryColumn::State) .data(RemuxEntryRole::EntryStateRole) .value<RemuxEntryState>(); if (state == RemuxEntryState::Pending || - state == RemuxEntryState::InProgress) { + state == RemuxEntryState::InProgress) { // Never allow modification of rows that are // in progress. return Q_NULLPTR; @@ -88,22 +84,20 @@ return Q_NULLPTR; } else { QSizePolicy buttonSizePolicy( - QSizePolicy::Policy::Minimum, - QSizePolicy::Policy::Expanding, - QSizePolicy::ControlType::PushButton); + QSizePolicy::Policy::Minimum, + QSizePolicy::Policy::Expanding, + QSizePolicy::ControlType::PushButton); QWidget *container = new QWidget(parent); - auto browseCallback = [this, container]() - { + auto browseCallback = [this, container]() { const_cast<RemuxEntryPathItemDelegate *>(this) - ->handleBrowse(container); + ->handleBrowse(container); }; - auto clearCallback = [this, container]() - { + auto clearCallback = [this, container]() { const_cast<RemuxEntryPathItemDelegate *>(this) - ->handleClear(container); + ->handleClear(container); }; QHBoxLayout *layout = new QHBoxLayout(); @@ -112,10 +106,10 @@ QLineEdit *text = new QLineEdit(); text->setObjectName(QStringLiteral("text")); - text->setSizePolicy(QSizePolicy( - QSizePolicy::Policy::Expanding, - QSizePolicy::Policy::Expanding, - QSizePolicy::ControlType::LineEdit)); + text->setSizePolicy( + QSizePolicy(QSizePolicy::Policy::Expanding, + QSizePolicy::Policy::Expanding, + QSizePolicy::ControlType::LineEdit)); layout->addWidget(text); QToolButton *browseButton = new QToolButton(); @@ -124,7 +118,7 @@ layout->addWidget(browseButton); container->connect(browseButton, &QToolButton::clicked, - browseCallback); + browseCallback); // The "clear" button is not shown in output cells // or the insertion point's input cell. @@ -134,9 +128,8 @@ clearButton->setSizePolicy(buttonSizePolicy); layout->addWidget(clearButton); - container->connect(clearButton, - &QToolButton::clicked, - clearCallback); + container->connect(clearButton, &QToolButton::clicked, + clearCallback); } container->setLayout(layout); @@ -146,17 +139,18 @@ } void RemuxEntryPathItemDelegate::setEditorData(QWidget *editor, - const QModelIndex &index) const + const QModelIndex &index) const { QLineEdit *text = editor->findChild<QLineEdit *>(); text->setText(index.data().toString()); - QObject::connect(text, SIGNAL(textEdited(QString)), this, SLOT(updateText())); + QObject::connect(text, SIGNAL(textEdited(QString)), this, + SLOT(updateText())); editor->setProperty(PATH_LIST_PROP, QVariant()); } void RemuxEntryPathItemDelegate::setModelData(QWidget *editor, - QAbstractItemModel *model, - const QModelIndex &index) const + QAbstractItemModel *model, + const QModelIndex &index) const { // We use the PATH_LIST_PROP property to pass a list of // path strings from the editor widget into the model's @@ -167,14 +161,14 @@ // as normal text data in the default role. QVariant pathListProp = editor->property(PATH_LIST_PROP); if (pathListProp.isValid()) { - QStringList list = editor->property(PATH_LIST_PROP) - .toStringList(); + QStringList list = + editor->property(PATH_LIST_PROP).toStringList(); if (isOutput) { if (list.size() > 0) model->setData(index, list); } else model->setData(index, list, - RemuxEntryRole::NewPathsToProcessRole); + RemuxEntryRole::NewPathsToProcessRole); } else { QLineEdit *lineEdit = editor->findChild<QLineEdit *>(); model->setData(index, lineEdit->text()); @@ -182,10 +176,11 @@ } void RemuxEntryPathItemDelegate::paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const + const QStyleOptionViewItem &option, + const QModelIndex &index) const { - RemuxEntryState state = index.model() + RemuxEntryState state = + index.model() ->index(index.row(), RemuxEntryColumn::State) .data(RemuxEntryRole::EntryStateRole) .value<RemuxEntryState>(); @@ -195,24 +190,22 @@ if (isOutput) { if (state != Ready) { - QColor background = localOption.palette - .color(QPalette::ColorGroup::Disabled, - QPalette::ColorRole::Background); + QColor background = localOption.palette.color( + QPalette::ColorGroup::Disabled, + QPalette::ColorRole::Background); localOption.backgroundBrush = QBrush(background); } } QApplication::style()->drawControl(QStyle::CE_ItemViewItem, - &localOption, painter); + &localOption, painter); } void RemuxEntryPathItemDelegate::handleBrowse(QWidget *container) { - QString OutputPattern = - "(*.mp4 *.flv *.mov *.mkv *.ts *.m3u8)"; - QString InputPattern = - "(*.flv *.mov *.mkv *.ts *.m3u8)"; + QString OutputPattern = "(*.mp4 *.flv *.mov *.mkv *.ts *.m3u8)"; + QString InputPattern = "(*.flv *.mov *.mkv *.ts *.m3u8)"; QLineEdit *text = container->findChild<QLineEdit *>(); @@ -223,21 +216,19 @@ bool isSet = false; if (isOutput) { QString newPath = QFileDialog::getSaveFileName( - container, QTStr("Remux.SelectTarget"), - currentPath, OutputPattern); + container, QTStr("Remux.SelectTarget"), currentPath, + OutputPattern); if (!newPath.isEmpty()) { container->setProperty(PATH_LIST_PROP, - QStringList() << newPath); + QStringList() << newPath); isSet = true; } } else { QStringList paths = QFileDialog::getOpenFileNames( - container, - QTStr("Remux.SelectRecording"), - currentPath, - QTStr("Remux.OBSRecording") - + QString(" ") + InputPattern); + container, QTStr("Remux.SelectRecording"), currentPath, + QTStr("Remux.OBSRecording") + QString(" ") + + InputPattern); if (!paths.empty()) { container->setProperty(PATH_LIST_PROP, paths); @@ -258,8 +249,9 @@ emit commitData(container); } -void RemuxEntryPathItemDelegate::updateText() { - QLineEdit *lineEdit = dynamic_cast<QLineEdit*>(sender()); +void RemuxEntryPathItemDelegate::updateText() +{ + QLineEdit *lineEdit = dynamic_cast<QLineEdit *>(sender()); QWidget *editor = lineEdit->parentWidget(); emit commitData(editor); } @@ -294,7 +286,7 @@ break; } } else if (role == Qt::DecorationRole && - index.column() == RemuxEntryColumn::State) { + index.column() == RemuxEntryColumn::State) { result = getIcon(queue[index.row()].state); } else if (role == RemuxEntryRole::EntryStateRole) { result = queue[index.row()].state; @@ -304,12 +296,12 @@ } QVariant RemuxQueueModel::headerData(int section, Qt::Orientation orientation, - int role) const + int role) const { QVariant result = QVariant(); if (role == Qt::DisplayRole && - orientation == Qt::Orientation::Horizontal) { + orientation == Qt::Orientation::Horizontal) { switch (section) { case RemuxEntryColumn::State: result = QString(); @@ -333,7 +325,7 @@ if (index.column() == RemuxEntryColumn::InputPath) { flags |= Qt::ItemIsEditable; } else if (index.column() == RemuxEntryColumn::OutputPath && - index.row() != queue.length()) { + index.row() != queue.length()) { flags |= Qt::ItemIsEditable; } @@ -341,7 +333,7 @@ } bool RemuxQueueModel::setData(const QModelIndex &index, const QVariant &value, - int role) + int role) { bool success = false; @@ -356,7 +348,8 @@ endRemoveRows(); } } else { - if (pathList.size() > 1 && index.row() < queue.length()) { + if (pathList.size() > 1 && + index.row() < queue.length()) { queue[index.row()].sourcePath = pathList[0]; checkInputPath(index.row()); @@ -394,7 +387,7 @@ entry.sourcePath = path; beginInsertRows(QModelIndex(), queue.length() + 1, - queue.length() + 1); + queue.length() + 1); queue.append(entry); endInsertRows(); @@ -414,12 +407,14 @@ } else { switch (index.column()) { case RemuxEntryColumn::InputPath: - queue[index.row()].sourcePath = value.toString(); + queue[index.row()].sourcePath = + value.toString(); checkInputPath(index.row()); success = true; break; case RemuxEntryColumn::OutputPath: - queue[index.row()].targetPath = value.toString(); + queue[index.row()].targetPath = + value.toString(); emit dataChanged(index, index); success = true; break; @@ -437,23 +432,19 @@ switch (state) { case RemuxEntryState::Complete: - icon = style->standardIcon( - QStyle::SP_DialogApplyButton); + icon = style->standardIcon(QStyle::SP_DialogApplyButton); break; case RemuxEntryState::InProgress: - icon = style->standardIcon( - QStyle::SP_ArrowRight); + icon = style->standardIcon(QStyle::SP_ArrowRight); break; case RemuxEntryState::Error: - icon = style->standardIcon( - QStyle::SP_DialogCancelButton); + icon = style->standardIcon(QStyle::SP_DialogCancelButton); break; case RemuxEntryState::InvalidPath: - icon = style->standardIcon( - QStyle::SP_MessageBoxWarning); + icon = style->standardIcon(QStyle::SP_MessageBoxWarning); break; default: @@ -477,8 +468,8 @@ entry.state = RemuxEntryState::InvalidPath; if (entry.state == RemuxEntryState::Ready) - entry.targetPath = fileInfo.path() + QDir::separator() - + fileInfo.completeBaseName() + ".mp4"; + entry.targetPath = fileInfo.path() + QDir::separator() + + fileInfo.completeBaseName() + ".mp4"; } if (entry.state == RemuxEntryState::Ready && isProcessing) @@ -564,7 +555,7 @@ isProcessing = true; emit dataChanged(index(0, RemuxEntryColumn::State), - index(queue.length(), RemuxEntryColumn::State)); + index(queue.length(), RemuxEntryColumn::State)); } void RemuxQueueModel::endProcessing() @@ -585,7 +576,7 @@ isProcessing = false; emit dataChanged(index(0, RemuxEntryColumn::State), - index(queue.length(), RemuxEntryColumn::State)); + index(queue.length(), RemuxEntryColumn::State)); } bool RemuxQueueModel::beginNextEntry(QString &inputPath, QString &outputPath) @@ -600,8 +591,8 @@ inputPath = entry.sourcePath; outputPath = entry.targetPath; - QModelIndex index = this->index(row, - RemuxEntryColumn::State); + QModelIndex index = + this->index(row, RemuxEntryColumn::State); emit dataChanged(index, index); anyStarted = true; @@ -622,8 +613,8 @@ else entry.state = RemuxEntryState::Error; - QModelIndex index = this->index(row, - RemuxEntryColumn::State); + QModelIndex index = + this->index(row, RemuxEntryColumn::State); emit dataChanged(index, index); break; @@ -636,12 +627,12 @@ **********************************************************/ OBSRemux::OBSRemux(const char *path, QWidget *parent, bool autoRemux_) - : QDialog (parent), + : QDialog(parent), queueModel(new RemuxQueueModel), - worker (new RemuxWorker()), - ui (new Ui::OBSRemux), - recPath (path), - autoRemux (autoRemux_) + worker(new RemuxWorker()), + ui(new Ui::OBSRemux), + recPath(path), + autoRemux(autoRemux_) { setAcceptDrops(true); @@ -650,10 +641,9 @@ ui->setupUi(this); ui->progressBar->setVisible(false); - ui->buttonBox->button(QDialogButtonBox::Ok)-> - setEnabled(false); - ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)-> - setEnabled(false); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); + ui->buttonBox->button(QDialogButtonBox::RestoreDefaults) + ->setEnabled(false); if (autoRemux) { resize(280, 40); @@ -667,66 +657,63 @@ ui->progressBar->setValue(0); ui->tableView->setModel(queueModel); - ui->tableView->setItemDelegateForColumn(RemuxEntryColumn::InputPath, - new RemuxEntryPathItemDelegate(false, recPath)); - ui->tableView->setItemDelegateForColumn(RemuxEntryColumn::OutputPath, - new RemuxEntryPathItemDelegate(true, recPath)); + ui->tableView->setItemDelegateForColumn( + RemuxEntryColumn::InputPath, + new RemuxEntryPathItemDelegate(false, recPath)); + ui->tableView->setItemDelegateForColumn( + RemuxEntryColumn::OutputPath, + new RemuxEntryPathItemDelegate(true, recPath)); ui->tableView->horizontalHeader()->setSectionResizeMode( - QHeaderView::ResizeMode::Stretch); + QHeaderView::ResizeMode::Stretch); ui->tableView->horizontalHeader()->setSectionResizeMode( - RemuxEntryColumn::State, - QHeaderView::ResizeMode::Fixed); + RemuxEntryColumn::State, QHeaderView::ResizeMode::Fixed); ui->tableView->setEditTriggers( - QAbstractItemView::EditTrigger::CurrentChanged); + QAbstractItemView::EditTrigger::CurrentChanged); installEventFilter(CreateShortcutFilter()); - ui->buttonBox->button(QDialogButtonBox::Ok)-> - setText(QTStr("Remux.Remux")); - ui->buttonBox->button(QDialogButtonBox::Reset)-> - setText(QTStr("Remux.ClearFinished")); - ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)-> - setText(QTStr("Remux.ClearAll")); - ui->buttonBox->button(QDialogButtonBox::Reset)-> - setDisabled(true); - - connect(ui->buttonBox->button(QDialogButtonBox::Ok), - SIGNAL(clicked()), this, SLOT(beginRemux())); + ui->buttonBox->button(QDialogButtonBox::Ok) + ->setText(QTStr("Remux.Remux")); + ui->buttonBox->button(QDialogButtonBox::Reset) + ->setText(QTStr("Remux.ClearFinished")); + ui->buttonBox->button(QDialogButtonBox::RestoreDefaults) + ->setText(QTStr("Remux.ClearAll")); + ui->buttonBox->button(QDialogButtonBox::Reset)->setDisabled(true); + + connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), + this, SLOT(beginRemux())); connect(ui->buttonBox->button(QDialogButtonBox::Reset), - SIGNAL(clicked()), this, SLOT(clearFinished())); + SIGNAL(clicked()), this, SLOT(clearFinished())); connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), - SIGNAL(clicked()), this, SLOT(clearAll())); + SIGNAL(clicked()), this, SLOT(clearAll())); connect(ui->buttonBox->button(QDialogButtonBox::Close), - SIGNAL(clicked()), this, SLOT(close())); + SIGNAL(clicked()), this, SLOT(close())); worker->moveToThread(&remuxer); remuxer.start(); //gcc-4.8 can't use QPointer<RemuxWorker> below RemuxWorker *worker_ = worker; - connect(worker_, &RemuxWorker::updateProgress, - this, &OBSRemux::updateProgress); + connect(worker_, &RemuxWorker::updateProgress, this, + &OBSRemux::updateProgress); connect(&remuxer, &QThread::finished, worker_, &QObject::deleteLater); - connect(worker_, &RemuxWorker::remuxFinished, - this, &OBSRemux::remuxFinished); + connect(worker_, &RemuxWorker::remuxFinished, this, + &OBSRemux::remuxFinished); connect(this, &OBSRemux::remux, worker_, &RemuxWorker::remux); // Guessing the GCC bug mentioned above would also affect // QPointer<RemuxQueueModel>? Unsure. RemuxQueueModel *queueModel_ = queueModel; connect(queueModel_, - SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, - SLOT(rowCountChanged(const QModelIndex &, int, int))); - connect(queueModel_, - SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, - SLOT(rowCountChanged(const QModelIndex &, int, int))); + SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, + SLOT(rowCountChanged(const QModelIndex &, int, int))); + connect(queueModel_, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), + this, SLOT(rowCountChanged(const QModelIndex &, int, int))); QModelIndex index = queueModel->createIndex(0, 1); - QMetaObject::invokeMethod(ui->tableView, - "setCurrentIndex", Qt::QueuedConnection, - Q_ARG(const QModelIndex &, index)); + QMetaObject::invokeMethod(ui->tableView, "setCurrentIndex", + Qt::QueuedConnection, + Q_ARG(const QModelIndex &, index)); } bool OBSRemux::stopRemux() @@ -741,12 +728,10 @@ bool exit = false; - if (QMessageBox::critical(nullptr, - QTStr("Remux.ExitUnfinishedTitle"), - QTStr("Remux.ExitUnfinished"), - QMessageBox::Yes | QMessageBox::No, - QMessageBox::No) == - QMessageBox::Yes) { + if (QMessageBox::critical(nullptr, QTStr("Remux.ExitUnfinishedTitle"), + QTStr("Remux.ExitUnfinished"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No) == QMessageBox::Yes) { exit = true; } @@ -774,19 +759,17 @@ // There must be more than one row, since there will always be // at least one row for the empty insertion point. if (queueModel->rowCount() > 1) { - ui->buttonBox->button(QDialogButtonBox::Ok)-> - setEnabled(true); - ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)-> - setEnabled(true); - ui->buttonBox->button(QDialogButtonBox::Reset)-> - setEnabled(queueModel->canClearFinished()); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); + ui->buttonBox->button(QDialogButtonBox::RestoreDefaults) + ->setEnabled(true); + ui->buttonBox->button(QDialogButtonBox::Reset) + ->setEnabled(queueModel->canClearFinished()); } else { - ui->buttonBox->button(QDialogButtonBox::Ok)-> - setEnabled(false); - ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)-> - setEnabled(false); - ui->buttonBox->button(QDialogButtonBox::Reset)-> - setEnabled(false); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); + ui->buttonBox->button(QDialogButtonBox::RestoreDefaults) + ->setEnabled(false); + ui->buttonBox->button(QDialogButtonBox::Reset) + ->setEnabled(false); } } @@ -799,17 +782,16 @@ if (fileInfo.isDir()) { QStringList directoryFilter; - directoryFilter << - "*.flv" << - "*.mp4" << - "*.mov" << - "*.mkv" << - "*.ts" << - "*.m3u8"; + directoryFilter << "*.flv" + << "*.mp4" + << "*.mov" + << "*.mkv" + << "*.ts" + << "*.m3u8"; QDirIterator dirIter(fileInfo.absoluteFilePath(), - directoryFilter, QDir::Files, - QDirIterator::Subdirectories); + directoryFilter, QDir::Files, + QDirIterator::Subdirectories); while (dirIter.hasNext()) { urlList.append(dirIter.next()); @@ -821,14 +803,15 @@ if (urlList.empty()) { QMessageBox::information(nullptr, - QTStr("Remux.NoFilesAddedTitle"), - QTStr("Remux.NoFilesAdded"), QMessageBox::Ok); + QTStr("Remux.NoFilesAddedTitle"), + QTStr("Remux.NoFilesAdded"), + QMessageBox::Ok); } else if (!autoRemux) { - QModelIndex insertIndex = queueModel->index( - queueModel->rowCount() - 1, - RemuxEntryColumn::InputPath); + QModelIndex insertIndex = + queueModel->index(queueModel->rowCount() - 1, + RemuxEntryColumn::InputPath); queueModel->setData(insertIndex, urlList, - RemuxEntryRole::NewPathsToProcessRole); + RemuxEntryRole::NewPathsToProcessRole); } } @@ -856,8 +839,8 @@ message += fileInfo.canonicalFilePath() + "\n"; if (OBSMessageBox::question(this, - QTStr("Remux.FileExistsTitle"), message) - != QMessageBox::Yes) + QTStr("Remux.FileExistsTitle"), + message) != QMessageBox::Yes) proceedWithRemux = false; } @@ -868,8 +851,8 @@ queueModel->beginProcessing(); ui->progressBar->setVisible(true); - ui->buttonBox->button(QDialogButtonBox::Ok)-> - setText(QTStr("Remux.Stop")); + ui->buttonBox->button(QDialogButtonBox::Ok) + ->setText(QTStr("Remux.Stop")); setAcceptDrops(false); remuxNextEntry(); @@ -895,20 +878,20 @@ queueModel->endProcessing(); if (!autoRemux) { - OBSMessageBox::information(this, - QTStr("Remux.FinishedTitle"), - queueModel->checkForErrors() + OBSMessageBox::information( + this, QTStr("Remux.FinishedTitle"), + queueModel->checkForErrors() ? QTStr("Remux.FinishedError") : QTStr("Remux.Finished")); } ui->progressBar->setVisible(autoRemux); - ui->buttonBox->button(QDialogButtonBox::Ok)-> - setText(QTStr("Remux.Remux")); - ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)-> - setEnabled(true); - ui->buttonBox->button(QDialogButtonBox::Reset)-> - setEnabled(queueModel->canClearFinished()); + ui->buttonBox->button(QDialogButtonBox::Ok) + ->setText(QTStr("Remux.Remux")); + ui->buttonBox->button(QDialogButtonBox::RestoreDefaults) + ->setEnabled(true); + ui->buttonBox->button(QDialogButtonBox::Reset) + ->setEnabled(queueModel->canClearFinished()); setAcceptDrops(true); } } @@ -936,8 +919,7 @@ void OBSRemux::remuxFinished(bool success) { - ui->buttonBox->button(QDialogButtonBox::Ok)-> - setEnabled(true); + ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); queueModel->finishEntry(success); @@ -976,9 +958,8 @@ { isWorking = true; - auto callback = [](void *data, float percent) - { - RemuxWorker *rw = static_cast<RemuxWorker*>(data); + auto callback = [](void *data, float percent) { + RemuxWorker *rw = static_cast<RemuxWorker *>(data); QMutexLocker lock(&rw->updateMutex); @@ -991,12 +972,10 @@ bool success = false; media_remux_job_t mr_job = nullptr; - if (media_remux_job_create(&mr_job, - QT_TO_UTF8(source), - QT_TO_UTF8(target))) { + if (media_remux_job_create(&mr_job, QT_TO_UTF8(source), + QT_TO_UTF8(target))) { - success = media_remux_job_process(mr_job, callback, - this); + success = media_remux_job_process(mr_job, callback, this); media_remux_job_destroy(mr_job);
View file
obs-studio-23.2.1.tar.xz/UI/window-remux.hpp -> obs-studio-24.0.0.tar.xz/UI/window-remux.hpp
Changed
@@ -31,8 +31,7 @@ class RemuxQueueModel; class RemuxWorker; -enum RemuxEntryState -{ +enum RemuxEntryState { Empty, Ready, Pending, @@ -62,7 +61,7 @@ public: explicit OBSRemux(const char *recPath, QWidget *parent = nullptr, - bool autoRemux = false); + bool autoRemux = false); virtual ~OBSRemux() override; using job_t = std::shared_ptr<struct media_remux_job>; @@ -70,8 +69,8 @@ void AutoRemux(QString inFile, QString outFile); protected: - void dropEvent(QDropEvent *ev); - void dragEnterEvent(QDragEnterEvent *ev); + virtual void dropEvent(QDropEvent *ev) override; + virtual void dragEnterEvent(QDragEnterEvent *ev) override; void remuxNextEntry(); @@ -97,17 +96,17 @@ public: RemuxQueueModel(QObject *parent = 0) - : QAbstractTableModel(parent) - , isProcessing(false) {} + : QAbstractTableModel(parent), isProcessing(false) + { + } int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, - int role = Qt::DisplayRole) const; + int role = Qt::DisplayRole) const; Qt::ItemFlags flags(const QModelIndex &index) const; - bool setData(const QModelIndex &index, const QVariant &value, - int role); + bool setData(const QModelIndex &index, const QVariant &value, int role); QFileInfoList checkForOverwrites() const; bool checkForErrors() const; @@ -122,8 +121,7 @@ bool autoRemux = false; private: - struct RemuxQueueEntry - { + struct RemuxQueueEntry { RemuxEntryState state; QString sourcePath; @@ -148,9 +146,8 @@ float lastProgress; void UpdateProgress(float percent); - explicit RemuxWorker() - : isWorking(false) { } - virtual ~RemuxWorker() {}; + explicit RemuxWorker() : isWorking(false) {} + virtual ~RemuxWorker(){}; private slots: void remux(const QString &source, const QString &target); @@ -169,17 +166,16 @@ RemuxEntryPathItemDelegate(bool isOutput, const QString &defaultPath); virtual QWidget *createEditor(QWidget *parent, - const QStyleOptionViewItem & /* option */, - const QModelIndex &index) const override; - - virtual void setEditorData(QWidget *editor, const QModelIndex &index) - const override; - virtual void setModelData(QWidget *editor, - QAbstractItemModel *model, - const QModelIndex &index) const override; + const QStyleOptionViewItem & /* option */, + const QModelIndex &index) const override; + + virtual void setEditorData(QWidget *editor, + const QModelIndex &index) const override; + virtual void setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const override; virtual void paint(QPainter *painter, - const QStyleOptionViewItem &option, - const QModelIndex &index) const override; + const QStyleOptionViewItem &option, + const QModelIndex &index) const override; private: bool isOutput;
View file
obs-studio-23.2.1.tar.xz/appveyor.yml -> obs-studio-24.0.0.tar.xz/appveyor.yml
Changed
@@ -4,7 +4,7 @@ environment: CURL_VERSION: 7.56.1 - CEF_VERSION: 3.3440.1805.gbe070f9 + CEF_VERSION: 75.1.16+g16a67c4+chromium-75.0.3770.100 APPVEYOR_YML_DISABLE_PS_LINUX: true TWITCH-CLIENTID: secure: D3vFGk41HZaJWAZu5slwAHZhB868mGI2aIMS03L2rt4= @@ -43,8 +43,8 @@ cache: - dependencies2017.zip - vlc.zip - - 'cef_binary_%CEF_VERSION%_windows32.zip' - - 'cef_binary_%CEF_VERSION%_windows64.zip' + - 'cef_binary_%CEF_VERSION%_windows32_minimal.zip' + - 'cef_binary_%CEF_VERSION%_windows64_minimal.zip' - Qt_5.10.1.7z notifications:
View file
obs-studio-23.2.1.tar.xz/azure-pipelines.yml -> obs-studio-24.0.0.tar.xz/azure-pipelines.yml
Changed
@@ -2,8 +2,8 @@ variables: CMAKE_PREFIX_PATH: /usr/local/opt/qt5/lib/cmake - CEF_BUILD_VERSION: 3.3282.1726.gc8368c8 - CEF_VERSION: 3.3440.1805.gbe070f9 + CEF_BUILD_VERSION: 3770 + CEF_VERSION: 75.1.16+g16a67c4+chromium-75.0.3770.100 TWITCH-CLIENTID: $(twitch_clientid) TWITCH-HASH: $(twitch_hash) MIXER-CLIENTID: $(mixer_clientid)
View file
obs-studio-24.0.0.tar.xz/deps/blake2/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/deps/file-updater/file-updater/file-updater.c -> obs-studio-24.0.0.tar.xz/deps/file-updater/file-updater/file-updater.c
Changed
@@ -7,9 +7,9 @@ #include "file-updater.h" #define warn(msg, ...) \ - blog(LOG_WARNING, "%s"msg, info->log_prefix, ##__VA_ARGS__) + blog(LOG_WARNING, "%s" msg, info->log_prefix, ##__VA_ARGS__) #define info(msg, ...) \ - blog(LOG_WARNING, "%s"msg, info->log_prefix, ##__VA_ARGS__) + blog(LOG_WARNING, "%s" msg, info->log_prefix, ##__VA_ARGS__) struct update_info { char error[CURL_ERROR_SIZE]; @@ -70,7 +70,7 @@ } static size_t http_write(uint8_t *ptr, size_t size, size_t nmemb, - struct update_info *info) + struct update_info *info) { size_t total = size * nmemb; if (total) @@ -80,10 +80,9 @@ } static size_t http_header(char *buffer, size_t size, size_t nitems, - struct update_info *info) + struct update_info *info) { - if (!strncmp(buffer, "ETag: ", 6)) - { + if (!strncmp(buffer, "ETag: ", 6)) { char *etag = buffer + 6; if (*etag) { char *etag_clean, *p; @@ -105,7 +104,7 @@ } static bool do_http_request(struct update_info *info, const char *url, - long *response_code) + long *response_code) { CURLcode code; uint8_t null_terminator = 0; @@ -118,10 +117,12 @@ curl_easy_setopt(info->curl, CURLOPT_WRITEDATA, info); curl_easy_setopt(info->curl, CURLOPT_FAILONERROR, true); curl_easy_setopt(info->curl, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(info->curl, CURLOPT_ACCEPT_ENCODING, ""); if (!info->remote_url) { // We only care about headers from the main package file - curl_easy_setopt(info->curl, CURLOPT_HEADERFUNCTION, http_header); + curl_easy_setopt(info->curl, CURLOPT_HEADERFUNCTION, + http_header); curl_easy_setopt(info->curl, CURLOPT_HEADERDATA, info); } @@ -133,17 +134,17 @@ code = curl_easy_perform(info->curl); if (code != CURLE_OK) { warn("Remote update of URL \"%s\" failed: %s", url, - info->error); + info->error); return false; } if (curl_easy_getinfo(info->curl, CURLINFO_RESPONSE_CODE, - response_code) != CURLE_OK) + response_code) != CURLE_OK) return false; if (*response_code >= 400) { warn("Remote update of URL \"%s\" failed: HTTP/%ld", url, - *response_code); + *response_code); return false; } @@ -190,14 +191,14 @@ if (metadata) { const char *etag = obs_data_get_string(metadata, "etag"); if (etag) { - struct dstr if_none_match = { 0 }; + struct dstr if_none_match = {0}; dstr_copy(&if_none_match, "If-None-Match: "); dstr_cat(&if_none_match, etag); info->etag_local = bstrdup(etag); info->header = curl_slist_append(info->header, - if_none_match.array); + if_none_match.array); dstr_free(&if_none_match); } @@ -218,7 +219,7 @@ { char *local_file_path = get_path(info->local, file); char *cache_file_path = get_path(info->cache, file); - char *temp_file_path = get_path(info->temp, file); + char *temp_file_path = get_path(info->temp, file); os_copyfile(local_file_path, temp_file_path); os_unlink(cache_file_path); @@ -230,8 +231,8 @@ } static void enum_files(obs_data_t *package, - bool (*enum_func)(void *param, obs_data_t *file), - void *param) + bool (*enum_func)(void *param, obs_data_t *file), + void *param) { obs_data_array_t *array = obs_data_get_array(package, "files"); size_t num; @@ -280,8 +281,7 @@ struct update_info *info = param; struct file_update_data data = { .name = obs_data_get_string(local_file, "name"), - .version = (int)obs_data_get_int(local_file, "version") - }; + .version = (int)obs_data_get_int(local_file, "version")}; enum_files(info->cache_package, newer_than_cache, &data); if (data.newer || !data.found) @@ -314,7 +314,7 @@ } static inline bool do_relative_http_request(struct update_info *info, - const char *url, const char *file) + const char *url, const char *file) { long response_code; char *full_url = get_path(url, file); @@ -324,17 +324,16 @@ } static inline void write_file_data(struct update_info *info, - const char *base_path, const char *file) + const char *base_path, const char *file) { char *full_path = get_path(base_path, file); - os_quick_write_utf8_file(full_path, - (char*)info->file_data.array, - info->file_data.num - 1, false); + os_quick_write_utf8_file(full_path, (char *)info->file_data.array, + info->file_data.num - 1, false); bfree(full_path); } static inline void replace_file(const char *src_base_path, - const char *dst_base_path, const char *file) + const char *dst_base_path, const char *file) { char *src_path = get_path(src_base_path, file); char *dst_path = get_path(dst_base_path, file); @@ -354,8 +353,7 @@ struct file_update_data data = { .name = obs_data_get_string(remote_file, "name"), - .version = (int)obs_data_get_int(remote_file, "version") - }; + .version = (int)obs_data_get_int(remote_file, "version")}; enum_files(info->cache_package, newer_than_cache, &data); if (!data.newer && data.found) @@ -378,7 +376,7 @@ if (!confirm) { info("Update file '%s' (version %d) rejected", - data.name, data.version); + data.name, data.version); return true; } } @@ -386,14 +384,14 @@ write_file_data(info, info->temp, data.name); replace_file(info->temp, info->cache, data.name); - info("Successfully updated file '%s' (version %d)", - data.name, data.version); + info("Successfully updated file '%s' (version %d)", data.name, + data.version); return true; } static void update_save_metadata(struct update_info *info) { - struct dstr path = { 0 }; + struct dstr path = {0}; if (!info->etag_remote) return; @@ -428,8 +426,8 @@ update_save_metadata(info); - info->remote_package = obs_data_create_from_json( - (char*)info->file_data.array); + info->remote_package = + obs_data_create_from_json((char *)info->file_data.array); if (!info->remote_package) { warn("Failed to initialize remote package json"); return; @@ -476,14 +474,12 @@ return NULL; } -update_info_t *update_info_create( - const char *log_prefix, - const char *user_agent, - const char *update_url, - const char *local_dir, - const char *cache_dir, - confirm_file_callback_t confirm_callback, - void *param) +update_info_t *update_info_create(const char *log_prefix, + const char *user_agent, + const char *update_url, const char *local_dir, + const char *cache_dir, + confirm_file_callback_t confirm_callback, + void *param) { struct update_info *info; struct dstr dir = {0}; @@ -493,7 +489,7 @@ if (os_mkdir(cache_dir) < 0) { blog(LOG_WARNING, "%sCould not create cache directory %s", - log_prefix, cache_dir); + log_prefix, cache_dir); return NULL; } @@ -504,7 +500,7 @@ if (os_mkdir(dir.array) < 0) { blog(LOG_WARNING, "%sCould not create temp directory %s", - log_prefix, cache_dir); + log_prefix, cache_dir); dstr_free(&dir); return NULL; } @@ -550,12 +546,10 @@ return NULL; } -update_info_t *update_info_create_single( - const char *log_prefix, - const char *user_agent, - const char *file_url, - confirm_file_callback_t confirm_callback, - void *param) +update_info_t * +update_info_create_single(const char *log_prefix, const char *user_agent, + const char *file_url, + confirm_file_callback_t confirm_callback, void *param) { struct update_info *info;
View file
obs-studio-23.2.1.tar.xz/deps/file-updater/file-updater/file-updater.h -> obs-studio-24.0.0.tar.xz/deps/file-updater/file-updater/file-updater.h
Changed
@@ -13,20 +13,15 @@ }; typedef bool (*confirm_file_callback_t)(void *param, - struct file_download_data *file); + struct file_download_data *file); -update_info_t *update_info_create( - const char *log_prefix, - const char *user_agent, - const char *update_url, - const char *local_dir, - const char *cache_dir, - confirm_file_callback_t confirm_callback, - void *param); +update_info_t *update_info_create(const char *log_prefix, + const char *user_agent, + const char *update_url, const char *local_dir, + const char *cache_dir, + confirm_file_callback_t confirm_callback, + void *param); update_info_t *update_info_create_single( - const char *log_prefix, - const char *user_agent, - const char *file_url, - confirm_file_callback_t confirm_callback, - void *param); + const char *log_prefix, const char *user_agent, const char *file_url, + confirm_file_callback_t confirm_callback, void *param); void update_info_destroy(update_info_t *info);
View file
obs-studio-24.0.0.tar.xz/deps/glad/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/deps/ipc-util/ipc-util/pipe-windows.c -> obs-studio-24.0.0.tar.xz/deps/ipc-util/ipc-util/pipe-windows.c
Changed
@@ -47,15 +47,14 @@ } static inline bool ipc_pipe_internal_create_pipe(ipc_pipe_server_t *pipe, - const char *name) + const char *name) { SECURITY_ATTRIBUTES sa; char new_name[512]; void *sd; const DWORD access = PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED; - const DWORD flags = PIPE_TYPE_MESSAGE | - PIPE_READMODE_MESSAGE | - PIPE_WAIT; + const DWORD flags = PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | + PIPE_WAIT; strcpy_s(new_name, sizeof(new_name), "\\\\.\\pipe\\"); strcat_s(new_name, sizeof(new_name), name); @@ -70,14 +69,15 @@ sa.bInheritHandle = false; pipe->handle = CreateNamedPipeA(new_name, access, flags, 1, - IPC_PIPE_BUF_SIZE, IPC_PIPE_BUF_SIZE, 0, &sa); + IPC_PIPE_BUF_SIZE, IPC_PIPE_BUF_SIZE, 0, + &sa); free(sd); return pipe->handle != INVALID_HANDLE_VALUE; } static inline void ipc_pipe_internal_ensure_capacity(ipc_pipe_server_t *pipe, - size_t new_size) + size_t new_size) { if (pipe->capacity >= new_size) { return; @@ -88,7 +88,7 @@ } static inline void ipc_pipe_internal_append_bytes(ipc_pipe_server_t *pipe, - uint8_t *bytes, size_t size) + uint8_t *bytes, size_t size) { size_t new_size = pipe->size + size; ipc_pipe_internal_ensure_capacity(pipe, new_size); @@ -118,7 +118,7 @@ bool success; success = !!ReadFile(pipe->handle, buf, IPC_PIPE_BUF_SIZE, NULL, - &pipe->overlap); + &pipe->overlap); if (!success && !ipc_pipe_internal_io_pending()) { break; } @@ -129,7 +129,7 @@ } success = !!GetOverlappedResult(pipe->handle, &pipe->overlap, - &bytes, true); + &bytes, true); if (!success || !bytes) { break; } @@ -138,7 +138,7 @@ if (success) { pipe->read_callback(pipe->param, pipe->read_data, - pipe->size); + pipe->size); pipe->size = 0; } } @@ -147,16 +147,16 @@ return 0; } -static inline bool ipc_pipe_internal_start_server_thread( - ipc_pipe_server_t *pipe) +static inline bool +ipc_pipe_internal_start_server_thread(ipc_pipe_server_t *pipe) { pipe->thread = CreateThread(NULL, 0, ipc_pipe_internal_server_thread, - pipe, 0, NULL); + pipe, 0, NULL); return pipe->thread != NULL; } -static inline bool ipc_pipe_internal_wait_for_connection( - ipc_pipe_server_t *pipe) +static inline bool +ipc_pipe_internal_wait_for_connection(ipc_pipe_server_t *pipe) { bool success; @@ -166,7 +166,7 @@ } static inline bool ipc_pipe_internal_open_pipe(ipc_pipe_client_t *pipe, - const char *name) + const char *name) { DWORD mode = PIPE_READMODE_MESSAGE; char new_name[512]; @@ -174,8 +174,8 @@ strcpy_s(new_name, sizeof(new_name), "\\\\.\\pipe\\"); strcat_s(new_name, sizeof(new_name), name); - pipe->handle = CreateFileA(new_name, GENERIC_READ | GENERIC_WRITE, - 0, NULL, OPEN_EXISTING, 0, NULL); + pipe->handle = CreateFileA(new_name, GENERIC_READ | GENERIC_WRITE, 0, + NULL, OPEN_EXISTING, 0, NULL); if (pipe->handle == INVALID_HANDLE_VALUE) { return false; } @@ -186,7 +186,7 @@ /* ------------------------------------------------------------------------- */ bool ipc_pipe_server_start(ipc_pipe_server_t *pipe, const char *name, - ipc_pipe_read_t read_callback, void *param) + ipc_pipe_read_t read_callback, void *param) { pipe->read_callback = read_callback; pipe->param = param; @@ -253,7 +253,7 @@ } bool ipc_pipe_client_write(ipc_pipe_client_t *pipe, const void *data, - size_t size) + size_t size) { DWORD bytes;
View file
obs-studio-23.2.1.tar.xz/deps/ipc-util/ipc-util/pipe-windows.h -> obs-studio-24.0.0.tar.xz/deps/ipc-util/ipc-util/pipe-windows.h
Changed
@@ -19,21 +19,21 @@ #include <windows.h> struct ipc_pipe_server { - OVERLAPPED overlap; - HANDLE handle; - HANDLE ready_event; - HANDLE thread; + OVERLAPPED overlap; + HANDLE handle; + HANDLE ready_event; + HANDLE thread; - uint8_t *read_data; - size_t size; - size_t capacity; + uint8_t *read_data; + size_t size; + size_t capacity; - ipc_pipe_read_t read_callback; - void *param; + ipc_pipe_read_t read_callback; + void *param; }; struct ipc_pipe_client { - HANDLE handle; + HANDLE handle; }; static inline bool ipc_pipe_client_valid(ipc_pipe_client_t *pipe)
View file
obs-studio-23.2.1.tar.xz/deps/ipc-util/ipc-util/pipe.h -> obs-studio-24.0.0.tar.xz/deps/ipc-util/ipc-util/pipe.h
Changed
@@ -35,13 +35,13 @@ typedef void (*ipc_pipe_read_t)(void *param, uint8_t *data, size_t size); bool ipc_pipe_server_start(ipc_pipe_server_t *pipe, const char *name, - ipc_pipe_read_t read_callback, void *param); + ipc_pipe_read_t read_callback, void *param); void ipc_pipe_server_free(ipc_pipe_server_t *pipe); bool ipc_pipe_client_open(ipc_pipe_client_t *pipe, const char *name); void ipc_pipe_client_free(ipc_pipe_client_t *pipe); bool ipc_pipe_client_write(ipc_pipe_client_t *pipe, const void *data, - size_t size); + size_t size); static inline bool ipc_pipe_client_valid(ipc_pipe_client_t *pipe); #ifdef _WIN32
View file
obs-studio-24.0.0.tar.xz/deps/jansson/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-24.0.0.tar.xz/deps/json11/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-24.0.0.tar.xz/deps/libcaption/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-audio-decoder.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-audio-decoder.c
Changed
@@ -36,13 +36,13 @@ int remaining = packet->base.size - packet_length; memmove(packet->base.data, &packet->base.data[packet_length], - remaining); + remaining); av_shrink_packet(&packet->base, remaining); } } static bool handle_reset_packet(struct ff_decoder *decoder, - struct ff_packet *packet) + struct ff_packet *packet) { if (decoder->clock != NULL) ff_clock_release(&decoder->clock); @@ -53,27 +53,29 @@ } static void drop_late_packets(struct ff_decoder *decoder, - struct ff_packet *packet) + struct ff_packet *packet) { int64_t start_time = ff_clock_start_time(decoder->clock); if (start_time != AV_NOPTS_VALUE) { if (ff_decoder_set_frame_drop_state(decoder, start_time, - packet->base.pts)) + packet->base.pts)) shrink_packet(packet, packet->base.size); } } -static int decode_frame(struct ff_decoder *decoder, - struct ff_packet *packet, AVFrame *frame, bool *frame_complete) +static int decode_frame(struct ff_decoder *decoder, struct ff_packet *packet, + AVFrame *frame, bool *frame_complete) { int packet_length; int ret; while (true) { if (decoder->eof) - ret = packet_queue_get(&decoder->packet_queue, packet, 0); + ret = packet_queue_get(&decoder->packet_queue, packet, + 0); else - ret = packet_queue_get(&decoder->packet_queue, packet, 1); + ret = packet_queue_get(&decoder->packet_queue, packet, + 1); if (ret == FF_PACKET_EMPTY) { return 0; @@ -82,7 +84,7 @@ } if (packet->base.data == - decoder->packet_queue.flush_packet.base.data) { + decoder->packet_queue.flush_packet.base.data) { avcodec_flush_buffers(decoder->codec); continue; } @@ -98,8 +100,8 @@ drop_late_packets(decoder, packet); packet_length = avcodec_decode_audio4(decoder->codec, - frame, &complete, - &packet->base); + frame, &complete, + &packet->base); if (packet_length < 0) break; @@ -112,7 +114,7 @@ *frame_complete = complete != 0; return frame->nb_samples * - av_get_bytes_per_sample(frame->format); + av_get_bytes_per_sample(frame->format); } if (packet->base.data != NULL) @@ -121,7 +123,7 @@ } static bool queue_frame(struct ff_decoder *decoder, AVFrame *frame, - double best_effort_pts) + double best_effort_pts) { struct ff_frame *queue_frame; bool call_initialize; @@ -135,10 +137,11 @@ queue_frame = ff_circular_queue_peek_write(&decoder->frame_queue); AVCodecContext *codec = decoder->codec; - call_initialize = (queue_frame->frame == NULL - || queue_frame->frame->channels != codec->channels - || queue_frame->frame->sample_rate != codec->sample_rate - || queue_frame->frame->format != codec->sample_fmt); + call_initialize = + (queue_frame->frame == NULL || + queue_frame->frame->channels != codec->channels || + queue_frame->frame->sample_rate != codec->sample_rate || + queue_frame->frame->format != codec->sample_fmt); if (queue_frame->frame != NULL) { //FIXME: this shouldn't happen any more! @@ -183,7 +186,7 @@ // This function returns a pts scaled to stream // time base double best_effort_pts = - ff_decoder_get_best_effort_pts(decoder, frame); + ff_decoder_get_best_effort_pts(decoder, frame); queue_frame(decoder, frame, best_effort_pts); av_frame_unref(frame); }
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-callbacks.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-callbacks.c
Changed
@@ -16,8 +16,7 @@ #include "ff-callbacks.h" -bool ff_callbacks_frame(struct ff_callbacks *callbacks, - struct ff_frame *frame) +bool ff_callbacks_frame(struct ff_callbacks *callbacks, struct ff_frame *frame) { if (callbacks->frame == NULL) return true; @@ -26,7 +25,7 @@ } bool ff_callbacks_format(struct ff_callbacks *callbacks, - AVCodecContext *codec_context) + AVCodecContext *codec_context) { if (callbacks->format == NULL) return true; @@ -43,7 +42,7 @@ } bool ff_callbacks_frame_initialize(struct ff_frame *frame, - struct ff_callbacks *callbacks) + struct ff_callbacks *callbacks) { if (callbacks->frame_initialize == NULL) return true; @@ -52,7 +51,7 @@ } bool ff_callbacks_frame_free(struct ff_frame *frame, - struct ff_callbacks *callbacks) + struct ff_callbacks *callbacks) { if (callbacks->frame_free == NULL) return true;
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-callbacks.h -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-callbacks.h
Changed
@@ -29,7 +29,6 @@ typedef bool (*ff_callback_format)(AVCodecContext *codec_context, void *opaque); typedef bool (*ff_callback_initialize)(void *opaque); - struct ff_callbacks { ff_callback_frame frame; ff_callback_format format; @@ -39,15 +38,14 @@ void *opaque; }; -bool ff_callbacks_frame(struct ff_callbacks *callbacks, - struct ff_frame *frame); +bool ff_callbacks_frame(struct ff_callbacks *callbacks, struct ff_frame *frame); bool ff_callbacks_format(struct ff_callbacks *callbacks, - AVCodecContext *codec_context); + AVCodecContext *codec_context); bool ff_callbacks_initialize(struct ff_callbacks *callbacks); bool ff_callbacks_frame_initialize(struct ff_frame *frame, - struct ff_callbacks *callbacks); + struct ff_callbacks *callbacks); bool ff_callbacks_frame_free(struct ff_frame *frame, - struct ff_callbacks *callbacks); + struct ff_callbacks *callbacks); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-circular-queue.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-circular-queue.c
Changed
@@ -16,8 +16,7 @@ #include "ff-circular-queue.h" -static void *queue_fetch_or_alloc(struct ff_circular_queue *cq, - int index) +static void *queue_fetch_or_alloc(struct ff_circular_queue *cq, int index) { if (cq->slots[index] == NULL) cq->slots[index] = av_mallocz(cq->item_size); @@ -46,7 +45,7 @@ } bool ff_circular_queue_init(struct ff_circular_queue *cq, int item_size, - int capacity) + int capacity) { memset(cq, 0, sizeof(struct ff_circular_queue)); @@ -136,5 +135,3 @@ queue_signal(cq); queue_unlock(cq); } - -
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-circular-queue.h -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-circular-queue.h
Changed
@@ -43,7 +43,7 @@ typedef struct ff_circular_queue ff_circular_queue_t; bool ff_circular_queue_init(struct ff_circular_queue *cq, int item_size, - int capacity); + int capacity); void ff_circular_queue_abort(struct ff_circular_queue *cq); void ff_circular_queue_free(struct ff_circular_queue *cq);
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-clock.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-clock.c
Changed
@@ -41,7 +41,7 @@ } bool ff_clock_start(struct ff_clock *clock, enum ff_av_sync_type sync_type, - const bool *abort) + const bool *abort) { bool release = false; bool aborted = false; @@ -57,14 +57,14 @@ } else { while (!clock->started) { pthread_mutex_lock(&clock->mutex); - int64_t current_time = av_gettime() - + CLOCK_START_CHECK_INTERVAL; + int64_t current_time = + av_gettime() + CLOCK_START_CHECK_INTERVAL; struct timespec sleep_time = { - .tv_sec = current_time / AV_TIME_BASE, - .tv_nsec = (current_time % AV_TIME_BASE) * 1000 - }; + .tv_sec = current_time / AV_TIME_BASE, + .tv_nsec = + (current_time % AV_TIME_BASE) * 1000}; pthread_cond_timedwait(&clock->cond, &clock->mutex, - &sleep_time); + &sleep_time); aborted = *abort; @@ -75,10 +75,11 @@ pthread_mutex_unlock(&clock->mutex); if (aborted || release) { - av_log(NULL, AV_LOG_ERROR, "could not start " - "slave clock as master clock " - "was never started before " - "being released or aborted"); + av_log(NULL, AV_LOG_ERROR, + "could not start " + "slave clock as master clock " + "was never started before " + "being released or aborted"); break; } }
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-clock.h -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-clock.h
Changed
@@ -50,7 +50,7 @@ typedef struct ff_clock ff_clock_t; -struct ff_clock * ff_clock_init(void); +struct ff_clock *ff_clock_init(void); double ff_get_sync_clock(struct ff_clock *clock); struct ff_clock *ff_clock_retain(struct ff_clock *clock); struct ff_clock *ff_clock_move(struct ff_clock **clock); @@ -58,7 +58,7 @@ int64_t ff_clock_start_time(struct ff_clock *clock); bool ff_clock_start(struct ff_clock *clock, enum ff_av_sync_type sync_type, - const bool *abort); + const bool *abort); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-decoder.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-decoder.c
Changed
@@ -25,8 +25,9 @@ extern void *ff_video_decoder_thread(void *opaque_video_decoder); struct ff_decoder *ff_decoder_init(AVCodecContext *codec_context, - AVStream *stream, unsigned int packet_queue_size, - unsigned int frame_queue_size) + AVStream *stream, + unsigned int packet_queue_size, + unsigned int frame_queue_size) { bool success; @@ -56,12 +57,13 @@ decoder->first_frame = true; success = ff_timer_init(&decoder->refresh_timer, ff_decoder_refresh, - decoder); + decoder); if (!success) goto fail2; success = ff_circular_queue_init(&decoder->frame_queue, - sizeof(struct ff_frame), frame_queue_size); + sizeof(struct ff_frame), + frame_queue_size); if (!success) goto fail3; @@ -88,14 +90,14 @@ decoder_thread = ff_video_decoder_thread; } else { av_log(NULL, AV_LOG_ERROR, "no decoder found for type %d", - decoder->codec->codec_type); + decoder->codec->codec_type); return false; } ff_decoder_schedule_refresh(decoder, 40); - return (pthread_create(&decoder->decoder_thread, NULL, - decoder_thread, decoder) != 0); + return (pthread_create(&decoder->decoder_thread, NULL, decoder_thread, + decoder) != 0); } void ff_decoder_free(struct ff_decoder *decoder) @@ -139,7 +141,7 @@ void ff_decoder_schedule_refresh(struct ff_decoder *decoder, int delay) { - ff_timer_schedule(&decoder->refresh_timer, 1000*delay); + ff_timer_schedule(&decoder->refresh_timer, 1000 * delay); } double ff_decoder_clock(void *opaque) @@ -149,16 +151,16 @@ return decoder->current_pts + delta; } -static double get_sync_adjusted_pts_diff(struct ff_clock *clock, - double pts, double pts_diff) +static double get_sync_adjusted_pts_diff(struct ff_clock *clock, double pts, + double pts_diff) { double new_pts_diff = pts_diff; double sync_time = ff_get_sync_clock(clock); double diff = pts - sync_time; double sync_threshold; - sync_threshold = (pts_diff > AV_SYNC_THRESHOLD) - ? pts_diff : AV_SYNC_THRESHOLD; + sync_threshold = (pts_diff > AV_SYNC_THRESHOLD) ? pts_diff + : AV_SYNC_THRESHOLD; if (fabs(diff) < AV_NOSYNC_THRESHOLD) { if (diff <= -sync_threshold) { @@ -183,7 +185,7 @@ if (!decoder->eof || !decoder->finished) { // We expected a frame, but there were none // available - + // Schedule another call as soon as possible ff_decoder_schedule_refresh(decoder, 1); } else { @@ -191,7 +193,7 @@ decoder->refresh_timer.abort = true; // no more refreshes, we are at the eof av_log(NULL, AV_LOG_INFO, - "refresh timer stopping; eof"); + "refresh timer stopping; eof"); return; } } else { @@ -200,12 +202,12 @@ bool late_first_frame = false; frame = ff_circular_queue_peek_read( - &decoder->frame_queue); + &decoder->frame_queue); // Get frame clock and start it if needed ff_clock_t *clock = ff_clock_move(&frame->clock); if (!ff_clock_start(clock, decoder->natural_sync_clock, - &decoder->refresh_timer.abort)) { + &decoder->refresh_timer.abort)) { ff_clock_release(&clock); // Our clock was never started and deleted or @@ -213,7 +215,7 @@ if (decoder->refresh_timer.abort) { av_log(NULL, AV_LOG_INFO, - "refresh timer aborted"); + "refresh timer aborted"); return; } @@ -227,7 +229,7 @@ // Drop this frame as we have no way of timing // it ff_circular_queue_advance_read( - &decoder->frame_queue); + &decoder->frame_queue); return; } @@ -256,17 +258,16 @@ decoder->previous_pts = frame->pts; // if not synced against natural clock - if (clock->sync_type - != decoder->natural_sync_clock) { - pts_diff = get_sync_adjusted_pts_diff(clock, - frame->pts, pts_diff); + if (clock->sync_type != decoder->natural_sync_clock) { + pts_diff = get_sync_adjusted_pts_diff( + clock, frame->pts, pts_diff); } decoder->timer_next_wake += pts_diff; // compute the amount of time until next refresh delay_until_next_wake = decoder->timer_next_wake - - (av_gettime() / 1000000.0L); + (av_gettime() / 1000000.0L); if (delay_until_next_wake < 0.010L) { delay_until_next_wake = 0.010L; } @@ -277,9 +278,9 @@ ff_clock_release(&clock); ff_callbacks_frame(decoder->callbacks, frame); - ff_decoder_schedule_refresh(decoder, - (int)(delay_until_next_wake * 1000 - + 0.5L)); + ff_decoder_schedule_refresh( + decoder, + (int)(delay_until_next_wake * 1000 + 0.5L)); av_frame_free(&frame->frame); @@ -309,7 +310,7 @@ } double ff_decoder_get_best_effort_pts(struct ff_decoder *decoder, - AVFrame *frame) + AVFrame *frame) { // this is how long each frame is added to the amount of repeated frames // according to the codec @@ -328,9 +329,10 @@ if (decoder->first_frame) { best_effort_pts = decoder->start_pts; } else { - av_log(NULL, AV_LOG_WARNING, "multiple pts < " - "start_pts; setting start pts " - "to 0"); + av_log(NULL, AV_LOG_WARNING, + "multiple pts < " + "start_pts; setting start pts " + "to 0"); decoder->start_pts = 0; } } @@ -347,11 +349,11 @@ // Update our predicted pts to include the repeated picture count // Our predicted pts clock is based on the codecs time base - estimated_frame_delay = av_frame_get_pkt_duration(frame) - * av_q2d(decoder->codec->time_base); + estimated_frame_delay = av_frame_get_pkt_duration(frame) * + av_q2d(decoder->codec->time_base); // Add repeat frame delay - estimated_frame_delay += frame->repeat_pict - / (1.0L / estimated_frame_delay); + estimated_frame_delay += + frame->repeat_pict / (1.0L / estimated_frame_delay); decoder->predicted_pts += estimated_frame_delay; @@ -359,13 +361,12 @@ } bool ff_decoder_set_frame_drop_state(struct ff_decoder *decoder, - int64_t start_time, int64_t pts) + int64_t start_time, int64_t pts) { if (pts != AV_NOPTS_VALUE) { - int64_t rescaled_pts = av_rescale_q(pts, - decoder->stream->time_base, AV_TIME_BASE_Q); - int64_t master_clock = av_gettime() - - start_time; + int64_t rescaled_pts = av_rescale_q( + pts, decoder->stream->time_base, AV_TIME_BASE_Q); + int64_t master_clock = av_gettime() - start_time; int64_t diff = master_clock - rescaled_pts;
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-decoder.h -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-decoder.h
Changed
@@ -41,11 +41,11 @@ unsigned int packet_queue_size; double timer_next_wake; - double previous_pts; // previous decoded frame's pts - double previous_pts_diff; // previous decoded frame pts delay - double predicted_pts; // predicted pts of next frame - double current_pts; // pts of the most recently dispatched frame - int64_t current_pts_time; // clock time when current_pts was set + double previous_pts; // previous decoded frame's pts + double previous_pts_diff; // previous decoded frame pts delay + double predicted_pts; // predicted pts of next frame + double current_pts; // pts of the most recently dispatched frame + int64_t current_pts_time; // clock time when current_pts was set int64_t start_pts; bool hwaccel_decoder; @@ -62,8 +62,9 @@ typedef struct ff_decoder ff_decoder_t; struct ff_decoder *ff_decoder_init(AVCodecContext *codec_context, - AVStream *stream, unsigned int packet_queue_size, - unsigned int frame_queue_size); + AVStream *stream, + unsigned int packet_queue_size, + unsigned int frame_queue_size); bool ff_decoder_start(struct ff_decoder *decoder); void ff_decoder_free(struct ff_decoder *decoder); @@ -76,10 +77,10 @@ void ff_decoder_refresh(void *opaque); double ff_decoder_get_best_effort_pts(struct ff_decoder *decoder, - AVFrame *frame); + AVFrame *frame); bool ff_decoder_set_frame_drop_state(struct ff_decoder *decoder, - int64_t start_time, int64_t pts); + int64_t start_time, int64_t pts); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-demuxer.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-demuxer.c
Changed
@@ -43,7 +43,7 @@ avdevice_register_all(); avfilter_register_all(); avformat_network_init(); - + demuxer = av_mallocz(sizeof(struct ff_demuxer)); if (demuxer == NULL) return NULL; @@ -60,7 +60,7 @@ } bool ff_demuxer_open(struct ff_demuxer *demuxer, char *input, - char *input_format) + char *input_format) { int ret; @@ -69,7 +69,7 @@ demuxer->input_format = av_strdup(input_format); ret = pthread_create(&demuxer->demuxer_thread, NULL, demux_thread, - demuxer); + demuxer); return ret == 0; } @@ -100,12 +100,11 @@ } void ff_demuxer_set_callbacks(struct ff_callbacks *callbacks, - ff_callback_frame frame, - ff_callback_format format, - ff_callback_initialize initialize, - ff_callback_frame frame_initialize, - ff_callback_frame frame_free, - void *opaque) + ff_callback_frame frame, + ff_callback_format format, + ff_callback_initialize initialize, + ff_callback_frame frame_initialize, + ff_callback_frame frame_free, void *opaque) { callbacks->opaque = opaque; callbacks->frame = frame; @@ -165,19 +164,18 @@ while ((hwaccel = av_hwaccel_next(hwaccel)) != NULL) { if (hwaccel->id == codec_context->codec_id && - (hwaccel->pix_fmt == AV_PIX_FMT_VDA_VLD || + (hwaccel->pix_fmt == AV_PIX_FMT_VDA_VLD || hwaccel->pix_fmt == AV_PIX_FMT_DXVA2_VLD || hwaccel->pix_fmt == AV_PIX_FMT_VAAPI_VLD)) { return hwaccel; } - } return NULL; } enum AVPixelFormat get_hwaccel_format(struct AVCodecContext *s, - const enum AVPixelFormat * fmt) + const enum AVPixelFormat *fmt) { (void)s; (void)fmt; @@ -187,25 +185,25 @@ } static bool initialize_decoder(struct ff_demuxer *demuxer, - AVCodecContext *codec_context, AVStream *stream, - bool hwaccel_decoder) + AVCodecContext *codec_context, AVStream *stream, + bool hwaccel_decoder) { switch (codec_context->codec_type) { case AVMEDIA_TYPE_AUDIO: demuxer->audio_decoder = ff_decoder_init( - codec_context, stream, - demuxer->options.audio_packet_queue_size, - demuxer->options.audio_frame_queue_size); + codec_context, stream, + demuxer->options.audio_packet_queue_size, + demuxer->options.audio_frame_queue_size); demuxer->audio_decoder->hwaccel_decoder = hwaccel_decoder; demuxer->audio_decoder->frame_drop = - demuxer->options.frame_drop; + demuxer->options.frame_drop; demuxer->audio_decoder->natural_sync_clock = - AV_SYNC_AUDIO_MASTER; + AV_SYNC_AUDIO_MASTER; demuxer->audio_decoder->callbacks = &demuxer->audio_callbacks; if (!ff_callbacks_format(&demuxer->audio_callbacks, - codec_context)) { + codec_context)) { ff_decoder_free(demuxer->audio_decoder); demuxer->audio_decoder = NULL; return false; @@ -216,19 +214,19 @@ case AVMEDIA_TYPE_VIDEO: demuxer->video_decoder = ff_decoder_init( - codec_context, stream, - demuxer->options.video_packet_queue_size, - demuxer->options.video_frame_queue_size); + codec_context, stream, + demuxer->options.video_packet_queue_size, + demuxer->options.video_frame_queue_size); demuxer->video_decoder->hwaccel_decoder = hwaccel_decoder; demuxer->video_decoder->frame_drop = - demuxer->options.frame_drop; + demuxer->options.frame_drop; demuxer->video_decoder->natural_sync_clock = - AV_SYNC_VIDEO_MASTER; + AV_SYNC_VIDEO_MASTER; demuxer->video_decoder->callbacks = &demuxer->video_callbacks; if (!ff_callbacks_format(&demuxer->video_callbacks, - codec_context)) { + codec_context)) { ff_decoder_free(demuxer->video_decoder); demuxer->video_decoder = NULL; return false; @@ -240,8 +238,8 @@ } } -typedef enum AVPixelFormat (*AVGetFormatCb)( - struct AVCodecContext *s, const enum AVPixelFormat * fmt); +typedef enum AVPixelFormat (*AVGetFormatCb)(struct AVCodecContext *s, + const enum AVPixelFormat *fmt); static bool find_decoder(struct ff_demuxer *demuxer, AVStream *stream) { @@ -258,10 +256,10 @@ codec_context->refcounted_frames = 1; // png/tiff decoders have serious issues with multiple threads - if (codec_context->codec_id == AV_CODEC_ID_PNG - || codec_context->codec_id == AV_CODEC_ID_TIFF - || codec_context->codec_id == AV_CODEC_ID_JPEG2000 - || codec_context->codec_id == AV_CODEC_ID_WEBP) + if (codec_context->codec_id == AV_CODEC_ID_PNG || + codec_context->codec_id == AV_CODEC_ID_TIFF || + codec_context->codec_id == AV_CODEC_ID_JPEG2000 || + codec_context->codec_id == AV_CODEC_ID_WEBP) codec_context->thread_count = 1; if (demuxer->options.is_hw_decoding) { @@ -269,24 +267,24 @@ if (hwaccel) { AVCodec *codec_vda = - avcodec_find_decoder_by_name(hwaccel->name); + avcodec_find_decoder_by_name(hwaccel->name); if (codec_vda != NULL) { AVGetFormatCb original_get_format = - codec_context->get_format; + codec_context->get_format; codec_context->get_format = get_hwaccel_format; codec_context->opaque = hwaccel; ret = avcodec_open2(codec_context, codec_vda, - &options_dict); + &options_dict); if (ret < 0) { av_log(NULL, AV_LOG_WARNING, - "no hardware decoder found for" - " codec with id %d", - codec_context->codec_id); + "no hardware decoder found for" + " codec with id %d", + codec_context->codec_id); codec_context->get_format = - original_get_format; + original_get_format; codec_context->opaque = NULL; } else { codec = codec_vda; @@ -305,21 +303,23 @@ if (!codec) codec = avcodec_find_decoder(codec_context->codec_id); if (codec == NULL) { - av_log(NULL, AV_LOG_WARNING, "no decoder found for" - " codec with id %d", - codec_context->codec_id); + av_log(NULL, AV_LOG_WARNING, + "no decoder found for" + " codec with id %d", + codec_context->codec_id); return false; } if (avcodec_open2(codec_context, codec, &options_dict) < 0) { - av_log(NULL, AV_LOG_WARNING, "unable to open decoder" - " with codec id %d", - codec_context->codec_id); + av_log(NULL, AV_LOG_WARNING, + "unable to open decoder" + " with codec id %d", + codec_context->codec_id); return false; } } return initialize_decoder(demuxer, codec_context, stream, - hwaccel_decoder); + hwaccel_decoder); } void ff_demuxer_flush(struct ff_demuxer *demuxer) @@ -328,14 +328,14 @@ demuxer->video_decoder->stream != NULL) { packet_queue_flush(&demuxer->video_decoder->packet_queue); packet_queue_put_flush_packet( - &demuxer->video_decoder->packet_queue); + &demuxer->video_decoder->packet_queue); } if (demuxer->audio_decoder != NULL && demuxer->audio_decoder->stream != NULL) { packet_queue_flush(&demuxer->audio_decoder->packet_queue); packet_queue_put_flush_packet( - &demuxer->audio_decoder->packet_queue); + &demuxer->audio_decoder->packet_queue); } } @@ -352,18 +352,18 @@ if (demuxer->audio_decoder != NULL) { ff_clock_retain(clock); packet_queue_put(&demuxer->audio_decoder->packet_queue, - &packet); + &packet); } if (demuxer->video_decoder != NULL) { ff_clock_retain(clock); packet_queue_put(&demuxer->video_decoder->packet_queue, - &packet); + &packet); } } static bool open_input(struct ff_demuxer *demuxer, - AVFormatContext **format_context) + AVFormatContext **format_context) { AVInputFormat *input_format = NULL; @@ -377,24 +377,25 @@ if (demuxer->input_format != NULL) { input_format = av_find_input_format(demuxer->input_format); if (input_format == NULL) - av_log(NULL, AV_LOG_WARNING, "unable to find input " - "format %s", - demuxer->input_format); + av_log(NULL, AV_LOG_WARNING, + "unable to find input " + "format %s", + demuxer->input_format); } - if (avformat_open_input(format_context, demuxer->input, - input_format, &demuxer->options.custom_options) != 0) + if (avformat_open_input(format_context, demuxer->input, input_format, + &demuxer->options.custom_options) != 0) return false; return avformat_find_stream_info(*format_context, NULL) >= 0; } static inline void set_decoder_start_time(struct ff_decoder *decoder, - int64_t start_time) + int64_t start_time) { if (decoder) decoder->start_pts = av_rescale_q(start_time, AV_TIME_BASE_Q, - decoder->stream->time_base); + decoder->stream->time_base); } static bool find_and_initialize_stream_decoders(struct ff_demuxer *demuxer) @@ -415,12 +416,12 @@ audio_stream = format_context->streams[i]; } - int default_stream_index = av_find_default_stream_index( - demuxer->format_context); + int default_stream_index = + av_find_default_stream_index(demuxer->format_context); if (default_stream_index >= 0) { AVStream *stream = - format_context->streams[default_stream_index]; + format_context->streams[default_stream_index]; if (stream->codec->codec_type == AVMEDIA_TYPE_AUDIO) demuxer->clock.sync_type = AV_SYNC_AUDIO_MASTER; @@ -452,7 +453,7 @@ } st_start_time = av_rescale_q(st->start_time, st->time_base, - AV_TIME_BASE_Q); + AV_TIME_BASE_Q); start_time = FFMIN(start_time, st_start_time); } @@ -508,18 +509,17 @@ seek_stream = demuxer->audio_decoder->stream; } - if (seek_stream != NULL && demuxer->format_context->duration != AV_NOPTS_VALUE) { - seek_target = av_rescale_q(seek_target, - AV_TIME_BASE_Q, - seek_stream->time_base); + if (seek_stream != NULL && + demuxer->format_context->duration != AV_NOPTS_VALUE) { + seek_target = av_rescale_q(seek_target, AV_TIME_BASE_Q, + seek_stream->time_base); } - ret = av_seek_frame(demuxer->format_context, - 0, seek_target, - demuxer->seek_flags); + ret = av_seek_frame(demuxer->format_context, 0, seek_target, + demuxer->seek_flags); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "unable to seek stream: %s", - av_err2str(ret)); + av_err2str(ret)); demuxer->seek_pos = 0; demuxer->seek_request = false; return false; @@ -551,7 +551,7 @@ static void *demux_thread(void *opaque) { - struct ff_demuxer *demuxer = (struct ff_demuxer *) opaque; + struct ff_demuxer *demuxer = (struct ff_demuxer *)opaque; int result; struct ff_packet packet = {0}; @@ -584,7 +584,7 @@ eof = true; } else if (demuxer->format_context->pb != NULL) { AVIOContext *io_context = - demuxer->format_context->pb; + demuxer->format_context->pb; if (io_context->error == 0) { av_usleep(100 * 1000); // 100ms continue; @@ -603,8 +603,8 @@ continue; } else { av_log(NULL, AV_LOG_ERROR, - "av_read_frame() failed: %s", - av_err2str(result)); + "av_read_frame() failed: %s", + av_err2str(result)); break; } }
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-demuxer.h -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-demuxer.h
Changed
@@ -31,8 +31,7 @@ extern "C" { #endif -struct ff_demuxer_options -{ +struct ff_demuxer_options { int audio_packet_queue_size; int video_packet_queue_size; int audio_frame_queue_size; @@ -75,16 +74,16 @@ typedef struct ff_demuxer ff_demuxer_t; struct ff_demuxer *ff_demuxer_init(); -bool ff_demuxer_open(struct ff_demuxer *demuxer, char *input, char *input_format); +bool ff_demuxer_open(struct ff_demuxer *demuxer, char *input, + char *input_format); void ff_demuxer_free(struct ff_demuxer *demuxer); void ff_demuxer_set_callbacks(struct ff_callbacks *callbacks, - ff_callback_frame frame, - ff_callback_format format, - ff_callback_initialize initialize, - ff_callback_frame frame_initialize, - ff_callback_frame frame_free, - void *opaque); + ff_callback_frame frame, + ff_callback_format format, + ff_callback_initialize initialize, + ff_callback_frame frame_initialize, + ff_callback_frame frame_free, void *opaque); void ff_demuxer_flush(struct ff_demuxer *demuxer);
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-packet-queue.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-packet-queue.c
Changed
@@ -36,7 +36,6 @@ pthread_mutex_destroy(&q->mutex); fail: return false; - } void packet_queue_abort(struct ff_packet_queue *q) @@ -93,7 +92,7 @@ } int packet_queue_get(struct ff_packet_queue *q, struct ff_packet *packet, - bool block) + bool block) { struct ff_packet_list *potential_packet; int return_status; @@ -141,7 +140,7 @@ pthread_mutex_lock(&q->mutex); for (packet = q->first_packet; packet != NULL; - packet = q->first_packet) { + packet = q->first_packet) { q->first_packet = packet->next; av_free_packet(&packet->packet.base); if (packet->packet.clock != NULL)
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-packet-queue.h -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-packet-queue.h
Changed
@@ -36,8 +36,8 @@ }; struct ff_packet_list { - struct ff_packet packet; - struct ff_packet_list *next; + struct ff_packet packet; + struct ff_packet_list *next; }; struct ff_packet_queue { @@ -59,7 +59,7 @@ int packet_queue_put(struct ff_packet_queue *q, struct ff_packet *packet); int packet_queue_put_flush_packet(struct ff_packet_queue *q); int packet_queue_get(struct ff_packet_queue *q, struct ff_packet *packet, - bool block); + bool block); void packet_queue_flush(struct ff_packet_queue *q);
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-timer.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-timer.c
Changed
@@ -38,17 +38,16 @@ uint64_t current_time = av_gettime(); if (current_time < timer->next_wake) { struct timespec sleep_time = { - .tv_sec = timer->next_wake / AV_TIME_BASE, - .tv_nsec = (timer->next_wake % AV_TIME_BASE) - * 1000 - }; + .tv_sec = timer->next_wake / AV_TIME_BASE, + .tv_nsec = (timer->next_wake % AV_TIME_BASE) * + 1000}; - ret = pthread_cond_timedwait(&timer->cond, - &timer->mutex, &sleep_time); + ret = pthread_cond_timedwait( + &timer->cond, &timer->mutex, &sleep_time); if (ret != ETIMEDOUT) { // failed to wait, just sleep - av_usleep((unsigned)(timer->next_wake - - current_time)); + av_usleep((unsigned)(timer->next_wake - + current_time)); } pthread_mutex_unlock(&timer->mutex); @@ -78,7 +77,7 @@ } bool ff_timer_init(struct ff_timer *timer, ff_timer_callback callback, - void *opaque) + void *opaque) { memset(timer, 0, sizeof(struct ff_timer)); timer->abort = false; @@ -88,14 +87,15 @@ if (pthread_mutexattr_init(&timer->mutexattr) != 0) goto fail; if (pthread_mutexattr_settype(&timer->mutexattr, - PTHREAD_MUTEX_RECURSIVE)) + PTHREAD_MUTEX_RECURSIVE)) goto fail1; if (pthread_mutex_init(&timer->mutex, &timer->mutexattr) != 0) goto fail1; if (pthread_cond_init(&timer->cond, NULL) != 0) goto fail2; - if (pthread_create(&timer->timer_thread, NULL, timer_thread, timer) != 0) + if (pthread_create(&timer->timer_thread, NULL, timer_thread, timer) != + 0) goto fail3; return true;
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-timer.h -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-timer.h
Changed
@@ -43,8 +43,8 @@ typedef struct ff_timer ff_timer_t; -bool ff_timer_init(struct ff_timer *timer, - ff_timer_callback callback, void *opaque); +bool ff_timer_init(struct ff_timer *timer, ff_timer_callback callback, + void *opaque); void ff_timer_free(struct ff_timer *timer); void ff_timer_schedule(struct ff_timer *timer, uint64_t microseconds);
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-util.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-util.c
Changed
@@ -40,7 +40,7 @@ const char *extensions; enum AVCodecID audio_codec; enum AVCodecID video_codec; - const struct AVCodecTag * const *codec_tags; + const struct AVCodecTag *const *codec_tags; const struct ff_format_desc *next; }; @@ -56,9 +56,11 @@ void ff_init() { +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); //avdevice_register_all(); avcodec_register_all(); +#endif avformat_network_init(); } @@ -71,7 +73,7 @@ return NULL; } -static bool get_codecs(const AVCodecDescriptor*** descs, unsigned int *size) +static bool get_codecs(const AVCodecDescriptor ***descs, unsigned int *size) { const AVCodecDescriptor *desc = NULL; const AVCodecDescriptor **codecs; @@ -84,8 +86,10 @@ codecs = av_calloc(codec_count, sizeof(AVCodecDescriptor *)); if (codecs == NULL) { - av_log(NULL, AV_LOG_ERROR, "unable to allocate sorted codec " - "array with size %d", codec_count); + av_log(NULL, AV_LOG_ERROR, + "unable to allocate sorted codec " + "array with size %d", + codec_count); return false; } @@ -99,18 +103,37 @@ static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev) { - while ((prev = av_codec_next(prev)) != NULL) { - if (prev->id == id && av_codec_is_encoder(prev)) - return prev; - } - - return NULL; +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 9, 100) + const AVCodec *cur = NULL; + void *i = 0; + bool found_prev = false; + + while ((cur = av_codec_iterate(&i)) != NULL) { + if (cur->id == id && av_codec_is_encoder(cur)) { + if (!prev) { + return cur; + } else if (!found_prev) { + if (cur == prev) { + found_prev = true; + } + } else { + return cur; + } + } + } +#else + while ((prev = av_codec_next(prev)) != NULL) { + if (prev->id == id && av_codec_is_encoder(prev)) + return prev; + } +#endif + return NULL; } static void add_codec_to_list(const struct ff_format_desc *format_desc, - struct ff_codec_desc **first, struct ff_codec_desc **current, - enum AVCodecID id, const AVCodec *codec, - bool ignore_compatability) + struct ff_codec_desc **first, + struct ff_codec_desc **current, enum AVCodecID id, + const AVCodec *codec, bool ignore_compatability) { if (codec == NULL) codec = avcodec_find_encoder(id); @@ -125,8 +148,8 @@ if (!ignore_compatability) { // Format doesn't support this codec - unsigned int tag = av_codec_get_tag(format_desc->codec_tags, - codec->id); + unsigned int tag = + av_codec_get_tag(format_desc->codec_tags, codec->id); if (tag == 0) return; } @@ -162,18 +185,19 @@ } static void get_codecs_for_id(const struct ff_format_desc *format_desc, - struct ff_codec_desc **first, struct ff_codec_desc **current, - enum AVCodecID id, bool ignore_compatability) + struct ff_codec_desc **first, + struct ff_codec_desc **current, enum AVCodecID id, + bool ignore_compatability) { const AVCodec *codec = NULL; while ((codec = next_codec_for_id(id, codec)) != NULL) - add_codec_to_list(format_desc, first, current, codec->id, - codec, ignore_compatability); + add_codec_to_list(format_desc, first, current, codec->id, codec, + ignore_compatability); } -const struct ff_codec_desc *ff_codec_supported( - const struct ff_format_desc *format_desc, - bool ignore_compatability) +const struct ff_codec_desc * +ff_codec_supported(const struct ff_format_desc *format_desc, + bool ignore_compatability) { const AVCodecDescriptor **codecs; unsigned int size; @@ -184,10 +208,10 @@ if (!get_codecs(&codecs, &size)) return NULL; - for(i = 0; i < size; i++) { + for (i = 0; i < size; i++) { const AVCodecDescriptor *codec = codecs[i]; get_codecs_for_id(format_desc, &first, ¤t, codec->id, - ignore_compatability); + ignore_compatability); } av_free((void *)codecs); @@ -235,8 +259,8 @@ return FF_CODEC_UNKNOWN; } -const struct ff_codec_desc *ff_codec_desc_next( - const struct ff_codec_desc *codec_desc) +const struct ff_codec_desc * +ff_codec_desc_next(const struct ff_codec_desc *codec_desc) { if (codec_desc != NULL) return codec_desc->next; @@ -255,7 +279,7 @@ void ff_codec_desc_free(const struct ff_codec_desc *codec_desc) { const struct ff_codec_desc *desc = codec_desc; - while(desc != NULL) { + while (desc != NULL) { const struct ff_codec_desc *next = desc->next; av_free((void *)desc); desc = next; @@ -283,11 +307,17 @@ const struct ff_format_desc *ff_format_supported() { - AVOutputFormat *output_format = NULL; + const AVOutputFormat *output_format = NULL; struct ff_format_desc *desc = NULL; struct ff_format_desc *current = NULL; +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(58, 9, 100) + void *i = 0; + + while ((output_format = av_muxer_iterate(&i)) != NULL) { +#else while ((output_format = av_oformat_next(output_format)) != NULL) { +#endif struct ff_format_desc *d; if (is_output_device(output_format->priv_class)) continue; @@ -377,8 +407,8 @@ return false; } -const struct ff_format_desc *ff_format_desc_next( - const struct ff_format_desc *format_desc) +const struct ff_format_desc * +ff_format_desc_next(const struct ff_format_desc *format_desc) { if (format_desc != NULL) return format_desc->next; @@ -387,7 +417,7 @@ } static const char *get_encoder_name(const struct ff_format_desc *format_desc, - enum AVCodecID codec_id) + enum AVCodecID codec_id) { AVCodec *codec = avcodec_find_encoder(codec_id); if (codec == NULL && codec_id == AV_CODEC_ID_NONE) @@ -398,27 +428,24 @@ return codec->name; } -const char *ff_format_desc_get_default_name( - const struct ff_format_desc *format_desc, - enum ff_codec_type codec_type) +const char * +ff_format_desc_get_default_name(const struct ff_format_desc *format_desc, + enum ff_codec_type codec_type) { - switch (codec_type) - { - case FF_CODEC_AUDIO: - return get_encoder_name(format_desc, - format_desc->audio_codec); - case FF_CODEC_VIDEO: - return get_encoder_name(format_desc, - format_desc->video_codec); - default: - return NULL; + switch (codec_type) { + case FF_CODEC_AUDIO: + return get_encoder_name(format_desc, format_desc->audio_codec); + case FF_CODEC_VIDEO: + return get_encoder_name(format_desc, format_desc->video_codec); + default: + return NULL; } } void ff_format_desc_free(const struct ff_format_desc *format_desc) { const struct ff_format_desc *desc = format_desc; - while(desc != NULL) { + while (desc != NULL) { const struct ff_format_desc *next = desc->next; av_free((void *)desc); desc = next;
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-util.h -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-util.h
Changed
@@ -22,11 +22,7 @@ extern "C" { #endif -enum ff_codec_type { - FF_CODEC_AUDIO, - FF_CODEC_VIDEO, - FF_CODEC_UNKNOWN -}; +enum ff_codec_type { FF_CODEC_AUDIO, FF_CODEC_VIDEO, FF_CODEC_UNKNOWN }; struct ff_format_desc; struct ff_codec_desc; @@ -36,9 +32,9 @@ const char *ff_codec_name_from_id(int codec_id); // Codec Description -const struct ff_codec_desc *ff_codec_supported( - const struct ff_format_desc *format_desc, - bool ignore_compatability); +const struct ff_codec_desc * +ff_codec_supported(const struct ff_format_desc *format_desc, + bool ignore_compatability); void ff_codec_desc_free(const struct ff_codec_desc *codec_desc); const char *ff_codec_desc_name(const struct ff_codec_desc *codec_desc); const char *ff_codec_desc_long_name(const struct ff_codec_desc *codec_desc); @@ -46,8 +42,8 @@ bool ff_codec_desc_is_alias(const struct ff_codec_desc *codec_desc); const char *ff_codec_desc_base_name(const struct ff_codec_desc *codec_desc); int ff_codec_desc_id(const struct ff_codec_desc *codec_desc); -const struct ff_codec_desc *ff_codec_desc_next( - const struct ff_codec_desc *codec_desc); +const struct ff_codec_desc * +ff_codec_desc_next(const struct ff_codec_desc *codec_desc); // Format Description const struct ff_format_desc *ff_format_supported(); @@ -60,11 +56,11 @@ bool ff_format_desc_has_video(const struct ff_format_desc *format_desc); int ff_format_desc_audio(const struct ff_format_desc *format_desc); int ff_format_desc_video(const struct ff_format_desc *format_desc); -const char *ff_format_desc_get_default_name( - const struct ff_format_desc *format_desc, - enum ff_codec_type codec_type); -const struct ff_format_desc *ff_format_desc_next( - const struct ff_format_desc *format_desc); +const char * +ff_format_desc_get_default_name(const struct ff_format_desc *format_desc, + enum ff_codec_type codec_type); +const struct ff_format_desc * +ff_format_desc_next(const struct ff_format_desc *format_desc); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/deps/libff/libff/ff-video-decoder.c -> obs-studio-24.0.0.tar.xz/deps/libff/libff/ff-video-decoder.c
Changed
@@ -30,7 +30,7 @@ #include "ff-compat.h" static bool queue_frame(struct ff_decoder *decoder, AVFrame *frame, - double best_effort_pts) + double best_effort_pts) { struct ff_frame *queue_frame; bool call_initialize; @@ -46,10 +46,10 @@ // Check if we need to communicate a different format has been received // to any callbacks AVCodecContext *codec = decoder->codec; - call_initialize = (queue_frame->frame == NULL - || queue_frame->frame->width != codec->width - || queue_frame->frame->height != codec->height - || queue_frame->frame->format != codec->pix_fmt); + call_initialize = (queue_frame->frame == NULL || + queue_frame->frame->width != codec->width || + queue_frame->frame->height != codec->height || + queue_frame->frame->format != codec->pix_fmt); if (queue_frame->frame != NULL) { // This shouldn't happen any more, the frames are freed in @@ -72,7 +72,7 @@ void *ff_video_decoder_thread(void *opaque_video_decoder) { - struct ff_decoder *decoder = (struct ff_decoder*)opaque_video_decoder; + struct ff_decoder *decoder = (struct ff_decoder *)opaque_video_decoder; struct ff_packet packet = {0}; int complete; @@ -82,16 +82,19 @@ while (!decoder->abort) { if (decoder->eof) - ret = packet_queue_get(&decoder->packet_queue, &packet, 0); + ret = packet_queue_get(&decoder->packet_queue, &packet, + 0); else - ret = packet_queue_get(&decoder->packet_queue, &packet, 1); + ret = packet_queue_get(&decoder->packet_queue, &packet, + 1); if (ret == FF_PACKET_EMPTY || ret == FF_PACKET_FAIL) { // should we just use abort here? break; } - if (packet.base.data == decoder->packet_queue.flush_packet.base.data) { + if (packet.base.data == + decoder->packet_queue.flush_packet.base.data) { avcodec_flush_buffers(decoder->codec); continue; } @@ -116,11 +119,11 @@ frame_drop_check &= start_time != AV_NOPTS_VALUE; if (frame_drop_check) - ff_decoder_set_frame_drop_state(decoder, - start_time, packet.base.pts); + ff_decoder_set_frame_drop_state(decoder, start_time, + packet.base.pts); - avcodec_decode_video2(decoder->codec, frame, - &complete, &packet.base); + avcodec_decode_video2(decoder->codec, frame, &complete, + &packet.base); // Did we get an entire video frame? This doesn't guarantee // there is a picture to show for some codecs, but we still want @@ -131,7 +134,7 @@ // This function returns a pts scaled to stream // time base double best_effort_pts = - ff_decoder_get_best_effort_pts(decoder, frame); + ff_decoder_get_best_effort_pts(decoder, frame); queue_frame(decoder, frame, best_effort_pts); av_frame_unref(frame);
View file
obs-studio-24.0.0.tar.xz/deps/lzma/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/deps/media-playback/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/deps/media-playback/CMakeLists.txt
Changed
@@ -9,6 +9,7 @@ ) set(media-playback_HEADERS + media-playback/closest-format.h media-playback/decode.h media-playback/media.h )
View file
obs-studio-23.2.1.tar.xz/deps/media-playback/media-playback/closest-format.h -> obs-studio-24.0.0.tar.xz/deps/media-playback/media-playback/closest-format.h
Changed
@@ -61,6 +61,15 @@ case AV_PIX_FMT_YUV420P14LE: return AV_PIX_FMT_YUV420P; + case AV_PIX_FMT_YUVA420P: + return AV_PIX_FMT_YUVA420P; + + case AV_PIX_FMT_YUVA422P: + return AV_PIX_FMT_YUVA422P; + + case AV_PIX_FMT_YUVA444P: + return AV_PIX_FMT_YUVA444P; + case AV_PIX_FMT_RGBA: case AV_PIX_FMT_BGRA: case AV_PIX_FMT_BGR0:
View file
obs-studio-23.2.1.tar.xz/deps/media-playback/media-playback/decode.c -> obs-studio-24.0.0.tar.xz/deps/media-playback/media-playback/decode.c
Changed
@@ -17,29 +17,62 @@ #include "decode.h" #include "media.h" -static AVCodec *find_hardware_decoder(enum AVCodecID id) +#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 4, 100) +#define USE_NEW_HARDWARE_CODEC_METHOD +#endif + +#ifdef USE_NEW_HARDWARE_CODEC_METHOD +enum AVHWDeviceType hw_priority[] = { + AV_HWDEVICE_TYPE_D3D11VA, AV_HWDEVICE_TYPE_DXVA2, + AV_HWDEVICE_TYPE_VAAPI, AV_HWDEVICE_TYPE_VDPAU, + AV_HWDEVICE_TYPE_QSV, AV_HWDEVICE_TYPE_NONE, +}; + +static bool has_hw_type(AVCodec *c, enum AVHWDeviceType type, + enum AVPixelFormat *hw_format) { - AVHWAccel *hwa = av_hwaccel_next(NULL); - AVCodec *c = NULL; - - while (hwa) { - if (hwa->id == id) { - if (hwa->pix_fmt == AV_PIX_FMT_VDTOOL || - hwa->pix_fmt == AV_PIX_FMT_DXVA2_VLD || - hwa->pix_fmt == AV_PIX_FMT_VAAPI_VLD) { - c = avcodec_find_decoder_by_name(hwa->name); - if (c) - break; - } + for (int i = 0;; i++) { + const AVCodecHWConfig *config = avcodec_get_hw_config(c, i); + if (!config) { + break; } - hwa = av_hwaccel_next(hwa); + if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX && + config->device_type == type) { + *hw_format = config->pix_fmt; + return true; + } } - return c; + return false; } -static int mp_open_codec(struct mp_decode *d) +static void init_hw_decoder(struct mp_decode *d, AVCodecContext *c) +{ + enum AVHWDeviceType *priority = hw_priority; + AVBufferRef *hw_ctx = NULL; + + while (*priority != AV_HWDEVICE_TYPE_NONE) { + if (has_hw_type(d->codec, *priority, &d->hw_format)) { + int ret = av_hwdevice_ctx_create(&hw_ctx, *priority, + NULL, NULL, 0); + if (ret == 0) + break; + } + + priority++; + } + + if (hw_ctx) { + c->hw_device_ctx = av_buffer_ref(hw_ctx); + c->opaque = d; + d->hw_ctx = hw_ctx; + d->hw = true; + } +} +#endif + +static int mp_open_codec(struct mp_decode *d, bool hw) { AVCodecContext *c; int ret; @@ -58,12 +91,17 @@ c = d->stream->codec; #endif - if (c->thread_count == 1 && - c->codec_id != AV_CODEC_ID_PNG && + d->hw = false; + +#ifdef USE_NEW_HARDWARE_CODEC_METHOD + if (hw) + init_hw_decoder(d, c); +#endif + + if (c->thread_count == 1 && c->codec_id != AV_CODEC_ID_PNG && c->codec_id != AV_CODEC_ID_TIFF && c->codec_id != AV_CODEC_ID_JPEG2000 && - c->codec_id != AV_CODEC_ID_MPEG4 && - c->codec_id != AV_CODEC_ID_WEBP) + c->codec_id != AV_CODEC_ID_MPEG4 && c->codec_id != AV_CODEC_ID_WEBP) c->thread_count = 0; ret = avcodec_open2(c, d->codec, NULL); @@ -103,45 +141,54 @@ id = stream->codec->codec_id; #endif - if (hw) { - d->codec = find_hardware_decoder(id); - if (d->codec) { - ret = mp_open_codec(d); - if (ret < 0) - d->codec = NULL; + if (id == AV_CODEC_ID_VP8 || id == AV_CODEC_ID_VP9) { + AVDictionaryEntry *tag = NULL; + tag = av_dict_get(stream->metadata, "alpha_mode", tag, + AV_DICT_IGNORE_SUFFIX); + + if (tag && strcmp(tag->value, "1") == 0) { + char *codec = (id == AV_CODEC_ID_VP8) ? "libvpx" + : "libvpx-vp9"; + d->codec = avcodec_find_decoder_by_name(codec); } } + if (!d->codec) + d->codec = avcodec_find_decoder(id); + if (!d->codec) { - if (id == AV_CODEC_ID_VP8) - d->codec = avcodec_find_decoder_by_name("libvpx"); - else if (id == AV_CODEC_ID_VP9) - d->codec = avcodec_find_decoder_by_name("libvpx-vp9"); - - if (!d->codec) - d->codec = avcodec_find_decoder(id); - if (!d->codec) { - blog(LOG_WARNING, "MP: Failed to find %s codec", - av_get_media_type_string(type)); - return false; - } + blog(LOG_WARNING, "MP: Failed to find %s codec", + av_get_media_type_string(type)); + return false; + } - ret = mp_open_codec(d); - if (ret < 0) { - blog(LOG_WARNING, "MP: Failed to open %s decoder: %s", - av_get_media_type_string(type), - av_err2str(ret)); - return false; - } + ret = mp_open_codec(d, hw); + if (ret < 0) { + blog(LOG_WARNING, "MP: Failed to open %s decoder: %s", + av_get_media_type_string(type), av_err2str(ret)); + return false; } - d->frame = av_frame_alloc(); - if (!d->frame) { + d->sw_frame = av_frame_alloc(); + if (!d->sw_frame) { blog(LOG_WARNING, "MP: Failed to allocate %s frame", - av_get_media_type_string(type)); + av_get_media_type_string(type)); return false; } + if (d->hw) { + d->hw_frame = av_frame_alloc(); + if (!d->hw_frame) { + blog(LOG_WARNING, "MP: Failed to allocate %s hw frame", + av_get_media_type_string(type)); + return false; + } + + d->in_frame = d->hw_frame; + } else { + d->in_frame = d->sw_frame; + } + if (d->codec->capabilities & CODEC_CAP_TRUNC) d->decoder->flags |= CODEC_FLAG_TRUNC; return true; @@ -166,6 +213,10 @@ mp_decode_clear_packets(d); circlebuf_free(&d->packets); + if (d->hw_frame) { + av_frame_unref(d->hw_frame); + av_free(d->hw_frame); + } if (d->decoder) { #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 40, 101) avcodec_free_context(&d->decoder); @@ -173,11 +224,17 @@ avcodec_close(d->decoder); #endif } - if (d->frame) { - av_frame_unref(d->frame); - av_free(d->frame); + if (d->sw_frame) { + av_frame_unref(d->sw_frame); + av_free(d->sw_frame); } +#ifdef USE_NEW_HARDWARE_CODEC_METHOD + if (d->hw_ctx) { + av_buffer_unref(&d->hw_ctx); + } +#endif + memset(d, 0, sizeof(*d)); } @@ -187,22 +244,22 @@ } static inline int64_t get_estimated_duration(struct mp_decode *d, - int64_t last_pts) + int64_t last_pts) { if (last_pts) return d->frame_pts - last_pts; if (d->audio) { - return av_rescale_q(d->frame->nb_samples, - (AVRational){1, d->frame->sample_rate}, - (AVRational){1, 1000000000}); + return av_rescale_q(d->in_frame->nb_samples, + (AVRational){1, d->in_frame->sample_rate}, + (AVRational){1, 1000000000}); } else { if (d->last_duration) return d->last_duration; return av_rescale_q(d->decoder->time_base.num, - d->decoder->time_base, - (AVRational){1, 1000000000}); + d->decoder->time_base, + (AVRational){1, 1000000000}); } } @@ -212,7 +269,7 @@ *got_frame = 0; #ifdef USE_NEW_FFMPEG_DECODE_API - ret = avcodec_receive_frame(d->decoder, d->frame); + ret = avcodec_receive_frame(d->decoder, d->in_frame); if (ret != 0 && ret != AVERROR(EAGAIN)) { if (ret == AVERROR_EOF) ret = 0; @@ -227,7 +284,7 @@ return ret; } - ret = avcodec_receive_frame(d->decoder, d->frame); + ret = avcodec_receive_frame(d->decoder, d->in_frame); if (ret != 0 && ret != AVERROR(EAGAIN)) { if (ret == AVERROR_EOF) ret = 0; @@ -243,13 +300,30 @@ #else if (d->audio) { - ret = avcodec_decode_audio4(d->decoder, - d->frame, got_frame, &d->pkt); + ret = avcodec_decode_audio4(d->decoder, d->in_frame, got_frame, + &d->pkt); } else { - ret = avcodec_decode_video2(d->decoder, - d->frame, got_frame, &d->pkt); + ret = avcodec_decode_video2(d->decoder, d->in_frame, got_frame, + &d->pkt); } #endif + +#ifdef USE_NEW_HARDWARE_CODEC_METHOD + if (*got_frame && d->hw) { + if (d->hw_frame->format != d->hw_format) { + d->frame = d->hw_frame; + return ret; + } + + int err = av_hwframe_transfer_data(d->sw_frame, d->hw_frame, 0); + if (err != 0) { + ret = 0; + *got_frame = false; + } + } +#endif + + d->frame = d->sw_frame; return ret; } @@ -275,7 +349,7 @@ } } else { circlebuf_pop_front(&d->packets, &d->orig_pkt, - sizeof(d->orig_pkt)); + sizeof(d->orig_pkt)); d->pkt = d->orig_pkt; d->packet_pending = true; } @@ -290,7 +364,7 @@ if (ret < 0) { #ifdef DETAILED_DEBUG_INFO blog(LOG_DEBUG, "MP: decode failed: %s", - av_err2str(ret)); + av_err2str(ret)); #endif if (d->packet_pending) { @@ -322,29 +396,28 @@ if (d->frame_ready) { int64_t last_pts = d->frame_pts; - if (d->frame->best_effort_timestamp == AV_NOPTS_VALUE) + if (d->in_frame->best_effort_timestamp == AV_NOPTS_VALUE) d->frame_pts = d->next_pts; else - d->frame_pts = av_rescale_q( - d->frame->best_effort_timestamp, - d->stream->time_base, - (AVRational){1, 1000000000}); + d->frame_pts = + av_rescale_q(d->in_frame->best_effort_timestamp, + d->stream->time_base, + (AVRational){1, 1000000000}); - int64_t duration = d->frame->pkt_duration; + int64_t duration = d->in_frame->pkt_duration; if (!duration) duration = get_estimated_duration(d, last_pts); else - duration = av_rescale_q(duration, - d->stream->time_base, - (AVRational){1, 1000000000}); + duration = av_rescale_q(duration, d->stream->time_base, + (AVRational){1, 1000000000}); if (d->m->speed != 100) { - d->frame_pts = av_rescale_q(d->frame_pts, - (AVRational){1, d->m->speed}, - (AVRational){1, 100}); + d->frame_pts = av_rescale_q( + d->frame_pts, (AVRational){1, d->m->speed}, + (AVRational){1, 100}); duration = av_rescale_q(duration, - (AVRational){1, d->m->speed}, - (AVRational){1, 100}); + (AVRational){1, d->m->speed}, + (AVRational){1, 100}); } d->last_duration = duration;
View file
obs-studio-23.2.1.tar.xz/deps/media-playback/media-playback/decode.h -> obs-studio-24.0.0.tar.xz/deps/media-playback/media-playback/decode.h
Changed
@@ -53,29 +53,35 @@ struct mp_media; struct mp_decode { - struct mp_media *m; - AVStream *stream; - bool audio; - - AVCodecContext *decoder; - AVCodec *codec; - - int64_t last_duration; - int64_t frame_pts; - int64_t next_pts; - AVFrame *frame; - bool got_first_keyframe; - bool frame_ready; - bool eof; - - AVPacket orig_pkt; - AVPacket pkt; - bool packet_pending; - struct circlebuf packets; + struct mp_media *m; + AVStream *stream; + bool audio; + + AVCodecContext *decoder; + AVBufferRef *hw_ctx; + AVCodec *codec; + + int64_t last_duration; + int64_t frame_pts; + int64_t next_pts; + AVFrame *in_frame; + AVFrame *sw_frame; + AVFrame *hw_frame; + AVFrame *frame; + enum AVPixelFormat hw_format; + bool got_first_keyframe; + bool frame_ready; + bool eof; + bool hw; + + AVPacket orig_pkt; + AVPacket pkt; + bool packet_pending; + struct circlebuf packets; }; extern bool mp_decode_init(struct mp_media *media, enum AVMediaType type, - bool hw); + bool hw); extern void mp_decode_free(struct mp_decode *decode); extern void mp_decode_clear_packets(struct mp_decode *decode);
View file
obs-studio-23.2.1.tar.xz/deps/media-playback/media-playback/media.c -> obs-studio-24.0.0.tar.xz/deps/media-playback/media-playback/media.c
Changed
@@ -30,15 +30,30 @@ static inline enum video_format convert_pixel_format(int f) { switch (f) { - case AV_PIX_FMT_NONE: return VIDEO_FORMAT_NONE; - case AV_PIX_FMT_YUV420P: return VIDEO_FORMAT_I420; - case AV_PIX_FMT_NV12: return VIDEO_FORMAT_NV12; - case AV_PIX_FMT_YUYV422: return VIDEO_FORMAT_YUY2; - case AV_PIX_FMT_YUV444P: return VIDEO_FORMAT_I444; - case AV_PIX_FMT_UYVY422: return VIDEO_FORMAT_UYVY; - case AV_PIX_FMT_RGBA: return VIDEO_FORMAT_RGBA; - case AV_PIX_FMT_BGRA: return VIDEO_FORMAT_BGRA; - case AV_PIX_FMT_BGR0: return VIDEO_FORMAT_BGRX; + case AV_PIX_FMT_NONE: + return VIDEO_FORMAT_NONE; + case AV_PIX_FMT_YUV420P: + return VIDEO_FORMAT_I420; + case AV_PIX_FMT_NV12: + return VIDEO_FORMAT_NV12; + case AV_PIX_FMT_YUYV422: + return VIDEO_FORMAT_YUY2; + case AV_PIX_FMT_YUV444P: + return VIDEO_FORMAT_I444; + case AV_PIX_FMT_UYVY422: + return VIDEO_FORMAT_UYVY; + case AV_PIX_FMT_RGBA: + return VIDEO_FORMAT_RGBA; + case AV_PIX_FMT_BGRA: + return VIDEO_FORMAT_BGRA; + case AV_PIX_FMT_BGR0: + return VIDEO_FORMAT_BGRX; + case AV_PIX_FMT_YUVA420P: + return VIDEO_FORMAT_I40A; + case AV_PIX_FMT_YUVA422P: + return VIDEO_FORMAT_I42A; + case AV_PIX_FMT_YUVA444P: + return VIDEO_FORMAT_YUVA; default:; } @@ -48,14 +63,22 @@ static inline enum audio_format convert_sample_format(int f) { switch (f) { - case AV_SAMPLE_FMT_U8: return AUDIO_FORMAT_U8BIT; - case AV_SAMPLE_FMT_S16: return AUDIO_FORMAT_16BIT; - case AV_SAMPLE_FMT_S32: return AUDIO_FORMAT_32BIT; - case AV_SAMPLE_FMT_FLT: return AUDIO_FORMAT_FLOAT; - case AV_SAMPLE_FMT_U8P: return AUDIO_FORMAT_U8BIT_PLANAR; - case AV_SAMPLE_FMT_S16P: return AUDIO_FORMAT_16BIT_PLANAR; - case AV_SAMPLE_FMT_S32P: return AUDIO_FORMAT_32BIT_PLANAR; - case AV_SAMPLE_FMT_FLTP: return AUDIO_FORMAT_FLOAT_PLANAR; + case AV_SAMPLE_FMT_U8: + return AUDIO_FORMAT_U8BIT; + case AV_SAMPLE_FMT_S16: + return AUDIO_FORMAT_16BIT; + case AV_SAMPLE_FMT_S32: + return AUDIO_FORMAT_32BIT; + case AV_SAMPLE_FMT_FLT: + return AUDIO_FORMAT_FLOAT; + case AV_SAMPLE_FMT_U8P: + return AUDIO_FORMAT_U8BIT_PLANAR; + case AV_SAMPLE_FMT_S16P: + return AUDIO_FORMAT_16BIT_PLANAR; + case AV_SAMPLE_FMT_S32P: + return AUDIO_FORMAT_32BIT_PLANAR; + case AV_SAMPLE_FMT_FLTP: + return AUDIO_FORMAT_FLOAT_PLANAR; default:; } @@ -65,15 +88,24 @@ static inline enum speaker_layout convert_speaker_layout(uint8_t channels) { switch (channels) { - case 0: return SPEAKERS_UNKNOWN; - case 1: return SPEAKERS_MONO; - case 2: return SPEAKERS_STEREO; - case 3: return SPEAKERS_2POINT1; - case 4: return SPEAKERS_4POINT0; - case 5: return SPEAKERS_4POINT1; - case 6: return SPEAKERS_5POINT1; - case 8: return SPEAKERS_7POINT1; - default: return SPEAKERS_UNKNOWN; + case 0: + return SPEAKERS_UNKNOWN; + case 1: + return SPEAKERS_MONO; + case 2: + return SPEAKERS_STEREO; + case 3: + return SPEAKERS_2POINT1; + case 4: + return SPEAKERS_4POINT0; + case 5: + return SPEAKERS_4POINT1; + case 6: + return SPEAKERS_5POINT1; + case 8: + return SPEAKERS_7POINT1; + default: + return SPEAKERS_UNKNOWN; } } @@ -88,7 +120,7 @@ } static inline struct mp_decode *get_packet_decoder(mp_media_t *media, - AVPacket *pkt) + AVPacket *pkt) { if (media->has_audio && pkt->stream_index == media->a.stream->index) return &media->a; @@ -109,7 +141,7 @@ if (ret < 0) { if (ret != AVERROR_EOF) blog(LOG_WARNING, "MP: av_read_frame failed: %s (%d)", - av_err2str(ret), ret); + av_err2str(ret), ret); return ret; } @@ -160,7 +192,7 @@ return r == AVCOL_RANGE_JPEG ? 1 : 0; } -#define FIXED_1_0 (1<<16) +#define FIXED_1_0 (1 << 16) static bool mp_media_init_scaling(mp_media_t *m) { @@ -168,23 +200,23 @@ int range = get_sws_range(m->v.decoder->color_range); const int *coeff = sws_getCoefficients(space); - m->swscale = sws_getCachedContext(NULL, - m->v.decoder->width, m->v.decoder->height, - m->v.decoder->pix_fmt, - m->v.decoder->width, m->v.decoder->height, - m->scale_format, - SWS_FAST_BILINEAR, NULL, NULL, NULL); + m->swscale = sws_getCachedContext(NULL, m->v.decoder->width, + m->v.decoder->height, + m->v.decoder->pix_fmt, + m->v.decoder->width, + m->v.decoder->height, m->scale_format, + SWS_FAST_BILINEAR, NULL, NULL, NULL); if (!m->swscale) { blog(LOG_WARNING, "MP: Failed to initialize scaler"); return false; } sws_setColorspaceDetails(m->swscale, coeff, range, coeff, range, 0, - FIXED_1_0, FIXED_1_0); + FIXED_1_0, FIXED_1_0); int ret = av_image_alloc(m->scale_pic, m->scale_linesizes, - m->v.decoder->width, m->v.decoder->height, - m->scale_format, 1); + m->v.decoder->width, m->v.decoder->height, + m->scale_format, 1); if (ret < 0) { blog(LOG_WARNING, "MP: Failed to create scale pic data"); return false; @@ -250,8 +282,7 @@ return base_ts; } -static inline bool mp_media_can_play_frame(mp_media_t *m, - struct mp_decode *d) +static inline bool mp_media_can_play_frame(mp_media_t *m, struct mp_decode *d) { return d->frame_ready && d->frame_pts <= m->next_pts_ns; } @@ -277,7 +308,7 @@ audio.format = convert_sample_format(f->format); audio.frames = f->nb_samples; audio.timestamp = m->base_ts + d->frame_pts - m->start_ts + - m->play_sys_ts - base_sys_ts; + m->play_sys_ts - base_sys_ts; if (audio.format == AUDIO_FORMAT_UNKNOWN) return; @@ -308,10 +339,9 @@ bool flip = false; if (m->swscale) { - int ret = sws_scale(m->swscale, - (const uint8_t *const *)f->data, f->linesize, - 0, f->height, - m->scale_pic, m->scale_linesizes); + int ret = sws_scale(m->swscale, (const uint8_t *const *)f->data, + f->linesize, 0, f->height, m->scale_pic, + m->scale_linesizes); if (ret < 0) return; @@ -334,25 +364,22 @@ frame->data[0] -= frame->linesize[0] * (f->height - 1); new_format = convert_pixel_format(m->scale_format); - new_space = convert_color_space(f->colorspace); - new_range = m->force_range == VIDEO_RANGE_DEFAULT - ? convert_color_range(f->color_range) - : m->force_range; - - if (new_format != frame->format || - new_space != m->cur_space || - new_range != m->cur_range) { + new_space = convert_color_space(f->colorspace); + new_range = m->force_range == VIDEO_RANGE_DEFAULT + ? convert_color_range(f->color_range) + : m->force_range; + + if (new_format != frame->format || new_space != m->cur_space || + new_range != m->cur_range) { bool success; frame->format = new_format; frame->full_range = new_range == VIDEO_RANGE_FULL; - success = video_format_get_parameters( - new_space, - new_range, - frame->color_matrix, - frame->color_range_min, - frame->color_range_max); + success = video_format_get_parameters(new_space, new_range, + frame->color_matrix, + frame->color_range_min, + frame->color_range_max); frame->format = new_format; m->cur_space = new_space; @@ -368,7 +395,7 @@ return; frame->timestamp = m->base_ts + d->frame_pts - m->start_ts + - m->play_sys_ts - base_sys_ts; + m->play_sys_ts - base_sys_ts; frame->width = f->width; frame->height = f->height; frame->flip = flip; @@ -420,14 +447,15 @@ } int64_t seek_target = seek_flags == AVSEEK_FLAG_BACKWARD - ? av_rescale_q(seek_pos, AV_TIME_BASE_Q, stream->time_base) - : seek_pos; + ? av_rescale_q(seek_pos, AV_TIME_BASE_Q, + stream->time_base) + : seek_pos; if (m->is_local_file) { int ret = av_seek_frame(m->fmt, 0, seek_target, seek_flags); if (ret < 0) { blog(LOG_WARNING, "MP: Failed to seek: %s", - av_err2str(ret)); + av_err2str(ret)); } } @@ -538,8 +566,10 @@ if (m->format_name && *m->format_name) { format = av_find_input_format(m->format_name); if (!format) - blog(LOG_INFO, "MP: Unable to find input format for " - "'%s'", m->path); + blog(LOG_INFO, + "MP: Unable to find input format for " + "'%s'", + m->path); } AVDictionary *opts = NULL; @@ -551,7 +581,7 @@ m->fmt->interrupt_callback.opaque = m; int ret = avformat_open_input(&m->fmt, m->path, format, - opts ? &opts : NULL); + opts ? &opts : NULL); av_dict_free(&opts); if (ret < 0) { @@ -561,7 +591,7 @@ if (avformat_find_stream_info(m->fmt, NULL) < 0) { blog(LOG_WARNING, "MP: Failed to find stream info for '%s'", - m->path); + m->path); return false; } @@ -569,8 +599,10 @@ m->has_audio = mp_decode_init(m, AVMEDIA_TYPE_AUDIO, m->hw); if (!m->has_video && !m->has_audio) { - blog(LOG_WARNING, "MP: Could not initialize audio or video: " - "'%s'", m->path); + blog(LOG_WARNING, + "MP: Could not initialize audio or video: " + "'%s'", + m->path); return false; } @@ -653,7 +685,7 @@ } static inline bool mp_media_init_internal(mp_media_t *m, - const struct mp_media_info *info) + const struct mp_media_info *info) { if (pthread_mutex_init(&m->mutex, NULL) != 0) { blog(LOG_WARNING, "MP: Failed to init mutex"); @@ -696,9 +728,11 @@ static bool initialized = false; if (!initialized) { +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); - avdevice_register_all(); avcodec_register_all(); +#endif + avdevice_register_all(); avformat_network_init(); initialized = true; }
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-callback.h -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-callback.h
Changed
@@ -36,10 +36,8 @@ bool removed; }; -static inline void *add_script_callback( - struct script_callback **first, - obs_script_t *script, - size_t extra_size) +static inline void *add_script_callback(struct script_callback **first, + obs_script_t *script, size_t extra_size) { struct script_callback *cb = bzalloc(sizeof(*cb) + extra_size); cb->script = script; @@ -47,7 +45,8 @@ struct script_callback *next = *first; cb->next = next; cb->p_prev_next = first; - if (next) next->p_prev_next = &cb->next; + if (next) + next->p_prev_next = &cb->next; *first = cb; return cb; @@ -58,13 +57,15 @@ cb->removed = true; struct script_callback *next = cb->next; - if (next) next->p_prev_next = cb->p_prev_next; + if (next) + next->p_prev_next = cb->p_prev_next; *cb->p_prev_next = cb->next; pthread_mutex_lock(&detach_mutex); next = detached_callbacks; cb->next = next; - if (next) next->p_prev_next = &cb->next; + if (next) + next->p_prev_next = &cb->next; cb->p_prev_next = &detached_callbacks; detached_callbacks = cb; pthread_mutex_unlock(&detach_mutex); @@ -83,7 +84,8 @@ { pthread_mutex_lock(&detach_mutex); struct script_callback *next = cb->next; - if (next) next->p_prev_next = cb->p_prev_next; + if (next) + next->p_prev_next = cb->p_prev_next; *cb->p_prev_next = cb->next; pthread_mutex_unlock(&detach_mutex);
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-internal.h -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-internal.h
Changed
@@ -37,9 +37,10 @@ extern void defer_call_post(defer_call_cb call, void *cb); -extern void script_log(obs_script_t *script, int level, const char *format, ...); +extern void script_log(obs_script_t *script, int level, const char *format, + ...); extern void script_log_va(obs_script_t *script, int level, const char *format, - va_list args); + va_list args); #define script_error(script, format, ...) \ script_log(script, LOG_ERROR, format, ##__VA_ARGS__)
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-logging.c -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-logging.c
Changed
@@ -22,7 +22,7 @@ static void *param = NULL; void script_log_va(obs_script_t *script, int level, const char *format, - va_list args) + va_list args) { char msg[2048]; const char *lang = "(Unknown)"; @@ -30,13 +30,19 @@ if (script) { switch (script->type) { - case OBS_SCRIPT_LANG_UNKNOWN: lang = "(Unknown language)"; break; - case OBS_SCRIPT_LANG_LUA: lang = "Lua"; break; - case OBS_SCRIPT_LANG_PYTHON: lang = "Python"; break; + case OBS_SCRIPT_LANG_UNKNOWN: + lang = "(Unknown language)"; + break; + case OBS_SCRIPT_LANG_LUA: + lang = "Lua"; + break; + case OBS_SCRIPT_LANG_PYTHON: + lang = "Python"; + break; } - start_len = snprintf(msg, sizeof(msg), "[%s: %s] ", - lang, script->file.array); + start_len = snprintf(msg, sizeof(msg), "[%s: %s] ", lang, + script->file.array); } else { start_len = snprintf(msg, sizeof(msg), "[Unknown Script] "); } @@ -57,7 +63,7 @@ } void obs_scripting_set_log_callback(scripting_log_handler_t handler, - void *log_param) + void *log_param) { callback = handler; param = log_param;
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-lua-frontend.c -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-lua-frontend.c
Changed
@@ -20,12 +20,12 @@ #include "obs-scripting-lua.h" -#define ls_get_libobs_obj(type, lua_index, obs_obj) \ - ls_get_libobs_obj_(script, #type " *", lua_index, obs_obj, \ - NULL, __FUNCTION__, __LINE__) -#define ls_push_libobs_obj(type, obs_obj, ownership) \ - ls_push_libobs_obj_(script, #type " *", obs_obj, ownership, \ - NULL, __FUNCTION__, __LINE__) +#define ls_get_libobs_obj(type, lua_index, obs_obj) \ + ls_get_libobs_obj_(script, #type " *", lua_index, obs_obj, NULL, \ + __FUNCTION__, __LINE__) +#define ls_push_libobs_obj(type, obs_obj, ownership) \ + ls_push_libobs_obj_(script, #type " *", obs_obj, ownership, NULL, \ + __FUNCTION__, __LINE__) #define call_func(func, args, rets) \ call_func_(script, cb->reg_idx, args, rets, #func, "frontend API") @@ -191,7 +191,7 @@ lua_State *script = cb->script; if (cb->base.removed) { - obs_frontend_remove_event_callback(frontend_event_callback, cb); + obs_frontend_remove_event_callback(frontend_event_callback, cb); return; } @@ -233,7 +233,7 @@ /* ----------------------------------- */ static void frontend_save_callback(obs_data_t *save_data, bool saving, - void *priv) + void *priv) { struct lua_obs_callback *cb = priv; lua_State *script = cb->script; @@ -285,11 +285,11 @@ { lua_getglobal(script, "obslua"); -#define add_func(name) \ - do { \ +#define add_func(name) \ + do { \ lua_pushstring(script, "obs_frontend_" #name); \ - lua_pushcfunction(script, name); \ - lua_rawset(script, -3); \ + lua_pushcfunction(script, name); \ + lua_rawset(script, -3); \ } while (false) add_func(get_scene_names);
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-lua-source.c -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-lua-source.c
Changed
@@ -23,7 +23,7 @@ /* ========================================================================= */ static inline const char *get_table_string_(lua_State *script, int idx, - const char *name, const char *func) + const char *name, const char *func) { const char *str = ""; @@ -38,8 +38,8 @@ return str; } -static inline int get_table_int_(lua_State *script, int idx, - const char *name, const char *func) +static inline int get_table_int_(lua_State *script, int idx, const char *name, + const char *func) { int val = 0; @@ -54,7 +54,8 @@ } static inline void get_callback_from_table_(lua_State *script, int idx, - const char *name, int *p_reg_idx, const char *func) + const char *name, int *p_reg_idx, + const char *func) { *p_reg_idx = LUA_REFNIL; @@ -77,22 +78,14 @@ #define get_callback_from_table(script, idx, name, p_reg_idx) \ get_callback_from_table_(script, idx, name, p_reg_idx, __FUNCTION__) -bool ls_get_libobs_obj_(lua_State * script, - const char *type, - int lua_idx, - void * libobs_out, - const char *id, - const char *func, - int line) +bool ls_get_libobs_obj_(lua_State *script, const char *type, int lua_idx, + void *libobs_out, const char *id, const char *func, + int line) { swig_type_info *info = SWIG_TypeQuery(script, type); if (info == NULL) { - warn("%s:%d: SWIG could not find type: %s%s%s", - func, - line, - id ? id : "", - id ? "::" : "", - type); + warn("%s:%d: SWIG could not find type: %s%s%s", func, line, + id ? id : "", id ? "::" : "", type); return false; } @@ -100,37 +93,25 @@ if (!SWIG_IsOK(ret)) { warn("%s:%d: SWIG failed to convert lua object to obs " "object: %s%s%s", - func, - line, - id ? id : "", - id ? "::" : "", - type); + func, line, id ? id : "", id ? "::" : "", type); return false; } return true; } -#define ls_get_libobs_obj(type, lua_index, obs_obj) \ - ls_get_libobs_obj_(ls->script, #type " *", lua_index, obs_obj, \ - ls->id, __FUNCTION__, __LINE__) - -bool ls_push_libobs_obj_(lua_State * script, - const char *type, - void * libobs_in, - bool ownership, - const char *id, - const char *func, - int line) +#define ls_get_libobs_obj(type, lua_index, obs_obj) \ + ls_get_libobs_obj_(ls->script, #type " *", lua_index, obs_obj, ls->id, \ + __FUNCTION__, __LINE__) + +bool ls_push_libobs_obj_(lua_State *script, const char *type, void *libobs_in, + bool ownership, const char *id, const char *func, + int line) { swig_type_info *info = SWIG_TypeQuery(script, type); if (info == NULL) { - warn("%s:%d: SWIG could not find type: %s%s%s", - func, - line, - id ? id : "", - id ? "::" : "", - type); + warn("%s:%d: SWIG could not find type: %s%s%s", func, line, + id ? id : "", id ? "::" : "", type); return false; } @@ -138,9 +119,9 @@ return true; } -#define ls_push_libobs_obj(type, obs_obj, ownership) \ +#define ls_push_libobs_obj(type, obs_obj, ownership) \ ls_push_libobs_obj_(ls->script, #type " *", obs_obj, ownership, \ - ls->id, __FUNCTION__, __LINE__) + ls->id, __FUNCTION__, __LINE__) /* ========================================================================= */ @@ -149,24 +130,24 @@ struct obs_lua_source { struct obs_lua_script *data; - lua_State * script; + lua_State *script; const char *id; const char *display_name; - int func_create; - int func_destroy; - int func_get_width; - int func_get_height; - int func_get_defaults; - int func_get_properties; - int func_update; - int func_activate; - int func_deactivate; - int func_show; - int func_hide; - int func_video_tick; - int func_video_render; - int func_save; - int func_load; + int func_create; + int func_destroy; + int func_get_width; + int func_get_height; + int func_get_defaults; + int func_get_properties; + int func_update; + int func_activate; + int func_deactivate; + int func_show; + int func_hide; + int func_video_tick; + int func_video_render; + int func_save; + int func_load; pthread_mutex_t definition_mutex; struct obs_lua_data *first_source; @@ -179,29 +160,27 @@ struct obs_lua_source *first_source_def = NULL; struct obs_lua_data { - obs_source_t * source; + obs_source_t *source; struct obs_lua_source *ls; - int lua_data_ref; + int lua_data_ref; struct obs_lua_data *next; struct obs_lua_data **p_prev_next; }; -#define call_func(name, args, rets) \ - call_func_(ls->script, ls->func_ ## name, args, rets, #name, \ - ls->display_name) -#define have_func(name) \ - (ls->func_ ## name != LUA_REFNIL) +#define call_func(name, args, rets) \ + call_func_(ls->script, ls->func_##name, args, rets, #name, \ + ls->display_name) +#define have_func(name) (ls->func_##name != LUA_REFNIL) #define ls_push_data() \ lua_rawgeti(ls->script, LUA_REGISTRYINDEX, ld->lua_data_ref) -#define ls_pop(count) \ - lua_pop(ls->script, count) -#define lock_script() \ - struct obs_lua_script *__data = ls->data; \ +#define ls_pop(count) lua_pop(ls->script, count) +#define lock_script() \ + struct obs_lua_script *__data = ls->data; \ struct obs_lua_script *__prev_script = current_lua_script; \ - current_lua_script = __data; \ + current_lua_script = __data; \ pthread_mutex_lock(&__data->mutex); -#define unlock_script() \ +#define unlock_script() \ pthread_mutex_unlock(&__data->mutex); \ current_lua_script = __prev_script; @@ -230,9 +209,9 @@ int lua_data_ref = luaL_ref(ls->script, LUA_REGISTRYINDEX); if (lua_data_ref != LUA_REFNIL) { - data = bmalloc(sizeof(*data)); - data->source = source; - data->ls = ls; + data = bmalloc(sizeof(*data)); + data->source = source; + data->ls = ls; data->lua_data_ref = lua_data_ref; } @@ -242,7 +221,8 @@ struct obs_lua_data *next = ls->first_source; data->next = next; data->p_prev_next = &ls->first_source; - if (next) next->p_prev_next = &data->next; + if (next) + next->p_prev_next = &data->next; ls->first_source = data; } @@ -263,9 +243,9 @@ static void obs_lua_source_destroy(void *data) { - struct obs_lua_data * ld = data; + struct obs_lua_data *ld = data; struct obs_lua_source *ls = ld->ls; - struct obs_lua_data * next; + struct obs_lua_data *next; pthread_mutex_lock(&ls->definition_mutex); if (!ls->script) @@ -280,7 +260,8 @@ fail: next = ld->next; *ld->p_prev_next = next; - if (next) next->p_prev_next = ld->p_prev_next; + if (next) + next->p_prev_next = ld->p_prev_next; bfree(data); pthread_mutex_unlock(&ls->definition_mutex); @@ -288,9 +269,9 @@ static uint32_t obs_lua_source_get_width(void *data) { - struct obs_lua_data * ld = data; - struct obs_lua_source *ls = ld->ls; - uint32_t width = 0; + struct obs_lua_data *ld = data; + struct obs_lua_source *ls = ld->ls; + uint32_t width = 0; pthread_mutex_lock(&ls->definition_mutex); if (!ls->script) @@ -315,9 +296,9 @@ static uint32_t obs_lua_source_get_height(void *data) { - struct obs_lua_data * ld = data; - struct obs_lua_source *ls = ld->ls; - uint32_t height = 0; + struct obs_lua_data *ld = data; + struct obs_lua_source *ls = ld->ls; + uint32_t height = 0; pthread_mutex_lock(&ls->definition_mutex); if (!ls->script) @@ -363,9 +344,9 @@ static obs_properties_t *obs_lua_source_get_properties(void *data) { - struct obs_lua_data * ld = data; - struct obs_lua_source *ls = ld->ls; - obs_properties_t * props = NULL; + struct obs_lua_data *ld = data; + struct obs_lua_source *ls = ld->ls; + obs_properties_t *props = NULL; pthread_mutex_lock(&ls->definition_mutex); if (!ls->script) @@ -390,7 +371,7 @@ static void obs_lua_source_update(void *data, obs_data_t *settings) { - struct obs_lua_data * ld = data; + struct obs_lua_data *ld = data; struct obs_lua_source *ls = ld->ls; pthread_mutex_lock(&ls->definition_mutex); @@ -411,17 +392,17 @@ pthread_mutex_unlock(&ls->definition_mutex); } -#define DEFINE_VOID_DATA_CALLBACK(name) \ - static void obs_lua_source_ ## name(void *data) \ - { \ - struct obs_lua_data * ld = data; \ - struct obs_lua_source *ls = ld->ls; \ - if (!have_func(name)) \ - return; \ - lock_script(); \ - ls_push_data(); \ - call_func(name, 1, 0); \ - unlock_script(); \ +#define DEFINE_VOID_DATA_CALLBACK(name) \ + static void obs_lua_source_##name(void *data) \ + { \ + struct obs_lua_data *ld = data; \ + struct obs_lua_source *ls = ld->ls; \ + if (!have_func(name)) \ + return; \ + lock_script(); \ + ls_push_data(); \ + call_func(name, 1, 0); \ + unlock_script(); \ } DEFINE_VOID_DATA_CALLBACK(activate) DEFINE_VOID_DATA_CALLBACK(deactivate) @@ -431,7 +412,7 @@ static void obs_lua_source_video_tick(void *data, float seconds) { - struct obs_lua_data * ld = data; + struct obs_lua_data *ld = data; struct obs_lua_source *ls = ld->ls; pthread_mutex_lock(&ls->definition_mutex); @@ -454,7 +435,7 @@ static void obs_lua_source_video_render(void *data, gs_effect_t *effect) { - struct obs_lua_data * ld = data; + struct obs_lua_data *ld = data; struct obs_lua_source *ls = ld->ls; pthread_mutex_lock(&ls->definition_mutex); @@ -477,7 +458,7 @@ static void obs_lua_source_save(void *data, obs_data_t *settings) { - struct obs_lua_data * ld = data; + struct obs_lua_data *ld = data; struct obs_lua_source *ls = ld->ls; pthread_mutex_lock(&ls->definition_mutex); @@ -500,7 +481,7 @@ static void obs_lua_source_load(void *data, obs_data_t *settings) { - struct obs_lua_data * ld = data; + struct obs_lua_data *ld = data; struct obs_lua_source *ls = ld->ls; pthread_mutex_lock(&ls->definition_mutex); @@ -523,7 +504,7 @@ static void source_type_unload(struct obs_lua_source *ls) { -#define unref(name) \ +#define unref(name) \ luaL_unref(ls->script, LUA_REGISTRYINDEX, name); \ name = LUA_REFNIL @@ -614,9 +595,9 @@ v = existing ? existing : &ls; v->script = script; - v->id = id; + v->id = id; - info.id = v->id; + info.id = v->id; info.type = (enum obs_source_type)get_table_int(script, -1, "type"); info.output_flags = get_table_int(script, -1, "output_flags"); @@ -628,16 +609,14 @@ lua_pop(script, 1); } - if (!v->display_name || - !*v->display_name || - !*info.id || + if (!v->display_name || !*v->display_name || !*info.id || !info.output_flags) goto fail; -#define get_callback(val) \ - do { \ - get_callback_from_table(script, -1, #val, &v->func_ ## val); \ - info.val = obs_lua_source_ ## val; \ +#define get_callback(val) \ + do { \ + get_callback_from_table(script, -1, #val, &v->func_##val); \ + info.val = obs_lua_source_##val; \ } while (false) get_callback(create); @@ -657,16 +636,21 @@ #undef get_callback get_callback_from_table(script, -1, "get_defaults", - &v->func_get_defaults); + &v->func_get_defaults); if (!existing) { ls.data = current_lua_script; - pthread_mutex_init(&ls.definition_mutex, NULL); - info.type_data = bmemdup(&ls, sizeof(ls)); + pthread_mutexattr_t mutexattr; + pthread_mutexattr_init(&mutexattr); + pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&ls.definition_mutex, &mutexattr); + pthread_mutexattr_destroy(&mutexattr); + + info.type_data = bmemdup(&ls, sizeof(ls)); info.free_type_data = obs_lua_source_free_type_data; - info.get_name = obs_lua_source_get_name; - info.get_defaults2 = obs_lua_source_get_defaults; + info.get_name = obs_lua_source_get_name; + info.get_defaults2 = obs_lua_source_get_defaults; obs_register_source(&info); pthread_mutex_lock(&lua_source_def_mutex); @@ -674,7 +658,8 @@ struct obs_lua_source *next = first_source_def; v->next = next; - if (next) next->p_prev_next = &v->next; + if (next) + next->p_prev_next = &v->next; v->p_prev_next = &first_source_def; first_source_def = v; @@ -690,15 +675,15 @@ if (have_func(create)) { obs_source_t *source = ld->source; - obs_data_t *settings = obs_source_get_settings( - source); + obs_data_t *settings = + obs_source_get_settings(source); ls_push_libobs_obj(obs_data_t, settings, false); ls_push_libobs_obj(obs_source_t, source, false); call_func(create, 2, 1); - ld->lua_data_ref = luaL_ref(ls->script, - LUA_REGISTRYINDEX); + ld->lua_data_ref = + luaL_ref(ls->script, LUA_REGISTRYINDEX); obs_data_release(settings); } @@ -727,7 +712,7 @@ } static inline void undef_source_type(struct obs_lua_script *data, - struct obs_lua_source *ls) + struct obs_lua_source *ls) { pthread_mutex_lock(&ls->definition_mutex); pthread_mutex_lock(&data->mutex);
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-lua.c -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-lua.c
Changed
@@ -26,17 +26,17 @@ /* ========================================================================= */ #if ARCH_BITS == 64 -# define ARCH_DIR "64bit" +#define ARCH_DIR "64bit" #else -# define ARCH_DIR "32bit" +#define ARCH_DIR "32bit" #endif #ifdef __APPLE__ -# define SO_EXT "dylib" +#define SO_EXT "dylib" #elif _WIN32 -# define SO_EXT "dll" +#define SO_EXT "dll" #else -# define SO_EXT "so" +#define SO_EXT "so" #endif static const char *startup_script_template = "\ @@ -59,15 +59,14 @@ pthread_mutex_t lua_source_def_mutex = PTHREAD_MUTEX_INITIALIZER; -#define ls_get_libobs_obj(type, lua_index, obs_obj) \ - ls_get_libobs_obj_(script, #type " *", lua_index, obs_obj, \ - NULL, __FUNCTION__, __LINE__) -#define ls_push_libobs_obj(type, obs_obj, ownership) \ - ls_push_libobs_obj_(script, #type " *", obs_obj, ownership, \ - NULL, __FUNCTION__, __LINE__) +#define ls_get_libobs_obj(type, lua_index, obs_obj) \ + ls_get_libobs_obj_(script, #type " *", lua_index, obs_obj, NULL, \ + __FUNCTION__, __LINE__) +#define ls_push_libobs_obj(type, obs_obj, ownership) \ + ls_push_libobs_obj_(script, #type " *", obs_obj, ownership, NULL, \ + __FUNCTION__, __LINE__) #define call_func(name, args, rets) \ - call_func_(script, cb->reg_idx, \ - args, rets, #name, __FUNCTION__) + call_func_(script, cb->reg_idx, args, rets, #name, __FUNCTION__) /* ========================================================================= */ @@ -98,7 +97,7 @@ if (luaL_dostring(script, startup_script) != 0) { script_warn(&data->base, "Error executing startup script 1: %s", - lua_tostring(script, -1)); + lua_tostring(script, -1)); goto fail; } @@ -108,7 +107,7 @@ if (ret != 0) { script_warn(&data->base, "Error executing startup script 2: %s", - lua_tostring(script, -1)); + lua_tostring(script, -1)); goto fail; } @@ -122,13 +121,13 @@ if (luaL_loadfile(script, data->base.path.array) != 0) { script_warn(&data->base, "Error loading file: %s", - lua_tostring(script, -1)); + lua_tostring(script, -1)); goto fail; } if (lua_pcall(script, 0, LUA_MULTRET, 0) != 0) { script_warn(&data->base, "Error running file: %s", - lua_tostring(script, -1)); + lua_tostring(script, -1)); goto fail; } @@ -148,7 +147,8 @@ struct obs_lua_script *next = first_tick_script; data->next_tick = next; data->p_prev_next_tick = &first_tick_script; - if (next) next->p_prev_next_tick = &data->next_tick; + if (next) + next->p_prev_next_tick = &data->next_tick; first_tick_script = data; data->tick = luaL_ref(script, LUA_REGISTRYINDEX); @@ -178,18 +178,20 @@ if (lua_isfunction(script, -1)) { ls_push_libobs_obj(obs_data_t, data->base.settings, false); if (lua_pcall(script, 1, 0, 0) != 0) { - script_warn(&data->base, "Error calling " - "script_defaults: %s", - lua_tostring(script, -1)); + script_warn(&data->base, + "Error calling " + "script_defaults: %s", + lua_tostring(script, -1)); } } lua_getglobal(script, "script_description"); if (lua_isfunction(script, -1)) { if (lua_pcall(script, 0, 1, 0) != 0) { - script_warn(&data->base, "Error calling " - "script_defaults: %s", - lua_tostring(script, -1)); + script_warn(&data->base, + "Error calling " + "script_defaults: %s", + lua_tostring(script, -1)); } else { const char *desc = lua_tostring(script, -1); dstr_copy(&data->base.desc, desc); @@ -200,9 +202,10 @@ if (lua_isfunction(script, -1)) { ls_push_libobs_obj(obs_data_t, data->base.settings, false); if (lua_pcall(script, 1, 0, 0) != 0) { - script_warn(&data->base, "Error calling " - "script_load: %s", - lua_tostring(script, -1)); + script_warn(&data->base, + "Error calling " + "script_load: %s", + lua_tostring(script, -1)); } } @@ -248,7 +251,8 @@ struct lua_obs_timer *next = first_timer; timer->next = next; timer->p_prev_next = &first_timer; - if (next) next->p_prev_next = &timer->next; + if (next) + next->p_prev_next = &timer->next; first_timer = timer; pthread_mutex_unlock(&timer_mutex); @@ -257,12 +261,13 @@ static inline void lua_obs_timer_remove(struct lua_obs_timer *timer) { struct lua_obs_timer *next = timer->next; - if (next) next->p_prev_next = timer->p_prev_next; + if (next) + next->p_prev_next = timer->p_prev_next; *timer->p_prev_next = timer->next; } -static inline struct lua_obs_callback *lua_obs_timer_cb( - struct lua_obs_timer *timer) +static inline struct lua_obs_callback * +lua_obs_timer_cb(struct lua_obs_timer *timer) { return &((struct lua_obs_callback *)timer)[-1]; } @@ -273,7 +278,8 @@ return 0; struct lua_obs_callback *cb = find_lua_obs_callback(script, 1); - if (cb) remove_lua_obs_callback(cb); + if (cb) + remove_lua_obs_callback(cb); return 0; } @@ -304,8 +310,8 @@ if (!ms) return 0; - struct lua_obs_callback *cb = add_lua_obs_callback_extra(script, 1, - sizeof(struct lua_obs_timer)); + struct lua_obs_callback *cb = add_lua_obs_callback_extra( + script, 1, sizeof(struct lua_obs_timer)); struct lua_obs_timer *timer = lua_obs_callback_extra_data(cb); timer->interval = (uint64_t)ms * 1000000ULL; @@ -324,7 +330,7 @@ if (cb->base.removed) { obs_remove_main_render_callback(obs_lua_main_render_callback, - cb); + cb); return; } @@ -343,7 +349,8 @@ return 0; struct lua_obs_callback *cb = find_lua_obs_callback(script, 1); - if (cb) remove_lua_obs_callback(cb); + if (cb) + remove_lua_obs_callback(cb); return 0; } @@ -388,7 +395,8 @@ return 0; struct lua_obs_callback *cb = find_lua_obs_callback(script, 1); - if (cb) remove_lua_obs_callback(cb); + if (cb) + remove_lua_obs_callback(cb); return 0; } @@ -447,15 +455,15 @@ const char *cb_signal = calldata_string(&cb->base.extra, "signal"); - if (cb_signal && - strcmp(signal, cb_signal) != 0 && + if (cb_signal && strcmp(signal, cb_signal) != 0 && handler == cb_handler) break; cb = find_next_lua_obs_callback(script, cb, 3); } - if (cb) remove_lua_obs_callback(cb); + if (cb) + remove_lua_obs_callback(cb); return 0; } @@ -465,7 +473,7 @@ signal_handler_t *handler = calldata_ptr(&cb->extra, "handler"); const char *signal = calldata_string(&cb->extra, "signal"); - signal_handler_connect(handler, signal, calldata_signal_callback, cb); + signal_handler_connect(handler, signal, calldata_signal_callback, cb); } static int obs_lua_signal_handler_connect(lua_State *script) @@ -491,7 +499,7 @@ /* -------------------------------------------- */ static void calldata_signal_callback_global(void *priv, const char *signal, - calldata_t *cd) + calldata_t *cd) { struct lua_obs_callback *cb = priv; lua_State *script = cb->script; @@ -530,7 +538,8 @@ cb = find_next_lua_obs_callback(script, cb, 3); } - if (cb) remove_lua_obs_callback(cb); + if (cb) + remove_lua_obs_callback(cb); return 0; } @@ -539,8 +548,8 @@ struct script_callback *cb = p_cb; signal_handler_t *handler = calldata_ptr(&cb->extra, "handler"); - signal_handler_connect_global(handler, - calldata_signal_callback_global, cb); + signal_handler_connect_global(handler, calldata_signal_callback_global, + cb); } static int obs_lua_signal_handler_connect_global(lua_State *script) @@ -581,8 +590,11 @@ /* -------------------------------------------- */ -static bool source_enum_filters_proc(obs_source_t *source, obs_source_t *filter, void *param) +static void source_enum_filters_proc(obs_source_t *source, obs_source_t *filter, + void *param) { + UNUSED_PARAMETER(source); + lua_State *script = param; obs_source_get_ref(filter); @@ -590,7 +602,6 @@ size_t idx = lua_rawlen(script, -2); lua_rawseti(script, -2, (int)idx + 1); - return true; } static int source_enum_filters(lua_State *script) @@ -604,11 +615,10 @@ return 1; } - /* -------------------------------------------- */ static bool enum_items_proc(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { lua_State *script = param; @@ -644,7 +654,7 @@ obs_hotkey_id id = (obs_hotkey_id)calldata_int(&cb->base.extra, "id"); if (id != OBS_INVALID_HOTKEY_ID) - defer_call_post(defer_hotkey_unregister, (void*)(uintptr_t)id); + defer_call_post(defer_hotkey_unregister, (void *)(uintptr_t)id); } static void hotkey_pressed(void *p_cb, bool pressed) @@ -673,8 +683,8 @@ hotkey_pressed(p_cb, false); } -static void hotkey_callback(void *p_cb, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) +static void hotkey_callback(void *p_cb, obs_hotkey_id id, obs_hotkey_t *hotkey, + bool pressed) { struct lua_obs_callback *cb = p_cb; @@ -696,7 +706,8 @@ return 0; struct lua_obs_callback *cb = find_lua_obs_callback(script, 1); - if (cb) remove_lua_obs_callback(cb); + if (cb) + remove_lua_obs_callback(cb); return 0; } @@ -727,7 +738,7 @@ /* -------------------------------------------- */ static bool button_prop_clicked(obs_properties_t *props, obs_property_t *p, - void *p_cb) + void *p_cb) { struct lua_obs_callback *cb = p_cb; lua_State *script = cb->script; @@ -773,7 +784,7 @@ struct lua_obs_callback *cb = add_lua_obs_callback(script, 4); p = obs_properties_add_button2(props, name, text, button_prop_clicked, - cb); + cb); if (!p || !ls_push_libobs_obj(obs_property_t, p, false)) return 0; @@ -783,7 +794,7 @@ /* -------------------------------------------- */ static bool modified_callback(void *p_cb, obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) + obs_property_t *p, obs_data_t *settings) { struct lua_obs_callback *cb = p_cb; lua_State *script = cb->script; @@ -976,11 +987,11 @@ static void add_hook_functions(lua_State *script) { -#define add_func(name, func) \ - do { \ - lua_pushstring(script, name); \ +#define add_func(name, func) \ + do { \ + lua_pushstring(script, name); \ lua_pushcfunction(script, func); \ - lua_rawset(script, -3); \ + lua_rawset(script, -3); \ } while (false) lua_getglobal(script, "_G"); @@ -1005,31 +1016,24 @@ add_func("calldata_source", calldata_source); add_func("calldata_sceneitem", calldata_sceneitem); add_func("obs_add_main_render_callback", - obs_lua_add_main_render_callback); + obs_lua_add_main_render_callback); add_func("obs_remove_main_render_callback", - obs_lua_remove_main_render_callback); - add_func("obs_add_tick_callback", - obs_lua_add_tick_callback); - add_func("obs_remove_tick_callback", - obs_lua_remove_tick_callback); - add_func("signal_handler_connect", - obs_lua_signal_handler_connect); + obs_lua_remove_main_render_callback); + add_func("obs_add_tick_callback", obs_lua_add_tick_callback); + add_func("obs_remove_tick_callback", obs_lua_remove_tick_callback); + add_func("signal_handler_connect", obs_lua_signal_handler_connect); add_func("signal_handler_disconnect", - obs_lua_signal_handler_disconnect); + obs_lua_signal_handler_disconnect); add_func("signal_handler_connect_global", - obs_lua_signal_handler_connect_global); + obs_lua_signal_handler_connect_global); add_func("signal_handler_disconnect_global", - obs_lua_signal_handler_disconnect_global); - add_func("obs_hotkey_unregister", - hotkey_unregister); - add_func("obs_hotkey_register_frontend", - hotkey_register_frontend); - add_func("obs_properties_add_button", - properties_add_button); + obs_lua_signal_handler_disconnect_global); + add_func("obs_hotkey_unregister", hotkey_unregister); + add_func("obs_hotkey_register_frontend", hotkey_register_frontend); + add_func("obs_properties_add_button", properties_add_button); add_func("obs_property_set_modified_callback", - property_set_modified_callback); - add_func("remove_current_callback", - remove_current_callback); + property_set_modified_callback); + add_func("remove_current_callback", remove_current_callback); lua_pop(script, 1); #undef add_func @@ -1166,7 +1170,8 @@ pthread_mutex_lock(&tick_mutex); struct obs_lua_script *next = data->next_tick; - if (next) next->p_prev_next_tick = data->p_prev_next_tick; + if (next) + next->p_prev_next_tick = data->p_prev_next_tick; *data->p_prev_next_tick = next; pthread_mutex_unlock(&tick_mutex); @@ -1258,7 +1263,7 @@ pthread_mutex_lock(&data->mutex); call_func_(script, data->get_properties, 0, 1, "script_properties", - __FUNCTION__); + __FUNCTION__); ls_get_libobs_obj(obs_properties_t, -1, &props); pthread_mutex_unlock(&data->mutex);
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-lua.h -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-lua.h
Changed
@@ -46,12 +46,11 @@ #include "obs-scripting-internal.h" #include "obs-scripting-callback.h" -#define do_log(level, format, ...) \ - blog(level, "[Lua] " format, ##__VA_ARGS__) +#define do_log(level, format, ...) blog(level, "[Lua] " format, ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) /* ------------------------------------------------------------ */ @@ -87,15 +86,15 @@ bool defined_sources; }; -#define lock_callback() \ - struct obs_lua_script *__last_script = current_lua_script; \ - struct lua_obs_callback *__last_callback = current_lua_cb; \ - current_lua_cb = cb; \ +#define lock_callback() \ + struct obs_lua_script *__last_script = current_lua_script; \ + struct lua_obs_callback *__last_callback = current_lua_cb; \ + current_lua_cb = cb; \ current_lua_script = (struct obs_lua_script *)cb->base.script; \ pthread_mutex_lock(¤t_lua_script->mutex); -#define unlock_callback() \ +#define unlock_callback() \ pthread_mutex_unlock(¤t_lua_script->mutex); \ - current_lua_script = __last_script; \ + current_lua_script = __last_script; \ current_lua_cb = __last_callback; /* ------------------------------------------------ */ @@ -107,16 +106,13 @@ int reg_idx; }; -static inline struct lua_obs_callback *add_lua_obs_callback_extra( - lua_State *script, - int stack_idx, - size_t extra_size) +static inline struct lua_obs_callback * +add_lua_obs_callback_extra(lua_State *script, int stack_idx, size_t extra_size) { struct obs_lua_script *data = current_lua_script; - struct lua_obs_callback *cb = add_script_callback( - &data->first_callback, - (obs_script_t *)data, - sizeof(*cb) + extra_size); + struct lua_obs_callback *cb = + add_script_callback(&data->first_callback, (obs_script_t *)data, + sizeof(*cb) + extra_size); lua_pushvalue(script, stack_idx); cb->reg_idx = luaL_ref(script, LUA_REGISTRYINDEX); @@ -124,25 +120,26 @@ return cb; } -static inline struct lua_obs_callback *add_lua_obs_callback( - lua_State *script, int stack_idx) +static inline struct lua_obs_callback *add_lua_obs_callback(lua_State *script, + int stack_idx) { return add_lua_obs_callback_extra(script, stack_idx, 0); } static inline void *lua_obs_callback_extra_data(struct lua_obs_callback *cb) { - return (void*)&cb[1]; + return (void *)&cb[1]; } -static inline struct obs_lua_script *lua_obs_callback_script( - struct lua_obs_callback *cb) +static inline struct obs_lua_script * +lua_obs_callback_script(struct lua_obs_callback *cb) { return (struct obs_lua_script *)cb->base.script; } -static inline struct lua_obs_callback *find_next_lua_obs_callback( - lua_State *script, struct lua_obs_callback *cb, int stack_idx) +static inline struct lua_obs_callback * +find_next_lua_obs_callback(lua_State *script, struct lua_obs_callback *cb, + int stack_idx) { struct obs_lua_script *data = current_lua_script; @@ -163,8 +160,8 @@ return cb; } -static inline struct lua_obs_callback *find_lua_obs_callback( - lua_State *script, int stack_idx) +static inline struct lua_obs_callback *find_lua_obs_callback(lua_State *script, + int stack_idx) { return find_next_lua_obs_callback(script, NULL, stack_idx); } @@ -204,9 +201,8 @@ typedef int (*param_cb)(lua_State *script, int idx); -static inline bool verify_args1_(lua_State *script, - param_cb param1_check, - const char *func) +static inline bool verify_args1_(lua_State *script, param_cb param1_check, + const char *func) { if (lua_gettop(script) != 1) { warn("Wrong number of parameters for %s", func); @@ -223,9 +219,9 @@ #define verify_args1(script, param1_check) \ verify_args1_(script, param1_check, __FUNCTION__) -static inline bool call_func_(lua_State *script, - int reg_idx, int args, int rets, - const char *func, const char *display_name) +static inline bool call_func_(lua_State *script, int reg_idx, int args, + int rets, const char *func, + const char *display_name) { if (reg_idx == LUA_REFNIL) return false; @@ -237,8 +233,7 @@ if (lua_pcall(script, args, rets, 0) != 0) { script_warn(&data->base, "Failed to call %s for %s: %s", func, - display_name, - lua_tostring(script, -1)); + display_name, lua_tostring(script, -1)); lua_pop(script, 1); return false; } @@ -246,19 +241,11 @@ return true; } -bool ls_get_libobs_obj_(lua_State * script, - const char *type, - int lua_idx, - void * libobs_out, - const char *id, - const char *func, - int line); -bool ls_push_libobs_obj_(lua_State * script, - const char *type, - void * libobs_in, - bool ownership, - const char *id, - const char *func, - int line); +bool ls_get_libobs_obj_(lua_State *script, const char *type, int lua_idx, + void *libobs_out, const char *id, const char *func, + int line); +bool ls_push_libobs_obj_(lua_State *script, const char *type, void *libobs_in, + bool ownership, const char *id, const char *func, + int line); extern void add_lua_source_functions(lua_State *script);
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-python-frontend.c -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-python-frontend.c
Changed
@@ -20,12 +20,11 @@ #include "obs-scripting-python.h" -#define libobs_to_py(type, obs_obj, ownership, py_obj) \ - libobs_to_py_(#type " *", obs_obj, ownership, py_obj, \ - NULL, __func__, __LINE__) +#define libobs_to_py(type, obs_obj, ownership, py_obj) \ + libobs_to_py_(#type " *", obs_obj, ownership, py_obj, NULL, __func__, \ + __LINE__) #define py_to_libobs(type, py_obj, libobs_out) \ - py_to_libobs_(#type " *", py_obj, libobs_out, \ - NULL, __func__, __LINE__) + py_to_libobs_(#type " *", py_obj, libobs_out, NULL, __func__, __LINE__) /* ----------------------------------- */ @@ -257,7 +256,7 @@ /* ----------------------------------- */ static void frontend_save_callback(obs_data_t *save_data, bool saving, - void *priv) + void *priv) { struct python_obs_callback *cb = priv; @@ -303,8 +302,10 @@ if (!py_cb || !PyFunction_Check(py_cb)) return python_none(); - struct python_obs_callback *cb = find_python_obs_callback(script, py_cb); - if (cb) remove_python_obs_callback(cb); + struct python_obs_callback *cb = + find_python_obs_callback(script, py_cb); + if (cb) + remove_python_obs_callback(cb); return python_none(); } @@ -354,8 +355,7 @@ DEF_FUNC(add_save_callback), #undef DEF_FUNC - {0} - }; + {0}}; add_functions_to_py_module(module, funcs); }
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-python-import.c -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-python-import.c
Changed
@@ -51,18 +51,18 @@ lib = os_dlopen(lib_path.array); if (!lib) { blog(LOG_WARNING, "[Python] Could not load library: %s", - lib_path.array); + lib_path.array); goto fail; } -#define IMPORT_FUNC(x) \ - do { \ - Import_##x = os_dlsym(lib, #x); \ - if (!Import_##x) { \ +#define IMPORT_FUNC(x) \ + do { \ + Import_##x = os_dlsym(lib, #x); \ + if (!Import_##x) { \ blog(LOG_WARNING, "[Python] Failed to import: %s", \ - #x); \ - goto fail; \ - } \ + #x); \ + goto fail; \ + } \ } while (false) IMPORT_FUNC(PyType_Ready);
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-python-import.h -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-python-import.h
Changed
@@ -32,11 +32,11 @@ #endif #if defined(_WIN32) && defined(_DEBUG) -# undef _DEBUG -# include <Python.h> -# define _DEBUG +#undef _DEBUG +#include <Python.h> +#define _DEBUG #else -# include <Python.h> +#include <Python.h> #endif #ifdef _MSC_VER @@ -64,14 +64,17 @@ PY_EXTERN PyObject *(*Import_PyBool_FromLong)(long); PY_EXTERN PyGILState_STATE (*Import_PyGILState_Ensure)(void); PY_EXTERN PyThreadState *(*Import_PyGILState_GetThisThreadState)(void); -PY_EXTERN void (*Import_PyErr_SetString)(PyObject *exception, const char *string); +PY_EXTERN void (*Import_PyErr_SetString)(PyObject *exception, + const char *string); PY_EXTERN PyObject *(*Import_PyErr_Occurred)(void); PY_EXTERN void (*Import_PyErr_Fetch)(PyObject **, PyObject **, PyObject **); PY_EXTERN void (*Import_PyErr_Restore)(PyObject *, PyObject *, PyObject *); PY_EXTERN void (*Import_PyErr_WriteUnraisable)(PyObject *); -PY_EXTERN int (*Import_PyArg_UnpackTuple)(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...); +PY_EXTERN int (*Import_PyArg_UnpackTuple)(PyObject *, const char *, Py_ssize_t, + Py_ssize_t, ...); PY_EXTERN PyObject *(*Import_Py_BuildValue)(const char *, ...); -PY_EXTERN int (*Import_PyRun_SimpleStringFlags)(const char *, PyCompilerFlags *); +PY_EXTERN int (*Import_PyRun_SimpleStringFlags)(const char *, + PyCompilerFlags *); PY_EXTERN void (*Import_PyErr_Print)(void); PY_EXTERN void (*Import_Py_SetPythonHome)(wchar_t *); PY_EXTERN void (*Import_Py_Initialize)(void); @@ -82,117 +85,127 @@ PY_EXTERN void (*Import_PyEval_ReleaseThread)(PyThreadState *tstate); PY_EXTERN void (*Import_PySys_SetArgv)(int, wchar_t **); PY_EXTERN PyObject *(*Import_PyImport_ImportModule)(const char *name); -PY_EXTERN PyObject *(*Import_PyObject_CallFunctionObjArgs)(PyObject *callable, ...); -PY_EXTERN PyObject (*Import__Py_NotImplementedStruct); +PY_EXTERN PyObject *(*Import_PyObject_CallFunctionObjArgs)(PyObject *callable, + ...); +PY_EXTERN PyObject(*Import__Py_NotImplementedStruct); PY_EXTERN PyObject *(*Import_PyExc_TypeError); PY_EXTERN PyObject *(*Import_PyExc_RuntimeError); PY_EXTERN PyObject *(*Import_PyObject_GetAttr)(PyObject *, PyObject *); PY_EXTERN PyObject *(*Import_PyUnicode_FromString)(const char *u); -PY_EXTERN PyObject *(*Import_PyDict_GetItemString)(PyObject *dp, const char *key); -PY_EXTERN int (*Import_PyDict_SetItemString)(PyObject *dp, const char *key, PyObject *item); -PY_EXTERN PyObject *(*Import_PyCFunction_NewEx)(PyMethodDef *, PyObject *, PyObject *); +PY_EXTERN PyObject *(*Import_PyDict_GetItemString)(PyObject *dp, + const char *key); +PY_EXTERN int (*Import_PyDict_SetItemString)(PyObject *dp, const char *key, + PyObject *item); +PY_EXTERN PyObject *(*Import_PyCFunction_NewEx)(PyMethodDef *, PyObject *, + PyObject *); PY_EXTERN PyObject *(*Import_PyModule_GetDict)(PyObject *); PY_EXTERN PyObject *(*Import_PyModule_GetNameObject)(PyObject *); -PY_EXTERN int (*Import_PyModule_AddObject)(PyObject *, const char *, PyObject *); -PY_EXTERN int (*Import_PyModule_AddStringConstant)(PyObject *, const char *, const char *); +PY_EXTERN int (*Import_PyModule_AddObject)(PyObject *, const char *, + PyObject *); +PY_EXTERN int (*Import_PyModule_AddStringConstant)(PyObject *, const char *, + const char *); PY_EXTERN PyObject *(*Import_PyImport_Import)(PyObject *name); -PY_EXTERN PyObject *(*Import_PyObject_CallObject)(PyObject *callable_object, PyObject *args); -PY_EXTERN struct _longobject (*Import__Py_FalseStruct); -PY_EXTERN struct _longobject (*Import__Py_TrueStruct); +PY_EXTERN PyObject *(*Import_PyObject_CallObject)(PyObject *callable_object, + PyObject *args); +PY_EXTERN struct _longobject(*Import__Py_FalseStruct); +PY_EXTERN struct _longobject(*Import__Py_TrueStruct); PY_EXTERN void (*Import_PyGILState_Release)(PyGILState_STATE); PY_EXTERN int (*Import_PyList_Append)(PyObject *, PyObject *); PY_EXTERN PyObject *(*Import_PySys_GetObject)(const char *); PY_EXTERN PyObject *(*Import_PyImport_ReloadModule)(PyObject *m); PY_EXTERN PyObject *(*Import_PyObject_GetAttrString)(PyObject *, const char *); -PY_EXTERN PyObject *(*Import_PyCapsule_New)(void *pointer, const char *name, PyCapsule_Destructor destructor); -PY_EXTERN void *(*Import_PyCapsule_GetPointer)(PyObject *capsule, const char *name); +PY_EXTERN PyObject *(*Import_PyCapsule_New)(void *pointer, const char *name, + PyCapsule_Destructor destructor); +PY_EXTERN void *(*Import_PyCapsule_GetPointer)(PyObject *capsule, + const char *name); PY_EXTERN int (*Import_PyArg_ParseTuple)(PyObject *, const char *, ...); -PY_EXTERN PyTypeObject (*Import_PyFunction_Type); +PY_EXTERN PyTypeObject(*Import_PyFunction_Type); PY_EXTERN int (*Import_PyObject_SetAttr)(PyObject *, PyObject *, PyObject *); PY_EXTERN PyObject *(*Import__PyObject_New)(PyTypeObject *); -PY_EXTERN void *(*Import_PyCapsule_Import)(const char *name, int no_block); +PY_EXTERN void *(*Import_PyCapsule_Import)(const char *name, int no_block); PY_EXTERN void (*Import_PyErr_Clear)(void); -PY_EXTERN PyObject *(*Import_PyObject_Call)(PyObject *callable_object, PyObject *args, PyObject *kwargs); +PY_EXTERN PyObject *(*Import_PyObject_Call)(PyObject *callable_object, + PyObject *args, PyObject *kwargs); PY_EXTERN PyObject *(*Import_PyList_New)(Py_ssize_t size); PY_EXTERN Py_ssize_t (*Import_PyList_Size)(PyObject *); PY_EXTERN PyObject *(*Import_PyList_GetItem)(PyObject *, Py_ssize_t); PY_EXTERN PyObject *(*Import_PyUnicode_AsUTF8String)(PyObject *unicode); PY_EXTERN PyObject *(*Import_PyLong_FromUnsignedLongLong)(unsigned long long); PY_EXTERN int (*Import_PyArg_VaParse)(PyObject *, const char *, va_list); -PY_EXTERN PyObject (*Import__Py_NoneStruct); +PY_EXTERN PyObject(*Import__Py_NoneStruct); extern bool import_python(const char *python_path); -# ifndef NO_REDEFS -# define PyType_Ready Import_PyType_Ready -# define PyObject_GenericGetAttr Import_PyObject_GenericGetAttr -# define PyObject_IsTrue Import_PyObject_IsTrue -# define Py_DecRef Import_Py_DecRef -# define PyObject_Malloc Import_PyObject_Malloc -# define PyObject_Free Import_PyObject_Free -# define PyObject_Init Import_PyObject_Init -# define PyUnicode_FromFormat Import_PyUnicode_FromFormat -# define PyUnicode_Concat Import_PyUnicode_Concat -# define PyLong_FromVoidPtr Import_PyLong_FromVoidPtr -# define PyBool_FromLong Import_PyBool_FromLong -# define PyGILState_Ensure Import_PyGILState_Ensure -# define PyGILState_GetThisThreadState Import_PyGILState_GetThisThreadState -# define PyErr_SetString Import_PyErr_SetString -# define PyErr_Occurred Import_PyErr_Occurred -# define PyErr_Fetch Import_PyErr_Fetch -# define PyErr_Restore Import_PyErr_Restore -# define PyErr_WriteUnraisable Import_PyErr_WriteUnraisable -# define PyArg_UnpackTuple Import_PyArg_UnpackTuple -# define Py_BuildValue Import_Py_BuildValue -# define PyRun_SimpleStringFlags Import_PyRun_SimpleStringFlags -# define PyErr_Print Import_PyErr_Print -# define Py_SetPythonHome Import_Py_SetPythonHome -# define Py_Initialize Import_Py_Initialize -# define Py_Finalize Import_Py_Finalize -# define Py_IsInitialized Import_Py_IsInitialized -# define PyEval_InitThreads Import_PyEval_InitThreads -# define PyEval_ThreadsInitialized Import_PyEval_ThreadsInitialized -# define PyEval_ReleaseThread Import_PyEval_ReleaseThread -# define PySys_SetArgv Import_PySys_SetArgv -# define PyImport_ImportModule Import_PyImport_ImportModule -# define PyObject_CallFunctionObjArgs Import_PyObject_CallFunctionObjArgs -# define _Py_NotImplementedStruct (*Import__Py_NotImplementedStruct) -# define PyExc_TypeError (*Import_PyExc_TypeError) -# define PyExc_RuntimeError (*Import_PyExc_RuntimeError) -# define PyObject_GetAttr Import_PyObject_GetAttr -# define PyUnicode_FromString Import_PyUnicode_FromString -# define PyDict_GetItemString Import_PyDict_GetItemString -# define PyDict_SetItemString Import_PyDict_SetItemString -# define PyCFunction_NewEx Import_PyCFunction_NewEx -# define PyModule_GetDict Import_PyModule_GetDict -# define PyModule_GetNameObject Import_PyModule_GetNameObject -# define PyModule_AddObject Import_PyModule_AddObject -# define PyModule_AddStringConstant Import_PyModule_AddStringConstant -# define PyImport_Import Import_PyImport_Import -# define PyObject_CallObject Import_PyObject_CallObject -# define _Py_FalseStruct (*Import__Py_FalseStruct) -# define _Py_TrueStruct (*Import__Py_TrueStruct) -# define PyGILState_Release Import_PyGILState_Release -# define PyList_Append Import_PyList_Append -# define PySys_GetObject Import_PySys_GetObject -# define PyImport_ReloadModule Import_PyImport_ReloadModule -# define PyObject_GetAttrString Import_PyObject_GetAttrString -# define PyCapsule_New Import_PyCapsule_New -# define PyCapsule_GetPointer Import_PyCapsule_GetPointer -# define PyArg_ParseTuple Import_PyArg_ParseTuple -# define PyFunction_Type (*Import_PyFunction_Type) -# define PyObject_SetAttr Import_PyObject_SetAttr -# define _PyObject_New Import__PyObject_New -# define PyCapsule_Import Import_PyCapsule_Import -# define PyErr_Clear Import_PyErr_Clear -# define PyObject_Call Import_PyObject_Call -# define PyList_New Import_PyList_New -# define PyList_Size Import_PyList_Size -# define PyList_GetItem Import_PyList_GetItem -# define PyUnicode_AsUTF8String Import_PyUnicode_AsUTF8String -# define PyLong_FromUnsignedLongLong Import_PyLong_FromUnsignedLongLong -# define PyArg_VaParse Import_PyArg_VaParse -# define _Py_NoneStruct (*Import__Py_NoneStruct) -# endif +#ifndef NO_REDEFS +#define PyType_Ready Import_PyType_Ready +#define PyObject_GenericGetAttr Import_PyObject_GenericGetAttr +#define PyObject_IsTrue Import_PyObject_IsTrue +#define Py_DecRef Import_Py_DecRef +#define PyObject_Malloc Import_PyObject_Malloc +#define PyObject_Free Import_PyObject_Free +#define PyObject_Init Import_PyObject_Init +#define PyUnicode_FromFormat Import_PyUnicode_FromFormat +#define PyUnicode_Concat Import_PyUnicode_Concat +#define PyLong_FromVoidPtr Import_PyLong_FromVoidPtr +#define PyBool_FromLong Import_PyBool_FromLong +#define PyGILState_Ensure Import_PyGILState_Ensure +#define PyGILState_GetThisThreadState Import_PyGILState_GetThisThreadState +#define PyErr_SetString Import_PyErr_SetString +#define PyErr_Occurred Import_PyErr_Occurred +#define PyErr_Fetch Import_PyErr_Fetch +#define PyErr_Restore Import_PyErr_Restore +#define PyErr_WriteUnraisable Import_PyErr_WriteUnraisable +#define PyArg_UnpackTuple Import_PyArg_UnpackTuple +#define Py_BuildValue Import_Py_BuildValue +#define PyRun_SimpleStringFlags Import_PyRun_SimpleStringFlags +#define PyErr_Print Import_PyErr_Print +#define Py_SetPythonHome Import_Py_SetPythonHome +#define Py_Initialize Import_Py_Initialize +#define Py_Finalize Import_Py_Finalize +#define Py_IsInitialized Import_Py_IsInitialized +#define PyEval_InitThreads Import_PyEval_InitThreads +#define PyEval_ThreadsInitialized Import_PyEval_ThreadsInitialized +#define PyEval_ReleaseThread Import_PyEval_ReleaseThread +#define PySys_SetArgv Import_PySys_SetArgv +#define PyImport_ImportModule Import_PyImport_ImportModule +#define PyObject_CallFunctionObjArgs Import_PyObject_CallFunctionObjArgs +#define _Py_NotImplementedStruct (*Import__Py_NotImplementedStruct) +#define PyExc_TypeError (*Import_PyExc_TypeError) +#define PyExc_RuntimeError (*Import_PyExc_RuntimeError) +#define PyObject_GetAttr Import_PyObject_GetAttr +#define PyUnicode_FromString Import_PyUnicode_FromString +#define PyDict_GetItemString Import_PyDict_GetItemString +#define PyDict_SetItemString Import_PyDict_SetItemString +#define PyCFunction_NewEx Import_PyCFunction_NewEx +#define PyModule_GetDict Import_PyModule_GetDict +#define PyModule_GetNameObject Import_PyModule_GetNameObject +#define PyModule_AddObject Import_PyModule_AddObject +#define PyModule_AddStringConstant Import_PyModule_AddStringConstant +#define PyImport_Import Import_PyImport_Import +#define PyObject_CallObject Import_PyObject_CallObject +#define _Py_FalseStruct (*Import__Py_FalseStruct) +#define _Py_TrueStruct (*Import__Py_TrueStruct) +#define PyGILState_Release Import_PyGILState_Release +#define PyList_Append Import_PyList_Append +#define PySys_GetObject Import_PySys_GetObject +#define PyImport_ReloadModule Import_PyImport_ReloadModule +#define PyObject_GetAttrString Import_PyObject_GetAttrString +#define PyCapsule_New Import_PyCapsule_New +#define PyCapsule_GetPointer Import_PyCapsule_GetPointer +#define PyArg_ParseTuple Import_PyArg_ParseTuple +#define PyFunction_Type (*Import_PyFunction_Type) +#define PyObject_SetAttr Import_PyObject_SetAttr +#define _PyObject_New Import__PyObject_New +#define PyCapsule_Import Import_PyCapsule_Import +#define PyErr_Clear Import_PyErr_Clear +#define PyObject_Call Import_PyObject_Call +#define PyList_New Import_PyList_New +#define PyList_Size Import_PyList_Size +#define PyList_GetItem Import_PyList_GetItem +#define PyUnicode_AsUTF8String Import_PyUnicode_AsUTF8String +#define PyLong_FromUnsignedLongLong Import_PyLong_FromUnsignedLongLong +#define PyArg_VaParse Import_PyArg_VaParse +#define _Py_NoneStruct (*Import__Py_NoneStruct) +#endif #endif
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-python.c -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-python.c
Changed
@@ -51,7 +51,7 @@ static wchar_t home_path[1024] = {0}; #endif -DARRAY(char*) python_paths; +DARRAY(char *) python_paths; static bool python_loaded = false; static pthread_mutex_t tick_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -63,21 +63,13 @@ /* -------------------------------------------- */ -bool py_to_libobs_(const char *type, - PyObject * py_in, - void * libobs_out, - const char *id, - const char *func, - int line) +bool py_to_libobs_(const char *type, PyObject *py_in, void *libobs_out, + const char *id, const char *func, int line) { swig_type_info *info = SWIG_TypeQuery(type); if (info == NULL) { - warn("%s:%d: SWIG could not find type: %s%s%s", - func, - line, - id ? id : "", - id ? "::" : "", - type); + warn("%s:%d: SWIG could not find type: %s%s%s", func, line, + id ? id : "", id ? "::" : "", type); return false; } @@ -85,33 +77,21 @@ if (!SWIG_IsOK(ret)) { warn("%s:%d: SWIG failed to convert python object to obs " "object: %s%s%s", - func, - line, - id ? id : "", - id ? "::" : "", - type); + func, line, id ? id : "", id ? "::" : "", type); return false; } return true; } -bool libobs_to_py_(const char *type, - void * libobs_in, - bool ownership, - PyObject ** py_out, - const char *id, - const char *func, - int line) +bool libobs_to_py_(const char *type, void *libobs_in, bool ownership, + PyObject **py_out, const char *id, const char *func, + int line) { swig_type_info *info = SWIG_TypeQuery(type); if (info == NULL) { - warn("%s:%d: SWIG could not find type: %s%s%s", - func, - line, - id ? id : "", - id ? "::" : "", - type); + warn("%s:%d: SWIG could not find type: %s%s%s", func, line, + id ? id : "", id ? "::" : "", type); return false; } @@ -119,33 +99,27 @@ if (*py_out == Py_None) { warn("%s:%d: SWIG failed to convert obs object to python " "object: %s%s%s", - func, - line, - id ? id : "", - id ? "::" : "", - type); + func, line, id ? id : "", id ? "::" : "", type); return false; } return true; } - -#define libobs_to_py(type, obs_obj, ownership, py_obj) \ - libobs_to_py_(#type " *", obs_obj, ownership, py_obj, \ - NULL, __func__, __LINE__) +#define libobs_to_py(type, obs_obj, ownership, py_obj) \ + libobs_to_py_(#type " *", obs_obj, ownership, py_obj, NULL, __func__, \ + __LINE__) #define py_to_libobs(type, py_obj, libobs_out) \ - py_to_libobs_(#type " *", py_obj, libobs_out, \ - NULL, __func__, __LINE__) + py_to_libobs_(#type " *", py_obj, libobs_out, NULL, __func__, __LINE__) -#define lock_callback(cb) \ - lock_python(); \ - struct obs_python_script *__last_script = cur_python_script; \ - struct python_obs_callback *__last_cb = cur_python_cb; \ +#define lock_callback(cb) \ + lock_python(); \ + struct obs_python_script *__last_script = cur_python_script; \ + struct python_obs_callback *__last_cb = cur_python_cb; \ cur_python_script = (struct obs_python_script *)cb->base.script; \ cur_python_cb = cb -#define unlock_callback() \ - cur_python_cb = __last_cb; \ +#define unlock_callback() \ + cur_python_cb = __last_cb; \ cur_python_script = __last_script; \ unlock_python() @@ -174,8 +148,7 @@ static PyObject *py_get_current_script_path(PyObject *self, PyObject *args) { UNUSED_PARAMETER(args); - return PyDict_GetItemString(PyModule_GetDict(self), - "__script_dir__"); + return PyDict_GetItemString(PyModule_GetDict(self), "__script_dir__"); } static void get_defaults(struct obs_python_script *data, PyObject *get_defs) @@ -194,19 +167,19 @@ static bool load_python_script(struct obs_python_script *data) { - PyObject *py_file = NULL; - PyObject *py_module = NULL; - PyObject *py_success = NULL; - PyObject *py_tick = NULL; - PyObject *py_load = NULL; + PyObject *py_file = NULL; + PyObject *py_module = NULL; + PyObject *py_success = NULL; + PyObject *py_tick = NULL; + PyObject *py_load = NULL; PyObject *py_defaults = NULL; - bool success = false; - int ret; + bool success = false; + int ret; cur_python_script = data; if (!data->module) { - py_file = PyUnicode_FromString(data->name.array); + py_file = PyUnicode_FromString(data->name.array); py_module = PyImport_Import(py_file); } else { py_module = PyImport_ReloadModule(data->module); @@ -223,7 +196,7 @@ goto fail; ret = PyModule_AddStringConstant(py_module, "__script_dir__", - data->dir.array); + data->dir.array); if (py_error() || ret != 0) goto fail; @@ -233,12 +206,9 @@ goto fail; static PyMethodDef global_funcs[] = { - {"script_path", - py_get_current_script_path, - METH_NOARGS, + {"script_path", py_get_current_script_path, METH_NOARGS, "Gets the script path"}, - {0} - }; + {0}}; add_functions_to_py_module(py_module, global_funcs); @@ -250,8 +220,8 @@ if (!data->save) PyErr_Clear(); - data->get_properties = PyObject_GetAttrString(py_module, - "script_properties"); + data->get_properties = + PyObject_GetAttrString(py_module, "script_properties"); if (!data->get_properties) PyErr_Clear(); @@ -270,7 +240,8 @@ PyObject *py_desc = PyUnicode_AsUTF8String(py_ret); if (py_desc) { const char *desc = PyBytes_AS_STRING(py_desc); - if (desc) dstr_copy(&data->base.desc, desc); + if (desc) + dstr_copy(&data->base.desc, desc); Py_DECREF(py_desc); } Py_XDECREF(py_ret); @@ -286,7 +257,8 @@ struct obs_python_script *next = first_tick_script; data->next_tick = next; data->p_prev_next_tick = &first_tick_script; - if (next) next->p_prev_next_tick = &data->next_tick; + if (next) + next->p_prev_next_tick = &data->next_tick; first_tick_script = data; data->tick = py_tick; @@ -332,9 +304,9 @@ static void unload_python_script(struct obs_python_script *data) { - PyObject *py_module = data->module; - PyObject *py_func = NULL; - PyObject *py_ret = NULL; + PyObject *py_module = data->module; + PyObject *py_func = NULL; + PyObject *py_ret = NULL; cur_python_script = data; @@ -358,8 +330,8 @@ static void add_to_python_path(const char *path) { PyObject *py_path_str = NULL; - PyObject *py_path = NULL; - int ret; + PyObject *py_path = NULL; + int ret; if (!path || !*path) return; @@ -411,7 +383,8 @@ struct python_obs_timer *next = first_timer; timer->next = next; timer->p_prev_next = &first_timer; - if (next) next->p_prev_next = &timer->next; + if (next) + next->p_prev_next = &timer->next; first_timer = timer; pthread_mutex_unlock(&timer_mutex); @@ -420,12 +393,13 @@ static inline void python_obs_timer_remove(struct python_obs_timer *timer) { struct python_obs_timer *next = timer->next; - if (next) next->p_prev_next = timer->p_prev_next; + if (next) + next->p_prev_next = timer->p_prev_next; *timer->p_prev_next = timer->next; } -static inline struct python_obs_callback *python_obs_timer_cb( - struct python_obs_timer *timer) +static inline struct python_obs_callback * +python_obs_timer_cb(struct python_obs_timer *timer) { return &((struct python_obs_callback *)timer)[-1]; } @@ -440,8 +414,10 @@ if (!parse_args(args, "O", &py_cb)) return python_none(); - struct python_obs_callback *cb = find_python_obs_callback(script, py_cb); - if (cb) remove_python_obs_callback(cb); + struct python_obs_callback *cb = + find_python_obs_callback(script, py_cb); + if (cb) + remove_python_obs_callback(cb); return python_none(); } @@ -478,7 +454,7 @@ return python_none(); struct python_obs_callback *cb = add_python_obs_callback_extra( - script, py_cb, sizeof(struct python_obs_timer)); + script, py_cb, sizeof(struct python_obs_timer)); struct python_obs_timer *timer = python_obs_callback_extra_data(cb); timer->interval = (uint64_t)ms * 1000000ULL; @@ -528,8 +504,10 @@ if (!py_cb || !PyFunction_Check(py_cb)) return python_none(); - struct python_obs_callback *cb = find_python_obs_callback(script, py_cb); - if (cb) remove_python_obs_callback(cb); + struct python_obs_callback *cb = + find_python_obs_callback(script, py_cb); + if (cb) + remove_python_obs_callback(cb); return python_none(); } @@ -583,8 +561,8 @@ unlock_callback(); } -static PyObject *obs_python_signal_handler_disconnect( - PyObject *self, PyObject *args) +static PyObject *obs_python_signal_handler_disconnect(PyObject *self, + PyObject *args) { struct obs_python_script *script = cur_python_script; PyObject *py_sh = NULL; @@ -609,27 +587,28 @@ if (!py_cb || !PyFunction_Check(py_cb)) return python_none(); - struct python_obs_callback *cb = find_python_obs_callback(script, py_cb); + struct python_obs_callback *cb = + find_python_obs_callback(script, py_cb); while (cb) { signal_handler_t *cb_handler = calldata_ptr(&cb->base.extra, "handler"); const char *cb_signal = calldata_string(&cb->base.extra, "signal"); - if (cb_signal && - strcmp(signal, cb_signal) != 0 && + if (cb_signal && strcmp(signal, cb_signal) != 0 && handler == cb_handler) break; cb = find_next_python_obs_callback(script, cb, py_cb); } - if (cb) remove_python_obs_callback(cb); + if (cb) + remove_python_obs_callback(cb); return python_none(); } -static PyObject *obs_python_signal_handler_connect( - PyObject *self, PyObject *args) +static PyObject *obs_python_signal_handler_connect(PyObject *self, + PyObject *args) { struct obs_python_script *script = cur_python_script; PyObject *py_sh = NULL; @@ -663,7 +642,7 @@ /* -------------------------------------------- */ static void calldata_signal_callback_global(void *priv, const char *signal, - calldata_t *cd) + calldata_t *cd) { struct python_obs_callback *cb = priv; @@ -688,8 +667,8 @@ unlock_callback(); } -static PyObject *obs_python_signal_handler_disconnect_global( - PyObject *self, PyObject *args) +static PyObject *obs_python_signal_handler_disconnect_global(PyObject *self, + PyObject *args) { struct obs_python_script *script = cur_python_script; PyObject *py_sh = NULL; @@ -713,7 +692,8 @@ if (!py_cb || !PyFunction_Check(py_cb)) return python_none(); - struct python_obs_callback *cb = find_python_obs_callback(script, py_cb); + struct python_obs_callback *cb = + find_python_obs_callback(script, py_cb); while (cb) { signal_handler_t *cb_handler = calldata_ptr(&cb->base.extra, "handler"); @@ -724,12 +704,13 @@ cb = find_next_python_obs_callback(script, cb, py_cb); } - if (cb) remove_python_obs_callback(cb); + if (cb) + remove_python_obs_callback(cb); return python_none(); } -static PyObject *obs_python_signal_handler_connect_global( - PyObject *self, PyObject *args) +static PyObject *obs_python_signal_handler_connect_global(PyObject *self, + PyObject *args) { struct obs_python_script *script = cur_python_script; PyObject *py_sh = NULL; @@ -755,8 +736,8 @@ struct python_obs_callback *cb = add_python_obs_callback(script, py_cb); calldata_set_ptr(&cb->base.extra, "handler", handler); - signal_handler_connect_global(handler, - calldata_signal_callback_global, cb); + signal_handler_connect_global(handler, calldata_signal_callback_global, + cb); return python_none(); } @@ -773,7 +754,7 @@ obs_hotkey_id id = (obs_hotkey_id)calldata_int(&cb->base.extra, "id"); if (id != OBS_INVALID_HOTKEY_ID) - defer_call_post(defer_hotkey_unregister, (void*)(uintptr_t)id); + defer_call_post(defer_hotkey_unregister, (void *)(uintptr_t)id); } static void hotkey_pressed(void *p_cb, bool pressed) @@ -811,8 +792,8 @@ return PyLong_FromUnsignedLongLong(OBS_INVALID_HOTKEY_ID); } -static void hotkey_callback(void *p_cb, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) +static void hotkey_callback(void *p_cb, obs_hotkey_id id, obs_hotkey_t *hotkey, + bool pressed) { struct python_obs_callback *cb = p_cb; @@ -844,8 +825,10 @@ if (!py_cb || !PyFunction_Check(py_cb)) return python_none(); - struct python_obs_callback *cb = find_python_obs_callback(script, py_cb); - if (cb) remove_python_obs_callback(cb); + struct python_obs_callback *cb = + find_python_obs_callback(script, py_cb); + if (cb) + remove_python_obs_callback(cb); UNUSED_PARAMETER(self); return python_none(); @@ -879,7 +862,7 @@ /* -------------------------------------------- */ static bool button_prop_clicked(obs_properties_t *props, obs_property_t *p, - void *p_cb) + void *p_cb) { struct python_obs_callback *cb = p_cb; bool ret = false; @@ -931,7 +914,7 @@ struct python_obs_callback *cb = add_python_obs_callback(script, py_cb); p = obs_properties_add_button2(props, name, text, button_prop_clicked, - cb); + cb); if (!p || !libobs_to_py(obs_property_t, p, false, &py_ret)) return python_none(); @@ -943,7 +926,7 @@ /* -------------------------------------------- */ static bool modified_callback(void *p_cb, obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) + obs_property_t *p, obs_data_t *settings) { struct python_obs_callback *cb = p_cb; bool ret = false; @@ -961,8 +944,8 @@ libobs_to_py(obs_property_t, p, false, &py_p) && libobs_to_py(obs_data_t, settings, false, &py_settings)) { - PyObject *args = Py_BuildValue("(OOO)", py_props, py_p, - py_settings); + PyObject *args = + Py_BuildValue("(OOO)", py_props, py_p, py_settings); PyObject *py_ret = PyObject_CallObject(cb->func, args); if (!py_error()) ret = py_ret == Py_True; @@ -1017,7 +1000,7 @@ static PyObject *calldata_source(PyObject *self, PyObject *args) { PyObject *py_ret = NULL; - PyObject *py_cd = NULL; + PyObject *py_cd = NULL; calldata_t *cd; const char *name; @@ -1039,7 +1022,7 @@ static PyObject *calldata_sceneitem(PyObject *self, PyObject *args) { PyObject *py_ret = NULL; - PyObject *py_cd = NULL; + PyObject *py_cd = NULL; calldata_t *cd; const char *name; @@ -1086,7 +1069,7 @@ /* -------------------------------------------- */ static bool enum_items_proc(obs_scene_t *scene, obs_sceneitem_t *item, - void *param) + void *param) { PyObject *list = param; PyObject *py_item; @@ -1165,7 +1148,7 @@ struct dstr cur_py_log_chunk = {0}; static PyObject *py_script_log_internal(PyObject *self, PyObject *args, - bool add_endl) + bool add_endl) { static bool calling_self = false; int log_level; @@ -1195,7 +1178,7 @@ *endl = 0; if (cur_python_script) script_log(&cur_python_script->base, log_level, "%s", - start); + start); else script_log(NULL, log_level, "%s", start); *endl = '\n'; @@ -1206,7 +1189,8 @@ if (start) { size_t len = strlen(start); - if (len) memmove(cur_py_log_chunk.array, start, len); + if (len) + memmove(cur_py_log_chunk.array, start, len); dstr_resize(&cur_py_log_chunk, len); } @@ -1245,31 +1229,26 @@ DEF_FUNC("obs_enum_sources", enum_sources), DEF_FUNC("obs_scene_enum_items", scene_enum_items), DEF_FUNC("obs_remove_tick_callback", - obs_python_remove_tick_callback), - DEF_FUNC("obs_add_tick_callback", - obs_python_add_tick_callback), + obs_python_remove_tick_callback), + DEF_FUNC("obs_add_tick_callback", obs_python_add_tick_callback), DEF_FUNC("signal_handler_disconnect", - obs_python_signal_handler_disconnect), + obs_python_signal_handler_disconnect), DEF_FUNC("signal_handler_connect", - obs_python_signal_handler_connect), + obs_python_signal_handler_connect), DEF_FUNC("signal_handler_disconnect_global", - obs_python_signal_handler_disconnect_global), + obs_python_signal_handler_disconnect_global), DEF_FUNC("signal_handler_connect_global", - obs_python_signal_handler_connect_global), - DEF_FUNC("obs_hotkey_unregister", - hotkey_unregister), + obs_python_signal_handler_connect_global), + DEF_FUNC("obs_hotkey_unregister", hotkey_unregister), DEF_FUNC("obs_hotkey_register_frontend", - hotkey_register_frontend), - DEF_FUNC("obs_properties_add_button", - properties_add_button), + hotkey_register_frontend), + DEF_FUNC("obs_properties_add_button", properties_add_button), DEF_FUNC("obs_property_set_modified_callback", - property_set_modified_callback), - DEF_FUNC("remove_current_callback", - remove_current_callback), + property_set_modified_callback), + DEF_FUNC("remove_current_callback", remove_current_callback), #undef DEF_FUNC - {0} - }; + {0}}; add_functions_to_py_module(module, funcs); } @@ -1355,7 +1334,8 @@ pthread_mutex_lock(&tick_mutex); struct obs_python_script *next = data->next_tick; - if (next) next->p_prev_next_tick = data->p_prev_next_tick; + if (next) + next->p_prev_next_tick = data->p_prev_next_tick; *data->p_prev_next_tick = next; pthread_mutex_unlock(&tick_mutex); @@ -1520,7 +1500,8 @@ while (data) { cur_python_script = data; - PyObject *py_ret = PyObject_CallObject(data->tick, args); + PyObject *py_ret = + PyObject_CallObject(data->tick, args); Py_XDECREF(py_ret); py_error(); @@ -1590,7 +1571,6 @@ pthread_mutex_init(&tick_mutex, NULL); pthread_mutex_init(&timer_mutex, &attr); - } extern void add_python_frontend_funcs(PyObject *module); @@ -1602,12 +1582,12 @@ if (python_loaded) return true; - /* Use external python on windows and mac */ + /* Use external python on windows and mac */ #if RUNTIME_LINK -# if 0 +#if 0 struct dstr old_path = {0}; struct dstr new_path = {0}; -# endif +#endif if (!import_python(python_path)) return false; @@ -1615,11 +1595,11 @@ if (python_path && *python_path) { os_utf8_to_wcs(python_path, 0, home_path, 1024); Py_SetPythonHome(home_path); -# if 0 +#if 0 dstr_copy(&old_path, getenv("PATH")); _putenv("PYTHONPATH="); _putenv("PATH="); -# endif +#endif } #else UNUSED_PARAMETER(python_path); @@ -1630,12 +1610,12 @@ return false; #if 0 -# ifdef _DEBUG +#ifdef _DEBUG if (pythondir && *pythondir) { dstr_printf(&new_path, "PATH=%s", old_path.array); _putenv(new_path.array); } -# endif +#endif bfree(pythondir); dstr_free(&new_path); @@ -1650,7 +1630,7 @@ /* Must set arguments for guis to work */ wchar_t *argv[] = {L"", NULL}; - int argc = sizeof(argv) / sizeof(wchar_t*) - 1; + int argc = sizeof(argv) / sizeof(wchar_t *) - 1; PySys_SetArgv(argc, argv);
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting-python.h -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting-python.h
Changed
@@ -55,9 +55,9 @@ #define do_log(level, format, ...) \ blog(level, "[Python] " format, ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) /* ------------------------------------------------------------ */ @@ -90,43 +90,40 @@ PyObject *func; }; -static inline struct python_obs_callback *add_python_obs_callback_extra( - struct obs_python_script *script, - PyObject *func, - size_t extra_size) +static inline struct python_obs_callback * +add_python_obs_callback_extra(struct obs_python_script *script, PyObject *func, + size_t extra_size) { struct python_obs_callback *cb = add_script_callback( - &script->first_callback, - (obs_script_t *)script, - sizeof(*cb) + extra_size); + &script->first_callback, (obs_script_t *)script, + sizeof(*cb) + extra_size); Py_XINCREF(func); cb->func = func; return cb; } -static inline struct python_obs_callback *add_python_obs_callback( - struct obs_python_script *script, - PyObject *func) +static inline struct python_obs_callback * +add_python_obs_callback(struct obs_python_script *script, PyObject *func) { return add_python_obs_callback_extra(script, func, 0); } -static inline void *python_obs_callback_extra_data( - struct python_obs_callback *cb) +static inline void * +python_obs_callback_extra_data(struct python_obs_callback *cb) { - return (void*)&cb[1]; + return (void *)&cb[1]; } -static inline struct obs_python_script *python_obs_callback_script( - struct python_obs_callback *cb) +static inline struct obs_python_script * +python_obs_callback_script(struct python_obs_callback *cb) { return (struct obs_python_script *)cb->base.script; } -static inline struct python_obs_callback *find_next_python_obs_callback( - struct obs_python_script *script, - struct python_obs_callback *cb, PyObject *func) +static inline struct python_obs_callback * +find_next_python_obs_callback(struct obs_python_script *script, + struct python_obs_callback *cb, PyObject *func) { cb = cb ? (struct python_obs_callback *)cb->base.next : (struct python_obs_callback *)script->first_callback; @@ -140,9 +137,8 @@ return cb; } -static inline struct python_obs_callback *find_python_obs_callback( - struct obs_python_script *script, - PyObject *func) +static inline struct python_obs_callback * +find_python_obs_callback(struct obs_python_script *script, PyObject *func) { return find_next_python_obs_callback(script, NULL, func); } @@ -167,7 +163,8 @@ /* ------------------------------------------------------------ */ -static int parse_args_(PyObject *args, const char *func, const char *format, ...) +static int parse_args_(PyObject *args, const char *func, const char *format, + ...) { char new_format[128]; va_list va_args; @@ -197,15 +194,13 @@ #define py_error() py_error_(__FUNCTION__, __LINE__) -#define lock_python() \ - PyGILState_STATE gstate = PyGILState_Ensure() -#define unlock_python() \ - PyGILState_Release(gstate) +#define lock_python() PyGILState_STATE gstate = PyGILState_Ensure() +#define unlock_python() PyGILState_Release(gstate) struct py_source; typedef struct py_source py_source_t; -extern PyObject* py_libobs; +extern PyObject *py_libobs; extern struct python_obs_callback *cur_python_cb; extern struct obs_python_script *cur_python_script; @@ -213,25 +208,17 @@ extern PyObject *py_obs_register_source(PyObject *self, PyObject *args); extern PyObject *py_obs_get_script_config_path(PyObject *self, PyObject *args); extern void add_functions_to_py_module(PyObject *module, - PyMethodDef *method_list); + PyMethodDef *method_list); /* ------------------------------------------------------------ */ /* Warning: the following functions expect python to be locked! */ -extern bool py_to_libobs_(const char *type, - PyObject * py_in, - void * libobs_out, - const char *id, - const char *func, - int line); - -extern bool libobs_to_py_(const char *type, - void * libobs_in, - bool ownership, - PyObject ** py_out, - const char *id, - const char *func, - int line); +extern bool py_to_libobs_(const char *type, PyObject *py_in, void *libobs_out, + const char *id, const char *func, int line); + +extern bool libobs_to_py_(const char *type, void *libobs_in, bool ownership, + PyObject **py_out, const char *id, const char *func, + int line); extern bool py_call(PyObject *call, PyObject **ret, const char *arg_def, ...); extern bool py_import_script(const char *name);
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting.c -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting.c
Changed
@@ -27,7 +27,7 @@ #if COMPILE_LUA extern obs_script_t *obs_lua_script_create(const char *path, - obs_data_t *settings); + obs_data_t *settings); extern bool obs_lua_script_load(obs_script_t *s); extern void obs_lua_script_unload(obs_script_t *s); extern void obs_lua_script_destroy(obs_script_t *s); @@ -41,7 +41,7 @@ #if COMPILE_PYTHON extern obs_script_t *obs_python_script_create(const char *path, - obs_data_t *settings); + obs_data_t *settings); extern bool obs_python_script_load(obs_script_t *s); extern void obs_python_script_unload(obs_script_t *s); extern void obs_python_script_destroy(obs_script_t *s); @@ -49,7 +49,8 @@ extern void obs_python_unload(void); extern obs_properties_t *obs_python_script_get_properties(obs_script_t *script); -extern void obs_python_script_update(obs_script_t *script, obs_data_t *settings); +extern void obs_python_script_update(obs_script_t *script, + obs_data_t *settings); extern void obs_python_script_save(obs_script_t *script); #endif @@ -66,8 +67,7 @@ #if COMPILE_PYTHON "py", #endif - NULL -}; + NULL}; /* -------------------------------------------- */ @@ -164,7 +164,7 @@ if (!scripting_loaded) return; - /* ---------------------- */ + /* ---------------------- */ #if COMPILE_LUA obs_lua_unload(); @@ -195,7 +195,7 @@ pthread_mutex_destroy(&detach_mutex); blog(LOG_INFO, "[Scripting] Total detached callbacks: %d", - total_detached); + total_detached); /* ---------------------- */ @@ -223,11 +223,10 @@ } static inline bool pointer_valid(const void *x, const char *name, - const char *func) + const char *func) { if (!x) { - blog(LOG_WARNING, "obs-scripting: [%s] %s is null", - func, name); + blog(LOG_WARNING, "obs-scripting: [%s] %s is null", func, name); return false; } @@ -256,7 +255,7 @@ } else #endif #if COMPILE_PYTHON - if (strcmp(ext, ".py") == 0) { + if (strcmp(ext, ".py") == 0) { script = obs_python_script_create(path, settings); } else #endif
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obs-scripting.h -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obs-scripting.h
Changed
@@ -39,14 +39,11 @@ EXPORT void obs_scripting_unload(void); EXPORT const char **obs_scripting_supported_formats(void); -typedef void (*scripting_log_handler_t)( - void *p, - obs_script_t *script, - int lvl, - const char *msg); - -EXPORT void obs_scripting_set_log_callback( - scripting_log_handler_t handler, void *param); +typedef void (*scripting_log_handler_t)(void *p, obs_script_t *script, int lvl, + const char *msg); + +EXPORT void obs_scripting_set_log_callback(scripting_log_handler_t handler, + void *param); EXPORT bool obs_scripting_python_runtime_linked(void); EXPORT bool obs_scripting_python_loaded(void);
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obslua/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obslua/CMakeLists.txt
Changed
@@ -1,6 +1,10 @@ cmake_minimum_required(VERSION 2.8) project(obslua) +if(POLICY CMP0078) + cmake_policy(SET CMP0078 OLD) +endif() + find_package(SWIG 2 REQUIRED) include(${SWIG_USE_FILE}) @@ -16,7 +20,14 @@ include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/libobs") include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -SWIG_ADD_MODULE(obslua lua obslua.i ../cstrcache.cpp ../cstrcache.h) +if(CMAKE_VERSION VERSION_GREATER 3.7.2) + SWIG_ADD_LIBRARY(obslua + LANGUAGE lua + TYPE MODULE + SOURCES obslua.i ../cstrcache.cpp ../cstrcache.h) +else() + SWIG_ADD_MODULE(obslua lua obslua.i ../cstrcache.cpp ../cstrcache.h) +endif() SWIG_LINK_LIBRARIES(obslua obs-scripting libobs ${LUA_LIBRARIES} ${EXTRA_LIBS}) function(install_plugin_bin_swig target additional_target)
View file
obs-studio-23.2.1.tar.xz/deps/obs-scripting/obspython/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/deps/obs-scripting/obspython/CMakeLists.txt
Changed
@@ -1,6 +1,10 @@ cmake_minimum_required(VERSION 2.8) project(obspython) +if(POLICY CMP0078) + cmake_policy(SET CMP0078 OLD) +endif() + find_package(SWIG 2 REQUIRED) include(${SWIG_USE_FILE}) @@ -30,7 +34,14 @@ string(REGEX REPLACE "_d" "" PYTHON_LIBRARIES "${PYTHON_LIBRARIES}") endif() -SWIG_ADD_MODULE(obspython python obspython.i ../cstrcache.cpp ../cstrcache.h) +if(CMAKE_VERSION VERSION_GREATER 3.7.2) + SWIG_ADD_LIBRARY(obspython + LANGUAGE python + TYPE MODULE + SOURCES obspython.i ../cstrcache.cpp ../cstrcache.h) +else() + SWIG_ADD_MODULE(obspython python obspython.i ../cstrcache.cpp ../cstrcache.h) +endif() SWIG_LINK_LIBRARIES(obspython obs-scripting libobs ${PYTHON_LIBRARIES}) function(install_plugin_bin_swig target additional_target)
View file
obs-studio-24.0.0.tar.xz/deps/w32-pthreads/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/docs/sphinx/reference-frontend-api.rst -> obs-studio-24.0.0.tar.xz/docs/sphinx/reference-frontend-api.rst
Changed
@@ -124,6 +124,18 @@ the program is either about to load a new scene collection, or the program is about to exit. + - **OBS_FRONTEND_FINISHED_LOADING** + + Triggered when the program has finished loading. + + - **OBS_FRONTEND_EVENT_RECORDING_PAUSED** + + Triggered when the recording has been paused. + + - **OBS_FRONTEND_EVENT_RECORDING_UNPAUSED** + + Triggered when the recording has been unpaused. + .. type:: struct obs_frontend_source_list - DARRAY(obs_source_t*) **sources** @@ -402,6 +414,18 @@ --------------------------------------- +.. function:: void obs_frontend_recording_pause(bool pause) + + :pause: *true* to pause recording, *false* to unpause. + +--------------------------------------- + +.. function:: bool obs_frontend_recording_paused(void) + + :return: *true* if recording paused, *false* otherwise. + +--------------------------------------- + .. function:: void obs_frontend_replay_buffer_start(void) Starts replay buffer.
View file
obs-studio-23.2.1.tar.xz/docs/sphinx/reference-outputs.rst -> obs-studio-24.0.0.tar.xz/docs/sphinx/reference-outputs.rst
Changed
@@ -66,6 +66,14 @@ When this capability flag is used, specifies that this output supports multiple encoded audio tracks simultaneously. + - **OBS_OUTPUT_CAN_PAUSE** - Output supports pausing. + + When this capability flag is used, the output supports pausing. + When an output is paused, raw or encoded audio/video data will be + halted when paused down to the exact point to the closest video + frame. Audio data will be correctly truncated down to the exact + audio sample according to that video frame timing. + .. member:: const char *(*obs_output_info.get_name)(void *type_data) Get the translated name of the output type. @@ -170,13 +178,9 @@ :return: The properties of the output -.. member:: void (*obs_output_info.pause)(void *data) - - Pauses the output (if the output supports pausing). +.. member:: void (*obs_output_info.unused1)(void *data) - (Author's note: This is currently unimplemented) - - (Optional) + This callback is no longer used. .. member:: uint64_t (*obs_output_info.get_total_bytes)(void *data) @@ -257,6 +261,14 @@ | OBS_OUTPUT_NO_SPACE - Ran out of disk space | OBS_OUTPUT_ENCODE_ERROR - Encoder error +**pause** (ptr output) + + Called when the output has been paused. + +**unpause** (ptr output) + + Called when the output has been unpaused. + **starting** (ptr output) Called when the output is starting. @@ -444,11 +456,18 @@ --------------------- -.. function:: void obs_output_pause(obs_output_t *output) +.. function:: bool obs_output_pause(obs_output_t *output, bool pause) Pause an output (if supported by the output). - (Author's Note: Not yet implemented) + :return: *true* if the output was paused successfuly, *false* + otherwise + +--------------------- + +.. function:: bool obs_output_paused(const obs_output_t *output) + + :return: *true* if the output is paused, *false* otherwise --------------------- @@ -808,6 +827,14 @@ | OBS_OUTPUT_UNSUPPORTED - The settings, video/audio format, or codecs are unsupported by this output | OBS_OUTPUT_NO_SPACE - Ran out of disk space +--------------------- + +.. function:: uint64_t obs_output_get_pause_offset(obs_output_t *output) + + Returns the current pause offset of the output. Used with raw + outputs to calculate system timestamps when using calculated + timestamps (see FFmpeg output for an example). + .. --------------------------------------------------------------------------- .. _libobs/obs-output.h: https://github.com/jp9000/obs-studio/blob/master/libobs/obs-output.h
View file
obs-studio-23.2.1.tar.xz/docs/sphinx/reference-scenes.rst -> obs-studio-24.0.0.tar.xz/docs/sphinx/reference-scenes.rst
Changed
@@ -139,6 +139,10 @@ Called when a scene item's visibility state changes. +**item_locked** (ptr scene, ptr item, bool locked) + + Called when a scene item has been locked or unlocked. + **item_select** (ptr scene, ptr item) **item_deselect** (ptr scene, ptr item) @@ -406,6 +410,13 @@ --------------------- +.. function:: bool obs_sceneitem_set_locked(obs_sceneitem_t *item, bool locked) + bool obs_sceneitem_locked(const obs_sceneitem_t *item) + + Sets/gets the locked/unlocked state of the scene item. + +--------------------- + .. function:: void obs_sceneitem_set_crop(obs_sceneitem_t *item, const struct obs_sceneitem_crop *crop) void obs_sceneitem_get_crop(const obs_sceneitem_t *item, struct obs_sceneitem_crop *crop)
View file
obs-studio-24.0.0.tar.xz/formatcode.sh
Added
@@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Original source https://github.com/Project-OSRM/osrm-backend/blob/master/scripts/format.sh + +set +x +set -o errexit +set -o pipefail +set -o nounset + +# Runs the Clang Formatter in parallel on the code base. +# Return codes: +# - 1 there are files to be formatted +# - 0 everything looks fine + +# Get CPU count +OS=$(uname) +NPROC=1 +if [[ $OS = "Linux" ]] ; then + NPROC=$(nproc) +elif [[ ${OS} = "Darwin" ]] ; then + NPROC=$(sysctl -n hw.physicalcpu) +fi + +# Discover clang-format +if type clang-format-8 2> /dev/null ; then + CLANG_FORMAT=clang-format-8 +else + CLANG_FORMAT=clang-format +fi + +find . -type d \( -path ./deps -o -path ./cmake -o -path ./plugins/decklink/win -o -path ./plugins/decklink/mac -o -path ./plugins/decklink/linux \) -prune -type f -o -name '*.h' -or -name '*.hpp' -or -name '*.m' -or -name '*.mm' -or -name '*.c' -or -name '*.cpp' \ +| xargs -I{} -P ${NPROC} ${CLANG_FORMAT} -i -style=file -fallback-style=none {} \ No newline at end of file
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-duplicator.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-duplicator.cpp
Changed
@@ -19,7 +19,7 @@ #include <map> static inline bool get_monitor(gs_device_t *device, int monitor_idx, - IDXGIOutput **dxgiOutput) + IDXGIOutput **dxgiOutput) { HRESULT hr; @@ -44,7 +44,7 @@ throw "Invalid monitor index"; hr = output->QueryInterface(__uuidof(IDXGIOutput1), - (void**)output1.Assign()); + (void **)output1.Assign()); if (FAILED(hr)) throw HRError("Failed to query IDXGIOutput1", hr); @@ -54,11 +54,11 @@ } gs_duplicator::gs_duplicator(gs_device_t *device_, int monitor_idx) - : gs_obj (device_, gs_type::gs_duplicator), - texture (nullptr), - idx (monitor_idx), - refs (1), - updated (false) + : gs_obj(device_, gs_type::gs_duplicator), + texture(nullptr), + idx(monitor_idx), + refs(1), + updated(false) { Start(); } @@ -71,7 +71,8 @@ extern "C" { EXPORT bool device_get_duplicator_monitor_info(gs_device_t *device, - int monitor_idx, struct gs_monitor_info *info) + int monitor_idx, + struct gs_monitor_info *info) { DXGI_OUTPUT_DESC desc; HRESULT hr; @@ -86,9 +87,11 @@ if (FAILED(hr)) throw HRError("GetDesc failed", hr); - } catch (HRError error) { - blog(LOG_ERROR, "device_get_duplicator_monitor_info: " - "%s (%08lX)", error.str, error.hr); + } catch (const HRError &error) { + blog(LOG_ERROR, + "device_get_duplicator_monitor_info: " + "%s (%08lX)", + error.str, error.hr); return false; } @@ -119,7 +122,7 @@ return true; } -static std::map<int, gs_duplicator*> instances; +static std::map<int, gs_duplicator *> instances; void reset_duplicators(void) { @@ -129,7 +132,7 @@ } EXPORT gs_duplicator_t *device_duplicator_create(gs_device_t *device, - int monitor_idx) + int monitor_idx) { gs_duplicator *duplicator = nullptr; @@ -145,13 +148,12 @@ instances[monitor_idx] = duplicator; } catch (const char *error) { - blog(LOG_DEBUG, "device_duplicator_create: %s", - error); + blog(LOG_DEBUG, "device_duplicator_create: %s", error); return nullptr; - } catch (HRError error) { + } catch (const HRError &error) { blog(LOG_DEBUG, "device_duplicator_create: %s (%08lX)", - error.str, error.hr); + error.str, error.hr); return nullptr; } @@ -171,20 +173,17 @@ D3D11_TEXTURE2D_DESC desc; tex->GetDesc(&desc); - if (!d->texture || - d->texture->width != desc.Width || + if (!d->texture || d->texture->width != desc.Width || d->texture->height != desc.Height) { delete d->texture; - d->texture = (gs_texture_2d*)gs_texture_create( - desc.Width, desc.Height, - ConvertDXGITextureFormat(desc.Format), 1, - nullptr, 0); + d->texture = (gs_texture_2d *)gs_texture_create( + desc.Width, desc.Height, + ConvertDXGITextureFormat(desc.Format), 1, nullptr, 0); } if (!!d->texture) - d->device->context->CopyResource(d->texture->texture, - tex); + d->device->context->CopyResource(d->texture->texture, tex); } EXPORT bool gs_duplicator_update_frame(gs_duplicator_t *d) @@ -209,16 +208,20 @@ return true; } else if (FAILED(hr)) { - blog(LOG_ERROR, "gs_duplicator_update_frame: Failed to update " - "frame (%08lX)", hr); + blog(LOG_ERROR, + "gs_duplicator_update_frame: Failed to update " + "frame (%08lX)", + hr); return true; } hr = res->QueryInterface(__uuidof(ID3D11Texture2D), - (void**)tex.Assign()); + (void **)tex.Assign()); if (FAILED(hr)) { - blog(LOG_ERROR, "gs_duplicator_update_frame: Failed to query " - "ID3D11Texture2D (%08lX)", hr); + blog(LOG_ERROR, + "gs_duplicator_update_frame: Failed to query " + "ID3D11Texture2D (%08lX)", + hr); d->duplicator->ReleaseFrame(); return true; } @@ -233,5 +236,4 @@ { return duplicator->texture; } - }
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-indexbuffer.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-indexbuffer.cpp
Changed
@@ -21,14 +21,14 @@ { HRESULT hr; - memset(&bd, 0, sizeof(bd)); + memset(&bd, 0, sizeof(bd)); memset(&srd, 0, sizeof(srd)); - bd.Usage = dynamic ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT; + bd.Usage = dynamic ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT; bd.CPUAccessFlags = dynamic ? D3D11_CPU_ACCESS_WRITE : 0; - bd.BindFlags = D3D11_BIND_INDEX_BUFFER; - bd.ByteWidth = UINT(indexSize * num); - srd.pSysMem = indices.data; + bd.BindFlags = D3D11_BIND_INDEX_BUFFER; + bd.ByteWidth = UINT(indexSize * num); + srd.pSysMem = indices.data; hr = device->device->CreateBuffer(&bd, &srd, indexBuffer.Assign()); if (FAILED(hr)) @@ -36,16 +36,20 @@ } gs_index_buffer::gs_index_buffer(gs_device_t *device, enum gs_index_type type, - void *indices, size_t num, uint32_t flags) - : gs_obj (device, gs_type::gs_index_buffer), - dynamic ((flags & GS_DYNAMIC) != 0), - type (type), - num (num), - indices (indices) + void *indices, size_t num, uint32_t flags) + : gs_obj(device, gs_type::gs_index_buffer), + dynamic((flags & GS_DYNAMIC) != 0), + type(type), + num(num), + indices(indices) { switch (type) { - case GS_UNSIGNED_SHORT: indexSize = 2; break; - case GS_UNSIGNED_LONG: indexSize = 4; break; + case GS_UNSIGNED_SHORT: + indexSize = 2; + break; + case GS_UNSIGNED_LONG: + indexSize = 4; + break; } InitBuffer();
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-rebuild.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-rebuild.cpp
Changed
@@ -33,23 +33,23 @@ void gs_texture_2d::RebuildSharedTextureFallback() { - td = {}; - td.Width = 2; - td.Height = 2; - td.MipLevels = 1; - td.Format = DXGI_FORMAT_B8G8R8A8_UNORM; - td.ArraySize = 1; + td = {}; + td.Width = 2; + td.Height = 2; + td.MipLevels = 1; + td.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + td.ArraySize = 1; td.SampleDesc.Count = 1; - td.BindFlags = D3D11_BIND_SHADER_RESOURCE; + td.BindFlags = D3D11_BIND_SHADER_RESOURCE; - width = td.Width; - height = td.Height; + width = td.Width; + height = td.Height; dxgiFormat = td.Format; - levels = 1; + levels = 1; resourceDesc = {}; - resourceDesc.Format = td.Format; - resourceDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + resourceDesc.Format = td.Format; + resourceDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; resourceDesc.Texture2D.MipLevels = 1; isShared = false; @@ -60,18 +60,19 @@ HRESULT hr; if (isShared) { hr = dev->OpenSharedResource((HANDLE)(uintptr_t)sharedHandle, - __uuidof(ID3D11Texture2D), (void**)&texture); + __uuidof(ID3D11Texture2D), + (void **)&texture); if (FAILED(hr)) { - blog(LOG_WARNING, "Failed to rebuild shared texture: ", - "0x%08lX", hr); + blog(LOG_WARNING, + "Failed to rebuild shared texture: ", "0x%08lX", + hr); RebuildSharedTextureFallback(); } } if (!isShared) { - hr = dev->CreateTexture2D(&td, - data.size() ? srd.data() : nullptr, - &texture); + hr = dev->CreateTexture2D( + &td, data.size() ? srd.data() : nullptr, &texture); if (FAILED(hr)) throw HRError("Failed to create 2D texture", hr); } @@ -85,7 +86,7 @@ if (isGDICompatible) { hr = texture->QueryInterface(__uuidof(IDXGISurface1), - (void**)&gdiSurface); + (void **)&gdiSurface); if (FAILED(hr)) throw HRError("Failed to create GDI surface", hr); } @@ -172,12 +173,13 @@ void gs_vertex_shader::Rebuild(ID3D11Device *dev) { HRESULT hr; - hr = dev->CreateVertexShader(data.data(), data.size(), nullptr, &shader); + hr = dev->CreateVertexShader(data.data(), data.size(), nullptr, + &shader); if (FAILED(hr)) throw HRError("Failed to create vertex shader", hr); hr = dev->CreateInputLayout(layoutData.data(), (UINT)layoutData.size(), - data.data(), data.size(), &layout); + data.data(), data.size(), &layout); if (FAILED(hr)) throw HRError("Failed to create input layout", hr); @@ -197,9 +199,8 @@ void gs_pixel_shader::Rebuild(ID3D11Device *dev) { HRESULT hr; - - hr = dev->CreatePixelShader(data.data(), data.size(), nullptr, - &shader); + + hr = dev->CreatePixelShader(data.data(), data.size(), nullptr, &shader); if (FAILED(hr)) throw HRError("Failed to create pixel shader", hr); @@ -224,6 +225,29 @@ Init(); } +void gs_timer::Rebuild(ID3D11Device *dev) +{ + D3D11_QUERY_DESC desc; + desc.Query = D3D11_QUERY_TIMESTAMP; + desc.MiscFlags = 0; + HRESULT hr = dev->CreateQuery(&desc, &query_begin); + if (FAILED(hr)) + throw HRError("Failed to create timer", hr); + hr = dev->CreateQuery(&desc, &query_end); + if (FAILED(hr)) + throw HRError("Failed to create timer", hr); +} + +void gs_timer_range::Rebuild(ID3D11Device *dev) +{ + D3D11_QUERY_DESC desc; + desc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT; + desc.MiscFlags = 0; + HRESULT hr = dev->CreateQuery(&desc, &query_disjoint); + if (FAILED(hr)) + throw HRError("Failed to create timer", hr); +} + void SavedBlendState::Rebuild(ID3D11Device *dev) { HRESULT hr = dev->CreateBlendState(&bd, &state); @@ -245,8 +269,7 @@ throw HRError("Failed to create rasterizer state", hr); } -const static D3D_FEATURE_LEVEL featureLevels[] = -{ +const static D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, @@ -267,34 +290,40 @@ while (obj) { switch (obj->obj_type) { case gs_type::gs_vertex_buffer: - ((gs_vertex_buffer*)obj)->Release(); + ((gs_vertex_buffer *)obj)->Release(); break; case gs_type::gs_index_buffer: - ((gs_index_buffer*)obj)->Release(); + ((gs_index_buffer *)obj)->Release(); break; case gs_type::gs_texture_2d: - ((gs_texture_2d*)obj)->Release(); + ((gs_texture_2d *)obj)->Release(); break; case gs_type::gs_zstencil_buffer: - ((gs_zstencil_buffer*)obj)->Release(); + ((gs_zstencil_buffer *)obj)->Release(); break; case gs_type::gs_stage_surface: - ((gs_stage_surface*)obj)->Release(); + ((gs_stage_surface *)obj)->Release(); break; case gs_type::gs_sampler_state: - ((gs_sampler_state*)obj)->Release(); + ((gs_sampler_state *)obj)->Release(); break; case gs_type::gs_vertex_shader: - ((gs_vertex_shader*)obj)->Release(); + ((gs_vertex_shader *)obj)->Release(); break; case gs_type::gs_pixel_shader: - ((gs_pixel_shader*)obj)->Release(); + ((gs_pixel_shader *)obj)->Release(); break; case gs_type::gs_duplicator: - ((gs_duplicator*)obj)->Release(); + ((gs_duplicator *)obj)->Release(); break; case gs_type::gs_swap_chain: - ((gs_swap_chain*)obj)->Release(); + ((gs_swap_chain *)obj)->Release(); + break; + case gs_type::gs_timer: + ((gs_timer *)obj)->Release(); + break; + case gs_type::gs_timer_range: + ((gs_timer_range *)obj)->Release(); break; } @@ -320,10 +349,11 @@ InitFactory(adpIdx); uint32_t createFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT; - hr = D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, - nullptr, createFlags, featureLevels, - sizeof(featureLevels) / sizeof(D3D_FEATURE_LEVEL), - D3D11_SDK_VERSION, &device, nullptr, &context); + hr = D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, + createFlags, featureLevels, + sizeof(featureLevels) / + sizeof(D3D_FEATURE_LEVEL), + D3D11_SDK_VERSION, &device, nullptr, &context); if (FAILED(hr)) throw HRError("Failed to create device", hr); @@ -333,45 +363,49 @@ while (obj) { switch (obj->obj_type) { case gs_type::gs_vertex_buffer: - ((gs_vertex_buffer*)obj)->Rebuild(); + ((gs_vertex_buffer *)obj)->Rebuild(); break; case gs_type::gs_index_buffer: - ((gs_index_buffer*)obj)->Rebuild(dev); + ((gs_index_buffer *)obj)->Rebuild(dev); break; - case gs_type::gs_texture_2d: - { - gs_texture_2d *tex = (gs_texture_2d*)obj; - if (!tex->nv12) { - tex->Rebuild(dev); - } else if (!tex->chroma) { - tex->RebuildNV12_Y(dev); - } + case gs_type::gs_texture_2d: { + gs_texture_2d *tex = (gs_texture_2d *)obj; + if (!tex->nv12) { + tex->Rebuild(dev); + } else if (!tex->chroma) { + tex->RebuildNV12_Y(dev); } - break; + } break; case gs_type::gs_zstencil_buffer: - ((gs_zstencil_buffer*)obj)->Rebuild(dev); + ((gs_zstencil_buffer *)obj)->Rebuild(dev); break; case gs_type::gs_stage_surface: - ((gs_stage_surface*)obj)->Rebuild(dev); + ((gs_stage_surface *)obj)->Rebuild(dev); break; case gs_type::gs_sampler_state: - ((gs_sampler_state*)obj)->Rebuild(dev); + ((gs_sampler_state *)obj)->Rebuild(dev); break; case gs_type::gs_vertex_shader: - ((gs_vertex_shader*)obj)->Rebuild(dev); + ((gs_vertex_shader *)obj)->Rebuild(dev); break; case gs_type::gs_pixel_shader: - ((gs_pixel_shader*)obj)->Rebuild(dev); + ((gs_pixel_shader *)obj)->Rebuild(dev); break; case gs_type::gs_duplicator: try { - ((gs_duplicator*)obj)->Start(); + ((gs_duplicator *)obj)->Start(); } catch (...) { - ((gs_duplicator*)obj)->Release(); + ((gs_duplicator *)obj)->Release(); } break; case gs_type::gs_swap_chain: - ((gs_swap_chain*)obj)->Rebuild(dev); + ((gs_swap_chain *)obj)->Rebuild(dev); + break; + case gs_type::gs_timer: + ((gs_timer *)obj)->Rebuild(dev); + break; + case gs_type::gs_timer_range: + ((gs_timer_range *)obj)->Rebuild(dev); break; } @@ -406,7 +440,6 @@ } catch (const char *error) { bcrash("Failed to recreate D3D11: %s", error); -} catch (HRError error) { - bcrash("Failed to recreate D3D11: %s (%08lX)", - error.str, error.hr); +} catch (const HRError &error) { + bcrash("Failed to recreate D3D11: %s (%08lX)", error.str, error.hr); }
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-samplerstate.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-samplerstate.cpp
Changed
@@ -20,21 +20,26 @@ #include "d3d11-subsystem.hpp" -static inline D3D11_TEXTURE_ADDRESS_MODE ConvertGSAddressMode( - gs_address_mode mode) +static inline D3D11_TEXTURE_ADDRESS_MODE +ConvertGSAddressMode(gs_address_mode mode) { switch (mode) { - case GS_ADDRESS_WRAP: return D3D11_TEXTURE_ADDRESS_WRAP; - case GS_ADDRESS_CLAMP: return D3D11_TEXTURE_ADDRESS_CLAMP; - case GS_ADDRESS_MIRROR: return D3D11_TEXTURE_ADDRESS_MIRROR; - case GS_ADDRESS_BORDER: return D3D11_TEXTURE_ADDRESS_BORDER; - case GS_ADDRESS_MIRRORONCE: return D3D11_TEXTURE_ADDRESS_MIRROR_ONCE; + case GS_ADDRESS_WRAP: + return D3D11_TEXTURE_ADDRESS_WRAP; + case GS_ADDRESS_CLAMP: + return D3D11_TEXTURE_ADDRESS_CLAMP; + case GS_ADDRESS_MIRROR: + return D3D11_TEXTURE_ADDRESS_MIRROR; + case GS_ADDRESS_BORDER: + return D3D11_TEXTURE_ADDRESS_BORDER; + case GS_ADDRESS_MIRRORONCE: + return D3D11_TEXTURE_ADDRESS_MIRROR_ONCE; } return D3D11_TEXTURE_ADDRESS_WRAP; } -static inline D3D11_FILTER ConvertGSFilter( gs_sample_filter filter) +static inline D3D11_FILTER ConvertGSFilter(gs_sample_filter filter) { switch (filter) { case GS_FILTER_POINT: @@ -61,21 +66,20 @@ } gs_sampler_state::gs_sampler_state(gs_device_t *device, - const gs_sampler_info *info) - : gs_obj (device, gs_type::gs_sampler_state), - info (*info) + const gs_sampler_info *info) + : gs_obj(device, gs_type::gs_sampler_state), info(*info) { HRESULT hr; vec4 v4; memset(&sd, 0, sizeof(sd)); - sd.AddressU = ConvertGSAddressMode(info->address_u); - sd.AddressV = ConvertGSAddressMode(info->address_v); - sd.AddressW = ConvertGSAddressMode(info->address_w); + sd.AddressU = ConvertGSAddressMode(info->address_u); + sd.AddressV = ConvertGSAddressMode(info->address_v); + sd.AddressW = ConvertGSAddressMode(info->address_w); sd.ComparisonFunc = D3D11_COMPARISON_ALWAYS; - sd.Filter = ConvertGSFilter(info->filter); - sd.MaxAnisotropy = info->max_anisotropy; - sd.MaxLOD = FLT_MAX; + sd.Filter = ConvertGSFilter(info->filter); + sd.MaxAnisotropy = info->max_anisotropy; + sd.MaxLOD = FLT_MAX; vec4_from_rgba(&v4, info->border_color); memcpy(sd.BorderColor, v4.ptr, sizeof(v4));
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-shader.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-shader.cpp
Changed
@@ -23,7 +23,7 @@ #include <graphics/matrix4.h> void gs_vertex_shader::GetBuffersExpected( - const vector<D3D11_INPUT_ELEMENT_DESC> &inputs) + const vector<D3D11_INPUT_ELEMENT_DESC> &inputs) { for (size_t i = 0; i < inputs.size(); i++) { const D3D11_INPUT_ELEMENT_DESC &input = inputs[i]; @@ -39,17 +39,17 @@ } gs_vertex_shader::gs_vertex_shader(gs_device_t *device, const char *file, - const char *shaderString) - : gs_shader (device, gs_type::gs_vertex_shader, GS_SHADER_VERTEX), - hasNormals (false), - hasColors (false), - hasTangents (false), - nTexUnits (0) + const char *shaderString) + : gs_shader(device, gs_type::gs_vertex_shader, GS_SHADER_VERTEX), + hasNormals(false), + hasColors(false), + hasTangents(false), + nTexUnits(0) { - ShaderProcessor processor(device); + ShaderProcessor processor(device); ComPtr<ID3D10Blob> shaderBlob; - string outputString; - HRESULT hr; + string outputString; + HRESULT hr; processor.Process(shaderString, file); processor.BuildString(outputString); @@ -63,29 +63,33 @@ data.resize(shaderBlob->GetBufferSize()); memcpy(&data[0], shaderBlob->GetBufferPointer(), data.size()); - hr = device->device->CreateVertexShader(data.data(), data.size(), - NULL, shader.Assign()); + hr = device->device->CreateVertexShader(data.data(), data.size(), NULL, + shader.Assign()); if (FAILED(hr)) throw HRError("Failed to create vertex shader", hr); - hr = device->device->CreateInputLayout(layoutData.data(), - (UINT)layoutData.size(), - data.data(), data.size(), layout.Assign()); - if (FAILED(hr)) - throw HRError("Failed to create input layout", hr); + const UINT layoutSize = (UINT)layoutData.size(); + if (layoutSize > 0) { + hr = device->device->CreateInputLayout(layoutData.data(), + (UINT)layoutSize, + data.data(), data.size(), + layout.Assign()); + if (FAILED(hr)) + throw HRError("Failed to create input layout", hr); + } viewProj = gs_shader_get_param_by_name(this, "ViewProj"); - world = gs_shader_get_param_by_name(this, "World"); + world = gs_shader_get_param_by_name(this, "World"); } gs_pixel_shader::gs_pixel_shader(gs_device_t *device, const char *file, - const char *shaderString) + const char *shaderString) : gs_shader(device, gs_type::gs_pixel_shader, GS_SHADER_PIXEL) { - ShaderProcessor processor(device); + ShaderProcessor processor(device); ComPtr<ID3D10Blob> shaderBlob; - string outputString; - HRESULT hr; + string outputString; + HRESULT hr; processor.Process(shaderString, file); processor.BuildString(outputString); @@ -98,8 +102,8 @@ data.resize(shaderBlob->GetBufferSize()); memcpy(&data[0], shaderBlob->GetBufferPointer(), data.size()); - hr = device->device->CreatePixelShader(data.data(), data.size(), - NULL, shader.Assign()); + hr = device->device->CreatePixelShader(data.data(), data.size(), NULL, + shader.Assign()); if (FAILED(hr)) throw HRError("Failed to create pixel shader", hr); } @@ -131,20 +135,28 @@ { for (size_t i = 0; i < params.size(); i++) { gs_shader_param ¶m = params[i]; - size_t size = 0; + size_t size = 0; switch (param.type) { case GS_SHADER_PARAM_BOOL: case GS_SHADER_PARAM_INT: - case GS_SHADER_PARAM_FLOAT: size = sizeof(float); break; + case GS_SHADER_PARAM_FLOAT: + size = sizeof(float); + break; case GS_SHADER_PARAM_INT2: - case GS_SHADER_PARAM_VEC2: size = sizeof(vec2); break; + case GS_SHADER_PARAM_VEC2: + size = sizeof(vec2); + break; case GS_SHADER_PARAM_INT3: - case GS_SHADER_PARAM_VEC3: size = sizeof(float)*3; break; + case GS_SHADER_PARAM_VEC3: + size = sizeof(float) * 3; + break; case GS_SHADER_PARAM_INT4: - case GS_SHADER_PARAM_VEC4: size = sizeof(vec4); break; + case GS_SHADER_PARAM_VEC4: + size = sizeof(vec4); + break; case GS_SHADER_PARAM_MATRIX4X4: - size = sizeof(float)*4*4; + size = sizeof(float) * 4 * 4; break; case GS_SHADER_PARAM_TEXTURE: case GS_SHADER_PARAM_STRING: @@ -164,7 +176,7 @@ constantSize = alignMax; } - param.pos = constantSize; + param.pos = constantSize; constantSize += size; } @@ -173,13 +185,13 @@ if (constantSize) { HRESULT hr; - bd.ByteWidth = (constantSize+15)&0xFFFFFFF0; /* align */ - bd.Usage = D3D11_USAGE_DYNAMIC; - bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + bd.ByteWidth = (constantSize + 15) & 0xFFFFFFF0; /* align */ + bd.Usage = D3D11_USAGE_DYNAMIC; + bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER; bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; hr = device->device->CreateBuffer(&bd, NULL, - constants.Assign()); + constants.Assign()); if (FAILED(hr)) throw HRError("Failed to create constant buffer", hr); } @@ -189,7 +201,7 @@ } void gs_shader::Compile(const char *shaderString, const char *file, - const char *target, ID3D10Blob **shader) + const char *target, ID3D10Blob **shader) { ComPtr<ID3D10Blob> errorsBlob; HRESULT hr; @@ -198,9 +210,9 @@ throw "No shader string specified"; hr = device->d3dCompile(shaderString, strlen(shaderString), file, NULL, - NULL, "main", target, - D3D10_SHADER_OPTIMIZATION_LEVEL1, 0, - shader, errorsBlob.Assign()); + NULL, "main", target, + D3D10_SHADER_OPTIMIZATION_LEVEL1, 0, shader, + errorsBlob.Assign()); if (FAILED(hr)) { if (errorsBlob != NULL && errorsBlob->GetBufferSize()) throw ShaderError(errorsBlob, hr); @@ -215,18 +227,19 @@ return; hr = device->d3dDisassemble((*shader)->GetBufferPointer(), - (*shader)->GetBufferSize(), 0, nullptr, &asmBlob); + (*shader)->GetBufferSize(), 0, nullptr, + &asmBlob); if (SUCCEEDED(hr) && !!asmBlob && asmBlob->GetBufferSize()) { blog(LOG_INFO, "============================================="); - blog(LOG_INFO, "Disassembly output for shader '%s':\n%s", - file, asmBlob->GetBufferPointer()); + blog(LOG_INFO, "Disassembly output for shader '%s':\n%s", file, + asmBlob->GetBufferPointer()); } #endif } inline void gs_shader::UpdateParam(vector<uint8_t> &constData, - gs_shader_param ¶m, bool &upload) + gs_shader_param ¶m, bool &upload) { if (param.type != GS_SHADER_PARAM_TEXTURE) { if (!param.curValue.size()) @@ -235,30 +248,29 @@ /* padding in case the constant needs to start at a new * register */ if (param.pos > constData.size()) { - uint8_t zero = 0; + uint8_t zero = 0; constData.insert(constData.end(), - param.pos - constData.size(), zero); + param.pos - constData.size(), zero); } - constData.insert(constData.end(), - param.curValue.begin(), - param.curValue.end()); + constData.insert(constData.end(), param.curValue.begin(), + param.curValue.end()); if (param.changed) { upload = true; param.changed = false; } - } else if (param.curValue.size() == sizeof(gs_texture_t*)) { + } else if (param.curValue.size() == sizeof(gs_texture_t *)) { gs_texture_t *tex; - memcpy(&tex, param.curValue.data(), sizeof(gs_texture_t*)); + memcpy(&tex, param.curValue.data(), sizeof(gs_texture_t *)); device_load_texture(device, tex, param.textureID); if (param.nextSampler) { ID3D11SamplerState *state = param.nextSampler->state; device->context->PSSetSamplers(param.textureID, 1, - &state); + &state); param.nextSampler = nullptr; } } @@ -267,7 +279,7 @@ void gs_shader::UploadParams() { vector<uint8_t> constData; - bool upload = false; + bool upload = false; constData.reserve(constantSize); @@ -282,7 +294,7 @@ HRESULT hr; hr = device->context->Map(constants, 0, D3D11_MAP_WRITE_DISCARD, - 0, &map); + 0, &map); if (FAILED(hr)) throw HRError("Could not lock constant buffer", hr); @@ -324,7 +336,7 @@ if (shader->type != GS_SHADER_VERTEX) return NULL; - return static_cast<const gs_vertex_shader*>(shader)->viewProj; + return static_cast<const gs_vertex_shader *>(shader)->viewProj; } gs_sparam_t *gs_shader_get_world_matrix(const gs_shader_t *shader) @@ -332,11 +344,11 @@ if (shader->type != GS_SHADER_VERTEX) return NULL; - return static_cast<const gs_vertex_shader*>(shader)->world; + return static_cast<const gs_vertex_shader *>(shader)->world; } void gs_shader_get_param_info(const gs_sparam_t *param, - struct gs_shader_param_info *info) + struct gs_shader_param_info *info) { if (!param) return; @@ -346,7 +358,7 @@ } static inline void shader_setval_inline(gs_shader_param *param, - const void *data, size_t size) + const void *data, size_t size) { assert(param); if (!param) @@ -407,7 +419,7 @@ void gs_shader_set_texture(gs_sparam_t *param, gs_texture_t *val) { - shader_setval_inline(param, &val, sizeof(gs_texture_t*)); + shader_setval_inline(param, &val, sizeof(gs_texture_t *)); } void gs_shader_set_val(gs_sparam_t *param, const void *val, size_t size) @@ -419,7 +431,7 @@ { if (param->defaultValue.size()) shader_setval_inline(param, param->defaultValue.data(), - param->defaultValue.size()); + param->defaultValue.size()); } void gs_shader_set_next_sampler(gs_sparam_t *param, gs_samplerstate_t *sampler)
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-shaderprocessor.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-shaderprocessor.cpp
Changed
@@ -21,14 +21,14 @@ #include <sstream> using namespace std; -static const char *semanticInputNames[] = - {"POSITION", "NORMAL", "COLOR", "TANGENT", "TEXCOORD"}; -static const char *semanticOutputNames[] = - {"SV_Position", "NORMAL", "COLOR", "TANGENT", "TEXCOORD"}; +static const char *semanticInputNames[] = {"POSITION", "NORMAL", "COLOR", + "TANGENT", "TEXCOORD", "VERTEXID"}; +static const char *semanticOutputNames[] = { + "SV_Position", "NORMAL", "COLOR", "TANGENT", "TEXCOORD", "VERTEXID"}; static const char *ConvertSemanticName(const char *name) { - const size_t num = sizeof(semanticInputNames) / sizeof(const char*); + const size_t num = sizeof(semanticInputNames) / sizeof(const char *); for (size_t i = 0; i < num; i++) { if (strcmp(name, semanticInputNames[i]) == 0) return semanticOutputNames[i]; @@ -37,8 +37,7 @@ throw "Unknown Semantic Name"; } -static void GetSemanticInfo(shader_var *var, const char *&name, - uint32_t &index) +static void GetSemanticInfo(shader_var *var, const char *&name, uint32_t &index) { const char *mapping = var->mapping; const char *indexStr = mapping; @@ -48,12 +47,12 @@ index = (*indexStr) ? strtol(indexStr, NULL, 10) : 0; string nameStr; - nameStr.assign(mapping, indexStr-mapping); + nameStr.assign(mapping, indexStr - mapping); name = ConvertSemanticName(nameStr.c_str()); } static void AddInputLayoutVar(shader_var *var, - vector<D3D11_INPUT_ELEMENT_DESC> &layout) + vector<D3D11_INPUT_ELEMENT_DESC> &layout) { D3D11_INPUT_ELEMENT_DESC ied; const char *semanticName; @@ -62,25 +61,31 @@ GetSemanticInfo(var, semanticName, semanticIndex); memset(&ied, 0, sizeof(ied)); - ied.SemanticName = semanticName; - ied.SemanticIndex = semanticIndex; + ied.SemanticName = semanticName; + ied.SemanticIndex = semanticIndex; ied.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA; if (strcmp(var->mapping, "COLOR") == 0) { ied.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - } else if (strcmp(var->mapping, "POSITION") == 0 || - strcmp(var->mapping, "NORMAL") == 0 || - strcmp(var->mapping, "TANGENT") == 0) { + } else if (strcmp(var->mapping, "POSITION") == 0 || + strcmp(var->mapping, "NORMAL") == 0 || + strcmp(var->mapping, "TANGENT") == 0) { ied.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; } else if (astrcmp_n(var->mapping, "TEXCOORD", 8) == 0) { /* type is always a 'float' type */ switch (var->type[5]) { - case 0: ied.Format = DXGI_FORMAT_R32_FLOAT; break; - case '2': ied.Format = DXGI_FORMAT_R32G32_FLOAT; break; + case 0: + ied.Format = DXGI_FORMAT_R32_FLOAT; + break; + case '2': + ied.Format = DXGI_FORMAT_R32G32_FLOAT; + break; case '3': - case '4': ied.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; break; + case '4': + ied.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; + break; } } @@ -88,7 +93,7 @@ } static inline bool SetSlot(vector<D3D11_INPUT_ELEMENT_DESC> &layout, - const char *name, uint32_t index, uint32_t &slotIdx) + const char *name, uint32_t index, uint32_t &slotIdx) { for (size_t i = 0; i < layout.size(); i++) { D3D11_INPUT_ELEMENT_DESC &input = layout[i]; @@ -103,21 +108,22 @@ } static void BuildInputLayoutFromVars(shader_parser *parser, darray *vars, - vector<D3D11_INPUT_ELEMENT_DESC> &layout) + vector<D3D11_INPUT_ELEMENT_DESC> &layout) { - shader_var *array = (shader_var*)vars->array; + shader_var *array = (shader_var *)vars->array; for (size_t i = 0; i < vars->num; i++) { - shader_var *var = array+i; + shader_var *var = array + i; if (var->mapping) { - AddInputLayoutVar(var, layout); + if (strcmp(var->mapping, "VERTEXID") != 0) + AddInputLayoutVar(var, layout); } else { - shader_struct *st = shader_parser_getstruct(parser, - var->type); + shader_struct *st = + shader_parser_getstruct(parser, var->type); if (st) BuildInputLayoutFromVars(parser, &st->vars.da, - layout); + layout); } } @@ -133,11 +139,11 @@ SetSlot(layout, "TANGENT", 0, slot); uint32_t index = 0; - while (SetSlot(layout, "TEXCOORD", index++, slot)); + while (SetSlot(layout, "TEXCOORD", index++, slot)) + ; } -void ShaderProcessor::BuildInputLayout( - vector<D3D11_INPUT_ELEMENT_DESC> &layout) +void ShaderProcessor::BuildInputLayout(vector<D3D11_INPUT_ELEMENT_DESC> &layout) { shader_func *func = shader_parser_getfunc(&parser, "main"); if (!func) @@ -147,11 +153,11 @@ } gs_shader_param::gs_shader_param(shader_var &var, uint32_t &texCounter) - : name (var.name), - type (get_shader_param_type(var.type)), - textureID (texCounter), - arrayCount (var.array_count), - changed (false) + : name(var.name), + type(get_shader_param_type(var.type)), + textureID(texCounter), + arrayCount(var.array_count), + changed(false) { defaultValue.resize(var.default_val.num); memcpy(defaultValue.data(), var.default_val.array, var.default_val.num); @@ -163,7 +169,7 @@ } static inline void AddParam(shader_var &var, vector<gs_shader_param> ¶ms, - uint32_t &texCounter) + uint32_t &texCounter) { if (var.var_type != SHADER_VAR_UNIFORM || strcmp(var.type, "sampler") == 0) @@ -181,7 +187,7 @@ } static inline void AddSampler(gs_device_t *device, shader_sampler &sampler, - vector<unique_ptr<ShaderSampler>> &samplers) + vector<unique_ptr<ShaderSampler>> &samplers) { gs_sampler_info si; shader_sampler_convert(&sampler, &si); @@ -197,6 +203,8 @@ void ShaderProcessor::BuildString(string &outputString) { stringstream output; + output << "static const bool obs_glsl_compile = false;\n\n"; + cf_token *token = cf_preprocessor_get_tokens(&parser.cfp.pp); while (token->type != CFTOKEN_NONE) { /* cheaply just replace specific tokens */ @@ -214,6 +222,8 @@ throw "texture_rect is not supported in D3D"; else if (strref_cmp(&token->str, "sampler_state") == 0) output << "SamplerState"; + else if (strref_cmp(&token->str, "VERTEXID") == 0) + output << "SV_VertexID"; else output.write(token->str.array, token->str.len);
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-shaderprocessor.hpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-shaderprocessor.hpp
Changed
@@ -20,8 +20,8 @@ #include <graphics/shader-parser.h> struct ShaderParser : shader_parser { - inline ShaderParser() {shader_parser_init(this);} - inline ~ShaderParser() {shader_parser_free(this);} + inline ShaderParser() { shader_parser_init(this); } + inline ~ShaderParser() { shader_parser_free(this); } }; struct ShaderProcessor { @@ -34,7 +34,5 @@ void BuildString(string &outputString); void Process(const char *shader_string, const char *file); - inline ShaderProcessor(gs_device_t *device) : device(device) - { - } + inline ShaderProcessor(gs_device_t *device) : device(device) {} };
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-stagesurf.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-stagesurf.cpp
Changed
@@ -18,24 +18,24 @@ #include "d3d11-subsystem.hpp" gs_stage_surface::gs_stage_surface(gs_device_t *device, uint32_t width, - uint32_t height, gs_color_format colorFormat) - : gs_obj (device, gs_type::gs_stage_surface), - width (width), - height (height), - format (colorFormat), - dxgiFormat (ConvertGSTextureFormat(colorFormat)) + uint32_t height, gs_color_format colorFormat) + : gs_obj(device, gs_type::gs_stage_surface), + width(width), + height(height), + format(colorFormat), + dxgiFormat(ConvertGSTextureFormat(colorFormat)) { HRESULT hr; memset(&td, 0, sizeof(td)); - td.Width = width; - td.Height = height; - td.MipLevels = 1; - td.ArraySize = 1; - td.Format = dxgiFormat; + td.Width = width; + td.Height = height; + td.MipLevels = 1; + td.ArraySize = 1; + td.Format = dxgiFormat; td.SampleDesc.Count = 1; - td.CPUAccessFlags = D3D11_CPU_ACCESS_READ; - td.Usage = D3D11_USAGE_STAGING; + td.CPUAccessFlags = D3D11_CPU_ACCESS_READ; + td.Usage = D3D11_USAGE_STAGING; hr = device->device->CreateTexture2D(&td, NULL, texture.Assign()); if (FAILED(hr)) @@ -43,24 +43,24 @@ } gs_stage_surface::gs_stage_surface(gs_device_t *device, uint32_t width, - uint32_t height) - : gs_obj (device, gs_type::gs_stage_surface), - width (width), - height (height), - format (GS_UNKNOWN), - dxgiFormat (DXGI_FORMAT_NV12) + uint32_t height) + : gs_obj(device, gs_type::gs_stage_surface), + width(width), + height(height), + format(GS_UNKNOWN), + dxgiFormat(DXGI_FORMAT_NV12) { HRESULT hr; memset(&td, 0, sizeof(td)); - td.Width = width; - td.Height = height; - td.MipLevels = 1; - td.ArraySize = 1; - td.Format = dxgiFormat; + td.Width = width; + td.Height = height; + td.MipLevels = 1; + td.ArraySize = 1; + td.Format = dxgiFormat; td.SampleDesc.Count = 1; - td.CPUAccessFlags = D3D11_CPU_ACCESS_READ; - td.Usage = D3D11_USAGE_STAGING; + td.CPUAccessFlags = D3D11_CPU_ACCESS_READ; + td.Usage = D3D11_USAGE_STAGING; hr = device->device->CreateTexture2D(&td, NULL, texture.Assign()); if (FAILED(hr))
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-subsystem.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-subsystem.cpp
Changed
@@ -33,26 +33,27 @@ #ifdef _MSC_VER /* alignment warning - despite the fact that alignment is already fixed */ -#pragma warning (disable : 4316) +#pragma warning(disable : 4316) #endif static inline void LogD3D11ErrorDetails(HRError error, gs_device_t *device) { if (error.hr == DXGI_ERROR_DEVICE_REMOVED) { HRESULT DeviceRemovedReason = - device->device->GetDeviceRemovedReason(); + device->device->GetDeviceRemovedReason(); blog(LOG_ERROR, " Device Removed Reason: %08lX", - DeviceRemovedReason); + DeviceRemovedReason); } } -static const IID dxgiFactory2 = -{0x50c83a1c, 0xe072, 0x4c48, {0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0}}; +static const IID dxgiFactory2 = {0x50c83a1c, + 0xe072, + 0x4c48, + {0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, + 0xd0}}; - -gs_obj::gs_obj(gs_device_t *device_, gs_type type) : - device (device_), - obj_type (type) +gs_obj::gs_obj(gs_device_t *device_, gs_type type) + : device(device_), obj_type(type) { prev_next = &device->first_obj; next = device->first_obj; @@ -70,40 +71,40 @@ } static inline void make_swap_desc(DXGI_SWAP_CHAIN_DESC &desc, - const gs_init_data *data) + const gs_init_data *data) { memset(&desc, 0, sizeof(desc)); - desc.BufferCount = data->num_backbuffers; + desc.BufferCount = data->num_backbuffers; desc.BufferDesc.Format = ConvertGSTextureFormat(data->format); - desc.BufferDesc.Width = data->cx; + desc.BufferDesc.Width = data->cx; desc.BufferDesc.Height = data->cy; - desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - desc.OutputWindow = (HWND)data->window.hwnd; - desc.SampleDesc.Count = 1; - desc.Windowed = true; + desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + desc.OutputWindow = (HWND)data->window.hwnd; + desc.SampleDesc.Count = 1; + desc.Windowed = true; } void gs_swap_chain::InitTarget(uint32_t cx, uint32_t cy) { HRESULT hr; - target.width = cx; + target.width = cx; target.height = cy; hr = swap->GetBuffer(0, __uuidof(ID3D11Texture2D), - (void**)target.texture.Assign()); + (void **)target.texture.Assign()); if (FAILED(hr)) throw HRError("Failed to get swap buffer texture", hr); - hr = device->device->CreateRenderTargetView(target.texture, NULL, - target.renderTarget[0].Assign()); + hr = device->device->CreateRenderTargetView( + target.texture, NULL, target.renderTarget[0].Assign()); if (FAILED(hr)) throw HRError("Failed to create swap render target view", hr); } void gs_swap_chain::InitZStencilBuffer(uint32_t cx, uint32_t cy) { - zs.width = cx; + zs.width = cx; zs.height = cy; if (zs.format != GS_ZS_NONE && cx != 0 && cy != 0) { @@ -129,8 +130,10 @@ if (cx == 0 || cy == 0) { GetClientRect(hwnd, &clientRect); - if (cx == 0) cx = clientRect.right; - if (cy == 0) cy = clientRect.bottom; + if (cx == 0) + cx = clientRect.right; + if (cy == 0) + cy = clientRect.bottom; } hr = swap->ResizeBuffers(numBuffers, cx, cy, target.dxgiFormat, 0); @@ -143,29 +146,29 @@ void gs_swap_chain::Init() { - target.device = device; + target.device = device; target.isRenderTarget = true; - target.format = initData.format; - target.dxgiFormat = ConvertGSTextureFormat(initData.format); + target.format = initData.format; + target.dxgiFormat = ConvertGSTextureFormat(initData.format); InitTarget(initData.cx, initData.cy); - zs.device = device; - zs.format = initData.zsformat; + zs.device = device; + zs.format = initData.zsformat; zs.dxgiFormat = ConvertGSZStencilFormat(initData.zsformat); InitZStencilBuffer(initData.cx, initData.cy); } gs_swap_chain::gs_swap_chain(gs_device *device, const gs_init_data *data) - : gs_obj (device, gs_type::gs_swap_chain), - numBuffers (data->num_backbuffers), - hwnd ((HWND)data->window.hwnd), - initData (*data) + : gs_obj(device, gs_type::gs_swap_chain), + numBuffers(data->num_backbuffers), + hwnd((HWND)data->window.hwnd), + initData(*data) { HRESULT hr; make_swap_desc(swapDesc, data); hr = device->factory->CreateSwapChain(device->device, &swapDesc, - swap.Assign()); + swap.Assign()); if (FAILED(hr)) throw HRError("Failed to create swap chain", hr); @@ -186,11 +189,11 @@ HMODULE module = LoadLibraryA(d3dcompiler); if (module) { d3dCompile = (pD3DCompile)GetProcAddress(module, - "D3DCompile"); + "D3DCompile"); #ifdef DISASSEMBLE_SHADERS d3dDisassemble = (pD3DDisassemble)GetProcAddress( - module, "D3DDisassemble"); + module, "D3DDisassemble"); #endif if (d3dCompile) { return; @@ -203,17 +206,17 @@ } throw "Could not find any D3DCompiler libraries. Make sure you've " - "installed the <a href=\"https://obsproject.com/go/dxwebsetup\">" - "DirectX components</a> that OBS Studio requires."; + "installed the <a href=\"https://obsproject.com/go/dxwebsetup\">" + "DirectX components</a> that OBS Studio requires."; } void gs_device::InitFactory(uint32_t adapterIdx) { HRESULT hr; - IID factoryIID = (GetWinVer() >= 0x602) ? dxgiFactory2 : - __uuidof(IDXGIFactory1); + IID factoryIID = (GetWinVer() >= 0x602) ? dxgiFactory2 + : __uuidof(IDXGIFactory1); - hr = CreateDXGIFactory1(factoryIID, (void**)factory.Assign()); + hr = CreateDXGIFactory1(factoryIID, (void **)factory.Assign()); if (FAILED(hr)) throw UnsupportedHWError("Failed to create DXGIFactory", hr); @@ -222,8 +225,7 @@ throw UnsupportedHWError("Failed to enumerate DXGIAdapter", hr); } -const static D3D_FEATURE_LEVEL featureLevels[] = -{ +const static D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, @@ -232,24 +234,28 @@ /* ------------------------------------------------------------------------- */ -#define VERT_IN_OUT "\ +#define VERT_IN_OUT \ + "\ struct VertInOut { \ float4 pos : POSITION; \ }; " -#define NV12_Y_PS VERT_IN_OUT "\ +#define NV12_Y_PS \ + VERT_IN_OUT "\ float main(VertInOut vert_in) : TARGET \ { \ return 1.0; \ }" -#define NV12_UV_PS VERT_IN_OUT "\ +#define NV12_UV_PS \ + VERT_IN_OUT "\ float2 main(VertInOut vert_in) : TARGET \ { \ return float2(1.0, 1.0); \ }" -#define NV12_VS VERT_IN_OUT "\ +#define NV12_VS \ + VERT_IN_OUT "\ VertInOut main(VertInOut vert_in) \ { \ VertInOut vert_out; \ @@ -266,23 +272,23 @@ try { vec3 points[4]; vec3_set(&points[0], -1.0f, -1.0f, 0.0f); - vec3_set(&points[1], -1.0f, 1.0f, 0.0f); - vec3_set(&points[2], 1.0f, -1.0f, 0.0f); - vec3_set(&points[3], 1.0f, 1.0f, 0.0f); + vec3_set(&points[1], -1.0f, 1.0f, 0.0f); + vec3_set(&points[2], 1.0f, -1.0f, 0.0f); + vec3_set(&points[3], 1.0f, 1.0f, 0.0f); gs_texture_2d nv12_y(this, NV12_CX, NV12_CY, GS_R8, 1, nullptr, - GS_RENDER_TARGET | GS_SHARED_KM_TEX, GS_TEXTURE_2D, - false, true); + GS_RENDER_TARGET | GS_SHARED_KM_TEX, GS_TEXTURE_2D, + false, true); gs_texture_2d nv12_uv(this, nv12_y.texture, - GS_RENDER_TARGET | GS_SHARED_KM_TEX); + GS_RENDER_TARGET | GS_SHARED_KM_TEX); gs_vertex_shader nv12_vs(this, "", NV12_VS); gs_pixel_shader nv12_y_ps(this, "", NV12_Y_PS); gs_pixel_shader nv12_uv_ps(this, "", NV12_UV_PS); gs_stage_surface nv12_stage(this, NV12_CX, NV12_CY); gs_vb_data *vbd = gs_vbdata_create(); - vbd->num = 4; - vbd->points = (vec3*)bmemdup(&points, sizeof(points)); + vbd->num = 4; + vbd->points = (vec3 *)bmemdup(&points, sizeof(points)); gs_vertex_buffer buf(this, vbd, 0); @@ -304,7 +310,7 @@ UpdateZStencilState(); context->Draw(4, 0); - device_set_viewport(this, 0, 0, NV12_CX/2, NV12_CY/2); + device_set_viewport(this, 0, 0, NV12_CX / 2, NV12_CY / 2); device_set_render_target(this, &nv12_uv, nullptr); device_load_pixelshader(this, &nv12_uv_ps); UpdateBlendState(); @@ -313,6 +319,7 @@ context->Draw(4, 0); device_load_pixelshader(this, nullptr); + device_load_vertexbuffer(this, nullptr); device_load_vertexshader(this, nullptr); device_set_render_target(this, nullptr, nullptr); @@ -335,9 +342,9 @@ } return bad_driver; -} catch (HRError error) { - blog(LOG_WARNING, "HasBadNV12Output failed: %s (%08lX)", - error.str, error.hr); +} catch (const HRError &error) { + blog(LOG_WARNING, "HasBadNV12Output failed: %s (%08lX)", error.str, + error.hr); return false; } catch (const char *error) { blog(LOG_WARNING, "HasBadNV12Output failed: %s", error); @@ -358,30 +365,36 @@ //createFlags |= D3D11_CREATE_DEVICE_DEBUG; #endif - adapterName = (adapter->GetDesc(&desc) == S_OK) ? desc.Description : - L"<unknown>"; + adapterName = (adapter->GetDesc(&desc) == S_OK) ? desc.Description + : L"<unknown>"; BPtr<char> adapterNameUTF8; os_wcs_to_utf8_ptr(adapterName.c_str(), 0, &adapterNameUTF8); blog(LOG_INFO, "Loading up D3D11 on adapter %s (%" PRIu32 ")", - adapterNameUTF8.Get(), adapterIdx); - - hr = D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, - NULL, createFlags, featureLevels, - sizeof(featureLevels) / sizeof(D3D_FEATURE_LEVEL), - D3D11_SDK_VERSION, device.Assign(), - &levelUsed, context.Assign()); + adapterNameUTF8.Get(), adapterIdx); + + hr = D3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, + createFlags, featureLevels, + sizeof(featureLevels) / + sizeof(D3D_FEATURE_LEVEL), + D3D11_SDK_VERSION, device.Assign(), &levelUsed, + context.Assign()); if (FAILED(hr)) throw UnsupportedHWError("Failed to create device", hr); - blog(LOG_INFO, "D3D11 loaded successfully, feature level used: %u", - (unsigned int)levelUsed); + blog(LOG_INFO, "D3D11 loaded successfully, feature level used: %x", + (unsigned int)levelUsed); /* ---------------------------------------- */ /* check for nv12 texture output support */ nv12Supported = false; + /* Intel CopyResource is very slow with NV12 */ + if (desc.VendorId == 0x8086) { + return; + } + ComQIPtr<ID3D11Device1> d3d11_1(device); if (!d3d11_1) { return; @@ -389,18 +402,15 @@ /* needs to support extended resource sharing */ D3D11_FEATURE_DATA_D3D11_OPTIONS opts = {}; - hr = d3d11_1->CheckFeatureSupport( - D3D11_FEATURE_D3D11_OPTIONS, - &opts, sizeof(opts)); + hr = d3d11_1->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &opts, + sizeof(opts)); if (FAILED(hr) || !opts.ExtendedResourceSharing) { return; } /* needs to support the actual format */ UINT support = 0; - hr = device->CheckFormatSupport( - DXGI_FORMAT_NV12, - &support); + hr = device->CheckFormatSupport(DXGI_FORMAT_NV12, &support); if (FAILED(hr)) { return; } @@ -422,12 +432,12 @@ } static inline void ConvertStencilSide(D3D11_DEPTH_STENCILOP_DESC &desc, - const StencilSide &side) + const StencilSide &side) { - desc.StencilFunc = ConvertGSDepthTest(side.test); - desc.StencilFailOp = ConvertGSStencilOp(side.fail); + desc.StencilFunc = ConvertGSDepthTest(side.test); + desc.StencilFailOp = ConvertGSStencilOp(side.fail); desc.StencilDepthFailOp = ConvertGSStencilOp(side.zfail); - desc.StencilPassOp = ConvertGSStencilOp(side.zpass); + desc.StencilPassOp = ConvertGSStencilOp(side.zpass); } ID3D11DepthStencilState *gs_device::AddZStencilState() @@ -436,16 +446,18 @@ D3D11_DEPTH_STENCIL_DESC dsd; ID3D11DepthStencilState *state; - dsd.DepthEnable = zstencilState.depthEnabled; - dsd.DepthFunc = ConvertGSDepthTest(zstencilState.depthFunc); - dsd.DepthWriteMask = zstencilState.depthWriteEnabled ? - D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO; - dsd.StencilEnable = zstencilState.stencilEnabled; - dsd.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; - dsd.StencilWriteMask = zstencilState.stencilWriteEnabled ? - D3D11_DEFAULT_STENCIL_WRITE_MASK : 0; + dsd.DepthEnable = zstencilState.depthEnabled; + dsd.DepthFunc = ConvertGSDepthTest(zstencilState.depthFunc); + dsd.DepthWriteMask = zstencilState.depthWriteEnabled + ? D3D11_DEPTH_WRITE_MASK_ALL + : D3D11_DEPTH_WRITE_MASK_ZERO; + dsd.StencilEnable = zstencilState.stencilEnabled; + dsd.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; + dsd.StencilWriteMask = zstencilState.stencilWriteEnabled + ? D3D11_DEFAULT_STENCIL_WRITE_MASK + : 0; ConvertStencilSide(dsd.FrontFace, zstencilState.stencilFront); - ConvertStencilSide(dsd.BackFace, zstencilState.stencilBack); + ConvertStencilSide(dsd.BackFace, zstencilState.stencilBack); SavedZStencilState savedState(zstencilState, dsd); hr = device->CreateDepthStencilState(&dsd, savedState.state.Assign()); @@ -467,10 +479,10 @@ memset(&rd, 0, sizeof(rd)); /* use CCW to convert to a right-handed coordinate system */ rd.FrontCounterClockwise = true; - rd.FillMode = D3D11_FILL_SOLID; - rd.CullMode = ConvertGSCullMode(rasterState.cullMode); - rd.DepthClipEnable = true; - rd.ScissorEnable = rasterState.scissorEnabled; + rd.FillMode = D3D11_FILL_SOLID; + rd.CullMode = ConvertGSCullMode(rasterState.cullMode); + rd.DepthClipEnable = true; + rd.ScissorEnable = rasterState.scissorEnabled; SavedRasterState savedState(rasterState, rd); hr = device->CreateRasterizerState(&rd, savedState.state.Assign()); @@ -491,9 +503,9 @@ memset(&bd, 0, sizeof(bd)); for (int i = 0; i < 8; i++) { - bd.RenderTarget[i].BlendEnable = blendState.blendEnabled; - bd.RenderTarget[i].BlendOp = D3D11_BLEND_OP_ADD; - bd.RenderTarget[i].BlendOpAlpha = D3D11_BLEND_OP_ADD; + bd.RenderTarget[i].BlendEnable = blendState.blendEnabled; + bd.RenderTarget[i].BlendOp = D3D11_BLEND_OP_ADD; + bd.RenderTarget[i].BlendOpAlpha = D3D11_BLEND_OP_ADD; bd.RenderTarget[i].SrcBlend = ConvertGSBlendType(blendState.srcFactorC); bd.RenderTarget[i].DestBlend = @@ -503,10 +515,16 @@ bd.RenderTarget[i].DestBlendAlpha = ConvertGSBlendType(blendState.destFactorA); bd.RenderTarget[i].RenderTargetWriteMask = - (blendState.redEnabled ? D3D11_COLOR_WRITE_ENABLE_RED : 0) | - (blendState.greenEnabled ? D3D11_COLOR_WRITE_ENABLE_GREEN : 0) | - (blendState.blueEnabled ? D3D11_COLOR_WRITE_ENABLE_BLUE : 0) | - (blendState.alphaEnabled ? D3D11_COLOR_WRITE_ENABLE_ALPHA : 0) ; + (blendState.redEnabled ? D3D11_COLOR_WRITE_ENABLE_RED + : 0) | + (blendState.greenEnabled + ? D3D11_COLOR_WRITE_ENABLE_GREEN + : 0) | + (blendState.blueEnabled ? D3D11_COLOR_WRITE_ENABLE_BLUE + : 0) | + (blendState.alphaEnabled + ? D3D11_COLOR_WRITE_ENABLE_ALPHA + : 0); } SavedBlendState savedState(blendState, bd); @@ -614,11 +632,11 @@ if (curVertexShader->viewProj) gs_shader_set_matrix4(curVertexShader->viewProj, - &curViewProjMatrix); + &curViewProjMatrix); } gs_device::gs_device(uint32_t adapterIdx) - : curToplogy (D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED) + : curToplogy(D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED) { matrix4_identity(&curProjMatrix); matrix4_identity(&curViewMatrix); @@ -657,19 +675,18 @@ return "_D3D11"; } -static inline void EnumD3DAdapters( - bool (*callback)(void*, const char*, uint32_t), - void *param) +static inline void +EnumD3DAdapters(bool (*callback)(void *, const char *, uint32_t), void *param) { ComPtr<IDXGIFactory1> factory; ComPtr<IDXGIAdapter1> adapter; HRESULT hr; UINT i; - IID factoryIID = (GetWinVer() >= 0x602) ? dxgiFactory2 : - __uuidof(IDXGIFactory1); + IID factoryIID = (GetWinVer() >= 0x602) ? dxgiFactory2 + : __uuidof(IDXGIFactory1); - hr = CreateDXGIFactory1(factoryIID, (void**)factory.Assign()); + hr = CreateDXGIFactory1(factoryIID, (void **)factory.Assign()); if (FAILED(hr)) throw HRError("Failed to create DXGIFactory", hr); @@ -692,17 +709,17 @@ } } -bool device_enum_adapters( - bool (*callback)(void *param, const char *name, uint32_t id), - void *param) +bool device_enum_adapters(bool (*callback)(void *param, const char *name, + uint32_t id), + void *param) { try { EnumD3DAdapters(callback, param); return true; - } catch (HRError error) { + } catch (const HRError &error) { blog(LOG_WARNING, "Failed enumerating devices: %s (%08lX)", - error.str, error.hr); + error.str, error.hr); return false; } } @@ -718,14 +735,14 @@ continue; RECT rect = desc.DesktopCoordinates; - blog(LOG_INFO, "\t output %u: " - "pos={%d, %d}, " - "size={%d, %d}, " - "attached=%s", - i, - rect.left, rect.top, - rect.right - rect.left, rect.bottom - rect.top, - desc.AttachedToDesktop ? "true" : "false"); + blog(LOG_INFO, + "\t output %u: " + "pos={%d, %d}, " + "size={%d, %d}, " + "attached=%s", + i, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, + desc.AttachedToDesktop ? "true" : "false"); } } @@ -738,10 +755,10 @@ blog(LOG_INFO, "Available Video Adapters: "); - IID factoryIID = (GetWinVer() >= 0x602) ? dxgiFactory2 : - __uuidof(IDXGIFactory1); + IID factoryIID = (GetWinVer() >= 0x602) ? dxgiFactory2 + : __uuidof(IDXGIFactory1); - hr = CreateDXGIFactory1(factoryIID, (void**)factory.Assign()); + hr = CreateDXGIFactory1(factoryIID, (void **)factory.Assign()); if (FAILED(hr)) throw HRError("Failed to create DXGIFactory", hr); @@ -760,9 +777,9 @@ os_wcs_to_utf8(desc.Description, 0, name, sizeof(name)); blog(LOG_INFO, "\tAdapter %u: %s", i, name); blog(LOG_INFO, "\t Dedicated VRAM: %u", - desc.DedicatedVideoMemory); + desc.DedicatedVideoMemory); blog(LOG_INFO, "\t Shared VRAM: %u", - desc.SharedSystemMemory); + desc.SharedSystemMemory); LogAdapterMonitors(adapter); } @@ -780,14 +797,14 @@ device = new gs_device(adapter); - } catch (UnsupportedHWError error) { + } catch (const UnsupportedHWError &error) { blog(LOG_ERROR, "device_create (D3D11): %s (%08lX)", error.str, - error.hr); + error.hr); errorcode = GS_ERROR_NOT_SUPPORTED; - } catch (HRError error) { + } catch (const HRError &error) { blog(LOG_ERROR, "device_create (D3D11): %s (%08lX)", error.str, - error.hr); + error.hr); errorcode = GS_ERROR_FAIL; } @@ -812,16 +829,21 @@ UNUSED_PARAMETER(device); } +void *device_get_device_obj(gs_device_t *device) +{ + return (void *)device->device.Get(); +} + gs_swapchain_t *device_swapchain_create(gs_device_t *device, - const struct gs_init_data *data) + const struct gs_init_data *data) { gs_swap_chain *swap = NULL; try { swap = new gs_swap_chain(device, data); - } catch (HRError error) { + } catch (const HRError &error) { blog(LOG_ERROR, "device_swapchain_create (D3D11): %s (%08lX)", - error.str, error.hr); + error.str, error.hr); LogD3D11ErrorDetails(error, device); } @@ -837,7 +859,7 @@ try { ID3D11RenderTargetView *renderView = NULL; - ID3D11DepthStencilView *depthView = NULL; + ID3D11DepthStencilView *depthView = NULL; int i = device->curRenderSide; device->context->OMSetRenderTargets(1, &renderView, depthView); @@ -846,12 +868,12 @@ if (device->curRenderTarget) renderView = device->curRenderTarget->renderTarget[i]; if (device->curZStencilBuffer) - depthView = device->curZStencilBuffer->view; + depthView = device->curZStencilBuffer->view; device->context->OMSetRenderTargets(1, &renderView, depthView); - } catch (HRError error) { - blog(LOG_ERROR, "device_resize (D3D11): %s (%08lX)", - error.str, error.hr); + } catch (const HRError &error) { + blog(LOG_ERROR, "device_resize (D3D11): %s (%08lX)", error.str, + error.hr); LogD3D11ErrorDetails(error, device); } } @@ -889,16 +911,19 @@ } gs_texture_t *device_texture_create(gs_device_t *device, uint32_t width, - uint32_t height, enum gs_color_format color_format, - uint32_t levels, const uint8_t **data, uint32_t flags) + uint32_t height, + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags) { gs_texture *texture = NULL; try { texture = new gs_texture_2d(device, width, height, color_format, - levels, data, flags, GS_TEXTURE_2D, false); - } catch (HRError error) { + levels, data, flags, GS_TEXTURE_2D, + false); + } catch (const HRError &error) { blog(LOG_ERROR, "device_texture_create (D3D11): %s (%08lX)", - error.str, error.hr); + error.str, error.hr); LogD3D11ErrorDetails(error, device); } catch (const char *error) { blog(LOG_ERROR, "device_texture_create (D3D11): %s", error); @@ -908,30 +933,33 @@ } gs_texture_t *device_cubetexture_create(gs_device_t *device, uint32_t size, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags) + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags) { gs_texture *texture = NULL; try { texture = new gs_texture_2d(device, size, size, color_format, - levels, data, flags, GS_TEXTURE_CUBE, false); - } catch (HRError error) { - blog(LOG_ERROR, "device_cubetexture_create (D3D11): %s " - "(%08lX)", - error.str, error.hr); + levels, data, flags, + GS_TEXTURE_CUBE, false); + } catch (const HRError &error) { + blog(LOG_ERROR, + "device_cubetexture_create (D3D11): %s " + "(%08lX)", + error.str, error.hr); LogD3D11ErrorDetails(error, device); } catch (const char *error) { - blog(LOG_ERROR, "device_cubetexture_create (D3D11): %s", - error); + blog(LOG_ERROR, "device_cubetexture_create (D3D11): %s", error); } return texture; } gs_texture_t *device_voltexture_create(gs_device_t *device, uint32_t width, - uint32_t height, uint32_t depth, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags) + uint32_t height, uint32_t depth, + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags) { /* TODO */ UNUSED_PARAMETER(device); @@ -946,15 +974,16 @@ } gs_zstencil_t *device_zstencil_create(gs_device_t *device, uint32_t width, - uint32_t height, enum gs_zstencil_format format) + uint32_t height, + enum gs_zstencil_format format) { gs_zstencil_buffer *zstencil = NULL; try { - zstencil = new gs_zstencil_buffer(device, width, height, - format); - } catch (HRError error) { + zstencil = + new gs_zstencil_buffer(device, width, height, format); + } catch (const HRError &error) { blog(LOG_ERROR, "device_zstencil_create (D3D11): %s (%08lX)", - error.str, error.hr); + error.str, error.hr); LogD3D11ErrorDetails(error, device); } @@ -962,32 +991,36 @@ } gs_stagesurf_t *device_stagesurface_create(gs_device_t *device, uint32_t width, - uint32_t height, enum gs_color_format color_format) + uint32_t height, + enum gs_color_format color_format) { gs_stage_surface *surf = NULL; try { surf = new gs_stage_surface(device, width, height, - color_format); - } catch (HRError error) { - blog(LOG_ERROR, "device_stagesurface_create (D3D11): %s " - "(%08lX)", - error.str, error.hr); + color_format); + } catch (const HRError &error) { + blog(LOG_ERROR, + "device_stagesurface_create (D3D11): %s " + "(%08lX)", + error.str, error.hr); LogD3D11ErrorDetails(error, device); } return surf; } -gs_samplerstate_t *device_samplerstate_create(gs_device_t *device, - const struct gs_sampler_info *info) +gs_samplerstate_t * +device_samplerstate_create(gs_device_t *device, + const struct gs_sampler_info *info) { gs_sampler_state *ss = NULL; try { ss = new gs_sampler_state(device, info); - } catch (HRError error) { - blog(LOG_ERROR, "device_samplerstate_create (D3D11): %s " - "(%08lX)", - error.str, error.hr); + } catch (const HRError &error) { + blog(LOG_ERROR, + "device_samplerstate_create (D3D11): %s " + "(%08lX)", + error.str, error.hr); LogD3D11ErrorDetails(error, device); } @@ -995,100 +1028,136 @@ } gs_shader_t *device_vertexshader_create(gs_device_t *device, - const char *shader_string, const char *file, - char **error_string) + const char *shader_string, + const char *file, char **error_string) { gs_vertex_shader *shader = NULL; try { shader = new gs_vertex_shader(device, file, shader_string); - } catch (HRError error) { - blog(LOG_ERROR, "device_vertexshader_create (D3D11): %s " - "(%08lX)", - error.str, error.hr); + } catch (const HRError &error) { + blog(LOG_ERROR, + "device_vertexshader_create (D3D11): %s " + "(%08lX)", + error.str, error.hr); LogD3D11ErrorDetails(error, device); - } catch (ShaderError error) { - const char *buf = (const char*)error.errors->GetBufferPointer(); + } catch (const ShaderError &error) { + const char *buf = + (const char *)error.errors->GetBufferPointer(); if (error_string) *error_string = bstrdup(buf); - blog(LOG_ERROR, "device_vertexshader_create (D3D11): " - "Compile warnings/errors for %s:\n%s", - file, buf); + blog(LOG_ERROR, + "device_vertexshader_create (D3D11): " + "Compile warnings/errors for %s:\n%s", + file, buf); } catch (const char *error) { blog(LOG_ERROR, "device_vertexshader_create (D3D11): %s", - error); + error); } return shader; } gs_shader_t *device_pixelshader_create(gs_device_t *device, - const char *shader_string, const char *file, - char **error_string) + const char *shader_string, + const char *file, char **error_string) { gs_pixel_shader *shader = NULL; try { shader = new gs_pixel_shader(device, file, shader_string); - } catch (HRError error) { - blog(LOG_ERROR, "device_pixelshader_create (D3D11): %s " - "(%08lX)", - error.str, error.hr); + } catch (const HRError &error) { + blog(LOG_ERROR, + "device_pixelshader_create (D3D11): %s " + "(%08lX)", + error.str, error.hr); LogD3D11ErrorDetails(error, device); - } catch (ShaderError error) { - const char *buf = (const char*)error.errors->GetBufferPointer(); + } catch (const ShaderError &error) { + const char *buf = + (const char *)error.errors->GetBufferPointer(); if (error_string) *error_string = bstrdup(buf); - blog(LOG_ERROR, "device_pixelshader_create (D3D11): " - "Compiler warnings/errors for %s:\n%s", - file, buf); + blog(LOG_ERROR, + "device_pixelshader_create (D3D11): " + "Compiler warnings/errors for %s:\n%s", + file, buf); } catch (const char *error) { - blog(LOG_ERROR, "device_pixelshader_create (D3D11): %s", - error); + blog(LOG_ERROR, "device_pixelshader_create (D3D11): %s", error); } return shader; } gs_vertbuffer_t *device_vertexbuffer_create(gs_device_t *device, - struct gs_vb_data *data, uint32_t flags) + struct gs_vb_data *data, + uint32_t flags) { gs_vertex_buffer *buffer = NULL; try { buffer = new gs_vertex_buffer(device, data, flags); - } catch (HRError error) { - blog(LOG_ERROR, "device_vertexbuffer_create (D3D11): %s " - "(%08lX)", - error.str, error.hr); + } catch (const HRError &error) { + blog(LOG_ERROR, + "device_vertexbuffer_create (D3D11): %s " + "(%08lX)", + error.str, error.hr); LogD3D11ErrorDetails(error, device); } catch (const char *error) { blog(LOG_ERROR, "device_vertexbuffer_create (D3D11): %s", - error); + error); } return buffer; } gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device, - enum gs_index_type type, void *indices, size_t num, - uint32_t flags) + enum gs_index_type type, + void *indices, size_t num, + uint32_t flags) { gs_index_buffer *buffer = NULL; try { buffer = new gs_index_buffer(device, type, indices, num, flags); - } catch (HRError error) { + } catch (const HRError &error) { blog(LOG_ERROR, "device_indexbuffer_create (D3D11): %s (%08lX)", - error.str, error.hr); + error.str, error.hr); LogD3D11ErrorDetails(error, device); } return buffer; } +gs_timer_t *device_timer_create(gs_device_t *device) +{ + gs_timer *timer = NULL; + try { + timer = new gs_timer(device); + } catch (const HRError &error) { + blog(LOG_ERROR, "device_timer_create (D3D11): %s (%08lX)", + error.str, error.hr); + LogD3D11ErrorDetails(error, device); + } + + return timer; +} + +gs_timer_range_t *device_timer_range_create(gs_device_t *device) +{ + gs_timer_range *range = NULL; + try { + range = new gs_timer_range(device); + } catch (const HRError &error) { + blog(LOG_ERROR, "device_timer_range_create (D3D11): %s (%08lX)", + error.str, error.hr); + LogD3D11ErrorDetails(error, device); + } + + return range; +} + enum gs_texture_type device_get_texture_type(const gs_texture_t *texture) { return texture->type; @@ -1100,23 +1169,24 @@ curVertexShader == lastVertexShader) return; - vector<ID3D11Buffer*> buffers; + vector<ID3D11Buffer *> buffers; vector<uint32_t> strides; vector<uint32_t> offsets; if (curVertexBuffer && curVertexShader) { - curVertexBuffer->MakeBufferList(curVertexShader, - buffers, strides); + curVertexBuffer->MakeBufferList(curVertexShader, buffers, + strides); } else { - size_t buffersToClear = curVertexShader - ? curVertexShader->NumBuffersExpected() : 0; + size_t buffersToClear = + curVertexShader ? curVertexShader->NumBuffersExpected() + : 0; buffers.resize(buffersToClear); strides.resize(buffersToClear); } offsets.resize(buffers.size()); - context->IASetVertexBuffers(0, (UINT)buffers.size(), - buffers.data(), strides.data(), offsets.data()); + context->IASetVertexBuffers(0, (UINT)buffers.size(), buffers.data(), + strides.data(), offsets.data()); lastVertexBuffer = curVertexBuffer; lastVertexShader = curVertexShader; @@ -1140,9 +1210,13 @@ if (indexbuffer) { switch (indexbuffer->indexSize) { - case 2: format = DXGI_FORMAT_R16_UINT; break; + case 2: + format = DXGI_FORMAT_R16_UINT; + break; default: - case 4: format = DXGI_FORMAT_R32_UINT; break; + case 4: + format = DXGI_FORMAT_R32_UINT; + break; } buffer = indexbuffer->indexBuffer; @@ -1170,7 +1244,7 @@ } void device_load_samplerstate(gs_device_t *device, - gs_samplerstate_t *samplerstate, int unit) + gs_samplerstate_t *samplerstate, int unit) { ID3D11SamplerState *state = NULL; @@ -1186,25 +1260,25 @@ void device_load_vertexshader(gs_device_t *device, gs_shader_t *vertshader) { - ID3D11VertexShader *shader = NULL; - ID3D11InputLayout *layout = NULL; - ID3D11Buffer *constants = NULL; + ID3D11VertexShader *shader = NULL; + ID3D11InputLayout *layout = NULL; + ID3D11Buffer *constants = NULL; if (device->curVertexShader == vertshader) return; - gs_vertex_shader *vs = static_cast<gs_vertex_shader*>(vertshader); + gs_vertex_shader *vs = static_cast<gs_vertex_shader *>(vertshader); if (vertshader) { if (vertshader->type != GS_SHADER_VERTEX) { blog(LOG_ERROR, "device_load_vertexshader (D3D11): " - "Specified shader is not a vertex " - "shader"); + "Specified shader is not a vertex " + "shader"); return; } - shader = vs->shader; - layout = vs->layout; + shader = vs->shader; + layout = vs->layout; constants = vs->constants; } @@ -1217,31 +1291,31 @@ static inline void clear_textures(gs_device_t *device) { ID3D11ShaderResourceView *views[GS_MAX_TEXTURES]; - memset(views, 0, sizeof(views)); + memset(views, 0, sizeof(views)); memset(device->curTextures, 0, sizeof(device->curTextures)); device->context->PSSetShaderResources(0, GS_MAX_TEXTURES, views); } void device_load_pixelshader(gs_device_t *device, gs_shader_t *pixelshader) { - ID3D11PixelShader *shader = NULL; - ID3D11Buffer *constants = NULL; + ID3D11PixelShader *shader = NULL; + ID3D11Buffer *constants = NULL; ID3D11SamplerState *states[GS_MAX_TEXTURES]; if (device->curPixelShader == pixelshader) return; - gs_pixel_shader *ps = static_cast<gs_pixel_shader*>(pixelshader); + gs_pixel_shader *ps = static_cast<gs_pixel_shader *>(pixelshader); if (pixelshader) { if (pixelshader->type != GS_SHADER_PIXEL) { blog(LOG_ERROR, "device_load_pixelshader (D3D11): " - "Specified shader is not a pixel " - "shader"); + "Specified shader is not a pixel " + "shader"); return; } - shader = ps->shader; + shader = ps->shader; constants = ps->constants; ps->GetSamplerStates(states); } else { @@ -1257,7 +1331,7 @@ for (int i = 0; i < GS_MAX_TEXTURES; i++) if (device->curSamplers[i] && - device->curSamplers[i]->state != states[i]) + device->curSamplers[i]->state != states[i]) device->curSamplers[i] = nullptr; } @@ -1296,7 +1370,7 @@ } void device_set_render_target(gs_device_t *device, gs_texture_t *tex, - gs_zstencil_t *zstencil) + gs_zstencil_t *zstencil) { if (device->curSwapChain) { if (!tex) @@ -1305,34 +1379,35 @@ zstencil = &device->curSwapChain->zs; } - if (device->curRenderTarget == tex && + if (device->curRenderTarget == tex && device->curZStencilBuffer == zstencil) return; if (tex && tex->type != GS_TEXTURE_2D) { blog(LOG_ERROR, "device_set_render_target (D3D11): " - "texture is not a 2D texture"); + "texture is not a 2D texture"); return; } - gs_texture_2d *tex2d = static_cast<gs_texture_2d*>(tex); + gs_texture_2d *tex2d = static_cast<gs_texture_2d *>(tex); if (tex2d && !tex2d->renderTarget[0]) { blog(LOG_ERROR, "device_set_render_target (D3D11): " - "texture is not a render target"); + "texture is not a render target"); return; } - ID3D11RenderTargetView *rt = tex2d ? tex2d->renderTarget[0] : nullptr; + ID3D11RenderTargetView *rt = tex2d ? tex2d->renderTarget[0].Get() + : nullptr; - device->curRenderTarget = tex2d; - device->curRenderSide = 0; + device->curRenderTarget = tex2d; + device->curRenderSide = 0; device->curZStencilBuffer = zstencil; - device->context->OMSetRenderTargets(1, &rt, - zstencil ? zstencil->view : nullptr); + device->context->OMSetRenderTargets( + 1, &rt, zstencil ? zstencil->view : nullptr); } void device_set_cube_render_target(gs_device_t *device, gs_texture_t *tex, - int side, gs_zstencil_t *zstencil) + int side, gs_zstencil_t *zstencil) { if (device->curSwapChain) { if (!tex) { @@ -1344,18 +1419,17 @@ zstencil = &device->curSwapChain->zs; } - if (device->curRenderTarget == tex && - device->curRenderSide == side && + if (device->curRenderTarget == tex && device->curRenderSide == side && device->curZStencilBuffer == zstencil) return; if (tex->type != GS_TEXTURE_CUBE) { blog(LOG_ERROR, "device_set_cube_render_target (D3D11): " - "texture is not a cube texture"); + "texture is not a cube texture"); return; } - gs_texture_2d *tex2d = static_cast<gs_texture_2d*>(tex); + gs_texture_2d *tex2d = static_cast<gs_texture_2d *>(tex); if (!tex2d->renderTarget[side]) { blog(LOG_ERROR, "device_set_cube_render_target (D3D11): " "texture is not a render target"); @@ -1364,24 +1438,23 @@ ID3D11RenderTargetView *rt = tex2d->renderTarget[0]; - device->curRenderTarget = tex2d; - device->curRenderSide = side; + device->curRenderTarget = tex2d; + device->curRenderSide = side; device->curZStencilBuffer = zstencil; device->context->OMSetRenderTargets(1, &rt, zstencil->view); } -inline void gs_device::CopyTex(ID3D11Texture2D *dst, - uint32_t dst_x, uint32_t dst_y, - gs_texture_t *src, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h) +inline void gs_device::CopyTex(ID3D11Texture2D *dst, uint32_t dst_x, + uint32_t dst_y, gs_texture_t *src, + uint32_t src_x, uint32_t src_y, uint32_t src_w, + uint32_t src_h) { if (src->type != GS_TEXTURE_2D) throw "Source texture must be a 2D texture"; - gs_texture_2d *tex2d = static_cast<gs_texture_2d*>(src); + gs_texture_2d *tex2d = static_cast<gs_texture_2d *>(src); - if (dst_x == 0 && dst_y == 0 && - src_x == 0 && src_y == 0 && + if (dst_x == 0 && dst_y == 0 && src_x == 0 && src_y == 0 && src_w == 0 && src_h == 0) { context->CopyResource(dst, tex2d->texture); } else { @@ -1403,18 +1476,18 @@ sbox.back = 1; context->CopySubresourceRegion(dst, 0, dst_x, dst_y, 0, - tex2d->texture, 0, &sbox); + tex2d->texture, 0, &sbox); } } -void device_copy_texture_region(gs_device_t *device, - gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y, - gs_texture_t *src, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h) +void device_copy_texture_region(gs_device_t *device, gs_texture_t *dst, + uint32_t dst_x, uint32_t dst_y, + gs_texture_t *src, uint32_t src_x, + uint32_t src_y, uint32_t src_w, uint32_t src_h) { try { - gs_texture_2d *src2d = static_cast<gs_texture_2d*>(src); - gs_texture_2d *dst2d = static_cast<gs_texture_2d*>(dst); + gs_texture_2d *src2d = static_cast<gs_texture_2d *>(src); + gs_texture_2d *dst2d = static_cast<gs_texture_2d *>(dst); if (!src) throw "Source texture is NULL"; @@ -1429,44 +1502,43 @@ /* apparently casting to the same type that the variable * already exists as is supposed to prevent some warning * when used with the conditional operator? */ - uint32_t copyWidth = (uint32_t)src_w ? - (uint32_t)src_w : (src2d->width - src_x); - uint32_t copyHeight = (uint32_t)src_h ? - (uint32_t)src_h : (src2d->height - src_y); + uint32_t copyWidth = (uint32_t)src_w ? (uint32_t)src_w + : (src2d->width - src_x); + uint32_t copyHeight = (uint32_t)src_h ? (uint32_t)src_h + : (src2d->height - src_y); - uint32_t dstWidth = dst2d->width - dst_x; + uint32_t dstWidth = dst2d->width - dst_x; uint32_t dstHeight = dst2d->height - dst_y; if (dstWidth < copyWidth || dstHeight < copyHeight) throw "Destination texture region is not big " "enough to hold the source region"; - if (dst_x == 0 && dst_y == 0 && - src_x == 0 && src_y == 0 && + if (dst_x == 0 && dst_y == 0 && src_x == 0 && src_y == 0 && src_w == 0 && src_h == 0) { - copyWidth = 0; + copyWidth = 0; copyHeight = 0; } - device->CopyTex(dst2d->texture, dst_x, dst_y, - src, src_x, src_y, copyWidth, copyHeight); + device->CopyTex(dst2d->texture, dst_x, dst_y, src, src_x, src_y, + copyWidth, copyHeight); - } catch(const char *error) { + } catch (const char *error) { blog(LOG_ERROR, "device_copy_texture (D3D11): %s", error); } } void device_copy_texture(gs_device_t *device, gs_texture_t *dst, - gs_texture_t *src) + gs_texture_t *src) { device_copy_texture_region(device, dst, 0, 0, src, 0, 0, 0, 0); } void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst, - gs_texture_t *src) + gs_texture_t *src) { try { - gs_texture_2d *src2d = static_cast<gs_texture_2d*>(src); + gs_texture_2d *src2d = static_cast<gs_texture_2d *>(src); if (!src) throw "Source texture is NULL"; @@ -1476,8 +1548,7 @@ throw "Destination surface is NULL"; if (dst->format != GS_UNKNOWN && dst->format != src->format) throw "Source and destination formats do not match"; - if (dst->width != src2d->width || - dst->height != src2d->height) + if (dst->width != src2d->width || dst->height != src2d->height) throw "Source and destination must have the same " "dimensions"; @@ -1494,7 +1565,7 @@ } void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode, - uint32_t start_vert, uint32_t num_verts) + uint32_t start_vert, uint32_t num_verts) { try { if (!device->curVertexShader) @@ -1503,7 +1574,7 @@ if (!device->curPixelShader) throw "No pixel shader specified"; - if (!device->curVertexBuffer) + if (!device->curVertexBuffer && (num_verts == 0)) throw "No vertex buffer specified"; if (!device->curSwapChain && !device->curRenderTarget) @@ -1525,9 +1596,9 @@ blog(LOG_ERROR, "device_draw (D3D11): %s", error); return; - } catch (HRError error) { + } catch (const HRError &error) { blog(LOG_ERROR, "device_draw (D3D11): %s (%08lX)", error.str, - error.hr); + error.hr); LogD3D11ErrorDetails(error, device); return; } @@ -1557,10 +1628,12 @@ void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swapchain) { - gs_texture_t *target = device->curRenderTarget; - gs_zstencil_t *zs = device->curZStencilBuffer; - bool is_cube = device->curRenderTarget ? - (device->curRenderTarget->type == GS_TEXTURE_CUBE) : false; + gs_texture_t *target = device->curRenderTarget; + gs_zstencil_t *zs = device->curZStencilBuffer; + bool is_cube = + device->curRenderTarget + ? (device->curRenderTarget->type == GS_TEXTURE_CUBE) + : false; if (device->curSwapChain) { if (target == &device->curSwapChain->target) @@ -1573,19 +1646,19 @@ if (is_cube) device_set_cube_render_target(device, target, - device->curRenderSide, zs); + device->curRenderSide, zs); else device_set_render_target(device, target, zs); } void device_clear(gs_device_t *device, uint32_t clear_flags, - const struct vec4 *color, float depth, uint8_t stencil) + const struct vec4 *color, float depth, uint8_t stencil) { int side = device->curRenderSide; if ((clear_flags & GS_CLEAR_COLOR) != 0 && device->curRenderTarget) device->context->ClearRenderTargetView( - device->curRenderTarget->renderTarget[side], - color->ptr); + device->curRenderTarget->renderTarget[side], + color->ptr); if (device->curZStencilBuffer) { uint32_t flags = 0; @@ -1596,8 +1669,8 @@ if (flags && device->curZStencilBuffer->view) device->context->ClearDepthStencilView( - device->curZStencilBuffer->view, - flags, depth, stencil); + device->curZStencilBuffer->view, flags, depth, + stencil); } } @@ -1674,53 +1747,55 @@ device->zstencilStateChanged = true; } -void device_enable_color(gs_device_t *device, bool red, bool green, - bool blue, bool alpha) +void device_enable_color(gs_device_t *device, bool red, bool green, bool blue, + bool alpha) { - if (device->blendState.redEnabled == red && + if (device->blendState.redEnabled == red && device->blendState.greenEnabled == green && - device->blendState.blueEnabled == blue && + device->blendState.blueEnabled == blue && device->blendState.alphaEnabled == alpha) return; - device->blendState.redEnabled = red; + device->blendState.redEnabled = red; device->blendState.greenEnabled = green; - device->blendState.blueEnabled = blue; + device->blendState.blueEnabled = blue; device->blendState.alphaEnabled = alpha; - device->blendStateChanged = true; + device->blendStateChanged = true; } void device_blend_function(gs_device_t *device, enum gs_blend_type src, - enum gs_blend_type dest) + enum gs_blend_type dest) { - if (device->blendState.srcFactorC == src && + if (device->blendState.srcFactorC == src && device->blendState.destFactorC == dest && - device->blendState.srcFactorA == src && + device->blendState.srcFactorA == src && device->blendState.destFactorA == dest) return; device->blendState.srcFactorC = src; - device->blendState.destFactorC= dest; + device->blendState.destFactorC = dest; device->blendState.srcFactorA = src; - device->blendState.destFactorA= dest; - device->blendStateChanged = true; + device->blendState.destFactorA = dest; + device->blendStateChanged = true; } void device_blend_function_separate(gs_device_t *device, - enum gs_blend_type src_c, enum gs_blend_type dest_c, - enum gs_blend_type src_a, enum gs_blend_type dest_a) + enum gs_blend_type src_c, + enum gs_blend_type dest_c, + enum gs_blend_type src_a, + enum gs_blend_type dest_a) { - if (device->blendState.srcFactorC == src_c && + if (device->blendState.srcFactorC == src_c && device->blendState.destFactorC == dest_c && - device->blendState.srcFactorA == src_a && + device->blendState.srcFactorA == src_a && device->blendState.destFactorA == dest_a) return; - device->blendState.srcFactorC = src_c; + device->blendState.srcFactorC = src_c; device->blendState.destFactorC = dest_c; - device->blendState.srcFactorA = src_a; + device->blendState.srcFactorA = src_a; device->blendState.destFactorA = dest_a; - device->blendStateChanged = true; + device->blendStateChanged = true; } void device_depth_function(gs_device_t *device, enum gs_depth_test test) @@ -1729,11 +1804,12 @@ return; device->zstencilState.depthFunc = test; - device->zstencilStateChanged = true; + device->zstencilStateChanged = true; } static inline void update_stencilside_test(gs_device_t *device, - StencilSide &side, gs_depth_test test) + StencilSide &side, + gs_depth_test test) { if (side.test == test) return; @@ -1743,61 +1819,62 @@ } void device_stencil_function(gs_device_t *device, enum gs_stencil_side side, - enum gs_depth_test test) + enum gs_depth_test test) { int sideVal = (int)side; if (sideVal & GS_STENCIL_FRONT) - update_stencilside_test(device, - device->zstencilState.stencilFront, test); + update_stencilside_test( + device, device->zstencilState.stencilFront, test); if (sideVal & GS_STENCIL_BACK) - update_stencilside_test(device, - device->zstencilState.stencilBack, test); + update_stencilside_test( + device, device->zstencilState.stencilBack, test); } static inline void update_stencilside_op(gs_device_t *device, StencilSide &side, - enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail, - enum gs_stencil_op_type zpass) + enum gs_stencil_op_type fail, + enum gs_stencil_op_type zfail, + enum gs_stencil_op_type zpass) { if (side.fail == fail && side.zfail == zfail && side.zpass == zpass) return; - side.fail = fail; + side.fail = fail; side.zfail = zfail; side.zpass = zpass; device->zstencilStateChanged = true; } void device_stencil_op(gs_device_t *device, enum gs_stencil_side side, - enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail, - enum gs_stencil_op_type zpass) + enum gs_stencil_op_type fail, + enum gs_stencil_op_type zfail, + enum gs_stencil_op_type zpass) { int sideVal = (int)side; if (sideVal & GS_STENCIL_FRONT) update_stencilside_op(device, - device->zstencilState.stencilFront, - fail, zfail, zpass); + device->zstencilState.stencilFront, fail, + zfail, zpass); if (sideVal & GS_STENCIL_BACK) - update_stencilside_op(device, - device->zstencilState.stencilBack, - fail, zfail, zpass); + update_stencilside_op(device, device->zstencilState.stencilBack, + fail, zfail, zpass); } void device_set_viewport(gs_device_t *device, int x, int y, int width, - int height) + int height) { D3D11_VIEWPORT vp; memset(&vp, 0, sizeof(vp)); vp.MaxDepth = 1.0f; vp.TopLeftX = (float)x; vp.TopLeftY = (float)y; - vp.Width = (float)width; - vp.Height = (float)height; + vp.Width = (float)width; + vp.Height = (float)height; device->context->RSSetViewports(1, &vp); - device->viewport.x = x; - device->viewport.y = y; + device->viewport.x = x; + device->viewport.y = y; device->viewport.cx = width; device->viewport.cy = height; } @@ -1814,9 +1891,9 @@ device->rasterState.scissorEnabled = (rect != NULL); if (rect != NULL) { - d3drect.left = rect->x; - d3drect.top = rect->y; - d3drect.right = rect->x + rect->cx; + d3drect.left = rect->x; + d3drect.top = rect->y; + d3drect.right = rect->x + rect->cx; d3drect.bottom = rect->y + rect->cy; device->context->RSSetScissorRects(1, &d3drect); } @@ -1825,54 +1902,54 @@ } void device_ortho(gs_device_t *device, float left, float right, float top, - float bottom, float zNear, float zFar) + float bottom, float zNear, float zFar) { matrix4 *dst = &device->curProjMatrix; - float rml = right-left; - float bmt = bottom-top; - float fmn = zFar-zNear; + float rml = right - left; + float bmt = bottom - top; + float fmn = zFar - zNear; vec4_zero(&dst->x); vec4_zero(&dst->y); vec4_zero(&dst->z); vec4_zero(&dst->t); - dst->x.x = 2.0f / rml; - dst->t.x = (left+right) / -rml; + dst->x.x = 2.0f / rml; + dst->t.x = (left + right) / -rml; - dst->y.y = 2.0f / -bmt; - dst->t.y = (bottom+top) / bmt; + dst->y.y = 2.0f / -bmt; + dst->t.y = (bottom + top) / bmt; - dst->z.z = 1.0f / fmn; - dst->t.z = zNear / -fmn; + dst->z.z = 1.0f / fmn; + dst->t.z = zNear / -fmn; dst->t.w = 1.0f; } void device_frustum(gs_device_t *device, float left, float right, float top, - float bottom, float zNear, float zFar) + float bottom, float zNear, float zFar) { matrix4 *dst = &device->curProjMatrix; - float rml = right-left; - float bmt = bottom-top; - float fmn = zFar-zNear; - float nearx2 = 2.0f*zNear; + float rml = right - left; + float bmt = bottom - top; + float fmn = zFar - zNear; + float nearx2 = 2.0f * zNear; vec4_zero(&dst->x); vec4_zero(&dst->y); vec4_zero(&dst->z); vec4_zero(&dst->t); - dst->x.x = nearx2 / rml; - dst->z.x = (left+right) / -rml; + dst->x.x = nearx2 / rml; + dst->z.x = (left + right) / -rml; - dst->y.y = nearx2 / -bmt; - dst->z.y = (bottom+top) / bmt; + dst->y.y = nearx2 / -bmt; + dst->z.y = (bottom + top) / bmt; - dst->z.z = zFar / fmn; - dst->t.z = (zNear*zFar) / -fmn; + dst->z.z = zFar / fmn; + dst->t.z = (zNear * zFar) / -fmn; dst->z.w = 1.0f; } @@ -1886,14 +1963,11 @@ void device_projection_pop(gs_device_t *device) { - if (!device->projStack.size()) + if (device->projStack.empty()) return; - mat4float *mat = device->projStack.data(); - size_t end = device->projStack.size()-1; - - /* XXX - does anyone know a better way of doing this? */ - memcpy(&device->curProjMatrix, mat+end, sizeof(matrix4)); + const mat4float &mat = device->projStack.back(); + memcpy(&device->curProjMatrix, &mat, sizeof(matrix4)); device->projStack.pop_back(); } @@ -1915,7 +1989,7 @@ if (tex->type != GS_TEXTURE_2D) return 0; - return static_cast<const gs_texture_2d*>(tex)->width; + return static_cast<const gs_texture_2d *>(tex)->width; } uint32_t gs_texture_get_height(const gs_texture_t *tex) @@ -1923,7 +1997,7 @@ if (tex->type != GS_TEXTURE_2D) return 0; - return static_cast<const gs_texture_2d*>(tex)->height; + return static_cast<const gs_texture_2d *>(tex)->height; } enum gs_color_format gs_texture_get_color_format(const gs_texture_t *tex) @@ -1931,7 +2005,7 @@ if (tex->type != GS_TEXTURE_2D) return GS_UNKNOWN; - return static_cast<const gs_texture_2d*>(tex)->format; + return static_cast<const gs_texture_2d *>(tex)->format; } bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr, uint32_t *linesize) @@ -1941,15 +2015,15 @@ if (tex->type != GS_TEXTURE_2D) return false; - gs_texture_2d *tex2d = static_cast<gs_texture_2d*>(tex); + gs_texture_2d *tex2d = static_cast<gs_texture_2d *>(tex); D3D11_MAPPED_SUBRESOURCE map; hr = tex2d->device->context->Map(tex2d->texture, 0, - D3D11_MAP_WRITE_DISCARD, 0, &map); + D3D11_MAP_WRITE_DISCARD, 0, &map); if (FAILED(hr)) return false; - *ptr = (uint8_t*)map.pData; + *ptr = (uint8_t *)map.pData; *linesize = map.RowPitch; return true; } @@ -1959,7 +2033,7 @@ if (tex->type != GS_TEXTURE_2D) return; - gs_texture_2d *tex2d = static_cast<gs_texture_2d*>(tex); + gs_texture_2d *tex2d = static_cast<gs_texture_2d *>(tex); tex2d->device->context->Unmap(tex2d->texture, 0); } @@ -1968,11 +2042,10 @@ if (tex->type != GS_TEXTURE_2D) return nullptr; - gs_texture_2d *tex2d = static_cast<gs_texture_2d*>(tex); + gs_texture_2d *tex2d = static_cast<gs_texture_2d *>(tex); return tex2d->texture.Get(); } - void gs_cubetexture_destroy(gs_texture_t *cubetex) { delete cubetex; @@ -1983,21 +2056,20 @@ if (cubetex->type != GS_TEXTURE_CUBE) return 0; - const gs_texture_2d *tex = static_cast<const gs_texture_2d*>(cubetex); + const gs_texture_2d *tex = static_cast<const gs_texture_2d *>(cubetex); return tex->width; } -enum gs_color_format gs_cubetexture_get_color_format( - const gs_texture_t *cubetex) +enum gs_color_format +gs_cubetexture_get_color_format(const gs_texture_t *cubetex) { if (cubetex->type != GS_TEXTURE_CUBE) return GS_UNKNOWN; - const gs_texture_2d *tex = static_cast<const gs_texture_2d*>(cubetex); + const gs_texture_2d *tex = static_cast<const gs_texture_2d *>(cubetex); return tex->format; } - void gs_voltexture_destroy(gs_texture_t *voltex) { delete voltex; @@ -2031,7 +2103,6 @@ return GS_UNKNOWN; } - void gs_stagesurface_destroy(gs_stagesurf_t *stagesurf) { delete stagesurf; @@ -2047,21 +2118,21 @@ return stagesurf->height; } -enum gs_color_format gs_stagesurface_get_color_format( - const gs_stagesurf_t *stagesurf) +enum gs_color_format +gs_stagesurface_get_color_format(const gs_stagesurf_t *stagesurf) { return stagesurf->format; } bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data, - uint32_t *linesize) + uint32_t *linesize) { D3D11_MAPPED_SUBRESOURCE map; if (FAILED(stagesurf->device->context->Map(stagesurf->texture, 0, - D3D11_MAP_READ, 0, &map))) + D3D11_MAP_READ, 0, &map))) return false; - *data = (uint8_t*)map.pData; + *data = (uint8_t *)map.pData; *linesize = map.RowPitch; return true; } @@ -2071,13 +2142,11 @@ stagesurf->device->context->Unmap(stagesurf->texture, 0); } - void gs_zstencil_destroy(gs_zstencil_t *zstencil) { delete zstencil; } - void gs_samplerstate_destroy(gs_samplerstate_t *samplerstate) { if (!samplerstate) @@ -2086,13 +2155,12 @@ if (samplerstate->device) for (int i = 0; i < GS_MAX_TEXTURES; i++) if (samplerstate->device->curSamplers[i] == - samplerstate) + samplerstate) samplerstate->device->curSamplers[i] = nullptr; delete samplerstate; } - void gs_vertexbuffer_destroy(gs_vertbuffer_t *vertbuffer) { if (vertbuffer && vertbuffer->device->lastVertexBuffer == vertbuffer) @@ -2101,38 +2169,38 @@ } static inline void gs_vertexbuffer_flush_internal(gs_vertbuffer_t *vertbuffer, - const gs_vb_data *data) + const gs_vb_data *data) { size_t num_tex = data->num_tex < vertbuffer->uvBuffers.size() - ? data->num_tex - : vertbuffer->uvBuffers.size(); + ? data->num_tex + : vertbuffer->uvBuffers.size(); if (!vertbuffer->dynamic) { blog(LOG_ERROR, "gs_vertexbuffer_flush: vertex buffer is " - "not dynamic"); + "not dynamic"); return; } if (data->points) - vertbuffer->FlushBuffer(vertbuffer->vertexBuffer, - data->points, sizeof(vec3)); + vertbuffer->FlushBuffer(vertbuffer->vertexBuffer, data->points, + sizeof(vec3)); if (vertbuffer->normalBuffer && data->normals) - vertbuffer->FlushBuffer(vertbuffer->normalBuffer, - data->normals, sizeof(vec3)); + vertbuffer->FlushBuffer(vertbuffer->normalBuffer, data->normals, + sizeof(vec3)); if (vertbuffer->tangentBuffer && data->tangents) vertbuffer->FlushBuffer(vertbuffer->tangentBuffer, - data->tangents, sizeof(vec3)); + data->tangents, sizeof(vec3)); if (vertbuffer->colorBuffer && data->colors) - vertbuffer->FlushBuffer(vertbuffer->colorBuffer, - data->colors, sizeof(uint32_t)); + vertbuffer->FlushBuffer(vertbuffer->colorBuffer, data->colors, + sizeof(uint32_t)); for (size_t i = 0; i < num_tex; i++) { gs_tvertarray &tv = data->tvarray[i]; - vertbuffer->FlushBuffer(vertbuffer->uvBuffers[i], - tv.array, tv.width*sizeof(float)); + vertbuffer->FlushBuffer(vertbuffer->uvBuffers[i], tv.array, + tv.width * sizeof(float)); } } @@ -2142,7 +2210,7 @@ } void gs_vertexbuffer_flush_direct(gs_vertbuffer_t *vertbuffer, - const gs_vb_data *data) + const gs_vb_data *data) { gs_vertexbuffer_flush_internal(vertbuffer, data); } @@ -2152,14 +2220,13 @@ return vertbuffer->vbd.data; } - void gs_indexbuffer_destroy(gs_indexbuffer_t *indexbuffer) { delete indexbuffer; } static inline void gs_indexbuffer_flush_internal(gs_indexbuffer_t *indexbuffer, - const void *data) + const void *data) { HRESULT hr; @@ -2167,8 +2234,8 @@ return; D3D11_MAPPED_SUBRESOURCE map; - hr = indexbuffer->device->context->Map(indexbuffer->indexBuffer, 0, - D3D11_MAP_WRITE_DISCARD, 0, &map); + hr = indexbuffer->device->context->Map( + indexbuffer->indexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map); if (FAILED(hr)) return; @@ -2183,7 +2250,7 @@ } void gs_indexbuffer_flush_direct(gs_indexbuffer_t *indexbuffer, - const void *data) + const void *data) { gs_indexbuffer_flush_internal(indexbuffer, data); } @@ -2203,6 +2270,88 @@ return indexbuffer->type; } +void gs_timer_destroy(gs_timer_t *timer) +{ + delete timer; +} + +void gs_timer_begin(gs_timer_t *timer) +{ + timer->device->context->End(timer->query_begin); +} + +void gs_timer_end(gs_timer_t *timer) +{ + timer->device->context->End(timer->query_end); +} + +bool gs_timer_get_data(gs_timer_t *timer, uint64_t *ticks) +{ + uint64_t begin, end; + HRESULT hr_begin, hr_end; + do { + hr_begin = timer->device->context->GetData( + timer->query_begin, &begin, sizeof(begin), 0); + } while (hr_begin == S_FALSE); + do { + hr_end = timer->device->context->GetData(timer->query_end, &end, + sizeof(end), 0); + } while (hr_end == S_FALSE); + + const bool succeeded = SUCCEEDED(hr_begin) && SUCCEEDED(hr_end); + if (succeeded) + *ticks = end - begin; + + return succeeded; +} + +void gs_timer_range_destroy(gs_timer_range_t *range) +{ + delete range; +} + +void gs_timer_range_begin(gs_timer_range_t *range) +{ + range->device->context->Begin(range->query_disjoint); +} + +void gs_timer_range_end(gs_timer_range_t *range) +{ + range->device->context->End(range->query_disjoint); +} + +bool gs_timer_range_get_data(gs_timer_range_t *range, bool *disjoint, + uint64_t *frequency) +{ + D3D11_QUERY_DATA_TIMESTAMP_DISJOINT timestamp_disjoint; + HRESULT hr; + do { + hr = range->device->context->GetData(range->query_disjoint, + ×tamp_disjoint, + sizeof(timestamp_disjoint), + 0); + } while (hr == S_FALSE); + + const bool succeeded = SUCCEEDED(hr); + if (succeeded) { + *disjoint = timestamp_disjoint.Disjoint; + *frequency = timestamp_disjoint.Frequency; + } + + return succeeded; +} + +gs_timer::gs_timer(gs_device_t *device) : gs_obj(device, gs_type::gs_timer) +{ + Rebuild(device->device); +} + +gs_timer_range::gs_timer_range(gs_device_t *device) + : gs_obj(device, gs_type::gs_timer_range) +{ + Rebuild(device->device); +} + extern "C" EXPORT bool device_gdi_texture_available(void) { return true; @@ -2219,11 +2368,13 @@ } extern "C" EXPORT void device_debug_marker_begin(gs_device_t *, - const char *markername, const float color[4]) + const char *markername, + const float color[4]) { D3DCOLOR bgra = D3DCOLOR_ARGB((DWORD)(255.0f * color[3]), - (DWORD)(255.0f * color[0]), (DWORD)(255.0f * color[1]), - (DWORD)(255.0f * color[2])); + (DWORD)(255.0f * color[0]), + (DWORD)(255.0f * color[1]), + (DWORD)(255.0f * color[2])); wchar_t wide[64]; os_utf8_to_wcs(markername, 0, wide, _countof(wide)); @@ -2236,17 +2387,17 @@ D3DPERF_EndEvent(); } -extern "C" EXPORT gs_texture_t *device_texture_create_gdi(gs_device_t *device, - uint32_t width, uint32_t height) +extern "C" EXPORT gs_texture_t * +device_texture_create_gdi(gs_device_t *device, uint32_t width, uint32_t height) { gs_texture *texture = nullptr; try { - texture = new gs_texture_2d(device, width, height, GS_BGRA, - 1, nullptr, GS_RENDER_TARGET, GS_TEXTURE_2D, - true); - } catch (HRError error) { + texture = new gs_texture_2d(device, width, height, GS_BGRA, 1, + nullptr, GS_RENDER_TARGET, + GS_TEXTURE_2D, true); + } catch (const HRError &error) { blog(LOG_ERROR, "device_texture_create_gdi (D3D11): %s (%08lX)", - error.str, error.hr); + error.str, error.hr); LogD3D11ErrorDetails(error, device); } catch (const char *error) { blog(LOG_ERROR, "device_texture_create_gdi (D3D11): %s", error); @@ -2259,7 +2410,7 @@ { if (!tex2d->isGDICompatible) { blog(LOG_ERROR, "%s (D3D11): Texture is not GDI compatible", - func); + func); return false; } @@ -2273,7 +2424,7 @@ if (tex->type != GS_TEXTURE_2D) return nullptr; - gs_texture_2d *tex2d = static_cast<gs_texture_2d*>(tex); + gs_texture_2d *tex2d = static_cast<gs_texture_2d *>(tex); if (!TextureGDICompatible(tex2d, "gs_texture_get_dc")) return nullptr; @@ -2289,7 +2440,7 @@ if (tex->type != GS_TEXTURE_2D) return; - gs_texture_2d *tex2d = static_cast<gs_texture_2d*>(tex); + gs_texture_2d *tex2d = static_cast<gs_texture_2d *>(tex); if (!TextureGDICompatible(tex2d, "gs_texture_release_dc")) return; @@ -2297,14 +2448,14 @@ } extern "C" EXPORT gs_texture_t *device_texture_open_shared(gs_device_t *device, - uint32_t handle) + uint32_t handle) { gs_texture *texture = nullptr; try { texture = new gs_texture_2d(device, handle); - } catch (HRError error) { + } catch (const HRError &error) { blog(LOG_ERROR, "gs_texture_open_shared (D3D11): %s (%08lX)", - error.str, error.hr); + error.str, error.hr); LogD3D11ErrorDetails(error, device); } catch (const char *error) { blog(LOG_ERROR, "gs_texture_open_shared (D3D11): %s", error); @@ -2347,7 +2498,7 @@ } extern "C" EXPORT int device_texture_release_sync(gs_texture_t *tex, - uint64_t key) + uint64_t key) { gs_texture_2d *tex2d = reinterpret_cast<gs_texture_2d *>(tex); if (tex->type != GS_TEXTURE_2D) @@ -2369,9 +2520,10 @@ return -1; } -extern "C" EXPORT bool device_texture_create_nv12(gs_device_t *device, - gs_texture_t **p_tex_y, gs_texture_t **p_tex_uv, - uint32_t width, uint32_t height, uint32_t flags) +extern "C" EXPORT bool +device_texture_create_nv12(gs_device_t *device, gs_texture_t **p_tex_y, + gs_texture_t **p_tex_uv, uint32_t width, + uint32_t height, uint32_t flags) { if (!device->nv12Supported) return false; @@ -2384,12 +2536,13 @@ try { tex_y = new gs_texture_2d(device, width, height, GS_R8, 1, - nullptr, flags, GS_TEXTURE_2D, false, true); + nullptr, flags, GS_TEXTURE_2D, false, + true); tex_uv = new gs_texture_2d(device, tex_y->texture, flags); - } catch (HRError error) { + } catch (const HRError &error) { blog(LOG_ERROR, "gs_texture_create_nv12 (D3D11): %s (%08lX)", - error.str, error.hr); + error.str, error.hr); LogD3D11ErrorDetails(error, device); return false; @@ -2406,16 +2559,18 @@ return true; } -extern "C" EXPORT gs_stagesurf_t *device_stagesurface_create_nv12( - gs_device_t *device, uint32_t width, uint32_t height) +extern "C" EXPORT gs_stagesurf_t * +device_stagesurface_create_nv12(gs_device_t *device, uint32_t width, + uint32_t height) { gs_stage_surface *surf = NULL; try { surf = new gs_stage_surface(device, width, height); - } catch (HRError error) { - blog(LOG_ERROR, "device_stagesurface_create (D3D11): %s " - "(%08lX)", - error.str, error.hr); + } catch (const HRError &error) { + blog(LOG_ERROR, + "device_stagesurface_create (D3D11): %s " + "(%08lX)", + error.str, error.hr); LogD3D11ErrorDetails(error, device); }
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-subsystem.hpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-subsystem.hpp
Changed
@@ -62,25 +62,44 @@ static inline DXGI_FORMAT ConvertGSTextureFormat(gs_color_format format) { switch (format) { - case GS_UNKNOWN: return DXGI_FORMAT_UNKNOWN; - case GS_A8: return DXGI_FORMAT_A8_UNORM; - case GS_R8: return DXGI_FORMAT_R8_UNORM; - case GS_RGBA: return DXGI_FORMAT_R8G8B8A8_UNORM; - case GS_BGRX: return DXGI_FORMAT_B8G8R8X8_UNORM; - case GS_BGRA: return DXGI_FORMAT_B8G8R8A8_UNORM; - case GS_R10G10B10A2: return DXGI_FORMAT_R10G10B10A2_UNORM; - case GS_RGBA16: return DXGI_FORMAT_R16G16B16A16_UNORM; - case GS_R16: return DXGI_FORMAT_R16_UNORM; - case GS_RGBA16F: return DXGI_FORMAT_R16G16B16A16_FLOAT; - case GS_RGBA32F: return DXGI_FORMAT_R32G32B32A32_FLOAT; - case GS_RG16F: return DXGI_FORMAT_R16G16_FLOAT; - case GS_RG32F: return DXGI_FORMAT_R32G32_FLOAT; - case GS_R16F: return DXGI_FORMAT_R16_FLOAT; - case GS_R32F: return DXGI_FORMAT_R32_FLOAT; - case GS_DXT1: return DXGI_FORMAT_BC1_UNORM; - case GS_DXT3: return DXGI_FORMAT_BC2_UNORM; - case GS_DXT5: return DXGI_FORMAT_BC3_UNORM; - case GS_R8G8: return DXGI_FORMAT_R8G8_UNORM; + case GS_UNKNOWN: + return DXGI_FORMAT_UNKNOWN; + case GS_A8: + return DXGI_FORMAT_A8_UNORM; + case GS_R8: + return DXGI_FORMAT_R8_UNORM; + case GS_RGBA: + return DXGI_FORMAT_R8G8B8A8_UNORM; + case GS_BGRX: + return DXGI_FORMAT_B8G8R8X8_UNORM; + case GS_BGRA: + return DXGI_FORMAT_B8G8R8A8_UNORM; + case GS_R10G10B10A2: + return DXGI_FORMAT_R10G10B10A2_UNORM; + case GS_RGBA16: + return DXGI_FORMAT_R16G16B16A16_UNORM; + case GS_R16: + return DXGI_FORMAT_R16_UNORM; + case GS_RGBA16F: + return DXGI_FORMAT_R16G16B16A16_FLOAT; + case GS_RGBA32F: + return DXGI_FORMAT_R32G32B32A32_FLOAT; + case GS_RG16F: + return DXGI_FORMAT_R16G16_FLOAT; + case GS_RG32F: + return DXGI_FORMAT_R32G32_FLOAT; + case GS_R16F: + return DXGI_FORMAT_R16_FLOAT; + case GS_R32F: + return DXGI_FORMAT_R32_FLOAT; + case GS_DXT1: + return DXGI_FORMAT_BC1_UNORM; + case GS_DXT3: + return DXGI_FORMAT_BC2_UNORM; + case GS_DXT5: + return DXGI_FORMAT_BC3_UNORM; + case GS_R8G8: + return DXGI_FORMAT_R8G8_UNORM; } return DXGI_FORMAT_UNKNOWN; @@ -89,24 +108,42 @@ static inline gs_color_format ConvertDXGITextureFormat(DXGI_FORMAT format) { switch ((unsigned long)format) { - case DXGI_FORMAT_A8_UNORM: return GS_A8; - case DXGI_FORMAT_R8_UNORM: return GS_R8; - case DXGI_FORMAT_R8G8_UNORM: return GS_R8G8; - case DXGI_FORMAT_R8G8B8A8_UNORM: return GS_RGBA; - case DXGI_FORMAT_B8G8R8X8_UNORM: return GS_BGRX; - case DXGI_FORMAT_B8G8R8A8_UNORM: return GS_BGRA; - case DXGI_FORMAT_R10G10B10A2_UNORM: return GS_R10G10B10A2; - case DXGI_FORMAT_R16G16B16A16_UNORM: return GS_RGBA16; - case DXGI_FORMAT_R16_UNORM: return GS_R16; - case DXGI_FORMAT_R16G16B16A16_FLOAT: return GS_RGBA16F; - case DXGI_FORMAT_R32G32B32A32_FLOAT: return GS_RGBA32F; - case DXGI_FORMAT_R16G16_FLOAT: return GS_RG16F; - case DXGI_FORMAT_R32G32_FLOAT: return GS_RG32F; - case DXGI_FORMAT_R16_FLOAT: return GS_R16F; - case DXGI_FORMAT_R32_FLOAT: return GS_R32F; - case DXGI_FORMAT_BC1_UNORM: return GS_DXT1; - case DXGI_FORMAT_BC2_UNORM: return GS_DXT3; - case DXGI_FORMAT_BC3_UNORM: return GS_DXT5; + case DXGI_FORMAT_A8_UNORM: + return GS_A8; + case DXGI_FORMAT_R8_UNORM: + return GS_R8; + case DXGI_FORMAT_R8G8_UNORM: + return GS_R8G8; + case DXGI_FORMAT_R8G8B8A8_UNORM: + return GS_RGBA; + case DXGI_FORMAT_B8G8R8X8_UNORM: + return GS_BGRX; + case DXGI_FORMAT_B8G8R8A8_UNORM: + return GS_BGRA; + case DXGI_FORMAT_R10G10B10A2_UNORM: + return GS_R10G10B10A2; + case DXGI_FORMAT_R16G16B16A16_UNORM: + return GS_RGBA16; + case DXGI_FORMAT_R16_UNORM: + return GS_R16; + case DXGI_FORMAT_R16G16B16A16_FLOAT: + return GS_RGBA16F; + case DXGI_FORMAT_R32G32B32A32_FLOAT: + return GS_RGBA32F; + case DXGI_FORMAT_R16G16_FLOAT: + return GS_RG16F; + case DXGI_FORMAT_R32G32_FLOAT: + return GS_RG32F; + case DXGI_FORMAT_R16_FLOAT: + return GS_R16F; + case DXGI_FORMAT_R32_FLOAT: + return GS_R32F; + case DXGI_FORMAT_BC1_UNORM: + return GS_DXT1; + case DXGI_FORMAT_BC2_UNORM: + return GS_DXT3; + case DXGI_FORMAT_BC3_UNORM: + return GS_DXT5; } return GS_UNKNOWN; @@ -115,11 +152,16 @@ static inline DXGI_FORMAT ConvertGSZStencilFormat(gs_zstencil_format format) { switch (format) { - case GS_ZS_NONE: return DXGI_FORMAT_UNKNOWN; - case GS_Z16: return DXGI_FORMAT_D16_UNORM; - case GS_Z24_S8: return DXGI_FORMAT_D24_UNORM_S8_UINT; - case GS_Z32F: return DXGI_FORMAT_D32_FLOAT; - case GS_Z32F_S8X24: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT; + case GS_ZS_NONE: + return DXGI_FORMAT_UNKNOWN; + case GS_Z16: + return DXGI_FORMAT_D16_UNORM; + case GS_Z24_S8: + return DXGI_FORMAT_D24_UNORM_S8_UINT; + case GS_Z32F: + return DXGI_FORMAT_D32_FLOAT; + case GS_Z32F_S8X24: + return DXGI_FORMAT_D32_FLOAT_S8X24_UINT; } return DXGI_FORMAT_UNKNOWN; @@ -128,14 +170,22 @@ static inline D3D11_COMPARISON_FUNC ConvertGSDepthTest(gs_depth_test test) { switch (test) { - case GS_NEVER: return D3D11_COMPARISON_NEVER; - case GS_LESS: return D3D11_COMPARISON_LESS; - case GS_LEQUAL: return D3D11_COMPARISON_LESS_EQUAL; - case GS_EQUAL: return D3D11_COMPARISON_EQUAL; - case GS_GEQUAL: return D3D11_COMPARISON_GREATER_EQUAL; - case GS_GREATER: return D3D11_COMPARISON_GREATER; - case GS_NOTEQUAL: return D3D11_COMPARISON_NOT_EQUAL; - case GS_ALWAYS: return D3D11_COMPARISON_ALWAYS; + case GS_NEVER: + return D3D11_COMPARISON_NEVER; + case GS_LESS: + return D3D11_COMPARISON_LESS; + case GS_LEQUAL: + return D3D11_COMPARISON_LESS_EQUAL; + case GS_EQUAL: + return D3D11_COMPARISON_EQUAL; + case GS_GEQUAL: + return D3D11_COMPARISON_GREATER_EQUAL; + case GS_GREATER: + return D3D11_COMPARISON_GREATER; + case GS_NOTEQUAL: + return D3D11_COMPARISON_NOT_EQUAL; + case GS_ALWAYS: + return D3D11_COMPARISON_ALWAYS; } return D3D11_COMPARISON_NEVER; @@ -144,12 +194,18 @@ static inline D3D11_STENCIL_OP ConvertGSStencilOp(gs_stencil_op_type op) { switch (op) { - case GS_KEEP: return D3D11_STENCIL_OP_KEEP; - case GS_ZERO: return D3D11_STENCIL_OP_ZERO; - case GS_REPLACE: return D3D11_STENCIL_OP_REPLACE; - case GS_INCR: return D3D11_STENCIL_OP_INCR; - case GS_DECR: return D3D11_STENCIL_OP_DECR; - case GS_INVERT: return D3D11_STENCIL_OP_INVERT; + case GS_KEEP: + return D3D11_STENCIL_OP_KEEP; + case GS_ZERO: + return D3D11_STENCIL_OP_ZERO; + case GS_REPLACE: + return D3D11_STENCIL_OP_REPLACE; + case GS_INCR: + return D3D11_STENCIL_OP_INCR; + case GS_DECR: + return D3D11_STENCIL_OP_DECR; + case GS_INVERT: + return D3D11_STENCIL_OP_INVERT; } return D3D11_STENCIL_OP_KEEP; @@ -158,17 +214,28 @@ static inline D3D11_BLEND ConvertGSBlendType(gs_blend_type type) { switch (type) { - case GS_BLEND_ZERO: return D3D11_BLEND_ZERO; - case GS_BLEND_ONE: return D3D11_BLEND_ONE; - case GS_BLEND_SRCCOLOR: return D3D11_BLEND_SRC_COLOR; - case GS_BLEND_INVSRCCOLOR: return D3D11_BLEND_INV_SRC_COLOR; - case GS_BLEND_SRCALPHA: return D3D11_BLEND_SRC_ALPHA; - case GS_BLEND_INVSRCALPHA: return D3D11_BLEND_INV_SRC_ALPHA; - case GS_BLEND_DSTCOLOR: return D3D11_BLEND_DEST_COLOR; - case GS_BLEND_INVDSTCOLOR: return D3D11_BLEND_INV_DEST_COLOR; - case GS_BLEND_DSTALPHA: return D3D11_BLEND_DEST_ALPHA; - case GS_BLEND_INVDSTALPHA: return D3D11_BLEND_INV_DEST_ALPHA; - case GS_BLEND_SRCALPHASAT: return D3D11_BLEND_SRC_ALPHA_SAT; + case GS_BLEND_ZERO: + return D3D11_BLEND_ZERO; + case GS_BLEND_ONE: + return D3D11_BLEND_ONE; + case GS_BLEND_SRCCOLOR: + return D3D11_BLEND_SRC_COLOR; + case GS_BLEND_INVSRCCOLOR: + return D3D11_BLEND_INV_SRC_COLOR; + case GS_BLEND_SRCALPHA: + return D3D11_BLEND_SRC_ALPHA; + case GS_BLEND_INVSRCALPHA: + return D3D11_BLEND_INV_SRC_ALPHA; + case GS_BLEND_DSTCOLOR: + return D3D11_BLEND_DEST_COLOR; + case GS_BLEND_INVDSTCOLOR: + return D3D11_BLEND_INV_DEST_COLOR; + case GS_BLEND_DSTALPHA: + return D3D11_BLEND_DEST_ALPHA; + case GS_BLEND_INVDSTALPHA: + return D3D11_BLEND_INV_DEST_ALPHA; + case GS_BLEND_SRCALPHASAT: + return D3D11_BLEND_SRC_ALPHA_SAT; } return D3D11_BLEND_ONE; @@ -177,9 +244,12 @@ static inline D3D11_CULL_MODE ConvertGSCullMode(gs_cull_mode mode) { switch (mode) { - case GS_BACK: return D3D11_CULL_BACK; - case GS_FRONT: return D3D11_CULL_FRONT; - case GS_NEITHER: return D3D11_CULL_NONE; + case GS_BACK: + return D3D11_CULL_BACK; + case GS_FRONT: + return D3D11_CULL_FRONT; + case GS_NEITHER: + return D3D11_CULL_NONE; } return D3D11_CULL_BACK; @@ -188,11 +258,16 @@ static inline D3D11_PRIMITIVE_TOPOLOGY ConvertGSTopology(gs_draw_mode mode) { switch (mode) { - case GS_POINTS: return D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; - case GS_LINES: return D3D11_PRIMITIVE_TOPOLOGY_LINELIST; - case GS_LINESTRIP: return D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP; - case GS_TRIS: return D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST; - case GS_TRISTRIP: return D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; + case GS_POINTS: + return D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; + case GS_LINES: + return D3D11_PRIMITIVE_TOPOLOGY_LINELIST; + case GS_LINESTRIP: + return D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP; + case GS_TRIS: + return D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + case GS_TRISTRIP: + return D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; } return D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; @@ -203,7 +278,7 @@ gs_vb_data *data; inline VBDataPtr(gs_vb_data *data) : data(data) {} - inline ~VBDataPtr() {gs_vbdata_destroy(data);} + inline ~VBDataPtr() { gs_vbdata_destroy(data); } }; enum class gs_type { @@ -217,6 +292,8 @@ gs_pixel_shader, gs_duplicator, gs_swap_chain, + gs_timer, + gs_timer_range, }; struct gs_obj { @@ -225,38 +302,32 @@ gs_obj *next; gs_obj **prev_next; - inline gs_obj() : - device(nullptr), - next(nullptr), - prev_next(nullptr) - {} + inline gs_obj() : device(nullptr), next(nullptr), prev_next(nullptr) {} gs_obj(gs_device_t *device, gs_type type); virtual ~gs_obj(); }; struct gs_vertex_buffer : gs_obj { - ComPtr<ID3D11Buffer> vertexBuffer; - ComPtr<ID3D11Buffer> normalBuffer; - ComPtr<ID3D11Buffer> colorBuffer; - ComPtr<ID3D11Buffer> tangentBuffer; + ComPtr<ID3D11Buffer> vertexBuffer; + ComPtr<ID3D11Buffer> normalBuffer; + ComPtr<ID3D11Buffer> colorBuffer; + ComPtr<ID3D11Buffer> tangentBuffer; vector<ComPtr<ID3D11Buffer>> uvBuffers; - bool dynamic; - VBDataPtr vbd; - size_t numVerts; + bool dynamic; + VBDataPtr vbd; + size_t numVerts; vector<size_t> uvSizes; - void FlushBuffer(ID3D11Buffer *buffer, void *array, - size_t elementSize); + void FlushBuffer(ID3D11Buffer *buffer, void *array, size_t elementSize); void MakeBufferList(gs_vertex_shader *shader, - vector<ID3D11Buffer*> &buffers, - vector<uint32_t> &strides); + vector<ID3D11Buffer *> &buffers, + vector<uint32_t> &strides); - void InitBuffer(const size_t elementSize, - const size_t numVerts, void *array, - ID3D11Buffer **buffer); + void InitBuffer(const size_t elementSize, const size_t numVerts, + void *array, ID3D11Buffer **buffer); void BuildBuffers(); @@ -272,7 +343,7 @@ void Rebuild(); gs_vertex_buffer(gs_device_t *device, struct gs_vb_data *data, - uint32_t flags); + uint32_t flags); }; /* exception-safe RAII wrapper for index buffer data (NOTE: not copy-safe) */ @@ -280,16 +351,16 @@ void *data; inline DataPtr(void *data) : data(data) {} - inline ~DataPtr() {bfree(data);} + inline ~DataPtr() { bfree(data); } }; struct gs_index_buffer : gs_obj { ComPtr<ID3D11Buffer> indexBuffer; - bool dynamic; - gs_index_type type; - size_t indexSize; - size_t num; - DataPtr indices; + bool dynamic; + gs_index_type type; + size_t indexSize; + size_t num; + DataPtr indices; D3D11_BUFFER_DESC bd = {}; D3D11_SUBRESOURCE_DATA srd = {}; @@ -298,15 +369,40 @@ void Rebuild(ID3D11Device *dev); - inline void Release() {indexBuffer.Release();} + inline void Release() { indexBuffer.Release(); } gs_index_buffer(gs_device_t *device, enum gs_index_type type, void *indices, size_t num, uint32_t flags); }; +struct gs_timer : gs_obj { + ComPtr<ID3D11Query> query_begin; + ComPtr<ID3D11Query> query_end; + + void Rebuild(ID3D11Device *dev); + + inline void Release() + { + query_begin.Release(); + query_end.Release(); + } + + gs_timer(gs_device_t *device); +}; + +struct gs_timer_range : gs_obj { + ComPtr<ID3D11Query> query_disjoint; + + void Rebuild(ID3D11Device *dev); + + inline void Release() { query_disjoint.Release(); } + + gs_timer_range(gs_device_t *device); +}; + struct gs_texture : gs_obj { gs_texture_type type; - uint32_t levels; + uint32_t levels; gs_color_format format; ComPtr<ID3D11ShaderResourceView> shaderRes; @@ -315,50 +411,47 @@ void Rebuild(ID3D11Device *dev); inline gs_texture(gs_texture_type type, uint32_t levels, - gs_color_format format) - : type (type), - levels (levels), - format (format) + gs_color_format format) + : type(type), levels(levels), format(format) { } inline gs_texture(gs_device *device, gs_type obj_type, - gs_texture_type type) - : gs_obj (device, obj_type), - type (type) + gs_texture_type type) + : gs_obj(device, obj_type), type(type) { } inline gs_texture(gs_device *device, gs_type obj_type, - gs_texture_type type, - uint32_t levels, gs_color_format format) - : gs_obj (device, obj_type), - type (type), - levels (levels), - format (format) + gs_texture_type type, uint32_t levels, + gs_color_format format) + : gs_obj(device, obj_type), + type(type), + levels(levels), + format(format) { } }; struct gs_texture_2d : gs_texture { - ComPtr<ID3D11Texture2D> texture; - ComPtr<ID3D11RenderTargetView> renderTarget[6]; - ComPtr<IDXGISurface1> gdiSurface; - - uint32_t width = 0, height = 0; - uint32_t flags = 0; - DXGI_FORMAT dxgiFormat = DXGI_FORMAT_UNKNOWN; - bool isRenderTarget = false; - bool isGDICompatible = false; - bool isDynamic = false; - bool isShared = false; - bool genMipmaps = false; - uint32_t sharedHandle = GS_INVALID_HANDLE; - - gs_texture_2d *pairedNV12texture = nullptr; - bool nv12 = false; - bool chroma = false; - bool acquired = false; + ComPtr<ID3D11Texture2D> texture; + ComPtr<ID3D11RenderTargetView> renderTarget[6]; + ComPtr<IDXGISurface1> gdiSurface; + + uint32_t width = 0, height = 0; + uint32_t flags = 0; + DXGI_FORMAT dxgiFormat = DXGI_FORMAT_UNKNOWN; + bool isRenderTarget = false; + bool isGDICompatible = false; + bool isDynamic = false; + bool isShared = false; + bool genMipmaps = false; + uint32_t sharedHandle = GS_INVALID_HANDLE; + + gs_texture_2d *pairedNV12texture = nullptr; + bool nv12 = false; + bool chroma = false; + bool acquired = false; vector<vector<uint8_t>> data; vector<D3D11_SUBRESOURCE_DATA> srd; @@ -385,29 +478,26 @@ shaderRes.Release(); } - inline gs_texture_2d() - : gs_texture (GS_TEXTURE_2D, 0, GS_UNKNOWN) - { - } + inline gs_texture_2d() : gs_texture(GS_TEXTURE_2D, 0, GS_UNKNOWN) {} gs_texture_2d(gs_device_t *device, uint32_t width, uint32_t height, - gs_color_format colorFormat, uint32_t levels, - const uint8_t **data, uint32_t flags, - gs_texture_type type, bool gdiCompatible, - bool nv12 = false); + gs_color_format colorFormat, uint32_t levels, + const uint8_t **data, uint32_t flags, + gs_texture_type type, bool gdiCompatible, + bool nv12 = false); gs_texture_2d(gs_device_t *device, ID3D11Texture2D *nv12, - uint32_t flags); + uint32_t flags); gs_texture_2d(gs_device_t *device, uint32_t handle); }; struct gs_zstencil_buffer : gs_obj { - ComPtr<ID3D11Texture2D> texture; + ComPtr<ID3D11Texture2D> texture; ComPtr<ID3D11DepthStencilView> view; - uint32_t width, height; + uint32_t width, height; gs_zstencil_format format; - DXGI_FORMAT dxgiFormat; + DXGI_FORMAT dxgiFormat; D3D11_TEXTURE2D_DESC td = {}; D3D11_DEPTH_STENCIL_VIEW_DESC dsvd = {}; @@ -423,62 +513,57 @@ } inline gs_zstencil_buffer() - : width (0), - height (0), - dxgiFormat (DXGI_FORMAT_UNKNOWN) + : width(0), height(0), dxgiFormat(DXGI_FORMAT_UNKNOWN) { } gs_zstencil_buffer(gs_device_t *device, uint32_t width, uint32_t height, - gs_zstencil_format format); + gs_zstencil_format format); }; struct gs_stage_surface : gs_obj { ComPtr<ID3D11Texture2D> texture; D3D11_TEXTURE2D_DESC td = {}; - uint32_t width, height; + uint32_t width, height; gs_color_format format; - DXGI_FORMAT dxgiFormat; + DXGI_FORMAT dxgiFormat; void Rebuild(ID3D11Device *dev); - inline void Release() - { - texture.Release(); - } + inline void Release() { texture.Release(); } gs_stage_surface(gs_device_t *device, uint32_t width, uint32_t height, - gs_color_format colorFormat); + gs_color_format colorFormat); gs_stage_surface(gs_device_t *device, uint32_t width, uint32_t height); }; struct gs_sampler_state : gs_obj { ComPtr<ID3D11SamplerState> state; - D3D11_SAMPLER_DESC sd = {}; - gs_sampler_info info; + D3D11_SAMPLER_DESC sd = {}; + gs_sampler_info info; void Rebuild(ID3D11Device *dev); - inline void Release() {state.Release();} + inline void Release() { state.Release(); } gs_sampler_state(gs_device_t *device, const gs_sampler_info *info); }; struct gs_shader_param { - string name; - gs_shader_param_type type; + string name; + gs_shader_param_type type; - uint32_t textureID; - struct gs_sampler_state *nextSampler = nullptr; + uint32_t textureID; + struct gs_sampler_state *nextSampler = nullptr; - int arrayCount; + int arrayCount; - size_t pos; + size_t pos; - vector<uint8_t> curValue; - vector<uint8_t> defaultValue; - bool changed; + vector<uint8_t> curValue; + vector<uint8_t> defaultValue; + bool changed; gs_shader_param(shader_var &var, uint32_t &texCounter); }; @@ -488,34 +573,31 @@ HRESULT hr; inline ShaderError(const ComPtr<ID3D10Blob> &errors, HRESULT hr) - : errors (errors), - hr (hr) + : errors(errors), hr(hr) { } }; struct gs_shader : gs_obj { - gs_shader_type type; + gs_shader_type type; vector<gs_shader_param> params; - ComPtr<ID3D11Buffer> constants; - size_t constantSize; + ComPtr<ID3D11Buffer> constants; + size_t constantSize; - D3D11_BUFFER_DESC bd = {}; - vector<uint8_t> data; + D3D11_BUFFER_DESC bd = {}; + vector<uint8_t> data; inline void UpdateParam(vector<uint8_t> &constData, - gs_shader_param ¶m, bool &upload); + gs_shader_param ¶m, bool &upload); void UploadParams(); void BuildConstantBuffer(); void Compile(const char *shaderStr, const char *file, - const char *target, ID3D10Blob **shader); + const char *target, ID3D10Blob **shader); inline gs_shader(gs_device_t *device, gs_type obj_type, - gs_shader_type type) - : gs_obj (device, obj_type), - type (type), - constantSize (0) + gs_shader_type type) + : gs_obj(device, obj_type), type(type), constantSize(0) { } @@ -523,28 +605,27 @@ }; struct ShaderSampler { - string name; + string name; gs_sampler_state sampler; inline ShaderSampler(const char *name, gs_device_t *device, - gs_sampler_info *info) - : name (name), - sampler (device, info) + gs_sampler_info *info) + : name(name), sampler(device, info) { } }; struct gs_vertex_shader : gs_shader { ComPtr<ID3D11VertexShader> shader; - ComPtr<ID3D11InputLayout> layout; + ComPtr<ID3D11InputLayout> layout; gs_shader_param *world, *viewProj; vector<D3D11_INPUT_ELEMENT_DESC> layoutData; - bool hasNormals; - bool hasColors; - bool hasTangents; + bool hasNormals; + bool hasColors; + bool hasTangents; uint32_t nTexUnits; void Rebuild(ID3D11Device *dev); @@ -558,10 +639,13 @@ inline uint32_t NumBuffersExpected() const { - uint32_t count = nTexUnits+1; - if (hasNormals) count++; - if (hasColors) count++; - if (hasTangents) count++; + uint32_t count = nTexUnits + 1; + if (hasNormals) + count++; + if (hasColors) + count++; + if (hasTangents) + count++; return count; } @@ -569,7 +653,7 @@ void GetBuffersExpected(const vector<D3D11_INPUT_ELEMENT_DESC> &inputs); gs_vertex_shader(gs_device_t *device, const char *file, - const char *shaderString); + const char *shaderString); }; struct gs_duplicator : gs_obj { @@ -581,10 +665,7 @@ void Start(); - inline void Release() - { - duplicator.Release(); - } + inline void Release() { duplicator.Release(); } gs_duplicator(gs_device_t *device, int monitor_idx); ~gs_duplicator(); @@ -616,14 +697,14 @@ }; struct gs_swap_chain : gs_obj { - uint32_t numBuffers; - HWND hwnd; - gs_init_data initData; - DXGI_SWAP_CHAIN_DESC swapDesc = {}; + uint32_t numBuffers; + HWND hwnd; + gs_init_data initData; + DXGI_SWAP_CHAIN_DESC swapDesc = {}; - gs_texture_2d target; - gs_zstencil_buffer zs; - ComPtr<IDXGISwapChain> swap; + gs_texture_2d target; + gs_zstencil_buffer zs; + ComPtr<IDXGISwapChain> swap; void InitTarget(uint32_t cx, uint32_t cy); void InitZStencilBuffer(uint32_t cx, uint32_t cy); @@ -643,27 +724,27 @@ }; struct BlendState { - bool blendEnabled; + bool blendEnabled; gs_blend_type srcFactorC; gs_blend_type destFactorC; gs_blend_type srcFactorA; gs_blend_type destFactorA; - bool redEnabled; - bool greenEnabled; - bool blueEnabled; - bool alphaEnabled; + bool redEnabled; + bool greenEnabled; + bool blueEnabled; + bool alphaEnabled; inline BlendState() - : blendEnabled (true), - srcFactorC (GS_BLEND_SRCALPHA), - destFactorC (GS_BLEND_INVSRCALPHA), - srcFactorA (GS_BLEND_ONE), - destFactorA (GS_BLEND_INVSRCALPHA), - redEnabled (true), - greenEnabled (true), - blueEnabled (true), - alphaEnabled (true) + : blendEnabled(true), + srcFactorC(GS_BLEND_SRCALPHA), + destFactorC(GS_BLEND_INVSRCALPHA), + srcFactorA(GS_BLEND_ONE), + destFactorA(GS_BLEND_INVSRCALPHA), + redEnabled(true), + greenEnabled(true), + blueEnabled(true), + alphaEnabled(true) { } @@ -675,14 +756,11 @@ struct SavedBlendState : BlendState { ComPtr<ID3D11BlendState> state; - D3D11_BLEND_DESC bd; + D3D11_BLEND_DESC bd; void Rebuild(ID3D11Device *dev); - inline void Release() - { - state.Release(); - } + inline void Release() { state.Release(); } inline SavedBlendState(const BlendState &val, D3D11_BLEND_DESC &desc) : BlendState(val), bd(desc) @@ -697,30 +775,27 @@ gs_stencil_op_type zpass; inline StencilSide() - : test (GS_ALWAYS), - fail (GS_KEEP), - zfail (GS_KEEP), - zpass (GS_KEEP) + : test(GS_ALWAYS), fail(GS_KEEP), zfail(GS_KEEP), zpass(GS_KEEP) { } }; struct ZStencilState { - bool depthEnabled; - bool depthWriteEnabled; + bool depthEnabled; + bool depthWriteEnabled; gs_depth_test depthFunc; - bool stencilEnabled; - bool stencilWriteEnabled; - StencilSide stencilFront; - StencilSide stencilBack; + bool stencilEnabled; + bool stencilWriteEnabled; + StencilSide stencilFront; + StencilSide stencilBack; inline ZStencilState() - : depthEnabled (true), - depthWriteEnabled (true), - depthFunc (GS_LESS), - stencilEnabled (false), - stencilWriteEnabled (true) + : depthEnabled(true), + depthWriteEnabled(true), + depthFunc(GS_LESS), + stencilEnabled(false), + stencilWriteEnabled(true) { } @@ -732,32 +807,24 @@ struct SavedZStencilState : ZStencilState { ComPtr<ID3D11DepthStencilState> state; - D3D11_DEPTH_STENCIL_DESC dsd; + D3D11_DEPTH_STENCIL_DESC dsd; void Rebuild(ID3D11Device *dev); - inline void Release() - { - state.Release(); - } + inline void Release() { state.Release(); } inline SavedZStencilState(const ZStencilState &val, - D3D11_DEPTH_STENCIL_DESC desc) - : ZStencilState (val), - dsd (desc) + D3D11_DEPTH_STENCIL_DESC desc) + : ZStencilState(val), dsd(desc) { } }; struct RasterState { gs_cull_mode cullMode; - bool scissorEnabled; + bool scissorEnabled; - inline RasterState() - : cullMode (GS_BACK), - scissorEnabled (false) - { - } + inline RasterState() : cullMode(GS_BACK), scissorEnabled(false) {} inline RasterState(const RasterState &state) { @@ -767,19 +834,15 @@ struct SavedRasterState : RasterState { ComPtr<ID3D11RasterizerState> state; - D3D11_RASTERIZER_DESC rd; + D3D11_RASTERIZER_DESC rd; void Rebuild(ID3D11Device *dev); - inline void Release() - { - state.Release(); - } + inline void Release() { state.Release(); } inline SavedRasterState(const RasterState &val, - D3D11_RASTERIZER_DESC &desc) - : RasterState (val), - rd (desc) + D3D11_RASTERIZER_DESC &desc) + : RasterState(val), rd(desc) { } }; @@ -789,73 +852,72 @@ }; struct gs_device { - ComPtr<IDXGIFactory1> factory; - ComPtr<IDXGIAdapter1> adapter; - ComPtr<ID3D11Device> device; + ComPtr<IDXGIFactory1> factory; + ComPtr<IDXGIAdapter1> adapter; + ComPtr<ID3D11Device> device; ComPtr<ID3D11DeviceContext> context; - uint32_t adpIdx = 0; - bool nv12Supported = false; - - gs_texture_2d *curRenderTarget = nullptr; - gs_zstencil_buffer *curZStencilBuffer = nullptr; - int curRenderSide = 0; - gs_texture *curTextures[GS_MAX_TEXTURES]; - gs_sampler_state *curSamplers[GS_MAX_TEXTURES]; - gs_vertex_buffer *curVertexBuffer = nullptr; - gs_index_buffer *curIndexBuffer = nullptr; - gs_vertex_shader *curVertexShader = nullptr; - gs_pixel_shader *curPixelShader = nullptr; - gs_swap_chain *curSwapChain = nullptr; - - gs_vertex_buffer *lastVertexBuffer = nullptr; - gs_vertex_shader *lastVertexShader = nullptr; - - bool zstencilStateChanged = true; - bool rasterStateChanged = true; - bool blendStateChanged = true; - ZStencilState zstencilState; - RasterState rasterState; - BlendState blendState; - vector<SavedZStencilState> zstencilStates; - vector<SavedRasterState> rasterStates; - vector<SavedBlendState> blendStates; - ID3D11DepthStencilState *curDepthStencilState = nullptr; - ID3D11RasterizerState *curRasterState = nullptr; - ID3D11BlendState *curBlendState = nullptr; - D3D11_PRIMITIVE_TOPOLOGY curToplogy; - - pD3DCompile d3dCompile = nullptr; + uint32_t adpIdx = 0; + bool nv12Supported = false; + + gs_texture_2d *curRenderTarget = nullptr; + gs_zstencil_buffer *curZStencilBuffer = nullptr; + int curRenderSide = 0; + gs_texture *curTextures[GS_MAX_TEXTURES]; + gs_sampler_state *curSamplers[GS_MAX_TEXTURES]; + gs_vertex_buffer *curVertexBuffer = nullptr; + gs_index_buffer *curIndexBuffer = nullptr; + gs_vertex_shader *curVertexShader = nullptr; + gs_pixel_shader *curPixelShader = nullptr; + gs_swap_chain *curSwapChain = nullptr; + + gs_vertex_buffer *lastVertexBuffer = nullptr; + gs_vertex_shader *lastVertexShader = nullptr; + + bool zstencilStateChanged = true; + bool rasterStateChanged = true; + bool blendStateChanged = true; + ZStencilState zstencilState; + RasterState rasterState; + BlendState blendState; + vector<SavedZStencilState> zstencilStates; + vector<SavedRasterState> rasterStates; + vector<SavedBlendState> blendStates; + ID3D11DepthStencilState *curDepthStencilState = nullptr; + ID3D11RasterizerState *curRasterState = nullptr; + ID3D11BlendState *curBlendState = nullptr; + D3D11_PRIMITIVE_TOPOLOGY curToplogy; + + pD3DCompile d3dCompile = nullptr; #ifdef DISASSEMBLE_SHADERS - pD3DDisassemble d3dDisassemble = nullptr; + pD3DDisassemble d3dDisassemble = nullptr; #endif - gs_rect viewport; + gs_rect viewport; - vector<mat4float> projStack; + vector<mat4float> projStack; - matrix4 curProjMatrix; - matrix4 curViewMatrix; - matrix4 curViewProjMatrix; + matrix4 curProjMatrix; + matrix4 curViewMatrix; + matrix4 curViewProjMatrix; - gs_obj *first_obj = nullptr; + gs_obj *first_obj = nullptr; void InitCompiler(); void InitFactory(uint32_t adapterIdx); void InitDevice(uint32_t adapterIdx); ID3D11DepthStencilState *AddZStencilState(); - ID3D11RasterizerState *AddRasterState(); - ID3D11BlendState *AddBlendState(); + ID3D11RasterizerState *AddRasterState(); + ID3D11BlendState *AddBlendState(); void UpdateZStencilState(); void UpdateRasterState(); void UpdateBlendState(); void LoadVertexBufferData(); - inline void CopyTex(ID3D11Texture2D *dst, - uint32_t dst_x, uint32_t dst_y, - gs_texture_t *src, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h); + inline void CopyTex(ID3D11Texture2D *dst, uint32_t dst_x, + uint32_t dst_y, gs_texture_t *src, uint32_t src_x, + uint32_t src_y, uint32_t src_w, uint32_t src_h); void UpdateViewProjMatrix(); @@ -868,4 +930,4 @@ }; extern "C" EXPORT int device_texture_acquire_sync(gs_texture_t *tex, - uint64_t key, uint32_t ms); + uint64_t key, uint32_t ms);
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-texture2d.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-texture2d.cpp
Changed
@@ -20,11 +20,11 @@ void gs_texture_2d::InitSRD(vector<D3D11_SUBRESOURCE_DATA> &srd) { - uint32_t rowSizeBytes = width * gs_get_format_bpp(format); - uint32_t texSizeBytes = height * rowSizeBytes / 8; - size_t textures = type == GS_TEXTURE_2D ? 1 : 6; + uint32_t rowSizeBytes = width * gs_get_format_bpp(format); + uint32_t texSizeBytes = height * rowSizeBytes / 8; + size_t textures = type == GS_TEXTURE_2D ? 1 : 6; uint32_t actual_levels = levels; - size_t curTex = 0; + size_t curTex = 0; if (!actual_levels) actual_levels = gs_get_total_levels(width, height); @@ -37,8 +37,8 @@ for (uint32_t j = 0; j < actual_levels; j++) { D3D11_SUBRESOURCE_DATA newSRD; - newSRD.pSysMem = data[curTex++].data(); - newSRD.SysMemPitch = newRowSize; + newSRD.pSysMem = data[curTex++].data(); + newSRD.SysMemPitch = newRowSize; newSRD.SysMemSlicePitch = newTexSize; srd.push_back(newSRD); @@ -78,8 +78,10 @@ hr = dxgi_res->GetSharedHandle(&handle); if (FAILED(hr)) { - blog(LOG_WARNING, "GetSharedHandle: Failed to " - "get shared handle: %08lX", hr); + blog(LOG_WARNING, + "GetSharedHandle: Failed to " + "get shared handle: %08lX", + hr); } else { sharedHandle = (uint32_t)(uintptr_t)handle; } @@ -90,16 +92,15 @@ HRESULT hr; memset(&td, 0, sizeof(td)); - td.Width = width; - td.Height = height; - td.MipLevels = genMipmaps ? 0 : levels; - td.ArraySize = type == GS_TEXTURE_CUBE ? 6 : 1; - td.Format = nv12 ? DXGI_FORMAT_NV12 : dxgiFormat; - td.BindFlags = D3D11_BIND_SHADER_RESOURCE; + td.Width = width; + td.Height = height; + td.MipLevels = genMipmaps ? 0 : levels; + td.ArraySize = type == GS_TEXTURE_CUBE ? 6 : 1; + td.Format = nv12 ? DXGI_FORMAT_NV12 : dxgiFormat; + td.BindFlags = D3D11_BIND_SHADER_RESOURCE; td.SampleDesc.Count = 1; - td.CPUAccessFlags = isDynamic ? D3D11_CPU_ACCESS_WRITE : 0; - td.Usage = isDynamic ? D3D11_USAGE_DYNAMIC : - D3D11_USAGE_DEFAULT; + td.CPUAccessFlags = isDynamic ? D3D11_CPU_ACCESS_WRITE : 0; + td.Usage = isDynamic ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT; if (type == GS_TEXTURE_CUBE) td.MiscFlags |= D3D11_RESOURCE_MISC_TEXTURECUBE; @@ -121,13 +122,13 @@ } hr = device->device->CreateTexture2D(&td, data ? srd.data() : NULL, - texture.Assign()); + texture.Assign()); if (FAILED(hr)) throw HRError("Failed to create 2D texture", hr); if (isGDICompatible) { hr = texture->QueryInterface(__uuidof(IDXGISurface1), - (void**)gdiSurface.Assign()); + (void **)gdiSurface.Assign()); if (FAILED(hr)) throw HRError("Failed to create GDI surface", hr); } @@ -138,22 +139,24 @@ texture->SetEvictionPriority(DXGI_RESOURCE_PRIORITY_MAXIMUM); hr = texture->QueryInterface(__uuidof(IDXGIResource), - (void**)&dxgi_res); + (void **)&dxgi_res); if (FAILED(hr)) { - blog(LOG_WARNING, "InitTexture: Failed to query " - "interface: %08lX", hr); + blog(LOG_WARNING, + "InitTexture: Failed to query " + "interface: %08lX", + hr); } else { GetSharedHandle(dxgi_res); if (flags & GS_SHARED_KM_TEX) { ComPtr<IDXGIKeyedMutex> km; hr = texture->QueryInterface( - __uuidof(IDXGIKeyedMutex), - (void**)&km); + __uuidof(IDXGIKeyedMutex), + (void **)&km); if (FAILED(hr)) { throw HRError("Failed to query " - "IDXGIKeyedMutex", - hr); + "IDXGIKeyedMutex", + hr); } km->AcquireSync(0, INFINITE); @@ -181,7 +184,7 @@ } hr = device->device->CreateShaderResourceView(texture, &resourceDesc, - shaderRes.Assign()); + shaderRes.Assign()); if (FAILED(hr)) throw HRError("Failed to create resource view", hr); } @@ -193,27 +196,28 @@ D3D11_RENDER_TARGET_VIEW_DESC rtv; rtv.Format = dxgiFormat; rtv.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; - rtv.Texture2D.MipSlice = 0; + rtv.Texture2D.MipSlice = 0; - hr = device->device->CreateRenderTargetView(texture, &rtv, - renderTarget[0].Assign()); + hr = device->device->CreateRenderTargetView( + texture, &rtv, renderTarget[0].Assign()); if (FAILED(hr)) throw HRError("Failed to create render target view", - hr); + hr); } else { D3D11_RENDER_TARGET_VIEW_DESC rtv; rtv.Format = dxgiFormat; rtv.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; - rtv.Texture2DArray.MipSlice = 0; + rtv.Texture2DArray.MipSlice = 0; rtv.Texture2DArray.ArraySize = 1; for (UINT i = 0; i < 6; i++) { rtv.Texture2DArray.FirstArraySlice = i; - hr = device->device->CreateRenderTargetView(texture, - &rtv, renderTarget[i].Assign()); + hr = device->device->CreateRenderTargetView( + texture, &rtv, renderTarget[i].Assign()); if (FAILED(hr)) throw HRError("Failed to create cube render " - "target view", hr); + "target view", + hr); } } } @@ -221,22 +225,22 @@ #define SHARED_FLAGS (GS_SHARED_TEX | GS_SHARED_KM_TEX) gs_texture_2d::gs_texture_2d(gs_device_t *device, uint32_t width, - uint32_t height, gs_color_format colorFormat, uint32_t levels, - const uint8_t **data, uint32_t flags_, gs_texture_type type, - bool gdiCompatible, bool nv12_) - : gs_texture (device, gs_type::gs_texture_2d, type, levels, - colorFormat), - width (width), - height (height), - flags (flags_), - dxgiFormat (ConvertGSTextureFormat(format)), - isRenderTarget ((flags_ & GS_RENDER_TARGET) != 0), - isGDICompatible (gdiCompatible), - isDynamic ((flags_ & GS_DYNAMIC) != 0), - isShared ((flags_ & SHARED_FLAGS) != 0), - genMipmaps ((flags_ & GS_BUILD_MIPMAPS) != 0), - sharedHandle (GS_INVALID_HANDLE), - nv12 (nv12_) + uint32_t height, gs_color_format colorFormat, + uint32_t levels, const uint8_t **data, + uint32_t flags_, gs_texture_type type, + bool gdiCompatible, bool nv12_) + : gs_texture(device, gs_type::gs_texture_2d, type, levels, colorFormat), + width(width), + height(height), + flags(flags_), + dxgiFormat(ConvertGSTextureFormat(format)), + isRenderTarget((flags_ & GS_RENDER_TARGET) != 0), + isGDICompatible(gdiCompatible), + isDynamic((flags_ & GS_DYNAMIC) != 0), + isShared((flags_ & SHARED_FLAGS) != 0), + genMipmaps((flags_ & GS_BUILD_MIPMAPS) != 0), + sharedHandle(GS_INVALID_HANDLE), + nv12(nv12_) { InitTexture(data); InitResourceView(); @@ -246,25 +250,25 @@ } gs_texture_2d::gs_texture_2d(gs_device_t *device, ID3D11Texture2D *nv12tex, - uint32_t flags_) - : gs_texture (device, gs_type::gs_texture_2d, GS_TEXTURE_2D), - isRenderTarget ((flags_ & GS_RENDER_TARGET) != 0), - isDynamic ((flags_ & GS_DYNAMIC) != 0), - isShared ((flags_ & SHARED_FLAGS) != 0), - genMipmaps ((flags_ & GS_BUILD_MIPMAPS) != 0), - nv12 (true) + uint32_t flags_) + : gs_texture(device, gs_type::gs_texture_2d, GS_TEXTURE_2D), + isRenderTarget((flags_ & GS_RENDER_TARGET) != 0), + isDynamic((flags_ & GS_DYNAMIC) != 0), + isShared((flags_ & SHARED_FLAGS) != 0), + genMipmaps((flags_ & GS_BUILD_MIPMAPS) != 0), + nv12(true), + texture(nv12tex) { - texture = nv12tex; texture->GetDesc(&td); - this->type = GS_TEXTURE_2D; - this->format = GS_R8G8; - this->flags = flags_; - this->levels = 1; - this->device = device; - this->chroma = true; - this->width = td.Width / 2; - this->height = td.Height / 2; + this->type = GS_TEXTURE_2D; + this->format = GS_R8G8; + this->flags = flags_; + this->levels = 1; + this->device = device; + this->chroma = true; + this->width = td.Width / 2; + this->height = td.Height / 2; this->dxgiFormat = DXGI_FORMAT_R8G8_UNORM; InitResourceView(); @@ -273,35 +277,35 @@ } gs_texture_2d::gs_texture_2d(gs_device_t *device, uint32_t handle) - : gs_texture (device, gs_type::gs_texture_2d, - GS_TEXTURE_2D), - isShared (true), - sharedHandle (handle) + : gs_texture(device, gs_type::gs_texture_2d, GS_TEXTURE_2D), + isShared(true), + sharedHandle(handle) { HRESULT hr; hr = device->device->OpenSharedResource((HANDLE)(uintptr_t)handle, - __uuidof(ID3D11Texture2D), (void**)texture.Assign()); + __uuidof(ID3D11Texture2D), + (void **)texture.Assign()); if (FAILED(hr)) throw HRError("Failed to open shared 2D texture", hr); texture->GetDesc(&td); - this->type = GS_TEXTURE_2D; - this->format = ConvertDXGITextureFormat(td.Format); - this->levels = 1; - this->device = device; + this->type = GS_TEXTURE_2D; + this->format = ConvertDXGITextureFormat(td.Format); + this->levels = 1; + this->device = device; - this->width = td.Width; - this->height = td.Height; + this->width = td.Width; + this->height = td.Height; this->dxgiFormat = td.Format; memset(&resourceDesc, 0, sizeof(resourceDesc)); - resourceDesc.Format = td.Format; - resourceDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + resourceDesc.Format = td.Format; + resourceDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; resourceDesc.Texture2D.MipLevels = 1; hr = device->device->CreateShaderResourceView(texture, &resourceDesc, - shaderRes.Assign()); + shaderRes.Assign()); if (FAILED(hr)) throw HRError("Failed to create shader resource view", hr); }
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-vertexbuffer.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-vertexbuffer.cpp
Changed
@@ -19,27 +19,27 @@ #include <graphics/vec3.h> #include "d3d11-subsystem.hpp" -static inline void PushBuffer(vector<ID3D11Buffer*> &buffers, - vector<uint32_t> &strides, ID3D11Buffer *buffer, - size_t elementSize, const char *name) +static inline void PushBuffer(vector<ID3D11Buffer *> &buffers, + vector<uint32_t> &strides, ID3D11Buffer *buffer, + size_t elementSize, const char *name) { if (buffer) { buffers.push_back(buffer); strides.push_back((uint32_t)elementSize); } else { blog(LOG_ERROR, "This vertex shader requires a %s buffer", - name); + name); } } void gs_vertex_buffer::FlushBuffer(ID3D11Buffer *buffer, void *array, - size_t elementSize) + size_t elementSize) { D3D11_MAPPED_SUBRESOURCE msr; HRESULT hr; - if (FAILED(hr = device->context->Map(buffer, 0, - D3D11_MAP_WRITE_DISCARD, 0, &msr))) + if (FAILED(hr = device->context->Map(buffer, 0, D3D11_MAP_WRITE_DISCARD, + 0, &msr))) throw HRError("Failed to map buffer", hr); memcpy(msr.pData, array, elementSize * vbd.data->num); @@ -47,46 +47,49 @@ } void gs_vertex_buffer::MakeBufferList(gs_vertex_shader *shader, - vector<ID3D11Buffer*> &buffers, vector<uint32_t> &strides) + vector<ID3D11Buffer *> &buffers, + vector<uint32_t> &strides) { PushBuffer(buffers, strides, vertexBuffer, sizeof(vec3), "point"); if (shader->hasNormals) PushBuffer(buffers, strides, normalBuffer, sizeof(vec3), - "normal"); + "normal"); if (shader->hasColors) PushBuffer(buffers, strides, colorBuffer, sizeof(uint32_t), - "color"); + "color"); if (shader->hasTangents) PushBuffer(buffers, strides, tangentBuffer, sizeof(vec3), - "tangent"); + "tangent"); if (shader->nTexUnits <= uvBuffers.size()) { for (size_t i = 0; i < shader->nTexUnits; i++) { buffers.push_back(uvBuffers[i]); strides.push_back((uint32_t)uvSizes[i]); } } else { - blog(LOG_ERROR, "This vertex shader requires at least %u " - "texture buffers.", - (uint32_t)shader->nTexUnits); + blog(LOG_ERROR, + "This vertex shader requires at least %u " + "texture buffers.", + (uint32_t)shader->nTexUnits); } } void gs_vertex_buffer::InitBuffer(const size_t elementSize, - const size_t numVerts, void *array, ID3D11Buffer **buffer) + const size_t numVerts, void *array, + ID3D11Buffer **buffer) { D3D11_BUFFER_DESC bd; D3D11_SUBRESOURCE_DATA srd; HRESULT hr; - memset(&bd, 0, sizeof(bd)); + memset(&bd, 0, sizeof(bd)); memset(&srd, 0, sizeof(srd)); - bd.Usage = dynamic ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT; + bd.Usage = dynamic ? D3D11_USAGE_DYNAMIC : D3D11_USAGE_DEFAULT; bd.CPUAccessFlags = dynamic ? D3D11_CPU_ACCESS_WRITE : 0; - bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bd.ByteWidth = UINT(elementSize * numVerts); - srd.pSysMem = array; + bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bd.ByteWidth = UINT(elementSize * numVerts); + srd.pSysMem = array; hr = device->device->CreateBuffer(&bd, &srd, buffer); if (FAILED(hr)) @@ -96,22 +99,22 @@ void gs_vertex_buffer::BuildBuffers() { InitBuffer(sizeof(vec3), vbd.data->num, vbd.data->points, - &vertexBuffer); + &vertexBuffer); if (vbd.data->normals) InitBuffer(sizeof(vec3), vbd.data->num, vbd.data->normals, - &normalBuffer); + &normalBuffer); if (vbd.data->tangents) InitBuffer(sizeof(vec3), vbd.data->num, vbd.data->tangents, - &tangentBuffer); + &tangentBuffer); if (vbd.data->colors) InitBuffer(sizeof(uint32_t), vbd.data->num, vbd.data->colors, - &colorBuffer); + &colorBuffer); for (size_t i = 0; i < vbd.data->num_tex; i++) { - struct gs_tvertarray *tverts = vbd.data->tvarray+i; + struct gs_tvertarray *tverts = vbd.data->tvarray + i; if (tverts->width != 2 && tverts->width != 4) throw "Invalid texture vertex size specified"; @@ -120,7 +123,7 @@ ComPtr<ID3D11Buffer> buffer; InitBuffer(tverts->width * sizeof(float), vbd.data->num, - tverts->array, &buffer); + tverts->array, &buffer); uvBuffers.push_back(buffer); uvSizes.push_back(tverts->width * sizeof(float)); @@ -128,11 +131,11 @@ } gs_vertex_buffer::gs_vertex_buffer(gs_device_t *device, struct gs_vb_data *data, - uint32_t flags) - : gs_obj (device, gs_type::gs_vertex_buffer), - dynamic ((flags & GS_DYNAMIC) != 0), - vbd (data), - numVerts (data->num) + uint32_t flags) + : gs_obj(device, gs_type::gs_vertex_buffer), + dynamic((flags & GS_DYNAMIC) != 0), + vbd(data), + numVerts(data->num) { if (!data->num) throw "Cannot initialize vertex buffer with 0 vertices";
View file
obs-studio-23.2.1.tar.xz/libobs-d3d11/d3d11-zstencilbuffer.cpp -> obs-studio-24.0.0.tar.xz/libobs-d3d11/d3d11-zstencilbuffer.cpp
Changed
@@ -22,37 +22,37 @@ HRESULT hr; memset(&td, 0, sizeof(td)); - td.Width = width; - td.Height = height; - td.MipLevels = 1; - td.ArraySize = 1; - td.Format = dxgiFormat; - td.BindFlags = D3D11_BIND_DEPTH_STENCIL; + td.Width = width; + td.Height = height; + td.MipLevels = 1; + td.ArraySize = 1; + td.Format = dxgiFormat; + td.BindFlags = D3D11_BIND_DEPTH_STENCIL; td.SampleDesc.Count = 1; - td.Usage = D3D11_USAGE_DEFAULT; + td.Usage = D3D11_USAGE_DEFAULT; hr = device->device->CreateTexture2D(&td, NULL, texture.Assign()); if (FAILED(hr)) throw HRError("Failed to create depth stencil texture", hr); memset(&dsvd, 0, sizeof(dsvd)); - dsvd.Format = dxgiFormat; + dsvd.Format = dxgiFormat; dsvd.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; hr = device->device->CreateDepthStencilView(texture, &dsvd, - view.Assign()); + view.Assign()); if (FAILED(hr)) throw HRError("Failed to create depth stencil view", hr); } -gs_zstencil_buffer::gs_zstencil_buffer(gs_device_t *device, - uint32_t width, uint32_t height, - gs_zstencil_format format) - : gs_obj (device, gs_type::gs_zstencil_buffer), - width (width), - height (height), - format (format), - dxgiFormat (ConvertGSZStencilFormat(format)) +gs_zstencil_buffer::gs_zstencil_buffer(gs_device_t *device, uint32_t width, + uint32_t height, + gs_zstencil_format format) + : gs_obj(device, gs_type::gs_zstencil_buffer), + width(width), + height(height), + format(format), + dxgiFormat(ConvertGSZStencilFormat(format)) { InitBuffer(); }
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-cocoa.m -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-cocoa.m
Changed
@@ -21,10 +21,8 @@ #import <Cocoa/Cocoa.h> #import <AppKit/AppKit.h> - //#include "util/darray.h" - struct gl_windowinfo { NSView *view; }; @@ -37,9 +35,15 @@ { unsigned attrib_count = 0; -#define ADD_ATTR(x) \ - { attributes[attrib_count++] = (NSOpenGLPixelFormatAttribute)x; } -#define ADD_ATTR2(x, y) { ADD_ATTR(x); ADD_ATTR(y); } +#define ADD_ATTR(x) \ + { \ + attributes[attrib_count++] = (NSOpenGLPixelFormatAttribute)x; \ + } +#define ADD_ATTR2(x, y) \ + { \ + ADD_ATTR(x); \ + ADD_ATTR(y); \ + } NSOpenGLPixelFormatAttribute attributes[40]; @@ -52,7 +56,7 @@ NSOpenGLPixelFormat *pf; pf = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; - if(!pf) { + if (!pf) { blog(LOG_ERROR, "Failed to create pixel format"); return NULL; } @@ -60,7 +64,7 @@ NSOpenGLContext *context; context = [[NSOpenGLContext alloc] initWithFormat:pf shareContext:nil]; [pf release]; - if(!context) { + if (!context) { blog(LOG_ERROR, "Failed to create context"); return NULL; } @@ -98,7 +102,7 @@ void gl_platform_destroy(struct gl_platform *platform) { - if(!platform) + if (!platform) return; [platform->context release]; @@ -121,10 +125,10 @@ struct gl_windowinfo *gl_windowinfo_create(const struct gs_init_data *info) { - if(!info) + if (!info) return NULL; - if(!info->window.view) + if (!info->window.view) return NULL; struct gl_windowinfo *wi = bzalloc(sizeof(struct gl_windowinfo)); @@ -137,7 +141,7 @@ void gl_windowinfo_destroy(struct gl_windowinfo *wi) { - if(!wi) + if (!wi) return; wi->view = nil; @@ -161,9 +165,14 @@ [NSOpenGLContext clearCurrentContext]; } +void *device_get_device_obj(gs_device_t *device) +{ + return device->plat->context; +} + void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap) { - if(device->cur_swap == swap) + if (device->cur_swap == swap) return; device->cur_swap = swap; @@ -180,14 +189,16 @@ } void gl_getclientsize(const struct gs_swap_chain *swap, uint32_t *width, - uint32_t *height) + uint32_t *height) { - if(width) *width = swap->info.cx; - if(height) *height = swap->info.cy; + if (width) + *width = swap->info.cx; + if (height) + *height = swap->info.cy; } gs_texture_t *device_texture_create_from_iosurface(gs_device_t *device, - void *iosurf) + void *iosurf) { IOSurfaceRef ref = (IOSurfaceRef)iosurf; struct gs_texture_2d *tex = bzalloc(sizeof(struct gs_texture_2d)); @@ -195,23 +206,23 @@ OSType pf = IOSurfaceGetPixelFormat(ref); if (pf != 'BGRA') blog(LOG_ERROR, "Unexpected pixel format: %d (%c%c%c%c)", pf, - pf >> 24, pf >> 16, pf >> 8, pf); + pf >> 24, pf >> 16, pf >> 8, pf); const enum gs_color_format color_format = GS_BGRA; - tex->base.device = device; - tex->base.type = GS_TEXTURE_2D; - tex->base.format = GS_BGRA; - tex->base.levels = 1; - tex->base.gl_format = convert_gs_format(color_format); + tex->base.device = device; + tex->base.type = GS_TEXTURE_2D; + tex->base.format = GS_BGRA; + tex->base.levels = 1; + tex->base.gl_format = convert_gs_format(color_format); tex->base.gl_internal_format = convert_gs_internal_format(color_format); - tex->base.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; - tex->base.gl_target = GL_TEXTURE_RECTANGLE; - tex->base.is_dynamic = false; - tex->base.is_render_target = false; - tex->base.gen_mipmaps = false; - tex->width = IOSurfaceGetWidth(ref); - tex->height = IOSurfaceGetHeight(ref); + tex->base.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; + tex->base.gl_target = GL_TEXTURE_RECTANGLE; + tex->base.is_dynamic = false; + tex->base.is_render_target = false; + tex->base.gen_mipmaps = false; + tex->width = IOSurfaceGetWidth(ref); + tex->height = IOSurfaceGetHeight(ref); if (!gl_gen_textures(1, &tex->base.texture)) goto fail; @@ -220,34 +231,30 @@ goto fail; CGLError err = CGLTexImageIOSurface2D( - [[NSOpenGLContext currentContext] CGLContextObj], - tex->base.gl_target, - tex->base.gl_internal_format, - tex->width, tex->height, - tex->base.gl_format, - tex->base.gl_type, - ref, 0); - - if(err != kCGLNoError) { - blog(LOG_ERROR, "CGLTexImageIOSurface2D: %u, %s" - " (device_texture_create_from_iosurface)", - err, CGLErrorString(err)); + [[NSOpenGLContext currentContext] CGLContextObj], + tex->base.gl_target, tex->base.gl_internal_format, tex->width, + tex->height, tex->base.gl_format, tex->base.gl_type, ref, 0); + + if (err != kCGLNoError) { + blog(LOG_ERROR, + "CGLTexImageIOSurface2D: %u, %s" + " (device_texture_create_from_iosurface)", + err, CGLErrorString(err)); gl_success("CGLTexImageIOSurface2D"); goto fail; } - if (!gl_tex_param_i(tex->base.gl_target, - GL_TEXTURE_MAX_LEVEL, 0)) + if (!gl_tex_param_i(tex->base.gl_target, GL_TEXTURE_MAX_LEVEL, 0)) goto fail; if (!gl_bind_texture(tex->base.gl_target, 0)) goto fail; - return (gs_texture_t*)tex; + return (gs_texture_t *)tex; fail: - gs_texture_destroy((gs_texture_t*)tex); + gs_texture_destroy((gs_texture_t *)tex); blog(LOG_ERROR, "device_texture_create_from_iosurface (GL) failed"); return NULL; } @@ -260,34 +267,31 @@ if (!iosurf) return false; - struct gs_texture_2d *tex = (struct gs_texture_2d*)texture; + struct gs_texture_2d *tex = (struct gs_texture_2d *)texture; IOSurfaceRef ref = (IOSurfaceRef)iosurf; OSType pf = IOSurfaceGetPixelFormat(ref); if (pf != 'BGRA') blog(LOG_ERROR, "Unexpected pixel format: %d (%c%c%c%c)", pf, - pf >> 24, pf >> 16, pf >> 8, pf); + pf >> 24, pf >> 16, pf >> 8, pf); if (tex->width != IOSurfaceGetWidth(ref) || - tex->height != IOSurfaceGetHeight(ref)) + tex->height != IOSurfaceGetHeight(ref)) return false; if (!gl_bind_texture(tex->base.gl_target, tex->base.texture)) return false; CGLError err = CGLTexImageIOSurface2D( - [[NSOpenGLContext currentContext] CGLContextObj], - tex->base.gl_target, - tex->base.gl_internal_format, - tex->width, tex->height, - tex->base.gl_format, - tex->base.gl_type, - ref, 0); - - if(err != kCGLNoError) { - blog(LOG_ERROR, "CGLTexImageIOSurface2D: %u, %s" - " (gs_texture_rebind_iosurface)", - err, CGLErrorString(err)); + [[NSOpenGLContext currentContext] CGLContextObj], + tex->base.gl_target, tex->base.gl_internal_format, tex->width, + tex->height, tex->base.gl_format, tex->base.gl_type, ref, 0); + + if (err != kCGLNoError) { + blog(LOG_ERROR, + "CGLTexImageIOSurface2D: %u, %s" + " (gs_texture_rebind_iosurface)", + err, CGLErrorString(err)); gl_success("CGLTexImageIOSurface2D"); return false;
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-helpers.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-helpers.c
Changed
@@ -18,9 +18,9 @@ #include "gl-subsystem.h" bool gl_init_face(GLenum target, GLenum type, uint32_t num_levels, - GLenum format, GLint internal_format, bool compressed, - uint32_t width, uint32_t height, uint32_t size, - const uint8_t ***p_data) + GLenum format, GLint internal_format, bool compressed, + uint32_t width, uint32_t height, uint32_t size, + const uint8_t ***p_data) { bool success = true; const uint8_t **data = p_data ? *p_data : NULL; @@ -29,14 +29,14 @@ for (i = 0; i < num_levels; i++) { if (compressed) { glCompressedTexImage2D(target, i, internal_format, - width, height, 0, size, - data ? *data : NULL); + width, height, 0, size, + data ? *data : NULL); if (!gl_success("glCompressedTexImage2D")) success = false; } else { glTexImage2D(target, i, internal_format, width, height, - 0, format, type, data ? *data : NULL); + 0, format, type, data ? *data : NULL); if (!gl_success("glTexImage2D")) success = false; } @@ -44,12 +44,14 @@ if (data) data++; - size /= 4; - width /= 2; + size /= 4; + width /= 2; height /= 2; - if (width == 0) width = 1; - if (height == 0) height = 1; + if (width == 0) + width = 1; + if (height == 0) + height = 1; } if (data) @@ -58,8 +60,8 @@ } static bool gl_copy_fbo(struct gs_texture *dst, uint32_t dst_x, uint32_t dst_y, - struct gs_texture *src, uint32_t src_x, uint32_t src_y, - uint32_t width, uint32_t height) + struct gs_texture *src, uint32_t src_x, uint32_t src_y, + uint32_t width, uint32_t height) { struct fbo_info *fbo = get_fbo(src, width, height); GLint last_fbo; @@ -76,7 +78,7 @@ goto fail; glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + 0, - src->gl_target, src->texture, 0); + src->gl_target, src->texture, 0); if (!gl_success("glFrameBufferTexture2D")) goto fail; @@ -85,7 +87,7 @@ goto fail; glCopyTexSubImage2D(dst->gl_target, 0, dst_x, dst_y, src_x, src_y, - width, height); + width, height); if (!gl_success("glCopyTexSubImage2D")) goto fail; @@ -101,27 +103,27 @@ } bool gl_copy_texture(struct gs_device *device, struct gs_texture *dst, - uint32_t dst_x, uint32_t dst_y, struct gs_texture *src, - uint32_t src_x, uint32_t src_y, uint32_t width, - uint32_t height) + uint32_t dst_x, uint32_t dst_y, struct gs_texture *src, + uint32_t src_x, uint32_t src_y, uint32_t width, + uint32_t height) { bool success = false; if (device->copy_type == COPY_TYPE_ARB) { glCopyImageSubData(src->texture, src->gl_target, 0, src_x, - src_y, 0, dst->texture, dst->gl_target, 0, - dst_x, dst_y, 0, width, height, 1); + src_y, 0, dst->texture, dst->gl_target, 0, + dst_x, dst_y, 0, width, height, 1); success = gl_success("glCopyImageSubData"); } else if (device->copy_type == COPY_TYPE_NV) { glCopyImageSubDataNV(src->texture, src->gl_target, 0, src_x, - src_y, 0, dst->texture, dst->gl_target, 0, - dst_x, dst_y, 0, width, height, 1); + src_y, 0, dst->texture, dst->gl_target, 0, + dst_x, dst_y, 0, width, height, 1); success = gl_success("glCopyImageSubDataNV"); } else if (device->copy_type == COPY_TYPE_FBO_BLIT) { success = gl_copy_fbo(dst, dst_x, dst_y, src, src_x, src_y, - width, height); + width, height); if (!success) blog(LOG_ERROR, "gl_copy_texture failed"); } @@ -130,7 +132,7 @@ } bool gl_create_buffer(GLenum target, GLuint *buffer, GLsizeiptr size, - const GLvoid *data, GLenum usage) + const GLvoid *data, GLenum usage) { bool success; if (!gl_gen_buffers(1, buffer)) @@ -156,8 +158,7 @@ /* glMapBufferRange with these flags will actually give far better * performance than a plain glMapBuffer call */ ptr = glMapBufferRange(target, 0, size, - GL_MAP_WRITE_BIT | - GL_MAP_INVALIDATE_BUFFER_BIT); + GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); success = gl_success("glMapBufferRange"); if (success && ptr) { memcpy(ptr, data, size);
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-helpers.h -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-helpers.h
Changed
@@ -17,6 +17,48 @@ #pragma once +static const char *gl_error_to_str(GLenum errorcode) +{ + static const struct { + GLenum error; + const char *str; + } err_to_str[] = { + { + GL_INVALID_ENUM, + "GL_INVALID_ENUM", + }, + { + GL_INVALID_VALUE, + "GL_INVALID_VALUE", + }, + { + GL_INVALID_OPERATION, + "GL_INVALID_OPERATION", + }, + { + GL_INVALID_FRAMEBUFFER_OPERATION, + "GL_INVALID_FRAMEBUFFER_OPERATION", + }, + { + GL_OUT_OF_MEMORY, + "GL_OUT_OF_MEMORY", + }, + { + GL_STACK_UNDERFLOW, + "GL_STACK_UNDERFLOW", + }, + { + GL_STACK_OVERFLOW, + "GL_STACK_OVERFLOW", + }, + }; + for (size_t i = 0; i < sizeof(err_to_str) / sizeof(*err_to_str); i++) { + if (err_to_str[i].error == errorcode) + return err_to_str[i].str; + } + return "Unknown"; +} + /* * Okay, so GL error handling is.. unclean to work with. I don't want * to have to keep typing out the same stuff over and over again do I'll just @@ -27,8 +69,20 @@ { GLenum errorcode = glGetError(); if (errorcode != GL_NO_ERROR) { - blog(LOG_ERROR, "%s failed, glGetError returned 0x%X", - funcname, errorcode); + int attempts = 8; + do { + blog(LOG_ERROR, + "%s failed, glGetError returned %s(0x%X)", + funcname, gl_error_to_str(errorcode), errorcode); + errorcode = glGetError(); + + --attempts; + if (attempts == 0) { + blog(LOG_ERROR, + "Too many GL errors, moving on"); + break; + } + } while (errorcode != GL_NO_ERROR); return false; } @@ -144,17 +198,17 @@ } extern bool gl_init_face(GLenum target, GLenum type, uint32_t num_levels, - GLenum format, GLint internal_format, bool compressed, - uint32_t width, uint32_t height, uint32_t size, - const uint8_t ***p_data); + GLenum format, GLint internal_format, bool compressed, + uint32_t width, uint32_t height, uint32_t size, + const uint8_t ***p_data); extern bool gl_copy_texture(struct gs_device *device, struct gs_texture *dst, - uint32_t dst_x, uint32_t dst_y, struct gs_texture *src, - uint32_t src_x, uint32_t src_y, uint32_t width, - uint32_t height); + uint32_t dst_x, uint32_t dst_y, + struct gs_texture *src, uint32_t src_x, + uint32_t src_y, uint32_t width, uint32_t height); extern bool gl_create_buffer(GLenum target, GLuint *buffer, GLsizeiptr size, - const GLvoid *data, GLenum usage); + const GLvoid *data, GLenum usage); extern bool update_buffer(GLenum target, GLuint buffer, const void *data, - size_t size); + size_t size);
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-indexbuffer.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-indexbuffer.c
Changed
@@ -23,7 +23,7 @@ bool success; success = gl_create_buffer(GL_ELEMENT_ARRAY_BUFFER, &ib->buffer, - ib->size, ib->data, usage); + ib->size, ib->data, usage); if (!ib->dynamic) { bfree(ib->data); @@ -34,21 +34,22 @@ } gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device, - enum gs_index_type type, void *indices, size_t num, - uint32_t flags) + enum gs_index_type type, + void *indices, size_t num, + uint32_t flags) { struct gs_index_buffer *ib = bzalloc(sizeof(struct gs_index_buffer)); size_t width = type == GS_UNSIGNED_LONG ? 4 : 2; - ib->device = device; - ib->data = indices; + ib->device = device; + ib->data = indices; ib->dynamic = flags & GS_DYNAMIC; - ib->num = num; - ib->width = width; - ib->size = width * num; - ib->type = type; - ib->gl_type = type == GS_UNSIGNED_LONG ? GL_UNSIGNED_INT : - GL_UNSIGNED_SHORT; + ib->num = num; + ib->width = width; + ib->size = width * num; + ib->type = type; + ib->gl_type = type == GS_UNSIGNED_LONG ? GL_UNSIGNED_INT + : GL_UNSIGNED_SHORT; if (!init_ib(ib)) { blog(LOG_ERROR, "device_indexbuffer_create (GL) failed"); @@ -71,7 +72,7 @@ } static inline void gs_indexbuffer_flush_internal(gs_indexbuffer_t *ib, - const void *data) + const void *data) { if (!ib->dynamic) { blog(LOG_ERROR, "Index buffer is not dynamic");
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-shader.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-shader.c
Changed
@@ -43,17 +43,17 @@ } static void gl_get_shader_info(GLuint shader, const char *file, - char **error_string) + char **error_string) { - char *errors; - GLint info_len = 0; + char *errors; + GLint info_len = 0; GLsizei chars_written = 0; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_len); if (!gl_success("glGetProgramiv") || !info_len) return; - errors = bzalloc(info_len+1); + errors = bzalloc(info_len + 1); glGetShaderInfoLog(shader, info_len, &chars_written, errors); gl_success("glGetShaderInfoLog"); @@ -66,18 +66,18 @@ } static bool gl_add_param(struct gs_shader *shader, struct shader_var *var, - GLint *texture_id) + GLint *texture_id) { struct gs_shader_param param = {0}; param.array_count = var->array_count; - param.name = bstrdup(var->name); - param.shader = shader; - param.type = get_shader_param_type(var->type); + param.name = bstrdup(var->name); + param.shader = shader; + param.type = get_shader_param_type(var->type); if (param.type == GS_SHADER_PARAM_TEXTURE) { - param.sampler_id = var->gl_sampler_id; - param.texture_id = (*texture_id)++; + param.sampler_id = var->gl_sampler_id; + param.texture_id = (*texture_id)++; } else { param.changed = true; } @@ -90,23 +90,24 @@ } static inline bool gl_add_params(struct gs_shader *shader, - struct gl_shader_parser *glsp) + struct gl_shader_parser *glsp) { size_t i; GLint tex_id = 0; for (i = 0; i < glsp->parser.params.num; i++) - if (!gl_add_param(shader, glsp->parser.params.array+i, &tex_id)) + if (!gl_add_param(shader, glsp->parser.params.array + i, + &tex_id)) return false; shader->viewproj = gs_shader_get_param_by_name(shader, "ViewProj"); - shader->world = gs_shader_get_param_by_name(shader, "World"); + shader->world = gs_shader_get_param_by_name(shader, "World"); return true; } static inline void gl_add_sampler(struct gs_shader *shader, - struct shader_sampler *sampler) + struct shader_sampler *sampler) { gs_samplerstate_t *new_sampler; struct gs_sampler_info info; @@ -118,44 +119,45 @@ } static inline void gl_add_samplers(struct gs_shader *shader, - struct gl_shader_parser *glsp) + struct gl_shader_parser *glsp) { size_t i; for (i = 0; i < glsp->parser.samplers.num; i++) { - struct shader_sampler *sampler = glsp->parser.samplers.array+i; + struct shader_sampler *sampler = + glsp->parser.samplers.array + i; gl_add_sampler(shader, sampler); } } static void get_attrib_type(const char *mapping, enum attrib_type *type, - size_t *index) + size_t *index) { if (strcmp(mapping, "POSITION") == 0) { - *type = ATTRIB_POSITION; + *type = ATTRIB_POSITION; } else if (strcmp(mapping, "NORMAL") == 0) { - *type = ATTRIB_NORMAL; + *type = ATTRIB_NORMAL; } else if (strcmp(mapping, "TANGENT") == 0) { - *type = ATTRIB_TANGENT; + *type = ATTRIB_TANGENT; } else if (strcmp(mapping, "COLOR") == 0) { - *type = ATTRIB_COLOR; + *type = ATTRIB_COLOR; } else if (astrcmp_n(mapping, "TEXCOORD", 8) == 0) { - *type = ATTRIB_TEXCOORD; - *index = (*(mapping+8)) - '0'; + *type = ATTRIB_TEXCOORD; + *index = (*(mapping + 8)) - '0'; return; } else if (strcmp(mapping, "TARGET") == 0) { - *type = ATTRIB_TARGET; + *type = ATTRIB_TARGET; } *index = 0; } static inline bool gl_process_attrib(struct gs_shader *program, - struct gl_parser_attrib *pa) + struct gl_parser_attrib *pa) { struct shader_attrib attrib = {0}; @@ -166,8 +168,8 @@ get_attrib_type(pa->mapping, &attrib.type, &attrib.index); attrib.name = pa->name.array; - pa->name.array = NULL; - pa->name.len = 0; + pa->name.array = NULL; + pa->name.len = 0; pa->name.capacity = 0; da_push_back(program->attribs, &attrib); @@ -175,11 +177,11 @@ } static inline bool gl_process_attribs(struct gs_shader *shader, - struct gl_shader_parser *glsp) + struct gl_shader_parser *glsp) { size_t i; for (i = 0; i < glsp->attribs.num; i++) { - struct gl_parser_attrib *pa = glsp->attribs.array+i; + struct gl_parser_attrib *pa = glsp->attribs.array + i; if (!gl_process_attrib(shader, pa)) return false; } @@ -188,8 +190,8 @@ } static bool gl_shader_init(struct gs_shader *shader, - struct gl_shader_parser *glsp, - const char *file, char **error_string) + struct gl_shader_parser *glsp, const char *file, + char **error_string) { GLenum type = convert_shader_type(shader->type); int compiled = 0; @@ -199,8 +201,8 @@ if (!gl_success("glCreateShader") || !shader->obj) return false; - glShaderSource(shader->obj, 1, (const GLchar**)&glsp->gl_string.array, - 0); + glShaderSource(shader->obj, 1, (const GLchar **)&glsp->gl_string.array, + 0); if (!gl_success("glShaderSource")) return false; @@ -227,7 +229,8 @@ char *infoLog = malloc(sizeof(char) * infoLength); GLsizei returnedLength = 0; - glGetShaderInfoLog(shader->obj, infoLength, &returnedLength, infoLog); + glGetShaderInfoLog(shader->obj, infoLength, &returnedLength, + infoLog); blog(LOG_ERROR, "Error compiling shader:\n%s\n", infoLog); free(infoLog); @@ -249,15 +252,16 @@ } static struct gs_shader *shader_create(gs_device_t *device, - enum gs_shader_type type, const char *shader_str, - const char *file, char **error_string) + enum gs_shader_type type, + const char *shader_str, const char *file, + char **error_string) { struct gs_shader *shader = bzalloc(sizeof(struct gs_shader)); struct gl_shader_parser glsp; bool success = true; shader->device = device; - shader->type = type; + shader->type = type; gl_shader_parser_init(&glsp, type); if (!gl_shader_parse(&glsp, shader_str, file)) @@ -274,25 +278,23 @@ return shader; } -gs_shader_t *device_vertexshader_create(gs_device_t *device, - const char *shader, const char *file, - char **error_string) +gs_shader_t *device_vertexshader_create(gs_device_t *device, const char *shader, + const char *file, char **error_string) { struct gs_shader *ptr; ptr = shader_create(device, GS_SHADER_VERTEX, shader, file, - error_string); + error_string); if (!ptr) blog(LOG_ERROR, "device_vertexshader_create (GL) failed"); return ptr; } -gs_shader_t *device_pixelshader_create(gs_device_t *device, - const char *shader, const char *file, - char **error_string) +gs_shader_t *device_pixelshader_create(gs_device_t *device, const char *shader, + const char *file, char **error_string) { struct gs_shader *ptr; ptr = shader_create(device, GS_SHADER_PIXEL, shader, file, - error_string); + error_string); if (!ptr) blog(LOG_ERROR, "device_pixelshader_create (GL) failed"); return ptr; @@ -307,11 +309,11 @@ bool destroy = false; if (shader->type == GS_SHADER_VERTEX && - program->vertex_shader == shader) + program->vertex_shader == shader) destroy = true; else if (shader->type == GS_SHADER_PIXEL && - program->pixel_shader == shader) + program->pixel_shader == shader) destroy = true; if (destroy) @@ -331,13 +333,13 @@ remove_program_references(shader); for (i = 0; i < shader->attribs.num; i++) - shader_attrib_free(shader->attribs.array+i); + shader_attrib_free(shader->attribs.array + i); for (i = 0; i < shader->samplers.num; i++) gs_samplerstate_destroy(shader->samplers.array[i]); for (i = 0; i < shader->params.num; i++) - shader_param_free(shader->params.array+i); + shader_param_free(shader->params.array + i); if (shader->obj) { glDeleteShader(shader->obj); @@ -358,14 +360,14 @@ gs_sparam_t *gs_shader_get_param_by_idx(gs_shader_t *shader, uint32_t param) { assert(param < shader->params.num); - return shader->params.array+param; + return shader->params.array + param; } gs_sparam_t *gs_shader_get_param_by_name(gs_shader_t *shader, const char *name) { size_t i; for (i = 0; i < shader->params.num; i++) { - struct gs_shader_param *param = shader->params.array+i; + struct gs_shader_param *param = shader->params.array + i; if (strcmp(param->name, name) == 0) return param; @@ -385,7 +387,7 @@ } void gs_shader_get_param_info(const gs_sparam_t *param, - struct gs_shader_param_info *info) + struct gs_shader_param_info *info) { info->type = param->type; info->name = param->name; @@ -441,14 +443,14 @@ } static inline bool validate_param(struct program_param *pp, - size_t expected_size) + size_t expected_size) { if (pp->param->cur_value.num != expected_size) { - blog(LOG_ERROR, "Parameter '%s' set to invalid size %u, " - "expected %u", - pp->param->name, - (unsigned int)pp->param->cur_value.num, - (unsigned int)expected_size); + blog(LOG_ERROR, + "Parameter '%s' set to invalid size %u, " + "expected %u", + pp->param->name, (unsigned int)pp->param->cur_value.num, + (unsigned int)expected_size); return false; } @@ -456,63 +458,62 @@ } static void program_set_param_data(struct gs_program *program, - struct program_param *pp) + struct program_param *pp) { void *array = pp->param->cur_value.array; if (pp->param->type == GS_SHADER_PARAM_BOOL || pp->param->type == GS_SHADER_PARAM_INT) { if (validate_param(pp, sizeof(int))) { - glUniform1iv(pp->obj, 1, (int*)array); + glUniform1iv(pp->obj, 1, (int *)array); gl_success("glUniform1iv"); } } else if (pp->param->type == GS_SHADER_PARAM_INT2) { if (validate_param(pp, sizeof(int) * 2)) { - glUniform2iv(pp->obj, 1, (int*)array); + glUniform2iv(pp->obj, 1, (int *)array); gl_success("glUniform2iv"); } } else if (pp->param->type == GS_SHADER_PARAM_INT3) { if (validate_param(pp, sizeof(int) * 3)) { - glUniform3iv(pp->obj, 1, (int*)array); + glUniform3iv(pp->obj, 1, (int *)array); gl_success("glUniform3iv"); } } else if (pp->param->type == GS_SHADER_PARAM_INT4) { if (validate_param(pp, sizeof(int) * 4)) { - glUniform4iv(pp->obj, 1, (int*)array); + glUniform4iv(pp->obj, 1, (int *)array); gl_success("glUniform4iv"); } } else if (pp->param->type == GS_SHADER_PARAM_FLOAT) { if (validate_param(pp, sizeof(float))) { - glUniform1fv(pp->obj, 1, (float*)array); + glUniform1fv(pp->obj, 1, (float *)array); gl_success("glUniform1fv"); } } else if (pp->param->type == GS_SHADER_PARAM_VEC2) { if (validate_param(pp, sizeof(struct vec2))) { - glUniform2fv(pp->obj, 1, (float*)array); + glUniform2fv(pp->obj, 1, (float *)array); gl_success("glUniform2fv"); } } else if (pp->param->type == GS_SHADER_PARAM_VEC3) { if (validate_param(pp, sizeof(float) * 3)) { - glUniform3fv(pp->obj, 1, (float*)array); + glUniform3fv(pp->obj, 1, (float *)array); gl_success("glUniform3fv"); } } else if (pp->param->type == GS_SHADER_PARAM_VEC4) { if (validate_param(pp, sizeof(struct vec4))) { - glUniform4fv(pp->obj, 1, (float*)array); + glUniform4fv(pp->obj, 1, (float *)array); gl_success("glUniform4fv"); } } else if (pp->param->type == GS_SHADER_PARAM_MATRIX4X4) { if (validate_param(pp, sizeof(struct matrix4))) { - glUniformMatrix4fv(pp->obj, 1, false, - (float*)array); + glUniformMatrix4fv(pp->obj, 1, false, (float *)array); gl_success("glUniformMatrix4fv"); } @@ -525,7 +526,7 @@ glUniform1i(pp->obj, pp->param->texture_id); device_load_texture(program->device, pp->param->texture, - pp->param->texture_id); + pp->param->texture_id); } } @@ -539,15 +540,15 @@ static void print_link_errors(GLuint program) { - char *errors = NULL; - GLint info_len = 0; + char *errors = NULL; + GLint info_len = 0; GLsizei chars_written = 0; glGetProgramiv(program, GL_INFO_LOG_LENGTH, &info_len); if (!gl_success("glGetProgramiv") || !info_len) return; - errors = calloc(1, info_len+1); + errors = calloc(1, info_len + 1); glGetProgramInfoLog(program, info_len, &chars_written, errors); gl_success("glGetShaderInfoLog"); @@ -557,15 +558,17 @@ } static bool assign_program_attrib(struct gs_program *program, - struct shader_attrib *attrib) + struct shader_attrib *attrib) { GLint attrib_obj = glGetAttribLocation(program->obj, attrib->name); if (!gl_success("glGetAttribLocation")) return false; if (attrib_obj == -1) { - blog(LOG_ERROR, "glGetAttribLocation: Could not find " - "attribute '%s'", attrib->name); + blog(LOG_ERROR, + "glGetAttribLocation: Could not find " + "attribute '%s'", + attrib->name); return false; } @@ -587,7 +590,7 @@ } static bool assign_program_param(struct gs_program *program, - struct gs_shader_param *param) + struct gs_shader_param *param) { struct program_param info; @@ -605,7 +608,7 @@ } static inline bool assign_program_shader_params(struct gs_program *program, - struct gs_shader *shader) + struct gs_shader *shader) { for (size_t i = 0; i < shader->params.num; i++) { struct gs_shader_param *param = shader->params.array + i; @@ -631,9 +634,9 @@ struct gs_program *program = bzalloc(sizeof(*program)); int linked = false; - program->device = device; + program->device = device; program->vertex_shader = device->cur_vertex_shader; - program->pixel_shader = device->cur_pixel_shader; + program->pixel_shader = device->cur_pixel_shader; program->obj = glCreateProgram(); if (!gl_success("glCreateProgram")) @@ -725,18 +728,39 @@ count = 1; switch ((uint32_t)param->type) { - case GS_SHADER_PARAM_FLOAT: expected_size = sizeof(float); break; + case GS_SHADER_PARAM_FLOAT: + expected_size = sizeof(float); + break; case GS_SHADER_PARAM_BOOL: - case GS_SHADER_PARAM_INT: expected_size = sizeof(int); break; - case GS_SHADER_PARAM_INT2: expected_size = sizeof(int) * 2; break; - case GS_SHADER_PARAM_INT3: expected_size = sizeof(int) * 3; break; - case GS_SHADER_PARAM_INT4: expected_size = sizeof(int) * 4; break; - case GS_SHADER_PARAM_VEC2: expected_size = sizeof(float)*2; break; - case GS_SHADER_PARAM_VEC3: expected_size = sizeof(float)*3; break; - case GS_SHADER_PARAM_VEC4: expected_size = sizeof(float)*4; break; - case GS_SHADER_PARAM_MATRIX4X4: expected_size = sizeof(float)*4*4;break; - case GS_SHADER_PARAM_TEXTURE: expected_size = sizeof(void*); break; - default: expected_size = 0; + case GS_SHADER_PARAM_INT: + expected_size = sizeof(int); + break; + case GS_SHADER_PARAM_INT2: + expected_size = sizeof(int) * 2; + break; + case GS_SHADER_PARAM_INT3: + expected_size = sizeof(int) * 3; + break; + case GS_SHADER_PARAM_INT4: + expected_size = sizeof(int) * 4; + break; + case GS_SHADER_PARAM_VEC2: + expected_size = sizeof(float) * 2; + break; + case GS_SHADER_PARAM_VEC3: + expected_size = sizeof(float) * 3; + break; + case GS_SHADER_PARAM_VEC4: + expected_size = sizeof(float) * 4; + break; + case GS_SHADER_PARAM_MATRIX4X4: + expected_size = sizeof(float) * 4 * 4; + break; + case GS_SHADER_PARAM_TEXTURE: + expected_size = sizeof(void *); + break; + default: + expected_size = 0; } expected_size *= count; @@ -745,12 +769,12 @@ if (expected_size != size) { blog(LOG_ERROR, "gs_shader_set_val (GL): Size of shader " - "param does not match the size of the input"); + "param does not match the size of the input"); return; } if (param->type == GS_SHADER_PARAM_TEXTURE) - gs_shader_set_texture(param, *(gs_texture_t**)val); + gs_shader_set_texture(param, *(gs_texture_t **)val); else da_copy_array(param->cur_value, val, size); }
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-shaderparser.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-shaderparser.c
Changed
@@ -19,14 +19,15 @@ #include "gl-shaderparser.h" static void gl_write_function_contents(struct gl_shader_parser *glsp, - struct cf_token **p_token, const char *end); + struct cf_token **p_token, + const char *end); static inline struct shader_var *sp_getparam(struct gl_shader_parser *glsp, - struct cf_token *token) + struct cf_token *token) { size_t i; for (i = 0; i < glsp->parser.params.num; i++) { - struct shader_var *param = glsp->parser.params.array+i; + struct shader_var *param = glsp->parser.params.array + i; if (strref_cmp(&token->str, param->name) == 0) return param; } @@ -35,11 +36,12 @@ } static inline size_t sp_getsampler(struct gl_shader_parser *glsp, - struct cf_token *token) + struct cf_token *token) { size_t i; for (i = 0; i < glsp->parser.samplers.num; i++) { - struct shader_sampler *sampler = glsp->parser.samplers.array+i; + struct shader_sampler *sampler = + glsp->parser.samplers.array + i; if (strref_cmp(&token->str, sampler->name) == 0) return i; } @@ -48,14 +50,14 @@ } static inline int cmp_type(const char *name, const size_t name_len, - const char *type, const size_t type_len) + const char *type, const size_t type_len) { size_t min_len = (name_len < type_len) ? type_len : name_len; return astrcmp_n(name, type, min_len); } -static bool gl_write_type_n(struct gl_shader_parser *glsp, - const char *type, size_t len) +static bool gl_write_type_n(struct gl_shader_parser *glsp, const char *type, + size_t len) { if (cmp_type(type, len, "float2", 6) == 0) dstr_cat(&glsp->gl_string, "vec2"); @@ -90,14 +92,14 @@ } static inline void gl_write_type(struct gl_shader_parser *glsp, - const char *type) + const char *type) { if (!gl_write_type_n(glsp, type, strlen(type))) dstr_cat(&glsp->gl_string, type); } static inline bool gl_write_type_token(struct gl_shader_parser *glsp, - struct cf_token *token) + struct cf_token *token) { return gl_write_type_n(glsp, token->str.array, token->str.len); } @@ -122,7 +124,7 @@ { size_t i; for (i = 0; i < glsp->parser.params.num; i++) { - struct shader_var *var = glsp->parser.params.array+i; + struct shader_var *var = glsp->parser.params.array + i; gl_write_var(glsp, var); dstr_cat(&glsp->gl_string, ";\n"); } @@ -131,12 +133,13 @@ } static void gl_write_storage_var(struct gl_shader_parser *glsp, - struct shader_var *var, bool input, const char *prefix); + struct shader_var *var, bool input, + const char *prefix); /* unwraps a structure that's used for input/output */ static void gl_unwrap_storage_struct(struct gl_shader_parser *glsp, - struct shader_struct *st, const char *name, bool input, - const char *prefix) + struct shader_struct *st, const char *name, + bool input, const char *prefix) { struct dstr prefix_str; size_t i; @@ -148,7 +151,7 @@ dstr_cat(&prefix_str, "_"); for (i = 0; i < st->vars.num; i++) { - struct shader_var *st_var = st->vars.array+i; + struct shader_var *st_var = st->vars.array + i; gl_write_storage_var(glsp, st_var, input, prefix_str.array); } @@ -156,14 +159,24 @@ } static void gl_write_storage_var(struct gl_shader_parser *glsp, - struct shader_var *var, bool input, const char *prefix) + struct shader_var *var, bool input, + const char *prefix) { - struct shader_struct *st = shader_parser_getstruct(&glsp->parser, - var->type); + struct shader_struct *st = + shader_parser_getstruct(&glsp->parser, var->type); if (st) { gl_unwrap_storage_struct(glsp, st, var->name, input, prefix); } else { + if (input && (strcmp(var->mapping, "VERTEXID") == 0)) + return; + if (strcmp(var->mapping, "POSITION") == 0) { + if (!input && (glsp->type == GS_SHADER_VERTEX)) + return; + if (input && (glsp->type == GS_SHADER_PIXEL)) + return; + } + struct gl_parser_attrib attrib; gl_parser_attrib_init(&attrib); @@ -178,24 +191,24 @@ dstr_cat_dstr(&glsp->gl_string, &attrib.name); dstr_cat(&glsp->gl_string, ";\n"); - attrib.input = input; + attrib.input = input; attrib.mapping = var->mapping; da_push_back(glsp->attribs, &attrib); } } static inline void gl_write_inputs(struct gl_shader_parser *glsp, - struct shader_func *main) + struct shader_func *main) { size_t i; for (i = 0; i < main->params.num; i++) - gl_write_storage_var(glsp, main->params.array+i, true, - "inputval_"); + gl_write_storage_var(glsp, main->params.array + i, true, + "inputval_"); dstr_cat(&glsp->gl_string, "\n"); } static void gl_write_outputs(struct gl_shader_parser *glsp, - struct shader_func *main) + struct shader_func *main) { struct shader_var var = {0}; var.type = main->return_type; @@ -208,7 +221,7 @@ } static void gl_write_struct(struct gl_shader_parser *glsp, - struct shader_struct *st) + struct shader_struct *st) { size_t i; dstr_cat(&glsp->gl_string, "struct "); @@ -216,7 +229,7 @@ dstr_cat(&glsp->gl_string, " {\n"); for (i = 0; i < st->vars.num; i++) { - struct shader_var *var = st->vars.array+i; + struct shader_var *var = st->vars.array + i; dstr_cat(&glsp->gl_string, "\t"); gl_write_var(glsp, var); @@ -230,7 +243,7 @@ { if (glsp->type == GS_SHADER_VERTEX) { dstr_cat(&glsp->gl_string, "out gl_PerVertex {\n" - "\tvec4 gl_Position;\n};\n\n"); + "\tvec4 gl_Position;\n};\n\n"); } } @@ -238,7 +251,7 @@ { size_t i; for (i = 0; i < glsp->parser.structs.num; i++) { - struct shader_struct *st = glsp->parser.structs.array+i; + struct shader_struct *st = glsp->parser.structs.array + i; gl_write_struct(glsp, st); } } @@ -267,13 +280,15 @@ */ static bool gl_write_mul(struct gl_shader_parser *glsp, - struct cf_token **p_token) + struct cf_token **p_token) { struct cf_parser *cfp = &glsp->parser.cfp; cfp->cur_token = *p_token; - if (!cf_next_token(cfp)) return false; - if (!cf_token_is(cfp, "(")) return false; + if (!cf_next_token(cfp)) + return false; + if (!cf_token_is(cfp, "(")) + return false; dstr_cat(&glsp->gl_string, "("); gl_write_function_contents(glsp, &cfp->cur_token, ","); @@ -287,13 +302,15 @@ } static bool gl_write_saturate(struct gl_shader_parser *glsp, - struct cf_token **p_token) + struct cf_token **p_token) { struct cf_parser *cfp = &glsp->parser.cfp; cfp->cur_token = *p_token; - if (!cf_next_token(cfp)) return false; - if (!cf_token_is(cfp, "(")) return false; + if (!cf_next_token(cfp)) + return false; + if (!cf_token_is(cfp, "(")) + return false; dstr_cat(&glsp->gl_string, "clamp"); gl_write_function_contents(glsp, &cfp->cur_token, ")"); @@ -304,24 +321,30 @@ } static inline bool gl_write_texture_call(struct gl_shader_parser *glsp, - struct shader_var *var, const char *call, bool sampler) + struct shader_var *var, + const char *call, bool sampler) { struct cf_parser *cfp = &glsp->parser.cfp; - size_t sampler_id = (size_t)-1; - if (!cf_next_token(cfp)) return false; - if (!cf_token_is(cfp, "(")) return false; + if (!cf_next_token(cfp)) + return false; + if (!cf_token_is(cfp, "(")) + return false; if (sampler) { - if (!cf_next_token(cfp)) return false; - sampler_id = sp_getsampler(glsp, cfp->cur_token); - if (sampler_id == (size_t) -1) return false; - if (!cf_next_token(cfp)) return false; - if (!cf_token_is(cfp, ",")) return false; + if (!cf_next_token(cfp)) + return false; + const size_t sampler_id = sp_getsampler(glsp, cfp->cur_token); + if (sampler_id == (size_t)-1) + return false; + if (!cf_next_token(cfp)) + return false; + if (!cf_token_is(cfp, ",")) + return false; + + var->gl_sampler_id = sampler_id; } - var->gl_sampler_id = sampler_id; - dstr_cat(&glsp->gl_string, call); dstr_cat(&glsp->gl_string, "("); dstr_cat(&glsp->gl_string, var->name); @@ -331,15 +354,19 @@ /* processes texture.Sample(sampler, texcoord) */ static bool gl_write_texture_code(struct gl_shader_parser *glsp, - struct cf_token **p_token, struct shader_var *var) + struct cf_token **p_token, + struct shader_var *var) { struct cf_parser *cfp = &glsp->parser.cfp; bool written = false; cfp->cur_token = *p_token; - if (!cf_next_token(cfp)) return false; - if (!cf_token_is(cfp, ".")) return false; - if (!cf_next_token(cfp)) return false; + if (!cf_next_token(cfp)) + return false; + if (!cf_token_is(cfp, ".")) + return false; + if (!cf_next_token(cfp)) + return false; const char *function_end = ")"; @@ -360,7 +387,8 @@ if (!written) return false; - if (!cf_next_token(cfp)) return false; + if (!cf_next_token(cfp)) + return false; gl_write_function_contents(glsp, &cfp->cur_token, ")"); dstr_cat(&glsp->gl_string, function_end); @@ -370,7 +398,7 @@ } static bool gl_write_intrinsic(struct gl_shader_parser *glsp, - struct cf_token **p_token) + struct cf_token **p_token) { struct cf_token *token = *p_token; bool written = true; @@ -407,13 +435,13 @@ } static void gl_write_function_contents(struct gl_shader_parser *glsp, - struct cf_token **p_token, const char *end) + struct cf_token **p_token, + const char *end) { struct cf_token *token = *p_token; - if (token->type != CFTOKEN_NAME - || ( !gl_write_type_token(glsp, token) - && !gl_write_intrinsic(glsp, &token))) + if (token->type != CFTOKEN_NAME || (!gl_write_type_token(glsp, token) && + !gl_write_intrinsic(glsp, &token))) dstr_cat_strref(&glsp->gl_string, &token->str); while (token->type != CFTOKEN_NONE) { @@ -444,7 +472,7 @@ } static void gl_write_function(struct gl_shader_parser *glsp, - struct shader_func *func) + struct shader_func *func) { size_t i; struct cf_token *token; @@ -460,7 +488,7 @@ dstr_cat(&glsp->gl_string, "("); for (i = 0; i < func->params.num; i++) { - struct shader_var *param = func->params.array+i; + struct shader_var *param = func->params.array + i; if (i > 0) dstr_cat(&glsp->gl_string, ", "); @@ -478,14 +506,14 @@ { size_t i; for (i = 0; i < glsp->parser.funcs.num; i++) { - struct shader_func *func = glsp->parser.funcs.array+i; + struct shader_func *func = glsp->parser.funcs.array + i; gl_write_function(glsp, func); } } -static inline void gl_write_main_interface_assign( - struct gl_shader_parser *glsp, struct shader_var *var, - const char *src) +static inline void gl_write_main_interface_assign(struct gl_shader_parser *glsp, + struct shader_var *var, + const char *src) { /* vertex shaders: write gl_Position */ if (glsp->type == GS_SHADER_VERTEX && @@ -498,12 +526,13 @@ } static void gl_write_main_storage_assign(struct gl_shader_parser *glsp, - struct shader_var *var, const char *dst, const char *src, - bool input) + struct shader_var *var, + const char *dst, const char *src, + bool input) { struct shader_struct *st; struct dstr dst_copy = {0}; - char ch_left = input ? '.' : '_'; + char ch_left = input ? '.' : '_'; char ch_right = input ? '_' : '.'; if (dst) { @@ -526,20 +555,31 @@ dstr_cat_ch(&src_copy, ch_right); for (i = 0; i < st->vars.num; i++) { - struct shader_var *st_var = st->vars.array+i; + struct shader_var *st_var = st->vars.array + i; gl_write_main_storage_assign(glsp, st_var, - dst_copy.array, src_copy.array, input); + dst_copy.array, + src_copy.array, input); } dstr_free(&src_copy); } else { - if (!dstr_is_empty(&dst_copy)) - dstr_cat_dstr(&glsp->gl_string, &dst_copy); - dstr_cat(&glsp->gl_string, " = "); - if (src) - dstr_cat(&glsp->gl_string, src); - dstr_cat(&glsp->gl_string, var->name); - dstr_cat(&glsp->gl_string, ";\n"); + if (input || (glsp->type != GS_SHADER_VERTEX) || + (strcmp(var->mapping, "POSITION"))) { + if (!dstr_is_empty(&dst_copy)) + dstr_cat_dstr(&glsp->gl_string, &dst_copy); + dstr_cat(&glsp->gl_string, " = "); + if (input && (strcmp(var->mapping, "VERTEXID") == 0)) + dstr_cat(&glsp->gl_string, "uint(gl_VertexID)"); + else if (input && (glsp->type == GS_SHADER_PIXEL) && + (strcmp(var->mapping, "POSITION") == 0)) + dstr_cat(&glsp->gl_string, "gl_FragCoord"); + else { + if (src) + dstr_cat(&glsp->gl_string, src); + dstr_cat(&glsp->gl_string, var->name); + } + dstr_cat(&glsp->gl_string, ";\n"); + } if (!input) gl_write_main_interface_assign(glsp, var, src); @@ -549,28 +589,28 @@ } static inline void gl_write_main_storage_inputs(struct gl_shader_parser *glsp, - struct shader_func *main) + struct shader_func *main) { gl_write_main_storage_assign(glsp, main->params.array, NULL, - "inputval_", true); + "inputval_", true); } static inline void gl_write_main_storage_outputs(struct gl_shader_parser *glsp, - struct shader_func *main) + struct shader_func *main) { /* we only do this *if* we're writing a struct, because otherwise * the call to 'main' already does the assignment for us */ if (!main->mapping) { struct shader_var var = {0}; var.name = "outputval"; - var.type = (char*)main->return_type; + var.type = main->return_type; dstr_cat(&glsp->gl_string, "\n"); gl_write_main_storage_assign(glsp, &var, NULL, NULL, false); } } static inline void gl_write_main_vars(struct gl_shader_parser *glsp, - struct shader_func *main_func) + struct shader_func *main_func) { size_t i; for (i = 0; i < main_func->params.num; i++) { @@ -589,7 +629,7 @@ } static inline void gl_write_main_func_call(struct gl_shader_parser *glsp, - struct shader_func *main_func) + struct shader_func *main_func) { size_t i; dstr_cat(&glsp->gl_string, "\n\toutputval = _main_wrap("); @@ -604,7 +644,7 @@ } static void gl_write_main(struct gl_shader_parser *glsp, - struct shader_func *main) + struct shader_func *main) { dstr_cat(&glsp->gl_string, "void main(void)\n{\n"); @@ -622,22 +662,22 @@ size_t i = 0, input_idx = 0, output_idx = 0; for (i = 0; i < glsp->attribs.num; i++) { - struct gl_parser_attrib *attrib = glsp->attribs.array+i; + struct gl_parser_attrib *attrib = glsp->attribs.array + i; struct dstr new_name = {0}; const char *prefix; size_t val; if (attrib->input) { prefix = glsp->input_prefix; - val = input_idx++; + val = input_idx++; } else { prefix = glsp->output_prefix; - val = output_idx++; + val = output_idx++; } dstr_printf(&new_name, "%s%u", prefix, (unsigned int)val); dstr_replace(&glsp->gl_string, attrib->name.array, - new_name.array); + new_name.array); dstr_move(&attrib->name, &new_name); } } @@ -653,6 +693,7 @@ } dstr_copy(&glsp->gl_string, "#version 150\n\n"); + dstr_cat(&glsp->gl_string, "const bool obs_glsl_compile = true;\n\n"); gl_write_params(glsp); gl_write_inputs(glsp, main_func); gl_write_outputs(glsp, main_func); @@ -665,8 +706,8 @@ return true; } -bool gl_shader_parse(struct gl_shader_parser *glsp, - const char *shader_str, const char *file) +bool gl_shader_parse(struct gl_shader_parser *glsp, const char *shader_str, + const char *file) { bool success = shader_parse(&glsp->parser, shader_str, file); char *str = shader_parser_geterrors(&glsp->parser);
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-shaderparser.h -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-shaderparser.h
Changed
@@ -28,8 +28,8 @@ struct gl_parser_attrib { struct dstr name; - const char *mapping; - bool input; + const char *mapping; + bool input; }; static inline void gl_parser_attrib_init(struct gl_parser_attrib *attr) @@ -43,26 +43,26 @@ } struct gl_shader_parser { - enum gs_shader_type type; - const char *input_prefix; - const char *output_prefix; - struct shader_parser parser; - struct dstr gl_string; - - DARRAY(uint32_t) texture_samplers; + enum gs_shader_type type; + const char *input_prefix; + const char *output_prefix; + struct shader_parser parser; + struct dstr gl_string; + + DARRAY(uint32_t) texture_samplers; DARRAY(struct gl_parser_attrib) attribs; }; static inline void gl_shader_parser_init(struct gl_shader_parser *glsp, - enum gs_shader_type type) + enum gs_shader_type type) { glsp->type = type; if (type == GS_SHADER_VERTEX) { - glsp->input_prefix = "_input_attrib"; + glsp->input_prefix = "_input_attrib"; glsp->output_prefix = "_vertex_shader_attrib"; } else if (type == GS_SHADER_PIXEL) { - glsp->input_prefix = "_vertex_shader_attrib"; + glsp->input_prefix = "_vertex_shader_attrib"; glsp->output_prefix = "_pixel_shader_attrib"; } @@ -76,7 +76,7 @@ { size_t i; for (i = 0; i < glsp->attribs.num; i++) - gl_parser_attrib_free(glsp->attribs.array+i); + gl_parser_attrib_free(glsp->attribs.array + i); da_free(glsp->attribs); da_free(glsp->texture_samplers); @@ -85,4 +85,4 @@ } extern bool gl_shader_parse(struct gl_shader_parser *glsp, - const char *shader_str, const char *file); + const char *shader_str, const char *file);
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-stagesurf.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-stagesurf.c
Changed
@@ -28,8 +28,8 @@ if (!gl_bind_buffer(GL_PIXEL_PACK_BUFFER, surf->pack_buffer)) return false; - size = surf->width * surf->bytes_per_pixel; - size = (size+3) & 0xFFFFFFFC; /* align width to 4-byte boundary */ + size = surf->width * surf->bytes_per_pixel; + size = (size + 3) & 0xFFFFFFFC; /* align width to 4-byte boundary */ size *= surf->height; glBufferData(GL_PIXEL_PACK_BUFFER, size, 0, GL_DYNAMIC_READ); @@ -43,18 +43,19 @@ } gs_stagesurf_t *device_stagesurface_create(gs_device_t *device, uint32_t width, - uint32_t height, enum gs_color_format color_format) + uint32_t height, + enum gs_color_format color_format) { struct gs_stage_surface *surf; surf = bzalloc(sizeof(struct gs_stage_surface)); - surf->device = device; - surf->format = color_format; - surf->width = width; - surf->height = height; - surf->gl_format = convert_gs_format(color_format); + surf->device = device; + surf->format = color_format; + surf->width = width; + surf->height = height; + surf->gl_format = convert_gs_format(color_format); surf->gl_internal_format = convert_gs_internal_format(color_format); - surf->gl_type = get_gl_format_type(color_format); - surf->bytes_per_pixel = gs_get_format_bpp(color_format)/8; + surf->gl_type = get_gl_format_type(color_format); + surf->bytes_per_pixel = gs_get_format_bpp(color_format) / 8; if (!create_pixel_pack_buffer(surf)) { blog(LOG_ERROR, "device_stagesurface_create (GL) failed"); @@ -99,7 +100,7 @@ if (src->width != dst->width || src->height != dst->height) { blog(LOG_ERROR, "Source and destination must have the same " - "dimensions"); + "dimensions"); return false; } @@ -111,9 +112,9 @@ /* Apparently for mac, PBOs won't do an asynchronous transfer unless you use * FBOs along with glReadPixels, which is really dumb. */ void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst, - gs_texture_t *src) + gs_texture_t *src) { - struct gs_texture_2d *tex2d = (struct gs_texture_2d*)src; + struct gs_texture_2d *tex2d = (struct gs_texture_2d *)src; struct fbo_info *fbo; GLint last_fbo; bool success = false; @@ -132,12 +133,12 @@ goto failed_unbind_buffer; glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + 0, - src->gl_target, src->texture, 0); + src->gl_target, src->texture, 0); if (!gl_success("glFrameBufferTexture2D")) goto failed_unbind_all; glReadPixels(0, 0, dst->width, dst->height, dst->gl_format, - dst->gl_type, 0); + dst->gl_type, 0); if (!gl_success("glReadPixels")) goto failed_unbind_all; @@ -159,9 +160,9 @@ #else void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst, - gs_texture_t *src) + gs_texture_t *src) { - struct gs_texture_2d *tex2d = (struct gs_texture_2d*)src; + struct gs_texture_2d *tex2d = (struct gs_texture_2d *)src; if (!can_stage(dst, tex2d)) goto failed; @@ -198,14 +199,14 @@ return stagesurf->height; } -enum gs_color_format gs_stagesurface_get_color_format( - const gs_stagesurf_t *stagesurf) +enum gs_color_format +gs_stagesurface_get_color_format(const gs_stagesurf_t *stagesurf) { return stagesurf->format; } bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data, - uint32_t *linesize) + uint32_t *linesize) { if (!gl_bind_buffer(GL_PIXEL_PACK_BUFFER, stagesurf->pack_buffer)) goto fail;
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-subsystem.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-subsystem.c
Changed
@@ -27,9 +27,9 @@ #ifdef _DEBUG -static void APIENTRY gl_debug_proc( - GLenum source, GLenum type, GLuint id, GLenum severity, - GLsizei length, const GLchar *message, const GLvoid *data ) +static void APIENTRY gl_debug_proc(GLenum source, GLenum type, GLuint id, + GLenum severity, GLsizei length, + const GLchar *message, const GLvoid *data) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(data); @@ -45,58 +45,71 @@ } #endif - switch(source) { + switch (source) { case GL_DEBUG_SOURCE_API: - source_str = "API"; break; + source_str = "API"; + break; case GL_DEBUG_SOURCE_WINDOW_SYSTEM: - source_str = "Window System"; break; + source_str = "Window System"; + break; case GL_DEBUG_SOURCE_SHADER_COMPILER: - source_str = "Shader Compiler"; break; + source_str = "Shader Compiler"; + break; case GL_DEBUG_SOURCE_THIRD_PARTY: - source_str = "Third Party"; break; + source_str = "Third Party"; + break; case GL_DEBUG_SOURCE_APPLICATION: - source_str = "Application"; break; + source_str = "Application"; + break; case GL_DEBUG_SOURCE_OTHER: - source_str = "Other"; break; + source_str = "Other"; + break; default: source_str = "Unknown"; } - switch(type) { + switch (type) { case GL_DEBUG_TYPE_ERROR: - type_str = "Error"; break; + type_str = "Error"; + break; case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: - type_str = "Deprecated Behavior"; break; + type_str = "Deprecated Behavior"; + break; case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: - type_str = "Undefined Behavior"; break; + type_str = "Undefined Behavior"; + break; case GL_DEBUG_TYPE_PORTABILITY: - type_str = "Portability"; break; + type_str = "Portability"; + break; case GL_DEBUG_TYPE_PERFORMANCE: - type_str = "Performance"; break; + type_str = "Performance"; + break; case GL_DEBUG_TYPE_OTHER: - type_str = "Other"; break; - default: + type_str = "Other"; + break; + default: type_str = "Unknown"; } - switch(severity) { + switch (severity) { case GL_DEBUG_SEVERITY_HIGH: - severity_str = "High"; break; + severity_str = "High"; + break; case GL_DEBUG_SEVERITY_MEDIUM: - severity_str = "Medium"; break; + severity_str = "Medium"; + break; case GL_DEBUG_SEVERITY_LOW: - severity_str = "Low"; break; + severity_str = "Low"; + break; case GL_DEBUG_SEVERITY_NOTIFICATION: - severity_str = "Notification"; break; + severity_str = "Notification"; + break; default: severity_str = "Unknown"; } - blog(LOG_DEBUG, - "[%s][%s]{%s}: %.*s", - source_str, type_str, severity_str, - length, message - ); + blog(LOG_DEBUG, "[%s][%s]{%s}: %.*s", source_str, type_str, + severity_str, length, message); } static void gl_enable_debug() @@ -108,18 +121,18 @@ glDebugMessageCallbackARB(gl_debug_proc, NULL); } else { blog(LOG_DEBUG, "Failed to set GL debug callback as it is " - "not supported."); + "not supported."); } } #else static void gl_enable_debug() {} #endif -static bool gl_init_extensions(struct gs_device* device) +static bool gl_init_extensions(struct gs_device *device) { if (!GLAD_GL_VERSION_2_1) { blog(LOG_ERROR, "obs-studio requires OpenGL version 2.1 or " - "higher."); + "higher."); return false; } @@ -127,7 +140,7 @@ if (!GLAD_GL_VERSION_3_0 && !GLAD_GL_ARB_framebuffer_object) { blog(LOG_ERROR, "OpenGL extension ARB_framebuffer_object " - "is required."); + "is required."); return false; } @@ -158,14 +171,14 @@ } void convert_sampler_info(struct gs_sampler_state *sampler, - const struct gs_sampler_info *info) + const struct gs_sampler_info *info) { GLint max_anisotropy_max; convert_filter(info->filter, &sampler->min_filter, - &sampler->mag_filter); - sampler->address_u = convert_address_mode(info->address_u); - sampler->address_v = convert_address_mode(info->address_v); - sampler->address_w = convert_address_mode(info->address_w); + &sampler->mag_filter); + sampler->address_u = convert_address_mode(info->address_u); + sampler->address_v = convert_address_mode(info->address_v); + sampler->address_w = convert_address_mode(info->address_w); sampler->max_anisotropy = info->max_anisotropy; max_anisotropy_max = 1; @@ -181,10 +194,10 @@ else if (sampler->max_anisotropy > max_anisotropy_max) sampler->max_anisotropy = max_anisotropy_max; - blog(LOG_DEBUG, "convert_sampler_info: 1 <= max_anisotropy <= " - "%d violated, selected: %d, set: %d", - max_anisotropy_max, - info->max_anisotropy, sampler->max_anisotropy); + blog(LOG_DEBUG, + "convert_sampler_info: 1 <= max_anisotropy <= " + "%d violated, selected: %d, set: %d", + max_anisotropy_max, info->max_anisotropy, sampler->max_anisotropy); } const char *device_get_name(void) @@ -218,7 +231,7 @@ const char *glRenderer = (const char *)glGetString(GL_RENDERER); blog(LOG_INFO, "Loading up OpenGL on adapter %s %s", glVendor, - glRenderer); + glRenderer); if (!gl_init_extensions(device)) { errorcode = GS_ERROR_NOT_SUPPORTED; @@ -226,23 +239,26 @@ } const char *glVersion = (const char *)glGetString(GL_VERSION); - const char *glShadingLanguage = (const char *)glGetString( - GL_SHADING_LANGUAGE_VERSION); + const char *glShadingLanguage = + (const char *)glGetString(GL_SHADING_LANGUAGE_VERSION); - blog(LOG_INFO, "OpenGL loaded successfully, version %s, shading " - "language %s", glVersion, glShadingLanguage); + blog(LOG_INFO, + "OpenGL loaded successfully, version %s, shading " + "language %s", + glVersion, glShadingLanguage); gl_enable(GL_CULL_FACE); - + gl_gen_vertex_arrays(1, &device->empty_vao); + device_leave_context(device); device->cur_swap = NULL; #ifdef _WIN32 blog(LOG_INFO, "Warning: The OpenGL renderer is currently in use. " - "On windows, the OpenGL renderer can decrease " - "capture performance due to the lack of specific " - "features used to maximize capture performance. " - "The Direct3D 11 renderer is recommended instead."); + "On windows, the OpenGL renderer can decrease " + "capture performance due to the lack of specific " + "features used to maximize capture performance. " + "The Direct3D 11 renderer is recommended instead."); #endif *p_device = device; @@ -262,6 +278,8 @@ while (device->first_program) gs_program_destroy(device->first_program); + gl_delete_vertex_arrays(1, &device->empty_vao); + da_free(device->proj_stack); gl_platform_destroy(device->plat); bfree(device); @@ -269,13 +287,13 @@ } gs_swapchain_t *device_swapchain_create(gs_device_t *device, - const struct gs_init_data *info) + const struct gs_init_data *info) { struct gs_swap_chain *swap = bzalloc(sizeof(struct gs_swap_chain)); swap->device = device; - swap->info = *info; - swap->wi = gl_windowinfo_create(info); + swap->info = *info; + swap->wi = gl_windowinfo_create(info); if (!swap->wi) { blog(LOG_ERROR, "device_swapchain_create (GL) failed"); gs_swapchain_destroy(swap); @@ -337,9 +355,10 @@ } gs_texture_t *device_voltexture_create(gs_device_t *device, uint32_t width, - uint32_t height, uint32_t depth, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags) + uint32_t height, uint32_t depth, + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags) { /* TODO */ UNUSED_PARAMETER(device); @@ -353,19 +372,45 @@ return NULL; } -gs_samplerstate_t *device_samplerstate_create(gs_device_t *device, - const struct gs_sampler_info *info) +gs_samplerstate_t * +device_samplerstate_create(gs_device_t *device, + const struct gs_sampler_info *info) { struct gs_sampler_state *sampler; sampler = bzalloc(sizeof(struct gs_sampler_state)); sampler->device = device; - sampler->ref = 1; + sampler->ref = 1; convert_sampler_info(sampler, info); return sampler; } +gs_timer_t *device_timer_create(gs_device_t *device) +{ + UNUSED_PARAMETER(device); + + struct gs_timer *timer; + + GLuint queries[2]; + glGenQueries(2, queries); + if (!gl_success("glGenQueries")) + return NULL; + + timer = bzalloc(sizeof(struct gs_timer)); + timer->queries[0] = queries[0]; + timer->queries[1] = queries[1]; + + return timer; +} + +gs_timer_range_t *device_timer_range_create(gs_device_t *device) +{ + UNUSED_PARAMETER(device); + + return NULL; +} + enum gs_texture_type device_get_texture_type(const gs_texture_t *texture) { return texture->type; @@ -374,17 +419,17 @@ static void strip_mipmap_filter(GLint *filter) { switch (*filter) { - case GL_NEAREST: - case GL_LINEAR: - return; - case GL_NEAREST_MIPMAP_NEAREST: - case GL_NEAREST_MIPMAP_LINEAR: - *filter = GL_NEAREST; - return; - case GL_LINEAR_MIPMAP_NEAREST: - case GL_LINEAR_MIPMAP_LINEAR: - *filter = GL_LINEAR; - return; + case GL_NEAREST: + case GL_LINEAR: + return; + case GL_NEAREST_MIPMAP_NEAREST: + case GL_NEAREST_MIPMAP_LINEAR: + *filter = GL_NEAREST; + return; + case GL_LINEAR_MIPMAP_NEAREST: + case GL_LINEAR_MIPMAP_LINEAR: + *filter = GL_LINEAR; + return; } *filter = GL_NEAREST; } @@ -401,7 +446,7 @@ static bool load_texture_sampler(gs_texture_t *tex, gs_samplerstate_t *ss) { - bool success = true; + bool success = true; GLint min_filter; if (tex->cur_sampler == ss) @@ -419,11 +464,10 @@ if (gs_texture_is_rect(tex)) strip_mipmap_filter(&min_filter); - if (!gl_tex_param_i(tex->gl_target, GL_TEXTURE_MIN_FILTER, - min_filter)) + if (!gl_tex_param_i(tex->gl_target, GL_TEXTURE_MIN_FILTER, min_filter)) success = false; if (!gl_tex_param_i(tex->gl_target, GL_TEXTURE_MAG_FILTER, - ss->mag_filter)) + ss->mag_filter)) success = false; if (!gl_tex_param_i(tex->gl_target, GL_TEXTURE_WRAP_S, ss->address_u)) success = false; @@ -432,7 +476,7 @@ if (!gl_tex_param_i(tex->gl_target, GL_TEXTURE_WRAP_R, ss->address_w)) success = false; if (!gl_tex_param_i(tex->gl_target, GL_TEXTURE_MAX_ANISOTROPY_EXT, - ss->max_anisotropy)) + ss->max_anisotropy)) success = false; apply_swizzle(tex); @@ -441,13 +485,13 @@ } static inline struct gs_shader_param *get_texture_param(gs_device_t *device, - int unit) + int unit) { struct gs_shader *shader = device->cur_pixel_shader; size_t i; for (i = 0; i < shader->params.num; i++) { - struct gs_shader_param *param = shader->params.array+i; + struct gs_shader_param *param = shader->params.array + i; if (param->type == GS_SHADER_PARAM_TEXTURE) { if (param->texture_id == unit) return param; @@ -506,13 +550,13 @@ } static bool load_sampler_on_textures(gs_device_t *device, gs_samplerstate_t *ss, - int sampler_unit) + int sampler_unit) { struct gs_shader *shader = device->cur_pixel_shader; size_t i; for (i = 0; i < shader->params.num; i++) { - struct gs_shader_param *param = shader->params.array+i; + struct gs_shader_param *param = shader->params.array + i; if (param->type == GS_SHADER_PARAM_TEXTURE && param->sampler_id == (uint32_t)sampler_unit && @@ -528,7 +572,7 @@ } void device_load_samplerstate(gs_device_t *device, gs_samplerstate_t *ss, - int unit) + int unit) { /* need a pixel shader to properly bind samplers */ if (!device->cur_pixel_shader) @@ -563,7 +607,7 @@ } static void load_default_pixelshader_samplers(struct gs_device *device, - struct gs_shader *ps) + struct gs_shader *ps) { size_t i; if (!ps) @@ -629,17 +673,17 @@ } static bool get_tex_dimensions(gs_texture_t *tex, uint32_t *width, - uint32_t *height) + uint32_t *height) { if (tex->type == GS_TEXTURE_2D) { - struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex; - *width = tex2d->width; + struct gs_texture_2d *tex2d = (struct gs_texture_2d *)tex; + *width = tex2d->width; *height = tex2d->height; return true; } else if (tex->type == GS_TEXTURE_CUBE) { - struct gs_texture_cube *cube = (struct gs_texture_cube*)tex; - *width = cube->size; + struct gs_texture_cube *cube = (struct gs_texture_cube *)tex; + *width = cube->size; *height = cube->size; return true; } @@ -654,9 +698,8 @@ */ struct fbo_info *get_fbo(gs_texture_t *tex, uint32_t width, uint32_t height) { - if (tex->fbo && tex->fbo->width == width && - tex->fbo->height == height && - tex->fbo->format == tex->format) + if (tex->fbo && tex->fbo->width == width && + tex->fbo->height == height && tex->fbo->format == tex->format) return tex->fbo; GLuint fbo; @@ -665,12 +708,12 @@ return NULL; tex->fbo = bmalloc(sizeof(struct fbo_info)); - tex->fbo->fbo = fbo; - tex->fbo->width = width; - tex->fbo->height = height; - tex->fbo->format = tex->format; - tex->fbo->cur_render_target = NULL; - tex->fbo->cur_render_side = 0; + tex->fbo->fbo = fbo; + tex->fbo->width = width; + tex->fbo->height = height; + tex->fbo->format = tex->format; + tex->fbo->cur_render_target = NULL; + tex->fbo->cur_render_side = 0; tex->fbo->cur_zstencil_buffer = NULL; return tex->fbo; @@ -703,7 +746,7 @@ } static bool attach_rendertarget(struct fbo_info *fbo, gs_texture_t *tex, - int side) + int side) { if (fbo->cur_render_target == tex) return true; @@ -712,14 +755,14 @@ if (tex->type == GS_TEXTURE_2D) { glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, - tex->texture, 0); + GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, + tex->texture, 0); } else if (tex->type == GS_TEXTURE_CUBE) { glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_TEXTURE_CUBE_MAP_POSITIVE_X + side, - tex->texture, 0); + GL_COLOR_ATTACHMENT0, + GL_TEXTURE_CUBE_MAP_POSITIVE_X + side, + tex->texture, 0); } else { return false; @@ -743,8 +786,8 @@ zs_attachment = zs->attachment; } - glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, - zs_attachment, GL_RENDERBUFFER, zsbuffer); + glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, zs_attachment, + GL_RENDERBUFFER, zsbuffer); if (!gl_success("glFramebufferRenderbuffer")) return false; @@ -752,17 +795,17 @@ } static bool set_target(gs_device_t *device, gs_texture_t *tex, int side, - gs_zstencil_t *zs) + gs_zstencil_t *zs) { struct fbo_info *fbo; - if (device->cur_render_target == tex && - device->cur_zstencil_buffer == zs && - device->cur_render_side == side) + if (device->cur_render_target == tex && + device->cur_zstencil_buffer == zs && + device->cur_render_side == side) return true; - device->cur_render_target = tex; - device->cur_render_side = side; + device->cur_render_target = tex; + device->cur_render_side = side; device->cur_zstencil_buffer = zs; if (!tex) @@ -783,7 +826,7 @@ } void device_set_render_target(gs_device_t *device, gs_texture_t *tex, - gs_zstencil_t *zstencil) + gs_zstencil_t *zstencil) { if (tex) { if (tex->type != GS_TEXTURE_2D) { @@ -807,7 +850,7 @@ } void device_set_cube_render_target(gs_device_t *device, gs_texture_t *cubetex, - int side, gs_zstencil_t *zstencil) + int side, gs_zstencil_t *zstencil) { if (cubetex) { if (cubetex->type != GS_TEXTURE_CUBE) { @@ -830,13 +873,13 @@ blog(LOG_ERROR, "device_set_cube_render_target (GL) failed"); } -void device_copy_texture_region(gs_device_t *device, - gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y, - gs_texture_t *src, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h) +void device_copy_texture_region(gs_device_t *device, gs_texture_t *dst, + uint32_t dst_x, uint32_t dst_y, + gs_texture_t *src, uint32_t src_x, + uint32_t src_y, uint32_t src_w, uint32_t src_h) { - struct gs_texture_2d *src2d = (struct gs_texture_2d*)src; - struct gs_texture_2d *dst2d = (struct gs_texture_2d*)dst; + struct gs_texture_2d *src2d = (struct gs_texture_2d *)src; + struct gs_texture_2d *dst2d = (struct gs_texture_2d *)dst; if (!src) { blog(LOG_ERROR, "Source texture is NULL"); @@ -850,7 +893,7 @@ if (dst->type != GS_TEXTURE_2D || src->type != GS_TEXTURE_2D) { blog(LOG_ERROR, "Source and destination textures must be 2D " - "textures"); + "textures"); goto fail; } @@ -859,19 +902,19 @@ goto fail; } - uint32_t nw = (uint32_t)src_w ? - (uint32_t)src_w : (src2d->width - src_x); - uint32_t nh = (uint32_t)src_h ? - (uint32_t)src_h : (src2d->height - src_y); + uint32_t nw = (uint32_t)src_w ? (uint32_t)src_w + : (src2d->width - src_x); + uint32_t nh = (uint32_t)src_h ? (uint32_t)src_h + : (src2d->height - src_y); if (dst2d->width - dst_x < nw || dst2d->height - dst_y < nh) { blog(LOG_ERROR, "Destination texture region is not big " - "enough to hold the source region"); + "enough to hold the source region"); goto fail; } if (!gl_copy_texture(device, dst, dst_x, dst_y, src, src_x, src_y, nw, - nh)) + nh)) goto fail; return; @@ -881,7 +924,7 @@ } void device_copy_texture(gs_device_t *device, gs_texture_t *dst, - gs_texture_t *src) + gs_texture_t *src) { device_copy_texture_region(device, dst, 0, 0, src, 0, 0, 0, 0); } @@ -891,7 +934,7 @@ clear_textures(device); } -static inline bool can_render(const gs_device_t *device) +static inline bool can_render(const gs_device_t *device, uint32_t num_verts) { if (!device->cur_vertex_shader) { blog(LOG_ERROR, "No vertex shader specified"); @@ -903,7 +946,7 @@ return false; } - if (!device->cur_vertex_buffer) { + if (!device->cur_vertex_buffer && (num_verts == 0)) { blog(LOG_ERROR, "No vertex buffer specified"); return false; } @@ -950,7 +993,7 @@ while (program) { if (program->vertex_shader == device->cur_vertex_shader && - program->pixel_shader == device->cur_pixel_shader) + program->pixel_shader == device->cur_pixel_shader) return program; program = program->next; @@ -970,14 +1013,15 @@ } void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode, - uint32_t start_vert, uint32_t num_verts) + uint32_t start_vert, uint32_t num_verts) { + struct gs_vertex_buffer *vb = device->cur_vertex_buffer; struct gs_index_buffer *ib = device->cur_index_buffer; - GLenum topology = convert_gs_topology(draw_mode); + GLenum topology = convert_gs_topology(draw_mode); gs_effect_t *effect = gs_get_effect(); struct gs_program *program; - if (!can_render(device)) + if (!can_render(device, num_verts)) goto fail; if (effect) @@ -987,7 +1031,10 @@ if (!program) goto fail; - load_vb_buffers(program, device->cur_vertex_buffer, ib); + if (vb) + load_vb_buffers(program, vb, ib); + else + gl_bind_vertex_array(device->empty_vao); if (program != device->cur_program && device->cur_program) { glUseProgram(0); @@ -1010,7 +1057,7 @@ if (num_verts == 0) num_verts = (uint32_t)device->cur_index_buffer->num; glDrawElements(topology, num_verts, ib->gl_type, - (const GLvoid*)(start_vert * ib->width)); + (const GLvoid *)(start_vert * ib->width)); if (!gl_success("glDrawElements")) goto fail; @@ -1035,7 +1082,7 @@ } void device_clear(gs_device_t *device, uint32_t clear_flags, - const struct vec4 *color, float depth, uint8_t stencil) + const struct vec4 *color, float depth, uint8_t stencil) { GLbitfield gl_flags = 0; @@ -1136,8 +1183,8 @@ UNUSED_PARAMETER(device); } -void device_enable_color(gs_device_t *device, bool red, bool green, - bool blue, bool alpha) +void device_enable_color(gs_device_t *device, bool red, bool green, bool blue, + bool alpha) { glColorMask(red, green, blue, alpha); @@ -1145,7 +1192,7 @@ } void device_blend_function(gs_device_t *device, enum gs_blend_type src, - enum gs_blend_type dest) + enum gs_blend_type dest) { GLenum gl_src = convert_gs_blend_type(src); GLenum gl_dst = convert_gs_blend_type(dest); @@ -1158,8 +1205,10 @@ } void device_blend_function_separate(gs_device_t *device, - enum gs_blend_type src_c, enum gs_blend_type dest_c, - enum gs_blend_type src_a, enum gs_blend_type dest_a) + enum gs_blend_type src_c, + enum gs_blend_type dest_c, + enum gs_blend_type src_a, + enum gs_blend_type dest_a) { GLenum gl_src_c = convert_gs_blend_type(src_c); GLenum gl_dst_c = convert_gs_blend_type(dest_c); @@ -1185,7 +1234,7 @@ } void device_stencil_function(gs_device_t *device, enum gs_stencil_side side, - enum gs_depth_test test) + enum gs_depth_test test) { GLenum gl_side = convert_gs_stencil_side(side); GLenum gl_test = convert_gs_depth_test(test); @@ -1198,11 +1247,12 @@ } void device_stencil_op(gs_device_t *device, enum gs_stencil_side side, - enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail, - enum gs_stencil_op_type zpass) + enum gs_stencil_op_type fail, + enum gs_stencil_op_type zfail, + enum gs_stencil_op_type zpass) { - GLenum gl_side = convert_gs_stencil_side(side); - GLenum gl_fail = convert_gs_stencil_op(fail); + GLenum gl_side = convert_gs_stencil_side(side); + GLenum gl_fail = convert_gs_stencil_op(fail); GLenum gl_zfail = convert_gs_stencil_op(zfail); GLenum gl_zpass = convert_gs_stencil_op(zpass); @@ -1225,7 +1275,7 @@ } void device_set_viewport(gs_device_t *device, int x, int y, int width, - int height) + int height) { uint32_t base_height = 0; int gl_y = 0; @@ -1245,8 +1295,8 @@ if (!gl_success("glViewport")) blog(LOG_ERROR, "device_set_viewport (GL) failed"); - device->cur_viewport.x = x; - device->cur_viewport.y = y; + device->cur_viewport.x = x; + device->cur_viewport.y = y; device->cur_viewport.cx = width; device->cur_viewport.cy = height; } @@ -1272,55 +1322,55 @@ blog(LOG_ERROR, "device_set_scissor_rect (GL) failed"); } -void device_ortho(gs_device_t *device, float left, float right, - float top, float bottom, float near, float far) +void device_ortho(gs_device_t *device, float left, float right, float top, + float bottom, float near, float far) { struct matrix4 *dst = &device->cur_proj; - float rml = right-left; - float bmt = bottom-top; - float fmn = far-near; + float rml = right - left; + float bmt = bottom - top; + float fmn = far - near; vec4_zero(&dst->x); vec4_zero(&dst->y); vec4_zero(&dst->z); vec4_zero(&dst->t); - dst->x.x = 2.0f / rml; - dst->t.x = (left+right) / -rml; + dst->x.x = 2.0f / rml; + dst->t.x = (left + right) / -rml; - dst->y.y = 2.0f / -bmt; - dst->t.y = (bottom+top) / bmt; + dst->y.y = 2.0f / -bmt; + dst->t.y = (bottom + top) / bmt; - dst->z.z = -2.0f / fmn; - dst->t.z = (far+near) / -fmn; + dst->z.z = -2.0f / fmn; + dst->t.z = (far + near) / -fmn; dst->t.w = 1.0f; } -void device_frustum(gs_device_t *device, float left, float right, - float top, float bottom, float near, float far) +void device_frustum(gs_device_t *device, float left, float right, float top, + float bottom, float near, float far) { struct matrix4 *dst = &device->cur_proj; - float rml = right-left; - float tmb = top-bottom; - float nmf = near-far; - float nearx2 = 2.0f*near; + float rml = right - left; + float tmb = top - bottom; + float nmf = near - far; + float nearx2 = 2.0f * near; vec4_zero(&dst->x); vec4_zero(&dst->y); vec4_zero(&dst->z); vec4_zero(&dst->t); - dst->x.x = nearx2 / rml; - dst->z.x = (left+right) / rml; - - dst->y.y = nearx2 / tmb; - dst->z.y = (bottom+top) / tmb; + dst->x.x = nearx2 / rml; + dst->z.x = (left + right) / rml; - dst->z.z = (far+near) / nmf; - dst->t.z = 2.0f * (near*far) / nmf; + dst->y.y = nearx2 / tmb; + dst->z.y = (bottom + top) / tmb; + + dst->z.z = (far + near) / nmf; + dst->t.z = 2.0f * (near * far) / nmf; dst->z.w = -1.0f; } @@ -1341,8 +1391,8 @@ da_pop_back(device->proj_stack); } -void device_debug_marker_begin(gs_device_t *device, - const char *markername, const float color[4]) +void device_debug_marker_begin(gs_device_t *device, const char *markername, + const float color[4]) { UNUSED_PARAMETER(device); UNUSED_PARAMETER(color); @@ -1413,8 +1463,72 @@ if (samplerstate->device) for (int i = 0; i < GS_MAX_TEXTURES; i++) if (samplerstate->device->cur_samplers[i] == - samplerstate) + samplerstate) samplerstate->device->cur_samplers[i] = NULL; samplerstate_release(samplerstate); } + +void gs_timer_destroy(gs_timer_t *timer) +{ + if (!timer) + return; + + glDeleteQueries(2, timer->queries); + gl_success("glDeleteQueries"); + + bfree(timer); +} + +void gs_timer_begin(gs_timer_t *timer) +{ + glQueryCounter(timer->queries[0], GL_TIMESTAMP); + gl_success("glQueryCounter"); +} + +void gs_timer_end(gs_timer_t *timer) +{ + glQueryCounter(timer->queries[1], GL_TIMESTAMP); + gl_success("glQueryCounter"); +} + +bool gs_timer_get_data(gs_timer_t *timer, uint64_t *ticks) +{ + GLint available = 0; + glGetQueryObjectiv(timer->queries[1], GL_QUERY_RESULT_AVAILABLE, + &available); + + GLuint64 begin, end; + glGetQueryObjectui64v(timer->queries[0], GL_QUERY_RESULT, &begin); + gl_success("glGetQueryObjectui64v"); + glGetQueryObjectui64v(timer->queries[1], GL_QUERY_RESULT, &end); + gl_success("glGetQueryObjectui64v"); + + *ticks = end - begin; + return true; +} + +void gs_timer_range_destroy(gs_timer_range_t *range) +{ + UNUSED_PARAMETER(range); +} + +void gs_timer_range_begin(gs_timer_range_t *range) +{ + UNUSED_PARAMETER(range); +} + +void gs_timer_range_end(gs_timer_range_t *range) +{ + UNUSED_PARAMETER(range); +} + +bool gs_timer_range_get_data(gs_timer_range_t *range, bool *disjoint, + uint64_t *frequency) +{ + UNUSED_PARAMETER(range); + + *disjoint = false; + *frequency = 1000000000; + return true; +}
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-subsystem.h -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-subsystem.h
Changed
@@ -30,34 +30,49 @@ struct gl_platform; struct gl_windowinfo; -enum copy_type { - COPY_TYPE_ARB, - COPY_TYPE_NV, - COPY_TYPE_FBO_BLIT -}; +enum copy_type { COPY_TYPE_ARB, COPY_TYPE_NV, COPY_TYPE_FBO_BLIT }; static inline GLenum convert_gs_format(enum gs_color_format format) { switch (format) { - case GS_A8: return GL_RED; - case GS_R8: return GL_RED; - case GS_RGBA: return GL_RGBA; - case GS_BGRX: return GL_BGRA; - case GS_BGRA: return GL_BGRA; - case GS_R10G10B10A2: return GL_RGBA; - case GS_RGBA16: return GL_RGBA; - case GS_R16: return GL_RED; - case GS_RGBA16F: return GL_RGBA; - case GS_RGBA32F: return GL_RGBA; - case GS_RG16F: return GL_RG; - case GS_RG32F: return GL_RG; - case GS_R8G8: return GL_RG; - case GS_R16F: return GL_RED; - case GS_R32F: return GL_RED; - case GS_DXT1: return GL_RGB; - case GS_DXT3: return GL_RGBA; - case GS_DXT5: return GL_RGBA; - case GS_UNKNOWN: return 0; + case GS_A8: + return GL_RED; + case GS_R8: + return GL_RED; + case GS_RGBA: + return GL_RGBA; + case GS_BGRX: + return GL_BGRA; + case GS_BGRA: + return GL_BGRA; + case GS_R10G10B10A2: + return GL_RGBA; + case GS_RGBA16: + return GL_RGBA; + case GS_R16: + return GL_RED; + case GS_RGBA16F: + return GL_RGBA; + case GS_RGBA32F: + return GL_RGBA; + case GS_RG16F: + return GL_RG; + case GS_RG32F: + return GL_RG; + case GS_R8G8: + return GL_RG; + case GS_R16F: + return GL_RED; + case GS_R32F: + return GL_RED; + case GS_DXT1: + return GL_RGB; + case GS_DXT3: + return GL_RGBA; + case GS_DXT5: + return GL_RGBA; + case GS_UNKNOWN: + return 0; } return 0; @@ -66,25 +81,44 @@ static inline GLenum convert_gs_internal_format(enum gs_color_format format) { switch (format) { - case GS_A8: return GL_R8; /* NOTE: use GL_TEXTURE_SWIZZLE_x */ - case GS_R8: return GL_R8; - case GS_RGBA: return GL_RGBA; - case GS_BGRX: return GL_RGB; - case GS_BGRA: return GL_RGBA; - case GS_R10G10B10A2: return GL_RGB10_A2; - case GS_RGBA16: return GL_RGBA16; - case GS_R16: return GL_R16; - case GS_RGBA16F: return GL_RGBA16F; - case GS_RGBA32F: return GL_RGBA32F; - case GS_RG16F: return GL_RG16F; - case GS_RG32F: return GL_RG32F; - case GS_R8G8: return GL_R16; - case GS_R16F: return GL_R16F; - case GS_R32F: return GL_R32F; - case GS_DXT1: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - case GS_DXT3: return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - case GS_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - case GS_UNKNOWN: return 0; + case GS_A8: + return GL_R8; /* NOTE: use GL_TEXTURE_SWIZZLE_x */ + case GS_R8: + return GL_R8; + case GS_RGBA: + return GL_RGBA; + case GS_BGRX: + return GL_RGB; + case GS_BGRA: + return GL_RGBA; + case GS_R10G10B10A2: + return GL_RGB10_A2; + case GS_RGBA16: + return GL_RGBA16; + case GS_R16: + return GL_R16; + case GS_RGBA16F: + return GL_RGBA16F; + case GS_RGBA32F: + return GL_RGBA32F; + case GS_RG16F: + return GL_RG16F; + case GS_RG32F: + return GL_RG32F; + case GS_R8G8: + return GL_RG8; + case GS_R16F: + return GL_R16F; + case GS_R32F: + return GL_R32F; + case GS_DXT1: + return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; + case GS_DXT3: + return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; + case GS_DXT5: + return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; + case GS_UNKNOWN: + return 0; } return 0; @@ -93,25 +127,44 @@ static inline GLenum get_gl_format_type(enum gs_color_format format) { switch (format) { - case GS_A8: return GL_UNSIGNED_BYTE; - case GS_R8: return GL_UNSIGNED_BYTE; - case GS_RGBA: return GL_UNSIGNED_BYTE; - case GS_BGRX: return GL_UNSIGNED_BYTE; - case GS_BGRA: return GL_UNSIGNED_BYTE; - case GS_R10G10B10A2: return GL_UNSIGNED_INT_10_10_10_2; - case GS_RGBA16: return GL_UNSIGNED_SHORT; - case GS_R16: return GL_UNSIGNED_SHORT; - case GS_RGBA16F: return GL_UNSIGNED_SHORT; - case GS_RGBA32F: return GL_FLOAT; - case GS_RG16F: return GL_UNSIGNED_SHORT; - case GS_RG32F: return GL_FLOAT; - case GS_R8G8: return GL_UNSIGNED_SHORT; - case GS_R16F: return GL_UNSIGNED_SHORT; - case GS_R32F: return GL_FLOAT; - case GS_DXT1: return GL_UNSIGNED_BYTE; - case GS_DXT3: return GL_UNSIGNED_BYTE; - case GS_DXT5: return GL_UNSIGNED_BYTE; - case GS_UNKNOWN: return 0; + case GS_A8: + return GL_UNSIGNED_BYTE; + case GS_R8: + return GL_UNSIGNED_BYTE; + case GS_RGBA: + return GL_UNSIGNED_BYTE; + case GS_BGRX: + return GL_UNSIGNED_BYTE; + case GS_BGRA: + return GL_UNSIGNED_BYTE; + case GS_R10G10B10A2: + return GL_UNSIGNED_INT_10_10_10_2; + case GS_RGBA16: + return GL_UNSIGNED_SHORT; + case GS_R16: + return GL_UNSIGNED_SHORT; + case GS_RGBA16F: + return GL_UNSIGNED_SHORT; + case GS_RGBA32F: + return GL_FLOAT; + case GS_RG16F: + return GL_UNSIGNED_SHORT; + case GS_RG32F: + return GL_FLOAT; + case GS_R8G8: + return GL_UNSIGNED_BYTE; + case GS_R16F: + return GL_UNSIGNED_SHORT; + case GS_R32F: + return GL_FLOAT; + case GS_DXT1: + return GL_UNSIGNED_BYTE; + case GS_DXT3: + return GL_UNSIGNED_BYTE; + case GS_DXT5: + return GL_UNSIGNED_BYTE; + case GS_UNKNOWN: + return 0; } return GL_UNSIGNED_BYTE; @@ -120,11 +173,16 @@ static inline GLenum convert_zstencil_format(enum gs_zstencil_format format) { switch (format) { - case GS_Z16: return GL_DEPTH_COMPONENT16; - case GS_Z24_S8: return GL_DEPTH24_STENCIL8; - case GS_Z32F: return GL_DEPTH_COMPONENT32F; - case GS_Z32F_S8X24: return GL_DEPTH32F_STENCIL8; - case GS_ZS_NONE: return 0; + case GS_Z16: + return GL_DEPTH_COMPONENT16; + case GS_Z24_S8: + return GL_DEPTH24_STENCIL8; + case GS_Z32F: + return GL_DEPTH_COMPONENT32F; + case GS_Z32F_S8X24: + return GL_DEPTH32F_STENCIL8; + case GS_ZS_NONE: + return 0; } return 0; @@ -133,14 +191,22 @@ static inline GLenum convert_gs_depth_test(enum gs_depth_test test) { switch (test) { - case GS_NEVER: return GL_NEVER; - case GS_LESS: return GL_LESS; - case GS_LEQUAL: return GL_LEQUAL; - case GS_EQUAL: return GL_EQUAL; - case GS_GEQUAL: return GL_GEQUAL; - case GS_GREATER: return GL_GREATER; - case GS_NOTEQUAL: return GL_NOTEQUAL; - case GS_ALWAYS: return GL_ALWAYS; + case GS_NEVER: + return GL_NEVER; + case GS_LESS: + return GL_LESS; + case GS_LEQUAL: + return GL_LEQUAL; + case GS_EQUAL: + return GL_EQUAL; + case GS_GEQUAL: + return GL_GEQUAL; + case GS_GREATER: + return GL_GREATER; + case GS_NOTEQUAL: + return GL_NOTEQUAL; + case GS_ALWAYS: + return GL_ALWAYS; } return GL_NEVER; @@ -149,12 +215,18 @@ static inline GLenum convert_gs_stencil_op(enum gs_stencil_op_type op) { switch (op) { - case GS_KEEP: return GL_KEEP; - case GS_ZERO: return GL_ZERO; - case GS_REPLACE: return GL_REPLACE; - case GS_INCR: return GL_INCR; - case GS_DECR: return GL_DECR; - case GS_INVERT: return GL_INVERT; + case GS_KEEP: + return GL_KEEP; + case GS_ZERO: + return GL_ZERO; + case GS_REPLACE: + return GL_REPLACE; + case GS_INCR: + return GL_INCR; + case GS_DECR: + return GL_DECR; + case GS_INVERT: + return GL_INVERT; } return GL_KEEP; @@ -163,9 +235,12 @@ static inline GLenum convert_gs_stencil_side(enum gs_stencil_side side) { switch (side) { - case GS_STENCIL_FRONT: return GL_FRONT; - case GS_STENCIL_BACK: return GL_BACK; - case GS_STENCIL_BOTH: return GL_FRONT_AND_BACK; + case GS_STENCIL_FRONT: + return GL_FRONT; + case GS_STENCIL_BACK: + return GL_BACK; + case GS_STENCIL_BOTH: + return GL_FRONT_AND_BACK; } return GL_FRONT; @@ -174,17 +249,28 @@ static inline GLenum convert_gs_blend_type(enum gs_blend_type type) { switch (type) { - case GS_BLEND_ZERO: return GL_ZERO; - case GS_BLEND_ONE: return GL_ONE; - case GS_BLEND_SRCCOLOR: return GL_SRC_COLOR; - case GS_BLEND_INVSRCCOLOR: return GL_ONE_MINUS_SRC_COLOR; - case GS_BLEND_SRCALPHA: return GL_SRC_ALPHA; - case GS_BLEND_INVSRCALPHA: return GL_ONE_MINUS_SRC_ALPHA; - case GS_BLEND_DSTCOLOR: return GL_DST_COLOR; - case GS_BLEND_INVDSTCOLOR: return GL_ONE_MINUS_DST_COLOR; - case GS_BLEND_DSTALPHA: return GL_DST_ALPHA; - case GS_BLEND_INVDSTALPHA: return GL_ONE_MINUS_DST_ALPHA; - case GS_BLEND_SRCALPHASAT: return GL_SRC_ALPHA_SATURATE; + case GS_BLEND_ZERO: + return GL_ZERO; + case GS_BLEND_ONE: + return GL_ONE; + case GS_BLEND_SRCCOLOR: + return GL_SRC_COLOR; + case GS_BLEND_INVSRCCOLOR: + return GL_ONE_MINUS_SRC_COLOR; + case GS_BLEND_SRCALPHA: + return GL_SRC_ALPHA; + case GS_BLEND_INVSRCALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case GS_BLEND_DSTCOLOR: + return GL_DST_COLOR; + case GS_BLEND_INVDSTCOLOR: + return GL_ONE_MINUS_DST_COLOR; + case GS_BLEND_DSTALPHA: + return GL_DST_ALPHA; + case GS_BLEND_INVDSTALPHA: + return GL_ONE_MINUS_DST_ALPHA; + case GS_BLEND_SRCALPHASAT: + return GL_SRC_ALPHA_SATURATE; } return GL_ONE; @@ -193,15 +279,17 @@ static inline GLenum convert_shader_type(enum gs_shader_type type) { switch (type) { - case GS_SHADER_VERTEX: return GL_VERTEX_SHADER; - case GS_SHADER_PIXEL: return GL_FRAGMENT_SHADER; + case GS_SHADER_VERTEX: + return GL_VERTEX_SHADER; + case GS_SHADER_PIXEL: + return GL_FRAGMENT_SHADER; } return GL_VERTEX_SHADER; } static inline void convert_filter(enum gs_sample_filter filter, - GLint *min_filter, GLint *mag_filter) + GLint *min_filter, GLint *mag_filter) { switch (filter) { case GS_FILTER_POINT: @@ -249,11 +337,16 @@ static inline GLint convert_address_mode(enum gs_address_mode mode) { switch (mode) { - case GS_ADDRESS_WRAP: return GL_REPEAT; - case GS_ADDRESS_CLAMP: return GL_CLAMP_TO_EDGE; - case GS_ADDRESS_MIRROR: return GL_MIRRORED_REPEAT; - case GS_ADDRESS_BORDER: return GL_CLAMP_TO_BORDER; - case GS_ADDRESS_MIRRORONCE: return GL_MIRROR_CLAMP_EXT; + case GS_ADDRESS_WRAP: + return GL_REPEAT; + case GS_ADDRESS_CLAMP: + return GL_CLAMP_TO_EDGE; + case GS_ADDRESS_MIRROR: + return GL_MIRRORED_REPEAT; + case GS_ADDRESS_BORDER: + return GL_CLAMP_TO_BORDER; + case GS_ADDRESS_MIRRORONCE: + return GL_MIRROR_CLAMP_EXT; } return GL_REPEAT; @@ -262,29 +355,34 @@ static inline GLenum convert_gs_topology(enum gs_draw_mode mode) { switch (mode) { - case GS_POINTS: return GL_POINTS; - case GS_LINES: return GL_LINES; - case GS_LINESTRIP: return GL_LINE_STRIP; - case GS_TRIS: return GL_TRIANGLES; - case GS_TRISTRIP: return GL_TRIANGLE_STRIP; + case GS_POINTS: + return GL_POINTS; + case GS_LINES: + return GL_LINES; + case GS_LINESTRIP: + return GL_LINE_STRIP; + case GS_TRIS: + return GL_TRIANGLES; + case GS_TRISTRIP: + return GL_TRIANGLE_STRIP; } return GL_POINTS; } extern void convert_sampler_info(struct gs_sampler_state *sampler, - const struct gs_sampler_info *info); + const struct gs_sampler_info *info); struct gs_sampler_state { - gs_device_t *device; - volatile long ref; - - GLint min_filter; - GLint mag_filter; - GLint address_u; - GLint address_v; - GLint address_w; - GLint max_anisotropy; + gs_device_t *device; + volatile long ref; + + GLint min_filter; + GLint mag_filter; + GLint address_u; + GLint address_v; + GLint address_w; + GLint max_anisotropy; }; static inline void samplerstate_addref(gs_samplerstate_t *ss) @@ -298,21 +396,25 @@ bfree(ss); } +struct gs_timer { + GLuint queries[2]; +}; + struct gs_shader_param { enum gs_shader_param_type type; - char *name; - gs_shader_t *shader; - gs_samplerstate_t *next_sampler; - GLint texture_id; - size_t sampler_id; - int array_count; + char *name; + gs_shader_t *shader; + gs_samplerstate_t *next_sampler; + GLint texture_id; + size_t sampler_id; + int array_count; - struct gs_texture *texture; + struct gs_texture *texture; - DARRAY(uint8_t) cur_value; - DARRAY(uint8_t) def_value; - bool changed; + DARRAY(uint8_t) cur_value; + DARRAY(uint8_t) def_value; + bool changed; }; enum attrib_type { @@ -325,40 +427,40 @@ }; struct shader_attrib { - char *name; - size_t index; - enum attrib_type type; + char *name; + size_t index; + enum attrib_type type; }; struct gs_shader { - gs_device_t *device; - enum gs_shader_type type; - GLuint obj; + gs_device_t *device; + enum gs_shader_type type; + GLuint obj; - struct gs_shader_param *viewproj; - struct gs_shader_param *world; + struct gs_shader_param *viewproj; + struct gs_shader_param *world; - DARRAY(struct shader_attrib) attribs; + DARRAY(struct shader_attrib) attribs; DARRAY(struct gs_shader_param) params; - DARRAY(gs_samplerstate_t*) samplers; + DARRAY(gs_samplerstate_t *) samplers; }; struct program_param { - GLint obj; + GLint obj; struct gs_shader_param *param; }; struct gs_program { - gs_device_t *device; - GLuint obj; - struct gs_shader *vertex_shader; - struct gs_shader *pixel_shader; + gs_device_t *device; + GLuint obj; + struct gs_shader *vertex_shader; + struct gs_shader *pixel_shader; DARRAY(struct program_param) params; - DARRAY(GLint) attribs; + DARRAY(GLint) attribs; - struct gs_program **prev_next; - struct gs_program *next; + struct gs_program **prev_next; + struct gs_program *next; }; extern struct gs_program *gs_program_create(struct gs_device *device); @@ -366,106 +468,107 @@ extern void program_update_params(struct gs_program *shader); struct gs_vertex_buffer { - GLuint vao; - GLuint vertex_buffer; - GLuint normal_buffer; - GLuint tangent_buffer; - GLuint color_buffer; - DARRAY(GLuint) uv_buffers; - DARRAY(size_t) uv_sizes; - - gs_device_t *device; - size_t num; - bool dynamic; - struct gs_vb_data *data; + GLuint vao; + GLuint vertex_buffer; + GLuint normal_buffer; + GLuint tangent_buffer; + GLuint color_buffer; + DARRAY(GLuint) uv_buffers; + DARRAY(size_t) uv_sizes; + + gs_device_t *device; + size_t num; + bool dynamic; + struct gs_vb_data *data; }; extern bool load_vb_buffers(struct gs_program *program, - struct gs_vertex_buffer *vb, struct gs_index_buffer *ib); + struct gs_vertex_buffer *vb, + struct gs_index_buffer *ib); struct gs_index_buffer { - GLuint buffer; - enum gs_index_type type; - GLuint gl_type; - - gs_device_t *device; - void *data; - size_t num; - size_t width; - size_t size; - bool dynamic; + GLuint buffer; + enum gs_index_type type; + GLuint gl_type; + + gs_device_t *device; + void *data; + size_t num; + size_t width; + size_t size; + bool dynamic; }; struct gs_texture { - gs_device_t *device; + gs_device_t *device; enum gs_texture_type type; enum gs_color_format format; - GLenum gl_format; - GLenum gl_target; - GLenum gl_internal_format; - GLenum gl_type; - GLuint texture; - uint32_t levels; - bool is_dynamic; - bool is_render_target; - bool is_dummy; - bool gen_mipmaps; - - gs_samplerstate_t *cur_sampler; - struct fbo_info *fbo; + GLenum gl_format; + GLenum gl_target; + GLenum gl_internal_format; + GLenum gl_type; + GLuint texture; + uint32_t levels; + bool is_dynamic; + bool is_render_target; + bool is_dummy; + bool gen_mipmaps; + + gs_samplerstate_t *cur_sampler; + struct fbo_info *fbo; }; struct gs_texture_2d { - struct gs_texture base; + struct gs_texture base; - uint32_t width; - uint32_t height; - bool gen_mipmaps; - GLuint unpack_buffer; + uint32_t width; + uint32_t height; + bool gen_mipmaps; + GLuint unpack_buffer; }; struct gs_texture_cube { - struct gs_texture base; + struct gs_texture base; - uint32_t size; + uint32_t size; }; struct gs_stage_surface { - gs_device_t *device; + gs_device_t *device; enum gs_color_format format; - uint32_t width; - uint32_t height; - - uint32_t bytes_per_pixel; - GLenum gl_format; - GLint gl_internal_format; - GLenum gl_type; - GLuint pack_buffer; + uint32_t width; + uint32_t height; + + uint32_t bytes_per_pixel; + GLenum gl_format; + GLint gl_internal_format; + GLenum gl_type; + GLuint pack_buffer; }; struct gs_zstencil_buffer { - gs_device_t *device; - GLuint buffer; - GLuint attachment; - GLenum format; + gs_device_t *device; + GLuint buffer; + GLuint attachment; + GLenum format; }; struct gs_swap_chain { - gs_device_t *device; + gs_device_t *device; struct gl_windowinfo *wi; - struct gs_init_data info; + struct gs_init_data info; }; struct fbo_info { - GLuint fbo; - uint32_t width; - uint32_t height; + GLuint fbo; + uint32_t width; + uint32_t height; enum gs_color_format format; - gs_texture_t *cur_render_target; - int cur_render_side; - gs_zstencil_t *cur_zstencil_buffer; + gs_texture_t *cur_render_target; + int cur_render_side; + gs_zstencil_t *cur_zstencil_buffer; }; static inline void fbo_info_destroy(struct fbo_info *fbo) @@ -479,51 +582,52 @@ } struct gs_device { - struct gl_platform *plat; - enum copy_type copy_type; + struct gl_platform *plat; + enum copy_type copy_type; + + GLuint empty_vao; - gs_texture_t *cur_render_target; - gs_zstencil_t *cur_zstencil_buffer; - int cur_render_side; - gs_texture_t *cur_textures[GS_MAX_TEXTURES]; - gs_samplerstate_t *cur_samplers[GS_MAX_TEXTURES]; - gs_vertbuffer_t *cur_vertex_buffer; - gs_indexbuffer_t *cur_index_buffer; - gs_shader_t *cur_vertex_shader; - gs_shader_t *cur_pixel_shader; - gs_swapchain_t *cur_swap; - struct gs_program *cur_program; + gs_texture_t *cur_render_target; + gs_zstencil_t *cur_zstencil_buffer; + int cur_render_side; + gs_texture_t *cur_textures[GS_MAX_TEXTURES]; + gs_samplerstate_t *cur_samplers[GS_MAX_TEXTURES]; + gs_vertbuffer_t *cur_vertex_buffer; + gs_indexbuffer_t *cur_index_buffer; + gs_shader_t *cur_vertex_shader; + gs_shader_t *cur_pixel_shader; + gs_swapchain_t *cur_swap; + struct gs_program *cur_program; - struct gs_program *first_program; + struct gs_program *first_program; - enum gs_cull_mode cur_cull_mode; - struct gs_rect cur_viewport; + enum gs_cull_mode cur_cull_mode; + struct gs_rect cur_viewport; - struct matrix4 cur_proj; - struct matrix4 cur_view; - struct matrix4 cur_viewproj; + struct matrix4 cur_proj; + struct matrix4 cur_view; + struct matrix4 cur_viewproj; - DARRAY(struct matrix4) proj_stack; + DARRAY(struct matrix4) proj_stack; - struct fbo_info *cur_fbo; + struct fbo_info *cur_fbo; }; extern struct fbo_info *get_fbo(gs_texture_t *tex, uint32_t width, - uint32_t height); + uint32_t height); -extern void gl_update(gs_device_t *device); +extern void gl_update(gs_device_t *device); -extern struct gl_platform *gl_platform_create(gs_device_t *device, - uint32_t adapter); -extern void gl_platform_destroy(struct gl_platform *platform); +extern struct gl_platform *gl_platform_create(gs_device_t *device, + uint32_t adapter); +extern void gl_platform_destroy(struct gl_platform *platform); extern bool gl_platform_init_swapchain(struct gs_swap_chain *swap); extern void gl_platform_cleanup_swapchain(struct gs_swap_chain *swap); -extern struct gl_windowinfo *gl_windowinfo_create( - const struct gs_init_data *info); -extern void gl_windowinfo_destroy(struct gl_windowinfo *wi); +extern struct gl_windowinfo * +gl_windowinfo_create(const struct gs_init_data *info); +extern void gl_windowinfo_destroy(struct gl_windowinfo *wi); -extern void gl_getclientsize(const struct gs_swap_chain *swap, - uint32_t *width, - uint32_t *height); +extern void gl_getclientsize(const struct gs_swap_chain *swap, uint32_t *width, + uint32_t *height);
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-texture2d.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-texture2d.c
Changed
@@ -19,11 +19,11 @@ static bool upload_texture_2d(struct gs_texture_2d *tex, const uint8_t **data) { - uint32_t row_size = tex->width * gs_get_format_bpp(tex->base.format); - uint32_t tex_size = tex->height * row_size / 8; + uint32_t row_size = tex->width * gs_get_format_bpp(tex->base.format); + uint32_t tex_size = tex->height * row_size / 8; uint32_t num_levels = tex->base.levels; - bool compressed = gs_is_compressed_format(tex->base.format); - bool success; + bool compressed = gs_is_compressed_format(tex->base.format); + bool success; if (!num_levels) num_levels = gs_get_total_levels(tex->width, tex->height); @@ -32,10 +32,12 @@ return false; success = gl_init_face(GL_TEXTURE_2D, tex->base.gl_type, num_levels, - tex->base.gl_format, tex->base.gl_internal_format, - compressed, tex->width, tex->height, tex_size, &data); + tex->base.gl_format, + tex->base.gl_internal_format, compressed, + tex->width, tex->height, tex_size, &data); - if (!gl_tex_param_i(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, num_levels-1)) + if (!gl_tex_param_i(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, + num_levels - 1)) success = false; if (!gl_bind_texture(GL_TEXTURE_2D, 0)) success = false; @@ -57,7 +59,7 @@ size = tex->width * gs_get_format_bpp(tex->base.format); if (!gs_is_compressed_format(tex->base.format)) { size /= 8; - size = (size+3) & 0xFFFFFFFC; + size = (size + 3) & 0xFFFFFFFC; size *= tex->height; } else { size *= tex->height; @@ -75,24 +77,26 @@ } gs_texture_t *device_texture_create(gs_device_t *device, uint32_t width, - uint32_t height, enum gs_color_format color_format, - uint32_t levels, const uint8_t **data, uint32_t flags) + uint32_t height, + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags) { struct gs_texture_2d *tex = bzalloc(sizeof(struct gs_texture_2d)); - tex->base.device = device; - tex->base.type = GS_TEXTURE_2D; - tex->base.format = color_format; - tex->base.levels = levels; - tex->base.gl_format = convert_gs_format(color_format); + tex->base.device = device; + tex->base.type = GS_TEXTURE_2D; + tex->base.format = color_format; + tex->base.levels = levels; + tex->base.gl_format = convert_gs_format(color_format); tex->base.gl_internal_format = convert_gs_internal_format(color_format); - tex->base.gl_type = get_gl_format_type(color_format); - tex->base.gl_target = GL_TEXTURE_2D; - tex->base.is_dynamic = (flags & GS_DYNAMIC) != 0; - tex->base.is_render_target = (flags & GS_RENDER_TARGET) != 0; - tex->base.is_dummy = (flags & GS_GL_DUMMYTEX) != 0; - tex->base.gen_mipmaps = (flags & GS_BUILD_MIPMAPS) != 0; - tex->width = width; - tex->height = height; + tex->base.gl_type = get_gl_format_type(color_format); + tex->base.gl_target = GL_TEXTURE_2D; + tex->base.is_dynamic = (flags & GS_DYNAMIC) != 0; + tex->base.is_render_target = (flags & GS_RENDER_TARGET) != 0; + tex->base.is_dummy = (flags & GS_GL_DUMMYTEX) != 0; + tex->base.gen_mipmaps = (flags & GS_BUILD_MIPMAPS) != 0; + tex->width = width; + tex->height = height; if (!gl_gen_textures(1, &tex->base.texture)) goto fail; @@ -102,12 +106,31 @@ goto fail; if (!upload_texture_2d(tex, data)) goto fail; + } else { + if (!gl_bind_texture(GL_TEXTURE_2D, tex->base.texture)) + goto fail; + + uint32_t row_size = + tex->width * gs_get_format_bpp(tex->base.format); + uint32_t tex_size = tex->height * row_size / 8; + bool compressed = gs_is_compressed_format(tex->base.format); + bool did_init = gl_init_face(GL_TEXTURE_2D, tex->base.gl_type, + 1, tex->base.gl_format, + tex->base.gl_internal_format, + compressed, tex->width, + tex->height, tex_size, NULL); + did_init = + gl_tex_param_i(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); + + bool did_unbind = gl_bind_texture(GL_TEXTURE_2D, 0); + if (!did_init || !did_unbind) + goto fail; } - return (gs_texture_t*)tex; + return (gs_texture_t *)tex; fail: - gs_texture_destroy((gs_texture_t*)tex); + gs_texture_destroy((gs_texture_t *)tex); blog(LOG_ERROR, "device_texture_create (GL) failed"); return NULL; } @@ -122,7 +145,7 @@ void gs_texture_destroy(gs_texture_t *tex) { - struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex; + struct gs_texture_2d *tex2d = (struct gs_texture_2d *)tex; if (!tex) return; @@ -146,7 +169,7 @@ uint32_t gs_texture_get_width(const gs_texture_t *tex) { - const struct gs_texture_2d *tex2d = (const struct gs_texture_2d*)tex; + const struct gs_texture_2d *tex2d = (const struct gs_texture_2d *)tex; if (!is_texture_2d(tex, "gs_texture_get_width")) return 0; @@ -155,7 +178,7 @@ uint32_t gs_texture_get_height(const gs_texture_t *tex) { - const struct gs_texture_2d *tex2d = (const struct gs_texture_2d*)tex; + const struct gs_texture_2d *tex2d = (const struct gs_texture_2d *)tex; if (!is_texture_2d(tex, "gs_texture_get_height")) return 0; @@ -169,7 +192,7 @@ bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr, uint32_t *linesize) { - struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex; + struct gs_texture_2d *tex2d = (struct gs_texture_2d *)tex; if (!is_texture_2d(tex, "gs_texture_map")) goto fail; @@ -199,7 +222,7 @@ void gs_texture_unmap(gs_texture_t *tex) { - struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex; + struct gs_texture_2d *tex2d = (struct gs_texture_2d *)tex; if (!is_texture_2d(tex, "gs_texture_unmap")) goto failed; @@ -213,9 +236,8 @@ if (!gl_bind_texture(GL_TEXTURE_2D, tex2d->base.texture)) goto failed; - glTexImage2D(GL_TEXTURE_2D, 0, tex->gl_internal_format, - tex2d->width, tex2d->height, 0, - tex->gl_format, tex->gl_type, 0); + glTexImage2D(GL_TEXTURE_2D, 0, tex->gl_internal_format, tex2d->width, + tex2d->height, 0, tex->gl_format, tex->gl_type, 0); if (!gl_success("glTexImage2D")) goto failed; @@ -231,7 +253,7 @@ bool gs_texture_is_rect(const gs_texture_t *tex) { - const struct gs_texture_2d *tex2d = (const struct gs_texture_2d*)tex; + const struct gs_texture_2d *tex2d = (const struct gs_texture_2d *)tex; if (!is_texture_2d(tex, "gs_texture_unmap")) { blog(LOG_ERROR, "gs_texture_is_rect (GL) failed"); return false; @@ -242,7 +264,7 @@ void *gs_texture_get_obj(gs_texture_t *tex) { - struct gs_texture_2d *tex2d = (struct gs_texture_2d*)tex; + struct gs_texture_2d *tex2d = (struct gs_texture_2d *)tex; if (!is_texture_2d(tex, "gs_texture_unmap")) { blog(LOG_ERROR, "gs_texture_get_obj (GL) failed"); return NULL;
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-texturecube.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-texturecube.c
Changed
@@ -18,14 +18,14 @@ #include "gl-subsystem.h" static inline bool upload_texture_cube(struct gs_texture_cube *tex, - const uint8_t **data) + const uint8_t **data) { - uint32_t row_size = tex->size * gs_get_format_bpp(tex->base.format); - uint32_t tex_size = tex->size * row_size / 8; + uint32_t row_size = tex->size * gs_get_format_bpp(tex->base.format); + uint32_t tex_size = tex->size * row_size / 8; uint32_t num_levels = tex->base.levels; - bool compressed = gs_is_compressed_format(tex->base.format); - GLenum gl_type = get_gl_format_type(tex->base.format); - bool success = true; + bool compressed = gs_is_compressed_format(tex->base.format); + GLenum gl_type = get_gl_format_type(tex->base.format); + bool success = true; uint32_t i; if (!num_levels) @@ -38,10 +38,9 @@ success = false; if (!gl_init_face(target, gl_type, num_levels, - tex->base.gl_format, - tex->base.gl_internal_format, - compressed, tex->size, tex->size, - tex_size, &data)) + tex->base.gl_format, + tex->base.gl_internal_format, compressed, + tex->size, tex->size, tex_size, &data)) success = false; if (!gl_bind_texture(target, 0)) @@ -59,30 +58,31 @@ } gs_texture_t *device_cubetexture_create(gs_device_t *device, uint32_t size, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags) + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags) { struct gs_texture_cube *tex = bzalloc(sizeof(struct gs_texture_cube)); - tex->base.device = device; - tex->base.type = GS_TEXTURE_CUBE; - tex->base.format = color_format; - tex->base.levels = levels; - tex->base.gl_format = convert_gs_format(color_format); + tex->base.device = device; + tex->base.type = GS_TEXTURE_CUBE; + tex->base.format = color_format; + tex->base.levels = levels; + tex->base.gl_format = convert_gs_format(color_format); tex->base.gl_internal_format = convert_gs_internal_format(color_format); - tex->base.gl_target = GL_TEXTURE_CUBE_MAP; - tex->base.is_render_target = (flags & GS_RENDER_TARGET) != 0; - tex->base.gen_mipmaps = (flags & GS_BUILD_MIPMAPS) != 0; - tex->size = size; + tex->base.gl_target = GL_TEXTURE_CUBE_MAP; + tex->base.is_render_target = (flags & GS_RENDER_TARGET) != 0; + tex->base.gen_mipmaps = (flags & GS_BUILD_MIPMAPS) != 0; + tex->size = size; if (!gl_gen_textures(1, &tex->base.texture)) goto fail; if (!upload_texture_cube(tex, data)) goto fail; - return (gs_texture_t*)tex; + return (gs_texture_t *)tex; fail: - gs_cubetexture_destroy((gs_texture_t*)tex); + gs_cubetexture_destroy((gs_texture_t *)tex); blog(LOG_ERROR, "device_cubetexture_create (GL) failed"); return NULL; } @@ -112,7 +112,7 @@ uint32_t gs_cubetexture_get_size(const gs_texture_t *cubetex) { const struct gs_texture_cube *cube = - (const struct gs_texture_cube*)cubetex; + (const struct gs_texture_cube *)cubetex; if (!is_texture_cube(cubetex, "gs_cubetexture_get_size")) return 0; @@ -120,8 +120,8 @@ return cube->size; } -enum gs_color_format gs_cubetexture_get_color_format( - const gs_texture_t *cubetex) +enum gs_color_format +gs_cubetexture_get_color_format(const gs_texture_t *cubetex) { return cubetex->format; }
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-vertexbuffer.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-vertexbuffer.c
Changed
@@ -24,45 +24,45 @@ size_t i; if (!gl_create_buffer(GL_ARRAY_BUFFER, &vb->vertex_buffer, - vb->data->num * sizeof(struct vec3), - vb->data->points, usage)) + vb->data->num * sizeof(struct vec3), + vb->data->points, usage)) return false; if (vb->data->normals) { if (!gl_create_buffer(GL_ARRAY_BUFFER, &vb->normal_buffer, - vb->data->num * sizeof(struct vec3), - vb->data->normals, usage)) + vb->data->num * sizeof(struct vec3), + vb->data->normals, usage)) return false; } if (vb->data->tangents) { if (!gl_create_buffer(GL_ARRAY_BUFFER, &vb->tangent_buffer, - vb->data->num * sizeof(struct vec3), - vb->data->tangents, usage)) + vb->data->num * sizeof(struct vec3), + vb->data->tangents, usage)) return false; } if (vb->data->colors) { if (!gl_create_buffer(GL_ARRAY_BUFFER, &vb->color_buffer, - vb->data->num * sizeof(uint32_t), - vb->data->colors, usage)) + vb->data->num * sizeof(uint32_t), + vb->data->colors, usage)) return false; } da_reserve(vb->uv_buffers, vb->data->num_tex); - da_reserve(vb->uv_sizes, vb->data->num_tex); + da_reserve(vb->uv_sizes, vb->data->num_tex); for (i = 0; i < vb->data->num_tex; i++) { GLuint tex_buffer; - struct gs_tvertarray *tv = vb->data->tvarray+i; + struct gs_tvertarray *tv = vb->data->tvarray + i; size_t size = vb->data->num * sizeof(float) * tv->width; if (!gl_create_buffer(GL_ARRAY_BUFFER, &tex_buffer, size, - tv->array, usage)) + tv->array, usage)) return false; da_push_back(vb->uv_buffers, &tex_buffer); - da_push_back(vb->uv_sizes, &tv->width); + da_push_back(vb->uv_sizes, &tv->width); } if (!vb->dynamic) { @@ -77,12 +77,13 @@ } gs_vertbuffer_t *device_vertexbuffer_create(gs_device_t *device, - struct gs_vb_data *data, uint32_t flags) + struct gs_vb_data *data, + uint32_t flags) { struct gs_vertex_buffer *vb = bzalloc(sizeof(struct gs_vertex_buffer)); - vb->device = device; - vb->data = data; - vb->num = data->num; + vb->device = device; + vb->data = data; + vb->num = data->num; vb->dynamic = flags & GS_DYNAMIC; if (!create_buffers(vb)) { @@ -107,7 +108,7 @@ gl_delete_buffers(1, &vb->color_buffer); if (vb->uv_buffers.num) gl_delete_buffers((GLsizei)vb->uv_buffers.num, - vb->uv_buffers.array); + vb->uv_buffers.array); if (vb->vao) gl_delete_vertex_arrays(1, &vb->vao); @@ -121,12 +122,11 @@ } static inline void gs_vertexbuffer_flush_internal(gs_vertbuffer_t *vb, - const struct gs_vb_data *data) + const struct gs_vb_data *data) { size_t i; - size_t num_tex = data->num_tex < vb->data->num_tex - ? data->num_tex - : vb->data->num_tex; + size_t num_tex = data->num_tex < vb->data->num_tex ? data->num_tex + : vb->data->num_tex; if (!vb->dynamic) { blog(LOG_ERROR, "vertex buffer is not dynamic"); @@ -135,35 +135,34 @@ if (data->points) { if (!update_buffer(GL_ARRAY_BUFFER, vb->vertex_buffer, - data->points, - data->num * sizeof(struct vec3))) + data->points, + data->num * sizeof(struct vec3))) goto failed; } if (vb->normal_buffer && data->normals) { if (!update_buffer(GL_ARRAY_BUFFER, vb->normal_buffer, - data->normals, - data->num * sizeof(struct vec3))) + data->normals, + data->num * sizeof(struct vec3))) goto failed; } if (vb->tangent_buffer && data->tangents) { if (!update_buffer(GL_ARRAY_BUFFER, vb->tangent_buffer, - data->tangents, - data->num * sizeof(struct vec3))) + data->tangents, + data->num * sizeof(struct vec3))) goto failed; } if (vb->color_buffer && data->colors) { if (!update_buffer(GL_ARRAY_BUFFER, vb->color_buffer, - data->colors, - data->num * sizeof(uint32_t))) + data->colors, data->num * sizeof(uint32_t))) goto failed; } for (i = 0; i < num_tex; i++) { GLuint buffer = vb->uv_buffers.array[i]; - struct gs_tvertarray *tv = data->tvarray+i; + struct gs_tvertarray *tv = data->tvarray + i; size_t size = data->num * tv->width * sizeof(float); if (!update_buffer(GL_ARRAY_BUFFER, buffer, tv->array, size)) @@ -182,7 +181,7 @@ } void gs_vertexbuffer_flush_direct(gs_vertbuffer_t *vb, - const struct gs_vb_data *data) + const struct gs_vb_data *data) { gs_vertexbuffer_flush_internal(vb, data); } @@ -193,11 +192,11 @@ } static inline GLuint get_vb_buffer(struct gs_vertex_buffer *vb, - enum attrib_type type, size_t index, GLint *width, - GLenum *gl_type) + enum attrib_type type, size_t index, + GLint *width, GLenum *gl_type) { *gl_type = GL_FLOAT; - *width = 4; + *width = 4; if (type == ATTRIB_POSITION) { return vb->vertex_buffer; @@ -220,7 +219,7 @@ } static bool load_vb_buffer(struct shader_attrib *attrib, - struct gs_vertex_buffer *vb, GLint id) + struct gs_vertex_buffer *vb, GLint id) { GLenum type; GLint width; @@ -230,7 +229,7 @@ buffer = get_vb_buffer(vb, attrib->type, attrib->index, &width, &type); if (!buffer) { blog(LOG_ERROR, "Vertex buffer does not have the required " - "inputs for vertex shader"); + "inputs for vertex shader"); return false; } @@ -252,7 +251,7 @@ } bool load_vb_buffers(struct gs_program *program, struct gs_vertex_buffer *vb, - struct gs_index_buffer *ib) + struct gs_index_buffer *ib) { struct gs_shader *shader = program->vertex_shader; size_t i; @@ -261,7 +260,7 @@ return false; for (i = 0; i < shader->attribs.num; i++) { - struct shader_attrib *attrib = shader->attribs.array+i; + struct shader_attrib *attrib = shader->attribs.array + i; if (!load_vb_buffer(attrib, vb, program->attribs.array[i])) return false; }
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-windows.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-windows.c
Changed
@@ -26,7 +26,7 @@ * super basic stuff */ struct gl_windowinfo { HWND hwnd; - HDC hdc; + HDC hdc; }; /* Like the other subsystems, the GL subsystem has one swap chain created by @@ -73,24 +73,24 @@ static inline void init_dummy_pixel_format(PIXELFORMATDESCRIPTOR *pfd) { memset(pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); - pfd->nSize = sizeof(pfd); - pfd->nVersion = 1; - pfd->iPixelType = PFD_TYPE_RGBA; - pfd->cColorBits = 32; - pfd->cDepthBits = 24; + pfd->nSize = sizeof(pfd); + pfd->nVersion = 1; + pfd->iPixelType = PFD_TYPE_RGBA; + pfd->cColorBits = 32; + pfd->cDepthBits = 24; pfd->cStencilBits = 8; - pfd->iLayerType = PFD_MAIN_PLANE; - pfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | - PFD_DOUBLEBUFFER; + pfd->iLayerType = PFD_MAIN_PLANE; + pfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | + PFD_DOUBLEBUFFER; } static const char *dummy_window_class = "GLDummyWindow"; static bool registered_dummy_window_class = false; struct dummy_context { - HWND hwnd; + HWND hwnd; HGLRC hrc; - HDC hdc; + HDC hdc; }; /* Need a dummy window for the dummy context */ @@ -118,9 +118,8 @@ static inline HWND gl_create_dummy_window(void) { HWND hwnd = CreateWindowExA(0, dummy_window_class, "Dummy GL Window", - WS_POPUP, - 0, 0, 2, 2, - NULL, NULL, GetModuleHandle(NULL), NULL); + WS_POPUP, 0, 0, 2, 2, NULL, NULL, + GetModuleHandle(NULL), NULL); if (!hwnd) blog(LOG_ERROR, "Could not create dummy context window"); @@ -131,8 +130,10 @@ { bool success = wglMakeCurrent(hdc, hglrc); if (!success) - blog(LOG_ERROR, "wglMakeCurrent failed, GetLastError " - "returned %lu", GetLastError()); + blog(LOG_ERROR, + "wglMakeCurrent failed, GetLastError " + "returned %lu", + GetLastError()); return success; } @@ -153,14 +154,11 @@ return hglrc; } -static const int attribs[] = -{ +static const int attribs[] = { #ifdef _DEBUG - WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB, + WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB, #endif - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, - 0, 0 -}; + WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, 0, 0}; static inline HGLRC gl_init_context(HDC hdc) { @@ -168,8 +166,10 @@ if (GLAD_WGL_ARB_create_context) { HGLRC hglrc = wglCreateContextAttribsARB(hdc, 0, attribs); if (!hglrc) { - blog(LOG_ERROR, "wglCreateContextAttribsARB failed, " - "%lu", GetLastError()); + blog(LOG_ERROR, + "wglCreateContextAttribsARB failed, " + "%lu", + GetLastError()); return NULL; } @@ -203,13 +203,13 @@ format_index = ChoosePixelFormat(dummy->hdc, &pfd); if (!format_index) { blog(LOG_ERROR, "Dummy ChoosePixelFormat failed, %lu", - GetLastError()); + GetLastError()); return false; } if (!SetPixelFormat(dummy->hdc, format_index, &pfd)) { blog(LOG_ERROR, "Dummy SetPixelFormat failed, %lu", - GetLastError()); + GetLastError()); return false; } @@ -270,8 +270,8 @@ static int gl_choose_pixel_format(HDC hdc, const struct gs_init_data *info) { struct darray attribs; - int color_bits = get_color_format_bits(info->format); - int depth_bits = get_depth_format_bits(info->zsformat); + int color_bits = get_color_format_bits(info->format); + int depth_bits = get_depth_format_bits(info->zsformat); int stencil_bits = get_stencil_format_bits(info->zsformat); UINT num_formats; BOOL success; @@ -279,26 +279,26 @@ if (!color_bits) { blog(LOG_ERROR, "gl_init_pixel_format: color format not " - "supported"); + "supported"); return false; } darray_init(&attribs); add_attrib(&attribs, WGL_DRAW_TO_WINDOW_ARB, GL_TRUE); add_attrib(&attribs, WGL_SUPPORT_OPENGL_ARB, GL_TRUE); - add_attrib(&attribs, WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB); - add_attrib(&attribs, WGL_DOUBLE_BUFFER_ARB, GL_TRUE); - add_attrib(&attribs, WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB); - add_attrib(&attribs, WGL_COLOR_BITS_ARB, color_bits); - add_attrib(&attribs, WGL_DEPTH_BITS_ARB, depth_bits); - add_attrib(&attribs, WGL_STENCIL_BITS_ARB, stencil_bits); + add_attrib(&attribs, WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB); + add_attrib(&attribs, WGL_DOUBLE_BUFFER_ARB, GL_TRUE); + add_attrib(&attribs, WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB); + add_attrib(&attribs, WGL_COLOR_BITS_ARB, color_bits); + add_attrib(&attribs, WGL_DEPTH_BITS_ARB, depth_bits); + add_attrib(&attribs, WGL_STENCIL_BITS_ARB, stencil_bits); add_attrib(&attribs, 0, 0); success = wglChoosePixelFormatARB(hdc, attribs.array, NULL, 1, &format, - &num_formats); + &num_formats); if (!success || !num_formats) { blog(LOG_ERROR, "wglChoosePixelFormatARB failed, %lu", - GetLastError()); + GetLastError()); format = 0; } @@ -308,7 +308,7 @@ } static inline bool gl_getpixelformat(HDC hdc, const struct gs_init_data *info, - int *format, PIXELFORMATDESCRIPTOR *pfd) + int *format, PIXELFORMATDESCRIPTOR *pfd) { if (!format) return false; @@ -317,7 +317,7 @@ if (!DescribePixelFormat(hdc, *format, sizeof(*pfd), pfd)) { blog(LOG_ERROR, "DescribePixelFormat failed, %lu", - GetLastError()); + GetLastError()); return false; } @@ -325,7 +325,7 @@ } static inline bool gl_setpixelformat(HDC hdc, int format, - PIXELFORMATDESCRIPTOR *pfd) + PIXELFORMATDESCRIPTOR *pfd) { if (!SetPixelFormat(hdc, format, pfd)) { blog(LOG_ERROR, "SetPixelFormat failed, %lu", GetLastError()); @@ -339,7 +339,7 @@ { struct gl_windowinfo *wi = bzalloc(sizeof(struct gl_windowinfo)); wi->hwnd = info->window.hwnd; - wi->hdc = GetDC(wi->hwnd); + wi->hdc = GetDC(wi->hwnd); if (!wi->hdc) { blog(LOG_ERROR, "Unable to get device context from window"); @@ -356,10 +356,10 @@ { static bool created = false; - WNDCLASSA wc = {0}; - wc.style = CS_OWNDC; - wc.hInstance = GetModuleHandleW(NULL); - wc.lpfnWndProc = (WNDPROC)DefWindowProcA; + WNDCLASSA wc = {0}; + wc.style = CS_OWNDC; + wc.hInstance = GetModuleHandleW(NULL); + wc.lpfnWndProc = (WNDPROC)DefWindowProcA; wc.lpszClassName = DUMMY_WNDCLASS; if (created) @@ -367,7 +367,7 @@ if (!RegisterClassA(&wc)) { blog(LOG_ERROR, "Failed to register dummy GL window class, %lu", - GetLastError()); + GetLastError()); return false; } @@ -378,18 +378,19 @@ static bool create_dummy_window(struct gl_platform *plat) { plat->window.hwnd = CreateWindowExA(0, DUMMY_WNDCLASS, - "OpenGL Dummy Window", WS_POPUP, 0, 0, 1, 1, - NULL, NULL, GetModuleHandleW(NULL), NULL); + "OpenGL Dummy Window", WS_POPUP, 0, + 0, 1, 1, NULL, NULL, + GetModuleHandleW(NULL), NULL); if (!plat->window.hwnd) { blog(LOG_ERROR, "Failed to create dummy GL window, %lu", - GetLastError()); + GetLastError()); return false; } plat->window.hdc = GetDC(plat->window.hwnd); if (!plat->window.hdc) { blog(LOG_ERROR, "Failed to get dummy GL window DC (%lu)", - GetLastError()); + GetLastError()); return false; } @@ -397,7 +398,7 @@ } static bool init_default_swap(struct gl_platform *plat, gs_device_t *device, - int pixel_format, PIXELFORMATDESCRIPTOR *pfd) + int pixel_format, PIXELFORMATDESCRIPTOR *pfd) { if (!gl_setpixelformat(plat->window.hdc, pixel_format, pfd)) return false; @@ -541,6 +542,11 @@ UNUSED_PARAMETER(device); } +void *device_get_device_obj(gs_device_t *device) +{ + return device->plat->hrc; +} + void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap) { HDC hdc = device->plat->window.hdc; @@ -561,19 +567,21 @@ void device_present(gs_device_t *device) { if (!SwapBuffers(device->cur_swap->wi->hdc)) { - blog(LOG_ERROR, "SwapBuffers failed, GetLastError " - "returned %lu", GetLastError()); + blog(LOG_ERROR, + "SwapBuffers failed, GetLastError " + "returned %lu", + GetLastError()); blog(LOG_ERROR, "device_present (GL) failed"); } } -extern void gl_getclientsize(const struct gs_swap_chain *swap, - uint32_t *width, uint32_t *height) +extern void gl_getclientsize(const struct gs_swap_chain *swap, uint32_t *width, + uint32_t *height) { RECT rc; if (swap) { GetClientRect(swap->wi->hwnd, &rc); - *width = rc.right; + *width = rc.right; *height = rc.bottom; } else { *width = 0;
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-x11.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-x11.c
Changed
@@ -42,28 +42,34 @@ static const int ctx_attribs[] = { #ifdef _DEBUG - GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB, + GLX_CONTEXT_FLAGS_ARB, + GLX_CONTEXT_DEBUG_BIT_ARB, #endif - GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, - GLX_CONTEXT_MAJOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 2, + GLX_CONTEXT_PROFILE_MASK_ARB, + GLX_CONTEXT_CORE_PROFILE_BIT_ARB, + GLX_CONTEXT_MAJOR_VERSION_ARB, + 3, + GLX_CONTEXT_MINOR_VERSION_ARB, + 2, None, }; -static int ctx_pbuffer_attribs[] = { - GLX_PBUFFER_WIDTH, 2, - GLX_PBUFFER_HEIGHT, 2, - None -}; - -static int ctx_visual_attribs[] = { - GLX_STENCIL_SIZE, 0, - GLX_DEPTH_SIZE, 0, - GLX_BUFFER_SIZE, 32, - GLX_ALPHA_SIZE, 8, - GLX_DOUBLEBUFFER, true, - GLX_X_RENDERABLE, true, - None -}; +static int ctx_pbuffer_attribs[] = {GLX_PBUFFER_WIDTH, 2, GLX_PBUFFER_HEIGHT, 2, + None}; + +static int ctx_visual_attribs[] = {GLX_STENCIL_SIZE, + 0, + GLX_DEPTH_SIZE, + 0, + GLX_BUFFER_SIZE, + 32, + GLX_ALPHA_SIZE, + 8, + GLX_DOUBLEBUFFER, + true, + GLX_X_RENDERABLE, + true, + None}; struct gl_windowinfo { /* We store this value since we can fetch a lot @@ -91,17 +97,14 @@ static void print_info_stuff(const struct gs_init_data *info) { - blog( LOG_INFO, - "X and Y: %i %i\n" - "Backbuffers: %i\n" - "Color Format: %i\n" - "ZStencil Format: %i\n" - "Adapter: %i\n", - info->cx, info->cy, - info->num_backbuffers, - info->format, info->zsformat, - info->adapter - ); + blog(LOG_INFO, + "X and Y: %i %i\n" + "Backbuffers: %i\n" + "Color Format: %i\n" + "ZStencil Format: %i\n" + "Adapter: %i\n", + info->cx, info->cy, info->num_backbuffers, info->format, + info->zsformat, info->adapter); } /* The following utility functions are copied verbatim from WGL code. * GLX and WGL are more similar than most people realize. */ @@ -150,7 +153,7 @@ /* Returns -1 on invalid screen. */ static int get_screen_num_from_xcb_screen(xcb_connection_t *xcb_conn, - xcb_screen_t *screen) + xcb_screen_t *screen) { xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(xcb_conn)); @@ -164,7 +167,7 @@ } static xcb_screen_t *get_screen_from_root(xcb_connection_t *xcb_conn, - xcb_window_t root) + xcb_window_t root) { xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(xcb_conn)); @@ -180,17 +183,18 @@ } static inline int get_screen_num_from_root(xcb_connection_t *xcb_conn, - xcb_window_t root) + xcb_window_t root) { xcb_screen_t *screen = get_screen_from_root(xcb_conn, root); - if (!screen) return -1; + if (!screen) + return -1; return get_screen_num_from_xcb_screen(xcb_conn, screen); } -static xcb_get_geometry_reply_t* get_window_geometry( - xcb_connection_t *xcb_conn, xcb_drawable_t drawable) +static xcb_get_geometry_reply_t *get_window_geometry(xcb_connection_t *xcb_conn, + xcb_drawable_t drawable) { xcb_get_geometry_cookie_t cookie; xcb_generic_error_t *error; @@ -224,14 +228,14 @@ } config = glXChooseFBConfig(display, DefaultScreen(display), - ctx_visual_attribs, &frame_buf_config_count); + ctx_visual_attribs, &frame_buf_config_count); if (!config) { blog(LOG_ERROR, "Failed to create OpenGL frame buffer config"); return false; } - context = glXCreateContextAttribsARB(display, config[0], NULL, - true, ctx_attribs); + context = glXCreateContextAttribsARB(display, config[0], NULL, true, + ctx_attribs); if (!context) { blog(LOG_ERROR, "Failed to create OpenGL context."); goto error; @@ -240,8 +244,8 @@ plat->context = context; plat->display = display; - plat->pbuffer = glXCreatePbuffer(display, config[0], - ctx_pbuffer_attribs); + plat->pbuffer = + glXCreatePbuffer(display, config[0], ctx_pbuffer_attribs); if (!plat->pbuffer) { blog(LOG_ERROR, "Failed to create OpenGL pbuffer"); goto error; @@ -264,7 +268,8 @@ bfree(plat); } -extern struct gl_windowinfo *gl_windowinfo_create(const struct gs_init_data *info) +extern struct gl_windowinfo * +gl_windowinfo_create(const struct gs_init_data *info) { UNUSED_PARAMETER(info); return bmalloc(sizeof(struct gl_windowinfo)); @@ -330,20 +335,21 @@ XGetErrorText(display, error->request_code, str2, sizeof(str2)); XGetErrorText(display, error->minor_code, str3, sizeof(str3)); - blog(LOG_ERROR, "X Error: %s, Major opcode: %s, " - "Minor opcode: %s, Serial: %lu", - str1, str2, str3, error->serial); + blog(LOG_ERROR, + "X Error: %s, Major opcode: %s, " + "Minor opcode: %s, Serial: %lu", + str1, str2, str3, error->serial); return 0; } extern struct gl_platform *gl_platform_create(gs_device_t *device, - uint32_t adapter) + uint32_t adapter) { /* There's some trickery here... we're mixing libX11, xcb, and GLX For an explanation see here: http://xcb.freedesktop.org/MixingCalls/ Essentially, GLX requires Xlib. Everything else we use xcb. */ - struct gl_platform * plat = bmalloc(sizeof(struct gl_platform)); - Display * display = open_windowless_display(); + struct gl_platform *plat = bmalloc(sizeof(struct gl_platform)); + Display *display = open_windowless_display(); if (!display) { goto fail_display_open; @@ -363,7 +369,7 @@ } if (!glXMakeContextCurrent(plat->display, plat->pbuffer, plat->pbuffer, - plat->context)) { + plat->context)) { blog(LOG_ERROR, "Failed to make context current."); goto fail_make_current; } @@ -410,7 +416,8 @@ int visual; GLXFBConfig *fb_config; - if (!geometry) goto fail_geometry_request; + if (!geometry) + goto fail_geometry_request; screen_num = get_screen_num_from_root(xcb_conn, geometry->root); if (screen_num == -1) { @@ -421,7 +428,7 @@ { int num_configs; fb_config = glXChooseFBConfig(display, screen_num, - ctx_visual_attribs, &num_configs); + ctx_visual_attribs, &num_configs); if (!fb_config || !num_configs) { blog(LOG_ERROR, "Failed to find FBConfig!"); @@ -431,7 +438,8 @@ /* ...then fetch matching visual info for xcb. */ { - int error = glXGetFBConfigAttrib(display, fb_config[0], GLX_VISUAL_ID, &visual); + int error = glXGetFBConfigAttrib(display, fb_config[0], + GLX_VISUAL_ID, &visual); if (error) { blog(LOG_ERROR, "Bad call to GetFBConfigAttrib!"); @@ -439,27 +447,16 @@ } } - xcb_colormap_t colormap = xcb_generate_id(xcb_conn); uint32_t mask = XCB_CW_BORDER_PIXEL | XCB_CW_COLORMAP; - uint32_t mask_values[] = { 0, colormap, 0 }; - - xcb_create_colormap(xcb_conn, - XCB_COLORMAP_ALLOC_NONE, - colormap, - parent, - visual - ); - - xcb_create_window( - xcb_conn, 24 /* Hardcoded? */, - wid, parent, - 0, 0, - geometry->width, - geometry->height, - 0, 0, - visual, mask, mask_values - ); + uint32_t mask_values[] = {0, colormap, 0}; + + xcb_create_colormap(xcb_conn, XCB_COLORMAP_ALLOC_NONE, colormap, parent, + visual); + + xcb_create_window(xcb_conn, 24 /* Hardcoded? */, wid, parent, 0, 0, + geometry->width, geometry->height, 0, 0, visual, mask, + mask_values); swap->wi->config = fb_config[0]; swap->wi->window = wid; @@ -513,15 +510,22 @@ } } -extern void gl_getclientsize(const struct gs_swap_chain *swap, - uint32_t *width, uint32_t *height) +void *device_get_device_obj(gs_device_t *device) { - xcb_connection_t *xcb_conn = XGetXCBConnection(swap->device->plat->display); + return device->plat->context; +} + +extern void gl_getclientsize(const struct gs_swap_chain *swap, uint32_t *width, + uint32_t *height) +{ + xcb_connection_t *xcb_conn = + XGetXCBConnection(swap->device->plat->display); xcb_window_t window = swap->wi->window; - xcb_get_geometry_reply_t *geometry = get_window_geometry(xcb_conn, window); + xcb_get_geometry_reply_t *geometry = + get_window_geometry(xcb_conn, window); if (geometry) { - *width = geometry->width; + *width = geometry->width; *height = geometry->height; } @@ -533,16 +537,12 @@ Display *display = device->plat->display; xcb_window_t window = device->cur_swap->wi->window; - uint32_t values[] = { - device->cur_swap->info.cx, - device->cur_swap->info.cy - }; + uint32_t values[] = {device->cur_swap->info.cx, + device->cur_swap->info.cy}; - xcb_configure_window( - XGetXCBConnection(display), window, - XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, - values - ); + xcb_configure_window(XGetXCBConnection(display), window, + XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, + values); } extern void device_load_swapchain(gs_device_t *device, gs_swapchain_t *swap) @@ -596,15 +596,21 @@ xcb_connection_t *xcb_conn = XGetXCBConnection(display); xcb_generic_event_t *xcb_event; - while((xcb_event = xcb_poll_for_event(xcb_conn))) { + while ((xcb_event = xcb_poll_for_event(xcb_conn))) { /* TODO: Handle XCB events. */ free(xcb_event); } switch (swap_type) { - case SWAP_TYPE_EXT: glXSwapIntervalEXT(display, window, 0); break; - case SWAP_TYPE_MESA: glXSwapIntervalMESA(0); break; - case SWAP_TYPE_SGI: glXSwapIntervalSGI(0); break; + case SWAP_TYPE_EXT: + glXSwapIntervalEXT(display, window, 0); + break; + case SWAP_TYPE_MESA: + glXSwapIntervalMESA(0); + break; + case SWAP_TYPE_SGI: + glXSwapIntervalSGI(0); + break; case SWAP_TYPE_NORMAL:; }
View file
obs-studio-23.2.1.tar.xz/libobs-opengl/gl-zstencil.c -> obs-studio-24.0.0.tar.xz/libobs-opengl/gl-zstencil.c
Changed
@@ -18,7 +18,7 @@ #include "gl-subsystem.h" static bool gl_init_zsbuffer(struct gs_zstencil_buffer *zs, uint32_t width, - uint32_t height) + uint32_t height) { glGenRenderbuffers(1, &zs->buffer); if (!gl_success("glGenRenderbuffers")) @@ -38,25 +38,31 @@ static inline GLenum get_attachment(enum gs_zstencil_format format) { switch (format) { - case GS_Z16: return GL_DEPTH_ATTACHMENT; - case GS_Z24_S8: return GL_DEPTH_STENCIL_ATTACHMENT; - case GS_Z32F: return GL_DEPTH_ATTACHMENT; - case GS_Z32F_S8X24: return GL_DEPTH_STENCIL_ATTACHMENT; - case GS_ZS_NONE: return 0; + case GS_Z16: + return GL_DEPTH_ATTACHMENT; + case GS_Z24_S8: + return GL_DEPTH_STENCIL_ATTACHMENT; + case GS_Z32F: + return GL_DEPTH_ATTACHMENT; + case GS_Z32F_S8X24: + return GL_DEPTH_STENCIL_ATTACHMENT; + case GS_ZS_NONE: + return 0; } return 0; } gs_zstencil_t *device_zstencil_create(gs_device_t *device, uint32_t width, - uint32_t height, enum gs_zstencil_format format) + uint32_t height, + enum gs_zstencil_format format) { struct gs_zstencil_buffer *zs; zs = bzalloc(sizeof(struct gs_zstencil_buffer)); - zs->format = convert_zstencil_format(format); + zs->format = convert_zstencil_format(format); zs->attachment = get_attachment(format); - zs->device = device; + zs->device = device; if (!gl_init_zsbuffer(zs, width, height)) { blog(LOG_ERROR, "device_zstencil_create (GL) failed");
View file
obs-studio-23.2.1.tar.xz/libobs/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/libobs/CMakeLists.txt
Changed
@@ -454,7 +454,7 @@ set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}") endforeach() CONFIGURE_FILE("libobs.pc.in" "libobs.pc" @ONLY) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libobs.pc" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libobs.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() set_target_properties(libobs PROPERTIES
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/osx/coreaudio-enum-devices.c -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/osx/coreaudio-enum-devices.c
Changed
@@ -8,21 +8,20 @@ #include "mac-helpers.h" static bool obs_enum_audio_monitoring_device(obs_enum_audio_device_cb cb, - void *data, AudioDeviceID id, bool allow_inputs) + void *data, AudioDeviceID id, + bool allow_inputs) { - UInt32 size = 0; + UInt32 size = 0; CFStringRef cf_name = NULL; - CFStringRef cf_uid = NULL; - char *name = NULL; - char *uid = NULL; - OSStatus stat; - bool cont = true; + CFStringRef cf_uid = NULL; + char *name = NULL; + char *uid = NULL; + OSStatus stat; + bool cont = true; - AudioObjectPropertyAddress addr = { - kAudioDevicePropertyStreams, - kAudioDevicePropertyScopeOutput, - kAudioObjectPropertyElementMaster - }; + AudioObjectPropertyAddress addr = {kAudioDevicePropertyStreams, + kAudioDevicePropertyScopeOutput, + kAudioObjectPropertyElementMaster}; /* Check if the device is capable of audio output. */ AudioObjectGetPropertyDataSize(id, &addr, 0, NULL, &size); @@ -66,33 +65,31 @@ } static void enum_audio_devices(obs_enum_audio_device_cb cb, void *data, - bool allow_inputs) + bool allow_inputs) { - AudioObjectPropertyAddress addr = { - kAudioHardwarePropertyDevices, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; + AudioObjectPropertyAddress addr = {kAudioHardwarePropertyDevices, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster}; - UInt32 size = 0; - UInt32 count; - OSStatus stat; + UInt32 size = 0; + UInt32 count; + OSStatus stat; AudioDeviceID *ids; stat = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &addr, - 0, NULL, &size); + 0, NULL, &size); if (!success(stat, "get data size")) return; - ids = malloc(size); + ids = malloc(size); count = size / sizeof(AudioDeviceID); - stat = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, - 0, NULL, &size, ids); + stat = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, 0, + NULL, &size, ids); if (success(stat, "get data")) { for (UInt32 i = 0; i < count; i++) { if (!obs_enum_audio_monitoring_device(cb, data, ids[i], - allow_inputs)) + allow_inputs)) break; } } @@ -119,21 +116,20 @@ AudioObjectPropertyAddress addr = { kAudioHardwarePropertyDefaultSystemOutputDevice, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; + kAudioObjectPropertyElementMaster}; if (*p_id) return; - OSStatus stat; + OSStatus stat; AudioDeviceID id = 0; - UInt32 size = sizeof(id); + UInt32 size = sizeof(id); stat = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, 0, - NULL, &size, &id); + NULL, &size, &id); if (success(stat, "AudioObjectGetPropertyData")) obs_enum_audio_monitoring_device(alloc_default_id, p_id, id, - true); + true); if (!*p_id) *p_id = bzalloc(1); }
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/osx/coreaudio-output.c -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/osx/coreaudio-output.c
Changed
@@ -13,21 +13,21 @@ #include "mac-helpers.h" struct audio_monitor { - obs_source_t *source; - AudioQueueRef queue; - AudioQueueBufferRef buffers[3]; - - pthread_mutex_t mutex; - struct circlebuf empty_buffers; - struct circlebuf new_data; - audio_resampler_t *resampler; - size_t buffer_size; - size_t wait_size; - uint32_t channels; - - volatile bool active; - bool paused; - bool ignore; + obs_source_t *source; + AudioQueueRef queue; + AudioQueueBufferRef buffers[3]; + + pthread_mutex_t mutex; + struct circlebuf empty_buffers; + struct circlebuf new_data; + audio_resampler_t *resampler; + size_t buffer_size; + size_t wait_size; + uint32_t channels; + + volatile bool active; + bool paused; + bool ignore; }; static inline bool fill_buffer(struct audio_monitor *monitor) @@ -41,21 +41,21 @@ circlebuf_pop_front(&monitor->empty_buffers, &buf, sizeof(buf)); circlebuf_pop_front(&monitor->new_data, buf->mAudioData, - monitor->buffer_size); + monitor->buffer_size); buf->mAudioDataByteSize = monitor->buffer_size; stat = AudioQueueEnqueueBuffer(monitor->queue, buf, 0, NULL); if (!success(stat, "AudioQueueEnqueueBuffer")) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, - "Failed to enqueue buffer"); + "Failed to enqueue buffer"); AudioQueueStop(monitor->queue, false); } return true; } static void on_audio_playback(void *param, obs_source_t *source, - const struct audio_data *audio_data, bool muted) + const struct audio_data *audio_data, bool muted) { struct audio_monitor *monitor = param; float vol = source->user_volume; @@ -72,10 +72,10 @@ uint64_t ts_offset; bool success; - success = audio_resampler_resample(monitor->resampler, resample_data, - &resample_frames, &ts_offset, - (const uint8_t *const *)audio_data->data, - (uint32_t)audio_data->frames); + success = audio_resampler_resample( + monitor->resampler, resample_data, &resample_frames, &ts_offset, + (const uint8_t *const *)audio_data->data, + (uint32_t)audio_data->frames); if (!success) { return; } @@ -87,9 +87,9 @@ } else { /* apply volume */ if (!close_float(vol, 1.0f, EPSILON)) { - register float *cur = (float*)resample_data[0]; - register float *end = cur + - resample_frames * monitor->channels; + register float *cur = (float *)resample_data[0]; + register float *end = + cur + resample_frames * monitor->channels; while (cur < end) *(cur++) *= vol; @@ -141,10 +141,10 @@ extern bool devices_match(const char *id1, const char *id2); static bool audio_monitor_init(struct audio_monitor *monitor, - obs_source_t *source) + obs_source_t *source) { - const struct audio_output_info *info = audio_output_get_info( - obs->audio.audio); + const struct audio_output_info *info = + audio_output_get_info(obs->audio.audio); uint32_t channels = get_audio_channels(info->speakers); OSStatus stat; @@ -152,13 +152,12 @@ .mSampleRate = (Float64)info->samples_per_sec, .mFormatID = kAudioFormatLinearPCM, .mFormatFlags = kAudioFormatFlagIsFloat | - kAudioFormatFlagIsPacked, + kAudioFormatFlagIsPacked, .mBytesPerPacket = sizeof(float) * channels, .mFramesPerPacket = 1, .mBytesPerFrame = sizeof(float) * channels, .mChannelsPerFrame = channels, - .mBitsPerChannel = sizeof(float) * 8 - }; + .mBitsPerChannel = sizeof(float) * 8}; monitor->source = source; @@ -187,20 +186,19 @@ } stat = AudioQueueNewOutput(&desc, buffer_audio, monitor, NULL, NULL, 0, - &monitor->queue); + &monitor->queue); if (!success(stat, "AudioStreamBasicDescription")) { return false; } if (strcmp(uid, "default") != 0) { - CFStringRef cf_uid = CFStringCreateWithBytes(NULL, - (const UInt8*)uid, strlen(uid), - kCFStringEncodingUTF8, - false); + CFStringRef cf_uid = CFStringCreateWithBytes( + NULL, (const UInt8 *)uid, strlen(uid), + kCFStringEncodingUTF8, false); stat = AudioQueueSetProperty(monitor->queue, - kAudioQueueProperty_CurrentDevice, - &cf_uid, sizeof(cf_uid)); + kAudioQueueProperty_CurrentDevice, + &cf_uid, sizeof(cf_uid)); CFRelease(cf_uid); if (!success(stat, "set current device")) { @@ -208,45 +206,42 @@ } } - stat = AudioQueueSetParameter(monitor->queue, - kAudioQueueParam_Volume, 1.0); + stat = AudioQueueSetParameter(monitor->queue, kAudioQueueParam_Volume, + 1.0); if (!success(stat, "set volume")) { return false; } for (size_t i = 0; i < 3; i++) { stat = AudioQueueAllocateBuffer(monitor->queue, - monitor->buffer_size, &monitor->buffers[i]); + monitor->buffer_size, + &monitor->buffers[i]); if (!success(stat, "allocation of buffer")) { return false; } circlebuf_push_back(&monitor->empty_buffers, - &monitor->buffers[i], - sizeof(monitor->buffers[i])); + &monitor->buffers[i], + sizeof(monitor->buffers[i])); } if (pthread_mutex_init(&monitor->mutex, NULL) != 0) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, - "Failed to init mutex"); + "Failed to init mutex"); return false; } - struct resample_info from = { - .samples_per_sec = info->samples_per_sec, - .speakers = info->speakers, - .format = AUDIO_FORMAT_FLOAT_PLANAR - }; - struct resample_info to = { - .samples_per_sec = info->samples_per_sec, - .speakers = info->speakers, - .format = AUDIO_FORMAT_FLOAT - }; + struct resample_info from = {.samples_per_sec = info->samples_per_sec, + .speakers = info->speakers, + .format = AUDIO_FORMAT_FLOAT_PLANAR}; + struct resample_info to = {.samples_per_sec = info->samples_per_sec, + .speakers = info->speakers, + .format = AUDIO_FORMAT_FLOAT}; monitor->resampler = audio_resampler_create(&to, &from); if (!monitor->resampler) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, - "Failed to create resampler"); + "Failed to create resampler"); return false; } @@ -263,7 +258,7 @@ { if (monitor->source) { obs_source_remove_audio_capture_callback( - monitor->source, on_audio_playback, monitor); + monitor->source, on_audio_playback, monitor); } if (monitor->active) { AudioQueueStop(monitor->queue, true); @@ -271,7 +266,7 @@ for (size_t i = 0; i < 3; i++) { if (monitor->buffers[i]) { AudioQueueFreeBuffer(monitor->queue, - monitor->buffers[i]); + monitor->buffers[i]); } } if (monitor->queue) { @@ -290,7 +285,7 @@ return; obs_source_add_audio_capture_callback(monitor->source, - on_audio_playback, monitor); + on_audio_playback, monitor); } struct audio_monitor *audio_monitor_create(obs_source_t *source)
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/osx/mac-helpers.h -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/osx/mac-helpers.h
Changed
@@ -3,13 +3,11 @@ static bool success_(OSStatus stat, const char *func, const char *call) { if (stat != noErr) { - blog(LOG_WARNING, "%s: %s failed: %d", - func, call, (int)stat); + blog(LOG_WARNING, "%s: %s failed: %d", func, call, (int)stat); return false; } return true; } -#define success(stat, call) \ - success_(stat, __FUNCTION__, call) +#define success(stat, call) success_(stat, __FUNCTION__, call)
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/pulse/pulseaudio-enum-devices.c -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/pulse/pulseaudio-enum-devices.c
Changed
@@ -2,13 +2,13 @@ #include "pulseaudio-wrapper.h" static void pulseaudio_output_info(pa_context *c, const pa_source_info *i, - int eol, void *userdata) + int eol, void *userdata) { UNUSED_PARAMETER(c); if (eol != 0 || i->monitor_of_sink == PA_INVALID_INDEX) goto skip; - struct enum_cb *ecb = (struct enum_cb *) userdata; + struct enum_cb *ecb = (struct enum_cb *)userdata; if (ecb->cont) ecb->cont = ecb->cb(ecb->data, i->description, i->name); @@ -16,8 +16,7 @@ pulseaudio_signal(0); } -void obs_enum_audio_monitoring_devices(obs_enum_audio_device_cb cb, - void *data) +void obs_enum_audio_monitoring_devices(obs_enum_audio_device_cb cb, void *data) { struct enum_cb *ecb = bzalloc(sizeof(struct enum_cb)); ecb->cb = cb; @@ -26,7 +25,7 @@ pulseaudio_init(); pa_source_info_cb_t pa_cb = pulseaudio_output_info; - pulseaudio_get_source_info_list(pa_cb, (void *) ecb); + pulseaudio_get_source_info_list(pa_cb, (void *)ecb); pulseaudio_unref(); bfree(ecb);
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/pulse/pulseaudio-output.c -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/pulse/pulseaudio-output.c
Changed
@@ -5,47 +5,56 @@ #define blog(level, msg, ...) blog(level, "pulse-am: " msg, ##__VA_ARGS__) struct audio_monitor { - obs_source_t *source; - pa_stream *stream; - char *device; - pa_buffer_attr attr; - enum speaker_layout speakers; - pa_sample_format_t format; - uint_fast32_t samples_per_sec; - uint_fast32_t bytes_per_frame; - uint_fast8_t channels; - - uint_fast32_t packets; - uint_fast64_t frames; - - struct circlebuf new_data; - audio_resampler_t *resampler; - size_t buffer_size; - size_t bytesRemaining; - size_t bytes_per_channel; - - bool ignore; - pthread_mutex_t playback_mutex; + obs_source_t *source; + pa_stream *stream; + char *device; + pa_buffer_attr attr; + enum speaker_layout speakers; + pa_sample_format_t format; + uint_fast32_t samples_per_sec; + uint_fast32_t bytes_per_frame; + uint_fast8_t channels; + + uint_fast32_t packets; + uint_fast64_t frames; + + struct circlebuf new_data; + audio_resampler_t *resampler; + size_t buffer_size; + size_t bytesRemaining; + size_t bytes_per_channel; + + bool ignore; + pthread_mutex_t playback_mutex; }; -static enum speaker_layout pulseaudio_channels_to_obs_speakers( - uint_fast32_t channels) +static enum speaker_layout +pulseaudio_channels_to_obs_speakers(uint_fast32_t channels) { switch (channels) { - case 0: return SPEAKERS_UNKNOWN; - case 1: return SPEAKERS_MONO; - case 2: return SPEAKERS_STEREO; - case 3: return SPEAKERS_2POINT1; - case 4: return SPEAKERS_4POINT0; - case 5: return SPEAKERS_4POINT1; - case 6: return SPEAKERS_5POINT1; - case 8: return SPEAKERS_7POINT1; - default: return SPEAKERS_UNKNOWN; + case 0: + return SPEAKERS_UNKNOWN; + case 1: + return SPEAKERS_MONO; + case 2: + return SPEAKERS_STEREO; + case 3: + return SPEAKERS_2POINT1; + case 4: + return SPEAKERS_4POINT0; + case 5: + return SPEAKERS_4POINT1; + case 6: + return SPEAKERS_5POINT1; + case 8: + return SPEAKERS_7POINT1; + default: + return SPEAKERS_UNKNOWN; } } -static enum audio_format pulseaudio_to_obs_audio_format( - pa_sample_format_t format) +static enum audio_format +pulseaudio_to_obs_audio_format(pa_sample_format_t format) { switch (format) { case PA_SAMPLE_U8: @@ -118,7 +127,7 @@ static void process_byte(void *p, size_t frames, size_t channels, float vol) { - register char *cur = (char *) p; + register char *cur = (char *)p; register char *end = cur + frames * channels; while (cur < end) @@ -127,7 +136,7 @@ static void process_short(void *p, size_t frames, size_t channels, float vol) { - register short *cur = (short *) p; + register short *cur = (short *)p; register short *end = cur + frames * channels; while (cur < end) @@ -136,7 +145,7 @@ static void process_float(void *p, size_t frames, size_t channels, float vol) { - register float *cur = (float *) p; + register float *cur = (float *)p; register float *end = cur + frames * channels; while (cur < end) @@ -144,20 +153,20 @@ } void process_volume(const struct audio_monitor *monitor, float vol, - uint8_t *const *resample_data, uint32_t resample_frames) + uint8_t *const *resample_data, uint32_t resample_frames) { switch (monitor->bytes_per_channel) { case 1: process_byte(resample_data[0], resample_frames, - monitor->channels, vol); + monitor->channels, vol); break; case 2: process_short(resample_data[0], resample_frames, - monitor->channels, vol); + monitor->channels, vol); break; default: process_float(resample_data[0], resample_frames, - monitor->channels, vol); + monitor->channels, vol); break; } } @@ -168,20 +177,20 @@ uint8_t *buffer = NULL; while (data->new_data.size >= data->buffer_size && - data->bytesRemaining > 0) { + data->bytesRemaining > 0) { size_t bytesToFill = data->buffer_size; if (bytesToFill > data->bytesRemaining) bytesToFill = data->bytesRemaining; - pa_stream_begin_write(data->stream, (void **) &buffer, - &bytesToFill); + pa_stream_begin_write(data->stream, (void **)&buffer, + &bytesToFill); circlebuf_pop_front(&data->new_data, buffer, bytesToFill); pulseaudio_lock(); - pa_stream_write(data->stream, buffer, bytesToFill, NULL, - 0LL, PA_SEEK_RELATIVE); + pa_stream_write(data->stream, buffer, bytesToFill, NULL, 0LL, + PA_SEEK_RELATIVE); pulseaudio_unlock(); data->bytesRemaining -= bytesToFill; @@ -189,7 +198,7 @@ } static void on_audio_playback(void *param, obs_source_t *source, - const struct audio_data *audio_data, bool muted) + const struct audio_data *audio_data, bool muted) { struct audio_monitor *monitor = param; float vol = source->user_volume; @@ -206,10 +215,10 @@ if (os_atomic_load_long(&source->activate_refs) == 0) goto unlock; - success = audio_resampler_resample(monitor->resampler, resample_data, - &resample_frames, &ts_offset, - (const uint8_t *const *) audio_data->data, - (uint32_t) audio_data->frames); + success = audio_resampler_resample( + monitor->resampler, resample_data, &resample_frames, &ts_offset, + (const uint8_t *const *)audio_data->data, + (uint32_t)audio_data->frames); if (!success) goto unlock; @@ -221,7 +230,7 @@ } else { if (!close_float(vol, 1.0f, EPSILON)) { process_volume(monitor, vol, resample_data, - resample_frames); + resample_frames); } } @@ -262,19 +271,19 @@ } static void pulseaudio_server_info(pa_context *c, const pa_server_info *i, - void *userdata) + void *userdata) { UNUSED_PARAMETER(c); UNUSED_PARAMETER(userdata); blog(LOG_INFO, "Server name: '%s %s'", i->server_name, - i->server_version); + i->server_version); pulseaudio_signal(0); } static void pulseaudio_source_info(pa_context *c, const pa_source_info *i, - int eol, void *userdata) + int eol, void *userdata) { UNUSED_PARAMETER(c); PULSE_DATA(userdata); @@ -287,29 +296,29 @@ if (eol > 0) goto skip; - blog(LOG_INFO, "Audio format: %s, %"PRIu32" Hz, %"PRIu8" channels", - pa_sample_format_to_string(i->sample_spec.format), - i->sample_spec.rate, i->sample_spec.channels); + blog(LOG_INFO, "Audio format: %s, %" PRIu32 " Hz, %" PRIu8 " channels", + pa_sample_format_to_string(i->sample_spec.format), + i->sample_spec.rate, i->sample_spec.channels); pa_sample_format_t format = i->sample_spec.format; if (pulseaudio_to_obs_audio_format(format) == AUDIO_FORMAT_UNKNOWN) { format = PA_SAMPLE_FLOAT32LE; - blog(LOG_INFO, "Sample format %s not supported by OBS," - "using %s instead for recording", - pa_sample_format_to_string( - i->sample_spec.format), - pa_sample_format_to_string(format)); + blog(LOG_INFO, + "Sample format %s not supported by OBS," + "using %s instead for recording", + pa_sample_format_to_string(i->sample_spec.format), + pa_sample_format_to_string(format)); } uint8_t channels = i->sample_spec.channels; if (pulseaudio_channels_to_obs_speakers(channels) == SPEAKERS_UNKNOWN) { channels = 2; - blog(LOG_INFO, "%c channels not supported by OBS," - "using %c instead for recording", - i->sample_spec.channels, - channels); + blog(LOG_INFO, + "%c channels not supported by OBS," + "using %c instead for recording", + i->sample_spec.channels, channels); } data->format = format; @@ -328,15 +337,16 @@ } blog(LOG_INFO, "Stopped Monitoring in '%s'", monitor->device); - blog(LOG_INFO, "Got %"PRIuFAST32" packets with %"PRIuFAST64" frames", - monitor->packets, monitor->frames); + blog(LOG_INFO, + "Got %" PRIuFAST32 " packets with %" PRIuFAST64 " frames", + monitor->packets, monitor->frames); monitor->packets = 0; monitor->frames = 0; } static bool audio_monitor_init(struct audio_monitor *monitor, - obs_source_t *source) + obs_source_t *source) { pthread_mutex_init_value(&monitor->playback_mutex); @@ -355,7 +365,7 @@ if (match) { monitor->ignore = true; blog(LOG_INFO, "Prevented feedback-loop in '%s'", - s_dev_id); + s_dev_id); return true; } } @@ -371,25 +381,25 @@ return false; if (pulseaudio_get_server_info(pulseaudio_server_info, - (void *) monitor) < 0) { + (void *)monitor) < 0) { blog(LOG_ERROR, "Unable to get server info !"); return false; } if (pulseaudio_get_source_info(pulseaudio_source_info, monitor->device, - (void *) monitor) < 0) { + (void *)monitor) < 0) { blog(LOG_ERROR, "Unable to get source info !"); return false; } if (monitor->format == PA_SAMPLE_INVALID) { blog(LOG_ERROR, - "An error occurred while getting the source info!"); + "An error occurred while getting the source info!"); return false; } pa_sample_spec spec; spec.format = monitor->format; - spec.rate = (uint32_t) monitor->samples_per_sec; + spec.rate = (uint32_t)monitor->samples_per_sec; spec.channels = monitor->channels; if (!pa_sample_spec_valid(&spec)) { @@ -397,31 +407,27 @@ return false; } - const struct audio_output_info *info = audio_output_get_info( - obs->audio.audio); + const struct audio_output_info *info = + audio_output_get_info(obs->audio.audio); - struct resample_info from = { - .samples_per_sec = info->samples_per_sec, - .speakers = info->speakers, - .format = AUDIO_FORMAT_FLOAT_PLANAR - }; + struct resample_info from = {.samples_per_sec = info->samples_per_sec, + .speakers = info->speakers, + .format = AUDIO_FORMAT_FLOAT_PLANAR}; struct resample_info to = { - .samples_per_sec = (uint32_t) monitor->samples_per_sec, - .speakers = pulseaudio_channels_to_obs_speakers( - monitor->channels), - .format = pulseaudio_to_obs_audio_format - (monitor->format) - }; + .samples_per_sec = (uint32_t)monitor->samples_per_sec, + .speakers = + pulseaudio_channels_to_obs_speakers(monitor->channels), + .format = pulseaudio_to_obs_audio_format(monitor->format)}; monitor->resampler = audio_resampler_create(&to, &from); if (!monitor->resampler) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, - "Failed to create resampler"); + "Failed to create resampler"); return false; } monitor->bytes_per_channel = get_audio_bytes_per_channel( - pulseaudio_to_obs_audio_format(monitor->format)); + pulseaudio_to_obs_audio_format(monitor->format)); monitor->speakers = pulseaudio_channels_to_obs_speakers(spec.channels); monitor->bytes_per_frame = pa_frame_size(&spec); @@ -434,26 +440,26 @@ return false; } - monitor->attr.fragsize = (uint32_t) -1; - monitor->attr.maxlength = (uint32_t) -1; - monitor->attr.minreq = (uint32_t) -1; - monitor->attr.prebuf = (uint32_t) -1; + monitor->attr.fragsize = (uint32_t)-1; + monitor->attr.maxlength = (uint32_t)-1; + monitor->attr.minreq = (uint32_t)-1; + monitor->attr.prebuf = (uint32_t)-1; monitor->attr.tlength = pa_usec_to_bytes(25000, &spec); - monitor->buffer_size = monitor->bytes_per_frame * - pa_usec_to_bytes(5000, &spec); + monitor->buffer_size = + monitor->bytes_per_frame * pa_usec_to_bytes(5000, &spec); pa_stream_flags_t flags = PA_STREAM_INTERPOLATE_TIMING | - PA_STREAM_AUTO_TIMING_UPDATE; + PA_STREAM_AUTO_TIMING_UPDATE; if (pthread_mutex_init(&monitor->playback_mutex, NULL) != 0) { blog(LOG_WARNING, "%s: %s", __FUNCTION__, - "Failed to init mutex"); + "Failed to init mutex"); return false; } - int_fast32_t ret = pulseaudio_connect_playback(monitor->stream, - monitor->device, &monitor->attr, flags); + int_fast32_t ret = pulseaudio_connect_playback( + monitor->stream, monitor->device, &monitor->attr, flags); if (ret < 0) { pulseaudio_stop_playback(monitor); blog(LOG_ERROR, "Unable to connect to stream"); @@ -470,13 +476,13 @@ return; obs_source_add_audio_capture_callback(monitor->source, - on_audio_playback, monitor); + on_audio_playback, monitor); pulseaudio_write_callback(monitor->stream, pulseaudio_stream_write, - (void *) monitor); + (void *)monitor); pulseaudio_set_underflow_callback(monitor->stream, pulseaudio_underflow, - (void *) monitor); + (void *)monitor); } static inline void audio_monitor_free(struct audio_monitor *monitor) @@ -485,8 +491,8 @@ return; if (monitor->source) - obs_source_remove_audio_capture_callback(monitor->source, - on_audio_playback, monitor); + obs_source_remove_audio_capture_callback( + monitor->source, on_audio_playback, monitor); audio_resampler_destroy(monitor->resampler); circlebuf_free(&monitor->new_data);
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/pulse/pulseaudio-wrapper.c -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/pulse/pulseaudio-wrapper.c
Changed
@@ -32,11 +32,11 @@ static pa_context *pulseaudio_context = NULL; static void pulseaudio_default_devices(pa_context *c, const pa_server_info *i, - void *userdata) + void *userdata) { UNUSED_PARAMETER(c); struct pulseaudio_default_output *d = - (struct pulseaudio_default_output *) userdata; + (struct pulseaudio_default_output *)userdata; d->default_sink_name = bstrdup(i->default_sink_name); pulseaudio_signal(0); } @@ -44,11 +44,10 @@ void get_default_id(char **id) { pulseaudio_init(); - struct pulseaudio_default_output *pdo = bzalloc( - sizeof(struct pulseaudio_default_output)); + struct pulseaudio_default_output *pdo = + bzalloc(sizeof(struct pulseaudio_default_output)); pulseaudio_get_server_info( - (pa_server_info_cb_t) pulseaudio_default_devices, - (void *) pdo); + (pa_server_info_cb_t)pulseaudio_default_devices, (void *)pdo); *id = bzalloc(strlen(pdo->default_sink_name) + 9); strcat(*id, pdo->default_sink_name); strcat(*id, ".monitor"); @@ -118,14 +117,14 @@ pa_proplist *p = pulseaudio_properties(); pulseaudio_context = pa_context_new_with_proplist( - pa_threaded_mainloop_get_api(pulseaudio_mainloop), - "OBS-Monitor", p); + pa_threaded_mainloop_get_api(pulseaudio_mainloop), + "OBS-Monitor", p); pa_context_set_state_callback(pulseaudio_context, - pulseaudio_context_state_changed, NULL); + pulseaudio_context_state_changed, NULL); pa_context_connect(pulseaudio_context, NULL, PA_CONTEXT_NOAUTOSPAWN, - NULL); + NULL); pa_proplist_free(p); pulseaudio_unlock(); @@ -217,15 +216,15 @@ } int_fast32_t pulseaudio_get_source_info_list(pa_source_info_cb_t cb, - void *userdata) + void *userdata) { if (pulseaudio_context_ready() < 0) return -1; pulseaudio_lock(); - pa_operation *op = pa_context_get_source_info_list( - pulseaudio_context, cb, userdata); + pa_operation *op = pa_context_get_source_info_list(pulseaudio_context, + cb, userdata); if (!op) { pulseaudio_unlock(); return -1; @@ -240,7 +239,7 @@ } int_fast32_t pulseaudio_get_source_info(pa_source_info_cb_t cb, - const char *name, void *userdata) + const char *name, void *userdata) { if (pulseaudio_context_ready() < 0) return -1; @@ -248,7 +247,7 @@ pulseaudio_lock(); pa_operation *op = pa_context_get_source_info_by_name( - pulseaudio_context, name, cb, userdata); + pulseaudio_context, name, cb, userdata); if (!op) { pulseaudio_unlock(); return -1; @@ -269,8 +268,8 @@ pulseaudio_lock(); - pa_operation *op = pa_context_get_server_info( - pulseaudio_context, cb, userdata); + pa_operation *op = + pa_context_get_server_info(pulseaudio_context, cb, userdata); if (!op) { pulseaudio_unlock(); return -1; @@ -284,7 +283,7 @@ } pa_stream *pulseaudio_stream_new(const char *name, const pa_sample_spec *ss, - const pa_channel_map *map) + const pa_channel_map *map) { if (pulseaudio_context_ready() < 0) return NULL; @@ -292,8 +291,8 @@ pulseaudio_lock(); pa_proplist *p = pulseaudio_properties(); - pa_stream *s = pa_stream_new_with_proplist( - pulseaudio_context, name, ss, map, p); + pa_stream *s = pa_stream_new_with_proplist(pulseaudio_context, name, ss, + map, p); pa_proplist_free(p); pulseaudio_unlock(); @@ -301,7 +300,8 @@ } int_fast32_t pulseaudio_connect_playback(pa_stream *s, const char *name, - const pa_buffer_attr *attr, pa_stream_flags_t flags) + const pa_buffer_attr *attr, + pa_stream_flags_t flags) { if (pulseaudio_context_ready() < 0) return -1; @@ -311,8 +311,8 @@ memcpy(device, name, dev_len); pulseaudio_lock(); - int_fast32_t ret = pa_stream_connect_playback(s, device, attr, flags, - NULL, NULL); + int_fast32_t ret = + pa_stream_connect_playback(s, device, attr, flags, NULL, NULL); pulseaudio_unlock(); bfree(device); @@ -320,7 +320,7 @@ } void pulseaudio_write_callback(pa_stream *p, pa_stream_request_cb_t cb, - void *userdata) + void *userdata) { if (pulseaudio_context_ready() < 0) return; @@ -331,7 +331,7 @@ } void pulseaudio_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, - void *userdata) + void *userdata) { if (pulseaudio_context_ready() < 0) return;
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/pulse/pulseaudio-wrapper.h -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/pulse/pulseaudio-wrapper.h
Changed
@@ -107,7 +107,7 @@ * @warning call without active locks */ int_fast32_t pulseaudio_get_source_info_list(pa_source_info_cb_t cb, - void *userdata); + void *userdata); /** * Request source information from a specific source @@ -126,7 +126,7 @@ * @warning call without active locks */ int_fast32_t pulseaudio_get_source_info(pa_source_info_cb_t cb, - const char *name, void *userdata); + const char *name, void *userdata); /** * Request server information @@ -150,7 +150,7 @@ * @warning call without active locks */ pa_stream *pulseaudio_stream_new(const char *name, const pa_sample_spec *ss, - const pa_channel_map *map); + const pa_channel_map *map); /** * Connect to a pulseaudio playback stream @@ -162,7 +162,8 @@ * @return negative on error */ int_fast32_t pulseaudio_connect_playback(pa_stream *s, const char *name, - const pa_buffer_attr *attr, pa_stream_flags_t flags); + const pa_buffer_attr *attr, + pa_stream_flags_t flags); /** * Sets a callback function for when data can be written to the stream @@ -172,7 +173,7 @@ * @param userdata pointer to userdata the callback will be called with */ void pulseaudio_write_callback(pa_stream *p, pa_stream_request_cb_t cb, - void *userdata); + void *userdata); /** * Sets a callback function for when an underflow happen @@ -182,4 +183,4 @@ * @param userdata pointer to userdata the callback will be called with */ void pulseaudio_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, - void *userdata); + void *userdata);
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/win32/wasapi-enum-devices.c -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/win32/wasapi-enum-devices.c
Changed
@@ -10,10 +10,22 @@ #undef DEFINE_PROPERTYKEY #endif #define DEFINE_PROPERTYKEY(id, a, b, c, d, e, f, g, h, i, j, k, l) \ - const PROPERTYKEY id = { { a,b,c, { d,e,f,g,h,i,j,k, } }, l }; -DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, \ - 0xa45c254e, 0xdf1c, 0x4efd, 0x80, \ - 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); + const PROPERTYKEY id = {{a, \ + b, \ + c, \ + { \ + d, \ + e, \ + f, \ + g, \ + h, \ + i, \ + j, \ + k, \ + }}, \ + l}; +DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, + 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); #else @@ -22,7 +34,7 @@ #endif static bool get_device_info(obs_enum_audio_device_cb cb, void *data, - IMMDeviceCollection *collection, UINT idx) + IMMDeviceCollection *collection, UINT idx) { IPropertyStore *store = NULL; IMMDevice *device = NULL; @@ -50,7 +62,7 @@ PropVariantInit(&name_var); hr = store->lpVtbl->GetValue(store, &PKEY_Device_FriendlyName, - &name_var); + &name_var); if (FAILED(hr)) { goto fail; } @@ -68,8 +80,7 @@ return cont; } -void obs_enum_audio_monitoring_devices(obs_enum_audio_device_cb cb, - void *data) +void obs_enum_audio_monitoring_devices(obs_enum_audio_device_cb cb, void *data) { IMMDeviceEnumerator *enumerator = NULL; IMMDeviceCollection *collection = NULL; @@ -77,13 +88,13 @@ HRESULT hr; hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, - &IID_IMMDeviceEnumerator, &enumerator); + &IID_IMMDeviceEnumerator, &enumerator); if (FAILED(hr)) { goto fail; } - hr = enumerator->lpVtbl->EnumAudioEndpoints(enumerator, eRender, - DEVICE_STATE_ACTIVE, &collection); + hr = enumerator->lpVtbl->EnumAudioEndpoints( + enumerator, eRender, DEVICE_STATE_ACTIVE, &collection); if (FAILED(hr)) { goto fail; } @@ -115,13 +126,13 @@ return; hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, - &IID_IMMDeviceEnumerator, &immde); + &IID_IMMDeviceEnumerator, &immde); if (FAILED(hr)) { goto fail; } - hr = immde->lpVtbl->GetDefaultAudioEndpoint(immde, - eRender, eConsole, &device); + hr = immde->lpVtbl->GetDefaultAudioEndpoint(immde, eRender, eConsole, + &device); if (FAILED(hr)) { goto fail; }
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/win32/wasapi-output.c -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/win32/wasapi-output.c
Changed
@@ -7,49 +7,45 @@ #include "wasapi-output.h" #define ACTUALLY_DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - EXTERN_C const GUID DECLSPEC_SELECTANY name \ - = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } - -ACTUALLY_DEFINE_GUID(CLSID_MMDeviceEnumerator, - 0xBCDE0395, 0xE52F, 0x467C, - 0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E); -ACTUALLY_DEFINE_GUID(IID_IMMDeviceEnumerator, - 0xA95664D2, 0x9614, 0x4F35, - 0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6); -ACTUALLY_DEFINE_GUID(IID_IAudioClient, - 0x1CB9AD4C, 0xDBFA, 0x4C32, - 0xB1, 0x78, 0xC2, 0xF5, 0x68, 0xA7, 0x03, 0xB2); -ACTUALLY_DEFINE_GUID(IID_IAudioRenderClient, - 0xF294ACFC, 0x3146, 0x4483, - 0xA7, 0xBF, 0xAD, 0xDC, 0xA7, 0xC2, 0x60, 0xE2); + EXTERN_C const GUID DECLSPEC_SELECTANY name = { \ + l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}} + +ACTUALLY_DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, 0x8E, + 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E); +ACTUALLY_DEFINE_GUID(IID_IMMDeviceEnumerator, 0xA95664D2, 0x9614, 0x4F35, 0xA7, + 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6); +ACTUALLY_DEFINE_GUID(IID_IAudioClient, 0x1CB9AD4C, 0xDBFA, 0x4C32, 0xB1, 0x78, + 0xC2, 0xF5, 0x68, 0xA7, 0x03, 0xB2); +ACTUALLY_DEFINE_GUID(IID_IAudioRenderClient, 0xF294ACFC, 0x3146, 0x4483, 0xA7, + 0xBF, 0xAD, 0xDC, 0xA7, 0xC2, 0x60, 0xE2); struct audio_monitor { - obs_source_t *source; - IMMDevice *device; - IAudioClient *client; + obs_source_t *source; + IMMDevice *device; + IAudioClient *client; IAudioRenderClient *render; - uint64_t last_recv_time; - uint64_t prev_video_ts; - uint64_t time_since_prev; - audio_resampler_t *resampler; - uint32_t sample_rate; - uint32_t channels; - bool source_has_video; - bool ignore; - - int64_t lowest_audio_offset; - struct circlebuf delay_buffer; - uint32_t delay_size; - - DARRAY(float) buf; - pthread_mutex_t playback_mutex; + uint64_t last_recv_time; + uint64_t prev_video_ts; + uint64_t time_since_prev; + audio_resampler_t *resampler; + uint32_t sample_rate; + uint32_t channels; + bool source_has_video; + bool ignore; + + int64_t lowest_audio_offset; + struct circlebuf delay_buffer; + uint32_t delay_size; + + DARRAY(float) buf; + pthread_mutex_t playback_mutex; }; /* #define DEBUG_AUDIO */ -static bool process_audio_delay(struct audio_monitor *monitor, - float **data, uint32_t *frames, uint64_t ts, uint32_t pad) +static bool process_audio_delay(struct audio_monitor *monitor, float **data, + uint32_t *frames, uint64_t ts, uint32_t pad) { obs_source_t *s = monitor->source; uint64_t last_frame_ts = s->last_frame_ts; @@ -68,15 +64,14 @@ circlebuf_push_back(&monitor->delay_buffer, &ts, sizeof(ts)); circlebuf_push_back(&monitor->delay_buffer, frames, sizeof(*frames)); - circlebuf_push_back(&monitor->delay_buffer, *data, - *frames * blocksize); + circlebuf_push_back(&monitor->delay_buffer, *data, *frames * blocksize); if (!monitor->prev_video_ts) { monitor->prev_video_ts = last_frame_ts; } else if (monitor->prev_video_ts == last_frame_ts) { - monitor->time_since_prev += (uint64_t)*frames * - 1000000000ULL / (uint64_t)monitor->sample_rate; + monitor->time_since_prev += (uint64_t)*frames * 1000000000ULL / + (uint64_t)monitor->sample_rate; } else { monitor->time_since_prev = 0; } @@ -86,44 +81,45 @@ bool bad_diff; circlebuf_peek_front(&monitor->delay_buffer, &cur_ts, - sizeof(ts)); - front_ts = cur_ts - - ((uint64_t)pad * 1000000000ULL / - (uint64_t)monitor->sample_rate); + sizeof(ts)); + front_ts = cur_ts - ((uint64_t)pad * 1000000000ULL / + (uint64_t)monitor->sample_rate); diff = (int64_t)front_ts - (int64_t)last_frame_ts; - bad_diff = !last_frame_ts || - llabs(diff) > 5000000000 || - monitor->time_since_prev > 100000000ULL; + bad_diff = !last_frame_ts || llabs(diff) > 5000000000 || + monitor->time_since_prev > 100000000ULL; /* delay audio if rushing */ if (!bad_diff && diff > 75000000) { #ifdef DEBUG_AUDIO - blog(LOG_INFO, "audio rushing, cutting audio, " - "diff: %lld, delay buffer size: %lu, " - "v: %llu: a: %llu", - diff, (int)monitor->delay_buffer.size, - last_frame_ts, front_ts); + blog(LOG_INFO, + "audio rushing, cutting audio, " + "diff: %lld, delay buffer size: %lu, " + "v: %llu: a: %llu", + diff, (int)monitor->delay_buffer.size, + last_frame_ts, front_ts); #endif return false; } circlebuf_pop_front(&monitor->delay_buffer, NULL, sizeof(ts)); circlebuf_pop_front(&monitor->delay_buffer, frames, - sizeof(*frames)); + sizeof(*frames)); size = *frames * blocksize; da_resize(monitor->buf, size); - circlebuf_pop_front(&monitor->delay_buffer, - monitor->buf.array, size); + circlebuf_pop_front(&monitor->delay_buffer, monitor->buf.array, + size); /* cut audio if dragging */ - if (!bad_diff && diff < -75000000 && monitor->delay_buffer.size > 0) { + if (!bad_diff && diff < -75000000 && + monitor->delay_buffer.size > 0) { #ifdef DEBUG_AUDIO - blog(LOG_INFO, "audio dragging, cutting audio, " - "diff: %lld, delay buffer size: %lu, " - "v: %llu: a: %llu", - diff, (int)monitor->delay_buffer.size, - last_frame_ts, front_ts); + blog(LOG_INFO, + "audio dragging, cutting audio, " + "diff: %lld, delay buffer size: %lu, " + "v: %llu: a: %llu", + diff, (int)monitor->delay_buffer.size, + last_frame_ts, front_ts); #endif continue; } @@ -136,7 +132,7 @@ } static void on_audio_playback(void *param, obs_source_t *source, - const struct audio_data *audio_data, bool muted) + const struct audio_data *audio_data, bool muted) { struct audio_monitor *monitor = param; IAudioRenderClient *render = monitor->render; @@ -154,10 +150,10 @@ goto unlock; } - success = audio_resampler_resample(monitor->resampler, resample_data, - &resample_frames, &ts_offset, - (const uint8_t *const *)audio_data->data, - (uint32_t)audio_data->frames); + success = audio_resampler_resample( + monitor->resampler, resample_data, &resample_frames, &ts_offset, + (const uint8_t *const *)audio_data->data, + (uint32_t)audio_data->frames); if (!success) { goto unlock; } @@ -165,20 +161,20 @@ UINT32 pad = 0; monitor->client->lpVtbl->GetCurrentPadding(monitor->client, &pad); - bool decouple_audio = - source->async_unbuffered && source->async_decoupled; + bool decouple_audio = source->async_unbuffered && + source->async_decoupled; if (monitor->source_has_video && !decouple_audio) { uint64_t ts = audio_data->timestamp - ts_offset; - if (!process_audio_delay(monitor, (float**)(&resample_data[0]), - &resample_frames, ts, pad)) { + if (!process_audio_delay(monitor, (float **)(&resample_data[0]), + &resample_frames, ts, pad)) { goto unlock; } } - HRESULT hr = render->lpVtbl->GetBuffer(render, resample_frames, - &output); + HRESULT hr = + render->lpVtbl->GetBuffer(render, resample_frames, &output); if (FAILED(hr)) { goto unlock; } @@ -186,20 +182,19 @@ if (!muted) { /* apply volume */ if (!close_float(vol, 1.0f, EPSILON)) { - register float *cur = (float*)resample_data[0]; - register float *end = cur + - resample_frames * monitor->channels; + register float *cur = (float *)resample_data[0]; + register float *end = + cur + resample_frames * monitor->channels; while (cur < end) *(cur++) *= vol; } memcpy(output, resample_data[0], - resample_frames * monitor->channels * - sizeof(float)); + resample_frames * monitor->channels * sizeof(float)); } render->lpVtbl->ReleaseBuffer(render, resample_frames, - muted ? AUDCLNT_BUFFERFLAGS_SILENT : 0); + muted ? AUDCLNT_BUFFERFLAGS_SILENT : 0); unlock: pthread_mutex_unlock(&monitor->playback_mutex); @@ -212,7 +207,7 @@ if (monitor->source) { obs_source_remove_audio_capture_callback( - monitor->source, on_audio_playback, monitor); + monitor->source, on_audio_playback, monitor); } if (monitor->client) @@ -229,11 +224,16 @@ static enum speaker_layout convert_speaker_layout(DWORD layout, WORD channels) { switch (layout) { - case KSAUDIO_SPEAKER_2POINT1: return SPEAKERS_2POINT1; - case KSAUDIO_SPEAKER_SURROUND: return SPEAKERS_4POINT0; - case KSAUDIO_SPEAKER_4POINT1: return SPEAKERS_4POINT1; - case KSAUDIO_SPEAKER_5POINT1: return SPEAKERS_5POINT1; - case KSAUDIO_SPEAKER_7POINT1: return SPEAKERS_7POINT1; + case KSAUDIO_SPEAKER_2POINT1: + return SPEAKERS_2POINT1; + case KSAUDIO_SPEAKER_SURROUND: + return SPEAKERS_4POINT0; + case KSAUDIO_SPEAKER_4POINT1: + return SPEAKERS_4POINT1; + case KSAUDIO_SPEAKER_5POINT1: + return SPEAKERS_5POINT1; + case KSAUDIO_SPEAKER_7POINT1: + return SPEAKERS_7POINT1; } return (enum speaker_layout)channels; @@ -242,7 +242,7 @@ extern bool devices_match(const char *id1, const char *id2); static bool audio_monitor_init(struct audio_monitor *monitor, - obs_source_t *source) + obs_source_t *source) { IMMDeviceEnumerator *immde = NULL; WAVEFORMATEX *wfex = NULL; @@ -275,14 +275,14 @@ * Init device */ hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, - &IID_IMMDeviceEnumerator, (void**)&immde); + &IID_IMMDeviceEnumerator, (void **)&immde); if (FAILED(hr)) { return false; } if (strcmp(id, "default") == 0) { - hr = immde->lpVtbl->GetDefaultAudioEndpoint(immde, - eRender, eConsole, &monitor->device); + hr = immde->lpVtbl->GetDefaultAudioEndpoint( + immde, eRender, eConsole, &monitor->device); } else { wchar_t w_id[512]; os_utf8_to_wcs(id, 0, w_id, 512); @@ -298,8 +298,8 @@ * Init client */ hr = monitor->device->lpVtbl->Activate(monitor->device, - &IID_IAudioClient, CLSCTX_ALL, NULL, - (void**)&monitor->client); + &IID_IAudioClient, CLSCTX_ALL, + NULL, (void **)&monitor->client); if (FAILED(hr)) { goto fail; } @@ -310,8 +310,8 @@ } hr = monitor->client->lpVtbl->Initialize(monitor->client, - AUDCLNT_SHAREMODE_SHARED, 0, - 10000000, 0, wfex, NULL); + AUDCLNT_SHAREMODE_SHARED, 0, + 10000000, 0, wfex, NULL); if (FAILED(hr)) { goto fail; } @@ -319,9 +319,9 @@ /* ------------------------------------------ * * Init resampler */ - const struct audio_output_info *info = audio_output_get_info( - obs->audio.audio); - WAVEFORMATEXTENSIBLE *ext = (WAVEFORMATEXTENSIBLE*)wfex; + const struct audio_output_info *info = + audio_output_get_info(obs->audio.audio); + WAVEFORMATEXTENSIBLE *ext = (WAVEFORMATEXTENSIBLE *)wfex; struct resample_info from; struct resample_info to; @@ -330,8 +330,8 @@ from.format = AUDIO_FORMAT_FLOAT_PLANAR; to.samples_per_sec = (uint32_t)wfex->nSamplesPerSec; - to.speakers = convert_speaker_layout(ext->dwChannelMask, - wfex->nChannels); + to.speakers = + convert_speaker_layout(ext->dwChannelMask, wfex->nChannels); to.format = AUDIO_FORMAT_FLOAT; monitor->sample_rate = (uint32_t)wfex->nSamplesPerSec; @@ -350,7 +350,8 @@ } hr = monitor->client->lpVtbl->GetService(monitor->client, - &IID_IAudioRenderClient, (void**)&monitor->render); + &IID_IAudioRenderClient, + (void **)&monitor->render); if (FAILED(hr)) { goto fail; } @@ -381,7 +382,7 @@ monitor->source_has_video = (monitor->source->info.output_flags & OBS_SOURCE_VIDEO) != 0; obs_source_add_audio_capture_callback(monitor->source, - on_audio_playback, monitor); + on_audio_playback, monitor); } struct audio_monitor *audio_monitor_create(obs_source_t *source)
View file
obs-studio-23.2.1.tar.xz/libobs/audio-monitoring/win32/wasapi-output.h -> obs-studio-24.0.0.tar.xz/libobs/audio-monitoring/win32/wasapi-output.h
Changed
@@ -4,21 +4,21 @@ #include <mmdeviceapi.h> #include <audioclient.h> - #ifndef KSAUDIO_SPEAKER_2POINT1 -#define KSAUDIO_SPEAKER_2POINT1 (KSAUDIO_SPEAKER_STEREO|SPEAKER_LOW_FREQUENCY) +#define KSAUDIO_SPEAKER_2POINT1 (KSAUDIO_SPEAKER_STEREO | SPEAKER_LOW_FREQUENCY) #endif #define KSAUDIO_SPEAKER_SURROUND_AVUTIL \ - (KSAUDIO_SPEAKER_STEREO|SPEAKER_FRONT_CENTER) + (KSAUDIO_SPEAKER_STEREO | SPEAKER_FRONT_CENTER) #ifndef KSAUDIO_SPEAKER_4POINT1 -#define KSAUDIO_SPEAKER_4POINT1 (KSAUDIO_SPEAKER_SURROUND|SPEAKER_LOW_FREQUENCY) +#define KSAUDIO_SPEAKER_4POINT1 \ + (KSAUDIO_SPEAKER_SURROUND | SPEAKER_LOW_FREQUENCY) #endif -#define safe_release(ptr) \ - do { \ - if (ptr) { \ +#define safe_release(ptr) \ + do { \ + if (ptr) { \ ptr->lpVtbl->Release(ptr); \ - } \ + } \ } while (false)
View file
obs-studio-23.2.1.tar.xz/libobs/callback/calldata.c -> obs-studio-24.0.0.tar.xz/libobs/callback/calldata.c
Changed
@@ -65,8 +65,7 @@ return (size != 0) ? str : NULL; } -static bool cd_getparam(const calldata_t *data, const char *name, - uint8_t **pos) +static bool cd_getparam(const calldata_t *data, const char *name, uint8_t **pos) { size_t name_size; @@ -97,7 +96,7 @@ static inline void cd_copy_string(uint8_t **pos, const char *str, size_t len) { if (!len) - len = strlen(str)+1; + len = strlen(str) + 1; memcpy(*pos, &len, sizeof(size_t)); *pos += sizeof(size_t); @@ -117,20 +116,20 @@ } static inline void cd_set_first_param(calldata_t *data, const char *name, - const void *in, size_t size) + const void *in, size_t size) { uint8_t *pos; size_t capacity; - size_t name_len = strlen(name)+1; + size_t name_len = strlen(name) + 1; - capacity = sizeof(size_t)*3 + name_len + size; + capacity = sizeof(size_t) * 3 + name_len + size; data->size = capacity; if (capacity < 128) capacity = 128; data->capacity = capacity; - data->stack = bmalloc(capacity); + data->stack = bmalloc(capacity); pos = data->stack; cd_copy_string(&pos, name, name_len); @@ -139,7 +138,7 @@ } static inline bool cd_ensure_capacity(calldata_t *data, uint8_t **pos, - size_t new_size) + size_t new_size) { size_t offset; size_t new_capacity; @@ -157,7 +156,7 @@ if (new_capacity < new_size) new_capacity = new_size; - data->stack = brealloc(data->stack, new_capacity); + data->stack = brealloc(data->stack, new_capacity); data->capacity = new_capacity; *pos = data->stack + offset; @@ -167,7 +166,7 @@ /* ------------------------------------------------------------------------- */ bool calldata_get_data(const calldata_t *data, const char *name, void *out, - size_t size) + size_t size) { uint8_t *pos; size_t data_size; @@ -187,7 +186,7 @@ } void calldata_set_data(calldata_t *data, const char *name, const void *in, - size_t size) + size_t size) { uint8_t *pos = NULL; @@ -209,22 +208,22 @@ if (!cd_ensure_capacity(data, &pos, bytes + offset)) return; - memmove(pos+offset, pos, bytes - (pos - data->stack)); + memmove(pos + offset, pos, bytes - (pos - data->stack)); data->size += offset; } else if (cur_size > size) { size_t offset = cur_size - size; size_t bytes = data->size - offset; - memmove(pos, pos+offset, bytes - (pos - data->stack)); + memmove(pos, pos + offset, bytes - (pos - data->stack)); data->size -= offset; } cd_copy_data(&pos, in, size); } else { - size_t name_len = strlen(name)+1; - size_t offset = name_len + size + sizeof(size_t)*2; + size_t name_len = strlen(name) + 1; + size_t offset = name_len + size + sizeof(size_t) * 2; if (!cd_ensure_capacity(data, &pos, data->size + offset)) return; data->size += offset; @@ -236,7 +235,7 @@ } bool calldata_get_string(const calldata_t *data, const char *name, - const char **str) + const char **str) { uint8_t *pos; if (!data || !name || !*name)
View file
obs-studio-23.2.1.tar.xz/libobs/callback/calldata.h -> obs-studio-24.0.0.tar.xz/libobs/callback/calldata.h
Changed
@@ -40,14 +40,14 @@ CALL_PARAM_TYPE_STRING }; -#define CALL_PARAM_IN (1<<0) -#define CALL_PARAM_OUT (1<<1) +#define CALL_PARAM_IN (1 << 0) +#define CALL_PARAM_OUT (1 << 1) struct calldata { uint8_t *stack; - size_t size; /* size of the stack, in bytes */ - size_t capacity; /* capacity of the stack, in bytes */ - bool fixed; /* fixed size (using call stack) */ + size_t size; /* size of the stack, in bytes */ + size_t capacity; /* capacity of the stack, in bytes */ + bool fixed; /* fixed size (using call stack) */ }; typedef struct calldata calldata_t; @@ -60,7 +60,7 @@ static inline void calldata_clear(struct calldata *data); static inline void calldata_init_fixed(struct calldata *data, uint8_t *stack, - size_t size) + size_t size) { data->stack = stack; data->capacity = size; @@ -76,9 +76,9 @@ } EXPORT bool calldata_get_data(const calldata_t *data, const char *name, - void *out, size_t size); + void *out, size_t size); EXPORT void calldata_set_data(calldata_t *data, const char *name, - const void *in, size_t new_size); + const void *in, size_t new_size); static inline void calldata_clear(struct calldata *data) { @@ -90,7 +90,7 @@ static inline calldata_t *calldata_create(void) { - return (calldata_t*)bzalloc(sizeof(struct calldata)); + return (calldata_t *)bzalloc(sizeof(struct calldata)); } static inline void calldata_destroy(calldata_t *cd) @@ -104,31 +104,31 @@ * same type. They return false otherwise. */ static inline bool calldata_get_int(const calldata_t *data, const char *name, - long long *val) + long long *val) { return calldata_get_data(data, name, val, sizeof(*val)); } -static inline bool calldata_get_float (const calldata_t *data, const char *name, - double *val) +static inline bool calldata_get_float(const calldata_t *data, const char *name, + double *val) { return calldata_get_data(data, name, val, sizeof(*val)); } -static inline bool calldata_get_bool (const calldata_t *data, const char *name, - bool *val) +static inline bool calldata_get_bool(const calldata_t *data, const char *name, + bool *val) { return calldata_get_data(data, name, val, sizeof(*val)); } -static inline bool calldata_get_ptr (const calldata_t *data, const char *name, - void *p_ptr) +static inline bool calldata_get_ptr(const calldata_t *data, const char *name, + void *p_ptr) { return calldata_get_data(data, name, p_ptr, sizeof(p_ptr)); } EXPORT bool calldata_get_string(const calldata_t *data, const char *name, - const char **str); + const char **str); /* ------------------------------------------------------------------------- */ /* call if you know your data is valid */ @@ -162,7 +162,7 @@ } static inline const char *calldata_string(const calldata_t *data, - const char *name) + const char *name) { const char *val = NULL; calldata_get_string(data, name, &val); @@ -171,35 +171,35 @@ /* ------------------------------------------------------------------------- */ -static inline void calldata_set_int (calldata_t *data, const char *name, - long long val) +static inline void calldata_set_int(calldata_t *data, const char *name, + long long val) { calldata_set_data(data, name, &val, sizeof(val)); } -static inline void calldata_set_float (calldata_t *data, const char *name, - double val) +static inline void calldata_set_float(calldata_t *data, const char *name, + double val) { calldata_set_data(data, name, &val, sizeof(val)); } -static inline void calldata_set_bool (calldata_t *data, const char *name, - bool val) +static inline void calldata_set_bool(calldata_t *data, const char *name, + bool val) { calldata_set_data(data, name, &val, sizeof(val)); } -static inline void calldata_set_ptr (calldata_t *data, const char *name, - void *ptr) +static inline void calldata_set_ptr(calldata_t *data, const char *name, + void *ptr) { calldata_set_data(data, name, &ptr, sizeof(ptr)); } static inline void calldata_set_string(calldata_t *data, const char *name, - const char *str) + const char *str) { if (str) - calldata_set_data(data, name, str, strlen(str)+1); + calldata_set_data(data, name, str, strlen(str) + 1); else calldata_set_data(data, name, NULL, 0); }
View file
obs-studio-23.2.1.tar.xz/libobs/callback/decl.c -> obs-studio-24.0.0.tar.xz/libobs/callback/decl.c
Changed
@@ -18,16 +18,16 @@ #include "decl.h" static inline void err_specifier_exists(struct cf_parser *cfp, - const char *storage) + const char *storage) { - cf_adderror(cfp, "'$1' specifier already exists", LEX_ERROR, - storage, NULL, NULL); + cf_adderror(cfp, "'$1' specifier already exists", LEX_ERROR, storage, + NULL, NULL); } static inline void err_reserved_name(struct cf_parser *cfp, const char *name) { - cf_adderror(cfp, "'$1' is a reserved name", LEX_ERROR, - name, NULL, NULL); + cf_adderror(cfp, "'$1' is a reserved name", LEX_ERROR, name, NULL, + NULL); } static inline void err_existing_name(struct cf_parser *cfp, const char *name) @@ -36,7 +36,7 @@ } static bool is_in_out_specifier(struct cf_parser *cfp, struct strref *name, - uint32_t *type) + uint32_t *type) { if (strref_cmp(name, "in") == 0) { if (*type & CALL_PARAM_IN) @@ -60,7 +60,7 @@ #define TYPE_OR_STORAGE "type or storage specifier" static bool get_type(struct strref *ref, enum call_param_type *type, - bool is_return) + bool is_return) { if (strref_cmp(ref, "int") == 0) *type = CALL_PARAM_TYPE_INT; @@ -82,12 +82,9 @@ static bool is_reserved_name(const char *str) { - return (strcmp(str, "int") == 0) || - (strcmp(str, "float") == 0) || - (strcmp(str, "bool") == 0) || - (strcmp(str, "ptr") == 0) || - (strcmp(str, "string") == 0) || - (strcmp(str, "void") == 0) || + return (strcmp(str, "int") == 0) || (strcmp(str, "float") == 0) || + (strcmp(str, "bool") == 0) || (strcmp(str, "ptr") == 0) || + (strcmp(str, "string") == 0) || (strcmp(str, "void") == 0) || (strcmp(str, "return") == 0); } @@ -105,9 +102,9 @@ static int parse_param(struct cf_parser *cfp, struct decl_info *decl) { - struct strref ref; - int code; - struct decl_param param = {0}; + struct strref ref; + int code; + struct decl_param param = {0}; /* get storage specifiers */ code = cf_next_name_ref(cfp, &ref, TYPE_OR_STORAGE, ","); @@ -180,7 +177,7 @@ if (errors) { blog(LOG_WARNING, "Errors/warnings for '%s':\n\n%s", - decl_string, errors); + decl_string, errors); bfree(errors); } @@ -188,11 +185,11 @@ bool parse_decl_string(struct decl_info *decl, const char *decl_string) { - struct cf_parser cfp; - struct strref ret_type; - struct decl_param ret_param = {0}; - int code; - bool success; + struct cf_parser cfp; + struct strref ret_type; + struct decl_param ret_param = {0}; + int code; + bool success; decl->decl_string = decl_string; ret_param.flags = CALL_PARAM_OUT;
View file
obs-studio-23.2.1.tar.xz/libobs/callback/decl.h -> obs-studio-24.0.0.tar.xz/libobs/callback/decl.h
Changed
@@ -24,9 +24,9 @@ #endif struct decl_param { - char *name; + char *name; enum call_param_type type; - uint32_t flags; + uint32_t flags; }; static inline void decl_param_free(struct decl_param *param) @@ -37,8 +37,8 @@ } struct decl_info { - char *name; - const char *decl_string; + char *name; + const char *decl_string; DARRAY(struct decl_param) params; }; @@ -46,7 +46,7 @@ { if (decl) { for (size_t i = 0; i < decl->params.num; i++) - decl_param_free(decl->params.array+i); + decl_param_free(decl->params.array + i); da_free(decl->params); bfree(decl->name);
View file
obs-studio-23.2.1.tar.xz/libobs/callback/proc.c -> obs-studio-24.0.0.tar.xz/libobs/callback/proc.c
Changed
@@ -20,8 +20,8 @@ #include "proc.h" struct proc_info { - struct decl_info func; - void *data; + struct decl_info func; + void *data; proc_handler_proc_t callback; }; @@ -46,39 +46,41 @@ { if (handler) { for (size_t i = 0; i < handler->procs.num; i++) - proc_info_free(handler->procs.array+i); + proc_info_free(handler->procs.array + i); da_free(handler->procs); bfree(handler); } } void proc_handler_add(proc_handler_t *handler, const char *decl_string, - proc_handler_proc_t proc, void *data) + proc_handler_proc_t proc, void *data) { - if (!handler) return; + if (!handler) + return; struct proc_info pi; memset(&pi, 0, sizeof(struct proc_info)); if (!parse_decl_string(&pi.func, decl_string)) { blog(LOG_ERROR, "Function declaration invalid: %s", - decl_string); + decl_string); return; } pi.callback = proc; - pi.data = data; + pi.data = data; da_push_back(handler->procs, &pi); } bool proc_handler_call(proc_handler_t *handler, const char *name, - calldata_t *params) + calldata_t *params) { - if (!handler) return false; + if (!handler) + return false; for (size_t i = 0; i < handler->procs.num; i++) { - struct proc_info *info = handler->procs.array+i; + struct proc_info *info = handler->procs.array + i; if (strcmp(info->func.name, name) == 0) { info->callback(info->data, params);
View file
obs-studio-23.2.1.tar.xz/libobs/callback/proc.h -> obs-studio-24.0.0.tar.xz/libobs/callback/proc.h
Changed
@@ -34,20 +34,20 @@ struct proc_handler; typedef struct proc_handler proc_handler_t; -typedef void (*proc_handler_proc_t)(void*, calldata_t*); +typedef void (*proc_handler_proc_t)(void *, calldata_t *); EXPORT proc_handler_t *proc_handler_create(void); EXPORT void proc_handler_destroy(proc_handler_t *handler); EXPORT void proc_handler_add(proc_handler_t *handler, const char *decl_string, - proc_handler_proc_t proc, void *data); + proc_handler_proc_t proc, void *data); /** * Calls a function in a procedure handler. Returns false if the named * procedure is not found. */ EXPORT bool proc_handler_call(proc_handler_t *handler, const char *name, - calldata_t *params); + calldata_t *params); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/callback/signal.c -> obs-studio-24.0.0.tar.xz/libobs/callback/signal.c
Changed
@@ -22,18 +22,18 @@ struct signal_callback { signal_callback_t callback; - void *data; - bool remove; - bool keep_ref; + void *data; + bool remove; + bool keep_ref; }; struct signal_info { - struct decl_info func; + struct decl_info func; DARRAY(struct signal_callback) callbacks; - pthread_mutex_t mutex; - bool signalling; + pthread_mutex_t mutex; + bool signalling; - struct signal_info *next; + struct signal_info *next; }; static inline struct signal_info *signal_info_create(struct decl_info *info) @@ -48,8 +48,8 @@ si = bmalloc(sizeof(struct signal_info)); - si->func = *info; - si->next = NULL; + si->func = *info; + si->next = NULL; si->signalling = false; da_init(si->callbacks); @@ -75,10 +75,11 @@ } static inline size_t signal_get_callback_idx(struct signal_info *si, - signal_callback_t callback, void *data) + signal_callback_t callback, + void *data) { for (size_t i = 0; i < si->callbacks.num; i++) { - struct signal_callback *sc = si->callbacks.array+i; + struct signal_callback *sc = si->callbacks.array + i; if (sc->callback == callback && sc->data == data) return i; @@ -89,24 +90,25 @@ struct global_callback_info { global_signal_callback_t callback; - void *data; - long signaling; - bool remove; + void *data; + long signaling; + bool remove; }; struct signal_handler { struct signal_info *first; - pthread_mutex_t mutex; - volatile long refs; + pthread_mutex_t mutex; + volatile long refs; DARRAY(struct global_callback_info) global_callbacks; - pthread_mutex_t global_callbacks_mutex; + pthread_mutex_t global_callbacks_mutex; }; static struct signal_info *getsignal(signal_handler_t *handler, - const char *name, struct signal_info **p_last) + const char *name, + struct signal_info **p_last) { - struct signal_info *signal, *last= NULL; + struct signal_info *signal, *last = NULL; signal = handler->first; while (signal != NULL) { @@ -206,8 +208,9 @@ } static void signal_handler_connect_internal(signal_handler_t *handler, - const char *signal, signal_callback_t callback, void *data, - bool keep_ref) + const char *signal, + signal_callback_t callback, + void *data, bool keep_ref) { struct signal_info *sig, *last; struct signal_callback cb_data = {callback, data, false, keep_ref}; @@ -221,8 +224,10 @@ pthread_mutex_unlock(&handler->mutex); if (!sig) { - blog(LOG_WARNING, "signal_handler_connect: " - "signal '%s' not found", signal); + blog(LOG_WARNING, + "signal_handler_connect: " + "signal '%s' not found", + signal); return; } @@ -241,19 +246,19 @@ } void signal_handler_connect(signal_handler_t *handler, const char *signal, - signal_callback_t callback, void *data) + signal_callback_t callback, void *data) { signal_handler_connect_internal(handler, signal, callback, data, false); } void signal_handler_connect_ref(signal_handler_t *handler, const char *signal, - signal_callback_t callback, void *data) + signal_callback_t callback, void *data) { signal_handler_connect_internal(handler, signal, callback, data, true); } static inline struct signal_info *getsignal_locked(signal_handler_t *handler, - const char *name) + const char *name) { struct signal_info *sig; @@ -268,7 +273,7 @@ } void signal_handler_disconnect(signal_handler_t *handler, const char *signal, - signal_callback_t callback, void *data) + signal_callback_t callback, void *data) { struct signal_info *sig = getsignal_locked(handler, signal); bool keep_ref = false; @@ -308,7 +313,7 @@ } void signal_handler_signal(signal_handler_t *handler, const char *signal, - calldata_t *params) + calldata_t *params) { struct signal_info *sig = getsignal_locked(handler, signal); long remove_refs = 0; @@ -320,7 +325,7 @@ sig->signalling = true; for (size_t i = 0; i < sig->callbacks.num; i++) { - struct signal_callback *cb = sig->callbacks.array+i; + struct signal_callback *cb = sig->callbacks.array + i; if (!cb->remove) { current_signal_cb = cb; cb->callback(cb->data, params); @@ -329,12 +334,12 @@ } for (size_t i = sig->callbacks.num; i > 0; i--) { - struct signal_callback *cb = sig->callbacks.array+i-1; + struct signal_callback *cb = sig->callbacks.array + i - 1; if (cb->remove) { if (cb->keep_ref) remove_refs++; - da_erase(sig->callbacks, i-1); + da_erase(sig->callbacks, i - 1); } } @@ -363,20 +368,21 @@ if (cb->remove && !cb->signaling) da_erase(handler->global_callbacks, i - 1); - } + } } pthread_mutex_unlock(&handler->global_callbacks_mutex); if (remove_refs) { os_atomic_set_long(&handler->refs, - os_atomic_load_long(&handler->refs) - - remove_refs); + os_atomic_load_long(&handler->refs) - + remove_refs); } } void signal_handler_connect_global(signal_handler_t *handler, - global_signal_callback_t callback, void *data) + global_signal_callback_t callback, + void *data) { struct global_callback_info cb_data = {callback, data, 0, false}; size_t idx; @@ -394,7 +400,8 @@ } void signal_handler_disconnect_global(signal_handler_t *handler, - global_signal_callback_t callback, void *data) + global_signal_callback_t callback, + void *data) { struct global_callback_info cb_data = {callback, data, false}; size_t idx;
View file
obs-studio-23.2.1.tar.xz/libobs/callback/signal.h -> obs-studio-24.0.0.tar.xz/libobs/callback/signal.h
Changed
@@ -33,17 +33,17 @@ struct signal_handler; typedef struct signal_handler signal_handler_t; -typedef void (*global_signal_callback_t)(void*, const char*, calldata_t*); -typedef void (*signal_callback_t)(void*, calldata_t*); +typedef void (*global_signal_callback_t)(void *, const char *, calldata_t *); +typedef void (*signal_callback_t)(void *, calldata_t *); EXPORT signal_handler_t *signal_handler_create(void); EXPORT void signal_handler_destroy(signal_handler_t *handler); EXPORT bool signal_handler_add(signal_handler_t *handler, - const char *signal_decl); + const char *signal_decl); static inline bool signal_handler_add_array(signal_handler_t *handler, - const char **signal_decls) + const char **signal_decls) { bool success = true; if (!signal_decls) @@ -57,21 +57,26 @@ } EXPORT void signal_handler_connect(signal_handler_t *handler, - const char *signal, signal_callback_t callback, void *data); + const char *signal, + signal_callback_t callback, void *data); EXPORT void signal_handler_connect_ref(signal_handler_t *handler, - const char *signal, signal_callback_t callback, void *data); + const char *signal, + signal_callback_t callback, void *data); EXPORT void signal_handler_disconnect(signal_handler_t *handler, - const char *signal, signal_callback_t callback, void *data); + const char *signal, + signal_callback_t callback, void *data); EXPORT void signal_handler_connect_global(signal_handler_t *handler, - global_signal_callback_t callback, void *data); + global_signal_callback_t callback, + void *data); EXPORT void signal_handler_disconnect_global(signal_handler_t *handler, - global_signal_callback_t callback, void *data); + global_signal_callback_t callback, + void *data); EXPORT void signal_handler_remove_current(void); EXPORT void signal_handler_signal(signal_handler_t *handler, const char *signal, - calldata_t *params); + calldata_t *params); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/data/area.effect -> obs-studio-24.0.0.tar.xz/libobs/data/area.effect
Changed
@@ -1,13 +1,29 @@ uniform float4x4 ViewProj; +uniform float2 base_dimension; uniform float2 base_dimension_i; uniform texture2d image; -struct VertInOut { +sampler_state textureSampler { + Filter = Linear; + AddressU = Clamp; + AddressV = Clamp; +}; + +struct VertData { float4 pos : POSITION; float2 uv : TEXCOORD0; }; -VertInOut VSDefault(VertInOut vert_in) +struct VertInOut { + float2 uv : TEXCOORD0; + float4 pos : POSITION; +}; + +struct FragData { + float2 uv : TEXCOORD0; +}; + +VertInOut VSDefault(VertData vert_in) { VertInOut vert_out; vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj); @@ -15,50 +31,122 @@ return vert_out; } -float4 PSDrawAreaRGBA(VertInOut vert_in) : TARGET +float4 DrawArea(float2 uv) +{ + float2 uv_delta = float2(ddx(uv.x), ddy(uv.y)); + + // Handle potential OpenGL flip. + if (obs_glsl_compile) + uv_delta.y = abs(uv_delta.y); + + float2 uv_min = uv - 0.5 * uv_delta; + float2 uv_max = uv_min + uv_delta; + + float2 load_index_begin = floor(uv_min * base_dimension); + float2 load_index_end = ceil(uv_max * base_dimension); + + float2 target_dimension = 1.0 / uv_delta; + float2 target_pos = uv * target_dimension; + float2 target_pos_min = target_pos - 0.5; + float2 target_pos_max = target_pos + 0.5; + float2 scale = base_dimension_i * target_dimension; + + float4 total_color = float4(0.0, 0.0, 0.0, 0.0); + + float load_index_y = load_index_begin.y; + do { + float source_y_min = load_index_y * scale.y; + float source_y_max = source_y_min + scale.y; + float y_min = max(source_y_min, target_pos_min.y); + float y_max = min(source_y_max, target_pos_max.y); + float height = y_max - y_min; + + float load_index_x = load_index_begin.x; + do { + float source_x_min = load_index_x * scale.x; + float source_x_max = source_x_min + scale.x; + float x_min = max(source_x_min, target_pos_min.x); + float x_max = min(source_x_max, target_pos_max.x); + float width = x_max - x_min; + float area = width * height; + + float4 color = image.Load(int3(load_index_x, load_index_y, 0)); + total_color += area * color; + + ++load_index_x; + } while (load_index_x < load_index_end.x); + + ++load_index_y; + } while (load_index_y < load_index_end.y); + + return total_color; +} + +float4 PSDrawAreaRGBA(FragData frag_in) : TARGET { - float4 totalcolor = float4(0.0, 0.0, 0.0, 0.0); + return DrawArea(frag_in.uv); +} - float2 uv = vert_in.uv; - float2 uvdelta = float2(ddx(uv.x), ddy(uv.y)); +float4 PSDrawAreaRGBADivide(FragData frag_in) : TARGET +{ + float4 rgba = DrawArea(frag_in.uv); + float alpha = rgba.a; + float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0; + return float4(rgba.rgb * multiplier, alpha); +} + +float4 PSDrawAreaRGBAUpscale(FragData frag_in) : TARGET +{ + float2 uv = frag_in.uv; + float2 uv_delta = float2(ddx(uv.x), ddy(uv.y)); // Handle potential OpenGL flip. - uvdelta.y = abs(uvdelta.y); + if (obs_glsl_compile) + uv_delta.y = abs(uv_delta.y); + + float2 uv_min = uv - 0.5 * uv_delta; + float2 uv_max = uv_min + uv_delta; - float2 uvhalfdelta = 0.5 * uvdelta; - float2 uvmin = uv - uvhalfdelta; - float2 uvmax = uv + uvhalfdelta; + float2 load_index_first = floor(uv_min * base_dimension); + float2 load_index_last = ceil(uv_max * base_dimension) - 1.0; - int2 loadindexmin = int2(uvmin / base_dimension_i); - int2 loadindexmax = int2(uvmax / base_dimension_i); + if (load_index_first.x < load_index_last.x) { + float uv_boundary_x = load_index_last.x * base_dimension_i.x; + uv.x = ((uv.x - uv_boundary_x) / uv_delta.x) * base_dimension_i.x + uv_boundary_x; + } else + uv.x = (load_index_first.x + 0.5) * base_dimension_i.x; + if (load_index_first.y < load_index_last.y) { + float uv_boundary_y = load_index_last.y * base_dimension_i.y; + uv.y = ((uv.y - uv_boundary_y) / uv_delta.y) * base_dimension_i.y + uv_boundary_y; + } else + uv.y = (load_index_first.y + 0.5) * base_dimension_i.y; + + return image.Sample(textureSampler, uv); +} - float2 targetpos = uv / uvdelta; - float2 targetposmin = targetpos - 0.5; - float2 targetposmax = targetpos + 0.5; - float2 scale = base_dimension_i / uvdelta; - for (int loadindexy = loadindexmin.y; loadindexy <= loadindexmax.y; ++loadindexy) +technique Draw +{ + pass { - for (int loadindexx = loadindexmin.x; loadindexx <= loadindexmax.x; ++loadindexx) - { - int2 loadindex = int2(loadindexx, loadindexy); - float2 potentialtargetmin = float2(loadindex) * scale; - float2 potentialtargetmax = potentialtargetmin + scale; - float2 targetmin = max(potentialtargetmin, targetposmin); - float2 targetmax = min(potentialtargetmax, targetposmax); - float area = (targetmax.x - targetmin.x) * (targetmax.y - targetmin.y); - float4 sample = image.Load(int3(loadindex, 0)); - totalcolor += area * sample; - } + vertex_shader = VSDefault(vert_in); + pixel_shader = PSDrawAreaRGBA(frag_in); } +} - return totalcolor; +technique DrawAlphaDivide +{ + pass + { + vertex_shader = VSDefault(vert_in); + pixel_shader = PSDrawAreaRGBADivide(frag_in); + } } -technique Draw +technique DrawUpscale { pass { vertex_shader = VSDefault(vert_in); - pixel_shader = PSDrawAreaRGBA(vert_in); + pixel_shader = PSDrawAreaRGBAUpscale(frag_in); } }
View file
obs-studio-23.2.1.tar.xz/libobs/data/bicubic_scale.effect -> obs-studio-24.0.0.tar.xz/libobs/data/bicubic_scale.effect
Changed
@@ -6,7 +6,7 @@ uniform float4x4 ViewProj; uniform texture2d image; -uniform float4x4 color_matrix; +uniform float2 base_dimension; uniform float2 base_dimension_i; uniform float undistort_factor = 1.0; @@ -21,45 +21,31 @@ float2 uv : TEXCOORD0; }; -VertData VSDefault(VertData v_in) +struct VertOut { + float2 uv : TEXCOORD0; + float4 pos : POSITION; +}; + +struct FragData { + float2 uv : TEXCOORD0; +}; + +VertOut VSDefault(VertData v_in) { - VertData vert_out; + VertOut vert_out; + vert_out.uv = v_in.uv * base_dimension; vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj); - vert_out.uv = v_in.uv; return vert_out; } -float weight(float x) -{ - float ax = abs(x); - - /* Sharper version. May look better in some cases. */ - const float B = 0.0; - const float C = 0.75; - - if (ax < 1.0) - return (pow(x, 2.0) * - ((12.0 - 9.0 * B - 6.0 * C) * ax + - (-18.0 + 12.0 * B + 6.0 * C)) + - (6.0 - 2.0 * B)) - / 6.0; - else if ((ax >= 1.0) && (ax < 2.0)) - return (pow(x, 2.0) * - ((-B - 6.0 * C) * ax + (6.0 * B + 30.0 * C)) + - (-12.0 * B - 48.0 * C) * ax + - (8.0 * B + 24.0 * C)) - / 6.0; - else - return 0.0; -} - float4 weight4(float x) { + /* Sharper version. May look better in some cases. B=0, C=0.75 */ return float4( - weight(x - 2.0), - weight(x - 1.0), - weight(x), - weight(x + 1.0)); + ((-0.75 * x + 1.5) * x - 0.75) * x, + (1.25 * x - 2.25) * x * x + 1.0, + ((-1.25 * x + 1.5) * x + 0.75) * x, + (0.75 * x - 0.75) * x * x); } float AspectUndistortX(float x, float a) @@ -74,83 +60,94 @@ return AspectUndistortX((u - 0.5) * 2.0, undistort_factor) * 0.5 + 0.5; } -float2 pixel_coord(float xpos, float ypos) +float2 undistort_coord(float xpos, float ypos) { return float2(AspectUndistortU(xpos), ypos); } -float4 pixel(float xpos, float ypos, bool undistort) +float4 undistort_pixel(float xpos, float ypos) { - if (undistort) - return image.Sample(textureSampler, pixel_coord(xpos, ypos)); - else - return image.Sample(textureSampler, float2(xpos, ypos)); + return image.Sample(textureSampler, undistort_coord(xpos, ypos)); } -float4 get_line(float ypos, float4 xpos, float4 linetaps, bool undistort) +float4 undistort_line(float4 xpos, float ypos, float4 rowtaps) { - return - pixel(xpos.r, ypos, undistort) * linetaps.r + - pixel(xpos.g, ypos, undistort) * linetaps.g + - pixel(xpos.b, ypos, undistort) * linetaps.b + - pixel(xpos.a, ypos, undistort) * linetaps.a; + return undistort_pixel(xpos.x, ypos) * rowtaps.x + + undistort_pixel(xpos.y, ypos) * rowtaps.y + + undistort_pixel(xpos.z, ypos) * rowtaps.z + + undistort_pixel(xpos.w, ypos) * rowtaps.w; } -float4 DrawBicubic(VertData v_in, bool undistort) +float4 DrawBicubic(FragData f_in, bool undistort) { - float2 stepxy = base_dimension_i; - float2 pos = v_in.uv + stepxy * 0.5; - float2 f = frac(pos / stepxy); - - float4 rowtaps = weight4(1.0 - f.x); - float4 coltaps = weight4(1.0 - f.y); - - /* make sure all taps added together is exactly 1.0, otherwise some - * (very small) distortion can occur */ - rowtaps /= rowtaps.r + rowtaps.g + rowtaps.b + rowtaps.a; - coltaps /= coltaps.r + coltaps.g + coltaps.b + coltaps.a; - - float2 xystart = (-1.5 - f) * stepxy + pos; - float4 xpos = float4( - xystart.x, - xystart.x + stepxy.x, - xystart.x + stepxy.x * 2.0, - xystart.x + stepxy.x * 3.0 - ); - - return - get_line(xystart.y , xpos, rowtaps, undistort) * coltaps.r + - get_line(xystart.y + stepxy.y , xpos, rowtaps, undistort) * coltaps.g + - get_line(xystart.y + stepxy.y * 2.0, xpos, rowtaps, undistort) * coltaps.b + - get_line(xystart.y + stepxy.y * 3.0, xpos, rowtaps, undistort) * coltaps.a; + float2 pos = f_in.uv; + float2 pos1 = floor(pos - 0.5) + 0.5; + float2 f = pos - pos1; + + float4 rowtaps = weight4(f.x); + float4 coltaps = weight4(f.y); + + float2 uv1 = pos1 * base_dimension_i; + float2 uv0 = uv1 - base_dimension_i; + float2 uv2 = uv1 + base_dimension_i; + float2 uv3 = uv2 + base_dimension_i; + + if (undistort) { + float4 xpos = float4(uv0.x, uv1.x, uv2.x, uv3.x); + return undistort_line(xpos, uv0.y, rowtaps) * coltaps.x + + undistort_line(xpos, uv1.y, rowtaps) * coltaps.y + + undistort_line(xpos, uv2.y, rowtaps) * coltaps.z + + undistort_line(xpos, uv3.y, rowtaps) * coltaps.w; + } + + float u_weight_sum = rowtaps.y + rowtaps.z; + float u_middle_offset = rowtaps.z * base_dimension_i.x / u_weight_sum; + float u_middle = uv1.x + u_middle_offset; + + float v_weight_sum = coltaps.y + coltaps.z; + float v_middle_offset = coltaps.z * base_dimension_i.y / v_weight_sum; + float v_middle = uv1.y + v_middle_offset; + + int2 coord_top_left = int2(max(uv0 * base_dimension, 0.5)); + int2 coord_bottom_right = int2(min(uv3 * base_dimension, base_dimension - 0.5)); + + float4 top = image.Load(int3(coord_top_left, 0)) * rowtaps.x; + top += image.Sample(textureSampler, float2(u_middle, uv0.y)) * u_weight_sum; + top += image.Load(int3(coord_bottom_right.x, coord_top_left.y, 0)) * rowtaps.w; + float4 total = top * coltaps.x; + + float4 middle = image.Sample(textureSampler, float2(uv0.x, v_middle)) * rowtaps.x; + middle += image.Sample(textureSampler, float2(u_middle, v_middle)) * u_weight_sum; + middle += image.Sample(textureSampler, float2(uv3.x, v_middle)) * rowtaps.w; + total += middle * v_weight_sum; + + float4 bottom = image.Load(int3(coord_top_left.x, coord_bottom_right.y, 0)) * rowtaps.x; + bottom += image.Sample(textureSampler, float2(u_middle, uv3.y)) * u_weight_sum; + bottom += image.Load(int3(coord_bottom_right, 0)) * rowtaps.w; + total += bottom * coltaps.w; + + return total; } -float4 PSDrawBicubicRGBA(VertData v_in, bool undistort) : TARGET +float4 PSDrawBicubicRGBA(FragData f_in, bool undistort) : TARGET { - return DrawBicubic(v_in, undistort); + return DrawBicubic(f_in, undistort); } -float4 PSDrawBicubicRGBADivide(VertData v_in) : TARGET +float4 PSDrawBicubicRGBADivide(FragData f_in) : TARGET { - float4 rgba = DrawBicubic(v_in, false); + float4 rgba = DrawBicubic(f_in, false); float alpha = rgba.a; float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0; return float4(rgba.rgb * multiplier, alpha); } -float4 PSDrawBicubicMatrix(VertData v_in) : TARGET -{ - float3 rgb = DrawBicubic(v_in, false).rgb; - float3 yuv = mul(float4(saturate(rgb), 1.0), color_matrix).xyz; - return float4(yuv, 1.0); -} - technique Draw { pass { vertex_shader = VSDefault(v_in); - pixel_shader = PSDrawBicubicRGBA(v_in, false); + pixel_shader = PSDrawBicubicRGBA(f_in, false); } } @@ -159,7 +156,7 @@ pass { vertex_shader = VSDefault(v_in); - pixel_shader = PSDrawBicubicRGBADivide(v_in); + pixel_shader = PSDrawBicubicRGBADivide(f_in); } } @@ -168,15 +165,6 @@ pass { vertex_shader = VSDefault(v_in); - pixel_shader = PSDrawBicubicRGBA(v_in, true); - } -} - -technique DrawMatrix -{ - pass - { - vertex_shader = VSDefault(v_in); - pixel_shader = PSDrawBicubicMatrix(v_in); + pixel_shader = PSDrawBicubicRGBA(f_in, true); } }
View file
obs-studio-23.2.1.tar.xz/libobs/data/bilinear_lowres_scale.effect -> obs-studio-24.0.0.tar.xz/libobs/data/bilinear_lowres_scale.effect
Changed
@@ -1,12 +1,10 @@ /* - * bilinear low res scaling, samples 9 pixels of a larger image to scale to a + * bilinear low res scaling, samples 8 pixels of a larger image to scale to a * low resolution image below half size */ uniform float4x4 ViewProj; uniform texture2d image; -uniform float4x4 color_matrix; -uniform float2 base_dimension_i; sampler_state textureSampler { Filter = Linear; @@ -34,19 +32,24 @@ float4 DrawLowresBilinear(VertData v_in) { - float2 stepxy = base_dimension_i; - float4 out_color; + float2 uv = v_in.uv; + float2 stepxy = float2(ddx(uv.x), ddy(uv.y)); + float2 stepxy1 = stepxy * 0.0625; + float2 stepxy3 = stepxy * 0.1875; + float2 stepxy5 = stepxy * 0.3125; + float2 stepxy7 = stepxy * 0.4375; - out_color = pixel(v_in.uv); - out_color += pixel(v_in.uv + float2(-stepxy.x, -stepxy.y)); - out_color += pixel(v_in.uv + float2(-stepxy.x, 0.0)); - out_color += pixel(v_in.uv + float2(-stepxy.x, stepxy.y)); - out_color += pixel(v_in.uv + float2( 0.0, -stepxy.y)); - out_color += pixel(v_in.uv + float2( 0.0, stepxy.y)); - out_color += pixel(v_in.uv + float2( stepxy.x, -stepxy.y)); - out_color += pixel(v_in.uv + float2( stepxy.x, 0.0)); - out_color += pixel(v_in.uv + float2( stepxy.x, stepxy.y)); - return out_color / float4(9.0, 9.0, 9.0, 9.0); + // Simulate Direct3D 8-sample pattern + float4 out_color; + out_color = pixel(uv + float2( stepxy1.x, -stepxy3.y)); + out_color += pixel(uv + float2(-stepxy1.x, stepxy3.y)); + out_color += pixel(uv + float2( stepxy5.x, stepxy1.y)); + out_color += pixel(uv + float2(-stepxy3.x, -stepxy5.y)); + out_color += pixel(uv + float2(-stepxy5.x, stepxy5.y)); + out_color += pixel(uv + float2(-stepxy7.x, -stepxy1.y)); + out_color += pixel(uv + float2( stepxy3.x, stepxy7.y)); + out_color += pixel(uv + float2( stepxy7.x, -stepxy7.y)); + return out_color * 0.125; } float4 PSDrawLowresBilinearRGBA(VertData v_in) : TARGET @@ -62,13 +65,6 @@ return float4(rgba.rgb * multiplier, alpha); } -float4 PSDrawLowresBilinearMatrix(VertData v_in) : TARGET -{ - float3 rgb = DrawLowresBilinear(v_in).rgb; - float3 yuv = mul(float4(saturate(rgb), 1.0), color_matrix).xyz; - return float4(yuv, 1.0); -} - technique Draw { pass @@ -87,12 +83,3 @@ } } -technique DrawMatrix -{ - pass - { - vertex_shader = VSDefault(v_in); - pixel_shader = PSDrawLowresBilinearMatrix(v_in); - } -} -
View file
obs-studio-23.2.1.tar.xz/libobs/data/default.effect -> obs-studio-24.0.0.tar.xz/libobs/data/default.effect
Changed
@@ -1,5 +1,4 @@ uniform float4x4 ViewProj; -uniform float4x4 color_matrix; uniform texture2d image; sampler_state def_sampler { @@ -34,13 +33,6 @@ return float4(rgba.rgb * multiplier, alpha); } -float4 PSDrawMatrix(VertInOut vert_in) : TARGET -{ - float3 rgb = image.Sample(def_sampler, vert_in.uv).rgb; - float3 yuv = mul(float4(rgb, 1.0), color_matrix).xyz; - return float4(yuv, 1.0); -} - technique Draw { pass @@ -58,12 +50,3 @@ pixel_shader = PSDrawAlphaDivide(vert_in); } } - -technique DrawMatrix -{ - pass - { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSDrawMatrix(vert_in); - } -}
View file
obs-studio-23.2.1.tar.xz/libobs/data/format_conversion.effect -> obs-studio-24.0.0.tar.xz/libobs/data/format_conversion.effect
Changed
@@ -15,38 +15,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ -//#define DEBUGGING - -uniform float4x4 ViewProj; - -uniform float u_plane_offset; -uniform float v_plane_offset; - uniform float width; uniform float height; uniform float width_i; -uniform float height_i; uniform float width_d2; uniform float height_d2; -uniform float width_d2_i; -uniform float height_d2_i; -uniform float input_width; -uniform float input_height; -uniform float input_width_i; -uniform float input_height_i; -uniform float input_width_i_d2; -uniform float input_height_i_d2; - -uniform int int_width; -uniform int int_input_width; -uniform int int_u_plane_offset; -uniform int int_v_plane_offset; - -uniform float4x4 color_matrix; +uniform float width_x2_i; + +uniform float4 color_vec0; +uniform float4 color_vec1; +uniform float4 color_vec2; uniform float3 color_range_min = {0.0, 0.0, 0.0}; uniform float3 color_range_max = {1.0, 1.0, 1.0}; uniform texture2d image; +uniform texture2d image1; +uniform texture2d image2; +uniform texture2d image3; sampler_state def_sampler { Filter = Linear; @@ -54,354 +39,385 @@ AddressV = Clamp; }; -struct VertInOut { +struct FragPos { float4 pos : POSITION; - float2 uv : TEXCOORD0; }; -VertInOut VSDefault(VertInOut vert_in) -{ - VertInOut vert_out; - vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj); - vert_out.uv = vert_in.uv; - return vert_out; -} - -/* used to prevent internal GPU precision issues width fmod in particular */ -#define PRECISION_OFFSET 0.2 - -float4 PSNV12(VertInOut vert_in) : TARGET -{ - float v_mul = floor(vert_in.uv.y * input_height); - - float byte_offset = floor((v_mul + vert_in.uv.x) * width) * 4.0; - byte_offset += PRECISION_OFFSET; - - float2 sample_pos[4]; - - if (byte_offset < u_plane_offset) { -#ifdef DEBUGGING - return float4(1.0, 1.0, 1.0, 1.0); -#endif - - float lum_u = floor(fmod(byte_offset, width)) * width_i; - float lum_v = floor(byte_offset * width_i) * height_i; - - /* move to texel centers to sample the 4 pixels properly */ - lum_u += width_i * 0.5; - lum_v += height_i * 0.5; - - sample_pos[0] = float2(lum_u, lum_v); - sample_pos[1] = float2(lum_u += width_i, lum_v); - sample_pos[2] = float2(lum_u += width_i, lum_v); - sample_pos[3] = float2(lum_u + width_i, lum_v); - - float4x4 out_val = float4x4( - image.Sample(def_sampler, sample_pos[0]), - image.Sample(def_sampler, sample_pos[1]), - image.Sample(def_sampler, sample_pos[2]), - image.Sample(def_sampler, sample_pos[3]) - ); +struct VertTexPos { + float2 uv : TEXCOORD0; + float4 pos : POSITION; +}; - return transpose(out_val)[1]; - } else { -#ifdef DEBUGGING - return float4(0.5, 0.2, 0.5, 0.2); -#endif +struct VertPosWide { + float3 pos_wide : TEXCOORD0; + float4 pos : POSITION; +}; - float new_offset = byte_offset - u_plane_offset; +struct VertTexPosWide { + float3 uuv : TEXCOORD0; + float4 pos : POSITION; +}; - float ch_u = floor(fmod(new_offset, width)) * width_i; - float ch_v = floor(new_offset * width_i) * height_d2_i; - float width_i2 = width_i*2.0; +struct FragTex { + float2 uv : TEXCOORD0; +}; - /* move to the borders of each set of 4 pixels to force it - * to do bilinear averaging */ - ch_u += width_i; - ch_v += height_i; +struct FragPosWide { + float3 pos_wide : TEXCOORD0; +}; - sample_pos[0] = float2(ch_u, ch_v); - sample_pos[1] = float2(ch_u + width_i2, ch_v); - - return float4( - image.Sample(def_sampler, sample_pos[0]).rb, - image.Sample(def_sampler, sample_pos[1]).rb - ); - } -} +struct FragTexWide { + float3 uuv : TEXCOORD0; +}; -float PSNV12_Y(VertInOut vert_in) : TARGET +FragPos VSPos(uint id : VERTEXID) { - return image.Sample(def_sampler, vert_in.uv.xy).y; -} + float idHigh = float(id >> 1); + float idLow = float(id & uint(1)); -float2 PSNV12_UV(VertInOut vert_in) : TARGET -{ - return image.Sample(def_sampler, vert_in.uv.xy).xz; + float x = idHigh * 4.0 - 1.0; + float y = idLow * 4.0 - 1.0; + + FragPos vert_out; + vert_out.pos = float4(x, y, 0.0, 1.0); + return vert_out; } -float4 PSPlanar420(VertInOut vert_in) : TARGET +VertTexPosWide VSTexPos_Left(uint id : VERTEXID) { - float v_mul = floor(vert_in.uv.y * input_height); - - float byte_offset = floor((v_mul + vert_in.uv.x) * width) * 4.0; - byte_offset += PRECISION_OFFSET; - - float2 sample_pos[4]; + float idHigh = float(id >> 1); + float idLow = float(id & uint(1)); - if (byte_offset < u_plane_offset) { -#ifdef DEBUGGING - return float4(1.0, 1.0, 1.0, 1.0); -#endif + float x = idHigh * 4.0 - 1.0; + float y = idLow * 4.0 - 1.0; - float lum_u = floor(fmod(byte_offset, width)) * width_i; - float lum_v = floor(byte_offset * width_i) * height_i; + float u_right = idHigh * 2.0; + float u_left = u_right - width_i; + float v = obs_glsl_compile ? (idLow * 2.0) : (1.0 - idLow * 2.0); - /* move to texel centers to sample the 4 pixels properly */ - lum_u += width_i * 0.5; - lum_v += height_i * 0.5; - - sample_pos[0] = float2(lum_u, lum_v); - sample_pos[1] = float2(lum_u += width_i, lum_v); - sample_pos[2] = float2(lum_u += width_i, lum_v); - sample_pos[3] = float2(lum_u + width_i, lum_v); - - } else { -#ifdef DEBUGGING - return ((byte_offset < v_plane_offset) ? - float4(0.5, 0.5, 0.5, 0.5) : - float4(0.2, 0.2, 0.2, 0.2)); -#endif - - float new_offset = byte_offset - - ((byte_offset < v_plane_offset) ? - u_plane_offset : v_plane_offset); + VertTexPosWide vert_out; + vert_out.uuv = float3(u_left, u_right, v); + vert_out.pos = float4(x, y, 0.0, 1.0); + return vert_out; +} - float ch_u = floor(fmod(new_offset, width_d2)) * width_d2_i; - float ch_v = floor(new_offset * width_d2_i) * height_d2_i; - float width_i2 = width_i*2.0; +VertTexPos VSTexPosHalf_Reverse(uint id : VERTEXID) +{ + float idHigh = float(id >> 1); + float idLow = float(id & uint(1)); - /* move to the borders of each set of 4 pixels to force it - * to do bilinear averaging */ - ch_u += width_i; - ch_v += height_i; + float x = idHigh * 4.0 - 1.0; + float y = idLow * 4.0 - 1.0; - /* set up coordinates for next chroma line, in case - * (width / 2) % 4 == 2, i.e. the current set of 4 pixels is split - * between the current and the next chroma line; do note that the next - * chroma line is two source lines below the current source line */ - float ch_u_n = 0. + width_i; - float ch_v_n = ch_v + height_i * 3; + float u = idHigh * 2.0; + float v = obs_glsl_compile ? (idLow * 2.0) : (1.0 - idLow * 2.0); - sample_pos[0] = float2(ch_u, ch_v); - sample_pos[1] = float2(ch_u += width_i2, ch_v); + VertTexPos vert_out; + vert_out.uv = float2(width_d2 * u, height * v); + vert_out.pos = float4(x, y, 0.0, 1.0); + return vert_out; +} - ch_u += width_i2; - // check if ch_u overflowed the current source and chroma line - if (ch_u > 1.0) { - sample_pos[2] = float2(ch_u_n, ch_v_n); - sample_pos[2] = float2(ch_u_n + width_i2, ch_v_n); - } else { - sample_pos[2] = float2(ch_u, ch_v); - sample_pos[3] = float2(ch_u + width_i2, ch_v); - } - } +VertTexPos VSTexPosHalfHalf_Reverse(uint id : VERTEXID) +{ + float idHigh = float(id >> 1); + float idLow = float(id & uint(1)); - float4x4 out_val = float4x4( - image.Sample(def_sampler, sample_pos[0]), - image.Sample(def_sampler, sample_pos[1]), - image.Sample(def_sampler, sample_pos[2]), - image.Sample(def_sampler, sample_pos[3]) - ); + float x = idHigh * 4.0 - 1.0; + float y = idLow * 4.0 - 1.0; - out_val = transpose(out_val); + float u = idHigh * 2.0; + float v = obs_glsl_compile ? (idLow * 2.0) : (1.0 - idLow * 2.0); - if (byte_offset < u_plane_offset) - return out_val[1]; - else if (byte_offset < v_plane_offset) - return out_val[0]; - else - return out_val[2]; + VertTexPos vert_out; + vert_out.uv = float2(width_d2 * u, height_d2 * v); + vert_out.pos = float4(x, y, 0.0, 1.0); + return vert_out; } -float4 PSPlanar444(VertInOut vert_in) : TARGET +VertPosWide VSPosWide_Reverse(uint id : VERTEXID) { - float v_mul = floor(vert_in.uv.y * input_height); - - float byte_offset = floor((v_mul + vert_in.uv.x) * width) * 4.0; - byte_offset += PRECISION_OFFSET; + float idHigh = float(id >> 1); + float idLow = float(id & uint(1)); - float new_byte_offset = byte_offset; + float x = idHigh * 4.0 - 1.0; + float y = idLow * 4.0 - 1.0; - if (byte_offset >= v_plane_offset) - new_byte_offset -= v_plane_offset; - else if (byte_offset >= u_plane_offset) - new_byte_offset -= u_plane_offset; + float u = idHigh * 2.0; + float v = obs_glsl_compile ? (idLow * 2.0) : (1.0 - idLow * 2.0); - float2 sample_pos[4]; + VertPosWide vert_out; + vert_out.pos_wide = float3(float2(width, width_d2) * u, height * v); + vert_out.pos = float4(x, y, 0.0, 1.0); + return vert_out; +} - float u_val = floor(fmod(new_byte_offset, width)) * width_i; - float v_val = floor(new_byte_offset * width_i) * height_i; +float PS_Y(FragPos frag_in) : TARGET +{ + float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb; + float y = dot(color_vec0.xyz, rgb) + color_vec0.w; + return y; +} - /* move to texel centers to sample the 4 pixels properly */ - u_val += width_i * 0.5; - v_val += height_i * 0.5; +float2 PS_UV_Wide(FragTexWide frag_in) : TARGET +{ + float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb; + float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb; + float3 rgb = (rgb_left + rgb_right) * 0.5; + float u = dot(color_vec1.xyz, rgb) + color_vec1.w; + float v = dot(color_vec2.xyz, rgb) + color_vec2.w; + return float2(u, v); +} - sample_pos[0] = float2(u_val, v_val); - sample_pos[1] = float2(u_val += width_i, v_val); - sample_pos[2] = float2(u_val += width_i, v_val); - sample_pos[3] = float2(u_val + width_i, v_val); +float PS_U(FragPos frag_in) : TARGET +{ + float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb; + float u = dot(color_vec1.xyz, rgb) + color_vec1.w; + return u; +} - float4x4 out_val = float4x4( - image.Sample(def_sampler, sample_pos[0]), - image.Sample(def_sampler, sample_pos[1]), - image.Sample(def_sampler, sample_pos[2]), - image.Sample(def_sampler, sample_pos[3]) - ); +float PS_V(FragPos frag_in) : TARGET +{ + float3 rgb = image.Load(int3(frag_in.pos.xy, 0)).rgb; + float v = dot(color_vec2.xyz, rgb) + color_vec2.w; + return v; +} - out_val = transpose(out_val); +float PS_U_Wide(FragTexWide frag_in) : TARGET +{ + float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb; + float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb; + float3 rgb = (rgb_left + rgb_right) * 0.5; + float u = dot(color_vec1.xyz, rgb) + color_vec1.w; + return u; +} - if (byte_offset < u_plane_offset) - return out_val[1]; - else if (byte_offset < v_plane_offset) - return out_val[0]; - else - return out_val[2]; +float PS_V_Wide(FragTexWide frag_in) : TARGET +{ + float3 rgb_left = image.Sample(def_sampler, frag_in.uuv.xz).rgb; + float3 rgb_right = image.Sample(def_sampler, frag_in.uuv.yz).rgb; + float3 rgb = (rgb_left + rgb_right) * 0.5; + float v = dot(color_vec2.xyz, rgb) + color_vec2.w; + return v; } -float GetIntOffsetColor(int offset) +float3 YUV_to_RGB(float3 yuv) { - return image.Load(int3(offset % int_input_width, - offset / int_input_width, - 0)).r; + yuv = clamp(yuv, color_range_min, color_range_max); + float r = dot(color_vec0.xyz, yuv) + color_vec0.w; + float g = dot(color_vec1.xyz, yuv) + color_vec1.w; + float b = dot(color_vec2.xyz, yuv) + color_vec2.w; + return float3(r, g, b); } -float4 PSPacked422_Reverse(VertInOut vert_in, int u_pos, int v_pos, - int y0_pos, int y1_pos) : TARGET +float3 PSUYVY_Reverse(FragTex frag_in) : TARGET { - float y = vert_in.uv.y; - float odd = floor(fmod(width * vert_in.uv.x + PRECISION_OFFSET, 2.0)); - float x = floor(width_d2 * vert_in.uv.x + PRECISION_OFFSET) * - width_d2_i; + float4 y2uv = image.Load(int3(frag_in.uv.xy, 0)); + float2 y01 = y2uv.yw; + float2 cbcr = y2uv.zx; + float leftover = frac(frag_in.uv.x); + float y = (leftover < 0.5) ? y01.x : y01.y; + float3 yuv = float3(y, cbcr); + float3 rgb = YUV_to_RGB(yuv); + return rgb; +} - x += input_width_i_d2; +float3 PSYUY2_Reverse(FragTex frag_in) : TARGET +{ + float4 y2uv = image.Load(int3(frag_in.uv.xy, 0)); + float2 y01 = y2uv.zx; + float2 cbcr = y2uv.yw; + float leftover = frac(frag_in.uv.x); + float y = (leftover < 0.5) ? y01.x : y01.y; + float3 yuv = float3(y, cbcr); + float3 rgb = YUV_to_RGB(yuv); + return rgb; +} - float4 texel = image.Sample(def_sampler, float2(x, y)); - float3 yuv = float3(odd > 0.5 ? texel[y1_pos] : texel[y0_pos], - texel[u_pos], texel[v_pos]); - yuv = clamp(yuv, color_range_min, color_range_max); - return saturate(mul(float4(yuv, 1.0), color_matrix)); +float3 PSYVYU_Reverse(FragTex frag_in) : TARGET +{ + float4 y2uv = image.Load(int3(frag_in.uv.xy, 0)); + float2 y01 = y2uv.zx; + float2 cbcr = y2uv.wy; + float leftover = frac(frag_in.uv.x); + float y = (leftover < 0.5) ? y01.x : y01.y; + float3 yuv = float3(y, cbcr); + float3 rgb = YUV_to_RGB(yuv); + return rgb; } -float4 PSPlanar420_Reverse(VertInOut vert_in) : TARGET +float3 PSPlanar420_Reverse(VertTexPos frag_in) : TARGET { - int x = int(vert_in.uv.x * width + PRECISION_OFFSET); - int y = int(vert_in.uv.y * height + PRECISION_OFFSET); + float y = image.Load(int3(frag_in.pos.xy, 0)).x; + int3 xy0_chroma = int3(frag_in.uv, 0); + float cb = image1.Load(xy0_chroma).x; + float cr = image2.Load(xy0_chroma).x; + float3 yuv = float3(y, cb, cr); + float3 rgb = YUV_to_RGB(yuv); + return rgb; +} - int lum_offset = y * int_width + x; - int chroma_offset = (y / 2) * (int_width / 2) + x / 2; - int chroma1 = int_u_plane_offset + chroma_offset; - int chroma2 = int_v_plane_offset + chroma_offset; +float4 PSPlanar420A_Reverse(VertTexPos frag_in) : TARGET +{ + int3 xy0_luma = int3(frag_in.pos.xy, 0); + float y = image.Load(xy0_luma).x; + int3 xy0_chroma = int3(frag_in.uv, 0); + float cb = image1.Load(xy0_chroma).x; + float cr = image2.Load(xy0_chroma).x; + float alpha = image3.Load(xy0_luma).x; + float3 yuv = float3(y, cb, cr); + float4 rgba = float4(YUV_to_RGB(yuv), alpha); + return rgba; +} - float3 yuv = float3( - GetIntOffsetColor(lum_offset), - GetIntOffsetColor(chroma1), - GetIntOffsetColor(chroma2) - ); - yuv = clamp(yuv, color_range_min, color_range_max); - return saturate(mul(float4(yuv, 1.0), color_matrix)); +float3 PSPlanar422_Reverse(FragPosWide frag_in) : TARGET +{ + float y = image.Load(int3(frag_in.pos_wide.xz, 0)).x; + int3 xy0_chroma = int3(frag_in.pos_wide.yz, 0); + float cb = image1.Load(xy0_chroma).x; + float cr = image2.Load(xy0_chroma).x; + float3 yuv = float3(y, cb, cr); + float3 rgb = YUV_to_RGB(yuv); + return rgb; } -float4 PSPlanar444_Reverse(VertInOut vert_in) : TARGET +float4 PSPlanar422A_Reverse(FragPosWide frag_in) : TARGET { - int x = int(vert_in.uv.x * width + PRECISION_OFFSET); - int y = int(vert_in.uv.y * height + PRECISION_OFFSET); + int3 xy0_luma = int3(frag_in.pos_wide.xz, 0); + float y = image.Load(xy0_luma).x; + int3 xy0_chroma = int3(frag_in.pos_wide.yz, 0); + float cb = image1.Load(xy0_chroma).x; + float cr = image2.Load(xy0_chroma).x; + float alpha = image3.Load(xy0_luma).x; + float3 yuv = float3(y, cb, cr); + float4 rgba = float4(YUV_to_RGB(yuv), alpha); + return rgba; +} - int lum_offset = y * int_width + x; - int chroma_offset = y * int_width + x; - int chroma1 = int_u_plane_offset + chroma_offset; - int chroma2 = int_v_plane_offset + chroma_offset; +float3 PSPlanar444_Reverse(FragPos frag_in) : TARGET +{ + int3 xy0 = int3(frag_in.pos.xy, 0); + float y = image.Load(xy0).x; + float cb = image1.Load(xy0).x; + float cr = image2.Load(xy0).x; + float3 yuv = float3(y, cb, cr); + float3 rgb = YUV_to_RGB(yuv); + return rgb; +} - float3 yuv = float3( - GetIntOffsetColor(lum_offset), - GetIntOffsetColor(chroma1), - GetIntOffsetColor(chroma2) - ); - yuv = clamp(yuv, color_range_min, color_range_max); - return saturate(mul(float4(yuv, 1.0), color_matrix)); +float4 PSPlanar444A_Reverse(FragPos frag_in) : TARGET +{ + int3 xy0 = int3(frag_in.pos.xy, 0); + float y = image.Load(xy0).x; + float cb = image1.Load(xy0).x; + float cr = image2.Load(xy0).x; + float alpha = image3.Load(xy0).x; + float3 yuv = float3(y, cb, cr); + float4 rgba = float4(YUV_to_RGB(yuv), alpha); + return rgba; } -float4 PSNV12_Reverse(VertInOut vert_in) : TARGET +float4 PSAYUV_Reverse(FragPos frag_in) : TARGET { - int x = int(vert_in.uv.x * width + PRECISION_OFFSET); - int y = int(vert_in.uv.y * height + PRECISION_OFFSET); + float4 yuva = image.Load(int3(frag_in.pos.xy, 0)); + float4 rgba = float4(YUV_to_RGB(yuva.xyz), yuva.a); + return rgba; +} - int lum_offset = y * int_width + x; - int chroma_offset = (y / 2) * (int_width / 2) + x / 2; - int chroma = int_u_plane_offset + chroma_offset * 2; +float3 PSNV12_Reverse(VertTexPos frag_in) : TARGET +{ + float y = image.Load(int3(frag_in.pos.xy, 0)).x; + float2 cbcr = image1.Load(int3(frag_in.uv, 0)).xy; + float3 yuv = float3(y, cbcr); + float3 rgb = YUV_to_RGB(yuv); + return rgb; +} - float3 yuv = float3( - GetIntOffsetColor(lum_offset), - GetIntOffsetColor(chroma), - GetIntOffsetColor(chroma + 1) - ); - yuv = clamp(yuv, color_range_min, color_range_max); - return saturate(mul(float4(yuv, 1.0), color_matrix)); +float3 PSY800_Limited(FragPos frag_in) : TARGET +{ + float limited = image.Load(int3(frag_in.pos.xy, 0)).x; + float full = (255.0 / 219.0) * limited - (16.0 / 219.0); + return float3(full, full, full); } -float4 PSY800_Limited(VertInOut vert_in) : TARGET +float3 PSY800_Full(FragPos frag_in) : TARGET { - int x = int(vert_in.uv.x * width + PRECISION_OFFSET); - int y = int(vert_in.uv.y * height + PRECISION_OFFSET); + float3 full = image.Load(int3(frag_in.pos.xy, 0)).xxx; + return full; +} - float limited = image.Load(int3(x, y, 0)).x; - float full = saturate((limited - (16.0 / 255.0)) * (255.0 / 219.0)); - return float4(full, full, full, 1.0); +float4 PSRGB_Limited(FragPos frag_in) : TARGET +{ + float4 rgba = image.Load(int3(frag_in.pos.xy, 0)); + rgba.rgb = (255.0 / 219.0) * rgba.rgb - (16.0 / 219.0); + return rgba; } -float4 PSY800_Full(VertInOut vert_in) : TARGET +float3 PSBGR3_Limited(FragPos frag_in) : TARGET { - int x = int(vert_in.uv.x * width + PRECISION_OFFSET); - int y = int(vert_in.uv.y * height + PRECISION_OFFSET); + float x = frag_in.pos.x * 3.0; + float y = frag_in.pos.y; + float b = image.Load(int3(x - 1.0, y, 0)).x; + float g = image.Load(int3(x, y, 0)).x; + float r = image.Load(int3(x + 1.0, y, 0)).x; + float3 rgb = float3(r, g, b); + rgb = (255.0 / 219.0) * rgb - (16.0 / 219.0); + return rgb; +} - float3 full = image.Load(int3(x, y, 0)).xxx; - return float4(full, 1.0); +float3 PSBGR3_Full(FragPos frag_in) : TARGET +{ + float x = frag_in.pos.x * 3.0; + float y = frag_in.pos.y; + float b = image.Load(int3(x - 1.0, y, 0)).x; + float g = image.Load(int3(x, y, 0)).x; + float r = image.Load(int3(x + 1.0, y, 0)).x; + float3 rgb = float3(r, g, b); + return rgb; } -float4 PSRGB_Limited(VertInOut vert_in) : TARGET +technique Planar_Y { - int x = int(vert_in.uv.x * width + PRECISION_OFFSET); - int y = int(vert_in.uv.y * height + PRECISION_OFFSET); + pass + { + vertex_shader = VSPos(id); + pixel_shader = PS_Y(frag_in); + } +} - float4 rgba = image.Load(int3(x, y, 0)); - rgba.rgb = saturate((rgba.rgb - (16.0 / 255.0)) * (255.0 / 219.0)); - return rgba; +technique Planar_U +{ + pass + { + vertex_shader = VSPos(id); + pixel_shader = PS_U(frag_in); + } } -technique Planar420 +technique Planar_V { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSPlanar420(vert_in); + vertex_shader = VSPos(id); + pixel_shader = PS_V(frag_in); } } -technique Planar444 +technique Planar_U_Left { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSPlanar444(vert_in); + vertex_shader = VSTexPos_Left(id); + pixel_shader = PS_U_Wide(frag_in); } } -technique NV12 +technique Planar_V_Left { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSNV12(vert_in); + vertex_shader = VSTexPos_Left(id); + pixel_shader = PS_V_Wide(frag_in); } } @@ -409,8 +425,8 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSNV12_Y(vert_in); + vertex_shader = VSPos(id); + pixel_shader = PS_Y(frag_in); } } @@ -418,8 +434,8 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSNV12_UV(vert_in); + vertex_shader = VSTexPos_Left(id); + pixel_shader = PS_UV_Wide(frag_in); } } @@ -427,8 +443,8 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSPacked422_Reverse(vert_in, 2, 0, 1, 3); + vertex_shader = VSTexPosHalf_Reverse(id); + pixel_shader = PSUYVY_Reverse(frag_in); } } @@ -436,8 +452,8 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSPacked422_Reverse(vert_in, 1, 3, 2, 0); + vertex_shader = VSTexPosHalf_Reverse(id); + pixel_shader = PSYUY2_Reverse(frag_in); } } @@ -445,8 +461,8 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSPacked422_Reverse(vert_in, 3, 1, 2, 0); + vertex_shader = VSTexPosHalf_Reverse(id); + pixel_shader = PSYVYU_Reverse(frag_in); } } @@ -454,8 +470,35 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSPlanar420_Reverse(vert_in); + vertex_shader = VSTexPosHalfHalf_Reverse(id); + pixel_shader = PSPlanar420_Reverse(frag_in); + } +} + +technique I40A_Reverse +{ + pass + { + vertex_shader = VSTexPosHalfHalf_Reverse(id); + pixel_shader = PSPlanar420A_Reverse(frag_in); + } +} + +technique I422_Reverse +{ + pass + { + vertex_shader = VSPosWide_Reverse(id); + pixel_shader = PSPlanar422_Reverse(frag_in); + } +} + +technique I42A_Reverse +{ + pass + { + vertex_shader = VSPosWide_Reverse(id); + pixel_shader = PSPlanar422A_Reverse(frag_in); } } @@ -463,8 +506,26 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSPlanar444_Reverse(vert_in); + vertex_shader = VSPos(id); + pixel_shader = PSPlanar444_Reverse(frag_in); + } +} + +technique YUVA_Reverse +{ + pass + { + vertex_shader = VSPos(id); + pixel_shader = PSPlanar444A_Reverse(frag_in); + } +} + +technique AYUV_Reverse +{ + pass + { + vertex_shader = VSPos(id); + pixel_shader = PSAYUV_Reverse(frag_in); } } @@ -472,8 +533,8 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSNV12_Reverse(vert_in); + vertex_shader = VSTexPosHalfHalf_Reverse(id); + pixel_shader = PSNV12_Reverse(frag_in); } } @@ -481,8 +542,8 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSY800_Limited(vert_in); + vertex_shader = VSPos(id); + pixel_shader = PSY800_Limited(frag_in); } } @@ -490,8 +551,8 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSY800_Full(vert_in); + vertex_shader = VSPos(id); + pixel_shader = PSY800_Full(frag_in); } } @@ -499,7 +560,25 @@ { pass { - vertex_shader = VSDefault(vert_in); - pixel_shader = PSRGB_Limited(vert_in); + vertex_shader = VSPos(id); + pixel_shader = PSRGB_Limited(frag_in); + } +} + +technique BGR3_Limited +{ + pass + { + vertex_shader = VSPos(id); + pixel_shader = PSBGR3_Limited(frag_in); + } +} + +technique BGR3_Full +{ + pass + { + vertex_shader = VSPos(id); + pixel_shader = PSBGR3_Full(frag_in); } }
View file
obs-studio-23.2.1.tar.xz/libobs/data/lanczos_scale.effect -> obs-studio-24.0.0.tar.xz/libobs/data/lanczos_scale.effect
Changed
@@ -6,7 +6,7 @@ uniform float4x4 ViewProj; uniform texture2d image; -uniform float4x4 color_matrix; +uniform float2 base_dimension; uniform float2 base_dimension_i; uniform float undistort_factor = 1.0; @@ -22,45 +22,46 @@ float2 uv : TEXCOORD0; }; -struct FragData { +struct VertOut { + float2 uv : TEXCOORD0; float4 pos : POSITION; - float2 uv : TEXCOORD0; - float2 scale : TEXCOORD1; }; -FragData VSDefault(VertData v_in) +struct FragData { + float2 uv : TEXCOORD0; +}; + +VertOut VSDefault(VertData v_in) { - FragData vert_out; + VertOut vert_out; + vert_out.uv = v_in.uv * base_dimension; vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj); - vert_out.uv = v_in.uv; - vert_out.scale = min(0.25 + abs(0.75 / mul(float4(1.0 / base_dimension_i.xy, 1.0, 1.0), ViewProj).xy), 1.0); return vert_out; } -float sinc(float x) +float weight(float x) { - const float PIval = 3.1415926535897932384626433832795; - return sin(x * PIval) / (x * PIval); + float x_pi = x * 3.141592654; + return 3.0 * sin(x_pi) * sin(x_pi * (1.0 / 3.0)) / (x_pi * x_pi); } -float weight(float x, float radius) +void weight6(float f_neg, out float3 tap012, out float3 tap345) { - float ax = abs(x); - if (x == 0.0) - return 1.0; - else if (ax < radius) - return sinc(x) * sinc(x / radius); - else - return 0.0; -} + tap012 = float3( + weight(f_neg - 2.0), + weight(f_neg - 1.0), + min(1.0, weight(f_neg))); // Replace NaN with 1.0. + tap345 = float3( + weight(f_neg + 1.0), + weight(f_neg + 2.0), + weight(f_neg + 3.0)); -float3 weight3(float x, float scale) -{ - return float3( - weight((x * 2.0 + 0.0 * 2.0 - 3.0) * scale, 3.0), - weight((x * 2.0 + 1.0 * 2.0 - 3.0) * scale, 3.0), - weight((x * 2.0 + 2.0 * 2.0 - 3.0) * scale, 3.0)); + // Normalize weights + float sum = tap012.x + tap012.y + tap012.z + tap345.x + tap345.y + tap345.z; + float sum_i = 1.0 / sum; + tap012 = tap012 * sum_i; + tap345 = tap345 * sum_i; } float AspectUndistortX(float x, float a) @@ -75,90 +76,134 @@ return AspectUndistortX((u - 0.5) * 2.0, undistort_factor) * 0.5 + 0.5; } -float2 pixel_coord(float xpos, float ypos) +float2 undistort_coord(float xpos, float ypos) { return float2(AspectUndistortU(xpos), ypos); } -float4 pixel(float xpos, float ypos, bool undistort) +float4 undistort_pixel(float xpos, float ypos) { - if (undistort) - return image.Sample(textureSampler, pixel_coord(xpos, ypos)); - else - return image.Sample(textureSampler, float2(xpos, ypos)); + return image.Sample(textureSampler, undistort_coord(xpos, ypos)); } -float4 get_line(float ypos, float3 xpos1, float3 xpos2, float3 rowtap1, - float3 rowtap2, bool undistort) +float4 undistort_line(float3 xpos012, float3 xpos345, float ypos, float3 rowtap012, + float3 rowtap345) { return - pixel(xpos1.r, ypos, undistort) * rowtap1.r + - pixel(xpos1.g, ypos, undistort) * rowtap2.r + - pixel(xpos1.b, ypos, undistort) * rowtap1.g + - pixel(xpos2.r, ypos, undistort) * rowtap2.g + - pixel(xpos2.g, ypos, undistort) * rowtap1.b + - pixel(xpos2.b, ypos, undistort) * rowtap2.b; -} + undistort_pixel(xpos012.x, ypos) * rowtap012.x + + undistort_pixel(xpos012.y, ypos) * rowtap012.y + + undistort_pixel(xpos012.z, ypos) * rowtap012.z + + undistort_pixel(xpos345.x, ypos) * rowtap345.x + + undistort_pixel(xpos345.y, ypos) * rowtap345.y + + undistort_pixel(xpos345.z, ypos) * rowtap345.z; +} + +float4 DrawLanczos(FragData f_in, bool undistort) +{ + float2 pos = f_in.uv; + float2 pos2 = floor(pos - 0.5) + 0.5; + float2 f_neg = pos2 - pos; + + float3 rowtap012, rowtap345; + weight6(f_neg.x, rowtap012, rowtap345); + + float3 coltap012, coltap345; + weight6(f_neg.y, coltap012, coltap345); + + float2 uv2 = pos2 * base_dimension_i; + float2 uv1 = uv2 - base_dimension_i; + float2 uv0 = uv1 - base_dimension_i; + float2 uv3 = uv2 + base_dimension_i; + float2 uv4 = uv3 + base_dimension_i; + float2 uv5 = uv4 + base_dimension_i; + + if (undistort) { + float3 xpos012 = float3(uv0.x, uv1.x, uv2.x); + float3 xpos345 = float3(uv3.x, uv4.x, uv5.x); + return undistort_line(xpos012, xpos345, uv0.y, rowtap012, rowtap345) * coltap012.x + + undistort_line(xpos012, xpos345, uv1.y, rowtap012, rowtap345) * coltap012.y + + undistort_line(xpos012, xpos345, uv2.y, rowtap012, rowtap345) * coltap012.z + + undistort_line(xpos012, xpos345, uv3.y, rowtap012, rowtap345) * coltap345.x + + undistort_line(xpos012, xpos345, uv4.y, rowtap012, rowtap345) * coltap345.y + + undistort_line(xpos012, xpos345, uv5.y, rowtap012, rowtap345) * coltap345.z; + } -float4 DrawLanczos(FragData v_in, bool undistort) -{ - float2 stepxy = base_dimension_i; - float2 pos = v_in.uv + stepxy * 0.5; - float2 f = frac(pos / stepxy); - - float3 rowtap1 = weight3((1.0 - f.x) / 2.0, v_in.scale.x); - float3 rowtap2 = weight3((1.0 - f.x) / 2.0 + 0.5, v_in.scale.x); - float3 coltap1 = weight3((1.0 - f.y) / 2.0, v_in.scale.y); - float3 coltap2 = weight3((1.0 - f.y) / 2.0 + 0.5, v_in.scale.y); - - /* make sure all taps added together is exactly 1.0, otherwise some - * (very small) distortion can occur */ - float suml = rowtap1.r + rowtap1.g + rowtap1.b + rowtap2.r + rowtap2.g + rowtap2.b; - float sumc = coltap1.r + coltap1.g + coltap1.b + coltap2.r + coltap2.g + coltap2.b; - rowtap1 /= suml; - rowtap2 /= suml; - coltap1 /= sumc; - coltap2 /= sumc; - - float2 xystart = (-2.5 - f) * stepxy + pos; - float3 xpos1 = float3(xystart.x , xystart.x + stepxy.x , xystart.x + stepxy.x * 2.0); - float3 xpos2 = float3(xystart.x + stepxy.x * 3.0, xystart.x + stepxy.x * 4.0, xystart.x + stepxy.x * 5.0); + float u_weight_sum = rowtap012.z + rowtap345.x; + float u_middle_offset = rowtap345.x * base_dimension_i.x / u_weight_sum; + float u_middle = uv2.x + u_middle_offset; - return - get_line(xystart.y , xpos1, xpos2, rowtap1, rowtap2, undistort) * coltap1.r + - get_line(xystart.y + stepxy.y , xpos1, xpos2, rowtap1, rowtap2, undistort) * coltap2.r + - get_line(xystart.y + stepxy.y * 2.0, xpos1, xpos2, rowtap1, rowtap2, undistort) * coltap1.g + - get_line(xystart.y + stepxy.y * 3.0, xpos1, xpos2, rowtap1, rowtap2, undistort) * coltap2.g + - get_line(xystart.y + stepxy.y * 4.0, xpos1, xpos2, rowtap1, rowtap2, undistort) * coltap1.b + - get_line(xystart.y + stepxy.y * 5.0, xpos1, xpos2, rowtap1, rowtap2, undistort) * coltap2.b; + float v_weight_sum = coltap012.z + coltap345.x; + float v_middle_offset = coltap345.x * base_dimension_i.y / v_weight_sum; + float v_middle = uv2.y + v_middle_offset; + + float2 coord_limit = base_dimension - 0.5; + float2 coord0_f = max(uv0 * base_dimension, 0.5); + float2 coord1_f = max(uv1 * base_dimension, 0.5); + float2 coord4_f = min(uv4 * base_dimension, coord_limit); + float2 coord5_f = min(uv5 * base_dimension, coord_limit); + + int2 coord0 = int2(coord0_f); + int2 coord1 = int2(coord1_f); + int2 coord4 = int2(coord4_f); + int2 coord5 = int2(coord5_f); + + float4 row0 = image.Load(int3(coord0, 0)) * rowtap012.x; + row0 += image.Load(int3(coord1.x, coord0.y, 0)) * rowtap012.y; + row0 += image.Sample(textureSampler, float2(u_middle, uv0.y)) * u_weight_sum; + row0 += image.Load(int3(coord4.x, coord0.y, 0)) * rowtap345.y; + row0 += image.Load(int3(coord5.x, coord0.y, 0)) * rowtap345.z; + float4 total = row0 * coltap012.x; + + float4 row1 = image.Load(int3(coord0.x, coord1.y, 0)) * rowtap012.x; + row1 += image.Load(int3(coord1.x, coord1.y, 0)) * rowtap012.y; + row1 += image.Sample(textureSampler, float2(u_middle, uv1.y)) * u_weight_sum; + row1 += image.Load(int3(coord4.x, coord1.y, 0)) * rowtap345.y; + row1 += image.Load(int3(coord5.x, coord1.y, 0)) * rowtap345.z; + total += row1 * coltap012.y; + + float4 row23 = image.Sample(textureSampler, float2(uv0.x, v_middle)) * rowtap012.x; + row23 += image.Sample(textureSampler, float2(uv1.x, v_middle)) * rowtap012.y; + row23 += image.Sample(textureSampler, float2(u_middle, v_middle)) * u_weight_sum; + row23 += image.Sample(textureSampler, float2(uv4.x, v_middle)) * rowtap345.y; + row23 += image.Sample(textureSampler, float2(uv5.x, v_middle)) * rowtap345.z; + total += row23 * v_weight_sum; + + float4 row4 = image.Load(int3(coord0.x, coord4.y, 0)) * rowtap012.x; + row4 += image.Load(int3(coord1.x, coord4.y, 0)) * rowtap012.y; + row4 += image.Sample(textureSampler, float2(u_middle, uv4.y)) * u_weight_sum; + row4 += image.Load(int3(coord4.x, coord4.y, 0)) * rowtap345.y; + row4 += image.Load(int3(coord5.x, coord4.y, 0)) * rowtap345.z; + total += row4 * coltap345.y; + + float4 row5 = image.Load(int3(coord0.x, coord5.y, 0)) * rowtap012.x; + row5 += image.Load(int3(coord1.x, coord5.y, 0)) * rowtap012.y; + row5 += image.Sample(textureSampler, float2(u_middle, uv5.y)) * u_weight_sum; + row5 += image.Load(int3(coord4.x, coord5.y, 0)) * rowtap345.y; + row5 += image.Load(int3(coord5, 0)) * rowtap345.z; + total += row5 * coltap345.z; + + return total; } -float4 PSDrawLanczosRGBA(FragData v_in, bool undistort) : TARGET +float4 PSDrawLanczosRGBA(FragData f_in, bool undistort) : TARGET { - return DrawLanczos(v_in, undistort); + return DrawLanczos(f_in, undistort); } -float4 PSDrawLanczosRGBADivide(FragData v_in) : TARGET +float4 PSDrawLanczosRGBADivide(FragData f_in) : TARGET { - float4 rgba = DrawLanczos(v_in, false); + float4 rgba = DrawLanczos(f_in, false); float alpha = rgba.a; float multiplier = (alpha > 0.0) ? (1.0 / alpha) : 0.0; return float4(rgba.rgb * multiplier, alpha); } -float4 PSDrawLanczosMatrix(FragData v_in) : TARGET -{ - float3 rgb = DrawLanczos(v_in, false).rgb; - float3 yuv = mul(float4(saturate(rgb), 1.0), color_matrix).xyz; - return float4(yuv, 1.0); -} - technique Draw { pass { vertex_shader = VSDefault(v_in); - pixel_shader = PSDrawLanczosRGBA(v_in, false); + pixel_shader = PSDrawLanczosRGBA(f_in, false); } } @@ -167,7 +212,7 @@ pass { vertex_shader = VSDefault(v_in); - pixel_shader = PSDrawLanczosRGBADivide(v_in); + pixel_shader = PSDrawLanczosRGBADivide(f_in); } } @@ -176,15 +221,6 @@ pass { vertex_shader = VSDefault(v_in); - pixel_shader = PSDrawLanczosRGBA(v_in, true); - } -} - -technique DrawMatrix -{ - pass - { - vertex_shader = VSDefault(v_in); - pixel_shader = PSDrawLanczosMatrix(v_in); + pixel_shader = PSDrawLanczosRGBA(f_in, true); } }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/axisang.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/axisang.c
Changed
@@ -22,13 +22,13 @@ { float len, leni; - len = q->x*q->x + q->y*q->y + q->z*q->z; + len = q->x * q->x + q->y * q->y + q->z * q->z; if (!close_float(len, 0.0f, EPSILON)) { - leni = 1.0f/sqrtf(len); + leni = 1.0f / sqrtf(len); dst->x = q->x * leni; dst->y = q->y * leni; dst->z = q->z * leni; - dst->w = acosf(q->w)*2.0f; + dst->w = acosf(q->w) * 2.0f; } else { dst->x = 0.0f; dst->y = 0.0f;
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/axisang.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/axisang.h
Changed
@@ -27,7 +27,9 @@ struct axisang { union { - struct {float x, y, z, w;}; + struct { + float x, y, z, w; + }; float ptr[4]; }; }; @@ -49,7 +51,7 @@ } static inline void axisang_set(struct axisang *dst, float x, float y, float z, - float w) + float w) { dst->x = x; dst->y = y;
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/bounds.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/bounds.c
Changed
@@ -22,35 +22,34 @@ #include "plane.h" void bounds_move(struct bounds *dst, const struct bounds *b, - const struct vec3 *v) + const struct vec3 *v) { vec3_add(&dst->min, &b->min, v); vec3_add(&dst->max, &b->max, v); } void bounds_scale(struct bounds *dst, const struct bounds *b, - const struct vec3 *v) + const struct vec3 *v) { vec3_mul(&dst->min, &b->min, v); vec3_mul(&dst->max, &b->max, v); } void bounds_merge(struct bounds *dst, const struct bounds *b1, - const struct bounds *b2) + const struct bounds *b2) { vec3_min(&dst->min, &b1->min, &b2->min); vec3_max(&dst->max, &b1->max, &b2->max); } void bounds_merge_point(struct bounds *dst, const struct bounds *b, - const struct vec3 *v) + const struct vec3 *v) { vec3_min(&dst->min, &b->min, v); vec3_max(&dst->max, &b->max, v); } -void bounds_get_point(struct vec3 *dst, const struct bounds *b, - unsigned int i) +void bounds_get_point(struct vec3 *dst, const struct bounds *b, unsigned int i) { if (i > 8) return; @@ -68,11 +67,19 @@ * 7 = MAX.x,MAX.y,MAX.z */ - if(i > 3) {dst->x = b->max.x; i -= 4;} - else {dst->x = b->min.x;} + if (i > 3) { + dst->x = b->max.x; + i -= 4; + } else { + dst->x = b->min.x; + } - if(i > 1) {dst->y = b->max.y; i -= 2;} - else {dst->y = b->min.y;} + if (i > 1) { + dst->y = b->max.y; + i -= 2; + } else { + dst->y = b->min.y; + } dst->z = (i == 1) ? b->max.z : b->min.z; } @@ -85,7 +92,7 @@ } void bounds_transform(struct bounds *dst, const struct bounds *b, - const struct matrix4 *m) + const struct matrix4 *m) { struct bounds temp; bool b_init = false; @@ -124,7 +131,7 @@ } void bounds_transform3x4(struct bounds *dst, const struct bounds *b, - const struct matrix3 *m) + const struct matrix3 *m) { struct bounds temp; bool b_init = false; @@ -163,7 +170,7 @@ } bool bounds_intersection_ray(const struct bounds *b, const struct vec3 *orig, - const struct vec3 *dir, float *t) + const struct vec3 *dir, float *t) { float t_max = M_INFINITE; float t_min = -M_INFINITE; @@ -179,22 +186,26 @@ float f = dir->ptr[i]; if (fabsf(f) > 0.0f) { - float fi = 1.0f/f; - float t1 = (e+max_offset.ptr[i])*fi; - float t2 = (e-max_offset.ptr[i])*fi; + float fi = 1.0f / f; + float t1 = (e + max_offset.ptr[i]) * fi; + float t2 = (e - max_offset.ptr[i]) * fi; if (t1 > t2) { - if (t2 > t_min) t_min = t2; - if (t1 < t_max) t_max = t1; + if (t2 > t_min) + t_min = t2; + if (t1 < t_max) + t_max = t1; } else { - if (t1 > t_min) t_min = t1; - if (t2 < t_max) t_max = t2; + if (t1 > t_min) + t_min = t1; + if (t2 < t_max) + t_max = t2; } if (t_min > t_max) return false; if (t_max < 0.0f) return false; } else if ((-e - max_offset.ptr[i]) > 0.0f || - (-e + max_offset.ptr[i]) < 0.0f) { + (-e + max_offset.ptr[i]) < 0.0f) { return false; } } @@ -204,7 +215,7 @@ } bool bounds_intersection_line(const struct bounds *b, const struct vec3 *p1, - const struct vec3 *p2, float *t) + const struct vec3 *p2, float *t) { struct vec3 dir; float length; @@ -214,7 +225,7 @@ if (length <= TINY_EPSILON) return false; - vec3_mulf(&dir, &dir, 1.0f/length); + vec3_mulf(&dir, &dir, 1.0f / length); if (!bounds_intersection_ray(b, p1, &dir, t)) return false; @@ -259,7 +270,7 @@ } bool bounds_intersects(const struct bounds *b, const struct bounds *test, - float epsilon) + float epsilon) { return ((b->min.x - test->max.x) <= epsilon) && ((test->min.x - b->max.x) <= epsilon) && @@ -270,7 +281,7 @@ } bool bounds_intersects_obb(const struct bounds *b, const struct bounds *test, - const struct matrix4 *m, float epsilon) + const struct matrix4 *m, float epsilon) { struct bounds b_tr, test_tr; struct matrix4 m_inv; @@ -285,7 +296,7 @@ } bool bounds_intersects_obb3x4(const struct bounds *b, const struct bounds *test, - const struct matrix3 *m, float epsilon) + const struct matrix3 *m, float epsilon) { struct bounds b_tr, test_tr; struct matrix3 m_inv; @@ -300,7 +311,7 @@ } static inline float vec3or_offset_len(const struct bounds *b, - const struct vec3 *v) + const struct vec3 *v) { struct vec3 temp1, temp2; vec3_sub(&temp1, &b->max, &b->min);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/bounds.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/bounds.h
Changed
@@ -33,7 +33,7 @@ #define BOUNDS_MAX_Z 4 #define BOUNDS_OUTSIDE 1 -#define BOUNDS_INSIDE 2 +#define BOUNDS_INSIDE 2 #define BOUNDS_PARTIAL 3 struct bounds { @@ -53,18 +53,18 @@ } EXPORT void bounds_move(struct bounds *dst, const struct bounds *b, - const struct vec3 *v); + const struct vec3 *v); EXPORT void bounds_scale(struct bounds *dst, const struct bounds *b, - const struct vec3 *v); + const struct vec3 *v); EXPORT void bounds_merge(struct bounds *dst, const struct bounds *b1, - const struct bounds *b2); + const struct bounds *b2); EXPORT void bounds_merge_point(struct bounds *dst, const struct bounds *b, - const struct vec3 *v); + const struct vec3 *v); EXPORT void bounds_get_point(struct vec3 *dst, const struct bounds *b, - unsigned int i); + unsigned int i); EXPORT void bounds_get_center(struct vec3 *dst, const struct bounds *b); /** @@ -72,59 +72,56 @@ * the actual size becoming larger than it originally was. */ EXPORT void bounds_transform(struct bounds *dst, const struct bounds *b, - const struct matrix4 *m); + const struct matrix4 *m); EXPORT void bounds_transform3x4(struct bounds *dst, const struct bounds *b, - const struct matrix3 *m); + const struct matrix3 *m); EXPORT bool bounds_intersection_ray(const struct bounds *b, - const struct vec3 *orig, const struct vec3 *dir, float *t); + const struct vec3 *orig, + const struct vec3 *dir, float *t); EXPORT bool bounds_intersection_line(const struct bounds *b, - const struct vec3 *p1, const struct vec3 *p2, float *t); + const struct vec3 *p1, + const struct vec3 *p2, float *t); EXPORT bool bounds_plane_test(const struct bounds *b, const struct plane *p); -EXPORT bool bounds_under_plane(const struct bounds *b, - const struct plane *p); +EXPORT bool bounds_under_plane(const struct bounds *b, const struct plane *p); static inline bool bounds_inside(const struct bounds *b, - const struct bounds *test) + const struct bounds *test) { - return test->min.x >= b->min.x && - test->min.y >= b->min.y && - test->min.z >= b->min.z && - test->max.x <= b->max.x && - test->max.y <= b->max.y && - test->max.z <= b->max.z; + return test->min.x >= b->min.x && test->min.y >= b->min.y && + test->min.z >= b->min.z && test->max.x <= b->max.x && + test->max.y <= b->max.y && test->max.z <= b->max.z; } static inline bool bounds_vec3_inside(const struct bounds *b, - const struct vec3 *v) + const struct vec3 *v) { - return v->x >= (b->min.x-EPSILON) && - v->x <= (b->max.x+EPSILON) && - v->y >= (b->min.y-EPSILON) && - v->y <= (b->max.y+EPSILON) && - v->z >= (b->min.z-EPSILON) && - v->z <= (b->max.z+EPSILON); + return v->x >= (b->min.x - EPSILON) && v->x <= (b->max.x + EPSILON) && + v->y >= (b->min.y - EPSILON) && v->y <= (b->max.y + EPSILON) && + v->z >= (b->min.z - EPSILON) && v->z <= (b->max.z + EPSILON); } -EXPORT bool bounds_intersects(const struct bounds *b, - const struct bounds *test, float epsilon); +EXPORT bool bounds_intersects(const struct bounds *b, const struct bounds *test, + float epsilon); EXPORT bool bounds_intersects_obb(const struct bounds *b, - const struct bounds *test, const struct matrix4 *m, - float epsilon); + const struct bounds *test, + const struct matrix4 *m, float epsilon); EXPORT bool bounds_intersects_obb3x4(const struct bounds *b, - const struct bounds *test, const struct matrix3 *m, - float epsilon); + const struct bounds *test, + const struct matrix3 *m, float epsilon); static inline bool bounds_intersects_ray(const struct bounds *b, - const struct vec3 *orig, const struct vec3 *dir) + const struct vec3 *orig, + const struct vec3 *dir) { float t; return bounds_intersection_ray(b, orig, dir, &t); } static inline bool bounds_intersects_line(const struct bounds *b, - const struct vec3 *p1, const struct vec3 *p2) + const struct vec3 *p1, + const struct vec3 *p2) { float t; return bounds_intersection_line(b, p1, p2, &t);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/device-exports.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/device-exports.h
Changed
@@ -25,90 +25,103 @@ EXPORT const char *device_get_name(void); EXPORT int device_get_type(void); -EXPORT bool device_enum_adapters( - bool (*callback)(void *param, const char *name, uint32_t id), - void *param); +EXPORT bool device_enum_adapters(bool (*callback)(void *param, const char *name, + uint32_t id), + void *param); EXPORT const char *device_preprocessor_name(void); EXPORT int device_create(gs_device_t **device, uint32_t adapter); EXPORT void device_destroy(gs_device_t *device); EXPORT void device_enter_context(gs_device_t *device); EXPORT void device_leave_context(gs_device_t *device); +EXPORT void *device_get_device_obj(gs_device_t *device); EXPORT gs_swapchain_t *device_swapchain_create(gs_device_t *device, - const struct gs_init_data *data); + const struct gs_init_data *data); EXPORT void device_resize(gs_device_t *device, uint32_t x, uint32_t y); -EXPORT void device_get_size(const gs_device_t *device, uint32_t *x, uint32_t *y); +EXPORT void device_get_size(const gs_device_t *device, uint32_t *x, + uint32_t *y); EXPORT uint32_t device_get_width(const gs_device_t *device); EXPORT uint32_t device_get_height(const gs_device_t *device); -EXPORT gs_texture_t *device_texture_create(gs_device_t *device, uint32_t width, - uint32_t height, enum gs_color_format color_format, - uint32_t levels, const uint8_t **data, uint32_t flags); -EXPORT gs_texture_t *device_cubetexture_create(gs_device_t *device, - uint32_t size, enum gs_color_format color_format, - uint32_t levels, const uint8_t **data, uint32_t flags); -EXPORT gs_texture_t *device_voltexture_create(gs_device_t *device, - uint32_t width, uint32_t height, uint32_t depth, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags); +EXPORT gs_texture_t * +device_texture_create(gs_device_t *device, uint32_t width, uint32_t height, + enum gs_color_format color_format, uint32_t levels, + const uint8_t **data, uint32_t flags); +EXPORT gs_texture_t * +device_cubetexture_create(gs_device_t *device, uint32_t size, + enum gs_color_format color_format, uint32_t levels, + const uint8_t **data, uint32_t flags); +EXPORT gs_texture_t * +device_voltexture_create(gs_device_t *device, uint32_t width, uint32_t height, + uint32_t depth, enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, uint32_t flags); EXPORT gs_zstencil_t *device_zstencil_create(gs_device_t *device, - uint32_t width, uint32_t height, - enum gs_zstencil_format format); -EXPORT gs_stagesurf_t *device_stagesurface_create(gs_device_t *device, - uint32_t width, uint32_t height, - enum gs_color_format color_format); -EXPORT gs_samplerstate_t *device_samplerstate_create(gs_device_t *device, - const struct gs_sampler_info *info); + uint32_t width, uint32_t height, + enum gs_zstencil_format format); +EXPORT gs_stagesurf_t * +device_stagesurface_create(gs_device_t *device, uint32_t width, uint32_t height, + enum gs_color_format color_format); +EXPORT gs_samplerstate_t * +device_samplerstate_create(gs_device_t *device, + const struct gs_sampler_info *info); EXPORT gs_shader_t *device_vertexshader_create(gs_device_t *device, - const char *shader, const char *file, - char **error_string); + const char *shader, + const char *file, + char **error_string); EXPORT gs_shader_t *device_pixelshader_create(gs_device_t *device, - const char *shader, const char *file, - char **error_string); + const char *shader, + const char *file, + char **error_string); EXPORT gs_vertbuffer_t *device_vertexbuffer_create(gs_device_t *device, - struct gs_vb_data *data, uint32_t flags); + struct gs_vb_data *data, + uint32_t flags); EXPORT gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device, - enum gs_index_type type, void *indices, size_t num, - uint32_t flags); -EXPORT enum gs_texture_type device_get_texture_type( - const gs_texture_t *texture); + enum gs_index_type type, + void *indices, size_t num, + uint32_t flags); +EXPORT gs_timer_t *device_timer_create(gs_device_t *device); +EXPORT gs_timer_range_t *device_timer_range_create(gs_device_t *device); +EXPORT enum gs_texture_type +device_get_texture_type(const gs_texture_t *texture); EXPORT void device_load_vertexbuffer(gs_device_t *device, - gs_vertbuffer_t *vertbuffer); + gs_vertbuffer_t *vertbuffer); EXPORT void device_load_indexbuffer(gs_device_t *device, - gs_indexbuffer_t *indexbuffer); + gs_indexbuffer_t *indexbuffer); EXPORT void device_load_texture(gs_device_t *device, gs_texture_t *tex, - int unit); + int unit); EXPORT void device_load_samplerstate(gs_device_t *device, - gs_samplerstate_t *samplerstate, int unit); + gs_samplerstate_t *samplerstate, int unit); EXPORT void device_load_vertexshader(gs_device_t *device, - gs_shader_t *vertshader); + gs_shader_t *vertshader); EXPORT void device_load_pixelshader(gs_device_t *device, - gs_shader_t *pixelshader); + gs_shader_t *pixelshader); EXPORT void device_load_default_samplerstate(gs_device_t *device, bool b_3d, - int unit); + int unit); EXPORT gs_shader_t *device_get_vertex_shader(const gs_device_t *device); EXPORT gs_shader_t *device_get_pixel_shader(const gs_device_t *device); EXPORT gs_texture_t *device_get_render_target(const gs_device_t *device); EXPORT gs_zstencil_t *device_get_zstencil_target(const gs_device_t *device); EXPORT void device_set_render_target(gs_device_t *device, gs_texture_t *tex, - gs_zstencil_t *zstencil); + gs_zstencil_t *zstencil); EXPORT void device_set_cube_render_target(gs_device_t *device, - gs_texture_t *cubetex, - int side, gs_zstencil_t *zstencil); + gs_texture_t *cubetex, int side, + gs_zstencil_t *zstencil); EXPORT void device_copy_texture(gs_device_t *device, gs_texture_t *dst, - gs_texture_t *src); -EXPORT void device_copy_texture_region(gs_device_t *device, - gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y, - gs_texture_t *src, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h); + gs_texture_t *src); +EXPORT void device_copy_texture_region(gs_device_t *device, gs_texture_t *dst, + uint32_t dst_x, uint32_t dst_y, + gs_texture_t *src, uint32_t src_x, + uint32_t src_y, uint32_t src_w, + uint32_t src_h); EXPORT void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst, - gs_texture_t *src); + gs_texture_t *src); EXPORT void device_begin_scene(gs_device_t *device); EXPORT void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode, - uint32_t start_vert, uint32_t num_verts); + uint32_t start_vert, uint32_t num_verts); EXPORT void device_end_scene(gs_device_t *device); EXPORT void device_load_swapchain(gs_device_t *device, - gs_swapchain_t *swapchain); + gs_swapchain_t *swapchain); EXPORT void device_clear(gs_device_t *device, uint32_t clear_flags, - const struct vec4 *color, float depth, uint8_t stencil); + const struct vec4 *color, float depth, + uint8_t stencil); EXPORT void device_present(gs_device_t *device); EXPORT void device_flush(gs_device_t *device); EXPORT void device_set_cull_mode(gs_device_t *device, enum gs_cull_mode mode); @@ -118,32 +131,37 @@ EXPORT void device_enable_stencil_test(gs_device_t *device, bool enable); EXPORT void device_enable_stencil_write(gs_device_t *device, bool enable); EXPORT void device_enable_color(gs_device_t *device, bool red, bool green, - bool blue, bool alpha); + bool blue, bool alpha); EXPORT void device_blend_function(gs_device_t *device, enum gs_blend_type src, - enum gs_blend_type dest); + enum gs_blend_type dest); EXPORT void device_blend_function_separate(gs_device_t *device, - enum gs_blend_type src_c, enum gs_blend_type dest_c, - enum gs_blend_type src_a, enum gs_blend_type dest_a); + enum gs_blend_type src_c, + enum gs_blend_type dest_c, + enum gs_blend_type src_a, + enum gs_blend_type dest_a); EXPORT void device_depth_function(gs_device_t *device, enum gs_depth_test test); EXPORT void device_stencil_function(gs_device_t *device, - enum gs_stencil_side side, enum gs_depth_test test); + enum gs_stencil_side side, + enum gs_depth_test test); EXPORT void device_stencil_op(gs_device_t *device, enum gs_stencil_side side, - enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail, - enum gs_stencil_op_type zpass); + enum gs_stencil_op_type fail, + enum gs_stencil_op_type zfail, + enum gs_stencil_op_type zpass); EXPORT void device_set_viewport(gs_device_t *device, int x, int y, int width, - int height); + int height); EXPORT void device_get_viewport(const gs_device_t *device, - struct gs_rect *rect); + struct gs_rect *rect); EXPORT void device_set_scissor_rect(gs_device_t *device, - const struct gs_rect *rect); + const struct gs_rect *rect); EXPORT void device_ortho(gs_device_t *device, float left, float right, - float top, float bottom, float znear, float zfar); + float top, float bottom, float znear, float zfar); EXPORT void device_frustum(gs_device_t *device, float left, float right, - float top, float bottom, float znear, float zfar); + float top, float bottom, float znear, float zfar); EXPORT void device_projection_push(gs_device_t *device); EXPORT void device_projection_pop(gs_device_t *device); EXPORT void device_debug_marker_begin(gs_device_t *device, - const char *markername, const float color[4]); + const char *markername, + const float color[4]); EXPORT void device_debug_marker_end(gs_device_t *device); #ifdef __cplusplus
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/effect-parser.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/effect-parser.c
Changed
@@ -22,7 +22,7 @@ #include "effect.h" static inline bool ep_parse_param_assign(struct effect_parser *ep, - struct ep_param *param); + struct ep_param *param); static enum gs_shader_param_type get_effect_param_type(const char *type) { @@ -58,15 +58,15 @@ { size_t i; for (i = 0; i < ep->params.num; i++) - ep_param_free(ep->params.array+i); + ep_param_free(ep->params.array + i); for (i = 0; i < ep->structs.num; i++) - ep_struct_free(ep->structs.array+i); + ep_struct_free(ep->structs.array + i); for (i = 0; i < ep->funcs.num; i++) - ep_func_free(ep->funcs.array+i); + ep_func_free(ep->funcs.array + i); for (i = 0; i < ep->samplers.num; i++) - ep_sampler_free(ep->samplers.array+i); + ep_sampler_free(ep->samplers.array + i); for (i = 0; i < ep->techniques.num; i++) - ep_technique_free(ep->techniques.array+i); + ep_technique_free(ep->techniques.array + i); ep->cur_pass = NULL; cf_parser_free(&ep->cfp); @@ -78,125 +78,128 @@ } static inline struct ep_func *ep_getfunc(struct effect_parser *ep, - const char *name) + const char *name) { size_t i; for (i = 0; i < ep->funcs.num; i++) { if (strcmp(name, ep->funcs.array[i].name) == 0) - return ep->funcs.array+i; + return ep->funcs.array + i; } return NULL; } static inline struct ep_struct *ep_getstruct(struct effect_parser *ep, - const char *name) + const char *name) { size_t i; for (i = 0; i < ep->structs.num; i++) { if (strcmp(name, ep->structs.array[i].name) == 0) - return ep->structs.array+i; + return ep->structs.array + i; } return NULL; } static inline struct ep_sampler *ep_getsampler(struct effect_parser *ep, - const char *name) + const char *name) { size_t i; for (i = 0; i < ep->samplers.num; i++) { if (strcmp(name, ep->samplers.array[i].name) == 0) - return ep->samplers.array+i; + return ep->samplers.array + i; } return NULL; } static inline struct ep_param *ep_getparam(struct effect_parser *ep, - const char *name) + const char *name) { size_t i; for (i = 0; i < ep->params.num; i++) { if (strcmp(name, ep->params.array[i].name) == 0) - return ep->params.array+i; + return ep->params.array + i; } return NULL; } static inline struct ep_param *ep_getannotation(struct ep_param *param, - const char *name) + const char *name) { size_t i; for (i = 0; i < param->annotations.num; i++) { if (strcmp(name, param->annotations.array[i].name) == 0) - return param->annotations.array+i; + return param->annotations.array + i; } return NULL; } static inline struct ep_func *ep_getfunc_strref(struct effect_parser *ep, - const struct strref *ref) + const struct strref *ref) { size_t i; for (i = 0; i < ep->funcs.num; i++) { if (strref_cmp(ref, ep->funcs.array[i].name) == 0) - return ep->funcs.array+i; + return ep->funcs.array + i; } return NULL; } static inline struct ep_struct *ep_getstruct_strref(struct effect_parser *ep, - const struct strref *ref) + const struct strref *ref) { size_t i; for (i = 0; i < ep->structs.num; i++) { if (strref_cmp(ref, ep->structs.array[i].name) == 0) - return ep->structs.array+i; + return ep->structs.array + i; } return NULL; } static inline struct ep_sampler *ep_getsampler_strref(struct effect_parser *ep, - const struct strref *ref) + const struct strref *ref) { size_t i; for (i = 0; i < ep->samplers.num; i++) { if (strref_cmp(ref, ep->samplers.array[i].name) == 0) - return ep->samplers.array+i; + return ep->samplers.array + i; } return NULL; } static inline struct ep_param *ep_getparam_strref(struct effect_parser *ep, - const struct strref *ref) + const struct strref *ref) { size_t i; for (i = 0; i < ep->params.num; i++) { if (strref_cmp(ref, ep->params.array[i].name) == 0) - return ep->params.array+i; + return ep->params.array + i; } return NULL; } static inline int ep_parse_struct_var(struct effect_parser *ep, - struct ep_var *var) + struct ep_var *var) { int code; /* -------------------------------------- */ /* variable type */ - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; - if (cf_token_is(&ep->cfp, ";")) return PARSE_CONTINUE; - if (cf_token_is(&ep->cfp, "}")) return PARSE_BREAK; + if (cf_token_is(&ep->cfp, ";")) + return PARSE_CONTINUE; + if (cf_token_is(&ep->cfp, "}")) + return PARSE_BREAK; code = cf_token_is_type(&ep->cfp, CFTOKEN_NAME, "type name", ";"); if (code != PARSE_SUCCESS) @@ -207,10 +210,13 @@ /* -------------------------------------- */ /* variable name */ - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; - if (cf_token_is(&ep->cfp, ";")) return PARSE_UNEXPECTED_CONTINUE; - if (cf_token_is(&ep->cfp, "}")) return PARSE_UNEXPECTED_BREAK; + if (cf_token_is(&ep->cfp, ";")) + return PARSE_UNEXPECTED_CONTINUE; + if (cf_token_is(&ep->cfp, "}")) + return PARSE_UNEXPECTED_BREAK; code = cf_token_is_type(&ep->cfp, CFTOKEN_NAME, "variable name", ";"); if (code != PARSE_SUCCESS) @@ -221,24 +227,27 @@ /* -------------------------------------- */ /* variable mapping if any (POSITION, TEXCOORD, etc) */ - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; if (cf_token_is(&ep->cfp, ":")) { - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; if (cf_token_is(&ep->cfp, ";")) return PARSE_UNEXPECTED_CONTINUE; if (cf_token_is(&ep->cfp, "}")) return PARSE_UNEXPECTED_BREAK; - code = cf_token_is_type(&ep->cfp, CFTOKEN_NAME, - "mapping name", ";"); + code = cf_token_is_type(&ep->cfp, CFTOKEN_NAME, "mapping name", + ";"); if (code != PARSE_SUCCESS) return code; cf_copy_token(&ep->cfp, &var->mapping); - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; } /* -------------------------------------- */ @@ -308,7 +317,7 @@ } static inline int ep_parse_param_annotation_var(struct effect_parser *ep, - struct ep_param *var) + struct ep_param *var) { int code; @@ -385,7 +394,7 @@ } static int ep_parse_annotations(struct effect_parser *ep, - struct darray *annotations) + struct darray *annotations) { if (!cf_token_is(&ep->cfp, "<")) { cf_adderror_expecting(&ep->cfp, "<"); @@ -398,7 +407,7 @@ struct ep_param var; ep_param_init(&var, bstrdup(""), bstrdup(""), false, false, - false); + false); switch (ep_parse_param_annotation_var(ep, &var)) { case PARSE_UNEXPECTED_CONTINUE: @@ -441,13 +450,13 @@ } static int ep_parse_param_annotations(struct effect_parser *ep, - struct ep_param *param) + struct ep_param *param) { return ep_parse_annotations(ep, ¶m->annotations.da); } static inline int ep_parse_pass_command_call(struct effect_parser *ep, - struct darray *call) + struct darray *call) { struct cf_token end_token; cf_token_clear(&end_token); @@ -459,8 +468,9 @@ } darray_push_back(sizeof(struct cf_token), call, - ep->cfp.cur_token); - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + ep->cfp.cur_token); + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; } darray_push_back(sizeof(struct cf_token), call, ep->cfp.cur_token); @@ -472,30 +482,34 @@ { struct darray *call; /* struct cf_token */ - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; if (cf_token_is(&ep->cfp, "vertex_shader") || cf_token_is(&ep->cfp, "vertex_program")) { call = &pass->vertex_program.da; } else if (cf_token_is(&ep->cfp, "pixel_shader") || - cf_token_is(&ep->cfp, "pixel_program")) { + cf_token_is(&ep->cfp, "pixel_program")) { call = &pass->fragment_program.da; } else { cf_adderror_syntax_error(&ep->cfp); - if (!cf_go_to_valid_token(&ep->cfp, ";", "}")) return PARSE_EOF; + if (!cf_go_to_valid_token(&ep->cfp, ";", "}")) + return PARSE_EOF; return PARSE_CONTINUE; } if (cf_next_token_should_be(&ep->cfp, "=", ";", "}") != PARSE_SUCCESS) return PARSE_CONTINUE; - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; if (cf_token_is(&ep->cfp, "compile")) { cf_adderror(&ep->cfp, "compile keyword not necessary", - LEX_WARNING, NULL, NULL, NULL); - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + LEX_WARNING, NULL, NULL, NULL); + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; } return ep_parse_pass_command_call(ep, call); @@ -508,15 +522,18 @@ if (!cf_token_is(&ep->cfp, "pass")) return PARSE_UNEXPECTED_CONTINUE; - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; if (!cf_token_is(&ep->cfp, "{")) { pass->name = bstrdup_n(ep->cfp.cur_token->str.array, - ep->cfp.cur_token->str.len); - if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; + ep->cfp.cur_token->str.len); + if (!cf_next_valid_token(&ep->cfp)) + return PARSE_EOF; } - if (!cf_peek_valid_token(&ep->cfp, &peek)) return PARSE_EOF; + if (!cf_peek_valid_token(&ep->cfp, &peek)) + return PARSE_EOF; while (strref_cmp(&peek.str, "}") != 0) { int ret = ep_parse_pass_command(ep, pass); @@ -589,17 +606,19 @@ } static int ep_parse_sampler_state_item(struct effect_parser *ep, - struct ep_sampler *eps) + struct ep_sampler *eps) { int ret; char *state = NULL; struct dstr value = {0}; ret = cf_next_name(&ep->cfp, &state, "state name", ";"); - if (ret != PARSE_SUCCESS) goto fail; + if (ret != PARSE_SUCCESS) + goto fail; ret = cf_next_token_should_be(&ep->cfp, "=", ";", NULL); - if (ret != PARSE_SUCCESS) goto fail; + if (ret != PARSE_SUCCESS) + goto fail; for (;;) { const char *cur_str; @@ -663,7 +682,7 @@ } static inline int ep_check_for_keyword(struct effect_parser *ep, - const char *keyword, bool *val) + const char *keyword, bool *val) { bool new_val = cf_token_is(&ep->cfp, keyword); if (new_val) { @@ -672,7 +691,7 @@ if (new_val && *val) cf_adderror(&ep->cfp, "'$1' keyword already specified", - LEX_WARNING, keyword, NULL, NULL); + LEX_WARNING, keyword, NULL, NULL); *val = new_val; return PARSE_CONTINUE; @@ -682,7 +701,7 @@ } static inline int ep_parse_func_param(struct effect_parser *ep, - struct ep_func *func, struct ep_var *var) + struct ep_func *func, struct ep_var *var) { int code; bool var_type_keyword = false; @@ -733,7 +752,7 @@ if (cf_token_is(&ep->cfp, ":")) { code = cf_next_name(&ep->cfp, &var->mapping, - "mapping specifier", ")"); + "mapping specifier", ")"); if (code != PARSE_SUCCESS) return code; @@ -789,37 +808,36 @@ } static inline bool ep_process_struct_dep(struct effect_parser *ep, - struct ep_func *func) + struct ep_func *func) { - struct ep_struct *val = ep_getstruct_strref(ep, - &ep->cfp.cur_token->str); + struct ep_struct *val = + ep_getstruct_strref(ep, &ep->cfp.cur_token->str); if (val) da_push_back(func->struct_deps, &val->name); return val != NULL; } static inline bool ep_process_func_dep(struct effect_parser *ep, - struct ep_func *func) + struct ep_func *func) { - struct ep_func *val = ep_getfunc_strref(ep, - &ep->cfp.cur_token->str); + struct ep_func *val = ep_getfunc_strref(ep, &ep->cfp.cur_token->str); if (val) da_push_back(func->func_deps, &val->name); return val != NULL; } static inline bool ep_process_sampler_dep(struct effect_parser *ep, - struct ep_func *func) + struct ep_func *func) { - struct ep_sampler *val = ep_getsampler_strref(ep, - &ep->cfp.cur_token->str); + struct ep_sampler *val = + ep_getsampler_strref(ep, &ep->cfp.cur_token->str); if (val) da_push_back(func->sampler_deps, &val->name); return val != NULL; } static inline bool ep_process_param_dep(struct effect_parser *ep, - struct ep_func *func) + struct ep_func *func) { struct ep_param *val = ep_getparam_strref(ep, &ep->cfp.cur_token->str); if (val) @@ -828,7 +846,7 @@ } static inline bool ep_parse_func_contents(struct effect_parser *ep, - struct ep_func *func) + struct ep_func *func) { int braces = 1; @@ -844,10 +862,10 @@ braces++; } else if (cf_token_is(&ep->cfp, "}")) { braces--; - } else if (ep_process_struct_dep(ep, func) || - ep_process_func_dep(ep, func) || - ep_process_sampler_dep(ep, func) || - ep_process_param_dep(ep, func)) { + } else if (ep_process_struct_dep(ep, func) || + ep_process_func_dep(ep, func) || + ep_process_sampler_dep(ep, func) || + ep_process_param_dep(ep, func)) { } dstr_cat_strref(&func->contents, &ep->cfp.cur_token->str); @@ -856,8 +874,7 @@ return true; } -static void ep_parse_function(struct effect_parser *ep, - char *type, char *name) +static void ep_parse_function(struct effect_parser *ep, char *type, char *name) { struct ep_func func; int code; @@ -875,7 +892,7 @@ /* if function is mapped to something, for example COLOR */ if (cf_token_is(&ep->cfp, ":")) { code = cf_next_name(&ep->cfp, &func.mapping, - "mapping specifier", "{"); + "mapping specifier", "{"); if (code == PARSE_EOF) goto error; else if (code != PARSE_CONTINUE) { @@ -904,17 +921,18 @@ /* parses "array[count]" */ static bool ep_parse_param_array(struct effect_parser *ep, - struct ep_param *param) + struct ep_param *param) { if (!cf_next_valid_token(&ep->cfp)) return false; if (ep->cfp.cur_token->type != CFTOKEN_NUM || !valid_int_str(ep->cfp.cur_token->str.array, - ep->cfp.cur_token->str.len)) + ep->cfp.cur_token->str.len)) return false; - param->array_count =(int)strtol(ep->cfp.cur_token->str.array, NULL, 10); + param->array_count = + (int)strtol(ep->cfp.cur_token->str.array, NULL, 10); if (cf_next_token_should_be(&ep->cfp, "]", ";", NULL) == PARSE_EOF) return false; @@ -926,7 +944,7 @@ } static inline int ep_parse_param_assign_texture(struct effect_parser *ep, - struct ep_param *param) + struct ep_param *param) { int code; char *str; @@ -934,13 +952,13 @@ if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; - code = cf_token_is_type(&ep->cfp, CFTOKEN_STRING, - "texture path string", ";"); + code = cf_token_is_type(&ep->cfp, CFTOKEN_STRING, "texture path string", + ";"); if (code != PARSE_SUCCESS) return code; str = cf_literal_to_str(ep->cfp.cur_token->str.array, - ep->cfp.cur_token->str.len); + ep->cfp.cur_token->str.len); if (str) { da_copy_array(param->default_val, str, strlen(str) + 1); @@ -951,7 +969,7 @@ } static inline int ep_parse_param_assign_string(struct effect_parser *ep, - struct ep_param *param) + struct ep_param *param) { int code; char *str = NULL; @@ -964,7 +982,7 @@ return code; str = cf_literal_to_str(ep->cfp.cur_token->str.array, - ep->cfp.cur_token->str.len); + ep->cfp.cur_token->str.len); if (str) { da_copy_array(param->default_val, str, strlen(str) + 1); @@ -975,7 +993,8 @@ } static inline int ep_parse_param_assign_intfloat(struct effect_parser *ep, - struct ep_param *param, bool is_float) + struct ep_param *param, + bool is_float) { int code; bool is_negative = false; @@ -996,11 +1015,13 @@ if (is_float) { float f = (float)os_strtod(ep->cfp.cur_token->str.array); - if (is_negative) f = -f; + if (is_negative) + f = -f; da_push_back_array(param->default_val, &f, sizeof(float)); } else { long l = strtol(ep->cfp.cur_token->str.array, NULL, 10); - if (is_negative) l = -l; + if (is_negative) + l = -l; da_push_back_array(param->default_val, &l, sizeof(long)); } @@ -1008,7 +1029,7 @@ } static inline int ep_parse_param_assign_bool(struct effect_parser *ep, - struct ep_param *param) + struct ep_param *param) { if (!cf_next_valid_token(&ep->cfp)) return PARSE_EOF; @@ -1033,7 +1054,8 @@ * and any combination for float3x3, float4x4, int3x3, int4x4, etc */ static inline int ep_parse_param_assign_intfloat_array(struct effect_parser *ep, - struct ep_param *param, bool is_float) + struct ep_param *param, + bool is_float) { const char *intfloat_type = param->type + (is_float ? 5 : 3); int intfloat_count = 0, code, i; @@ -1041,39 +1063,42 @@ /* -------------------------------------------- */ if (intfloat_type[0] < '1' || intfloat_type[0] > '4') - cf_adderror(&ep->cfp, "Invalid row count", LEX_ERROR, - NULL, NULL, NULL); + cf_adderror(&ep->cfp, "Invalid row count", LEX_ERROR, NULL, + NULL, NULL); - intfloat_count = intfloat_type[0]-'0'; + intfloat_count = intfloat_type[0] - '0'; if (intfloat_type[1] == 'x') { if (intfloat_type[2] < '1' || intfloat_type[2] > '4') - cf_adderror(&ep->cfp, "Invalid column count", - LEX_ERROR, NULL, NULL, NULL); + cf_adderror(&ep->cfp, "Invalid column count", LEX_ERROR, + NULL, NULL, NULL); - intfloat_count *= intfloat_type[2]-'0'; + intfloat_count *= intfloat_type[2] - '0'; } /* -------------------------------------------- */ code = cf_next_token_should_be(&ep->cfp, "{", ";", NULL); - if (code != PARSE_SUCCESS) return code; + if (code != PARSE_SUCCESS) + return code; for (i = 0; i < intfloat_count; i++) { - char *next = ((i+1) < intfloat_count) ? "," : "}"; + char *next = ((i + 1) < intfloat_count) ? "," : "}"; code = ep_parse_param_assign_intfloat(ep, param, is_float); - if (code != PARSE_SUCCESS) return code; + if (code != PARSE_SUCCESS) + return code; code = cf_next_token_should_be(&ep->cfp, next, ";", NULL); - if (code != PARSE_SUCCESS) return code; + if (code != PARSE_SUCCESS) + return code; } return PARSE_SUCCESS; } static int ep_parse_param_assignment_val(struct effect_parser *ep, - struct ep_param *param) + struct ep_param *param) { if (param->is_texture) return ep_parse_param_assign_texture(ep, param); @@ -1091,13 +1116,13 @@ return ep_parse_param_assign_bool(ep, param); cf_adderror(&ep->cfp, "Invalid type '$1' used for assignment", - LEX_ERROR, param->type, NULL, NULL); + LEX_ERROR, param->type, NULL, NULL); return PARSE_CONTINUE; } static inline bool ep_parse_param_assign(struct effect_parser *ep, - struct ep_param *param) + struct ep_param *param) { if (ep_parse_param_assignment_val(ep, param) != PARSE_SUCCESS) return false; @@ -1113,9 +1138,8 @@ { } */ -static void ep_parse_param(struct effect_parser *ep, - char *type, char *name, - bool is_property, bool is_const, bool is_uniform) +static void ep_parse_param(struct effect_parser *ep, char *type, char *name, + bool is_property, bool is_const, bool is_uniform) { struct ep_param param; ep_param_init(¶m, type, name, is_property, is_const, is_uniform); @@ -1124,8 +1148,8 @@ goto complete; if (cf_token_is(&ep->cfp, "[") && !ep_parse_param_array(ep, ¶m)) goto error; - if (cf_token_is(&ep->cfp, "<") && !ep_parse_param_annotations(ep, - ¶m)) + if (cf_token_is(&ep->cfp, "<") && + !ep_parse_param_annotations(ep, ¶m)) goto error; if (cf_token_is(&ep->cfp, "=") && !ep_parse_param_assign(ep, ¶m)) goto error; @@ -1143,10 +1167,10 @@ ep_param_free(¶m); } -static bool ep_get_var_specifiers(struct effect_parser *ep, - bool *is_property, bool *is_const, bool *is_uniform) +static bool ep_get_var_specifiers(struct effect_parser *ep, bool *is_property, + bool *is_const, bool *is_uniform) { - while(true) { + while (true) { int code; code = ep_check_for_keyword(ep, "property", is_property); if (code == PARSE_EOF) @@ -1173,12 +1197,13 @@ } static inline void report_invalid_func_keyword(struct effect_parser *ep, - const char *name, bool val) + const char *name, bool val) { if (val) - cf_adderror(&ep->cfp, "'$1' keyword cannot be used with a " - "function", LEX_ERROR, - name, NULL, NULL); + cf_adderror(&ep->cfp, + "'$1' keyword cannot be used with a " + "function", + LEX_ERROR, name, NULL, NULL); } static void ep_parse_other(struct effect_parser *ep) @@ -1198,14 +1223,14 @@ if (cf_token_is(&ep->cfp, "(")) { report_invalid_func_keyword(ep, "property", is_property); - report_invalid_func_keyword(ep, "const", is_const); - report_invalid_func_keyword(ep, "uniform", is_uniform); + report_invalid_func_keyword(ep, "const", is_const); + report_invalid_func_keyword(ep, "uniform", is_uniform); ep_parse_function(ep, type, name); return; } else { ep_parse_param(ep, type, name, is_property, is_const, - is_uniform); + is_uniform); return; } @@ -1219,8 +1244,8 @@ extern const char *gs_preprocessor_name(void); #if defined(_DEBUG) && defined(_DEBUG_SHADERS) -static void debug_get_default_value(struct gs_effect_param *param, - char* buffer, unsigned long long buf_size) +static void debug_get_default_value(struct gs_effect_param *param, char *buffer, + unsigned long long buf_size) { if (param->default_val.num == 0) { snprintf(buffer, buf_size, "(null)"); @@ -1229,80 +1254,78 @@ switch (param->type) { case GS_SHADER_PARAM_STRING: - snprintf(buffer, buf_size, "'%.*s'", - param->default_val.num, - param->default_val.array); + snprintf(buffer, buf_size, "'%.*s'", param->default_val.num, + param->default_val.array); break; case GS_SHADER_PARAM_INT: snprintf(buffer, buf_size, "%ld", - *(int*)(param->default_val.array + 0)); + *(int *)(param->default_val.array + 0)); break; case GS_SHADER_PARAM_INT2: snprintf(buffer, buf_size, "%ld,%ld", - *(int*)(param->default_val.array + 0), - *(int*)(param->default_val.array + 4)); + *(int *)(param->default_val.array + 0), + *(int *)(param->default_val.array + 4)); break; case GS_SHADER_PARAM_INT3: snprintf(buffer, buf_size, "%ld,%ld,%ld", - *(int*)(param->default_val.array + 0), - *(int*)(param->default_val.array + 4), - *(int*)(param->default_val.array + 8)); + *(int *)(param->default_val.array + 0), + *(int *)(param->default_val.array + 4), + *(int *)(param->default_val.array + 8)); break; case GS_SHADER_PARAM_INT4: snprintf(buffer, buf_size, "%ld,%ld,%ld,%ld", - *(int*)(param->default_val.array + 0), - *(int*)(param->default_val.array + 4), - *(int*)(param->default_val.array + 8), - *(int*)(param->default_val.array + 12)); + *(int *)(param->default_val.array + 0), + *(int *)(param->default_val.array + 4), + *(int *)(param->default_val.array + 8), + *(int *)(param->default_val.array + 12)); break; case GS_SHADER_PARAM_FLOAT: snprintf(buffer, buf_size, "%e", - *(float*)(param->default_val.array + 0)); + *(float *)(param->default_val.array + 0)); break; case GS_SHADER_PARAM_VEC2: snprintf(buffer, buf_size, "%e,%e", - *(float*)(param->default_val.array + 0), - *(float*)(param->default_val.array + 4)); + *(float *)(param->default_val.array + 0), + *(float *)(param->default_val.array + 4)); break; case GS_SHADER_PARAM_VEC3: snprintf(buffer, buf_size, "%e,%e,%e", - *(float*)(param->default_val.array + 0), - *(float*)(param->default_val.array + 4), - *(float*)(param->default_val.array + 8)); + *(float *)(param->default_val.array + 0), + *(float *)(param->default_val.array + 4), + *(float *)(param->default_val.array + 8)); break; case GS_SHADER_PARAM_VEC4: snprintf(buffer, buf_size, "%e,%e,%e,%e", - *(float*)(param->default_val.array + 0), - *(float*)(param->default_val.array + 4), - *(float*)(param->default_val.array + 8), - *(float*)(param->default_val.array + 12)); + *(float *)(param->default_val.array + 0), + *(float *)(param->default_val.array + 4), + *(float *)(param->default_val.array + 8), + *(float *)(param->default_val.array + 12)); break; case GS_SHADER_PARAM_MATRIX4X4: snprintf(buffer, buf_size, - "[[%e,%e,%e,%e],[%e,%e,%e,%e]," - "[%e,%e,%e,%e],[%e,%e,%e,%e]]", - *(float*)(param->default_val.array + 0), - *(float*)(param->default_val.array + 4), - *(float*)(param->default_val.array + 8), - *(float*)(param->default_val.array + 12), - *(float*)(param->default_val.array + 16), - *(float*)(param->default_val.array + 20), - *(float*)(param->default_val.array + 24), - *(float*)(param->default_val.array + 28), - *(float*)(param->default_val.array + 32), - *(float*)(param->default_val.array + 36), - *(float*)(param->default_val.array + 40), - *(float*)(param->default_val.array + 44), - *(float*)(param->default_val.array + 48), - *(float*)(param->default_val.array + 52), - *(float*)(param->default_val.array + 56), - *(float*)(param->default_val.array + 60)); + "[[%e,%e,%e,%e],[%e,%e,%e,%e]," + "[%e,%e,%e,%e],[%e,%e,%e,%e]]", + *(float *)(param->default_val.array + 0), + *(float *)(param->default_val.array + 4), + *(float *)(param->default_val.array + 8), + *(float *)(param->default_val.array + 12), + *(float *)(param->default_val.array + 16), + *(float *)(param->default_val.array + 20), + *(float *)(param->default_val.array + 24), + *(float *)(param->default_val.array + 28), + *(float *)(param->default_val.array + 32), + *(float *)(param->default_val.array + 36), + *(float *)(param->default_val.array + 40), + *(float *)(param->default_val.array + 44), + *(float *)(param->default_val.array + 48), + *(float *)(param->default_val.array + 52), + *(float *)(param->default_val.array + 56), + *(float *)(param->default_val.array + 60)); break; case GS_SHADER_PARAM_BOOL: snprintf(buffer, buf_size, "%s", - (*param->default_val.array) != 0 - ? "true\0" - : "false\0"); + (*param->default_val.array) != 0 ? "true\0" + : "false\0"); break; case GS_SHADER_PARAM_UNKNOWN: case GS_SHADER_PARAM_TEXTURE: @@ -1312,7 +1335,8 @@ } static void debug_param(struct gs_effect_param *param, - struct ep_param *param_in, unsigned long long idx, const char* offset) + struct ep_param *param_in, unsigned long long idx, + const char *offset) { char _debug_type[4096]; switch (param->type) { @@ -1359,45 +1383,35 @@ char _debug_buf[4096]; debug_get_default_value(param, _debug_buf, sizeof(_debug_buf)); - if (param->annotations.num > 0) { - blog(LOG_DEBUG, "%s[%4lld] %.*s '%s' with value %.*s and %lld annotations:", - offset, - idx, - sizeof(_debug_type), _debug_type, - param->name, - sizeof(_debug_buf), _debug_buf, - param->annotations.num); + if (param->annotations.num > 0) { + blog(LOG_DEBUG, + "%s[%4lld] %.*s '%s' with value %.*s and %lld annotations:", + offset, idx, sizeof(_debug_type), _debug_type, param->name, + sizeof(_debug_buf), _debug_buf, param->annotations.num); } else { - blog(LOG_DEBUG, "%s[%4lld] %.*s '%s' with value %.*s.", - offset, - idx, - sizeof(_debug_type), _debug_type, - param->name, - sizeof(_debug_buf), _debug_buf); + blog(LOG_DEBUG, "%s[%4lld] %.*s '%s' with value %.*s.", offset, + idx, sizeof(_debug_type), _debug_type, param->name, + sizeof(_debug_buf), _debug_buf); } - } static void debug_param_annotation(struct gs_effect_param *param, - struct ep_param *param_in, unsigned long long idx, const char* offset) + struct ep_param *param_in, + unsigned long long idx, const char *offset) { char _debug_buf[4096]; debug_get_default_value(param, _debug_buf, sizeof(_debug_buf)); - blog(LOG_DEBUG, "%s[%4lld] %s '%s' with value %.*s", - offset, - idx, - param_in->type, - param->name, - sizeof(_debug_buf), _debug_buf); + blog(LOG_DEBUG, "%s[%4lld] %s '%s' with value %.*s", offset, idx, + param_in->type, param->name, sizeof(_debug_buf), _debug_buf); } -static void debug_print_string(const char* offset, const char* str) +static void debug_print_string(const char *offset, const char *str) { // Bypass 4096 limit in def_log_handler. char const *begin = str; unsigned long long line = 1; for (char const *here = begin; here[0] != '\0'; here++) { - char const * str = begin; + char const *str = begin; unsigned long long len = here - begin; bool is_line = false; @@ -1413,20 +1427,20 @@ } if (is_line) { - blog(LOG_DEBUG, "\t\t\t\t[%4lld] %.*s", line, - len, str); + blog(LOG_DEBUG, "\t\t\t\t[%4lld] %.*s", line, len, str); line++; } } if (begin[0] != '\0') { // Final line was not written. - blog(LOG_DEBUG, "\t\t\t\t[%4lld] %*s", line, strlen(begin), begin); + blog(LOG_DEBUG, "\t\t\t\t[%4lld] %*s", line, strlen(begin), + begin); } } #endif bool ep_parse(struct effect_parser *ep, gs_effect_t *effect, - const char *effect_string, const char *file) + const char *effect_string, const char *file) { bool success; @@ -1437,7 +1451,7 @@ cf_def_init(&def); def.name.str.array = graphics_preprocessor; - def.name.str.len = strlen(graphics_preprocessor); + def.name.str.len = strlen(graphics_preprocessor); strref_copy(&def.name.unmerged_str, &def.name.str); cf_preprocessor_add_def(&ep->cfp.pp, &def); @@ -1465,7 +1479,7 @@ } else if (cf_token_is(&ep->cfp, "{")) { /* add error and pass braces */ cf_adderror(&ep->cfp, "Unexpected code segment", - LEX_ERROR, NULL, NULL, NULL); + LEX_ERROR, NULL, NULL, NULL); cf_pass_pair(&ep->cfp, '{', '}'); } else { @@ -1475,7 +1489,8 @@ } #if defined(_DEBUG) && defined(_DEBUG_SHADERS) - blog(LOG_DEBUG, "================================================================================"); + blog(LOG_DEBUG, + "================================================================================"); blog(LOG_DEBUG, "Effect Parser reformatted shader '%s' to:", file); debug_print_string("\t", ep->cfp.lex.reformatted); #endif @@ -1484,9 +1499,9 @@ if (success) success = ep_compile(ep); - #if defined(_DEBUG) && defined(_DEBUG_SHADERS) - blog(LOG_DEBUG, "================================================================================"); + blog(LOG_DEBUG, + "================================================================================"); #endif return success; @@ -1495,7 +1510,7 @@ /* ------------------------------------------------------------------------- */ static inline void ep_write_param(struct dstr *shader, struct ep_param *param, - struct darray *used_params) + struct darray *used_params) { if (param->written) return; @@ -1523,8 +1538,9 @@ } static inline void ep_write_func_param_deps(struct effect_parser *ep, - struct dstr *shader, struct ep_func *func, - struct darray *used_params) + struct dstr *shader, + struct ep_func *func, + struct darray *used_params) { size_t i; for (i = 0; i < func->param_deps.num; i++) { @@ -1548,7 +1564,7 @@ dstr_cat(shader, sampler->name); dstr_cat(shader, " {"); - for (i = 0; i <sampler->values.num; i++) { + for (i = 0; i < sampler->values.num; i++) { dstr_cat(shader, "\n\t"); dstr_cat(shader, sampler->states.array[i]); dstr_cat(shader, " = "); @@ -1561,7 +1577,8 @@ } static inline void ep_write_func_sampler_deps(struct effect_parser *ep, - struct dstr *shader, struct ep_func *func) + struct dstr *shader, + struct ep_func *func) { size_t i; for (i = 0; i < func->sampler_deps.num; i++) { @@ -1607,7 +1624,7 @@ for (i = 0; i < st->vars.num; i++) { dstr_cat(shader, "\n\t"); - ep_write_var(shader, st->vars.array+i); + ep_write_var(shader, st->vars.array + i); dstr_cat(shader, ";"); } @@ -1616,7 +1633,8 @@ } static inline void ep_write_func_struct_deps(struct effect_parser *ep, - struct dstr *shader, struct ep_func *func) + struct dstr *shader, + struct ep_func *func) { size_t i; for (i = 0; i < func->struct_deps.num; i++) { @@ -1632,11 +1650,12 @@ } static void ep_write_func(struct effect_parser *ep, struct dstr *shader, - struct ep_func *func, struct darray *used_params); + struct ep_func *func, struct darray *used_params); static inline void ep_write_func_func_deps(struct effect_parser *ep, - struct dstr *shader, struct ep_func *func, - struct darray *used_params) + struct dstr *shader, + struct ep_func *func, + struct darray *used_params) { size_t i; for (i = 0; i < func->func_deps.num; i++) { @@ -1651,12 +1670,12 @@ } static void ep_write_func(struct effect_parser *ep, struct dstr *shader, - struct ep_func *func, struct darray *used_params) + struct ep_func *func, struct darray *used_params) { size_t i; func->written = true; - + ep_write_func_param_deps(ep, shader, func, used_params); ep_write_func_sampler_deps(ep, shader, func); ep_write_func_struct_deps(ep, shader, func); @@ -1670,7 +1689,7 @@ dstr_cat(shader, "("); for (i = 0; i < func->param_vars.num; i++) { - struct ep_var *var = func->param_vars.array+i; + struct ep_var *var = func->param_vars.array + i; if (i) dstr_cat(shader, ", "); @@ -1683,15 +1702,14 @@ } /* writes mapped vars used by the call as parameters for main */ -static void ep_write_main_params(struct effect_parser *ep, - struct dstr *shader, struct dstr *param_str, - struct ep_func *func) +static void ep_write_main_params(struct effect_parser *ep, struct dstr *shader, + struct dstr *param_str, struct ep_func *func) { size_t i; bool empty_params = dstr_is_empty(param_str); for (i = 0; i < func->param_vars.num; i++) { - struct ep_var *var = func->param_vars.array+i; + struct ep_var *var = func->param_vars.array + i; struct ep_struct *st = NULL; bool mapped = (var->mapping != NULL); @@ -1722,7 +1740,7 @@ } static void ep_write_main(struct effect_parser *ep, struct dstr *shader, - struct ep_func *func, struct dstr *call_str) + struct ep_func *func, struct dstr *call_str) { struct dstr param_str; struct dstr adjusted_call; @@ -1753,19 +1771,19 @@ static inline void ep_reset_written(struct effect_parser *ep) { size_t i; - for (i = 0; i <ep->params.num; i++) + for (i = 0; i < ep->params.num; i++) ep->params.array[i].written = false; - for (i = 0; i <ep->structs.num; i++) + for (i = 0; i < ep->structs.num; i++) ep->structs.array[i].written = false; - for (i = 0; i <ep->funcs.num; i++) + for (i = 0; i < ep->funcs.num; i++) ep->funcs.array[i].written = false; - for (i = 0; i <ep->samplers.num; i++) + for (i = 0; i < ep->samplers.num; i++) ep->samplers.array[i].written = false; } -static void ep_makeshaderstring(struct effect_parser *ep, - struct dstr *shader, struct darray *shader_call, - struct darray *used_params) +static void ep_makeshaderstring(struct effect_parser *ep, struct dstr *shader, + struct darray *shader_call, + struct darray *used_params) { struct cf_token *token = shader_call->array; struct cf_token *func_name; @@ -1780,8 +1798,7 @@ while (token->type != CFTOKEN_NONE && is_whitespace(*token->str.array)) token++; - if (token->type == CFTOKEN_NONE || - strref_cmp(&token->str, "NULL") == 0) + if (token->type == CFTOKEN_NONE || strref_cmp(&token->str, "NULL") == 0) return; func_name = token; @@ -1808,17 +1825,18 @@ } static void ep_compile_annotations(struct darray *ep_annotations, - struct darray *gsp_annotations, struct effect_parser *ep) + struct darray *gsp_annotations, + struct effect_parser *ep) { - darray_resize(sizeof(struct gs_effect_param), - gsp_annotations, ep_annotations->num); + darray_resize(sizeof(struct gs_effect_param), gsp_annotations, + ep_annotations->num); size_t i; for (i = 0; i < ep_annotations->num; i++) { - struct gs_effect_param *param = ((struct gs_effect_param *) - gsp_annotations->array)+i; - struct ep_param *param_in = ((struct ep_param *) - ep_annotations->array)+i; + struct gs_effect_param *param = + ((struct gs_effect_param *)gsp_annotations->array) + i; + struct ep_param *param_in = + ((struct ep_param *)ep_annotations->array) + i; param->name = bstrdup(param_in->name); param->section = EFFECT_ANNOTATION; @@ -1833,11 +1851,13 @@ } } -static void ep_compile_param_annotations(struct ep_param *ep_param_input, - struct gs_effect_param *gs_effect_input, struct effect_parser *ep) +static void +ep_compile_param_annotations(struct ep_param *ep_param_input, + struct gs_effect_param *gs_effect_input, + struct effect_parser *ep) { ep_compile_annotations(&(ep_param_input->annotations.da), - &(gs_effect_input->annotations.da), ep); + &(gs_effect_input->annotations.da), ep); } static void ep_compile_param(struct effect_parser *ep, size_t idx) @@ -1845,13 +1865,13 @@ struct gs_effect_param *param; struct ep_param *param_in; - param = ep->effect->params.array+idx; - param_in = ep->params.array+idx; + param = ep->effect->params.array + idx; + param_in = ep->params.array + idx; param_in->param = param; - param->name = bstrdup(param_in->name); + param->name = bstrdup(param_in->name); param->section = EFFECT_PARAM; - param->effect = ep->effect; + param->effect = ep->effect; da_move(param->default_val, param_in->default_val); param->type = get_effect_param_type(param_in->type); @@ -1869,12 +1889,13 @@ } static bool ep_compile_pass_shaderparams(struct effect_parser *ep, - struct darray *pass_params, struct darray *used_params, - gs_shader_t *shader) + struct darray *pass_params, + struct darray *used_params, + gs_shader_t *shader) { size_t i; darray_resize(sizeof(struct pass_shaderparam), pass_params, - used_params->num); + used_params->num); for (i = 0; i < pass_params->num; i++) { struct dstr *param_name; @@ -1882,12 +1903,12 @@ param_name = darray_item(sizeof(struct dstr), used_params, i); param = darray_item(sizeof(struct pass_shaderparam), - pass_params, i); + pass_params, i); param->eparam = gs_effect_get_param_by_name(ep->effect, - param_name->array); - param->sparam = gs_shader_get_param_by_name(shader, - param_name->array); + param_name->array); + param->sparam = + gs_shader_get_param_by_name(shader, param_name->array); #if defined(_DEBUG) && defined(_DEBUG_SHADERS) debug_param(param->eparam, 0, i, "\t\t\t\t"); @@ -1903,13 +1924,15 @@ } static inline bool ep_compile_pass_shader(struct effect_parser *ep, - struct gs_effect_technique *tech, - struct gs_effect_pass *pass, struct ep_pass *pass_in, - size_t pass_idx, enum gs_shader_type type) + struct gs_effect_technique *tech, + struct gs_effect_pass *pass, + struct ep_pass *pass_in, + size_t pass_idx, + enum gs_shader_type type) { struct dstr shader_str; struct dstr location; - struct darray used_params; /* struct dstr */ + struct darray used_params; /* struct dstr */ struct darray *pass_params = NULL; /* struct pass_shaderparam */ gs_shader_t *shader = NULL; bool success = true; @@ -1928,24 +1951,24 @@ assert(pass_idx <= UINT_MAX); dstr_catf(&location, "shader, technique %s, pass %u)", tech->name, - (unsigned)pass_idx); + (unsigned)pass_idx); if (type == GS_SHADER_VERTEX) { ep_makeshaderstring(ep, &shader_str, - &pass_in->vertex_program.da, &used_params); + &pass_in->vertex_program.da, &used_params); pass->vertshader = gs_vertexshader_create(shader_str.array, - location.array, NULL); - + location.array, NULL); shader = pass->vertshader; pass_params = &pass->vertshader_params.da; } else if (type == GS_SHADER_PIXEL) { ep_makeshaderstring(ep, &shader_str, - &pass_in->fragment_program.da, &used_params); + &pass_in->fragment_program.da, + &used_params); pass->pixelshader = gs_pixelshader_create(shader_str.array, - location.array, NULL); + location.array, NULL); shader = pass->pixelshader; pass_params = &pass->pixelshader_params.da; @@ -1953,7 +1976,7 @@ #if defined(_DEBUG) && defined(_DEBUG_SHADERS) blog(LOG_DEBUG, "\t\t\t%s Shader:", - type == GS_SHADER_VERTEX ? "Vertex" : "Fragment"); + type == GS_SHADER_VERTEX ? "Vertex" : "Fragment"); blog(LOG_DEBUG, "\t\t\tCode:"); debug_print_string("\t\t\t\t\t", shader_str.array); blog(LOG_DEBUG, "\t\t\tParameters:"); @@ -1961,7 +1984,7 @@ if (shader) success = ep_compile_pass_shaderparams(ep, pass_params, - &used_params, shader); + &used_params, shader); else success = false; @@ -1974,36 +1997,34 @@ } static bool ep_compile_pass(struct effect_parser *ep, - struct gs_effect_technique *tech, - struct ep_technique *tech_in, - size_t idx) + struct gs_effect_technique *tech, + struct ep_technique *tech_in, size_t idx) { struct gs_effect_pass *pass; struct ep_pass *pass_in; bool success = true; - pass = tech->passes.array+idx; - pass_in = tech_in->passes.array+idx; + pass = tech->passes.array + idx; + pass_in = tech_in->passes.array + idx; pass->name = bstrdup(pass_in->name); pass->section = EFFECT_PASS; #if defined(_DEBUG) && defined(_DEBUG_SHADERS) - blog(LOG_DEBUG, "\t\t[%4lld] Pass '%s':", - idx, pass->name); + blog(LOG_DEBUG, "\t\t[%4lld] Pass '%s':", idx, pass->name); #endif if (!ep_compile_pass_shader(ep, tech, pass, pass_in, idx, - GS_SHADER_VERTEX)) { + GS_SHADER_VERTEX)) { success = false; - blog(LOG_ERROR, "Pass (%zu) <%s> missing vertex shader!", - idx, pass->name ? pass->name : ""); + blog(LOG_ERROR, "Pass (%zu) <%s> missing vertex shader!", idx, + pass->name ? pass->name : ""); } if (!ep_compile_pass_shader(ep, tech, pass, pass_in, idx, - GS_SHADER_PIXEL)) { + GS_SHADER_PIXEL)) { success = false; - blog(LOG_ERROR, "Pass (%zu) <%s> missing pixel shader!", - idx, pass->name ? pass->name : ""); + blog(LOG_ERROR, "Pass (%zu) <%s> missing pixel shader!", idx, + pass->name ? pass->name : ""); } return success; } @@ -2015,8 +2036,8 @@ bool success = true; size_t i; - tech = ep->effect->techniques.array+idx; - tech_in = ep->techniques.array+idx; + tech = ep->effect->techniques.array + idx; + tech_in = ep->techniques.array + idx; tech->name = bstrdup(tech_in->name); tech->section = EFFECT_TECHNIQUE; @@ -2025,8 +2046,8 @@ da_resize(tech->passes, tech_in->passes.num); #if defined(_DEBUG) && defined(_DEBUG_SHADERS) - blog(LOG_DEBUG, "\t[%4lld] Technique '%s' has %lld passes:", - idx, tech->name, tech->passes.num); + blog(LOG_DEBUG, "\t[%4lld] Technique '%s' has %lld passes:", idx, + tech->name, tech->passes.num); #endif for (i = 0; i < tech->passes.num; i++) {
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/effect-parser.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/effect-parser.h
Changed
@@ -67,9 +67,9 @@ /* effect parser param data */ struct ep_param { - char *type, *name; - DARRAY(uint8_t) default_val; - DARRAY(char*) properties; + char *type, *name; + DARRAY(uint8_t) default_val; + DARRAY(char *) properties; struct gs_effect_param *param; bool is_const, is_property, is_uniform, is_texture, written; int writeorder, array_count; @@ -78,18 +78,18 @@ extern void ep_param_writevar(struct dstr *dst, struct darray *use_params); -static inline void ep_param_init(struct ep_param *epp, - char *type, char *name, - bool is_property, bool is_const, bool is_uniform) +static inline void ep_param_init(struct ep_param *epp, char *type, char *name, + bool is_property, bool is_const, + bool is_uniform) { - epp->type = type; - epp->name = name; + epp->type = type; + epp->name = name; epp->is_property = is_property; - epp->is_const = is_const; - epp->is_uniform = is_uniform; - epp->is_texture = (astrcmp_n(epp->type, "texture", 7) == 0); - epp->written = false; - epp->writeorder = false; + epp->is_const = is_const; + epp->is_uniform = is_uniform; + epp->is_texture = (astrcmp_n(epp->type, "texture", 7) == 0); + epp->written = false; + epp->writeorder = false; epp->array_count = 0; da_init(epp->default_val); da_init(epp->properties); @@ -136,7 +136,7 @@ bfree(eps->name); for (i = 0; i < eps->vars.num; i++) - ep_var_free(eps->vars.array+i); + ep_var_free(eps->vars.array + i); da_free(eps->vars); } @@ -145,8 +145,8 @@ struct ep_sampler { char *name; - DARRAY(char*) states; - DARRAY(char*) values; + DARRAY(char *) states; + DARRAY(char *) values; bool written; }; @@ -210,7 +210,7 @@ size_t i; for (i = 0; i < ept->passes.num; i++) - ep_pass_free(ept->passes.array+i); + ep_pass_free(ept->passes.array + i); bfree(ept->name); da_free(ept->passes); @@ -223,18 +223,17 @@ char *name, *ret_type, *mapping; struct dstr contents; DARRAY(struct ep_var) param_vars; - DARRAY(const char*) func_deps; - DARRAY(const char*) struct_deps; - DARRAY(const char*) param_deps; - DARRAY(const char*) sampler_deps; + DARRAY(const char *) func_deps; + DARRAY(const char *) struct_deps; + DARRAY(const char *) param_deps; + DARRAY(const char *) sampler_deps; bool written; }; -static inline void ep_func_init(struct ep_func *epf, char *ret_type, - char *name) +static inline void ep_func_init(struct ep_func *epf, char *ret_type, char *name) { memset(epf, 0, sizeof(struct ep_func)); - epf->name = name; + epf->name = name; epf->ret_type = ret_type; } @@ -242,7 +241,7 @@ { size_t i; for (i = 0; i < epf->param_vars.num; i++) - ep_var_free(epf->param_vars.array+i); + ep_var_free(epf->param_vars.array + i); bfree(epf->name); bfree(epf->ret_type); @@ -260,10 +259,10 @@ struct effect_parser { gs_effect_t *effect; - DARRAY(struct ep_param) params; - DARRAY(struct ep_struct) structs; - DARRAY(struct ep_func) funcs; - DARRAY(struct ep_sampler) samplers; + DARRAY(struct ep_param) params; + DARRAY(struct ep_struct) structs; + DARRAY(struct ep_func) funcs; + DARRAY(struct ep_sampler) samplers; DARRAY(struct ep_technique) techniques; /* internal vars */ @@ -291,7 +290,7 @@ extern void ep_free(struct effect_parser *ep); extern bool ep_parse(struct effect_parser *ep, gs_effect_t *effect, - const char *effect_string, const char *file); + const char *effect_string, const char *file); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/effect.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/effect.c
Changed
@@ -36,12 +36,13 @@ } gs_technique_t *gs_effect_get_technique(const gs_effect_t *effect, - const char *name) + const char *name) { - if (!effect) return NULL; + if (!effect) + return NULL; for (size_t i = 0; i < effect->techniques.num; i++) { - struct gs_effect_technique *tech = effect->techniques.array+i; + struct gs_effect_technique *tech = effect->techniques.array + i; if (strcmp(tech->name, name) == 0) return tech; } @@ -51,7 +52,8 @@ gs_technique_t *gs_effect_get_current_technique(const gs_effect_t *effect) { - if (!effect) return NULL; + if (!effect) + return NULL; return effect->cur_technique; } @@ -67,14 +69,16 @@ if (!!gs_get_effect()) { blog(LOG_WARNING, "gs_effect_loop: An effect is " - "already active"); + "already active"); return false; } tech = gs_effect_get_technique(effect, name); if (!tech) { - blog(LOG_WARNING, "gs_effect_loop: Technique '%s' " - "not found.", name); + blog(LOG_WARNING, + "gs_effect_loop: Technique '%s' " + "not found.", + name); return false; } @@ -86,7 +90,7 @@ } if (!gs_technique_begin_pass(effect->cur_technique, - effect->loop_pass++)) { + effect->loop_pass++)) { gs_technique_end(effect->cur_technique); effect->looping = false; effect->loop_pass = 0; @@ -98,7 +102,8 @@ size_t gs_technique_begin(gs_technique_t *tech) { - if (!tech) return 0; + if (!tech) + return 0; tech->effect->cur_technique = tech; tech->effect->graphics->cur_effect = tech->effect; @@ -108,7 +113,8 @@ void gs_technique_end(gs_technique_t *tech) { - if (!tech) return; + if (!tech) + return; struct gs_effect *effect = tech->effect; struct gs_effect_param *params = effect->params.array; @@ -121,7 +127,7 @@ tech->effect->graphics->cur_effect = NULL; for (i = 0; i < effect->params.num; i++) { - struct gs_effect_param *param = params+i; + struct gs_effect_param *param = params + i; da_free(param->cur_val); param->changed = false; @@ -145,12 +151,13 @@ size_t i; for (i = 0; i < pass_params->num; i++) { - struct pass_shaderparam *param = params+i; + struct pass_shaderparam *param = params + i; struct gs_effect_param *eparam = param->eparam; gs_sparam_t *sparam = param->sparam; if (eparam->next_sampler) - gs_shader_set_next_sampler(sparam, eparam->next_sampler); + gs_shader_set_next_sampler(sparam, + eparam->next_sampler); if (changed_only && !eparam->changed) continue; @@ -163,12 +170,12 @@ } gs_shader_set_val(sparam, eparam->cur_val.array, - eparam->cur_val.num); + eparam->cur_val.num); } } static inline void upload_parameters(struct gs_effect *effect, - bool changed_only) + bool changed_only) { struct darray *vshader_params, *pshader_params; @@ -184,7 +191,7 @@ reset_params(pshader_params); } -void gs_effect_update_params(gs_effect_t *effect) +void gs_effect_update_params(gs_effect_t *effect) { if (effect) upload_parameters(effect, true); @@ -199,7 +206,7 @@ return false; passes = tech->passes.array; - cur_pass = passes+idx; + cur_pass = passes + idx; tech->effect->cur_pass = cur_pass; gs_load_vertexshader(cur_pass->vertshader); @@ -209,14 +216,13 @@ return true; } -bool gs_technique_begin_pass_by_name(gs_technique_t *tech, - const char *name) +bool gs_technique_begin_pass_by_name(gs_technique_t *tech, const char *name) { if (!tech) return false; for (size_t i = 0; i < tech->passes.num; i++) { - struct gs_effect_pass *pass = tech->passes.array+i; + struct gs_effect_pass *pass = tech->passes.array + i; if (strcmp(pass->name, name) == 0) { gs_technique_begin_pass(tech, i); return true; @@ -231,7 +237,7 @@ struct pass_shaderparam *params = in_params->array; for (size_t i = 0; i < in_params->num; i++) { - struct pass_shaderparam *param = params+i; + struct pass_shaderparam *param = params + i; struct gs_shader_param_info info; gs_shader_get_param_info(param->sparam, &info); @@ -242,7 +248,8 @@ void gs_technique_end_pass(gs_technique_t *tech) { - if (!tech) return; + if (!tech) + return; struct gs_effect_pass *pass = tech->effect->cur_pass; if (!pass) @@ -260,24 +267,26 @@ gs_eparam_t *gs_effect_get_param_by_idx(const gs_effect_t *effect, size_t param) { - if (!effect) return NULL; + if (!effect) + return NULL; struct gs_effect_param *params = effect->params.array; if (param >= effect->params.num) return NULL; - return params+param; + return params + param; } gs_eparam_t *gs_effect_get_param_by_name(const gs_effect_t *effect, - const char *name) + const char *name) { - if (!effect) return NULL; + if (!effect) + return NULL; struct gs_effect_param *params = effect->params.array; for (size_t i = 0; i < effect->params.num; i++) { - struct gs_effect_param *param = params+i; + struct gs_effect_param *param = params + i; if (strcmp(param->name, name) == 0) return param; @@ -292,10 +301,11 @@ } gs_eparam_t *gs_param_get_annotation_by_idx(const gs_eparam_t *param, - size_t annotation) + size_t annotation) { - if (!param) return NULL; - + if (!param) + return NULL; + struct gs_effect_param *params = param->annotations.array; if (annotation > param->annotations.num) return NULL; @@ -304,9 +314,10 @@ } gs_eparam_t *gs_param_get_annotation_by_name(const gs_eparam_t *param, - const char *name) + const char *name) { - if (!param) return NULL; + if (!param) + return NULL; struct gs_effect_param *params = param->annotations.array; for (size_t i = 0; i < param->annotations.num; i++) { @@ -318,9 +329,10 @@ } gs_epass_t *gs_technique_get_pass_by_idx(const gs_technique_t *technique, - size_t pass) + size_t pass) { - if (!technique) return NULL; + if (!technique) + return NULL; struct gs_effect_pass *passes = technique->passes.array; if (pass > technique->passes.num) @@ -330,9 +342,10 @@ } gs_epass_t *gs_technique_get_pass_by_name(const gs_technique_t *technique, - const char *name) + const char *name) { - if (!technique) return NULL; + if (!technique) + return NULL; struct gs_effect_pass *passes = technique->passes.array; for (size_t i = 0; i < technique->passes.num; i++) { @@ -354,7 +367,7 @@ } void gs_effect_get_param_info(const gs_eparam_t *param, - struct gs_effect_param_info *info) + struct gs_effect_param_info *info) { if (!param) return; @@ -363,8 +376,8 @@ info->type = param->type; } -static inline void effect_setval_inline(gs_eparam_t *param, - const void *data, size_t size) +static inline void effect_setval_inline(gs_eparam_t *param, const void *data, + size_t size) { bool size_changed; @@ -390,10 +403,10 @@ } #ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define min(a, b) (((a) < (b)) ? (a) : (b)) #endif static inline void effect_getval_inline(gs_eparam_t *param, void *data, - size_t size) + size_t size) { if (!param) { blog(LOG_ERROR, "effect_getval_inline: invalid param"); @@ -411,7 +424,7 @@ } static inline void effect_getdefaultval_inline(gs_eparam_t *param, void *data, - size_t size) + size_t size) { if (!param) { blog(LOG_ERROR, "effect_getdefaultval_inline: invalid param"); @@ -473,7 +486,7 @@ void gs_effect_set_texture(gs_eparam_t *param, gs_texture_t *val) { - effect_setval_inline(param, &val, sizeof(gs_texture_t*)); + effect_setval_inline(param, &val, sizeof(gs_texture_t *)); } void gs_effect_set_val(gs_eparam_t *param, const void *val, size_t size) @@ -491,7 +504,7 @@ void *data; if (size) - data = (void*)bzalloc(size); + data = (void *)bzalloc(size); else return NULL; @@ -515,7 +528,7 @@ void *data; if (size) - data = (void*)bzalloc(size); + data = (void *)bzalloc(size); else return NULL; @@ -532,7 +545,7 @@ void gs_effect_set_default(gs_eparam_t *param) { effect_setval_inline(param, param->default_val.array, - param->default_val.num); + param->default_val.num); } void gs_effect_set_next_sampler(gs_eparam_t *param, gs_samplerstate_t *sampler)
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/effect.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/effect.h
Changed
@@ -86,7 +86,7 @@ } EXPORT void effect_param_parse_property(gs_eparam_t *param, - const char *property); + const char *property); /* ------------------------------------------------------------------------- */ @@ -139,7 +139,7 @@ { size_t i; for (i = 0; i < t->passes.num; i++) - effect_pass_free(t->passes.array+i); + effect_pass_free(t->passes.array + i); da_free(t->passes); bfree(t->name); @@ -176,9 +176,9 @@ { size_t i; for (i = 0; i < effect->params.num; i++) - effect_param_free(effect->params.array+i); + effect_param_free(effect->params.array + i); for (i = 0; i < effect->techniques.num; i++) - effect_technique_free(effect->techniques.array+i); + effect_technique_free(effect->techniques.array + i); da_free(effect->params); da_free(effect->techniques); @@ -191,8 +191,9 @@ EXPORT void effect_upload_params(gs_effect_t *effect, bool changed_only); EXPORT void effect_upload_shader_params(gs_effect_t *effect, - gs_shader_t *shader, struct darray *pass_params, - bool changed_only); + gs_shader_t *shader, + struct darray *pass_params, + bool changed_only); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/graphics-ffmpeg.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/graphics-ffmpeg.c
Changed
@@ -7,42 +7,44 @@ #include "../obs-ffmpeg-compat.h" struct ffmpeg_image { - const char *file; - AVFormatContext *fmt_ctx; - AVCodecContext *decoder_ctx; - AVCodec *decoder; - AVStream *stream; - int stream_idx; - - int cx, cy; + const char *file; + AVFormatContext *fmt_ctx; + AVCodecContext *decoder_ctx; + AVCodec *decoder; + AVStream *stream; + int stream_idx; + + int cx, cy; enum AVPixelFormat format; }; static bool ffmpeg_image_open_decoder_context(struct ffmpeg_image *info) { - int ret = av_find_best_stream(info->fmt_ctx, AVMEDIA_TYPE_VIDEO, - -1, 1, NULL, 0); + int ret = av_find_best_stream(info->fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, 1, + NULL, 0); if (ret < 0) { blog(LOG_WARNING, "Couldn't find video stream in file '%s': %s", - info->file, av_err2str(ret)); + info->file, av_err2str(ret)); return false; } - info->stream_idx = ret; - info->stream = info->fmt_ctx->streams[ret]; + info->stream_idx = ret; + info->stream = info->fmt_ctx->streams[ret]; info->decoder_ctx = info->stream->codec; - info->decoder = avcodec_find_decoder(info->decoder_ctx->codec_id); + info->decoder = avcodec_find_decoder(info->decoder_ctx->codec_id); if (!info->decoder) { blog(LOG_WARNING, "Failed to find decoder for file '%s'", - info->file); + info->file); return false; } ret = avcodec_open2(info->decoder_ctx, info->decoder, NULL); if (ret < 0) { - blog(LOG_WARNING, "Failed to open video codec for file '%s': " - "%s", info->file, av_err2str(ret)); + blog(LOG_WARNING, + "Failed to open video codec for file '%s': " + "%s", + info->file, av_err2str(ret)); return false; } @@ -63,28 +65,30 @@ return false; memset(info, 0, sizeof(struct ffmpeg_image)); - info->file = file; + info->file = file; info->stream_idx = -1; ret = avformat_open_input(&info->fmt_ctx, file, NULL, NULL); if (ret < 0) { - blog(LOG_WARNING, "Failed to open file '%s': %s", - info->file, av_err2str(ret)); + blog(LOG_WARNING, "Failed to open file '%s': %s", info->file, + av_err2str(ret)); return false; } ret = avformat_find_stream_info(info->fmt_ctx, NULL); if (ret < 0) { - blog(LOG_WARNING, "Could not find stream info for file '%s':" - " %s", info->file, av_err2str(ret)); + blog(LOG_WARNING, + "Could not find stream info for file '%s':" + " %s", + info->file, av_err2str(ret)); goto fail; } if (!ffmpeg_image_open_decoder_context(info)) goto fail; - info->cx = info->decoder_ctx->width; - info->cy = info->decoder_ctx->height; + info->cx = info->decoder_ctx->width; + info->cy = info->decoder_ctx->height; info->format = info->decoder_ctx->pix_fmt; return true; @@ -94,18 +98,20 @@ } static bool ffmpeg_image_reformat_frame(struct ffmpeg_image *info, - AVFrame *frame, uint8_t *out, int linesize) + AVFrame *frame, uint8_t *out, + int linesize) { struct SwsContext *sws_ctx = NULL; - int ret = 0; + int ret = 0; if (info->format == AV_PIX_FMT_RGBA || info->format == AV_PIX_FMT_BGRA || info->format == AV_PIX_FMT_BGR0) { if (linesize != frame->linesize[0]) { - int min_line = linesize < frame->linesize[0] ? - linesize : frame->linesize[0]; + int min_line = linesize < frame->linesize[0] + ? linesize + : frame->linesize[0]; for (int y = 0; y < info->cy; y++) memcpy(out + y * linesize, @@ -117,21 +123,23 @@ } else { sws_ctx = sws_getContext(info->cx, info->cy, info->format, - info->cx, info->cy, AV_PIX_FMT_BGRA, - SWS_POINT, NULL, NULL, NULL); + info->cx, info->cy, AV_PIX_FMT_BGRA, + SWS_POINT, NULL, NULL, NULL); if (!sws_ctx) { - blog(LOG_WARNING, "Failed to create scale context " - "for '%s'", info->file); + blog(LOG_WARNING, + "Failed to create scale context " + "for '%s'", + info->file); return false; } - ret = sws_scale(sws_ctx, (const uint8_t *const*)frame->data, + ret = sws_scale(sws_ctx, (const uint8_t *const *)frame->data, frame->linesize, 0, info->cy, &out, &linesize); sws_freeContext(sws_ctx); if (ret < 0) { blog(LOG_WARNING, "sws_scale failed for '%s': %s", - info->file, av_err2str(ret)); + info->file, av_err2str(ret)); return false; } @@ -142,24 +150,24 @@ } static bool ffmpeg_image_decode(struct ffmpeg_image *info, uint8_t *out, - int linesize) + int linesize) { - AVPacket packet = {0}; - bool success = false; - AVFrame *frame = av_frame_alloc(); - int got_frame = 0; - int ret; + AVPacket packet = {0}; + bool success = false; + AVFrame *frame = av_frame_alloc(); + int got_frame = 0; + int ret; if (!frame) { blog(LOG_WARNING, "Failed to create frame data for '%s'", - info->file); + info->file); return false; } ret = av_read_frame(info->fmt_ctx, &packet); if (ret < 0) { blog(LOG_WARNING, "Failed to read image frame from '%s': %s", - info->file, av_err2str(ret)); + info->file, av_err2str(ret)); goto fail; } @@ -175,11 +183,11 @@ ret = 0; #else ret = avcodec_decode_video2(info->decoder_ctx, frame, - &got_frame, &packet); + &got_frame, &packet); #endif if (ret < 0) { blog(LOG_WARNING, "Failed to decode frame for '%s': %s", - info->file, av_err2str(ret)); + info->file, av_err2str(ret)); goto fail; } } @@ -194,27 +202,30 @@ void gs_init_image_deps(void) { +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); +#endif } -void gs_free_image_deps(void) -{ -} +void gs_free_image_deps(void) {} static inline enum gs_color_format convert_format(enum AVPixelFormat format) { switch ((int)format) { - case AV_PIX_FMT_RGBA: return GS_RGBA; - case AV_PIX_FMT_BGRA: return GS_BGRA; - case AV_PIX_FMT_BGR0: return GS_BGRX; + case AV_PIX_FMT_RGBA: + return GS_RGBA; + case AV_PIX_FMT_BGRA: + return GS_BGRA; + case AV_PIX_FMT_BGR0: + return GS_BGRX; } return GS_BGRX; } uint8_t *gs_create_texture_file_data(const char *file, - enum gs_color_format *format, - uint32_t *cx_out, uint32_t *cy_out) + enum gs_color_format *format, + uint32_t *cx_out, uint32_t *cy_out) { struct ffmpeg_image image; uint8_t *data = NULL;
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/graphics-imports.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/graphics-imports.c
Changed
@@ -20,23 +20,25 @@ #include "../util/platform.h" #include "graphics-internal.h" -#define GRAPHICS_IMPORT(func) \ - do { \ - exports->func = os_dlsym(module, #func); \ - if (!exports->func) { \ - success = false; \ - blog(LOG_ERROR, "Could not load function '%s' from " \ - "module '%s'", #func, module_name); \ - } \ +#define GRAPHICS_IMPORT(func) \ + do { \ + exports->func = os_dlsym(module, #func); \ + if (!exports->func) { \ + success = false; \ + blog(LOG_ERROR, \ + "Could not load function '%s' from " \ + "module '%s'", \ + #func, module_name); \ + } \ } while (false) -#define GRAPHICS_IMPORT_OPTIONAL(func) \ - do { \ +#define GRAPHICS_IMPORT_OPTIONAL(func) \ + do { \ exports->func = os_dlsym(module, #func); \ } while (false) bool load_graphics_imports(struct gs_exports *exports, void *module, - const char *module_name) + const char *module_name) { bool success = true; @@ -48,6 +50,7 @@ GRAPHICS_IMPORT(device_destroy); GRAPHICS_IMPORT(device_enter_context); GRAPHICS_IMPORT(device_leave_context); + GRAPHICS_IMPORT(device_get_device_obj); GRAPHICS_IMPORT(device_swapchain_create); GRAPHICS_IMPORT(device_resize); GRAPHICS_IMPORT(device_get_size); @@ -63,6 +66,8 @@ GRAPHICS_IMPORT(device_pixelshader_create); GRAPHICS_IMPORT(device_vertexbuffer_create); GRAPHICS_IMPORT(device_indexbuffer_create); + GRAPHICS_IMPORT(device_timer_create); + GRAPHICS_IMPORT(device_timer_range_create); GRAPHICS_IMPORT(device_get_texture_type); GRAPHICS_IMPORT(device_load_vertexbuffer); GRAPHICS_IMPORT(device_load_indexbuffer); @@ -151,6 +156,15 @@ GRAPHICS_IMPORT(gs_indexbuffer_get_num_indices); GRAPHICS_IMPORT(gs_indexbuffer_get_type); + GRAPHICS_IMPORT(gs_timer_destroy); + GRAPHICS_IMPORT(gs_timer_begin); + GRAPHICS_IMPORT(gs_timer_end); + GRAPHICS_IMPORT(gs_timer_get_data); + GRAPHICS_IMPORT(gs_timer_range_destroy); + GRAPHICS_IMPORT(gs_timer_range_begin); + GRAPHICS_IMPORT(gs_timer_range_end); + GRAPHICS_IMPORT(gs_timer_range_get_data); + GRAPHICS_IMPORT(gs_shader_destroy); GRAPHICS_IMPORT(gs_shader_get_num_params); GRAPHICS_IMPORT(gs_shader_get_param_by_idx);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/graphics-internal.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/graphics-internal.h
Changed
@@ -26,162 +26,180 @@ struct gs_exports { const char *(*device_get_name)(void); int (*device_get_type)(void); - bool (*device_enum_adapters)( - bool (*callback)(void*, const char*, uint32_t), - void*); + bool (*device_enum_adapters)(bool (*callback)(void *, const char *, + uint32_t), + void *); const char *(*device_preprocessor_name)(void); int (*device_create)(gs_device_t **device, uint32_t adapter); void (*device_destroy)(gs_device_t *device); void (*device_enter_context)(gs_device_t *device); void (*device_leave_context)(gs_device_t *device); - gs_swapchain_t *(*device_swapchain_create)(gs_device_t *device, - const struct gs_init_data *data); + void *(*device_get_device_obj)(gs_device_t *device); + gs_swapchain_t *(*device_swapchain_create)( + gs_device_t *device, const struct gs_init_data *data); void (*device_resize)(gs_device_t *device, uint32_t x, uint32_t y); - void (*device_get_size)(const gs_device_t *device, - uint32_t *x, uint32_t *y); + void (*device_get_size)(const gs_device_t *device, uint32_t *x, + uint32_t *y); uint32_t (*device_get_width)(const gs_device_t *device); uint32_t (*device_get_height)(const gs_device_t *device); - gs_texture_t *(*device_texture_create)(gs_device_t *device, - uint32_t width, uint32_t height, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags); - gs_texture_t *(*device_cubetexture_create)(gs_device_t *device, - uint32_t size, enum gs_color_format color_format, - uint32_t levels, const uint8_t **data, uint32_t flags); - gs_texture_t *(*device_voltexture_create)(gs_device_t *device, - uint32_t width, uint32_t height, uint32_t depth, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags); - gs_zstencil_t *(*device_zstencil_create)(gs_device_t *device, - uint32_t width, uint32_t height, - enum gs_zstencil_format format); - gs_stagesurf_t *(*device_stagesurface_create)(gs_device_t *device, - uint32_t width, uint32_t height, - enum gs_color_format color_format); - gs_samplerstate_t *(*device_samplerstate_create)(gs_device_t *device, - const struct gs_sampler_info *info); + gs_texture_t *(*device_texture_create)( + gs_device_t *device, uint32_t width, uint32_t height, + enum gs_color_format color_format, uint32_t levels, + const uint8_t **data, uint32_t flags); + gs_texture_t *(*device_cubetexture_create)( + gs_device_t *device, uint32_t size, + enum gs_color_format color_format, uint32_t levels, + const uint8_t **data, uint32_t flags); + gs_texture_t *(*device_voltexture_create)( + gs_device_t *device, uint32_t width, uint32_t height, + uint32_t depth, enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, uint32_t flags); + gs_zstencil_t *(*device_zstencil_create)( + gs_device_t *device, uint32_t width, uint32_t height, + enum gs_zstencil_format format); + gs_stagesurf_t *(*device_stagesurface_create)( + gs_device_t *device, uint32_t width, uint32_t height, + enum gs_color_format color_format); + gs_samplerstate_t *(*device_samplerstate_create)( + gs_device_t *device, const struct gs_sampler_info *info); gs_shader_t *(*device_vertexshader_create)(gs_device_t *device, - const char *shader, const char *file, - char **error_string); + const char *shader, + const char *file, + char **error_string); gs_shader_t *(*device_pixelshader_create)(gs_device_t *device, - const char *shader, const char *file, - char **error_string); + const char *shader, + const char *file, + char **error_string); gs_vertbuffer_t *(*device_vertexbuffer_create)(gs_device_t *device, - struct gs_vb_data *data, uint32_t flags); + struct gs_vb_data *data, + uint32_t flags); gs_indexbuffer_t *(*device_indexbuffer_create)(gs_device_t *device, - enum gs_index_type type, void *indices, size_t num, - uint32_t flags); + enum gs_index_type type, + void *indices, + size_t num, + uint32_t flags); + gs_timer_t *(*device_timer_create)(gs_device_t *device); + gs_timer_range_t *(*device_timer_range_create)(gs_device_t *device); enum gs_texture_type (*device_get_texture_type)( - const gs_texture_t *texture); + const gs_texture_t *texture); void (*device_load_vertexbuffer)(gs_device_t *device, - gs_vertbuffer_t *vertbuffer); + gs_vertbuffer_t *vertbuffer); void (*device_load_indexbuffer)(gs_device_t *device, - gs_indexbuffer_t *indexbuffer); + gs_indexbuffer_t *indexbuffer); void (*device_load_texture)(gs_device_t *device, gs_texture_t *tex, - int unit); + int unit); void (*device_load_samplerstate)(gs_device_t *device, - gs_samplerstate_t *samplerstate, int unit); + gs_samplerstate_t *samplerstate, + int unit); void (*device_load_vertexshader)(gs_device_t *device, - gs_shader_t *vertshader); + gs_shader_t *vertshader); void (*device_load_pixelshader)(gs_device_t *device, - gs_shader_t *pixelshader); - void (*device_load_default_samplerstate)(gs_device_t *device, - bool b_3d, int unit); + gs_shader_t *pixelshader); + void (*device_load_default_samplerstate)(gs_device_t *device, bool b_3d, + int unit); gs_shader_t *(*device_get_vertex_shader)(const gs_device_t *device); gs_shader_t *(*device_get_pixel_shader)(const gs_device_t *device); gs_texture_t *(*device_get_render_target)(const gs_device_t *device); gs_zstencil_t *(*device_get_zstencil_target)(const gs_device_t *device); void (*device_set_render_target)(gs_device_t *device, gs_texture_t *tex, - gs_zstencil_t *zstencil); + gs_zstencil_t *zstencil); void (*device_set_cube_render_target)(gs_device_t *device, - gs_texture_t *cubetex, int side, gs_zstencil_t *zstencil); + gs_texture_t *cubetex, int side, + gs_zstencil_t *zstencil); void (*device_copy_texture)(gs_device_t *device, gs_texture_t *dst, - gs_texture_t *src); + gs_texture_t *src); void (*device_copy_texture_region)(gs_device_t *device, - gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y, - gs_texture_t *src, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h); + gs_texture_t *dst, uint32_t dst_x, + uint32_t dst_y, gs_texture_t *src, + uint32_t src_x, uint32_t src_y, + uint32_t src_w, uint32_t src_h); void (*device_stage_texture)(gs_device_t *device, gs_stagesurf_t *dst, - gs_texture_t *src); + gs_texture_t *src); void (*device_begin_scene)(gs_device_t *device); void (*device_draw)(gs_device_t *device, enum gs_draw_mode draw_mode, - uint32_t start_vert, uint32_t num_verts); + uint32_t start_vert, uint32_t num_verts); void (*device_end_scene)(gs_device_t *device); void (*device_load_swapchain)(gs_device_t *device, - gs_swapchain_t *swaphchain); + gs_swapchain_t *swaphchain); void (*device_clear)(gs_device_t *device, uint32_t clear_flags, - const struct vec4 *color, float depth, uint8_t stencil); + const struct vec4 *color, float depth, + uint8_t stencil); void (*device_present)(gs_device_t *device); void (*device_flush)(gs_device_t *device); void (*device_set_cull_mode)(gs_device_t *device, - enum gs_cull_mode mode); + enum gs_cull_mode mode); enum gs_cull_mode (*device_get_cull_mode)(const gs_device_t *device); void (*device_enable_blending)(gs_device_t *device, bool enable); void (*device_enable_depth_test)(gs_device_t *device, bool enable); void (*device_enable_stencil_test)(gs_device_t *device, bool enable); void (*device_enable_stencil_write)(gs_device_t *device, bool enable); void (*device_enable_color)(gs_device_t *device, bool red, bool green, - bool blue, bool alpha); + bool blue, bool alpha); void (*device_blend_function)(gs_device_t *device, - enum gs_blend_type src, enum gs_blend_type dest); + enum gs_blend_type src, + enum gs_blend_type dest); void (*device_blend_function_separate)(gs_device_t *device, - enum gs_blend_type src_c, enum gs_blend_type dest_c, - enum gs_blend_type src_a, enum gs_blend_type dest_a); + enum gs_blend_type src_c, + enum gs_blend_type dest_c, + enum gs_blend_type src_a, + enum gs_blend_type dest_a); void (*device_depth_function)(gs_device_t *device, - enum gs_depth_test test); + enum gs_depth_test test); void (*device_stencil_function)(gs_device_t *device, - enum gs_stencil_side side, enum gs_depth_test test); + enum gs_stencil_side side, + enum gs_depth_test test); void (*device_stencil_op)(gs_device_t *device, - enum gs_stencil_side side, - enum gs_stencil_op_type fail, - enum gs_stencil_op_type zfail, - enum gs_stencil_op_type zpass); + enum gs_stencil_side side, + enum gs_stencil_op_type fail, + enum gs_stencil_op_type zfail, + enum gs_stencil_op_type zpass); void (*device_set_viewport)(gs_device_t *device, int x, int y, - int width, int height); + int width, int height); void (*device_get_viewport)(const gs_device_t *device, - struct gs_rect *rect); + struct gs_rect *rect); void (*device_set_scissor_rect)(gs_device_t *device, - const struct gs_rect *rect); + const struct gs_rect *rect); void (*device_ortho)(gs_device_t *device, float left, float right, - float top, float bottom, float znear, float zfar); + float top, float bottom, float znear, float zfar); void (*device_frustum)(gs_device_t *device, float left, float right, - float top, float bottom, float znear, float zfar); + float top, float bottom, float znear, + float zfar); void (*device_projection_push)(gs_device_t *device); void (*device_projection_pop)(gs_device_t *device); - void (*gs_swapchain_destroy)(gs_swapchain_t *swapchain); + void (*gs_swapchain_destroy)(gs_swapchain_t *swapchain); - void (*gs_texture_destroy)(gs_texture_t *tex); + void (*gs_texture_destroy)(gs_texture_t *tex); uint32_t (*gs_texture_get_width)(const gs_texture_t *tex); uint32_t (*gs_texture_get_height)(const gs_texture_t *tex); enum gs_color_format (*gs_texture_get_color_format)( - const gs_texture_t *tex); - bool (*gs_texture_map)(gs_texture_t *tex, uint8_t **ptr, - uint32_t *linesize); - void (*gs_texture_unmap)(gs_texture_t *tex); - bool (*gs_texture_is_rect)(const gs_texture_t *tex); - void *(*gs_texture_get_obj)(const gs_texture_t *tex); - - void (*gs_cubetexture_destroy)(gs_texture_t *cubetex); + const gs_texture_t *tex); + bool (*gs_texture_map)(gs_texture_t *tex, uint8_t **ptr, + uint32_t *linesize); + void (*gs_texture_unmap)(gs_texture_t *tex); + bool (*gs_texture_is_rect)(const gs_texture_t *tex); + void *(*gs_texture_get_obj)(const gs_texture_t *tex); + + void (*gs_cubetexture_destroy)(gs_texture_t *cubetex); uint32_t (*gs_cubetexture_get_size)(const gs_texture_t *cubetex); enum gs_color_format (*gs_cubetexture_get_color_format)( - const gs_texture_t *cubetex); + const gs_texture_t *cubetex); - void (*gs_voltexture_destroy)(gs_texture_t *voltex); + void (*gs_voltexture_destroy)(gs_texture_t *voltex); uint32_t (*gs_voltexture_get_width)(const gs_texture_t *voltex); uint32_t (*gs_voltexture_get_height)(const gs_texture_t *voltex); uint32_t (*gs_voltexture_get_depth)(const gs_texture_t *voltex); enum gs_color_format (*gs_voltexture_get_color_format)( - const gs_texture_t *voltex); + const gs_texture_t *voltex); - void (*gs_stagesurface_destroy)(gs_stagesurf_t *stagesurf); + void (*gs_stagesurface_destroy)(gs_stagesurf_t *stagesurf); uint32_t (*gs_stagesurface_get_width)(const gs_stagesurf_t *stagesurf); uint32_t (*gs_stagesurface_get_height)(const gs_stagesurf_t *stagesurf); enum gs_color_format (*gs_stagesurface_get_color_format)( - const gs_stagesurf_t *stagesurf); - bool (*gs_stagesurface_map)(gs_stagesurf_t *stagesurf, - uint8_t **data, uint32_t *linesize); - void (*gs_stagesurface_unmap)(gs_stagesurf_t *stagesurf); + const gs_stagesurf_t *stagesurf); + bool (*gs_stagesurface_map)(gs_stagesurf_t *stagesurf, uint8_t **data, + uint32_t *linesize); + void (*gs_stagesurface_unmap)(gs_stagesurf_t *stagesurf); void (*gs_zstencil_destroy)(gs_zstencil_t *zstencil); @@ -190,98 +208,113 @@ void (*gs_vertexbuffer_destroy)(gs_vertbuffer_t *vertbuffer); void (*gs_vertexbuffer_flush)(gs_vertbuffer_t *vertbuffer); void (*gs_vertexbuffer_flush_direct)(gs_vertbuffer_t *vertbuffer, - const struct gs_vb_data *data); + const struct gs_vb_data *data); struct gs_vb_data *(*gs_vertexbuffer_get_data)( - const gs_vertbuffer_t *vertbuffer); + const gs_vertbuffer_t *vertbuffer); - void (*gs_indexbuffer_destroy)(gs_indexbuffer_t *indexbuffer); - void (*gs_indexbuffer_flush)(gs_indexbuffer_t *indexbuffer); - void (*gs_indexbuffer_flush_direct)(gs_indexbuffer_t *indexbuffer, - const void *data); - void *(*gs_indexbuffer_get_data)(const gs_indexbuffer_t *indexbuffer); + void (*gs_indexbuffer_destroy)(gs_indexbuffer_t *indexbuffer); + void (*gs_indexbuffer_flush)(gs_indexbuffer_t *indexbuffer); + void (*gs_indexbuffer_flush_direct)(gs_indexbuffer_t *indexbuffer, + const void *data); + void *(*gs_indexbuffer_get_data)(const gs_indexbuffer_t *indexbuffer); size_t (*gs_indexbuffer_get_num_indices)( - const gs_indexbuffer_t *indexbuffer); + const gs_indexbuffer_t *indexbuffer); enum gs_index_type (*gs_indexbuffer_get_type)( - const gs_indexbuffer_t *indexbuffer); + const gs_indexbuffer_t *indexbuffer); + + void (*gs_timer_destroy)(gs_timer_t *timer); + void (*gs_timer_begin)(gs_timer_t *timer); + void (*gs_timer_end)(gs_timer_t *timer); + bool (*gs_timer_get_data)(gs_timer_t *timer, uint64_t *ticks); + void (*gs_timer_range_destroy)(gs_timer_range_t *range); + bool (*gs_timer_range_begin)(gs_timer_range_t *range); + bool (*gs_timer_range_end)(gs_timer_range_t *range); + bool (*gs_timer_range_get_data)(gs_timer_range_t *range, bool *disjoint, + uint64_t *frequency); void (*gs_shader_destroy)(gs_shader_t *shader); int (*gs_shader_get_num_params)(const gs_shader_t *shader); gs_sparam_t *(*gs_shader_get_param_by_idx)(gs_shader_t *shader, - uint32_t param); + uint32_t param); gs_sparam_t *(*gs_shader_get_param_by_name)(gs_shader_t *shader, - const char *name); - gs_sparam_t *(*gs_shader_get_viewproj_matrix)( - const gs_shader_t *shader); + const char *name); + gs_sparam_t *(*gs_shader_get_viewproj_matrix)(const gs_shader_t *shader); gs_sparam_t *(*gs_shader_get_world_matrix)(const gs_shader_t *shader); void (*gs_shader_get_param_info)(const gs_sparam_t *param, - struct gs_shader_param_info *info); + struct gs_shader_param_info *info); void (*gs_shader_set_bool)(gs_sparam_t *param, bool val); void (*gs_shader_set_float)(gs_sparam_t *param, float val); void (*gs_shader_set_int)(gs_sparam_t *param, int val); void (*gs_shader_set_matrix3)(gs_sparam_t *param, - const struct matrix3 *val); + const struct matrix3 *val); void (*gs_shader_set_matrix4)(gs_sparam_t *param, - const struct matrix4 *val); + const struct matrix4 *val); void (*gs_shader_set_vec2)(gs_sparam_t *param, const struct vec2 *val); void (*gs_shader_set_vec3)(gs_sparam_t *param, const struct vec3 *val); void (*gs_shader_set_vec4)(gs_sparam_t *param, const struct vec4 *val); void (*gs_shader_set_texture)(gs_sparam_t *param, gs_texture_t *val); void (*gs_shader_set_val)(gs_sparam_t *param, const void *val, - size_t size); + size_t size); void (*gs_shader_set_default)(gs_sparam_t *param); void (*gs_shader_set_next_sampler)(gs_sparam_t *param, - gs_samplerstate_t *sampler); + gs_samplerstate_t *sampler); bool (*device_nv12_available)(gs_device_t *device); void (*device_debug_marker_begin)(gs_device_t *device, - const char *markername, const float color[4]); + const char *markername, + const float color[4]); void (*device_debug_marker_end)(gs_device_t *device); #ifdef __APPLE__ /* OSX/Cocoa specific functions */ gs_texture_t *(*device_texture_create_from_iosurface)(gs_device_t *dev, - void *iosurf); + void *iosurf); bool (*gs_texture_rebind_iosurface)(gs_texture_t *texture, - void *iosurf); + void *iosurf); #elif _WIN32 bool (*device_gdi_texture_available)(void); bool (*device_shared_texture_available)(void); - bool (*device_get_duplicator_monitor_info)(gs_device_t *device, - int monitor_idx, struct gs_monitor_info *monitor_info); + bool (*device_get_duplicator_monitor_info)( + gs_device_t *device, int monitor_idx, + struct gs_monitor_info *monitor_info); gs_duplicator_t *(*device_duplicator_create)(gs_device_t *device, - int monitor_idx); + int monitor_idx); void (*gs_duplicator_destroy)(gs_duplicator_t *duplicator); bool (*gs_duplicator_update_frame)(gs_duplicator_t *duplicator); gs_texture_t *(*gs_duplicator_get_texture)(gs_duplicator_t *duplicator); gs_texture_t *(*device_texture_create_gdi)(gs_device_t *device, - uint32_t width, uint32_t height); + uint32_t width, + uint32_t height); void *(*gs_texture_get_dc)(gs_texture_t *gdi_tex); void (*gs_texture_release_dc)(gs_texture_t *gdi_tex); gs_texture_t *(*device_texture_open_shared)(gs_device_t *device, - uint32_t handle); + uint32_t handle); uint32_t (*device_texture_get_shared_handle)(gs_texture_t *tex); int (*device_texture_acquire_sync)(gs_texture_t *tex, uint64_t key, - uint32_t ms); + uint32_t ms); int (*device_texture_release_sync)(gs_texture_t *tex, uint64_t key); bool (*device_texture_create_nv12)(gs_device_t *device, - gs_texture_t **tex_y, gs_texture_t **tex_uv, - uint32_t width, uint32_t height, uint32_t flags); + gs_texture_t **tex_y, + gs_texture_t **tex_uv, + uint32_t width, uint32_t height, + uint32_t flags); gs_stagesurf_t *(*device_stagesurface_create_nv12)(gs_device_t *device, - uint32_t width, uint32_t height); + uint32_t width, + uint32_t height); #endif }; struct blend_state { - bool enabled; + bool enabled; enum gs_blend_type src_c; enum gs_blend_type dest_c; enum gs_blend_type src_a; @@ -289,34 +322,34 @@ }; struct graphics_subsystem { - void *module; - gs_device_t *device; - struct gs_exports exports; + void *module; + gs_device_t *device; + struct gs_exports exports; DARRAY(struct gs_rect) viewport_stack; DARRAY(struct matrix4) matrix_stack; - size_t cur_matrix; + size_t cur_matrix; - struct matrix4 projection; - struct gs_effect *cur_effect; + struct matrix4 projection; + struct gs_effect *cur_effect; - gs_vertbuffer_t *sprite_buffer; + gs_vertbuffer_t *sprite_buffer; - bool using_immediate; - struct gs_vb_data *vbd; - gs_vertbuffer_t *immediate_vertbuffer; - DARRAY(struct vec3) verts; - DARRAY(struct vec3) norms; - DARRAY(uint32_t) colors; - DARRAY(struct vec2) texverts[16]; + bool using_immediate; + struct gs_vb_data *vbd; + gs_vertbuffer_t *immediate_vertbuffer; + DARRAY(struct vec3) verts; + DARRAY(struct vec3) norms; + DARRAY(uint32_t) colors; + DARRAY(struct vec2) texverts[16]; - pthread_mutex_t effect_mutex; - struct gs_effect *first_effect; + pthread_mutex_t effect_mutex; + struct gs_effect *first_effect; - pthread_mutex_t mutex; - volatile long ref; + pthread_mutex_t mutex; + volatile long ref; - struct blend_state cur_blend_state; + struct blend_state cur_blend_state; DARRAY(struct blend_state) blend_state_stack; };
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/graphics-magick.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/graphics-magick.c
Changed
@@ -2,7 +2,7 @@ #include "obsconfig.h" #define MAGICKCORE_QUANTUM_DEPTH 16 -#define MAGICKCORE_HDRI_ENABLE 0 +#define MAGICKCORE_HDRI_ENABLE 0 #if LIBOBS_IMAGEMAGICK_DIR_STYLE == LIBOBS_IMAGEMAGICK_DIR_STYLE_6L #include <magick/MagickCore.h> @@ -21,33 +21,34 @@ } uint8_t *gs_create_texture_file_data(const char *file, - enum gs_color_format *format, - uint32_t *cx_out, uint32_t *cy_out) + enum gs_color_format *format, + uint32_t *cx_out, uint32_t *cy_out) { - uint8_t *data = NULL; - ImageInfo *info; + uint8_t *data = NULL; + ImageInfo *info; ExceptionInfo *exception; - Image *image; + Image *image; if (!file || !*file) return NULL; - info = CloneImageInfo(NULL); + info = CloneImageInfo(NULL); exception = AcquireExceptionInfo(); strcpy(info->filename, file); image = ReadImage(info, exception); if (image) { - size_t cx = image->magick_columns; - size_t cy = image->magick_rows; - data = bmalloc(cx * cy * 4); + size_t cx = image->magick_columns; + size_t cy = image->magick_rows; + data = bmalloc(cx * cy * 4); - ExportImagePixels(image, 0, 0, cx, cy, "BGRA", CharPixel, - data, exception); + ExportImagePixels(image, 0, 0, cx, cy, "BGRA", CharPixel, data, + exception); if (exception->severity != UndefinedException) { - blog(LOG_WARNING, "magickcore warning/error getting " - "pixels from file '%s': %s", file, - exception->reason); + blog(LOG_WARNING, + "magickcore warning/error getting " + "pixels from file '%s': %s", + file, exception->reason); bfree(data); data = NULL; } @@ -58,8 +59,10 @@ DestroyImage(image); } else if (exception->severity != UndefinedException) { - blog(LOG_WARNING, "magickcore warning/error reading file " - "'%s': %s", file, exception->reason); + blog(LOG_WARNING, + "magickcore warning/error reading file " + "'%s': %s", + file, exception->reason); } DestroyImageInfo(info);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/graphics.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/graphics.c
Changed
@@ -31,7 +31,7 @@ static THREAD_LOCAL graphics_t *thread_graphics = NULL; static inline bool gs_obj_valid(const void *obj, const char *f, - const char *name) + const char *name) { if (!obj) { blog(LOG_DEBUG, "%s: Null '%s' parameter", f, name); @@ -45,7 +45,7 @@ { if (!thread_graphics) { blog(LOG_DEBUG, "%s: called while not in a graphics context", - f); + f); return false; } @@ -54,22 +54,20 @@ #define ptr_valid(ptr, func) gs_obj_valid(ptr, func, #ptr) -#define gs_valid_p(func, param1) \ - (gs_valid(func) && ptr_valid(param1, func)) +#define gs_valid_p(func, param1) (gs_valid(func) && ptr_valid(param1, func)) #define gs_valid_p2(func, param1, param2) \ - (gs_valid(func) && ptr_valid(param1, func) \ - && ptr_valid(param2, func)) + (gs_valid(func) && ptr_valid(param1, func) && ptr_valid(param2, func)) -#define gs_valid_p3(func, param1, param2, param3) \ - (gs_valid(func) && ptr_valid(param1, func) \ - && ptr_valid(param2, func) && ptr_valid(param3, func)) +#define gs_valid_p3(func, param1, param2, param3) \ + (gs_valid(func) && ptr_valid(param1, func) && \ + ptr_valid(param2, func) && ptr_valid(param3, func)) #define IMMEDIATE_COUNT 512 -void gs_enum_adapters( - bool (*callback)(void *param, const char *name, uint32_t id), - void *param) +void gs_enum_adapters(bool (*callback)(void *param, const char *name, + uint32_t id), + void *param) { graphics_t *graphics = thread_graphics; @@ -92,25 +90,25 @@ extern void gs_free_image_deps(void); bool load_graphics_imports(struct gs_exports *exports, void *module, - const char *module_name); + const char *module_name); static bool graphics_init_immediate_vb(struct graphics_subsystem *graphics) { struct gs_vb_data *vbd; vbd = gs_vbdata_create(); - vbd->num = IMMEDIATE_COUNT; - vbd->points = bmalloc(sizeof(struct vec3)*IMMEDIATE_COUNT); - vbd->normals = bmalloc(sizeof(struct vec3)*IMMEDIATE_COUNT); - vbd->colors = bmalloc(sizeof(uint32_t) *IMMEDIATE_COUNT); + vbd->num = IMMEDIATE_COUNT; + vbd->points = bmalloc(sizeof(struct vec3) * IMMEDIATE_COUNT); + vbd->normals = bmalloc(sizeof(struct vec3) * IMMEDIATE_COUNT); + vbd->colors = bmalloc(sizeof(uint32_t) * IMMEDIATE_COUNT); vbd->num_tex = 1; vbd->tvarray = bmalloc(sizeof(struct gs_tvertarray)); vbd->tvarray[0].width = 2; - vbd->tvarray[0].array = - bmalloc(sizeof(struct vec2) * IMMEDIATE_COUNT); + vbd->tvarray[0].array = bmalloc(sizeof(struct vec2) * IMMEDIATE_COUNT); - graphics->immediate_vertbuffer = graphics->exports. - device_vertexbuffer_create(graphics->device, vbd, GS_DYNAMIC); + graphics->immediate_vertbuffer = + graphics->exports.device_vertexbuffer_create(graphics->device, + vbd, GS_DYNAMIC); if (!graphics->immediate_vertbuffer) return false; @@ -122,18 +120,18 @@ struct gs_vb_data *vbd; vbd = gs_vbdata_create(); - vbd->num = 4; - vbd->points = bmalloc(sizeof(struct vec3) * 4); + vbd->num = 4; + vbd->points = bmalloc(sizeof(struct vec3) * 4); vbd->num_tex = 1; vbd->tvarray = bmalloc(sizeof(struct gs_tvertarray)); vbd->tvarray[0].width = 2; vbd->tvarray[0].array = bmalloc(sizeof(struct vec2) * 4); - memset(vbd->points, 0, sizeof(struct vec3) * 4); + memset(vbd->points, 0, sizeof(struct vec3) * 4); memset(vbd->tvarray[0].array, 0, sizeof(struct vec2) * 4); - graphics->sprite_buffer = graphics->exports. - device_vertexbuffer_create(graphics->device, vbd, GS_DYNAMIC); + graphics->sprite_buffer = graphics->exports.device_vertexbuffer_create( + graphics->device, vbd, GS_DYNAMIC); if (!graphics->sprite_buffer) return false; @@ -158,14 +156,14 @@ if (pthread_mutex_init(&graphics->effect_mutex, NULL) != 0) return false; - graphics->exports.device_blend_function_separate(graphics->device, - GS_BLEND_SRCALPHA, GS_BLEND_INVSRCALPHA, - GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); + graphics->exports.device_blend_function_separate( + graphics->device, GS_BLEND_SRCALPHA, GS_BLEND_INVSRCALPHA, + GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); graphics->cur_blend_state.enabled = true; - graphics->cur_blend_state.src_c = GS_BLEND_SRCALPHA; - graphics->cur_blend_state.dest_c = GS_BLEND_INVSRCALPHA; - graphics->cur_blend_state.src_a = GS_BLEND_ONE; - graphics->cur_blend_state.dest_a = GS_BLEND_INVSRCALPHA; + graphics->cur_blend_state.src_c = GS_BLEND_SRCALPHA; + graphics->cur_blend_state.dest_c = GS_BLEND_INVSRCALPHA; + graphics->cur_blend_state.src_a = GS_BLEND_ONE; + graphics->cur_blend_state.dest_a = GS_BLEND_INVSRCALPHA; graphics->exports.device_leave_context(graphics->device); @@ -188,7 +186,7 @@ } if (!load_graphics_imports(&graphics->exports, graphics->module, - module)) + module)) goto error; errcode = graphics->exports.device_create(&graphics->device, adapter); @@ -231,9 +229,9 @@ } graphics->exports.gs_vertexbuffer_destroy( - graphics->sprite_buffer); + graphics->sprite_buffer); graphics->exports.gs_vertexbuffer_destroy( - graphics->immediate_vertbuffer); + graphics->immediate_vertbuffer); graphics->exports.device_destroy(graphics->device); thread_graphics = NULL; @@ -278,7 +276,7 @@ graphics_t *graphics = thread_graphics; graphics->exports.device_leave_context( - graphics->device); + graphics->device); pthread_mutex_unlock(&graphics->mutex); thread_graphics = NULL; } @@ -290,16 +288,27 @@ return thread_graphics; } +void *gs_get_device_obj(void) +{ + if (!gs_valid("gs_get_device_obj")) + return NULL; + + return thread_graphics->exports.device_get_device_obj( + thread_graphics->device); +} + const char *gs_get_device_name(void) { - return gs_valid("gs_get_device_name") ? - thread_graphics->exports.device_get_name() : NULL; + return gs_valid("gs_get_device_name") + ? thread_graphics->exports.device_get_name() + : NULL; } int gs_get_device_type(void) { - return gs_valid("gs_get_device_type") ? - thread_graphics->exports.device_get_type() : -1; + return gs_valid("gs_get_device_type") + ? thread_graphics->exports.device_get_type() + : -1; } static inline struct matrix4 *top_matrix(graphics_t *graphics) @@ -509,18 +518,18 @@ graphics->vbd = gs_vbdata_create(); } else { graphics->vbd = gs_vertexbuffer_get_data( - graphics->immediate_vertbuffer); + graphics->immediate_vertbuffer); memset(graphics->vbd->colors, 0xFF, - sizeof(uint32_t) * IMMEDIATE_COUNT); + sizeof(uint32_t) * IMMEDIATE_COUNT); - graphics->verts.array = graphics->vbd->points; - graphics->norms.array = graphics->vbd->normals; - graphics->colors.array = graphics->vbd->colors; + graphics->verts.array = graphics->vbd->points; + graphics->norms.array = graphics->vbd->normals; + graphics->colors.array = graphics->vbd->colors; graphics->texverts[0].array = graphics->vbd->tvarray[0].array; - graphics->verts.capacity = IMMEDIATE_COUNT; - graphics->norms.capacity = IMMEDIATE_COUNT; - graphics->colors.capacity = IMMEDIATE_COUNT; + graphics->verts.capacity = IMMEDIATE_COUNT; + graphics->norms.capacity = IMMEDIATE_COUNT; + graphics->colors.capacity = IMMEDIATE_COUNT; graphics->texverts[0].capacity = IMMEDIATE_COUNT; } } @@ -555,21 +564,21 @@ if (graphics->norms.num && (graphics->norms.num != graphics->verts.num)) { blog(LOG_ERROR, "gs_render_stop: normal count does " - "not match vertex count"); + "not match vertex count"); num = min_size(num, graphics->norms.num); } if (graphics->colors.num && (graphics->colors.num != graphics->verts.num)) { blog(LOG_ERROR, "gs_render_stop: color count does " - "not match vertex count"); + "not match vertex count"); num = min_size(num, graphics->colors.num); } if (graphics->texverts[0].num && - (graphics->texverts[0].num != graphics->verts.num)) { + (graphics->texverts[0].num != graphics->verts.num)) { blog(LOG_ERROR, "gs_render_stop: texture vertex count does " - "not match vertex count"); + "not match vertex count"); num = min_size(num, graphics->texverts[0].num); } @@ -613,10 +622,10 @@ if (!graphics->texverts[num_tex].num) break; - graphics->vbd->points = graphics->verts.array; + graphics->vbd->points = graphics->verts.array; graphics->vbd->normals = graphics->norms.array; - graphics->vbd->colors = graphics->colors.array; - graphics->vbd->num = graphics->verts.num; + graphics->vbd->colors = graphics->colors.array; + graphics->vbd->num = graphics->verts.num; graphics->vbd->num_tex = num_tex; if (graphics->vbd->num_tex) { @@ -669,12 +678,13 @@ } static inline bool validvertsize(graphics_t *graphics, size_t num, - const char *name) + const char *name) { if (graphics->using_immediate && num == IMMEDIATE_COUNT) { - blog(LOG_ERROR, "%s: tried to use over %u " - "for immediate rendering", - name, IMMEDIATE_COUNT); + blog(LOG_ERROR, + "%s: tried to use over %u " + "for immediate rendering", + name, IMMEDIATE_COUNT); return false; } @@ -689,7 +699,7 @@ return; if (!validvertsize(graphics, graphics->colors.num, "gs_color")) return; - + da_push_back(graphics->colors, &color); } @@ -735,7 +745,7 @@ return; if (!validvertsize(graphics, graphics->norms.num, "gs_normal")) return; - + da_push_back(graphics->norms, v); } @@ -752,7 +762,7 @@ if (!gs_valid("gs_texcoord2v")) return; if (!validvertsize(graphics, graphics->texverts[unit].num, - "gs_texcoord")) + "gs_texcoord")) return; da_push_back(graphics->texverts[unit], v); @@ -810,7 +820,7 @@ } gs_effect_t *gs_effect_create(const char *effect_string, const char *filename, - char **error_string) + char **error_string) { if (!gs_valid_p("gs_effect_create", effect_string)) return NULL; @@ -826,8 +836,8 @@ success = ep_parse(&parser, effect, effect_string, filename); if (!success) { if (error_string) - *error_string = error_data_buildstring( - &parser.cfp.error_list); + *error_string = + error_data_buildstring(&parser.cfp.error_list); gs_effect_destroy(effect); effect = NULL; } @@ -849,7 +859,7 @@ } gs_shader_t *gs_vertexshader_create_from_file(const char *file, - char **error_string) + char **error_string) { if (!gs_valid_p("gs_vertexshader_create_from_file", file)) return NULL; @@ -859,8 +869,7 @@ file_string = os_quick_read_utf8_file(file); if (!file_string) { - blog(LOG_ERROR, "Could not load vertex shader file '%s'", - file); + blog(LOG_ERROR, "Could not load vertex shader file '%s'", file); return NULL; } @@ -871,7 +880,7 @@ } gs_shader_t *gs_pixelshader_create_from_file(const char *file, - char **error_string) + char **error_string) { char *file_string; gs_shader_t *shader = NULL; @@ -881,8 +890,7 @@ file_string = os_quick_read_utf8_file(file); if (!file_string) { - blog(LOG_ERROR, "Could not load pixel shader file '%s'", - file); + blog(LOG_ERROR, "Could not load pixel shader file '%s'", file); return NULL; } @@ -902,7 +910,7 @@ if (data) { tex = gs_texture_create(cx, cy, format, 1, - (const uint8_t**)&data, 0); + (const uint8_t **)&data, 0); bfree(data); } @@ -910,14 +918,14 @@ } static inline void assign_sprite_rect(float *start, float *end, float size, - bool flip) + bool flip) { if (!flip) { *start = 0.0f; - *end = size; + *end = size; } else { *start = size; - *end = 0.0f; + *end = 0.0f; } } @@ -925,30 +933,30 @@ { if (!flip) { *start = 0.0f; - *end = 1.0f; + *end = 1.0f; } else { *start = 1.0f; - *end = 0.0f; + *end = 0.0f; } } static void build_sprite(struct gs_vb_data *data, float fcx, float fcy, - float start_u, float end_u, float start_v, float end_v) + float start_u, float end_u, float start_v, float end_v) { struct vec2 *tvarray = data->tvarray[0].array; vec3_zero(data->points); - vec3_set(data->points+1, fcx, 0.0f, 0.0f); - vec3_set(data->points+2, 0.0f, fcy, 0.0f); - vec3_set(data->points+3, fcx, fcy, 0.0f); - vec2_set(tvarray, start_u, start_v); - vec2_set(tvarray+1, end_u, start_v); - vec2_set(tvarray+2, start_u, end_v); - vec2_set(tvarray+3, end_u, end_v); + vec3_set(data->points + 1, fcx, 0.0f, 0.0f); + vec3_set(data->points + 2, 0.0f, fcy, 0.0f); + vec3_set(data->points + 3, fcx, fcy, 0.0f); + vec2_set(tvarray, start_u, start_v); + vec2_set(tvarray + 1, end_u, start_v); + vec2_set(tvarray + 2, start_u, end_v); + vec2_set(tvarray + 3, end_u, end_v); } static inline void build_sprite_norm(struct gs_vb_data *data, float fcx, - float fcy, uint32_t flip) + float fcy, uint32_t flip) { float start_u, end_u; float start_v, end_v; @@ -958,47 +966,48 @@ build_sprite(data, fcx, fcy, start_u, end_u, start_v, end_v); } -static inline void build_subsprite_norm(struct gs_vb_data *data, - float fsub_x, float fsub_y, float fsub_cx, float fsub_cy, - float fcx, float fcy, uint32_t flip) +static inline void build_subsprite_norm(struct gs_vb_data *data, float fsub_x, + float fsub_y, float fsub_cx, + float fsub_cy, float fcx, float fcy, + uint32_t flip) { float start_u, end_u; float start_v, end_v; if ((flip & GS_FLIP_U) == 0) { start_u = fsub_x / fcx; - end_u = (fsub_x + fsub_cx) / fcx; + end_u = (fsub_x + fsub_cx) / fcx; } else { start_u = (fsub_x + fsub_cx) / fcx; - end_u = fsub_x / fcx; + end_u = fsub_x / fcx; } if ((flip & GS_FLIP_V) == 0) { start_v = fsub_y / fcy; - end_v = (fsub_y + fsub_cy) / fcy; + end_v = (fsub_y + fsub_cy) / fcy; } else { start_v = (fsub_y + fsub_cy) / fcy; - end_v = fsub_y / fcy; + end_v = fsub_y / fcy; } build_sprite(data, fsub_cx, fsub_cy, start_u, end_u, start_v, end_v); } static inline void build_sprite_rect(struct gs_vb_data *data, gs_texture_t *tex, - float fcx, float fcy, uint32_t flip) + float fcx, float fcy, uint32_t flip) { float start_u, end_u; float start_v, end_v; - float width = (float)gs_texture_get_width(tex); + float width = (float)gs_texture_get_width(tex); float height = (float)gs_texture_get_height(tex); - assign_sprite_rect(&start_u, &end_u, width, (flip & GS_FLIP_U) != 0); + assign_sprite_rect(&start_u, &end_u, width, (flip & GS_FLIP_U) != 0); assign_sprite_rect(&start_v, &end_v, height, (flip & GS_FLIP_V) != 0); build_sprite(data, fcx, fcy, start_u, end_u, start_v, end_v); } void gs_draw_sprite(gs_texture_t *tex, uint32_t flip, uint32_t width, - uint32_t height) + uint32_t height) { graphics_t *graphics = thread_graphics; float fcx, fcy; @@ -1017,7 +1026,7 @@ } } - fcx = width ? (float)width : (float)gs_texture_get_width(tex); + fcx = width ? (float)width : (float)gs_texture_get_width(tex); fcy = height ? (float)height : (float)gs_texture_get_height(tex); data = gs_vertexbuffer_get_data(graphics->sprite_buffer); @@ -1033,9 +1042,8 @@ gs_draw(GS_TRISTRIP, 0, 0); } -void gs_draw_sprite_subregion(gs_texture_t *tex, uint32_t flip, - uint32_t sub_x, uint32_t sub_y, - uint32_t sub_cx, uint32_t sub_cy) +void gs_draw_sprite_subregion(gs_texture_t *tex, uint32_t flip, uint32_t sub_x, + uint32_t sub_y, uint32_t sub_cx, uint32_t sub_cy) { graphics_t *graphics = thread_graphics; float fcx, fcy; @@ -1052,10 +1060,8 @@ fcy = (float)gs_texture_get_height(tex); data = gs_vertexbuffer_get_data(graphics->sprite_buffer); - build_subsprite_norm(data, - (float)sub_x, (float)sub_y, - (float)sub_cx, (float)sub_cy, - fcx, fcy, flip); + build_subsprite_norm(data, (float)sub_x, (float)sub_y, (float)sub_cx, + (float)sub_cy, fcx, fcy, flip); gs_vertexbuffer_flush(graphics->sprite_buffer); gs_load_vertexbuffer(graphics->sprite_buffer); @@ -1065,7 +1071,8 @@ } void gs_draw_cube_backdrop(gs_texture_t *cubetex, const struct quat *rot, - float left, float right, float top, float bottom, float znear) + float left, float right, float top, float bottom, + float znear) { /* TODO */ UNUSED_PARAMETER(cubetex); @@ -1112,8 +1119,8 @@ if (!gs_valid("gs_viewport_push")) return; - struct gs_rect *rect = da_push_back_new( - thread_graphics->viewport_stack); + struct gs_rect *rect = + da_push_back_new(thread_graphics->viewport_stack); gs_get_viewport(rect); } @@ -1132,7 +1139,7 @@ } void gs_texture_set_image(gs_texture_t *tex, const uint8_t *data, - uint32_t linesize, bool flip) + uint32_t linesize, bool flip) { uint8_t *ptr; uint32_t linesize_out; @@ -1151,8 +1158,8 @@ row_copy = (linesize < linesize_out) ? linesize : linesize_out; if (flip) { - for (y = height-1; y >= 0; y--) - memcpy(ptr + (uint32_t)y * linesize_out, + for (y = height - 1; y >= 0; y--) + memcpy(ptr + (uint32_t)y * linesize_out, data + (uint32_t)(height - y - 1) * linesize, row_copy); @@ -1161,16 +1168,15 @@ } else { for (y = 0; y < height; y++) - memcpy(ptr + (uint32_t)y * linesize_out, - data + (uint32_t)y * linesize, - row_copy); + memcpy(ptr + (uint32_t)y * linesize_out, + data + (uint32_t)y * linesize, row_copy); } gs_texture_unmap(tex); } void gs_cubetexture_set_image(gs_texture_t *cubetex, uint32_t side, - const void *data, uint32_t linesize, bool invert) + const void *data, uint32_t linesize, bool invert) { /* TODO */ UNUSED_PARAMETER(cubetex); @@ -1188,14 +1194,14 @@ if (!gs_valid("gs_perspective")) return; - ymax = near * tanf(RAD(angle)*0.5f); + ymax = near * tanf(RAD(angle) * 0.5f); ymin = -ymax; xmin = ymin * aspect; xmax = ymax * aspect; - graphics->exports.device_frustum(graphics->device, xmin, xmax, - ymin, ymax, near, far); + graphics->exports.device_frustum(graphics->device, xmin, xmax, ymin, + ymax, near, far); } void gs_blend_state_push(void) @@ -1221,8 +1227,8 @@ return; gs_enable_blending(state->enabled); - gs_blend_function_separate(state->src_c, state->dest_c, - state->src_a, state->dest_a); + gs_blend_function_separate(state->src_c, state->dest_c, state->src_a, + state->dest_a); da_pop_back(graphics->blend_state_stack); } @@ -1237,13 +1243,13 @@ if (!graphics->cur_blend_state.enabled) gs_enable_blending(true); - if (graphics->cur_blend_state.src_c != GS_BLEND_SRCALPHA || + if (graphics->cur_blend_state.src_c != GS_BLEND_SRCALPHA || graphics->cur_blend_state.dest_c != GS_BLEND_INVSRCALPHA || - graphics->cur_blend_state.src_a != GS_BLEND_ONE || + graphics->cur_blend_state.src_a != GS_BLEND_ONE || graphics->cur_blend_state.dest_a != GS_BLEND_INVSRCALPHA) - gs_blend_function_separate( - GS_BLEND_SRCALPHA, GS_BLEND_INVSRCALPHA, - GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); + gs_blend_function_separate(GS_BLEND_SRCALPHA, + GS_BLEND_INVSRCALPHA, GS_BLEND_ONE, + GS_BLEND_INVSRCALPHA); } /* ------------------------------------------------------------------------- */ @@ -1270,7 +1276,7 @@ new_data.num_backbuffers = 1; return graphics->exports.device_swapchain_create(graphics->device, - &new_data); + &new_data); } void gs_resize(uint32_t x, uint32_t y) @@ -1315,12 +1321,13 @@ static inline bool is_pow2(uint32_t size) { - return size >= 2 && (size & (size-1)) == 0; + return size >= 2 && (size & (size - 1)) == 0; } gs_texture_t *gs_texture_create(uint32_t width, uint32_t height, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags) + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags) { graphics_t *graphics = thread_graphics; bool pow2tex = is_pow2(width) && is_pow2(height); @@ -1331,8 +1338,8 @@ if (uses_mipmaps && !pow2tex) { blog(LOG_WARNING, "Cannot use mipmaps with a " - "non-power-of-two texture. Disabling " - "mipmaps for this texture."); + "non-power-of-two texture. Disabling " + "mipmaps for this texture."); uses_mipmaps = false; flags &= ~GS_BUILD_MIPMAPS; @@ -1341,18 +1348,20 @@ if (uses_mipmaps && flags & GS_RENDER_TARGET) { blog(LOG_WARNING, "Cannot use mipmaps with render targets. " - "Disabling mipmaps for this texture."); + "Disabling mipmaps for this texture."); flags &= ~GS_BUILD_MIPMAPS; levels = 1; } - return graphics->exports.device_texture_create(graphics->device, - width, height, color_format, levels, data, flags); + return graphics->exports.device_texture_create(graphics->device, width, + height, color_format, + levels, data, flags); } gs_texture_t *gs_cubetexture_create(uint32_t size, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags) + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags) { graphics_t *graphics = thread_graphics; bool pow2tex = is_pow2(size); @@ -1363,8 +1372,8 @@ if (uses_mipmaps && !pow2tex) { blog(LOG_WARNING, "Cannot use mipmaps with a " - "non-power-of-two texture. Disabling " - "mipmaps for this texture."); + "non-power-of-two texture. Disabling " + "mipmaps for this texture."); uses_mipmaps = false; flags &= ~GS_BUILD_MIPMAPS; @@ -1373,19 +1382,21 @@ if (uses_mipmaps && flags & GS_RENDER_TARGET) { blog(LOG_WARNING, "Cannot use mipmaps with render targets. " - "Disabling mipmaps for this texture."); + "Disabling mipmaps for this texture."); flags &= ~GS_BUILD_MIPMAPS; levels = 1; - data = NULL; + data = NULL; } - return graphics->exports.device_cubetexture_create(graphics->device, - size, color_format, levels, data, flags); + return graphics->exports.device_cubetexture_create( + graphics->device, size, color_format, levels, data, flags); } gs_texture_t *gs_voltexture_create(uint32_t width, uint32_t height, - uint32_t depth, enum gs_color_format color_format, - uint32_t levels, const uint8_t **data, uint32_t flags) + uint32_t depth, + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags) { graphics_t *graphics = thread_graphics; @@ -1393,32 +1404,33 @@ return NULL; return graphics->exports.device_voltexture_create(graphics->device, - width, height, depth, color_format, levels, data, - flags); + width, height, depth, + color_format, levels, + data, flags); } gs_zstencil_t *gs_zstencil_create(uint32_t width, uint32_t height, - enum gs_zstencil_format format) + enum gs_zstencil_format format) { graphics_t *graphics = thread_graphics; if (!gs_valid("gs_zstencil_create")) return NULL; - return graphics->exports.device_zstencil_create(graphics->device, - width, height, format); + return graphics->exports.device_zstencil_create(graphics->device, width, + height, format); } gs_stagesurf_t *gs_stagesurface_create(uint32_t width, uint32_t height, - enum gs_color_format color_format) + enum gs_color_format color_format) { graphics_t *graphics = thread_graphics; if (!gs_valid("gs_stagesurface_create")) return NULL; - return graphics->exports.device_stagesurface_create(graphics->device, - width, height, color_format); + return graphics->exports.device_stagesurface_create( + graphics->device, width, height, color_format); } gs_samplerstate_t *gs_samplerstate_create(const struct gs_sampler_info *info) @@ -1429,35 +1441,34 @@ return NULL; return graphics->exports.device_samplerstate_create(graphics->device, - info); + info); } gs_shader_t *gs_vertexshader_create(const char *shader, const char *file, - char **error_string) + char **error_string) { graphics_t *graphics = thread_graphics; if (!gs_valid_p("gs_vertexshader_create", shader)) return NULL; - return graphics->exports.device_vertexshader_create(graphics->device, - shader, file, error_string); + return graphics->exports.device_vertexshader_create( + graphics->device, shader, file, error_string); } -gs_shader_t *gs_pixelshader_create(const char *shader, - const char *file, char **error_string) +gs_shader_t *gs_pixelshader_create(const char *shader, const char *file, + char **error_string) { graphics_t *graphics = thread_graphics; if (!gs_valid_p("gs_pixelshader_create", shader)) return NULL; - return graphics->exports.device_pixelshader_create(graphics->device, - shader, file, error_string); + return graphics->exports.device_pixelshader_create( + graphics->device, shader, file, error_string); } -gs_vertbuffer_t *gs_vertexbuffer_create(struct gs_vb_data *data, - uint32_t flags) +gs_vertbuffer_t *gs_vertexbuffer_create(struct gs_vb_data *data, uint32_t flags) { graphics_t *graphics = thread_graphics; @@ -1469,13 +1480,12 @@ new_data->num = data->num; -#define DUP_VAL(val) \ - do { \ - if (data->val) \ - new_data->val = bmemdup(data->val, \ - sizeof(*data->val) * \ - data->num); \ - } while (false) +#define DUP_VAL(val) \ + do { \ + if (data->val) \ + new_data->val = bmemdup( \ + data->val, sizeof(*data->val) * data->num); \ + } while (false) DUP_VAL(points); DUP_VAL(normals); @@ -1486,8 +1496,7 @@ if (data->tvarray && data->num_tex) { new_data->num_tex = data->num_tex; new_data->tvarray = bzalloc( - sizeof(struct gs_tvertarray) * - data->num_tex); + sizeof(struct gs_tvertarray) * data->num_tex); for (size_t i = 0; i < data->num_tex; i++) { struct gs_tvertarray *tv = &data->tvarray[i]; @@ -1496,8 +1505,8 @@ size_t size = tv->width * sizeof(float); new_tv->width = tv->width; - new_tv->array = bmemdup(tv->array, - size * data->num); + new_tv->array = + bmemdup(tv->array, size * data->num); } } @@ -1505,11 +1514,11 @@ } return graphics->exports.device_vertexbuffer_create(graphics->device, - data, flags); + data, flags); } -gs_indexbuffer_t *gs_indexbuffer_create(enum gs_index_type type, - void *indices, size_t num, uint32_t flags) +gs_indexbuffer_t *gs_indexbuffer_create(enum gs_index_type type, void *indices, + size_t num, uint32_t flags) { graphics_t *graphics = thread_graphics; @@ -1521,8 +1530,28 @@ indices = bmemdup(indices, size * num); } - return graphics->exports.device_indexbuffer_create(graphics->device, - type, indices, num, flags); + return graphics->exports.device_indexbuffer_create( + graphics->device, type, indices, num, flags); +} + +gs_timer_t *gs_timer_create() +{ + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_timer_create")) + return NULL; + + return graphics->exports.device_timer_create(graphics->device); +} + +gs_timer_range_t *gs_timer_range_create() +{ + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_timer_range_create")) + return NULL; + + return graphics->exports.device_timer_range_create(graphics->device); } enum gs_texture_type gs_get_texture_type(const gs_texture_t *texture) @@ -1543,7 +1572,7 @@ return; graphics->exports.device_load_vertexbuffer(graphics->device, - vertbuffer); + vertbuffer); } void gs_load_indexbuffer(gs_indexbuffer_t *indexbuffer) @@ -1554,7 +1583,7 @@ return; graphics->exports.device_load_indexbuffer(graphics->device, - indexbuffer); + indexbuffer); } void gs_load_texture(gs_texture_t *tex, int unit) @@ -1575,7 +1604,7 @@ return; graphics->exports.device_load_samplerstate(graphics->device, - samplerstate, unit); + samplerstate, unit); } void gs_load_vertexshader(gs_shader_t *vertshader) @@ -1586,7 +1615,7 @@ return; graphics->exports.device_load_vertexshader(graphics->device, - vertshader); + vertshader); } void gs_load_pixelshader(gs_shader_t *pixelshader) @@ -1597,7 +1626,7 @@ return; graphics->exports.device_load_pixelshader(graphics->device, - pixelshader); + pixelshader); } void gs_load_default_samplerstate(bool b_3d, int unit) @@ -1608,7 +1637,7 @@ return; graphics->exports.device_load_default_samplerstate(graphics->device, - b_3d, unit); + b_3d, unit); } gs_shader_t *gs_get_vertex_shader(void) @@ -1659,19 +1688,19 @@ return; graphics->exports.device_set_render_target(graphics->device, tex, - zstencil); + zstencil); } void gs_set_cube_render_target(gs_texture_t *cubetex, int side, - gs_zstencil_t *zstencil) + gs_zstencil_t *zstencil) { graphics_t *graphics = thread_graphics; if (!gs_valid("gs_set_cube_render_target")) return; - graphics->exports.device_set_cube_render_target(graphics->device, - cubetex, side, zstencil); + graphics->exports.device_set_cube_render_target( + graphics->device, cubetex, side, zstencil); } void gs_copy_texture(gs_texture_t *dst, gs_texture_t *src) @@ -1685,17 +1714,17 @@ } void gs_copy_texture_region(gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y, - gs_texture_t *src, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h) + gs_texture_t *src, uint32_t src_x, uint32_t src_y, + uint32_t src_w, uint32_t src_h) { graphics_t *graphics = thread_graphics; if (!gs_valid_p("gs_copy_texture_region", dst)) return; - graphics->exports.device_copy_texture_region(graphics->device, - dst, dst_x, dst_y, - src, src_x, src_y, src_w, src_h); + graphics->exports.device_copy_texture_region(graphics->device, dst, + dst_x, dst_y, src, src_x, + src_y, src_w, src_h); } void gs_stage_texture(gs_stagesurf_t *dst, gs_texture_t *src) @@ -1719,15 +1748,15 @@ } void gs_draw(enum gs_draw_mode draw_mode, uint32_t start_vert, - uint32_t num_verts) + uint32_t num_verts) { graphics_t *graphics = thread_graphics; if (!gs_valid("gs_draw")) return; - graphics->exports.device_draw(graphics->device, draw_mode, - start_vert, num_verts); + graphics->exports.device_draw(graphics->device, draw_mode, start_vert, + num_verts); } void gs_end_scene(void) @@ -1751,7 +1780,7 @@ } void gs_clear(uint32_t clear_flags, const struct vec4 *color, float depth, - uint8_t stencil) + uint8_t stencil) { graphics_t *graphics = thread_graphics; @@ -1759,7 +1788,7 @@ return; graphics->exports.device_clear(graphics->device, clear_flags, color, - depth, stencil); + depth, stencil); } void gs_present(void) @@ -1851,7 +1880,7 @@ return; graphics->exports.device_enable_color(graphics->device, red, green, - blue, alpha); + blue, alpha); } void gs_blend_function(enum gs_blend_type src, enum gs_blend_type dest) @@ -1861,28 +1890,29 @@ if (!gs_valid("gs_blend_function")) return; - graphics->cur_blend_state.src_c = src; + graphics->cur_blend_state.src_c = src; graphics->cur_blend_state.dest_c = dest; - graphics->cur_blend_state.src_a = src; + graphics->cur_blend_state.src_a = src; graphics->cur_blend_state.dest_a = dest; graphics->exports.device_blend_function(graphics->device, src, dest); } -void gs_blend_function_separate( - enum gs_blend_type src_c, enum gs_blend_type dest_c, - enum gs_blend_type src_a, enum gs_blend_type dest_a) +void gs_blend_function_separate(enum gs_blend_type src_c, + enum gs_blend_type dest_c, + enum gs_blend_type src_a, + enum gs_blend_type dest_a) { graphics_t *graphics = thread_graphics; if (!gs_valid("gs_blend_function_separate")) return; - graphics->cur_blend_state.src_c = src_c; + graphics->cur_blend_state.src_c = src_c; graphics->cur_blend_state.dest_c = dest_c; - graphics->cur_blend_state.src_a = src_a; + graphics->cur_blend_state.src_a = src_a; graphics->cur_blend_state.dest_a = dest_a; - graphics->exports.device_blend_function_separate(graphics->device, - src_c, dest_c, src_a, dest_a); + graphics->exports.device_blend_function_separate( + graphics->device, src_c, dest_c, src_a, dest_a); } void gs_depth_function(enum gs_depth_test test) @@ -1906,7 +1936,7 @@ } void gs_stencil_op(enum gs_stencil_side side, enum gs_stencil_op_type fail, - enum gs_stencil_op_type zfail, enum gs_stencil_op_type zpass) + enum gs_stencil_op_type zfail, enum gs_stencil_op_type zpass) { graphics_t *graphics = thread_graphics; @@ -1914,7 +1944,7 @@ return; graphics->exports.device_stencil_op(graphics->device, side, fail, zfail, - zpass); + zpass); } void gs_set_viewport(int x, int y, int width, int height) @@ -1925,7 +1955,7 @@ return; graphics->exports.device_set_viewport(graphics->device, x, y, width, - height); + height); } void gs_get_viewport(struct gs_rect *rect) @@ -1949,7 +1979,7 @@ } void gs_ortho(float left, float right, float top, float bottom, float znear, - float zfar) + float zfar) { graphics_t *graphics = thread_graphics; @@ -1957,7 +1987,7 @@ return; graphics->exports.device_ortho(graphics->device, left, right, top, - bottom, znear, zfar); + bottom, znear, zfar); } void gs_frustum(float left, float right, float top, float bottom, float znear, @@ -1969,7 +1999,7 @@ return; graphics->exports.device_frustum(graphics->device, left, right, top, - bottom, znear, zfar); + bottom, znear, zfar); } void gs_projection_push(void) @@ -2067,7 +2097,7 @@ } void gs_shader_get_param_info(const gs_sparam_t *param, - struct gs_shader_param_info *info) + struct gs_shader_param_info *info) { graphics_t *graphics = thread_graphics; @@ -2304,8 +2334,8 @@ return graphics->exports.gs_cubetexture_get_size(cubetex); } -enum gs_color_format gs_cubetexture_get_color_format( - const gs_texture_t *cubetex) +enum gs_color_format +gs_cubetexture_get_color_format(const gs_texture_t *cubetex) { graphics_t *graphics = thread_graphics; @@ -2399,8 +2429,8 @@ return graphics->exports.gs_stagesurface_get_height(stagesurf); } -enum gs_color_format gs_stagesurface_get_color_format( - const gs_stagesurf_t *stagesurf) +enum gs_color_format +gs_stagesurface_get_color_format(const gs_stagesurf_t *stagesurf) { graphics_t *graphics = thread_graphics; @@ -2411,7 +2441,7 @@ } bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data, - uint32_t *linesize) + uint32_t *linesize) { graphics_t *graphics = thread_graphics; @@ -2472,13 +2502,12 @@ } void gs_vertexbuffer_flush_direct(gs_vertbuffer_t *vertbuffer, - const struct gs_vb_data *data) + const struct gs_vb_data *data) { if (!gs_valid_p2("gs_vertexbuffer_flush_direct", vertbuffer, data)) return; - thread_graphics->exports.gs_vertexbuffer_flush_direct(vertbuffer, - data); + thread_graphics->exports.gs_vertexbuffer_flush_direct(vertbuffer, data); } struct gs_vb_data *gs_vertexbuffer_get_data(const gs_vertbuffer_t *vertbuffer) @@ -2501,7 +2530,7 @@ graphics->exports.gs_indexbuffer_destroy(indexbuffer); } -void gs_indexbuffer_flush(gs_indexbuffer_t *indexbuffer) +void gs_indexbuffer_flush(gs_indexbuffer_t *indexbuffer) { if (!gs_valid_p("gs_indexbuffer_flush", indexbuffer)) return; @@ -2509,8 +2538,8 @@ thread_graphics->exports.gs_indexbuffer_flush(indexbuffer); } -void gs_indexbuffer_flush_direct(gs_indexbuffer_t *indexbuffer, - const void *data) +void gs_indexbuffer_flush_direct(gs_indexbuffer_t *indexbuffer, + const void *data) { if (!gs_valid_p2("gs_indexbuffer_flush_direct", indexbuffer, data)) return; @@ -2518,7 +2547,7 @@ thread_graphics->exports.gs_indexbuffer_flush_direct(indexbuffer, data); } -void *gs_indexbuffer_get_data(const gs_indexbuffer_t *indexbuffer) +void *gs_indexbuffer_get_data(const gs_indexbuffer_t *indexbuffer) { if (!gs_valid_p("gs_indexbuffer_get_data", indexbuffer)) return NULL; @@ -2532,7 +2561,7 @@ return 0; return thread_graphics->exports.gs_indexbuffer_get_num_indices( - indexbuffer); + indexbuffer); } enum gs_index_type gs_indexbuffer_get_type(const gs_indexbuffer_t *indexbuffer) @@ -2543,6 +2572,96 @@ return thread_graphics->exports.gs_indexbuffer_get_type(indexbuffer); } +void gs_timer_destroy(gs_timer_t *timer) +{ + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_timer_destroy")) + return; + if (!timer) + return; + + graphics->exports.gs_timer_destroy(timer); +} + +void gs_timer_begin(gs_timer_t *timer) +{ + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_timer_begin")) + return; + if (!timer) + return; + + graphics->exports.gs_timer_begin(timer); +} + +void gs_timer_end(gs_timer_t *timer) +{ + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_timer_end")) + return; + if (!timer) + return; + + graphics->exports.gs_timer_end(timer); +} + +bool gs_timer_get_data(gs_timer_t *timer, uint64_t *ticks) +{ + if (!gs_valid_p2("gs_timer_get_data", timer, ticks)) + return false; + + return thread_graphics->exports.gs_timer_get_data(timer, ticks); +} + +void gs_timer_range_destroy(gs_timer_range_t *range) +{ + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_timer_range_destroy")) + return; + if (!range) + return; + + graphics->exports.gs_timer_range_destroy(range); +} + +void gs_timer_range_begin(gs_timer_range_t *range) +{ + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_timer_range_begin")) + return; + if (!range) + return; + + graphics->exports.gs_timer_range_begin(range); +} + +void gs_timer_range_end(gs_timer_range_t *range) +{ + graphics_t *graphics = thread_graphics; + + if (!gs_valid("gs_timer_range_end")) + return; + if (!range) + return; + + graphics->exports.gs_timer_range_end(range); +} + +bool gs_timer_range_get_data(gs_timer_range_t *range, bool *disjoint, + uint64_t *frequency) +{ + if (!gs_valid_p2("gs_timer_range_get_data", disjoint, frequency)) + return false; + + return thread_graphics->exports.gs_timer_range_get_data(range, disjoint, + frequency); +} + bool gs_nv12_available(void) { if (!gs_valid("gs_nv12_available")) @@ -2552,11 +2671,10 @@ return false; return thread_graphics->exports.device_nv12_available( - thread_graphics->device); + thread_graphics->device); } -void gs_debug_marker_begin(const float color[4], - const char *markername) +void gs_debug_marker_begin(const float color[4], const char *markername) { if (!gs_valid("gs_debug_marker_begin")) return; @@ -2565,12 +2683,10 @@ markername = "(null)"; thread_graphics->exports.device_debug_marker_begin( - thread_graphics->device, markername, - color); + thread_graphics->device, markername, color); } -void gs_debug_marker_begin_format(const float color[4], - const char *format, ...) +void gs_debug_marker_begin_format(const float color[4], const char *format, ...) { if (!gs_valid("gs_debug_marker_begin")) return; @@ -2582,8 +2698,7 @@ vsnprintf(markername, sizeof(markername), format, args); va_end(args); thread_graphics->exports.device_debug_marker_begin( - thread_graphics->device, markername, - color); + thread_graphics->device, markername, color); } else { gs_debug_marker_begin(color, NULL); } @@ -2595,7 +2710,7 @@ return; thread_graphics->exports.device_debug_marker_end( - thread_graphics->device); + thread_graphics->device); } #ifdef __APPLE__ @@ -2611,7 +2726,7 @@ return NULL; return graphics->exports.device_texture_create_from_iosurface( - graphics->device, iosurf); + graphics->device, iosurf); } bool gs_texture_rebind_iosurface(gs_texture_t *texture, void *iosurf) @@ -2645,7 +2760,7 @@ } bool gs_get_duplicator_monitor_info(int monitor_idx, - struct gs_monitor_info *monitor_info) + struct gs_monitor_info *monitor_info) { if (!gs_valid_p("gs_get_duplicator_monitor_info", monitor_info)) return false; @@ -2653,8 +2768,7 @@ return false; return thread_graphics->exports.device_get_duplicator_monitor_info( - thread_graphics->device, monitor_idx, - monitor_info); + thread_graphics->device, monitor_idx, monitor_info); } gs_duplicator_t *gs_duplicator_create(int monitor_idx) @@ -2665,7 +2779,7 @@ return NULL; return thread_graphics->exports.device_duplicator_create( - thread_graphics->device, monitor_idx); + thread_graphics->device, monitor_idx); } void gs_duplicator_destroy(gs_duplicator_t *duplicator) @@ -2710,7 +2824,7 @@ if (graphics->exports.device_texture_create_gdi) return graphics->exports.device_texture_create_gdi( - graphics->device, width, height); + graphics->device, width, height); return NULL; } @@ -2741,7 +2855,7 @@ if (graphics->exports.device_texture_open_shared) return graphics->exports.device_texture_open_shared( - graphics->device, handle); + graphics->device, handle); return NULL; } @@ -2763,8 +2877,8 @@ return -1; if (graphics->exports.device_texture_acquire_sync) - return graphics->exports.device_texture_acquire_sync(tex, - key, ms); + return graphics->exports.device_texture_acquire_sync(tex, key, + ms); return -1; } @@ -2780,7 +2894,7 @@ } bool gs_texture_create_nv12(gs_texture_t **tex_y, gs_texture_t **tex_uv, - uint32_t width, uint32_t height, uint32_t flags) + uint32_t width, uint32_t height, uint32_t flags) { graphics_t *graphics = thread_graphics; bool success = false; @@ -2796,15 +2910,14 @@ if (graphics->exports.device_texture_create_nv12) { success = graphics->exports.device_texture_create_nv12( - graphics->device, tex_y, tex_uv, - width, height, flags); + graphics->device, tex_y, tex_uv, width, height, flags); if (success) return true; } *tex_y = gs_texture_create(width, height, GS_R8, 1, NULL, flags); *tex_uv = gs_texture_create(width / 2, height / 2, GS_R8G8, 1, NULL, - flags); + flags); if (!*tex_y || !*tex_uv) { if (*tex_y) @@ -2834,7 +2947,7 @@ if (graphics->exports.device_stagesurface_create_nv12) return graphics->exports.device_stagesurface_create_nv12( - graphics->device, width, height); + graphics->device, width, height); return NULL; }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/graphics.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/graphics.h
Changed
@@ -50,7 +50,7 @@ GS_LINES, GS_LINESTRIP, GS_TRIS, - GS_TRISTRIP + GS_TRISTRIP, }; enum gs_color_format { @@ -80,18 +80,18 @@ GS_Z16, GS_Z24_S8, GS_Z32F, - GS_Z32F_S8X24 + GS_Z32F_S8X24, }; enum gs_index_type { GS_UNSIGNED_SHORT, - GS_UNSIGNED_LONG + GS_UNSIGNED_LONG, }; enum gs_cull_mode { GS_BACK, GS_FRONT, - GS_NEITHER + GS_NEITHER, }; enum gs_blend_type { @@ -105,7 +105,7 @@ GS_BLEND_INVDSTCOLOR, GS_BLEND_DSTALPHA, GS_BLEND_INVDSTALPHA, - GS_BLEND_SRCALPHASAT + GS_BLEND_SRCALPHASAT, }; enum gs_depth_test { @@ -116,13 +116,13 @@ GS_GEQUAL, GS_GREATER, GS_NOTEQUAL, - GS_ALWAYS + GS_ALWAYS, }; enum gs_stencil_side { - GS_STENCIL_FRONT=1, + GS_STENCIL_FRONT = 1, GS_STENCIL_BACK, - GS_STENCIL_BOTH + GS_STENCIL_BOTH, }; enum gs_stencil_op_type { @@ -131,7 +131,7 @@ GS_REPLACE, GS_INCR, GS_DECR, - GS_INVERT + GS_INVERT, }; enum gs_cube_sides { @@ -140,7 +140,7 @@ GS_POSITIVE_Y, GS_NEGATIVE_Y, GS_POSITIVE_Z, - GS_NEGATIVE_Z + GS_NEGATIVE_Z, }; enum gs_sample_filter { @@ -160,13 +160,13 @@ GS_ADDRESS_WRAP, GS_ADDRESS_MIRROR, GS_ADDRESS_BORDER, - GS_ADDRESS_MIRRORONCE + GS_ADDRESS_MIRRORONCE, }; enum gs_texture_type { GS_TEXTURE_2D, GS_TEXTURE_3D, - GS_TEXTURE_CUBE + GS_TEXTURE_CUBE, }; struct gs_monitor_info { @@ -195,7 +195,7 @@ static inline struct gs_vb_data *gs_vbdata_create(void) { - return (struct gs_vb_data*)bzalloc(sizeof(struct gs_vb_data)); + return (struct gs_vb_data *)bzalloc(sizeof(struct gs_vb_data)); } static inline void gs_vbdata_destroy(struct gs_vb_data *data) @@ -247,6 +247,7 @@ struct gs_sampler_state; struct gs_shader; struct gs_swap_chain; +struct gs_timer; struct gs_texrender; struct gs_shader_param; struct gs_effect; @@ -256,22 +257,24 @@ struct gs_device; struct graphics_subsystem; -typedef struct gs_texture gs_texture_t; -typedef struct gs_stage_surface gs_stagesurf_t; -typedef struct gs_zstencil_buffer gs_zstencil_t; -typedef struct gs_vertex_buffer gs_vertbuffer_t; -typedef struct gs_index_buffer gs_indexbuffer_t; -typedef struct gs_sampler_state gs_samplerstate_t; -typedef struct gs_swap_chain gs_swapchain_t; -typedef struct gs_texture_render gs_texrender_t; -typedef struct gs_shader gs_shader_t; -typedef struct gs_shader_param gs_sparam_t; -typedef struct gs_effect gs_effect_t; +typedef struct gs_texture gs_texture_t; +typedef struct gs_stage_surface gs_stagesurf_t; +typedef struct gs_zstencil_buffer gs_zstencil_t; +typedef struct gs_vertex_buffer gs_vertbuffer_t; +typedef struct gs_index_buffer gs_indexbuffer_t; +typedef struct gs_sampler_state gs_samplerstate_t; +typedef struct gs_swap_chain gs_swapchain_t; +typedef struct gs_timer gs_timer_t; +typedef struct gs_timer_range gs_timer_range_t; +typedef struct gs_texture_render gs_texrender_t; +typedef struct gs_shader gs_shader_t; +typedef struct gs_shader_param gs_sparam_t; +typedef struct gs_effect gs_effect_t; typedef struct gs_effect_technique gs_technique_t; -typedef struct gs_effect_pass gs_epass_t; -typedef struct gs_effect_param gs_eparam_t; -typedef struct gs_device gs_device_t; -typedef struct graphics_subsystem graphics_t; +typedef struct gs_effect_pass gs_epass_t; +typedef struct gs_effect_param gs_eparam_t; +typedef struct gs_device gs_device_t; +typedef struct graphics_subsystem graphics_t; /* --------------------------------------------------- * shader functions @@ -308,20 +311,22 @@ EXPORT int gs_shader_get_num_params(const gs_shader_t *shader); EXPORT gs_sparam_t *gs_shader_get_param_by_idx(gs_shader_t *shader, - uint32_t param); + uint32_t param); EXPORT gs_sparam_t *gs_shader_get_param_by_name(gs_shader_t *shader, - const char *name); + const char *name); EXPORT gs_sparam_t *gs_shader_get_viewproj_matrix(const gs_shader_t *shader); EXPORT gs_sparam_t *gs_shader_get_world_matrix(const gs_shader_t *shader); EXPORT void gs_shader_get_param_info(const gs_sparam_t *param, - struct gs_shader_param_info *info); + struct gs_shader_param_info *info); EXPORT void gs_shader_set_bool(gs_sparam_t *param, bool val); EXPORT void gs_shader_set_float(gs_sparam_t *param, float val); EXPORT void gs_shader_set_int(gs_sparam_t *param, int val); -EXPORT void gs_shader_set_matrix3(gs_sparam_t *param, const struct matrix3 *val); -EXPORT void gs_shader_set_matrix4(gs_sparam_t *param, const struct matrix4 *val); +EXPORT void gs_shader_set_matrix3(gs_sparam_t *param, + const struct matrix3 *val); +EXPORT void gs_shader_set_matrix4(gs_sparam_t *param, + const struct matrix4 *val); EXPORT void gs_shader_set_vec2(gs_sparam_t *param, const struct vec2 *val); EXPORT void gs_shader_set_vec3(gs_sparam_t *param, const struct vec3 *val); EXPORT void gs_shader_set_vec4(gs_sparam_t *param, const struct vec4 *val); @@ -329,7 +334,7 @@ EXPORT void gs_shader_set_val(gs_sparam_t *param, const void *val, size_t size); EXPORT void gs_shader_set_default(gs_sparam_t *param); EXPORT void gs_shader_set_next_sampler(gs_sparam_t *param, - gs_samplerstate_t *sampler); + gs_samplerstate_t *sampler); #endif /* --------------------------------------------------- @@ -359,32 +364,33 @@ EXPORT void gs_effect_destroy(gs_effect_t *effect); EXPORT gs_technique_t *gs_effect_get_technique(const gs_effect_t *effect, - const char *name); + const char *name); -EXPORT gs_technique_t *gs_effect_get_current_technique( - const gs_effect_t *effect); +EXPORT gs_technique_t * +gs_effect_get_current_technique(const gs_effect_t *effect); EXPORT size_t gs_technique_begin(gs_technique_t *technique); EXPORT void gs_technique_end(gs_technique_t *technique); EXPORT bool gs_technique_begin_pass(gs_technique_t *technique, size_t pass); EXPORT bool gs_technique_begin_pass_by_name(gs_technique_t *technique, - const char *name); + const char *name); EXPORT void gs_technique_end_pass(gs_technique_t *technique); EXPORT gs_epass_t *gs_technique_get_pass_by_idx(const gs_technique_t *technique, - size_t pass); -EXPORT gs_epass_t *gs_technique_get_pass_by_name( - const gs_technique_t *technique, const char *name); + size_t pass); +EXPORT gs_epass_t * +gs_technique_get_pass_by_name(const gs_technique_t *technique, + const char *name); EXPORT size_t gs_effect_get_num_params(const gs_effect_t *effect); EXPORT gs_eparam_t *gs_effect_get_param_by_idx(const gs_effect_t *effect, - size_t param); + size_t param); EXPORT gs_eparam_t *gs_effect_get_param_by_name(const gs_effect_t *effect, - const char *name); + const char *name); EXPORT size_t gs_param_get_num_annotations(const gs_eparam_t *param); EXPORT gs_eparam_t *gs_param_get_annotation_by_idx(const gs_eparam_t *param, - size_t annotation); + size_t annotation); EXPORT gs_eparam_t *gs_param_get_annotation_by_name(const gs_eparam_t *param, - const char *name); + const char *name); /** Helper function to simplify effect usage. Use with a while loop that * contains drawing functions. Automatically handles techniques, passes, and @@ -399,14 +405,14 @@ #ifndef SWIG EXPORT void gs_effect_get_param_info(const gs_eparam_t *param, - struct gs_effect_param_info *info); + struct gs_effect_param_info *info); #endif EXPORT void gs_effect_set_bool(gs_eparam_t *param, bool val); EXPORT void gs_effect_set_float(gs_eparam_t *param, float val); EXPORT void gs_effect_set_int(gs_eparam_t *param, int val); EXPORT void gs_effect_set_matrix4(gs_eparam_t *param, - const struct matrix4 *val); + const struct matrix4 *val); EXPORT void gs_effect_set_vec2(gs_eparam_t *param, const struct vec2 *val); EXPORT void gs_effect_set_vec3(gs_eparam_t *param, const struct vec3 *val); EXPORT void gs_effect_set_vec4(gs_eparam_t *param, const struct vec4 *val); @@ -418,7 +424,7 @@ EXPORT size_t gs_effect_get_default_val_size(gs_eparam_t *param); EXPORT void *gs_effect_get_default_val(gs_eparam_t *param); EXPORT void gs_effect_set_next_sampler(gs_eparam_t *param, - gs_samplerstate_t *sampler); + gs_samplerstate_t *sampler); EXPORT void gs_effect_set_color(gs_eparam_t *param, uint32_t argb); @@ -427,10 +433,10 @@ * --------------------------------------------------- */ EXPORT gs_texrender_t *gs_texrender_create(enum gs_color_format format, - enum gs_zstencil_format zsformat); + enum gs_zstencil_format zsformat); EXPORT void gs_texrender_destroy(gs_texrender_t *texrender); EXPORT bool gs_texrender_begin(gs_texrender_t *texrender, uint32_t cx, - uint32_t cy); + uint32_t cy); EXPORT void gs_texrender_end(gs_texrender_t *texrender); EXPORT void gs_texrender_reset(gs_texrender_t *texrender); EXPORT gs_texture_t *gs_texrender_get_texture(const gs_texrender_t *texrender); @@ -439,60 +445,62 @@ * graphics subsystem * --------------------------------------------------- */ -#define GS_BUILD_MIPMAPS (1<<0) -#define GS_DYNAMIC (1<<1) -#define GS_RENDER_TARGET (1<<2) -#define GS_GL_DUMMYTEX (1<<3) /**<< texture with no allocated texture data */ -#define GS_DUP_BUFFER (1<<4) /**<< do not pass buffer ownership when +#define GS_BUILD_MIPMAPS (1 << 0) +#define GS_DYNAMIC (1 << 1) +#define GS_RENDER_TARGET (1 << 2) +#define GS_GL_DUMMYTEX (1 << 3) /**<< texture with no allocated texture data */ +#define GS_DUP_BUFFER \ + (1 << 4) /**<< do not pass buffer ownership when * creating a vertex/index buffer */ -#define GS_SHARED_TEX (1<<5) -#define GS_SHARED_KM_TEX (1<<6) +#define GS_SHARED_TEX (1 << 5) +#define GS_SHARED_KM_TEX (1 << 6) /* ---------------- */ /* global functions */ -#define GS_SUCCESS 0 -#define GS_ERROR_FAIL -1 +#define GS_SUCCESS 0 +#define GS_ERROR_FAIL -1 #define GS_ERROR_MODULE_NOT_FOUND -2 -#define GS_ERROR_NOT_SUPPORTED -3 +#define GS_ERROR_NOT_SUPPORTED -3 struct gs_window { #if defined(_WIN32) - void *hwnd; + void *hwnd; #elif defined(__APPLE__) - __unsafe_unretained id view; + __unsafe_unretained id view; #elif defined(__linux__) || defined(__FreeBSD__) /* I'm not sure how portable defining id to uint32_t is. */ uint32_t id; - void* display; + void *display; #endif }; struct gs_init_data { - struct gs_window window; - uint32_t cx, cy; - uint32_t num_backbuffers; - enum gs_color_format format; + struct gs_window window; + uint32_t cx, cy; + uint32_t num_backbuffers; + enum gs_color_format format; enum gs_zstencil_format zsformat; - uint32_t adapter; + uint32_t adapter; }; -#define GS_DEVICE_OPENGL 1 +#define GS_DEVICE_OPENGL 1 #define GS_DEVICE_DIRECT3D_11 2 EXPORT const char *gs_get_device_name(void); EXPORT int gs_get_device_type(void); -EXPORT void gs_enum_adapters( - bool (*callback)(void *param, const char *name, uint32_t id), - void *param); +EXPORT void gs_enum_adapters(bool (*callback)(void *param, const char *name, + uint32_t id), + void *param); EXPORT int gs_create(graphics_t **graphics, const char *module, - uint32_t adapter); + uint32_t adapter); EXPORT void gs_destroy(graphics_t *graphics); EXPORT void gs_enter_context(graphics_t *graphics); EXPORT void gs_leave_context(void); EXPORT graphics_t *gs_get_context(void); +EXPORT void *gs_get_device_obj(void); EXPORT void gs_matrix_push(void); EXPORT void gs_matrix_pop(void); @@ -527,21 +535,22 @@ EXPORT gs_effect_t *gs_get_effect(void); EXPORT gs_effect_t *gs_effect_create_from_file(const char *file, - char **error_string); + char **error_string); EXPORT gs_effect_t *gs_effect_create(const char *effect_string, - const char *filename, char **error_string); + const char *filename, char **error_string); EXPORT gs_shader_t *gs_vertexshader_create_from_file(const char *file, - char **error_string); + char **error_string); EXPORT gs_shader_t *gs_pixelshader_create_from_file(const char *file, - char **error_string); + char **error_string); EXPORT gs_texture_t *gs_texture_create_from_file(const char *file); EXPORT uint8_t *gs_create_texture_file_data(const char *file, - enum gs_color_format *format, uint32_t *cx, uint32_t *cy); + enum gs_color_format *format, + uint32_t *cx, uint32_t *cy); -#define GS_FLIP_U (1<<0) -#define GS_FLIP_V (1<<1) +#define GS_FLIP_U (1 << 0) +#define GS_FLIP_V (1 << 1) /** * Draws a 2D sprite @@ -551,13 +560,15 @@ * axis with GS_FLIP_U and GS_FLIP_V. */ EXPORT void gs_draw_sprite(gs_texture_t *tex, uint32_t flip, uint32_t width, - uint32_t height); + uint32_t height); EXPORT void gs_draw_sprite_subregion(gs_texture_t *tex, uint32_t flip, - uint32_t x, uint32_t y, uint32_t cx, uint32_t cy); + uint32_t x, uint32_t y, uint32_t cx, + uint32_t cy); EXPORT void gs_draw_cube_backdrop(gs_texture_t *cubetex, const struct quat *rot, - float left, float right, float top, float bottom, float znear); + float left, float right, float top, + float bottom, float znear); /** sets the viewport to current swap chain size */ EXPORT void gs_reset_viewport(void); @@ -571,9 +582,10 @@ EXPORT void gs_viewport_pop(void); EXPORT void gs_texture_set_image(gs_texture_t *tex, const uint8_t *data, - uint32_t linesize, bool invert); + uint32_t linesize, bool invert); EXPORT void gs_cubetexture_set_image(gs_texture_t *cubetex, uint32_t side, - const void *data, uint32_t linesize, bool invert); + const void *data, uint32_t linesize, + bool invert); EXPORT void gs_perspective(float fovy, float aspect, float znear, float zfar); @@ -592,33 +604,41 @@ EXPORT uint32_t gs_get_height(void); EXPORT gs_texture_t *gs_texture_create(uint32_t width, uint32_t height, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags); -EXPORT gs_texture_t *gs_cubetexture_create(uint32_t size, - enum gs_color_format color_format, uint32_t levels, - const uint8_t **data, uint32_t flags); + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags); +EXPORT gs_texture_t * +gs_cubetexture_create(uint32_t size, enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, uint32_t flags); EXPORT gs_texture_t *gs_voltexture_create(uint32_t width, uint32_t height, - uint32_t depth, enum gs_color_format color_format, - uint32_t levels, const uint8_t **data, uint32_t flags); + uint32_t depth, + enum gs_color_format color_format, + uint32_t levels, const uint8_t **data, + uint32_t flags); EXPORT gs_zstencil_t *gs_zstencil_create(uint32_t width, uint32_t height, - enum gs_zstencil_format format); + enum gs_zstencil_format format); -EXPORT gs_stagesurf_t *gs_stagesurface_create(uint32_t width, uint32_t height, - enum gs_color_format color_format); +EXPORT gs_stagesurf_t * +gs_stagesurface_create(uint32_t width, uint32_t height, + enum gs_color_format color_format); -EXPORT gs_samplerstate_t *gs_samplerstate_create( - const struct gs_sampler_info *info); +EXPORT gs_samplerstate_t * +gs_samplerstate_create(const struct gs_sampler_info *info); -EXPORT gs_shader_t *gs_vertexshader_create(const char *shader, - const char *file, char **error_string); -EXPORT gs_shader_t *gs_pixelshader_create(const char *shader, - const char *file, char **error_string); +EXPORT gs_shader_t *gs_vertexshader_create(const char *shader, const char *file, + char **error_string); +EXPORT gs_shader_t *gs_pixelshader_create(const char *shader, const char *file, + char **error_string); EXPORT gs_vertbuffer_t *gs_vertexbuffer_create(struct gs_vb_data *data, - uint32_t flags); + uint32_t flags); EXPORT gs_indexbuffer_t *gs_indexbuffer_create(enum gs_index_type type, - void *indices, size_t num, uint32_t flags); + void *indices, size_t num, + uint32_t flags); + +EXPORT gs_timer_t *gs_timer_create(); +EXPORT gs_timer_range_t *gs_timer_range_create(); EXPORT enum gs_texture_type gs_get_texture_type(const gs_texture_t *texture); @@ -634,32 +654,32 @@ EXPORT gs_shader_t *gs_get_vertex_shader(void); EXPORT gs_shader_t *gs_get_pixel_shader(void); -EXPORT gs_texture_t *gs_get_render_target(void); +EXPORT gs_texture_t *gs_get_render_target(void); EXPORT gs_zstencil_t *gs_get_zstencil_target(void); EXPORT void gs_set_render_target(gs_texture_t *tex, gs_zstencil_t *zstencil); EXPORT void gs_set_cube_render_target(gs_texture_t *cubetex, int side, - gs_zstencil_t *zstencil); + gs_zstencil_t *zstencil); EXPORT void gs_copy_texture(gs_texture_t *dst, gs_texture_t *src); -EXPORT void gs_copy_texture_region( - gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y, - gs_texture_t *src, uint32_t src_x, uint32_t src_y, - uint32_t src_w, uint32_t src_h); +EXPORT void gs_copy_texture_region(gs_texture_t *dst, uint32_t dst_x, + uint32_t dst_y, gs_texture_t *src, + uint32_t src_x, uint32_t src_y, + uint32_t src_w, uint32_t src_h); EXPORT void gs_stage_texture(gs_stagesurf_t *dst, gs_texture_t *src); EXPORT void gs_begin_scene(void); EXPORT void gs_draw(enum gs_draw_mode draw_mode, uint32_t start_vert, - uint32_t num_verts); + uint32_t num_verts); EXPORT void gs_end_scene(void); -#define GS_CLEAR_COLOR (1<<0) -#define GS_CLEAR_DEPTH (1<<1) -#define GS_CLEAR_STENCIL (1<<2) +#define GS_CLEAR_COLOR (1 << 0) +#define GS_CLEAR_DEPTH (1 << 1) +#define GS_CLEAR_STENCIL (1 << 2) EXPORT void gs_load_swapchain(gs_swapchain_t *swapchain); EXPORT void gs_clear(uint32_t clear_flags, const struct vec4 *color, - float depth, uint8_t stencil); + float depth, uint8_t stencil); EXPORT void gs_present(void); EXPORT void gs_flush(void); @@ -673,109 +693,119 @@ EXPORT void gs_enable_color(bool red, bool green, bool blue, bool alpha); EXPORT void gs_blend_function(enum gs_blend_type src, enum gs_blend_type dest); -EXPORT void gs_blend_function_separate( - enum gs_blend_type src_c, enum gs_blend_type dest_c, - enum gs_blend_type src_a, enum gs_blend_type dest_a); +EXPORT void gs_blend_function_separate(enum gs_blend_type src_c, + enum gs_blend_type dest_c, + enum gs_blend_type src_a, + enum gs_blend_type dest_a); EXPORT void gs_depth_function(enum gs_depth_test test); EXPORT void gs_stencil_function(enum gs_stencil_side side, - enum gs_depth_test test); + enum gs_depth_test test); EXPORT void gs_stencil_op(enum gs_stencil_side side, - enum gs_stencil_op_type fail, - enum gs_stencil_op_type zfail, - enum gs_stencil_op_type zpass); + enum gs_stencil_op_type fail, + enum gs_stencil_op_type zfail, + enum gs_stencil_op_type zpass); EXPORT void gs_set_viewport(int x, int y, int width, int height); EXPORT void gs_get_viewport(struct gs_rect *rect); EXPORT void gs_set_scissor_rect(const struct gs_rect *rect); EXPORT void gs_ortho(float left, float right, float top, float bottom, - float znear, float zfar); + float znear, float zfar); EXPORT void gs_frustum(float left, float right, float top, float bottom, - float znear, float zfar); + float znear, float zfar); EXPORT void gs_projection_push(void); EXPORT void gs_projection_pop(void); -EXPORT void gs_swapchain_destroy(gs_swapchain_t *swapchain); +EXPORT void gs_swapchain_destroy(gs_swapchain_t *swapchain); -EXPORT void gs_texture_destroy(gs_texture_t *tex); +EXPORT void gs_texture_destroy(gs_texture_t *tex); EXPORT uint32_t gs_texture_get_width(const gs_texture_t *tex); EXPORT uint32_t gs_texture_get_height(const gs_texture_t *tex); -EXPORT enum gs_color_format gs_texture_get_color_format( - const gs_texture_t *tex); -EXPORT bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr, - uint32_t *linesize); -EXPORT void gs_texture_unmap(gs_texture_t *tex); +EXPORT enum gs_color_format +gs_texture_get_color_format(const gs_texture_t *tex); +EXPORT bool gs_texture_map(gs_texture_t *tex, uint8_t **ptr, + uint32_t *linesize); +EXPORT void gs_texture_unmap(gs_texture_t *tex); /** special-case function (GL only) - specifies whether the texture is a * GL_TEXTURE_RECTANGLE type, which doesn't use normalized texture * coordinates, doesn't support mipmapping, and requires address clamping */ -EXPORT bool gs_texture_is_rect(const gs_texture_t *tex); +EXPORT bool gs_texture_is_rect(const gs_texture_t *tex); /** * Gets a pointer to the context-specific object associated with the texture. * For example, for GL, this is a GLuint*. For D3D11, ID3D11Texture2D*. */ -EXPORT void *gs_texture_get_obj(gs_texture_t *tex); +EXPORT void *gs_texture_get_obj(gs_texture_t *tex); -EXPORT void gs_cubetexture_destroy(gs_texture_t *cubetex); +EXPORT void gs_cubetexture_destroy(gs_texture_t *cubetex); EXPORT uint32_t gs_cubetexture_get_size(const gs_texture_t *cubetex); -EXPORT enum gs_color_format gs_cubetexture_get_color_format( - const gs_texture_t *cubetex); +EXPORT enum gs_color_format +gs_cubetexture_get_color_format(const gs_texture_t *cubetex); -EXPORT void gs_voltexture_destroy(gs_texture_t *voltex); +EXPORT void gs_voltexture_destroy(gs_texture_t *voltex); EXPORT uint32_t gs_voltexture_get_width(const gs_texture_t *voltex); EXPORT uint32_t gs_voltexture_get_height(const gs_texture_t *voltex); EXPORT uint32_t gs_voltexture_get_depth(const gs_texture_t *voltex); -EXPORT enum gs_color_format gs_voltexture_get_color_format( - const gs_texture_t *voltex); +EXPORT enum gs_color_format +gs_voltexture_get_color_format(const gs_texture_t *voltex); -EXPORT void gs_stagesurface_destroy(gs_stagesurf_t *stagesurf); +EXPORT void gs_stagesurface_destroy(gs_stagesurf_t *stagesurf); EXPORT uint32_t gs_stagesurface_get_width(const gs_stagesurf_t *stagesurf); EXPORT uint32_t gs_stagesurface_get_height(const gs_stagesurf_t *stagesurf); -EXPORT enum gs_color_format gs_stagesurface_get_color_format( - const gs_stagesurf_t *stagesurf); -EXPORT bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data, - uint32_t *linesize); -EXPORT void gs_stagesurface_unmap(gs_stagesurf_t *stagesurf); - -EXPORT void gs_zstencil_destroy(gs_zstencil_t *zstencil); - -EXPORT void gs_samplerstate_destroy(gs_samplerstate_t *samplerstate); - -EXPORT void gs_vertexbuffer_destroy(gs_vertbuffer_t *vertbuffer); -EXPORT void gs_vertexbuffer_flush(gs_vertbuffer_t *vertbuffer); -EXPORT void gs_vertexbuffer_flush_direct(gs_vertbuffer_t *vertbuffer, - const struct gs_vb_data *data); -EXPORT struct gs_vb_data *gs_vertexbuffer_get_data( - const gs_vertbuffer_t *vertbuffer); - -EXPORT void gs_indexbuffer_destroy(gs_indexbuffer_t *indexbuffer); -EXPORT void gs_indexbuffer_flush(gs_indexbuffer_t *indexbuffer); -EXPORT void gs_indexbuffer_flush_direct(gs_indexbuffer_t *indexbuffer, - const void *data); -EXPORT void *gs_indexbuffer_get_data(const gs_indexbuffer_t *indexbuffer); -EXPORT size_t gs_indexbuffer_get_num_indices( - const gs_indexbuffer_t *indexbuffer); -EXPORT enum gs_index_type gs_indexbuffer_get_type( - const gs_indexbuffer_t *indexbuffer); - -EXPORT bool gs_nv12_available(void); +EXPORT enum gs_color_format +gs_stagesurface_get_color_format(const gs_stagesurf_t *stagesurf); +EXPORT bool gs_stagesurface_map(gs_stagesurf_t *stagesurf, uint8_t **data, + uint32_t *linesize); +EXPORT void gs_stagesurface_unmap(gs_stagesurf_t *stagesurf); + +EXPORT void gs_zstencil_destroy(gs_zstencil_t *zstencil); + +EXPORT void gs_samplerstate_destroy(gs_samplerstate_t *samplerstate); + +EXPORT void gs_vertexbuffer_destroy(gs_vertbuffer_t *vertbuffer); +EXPORT void gs_vertexbuffer_flush(gs_vertbuffer_t *vertbuffer); +EXPORT void gs_vertexbuffer_flush_direct(gs_vertbuffer_t *vertbuffer, + const struct gs_vb_data *data); +EXPORT struct gs_vb_data * +gs_vertexbuffer_get_data(const gs_vertbuffer_t *vertbuffer); + +EXPORT void gs_indexbuffer_destroy(gs_indexbuffer_t *indexbuffer); +EXPORT void gs_indexbuffer_flush(gs_indexbuffer_t *indexbuffer); +EXPORT void gs_indexbuffer_flush_direct(gs_indexbuffer_t *indexbuffer, + const void *data); +EXPORT void *gs_indexbuffer_get_data(const gs_indexbuffer_t *indexbuffer); +EXPORT size_t +gs_indexbuffer_get_num_indices(const gs_indexbuffer_t *indexbuffer); +EXPORT enum gs_index_type +gs_indexbuffer_get_type(const gs_indexbuffer_t *indexbuffer); + +EXPORT void gs_timer_destroy(gs_timer_t *timer); +EXPORT void gs_timer_begin(gs_timer_t *timer); +EXPORT void gs_timer_end(gs_timer_t *timer); +EXPORT bool gs_timer_get_data(gs_timer_t *timer, uint64_t *ticks); +EXPORT void gs_timer_range_destroy(gs_timer_range_t *timer); +EXPORT void gs_timer_range_begin(gs_timer_range_t *range); +EXPORT void gs_timer_range_end(gs_timer_range_t *range); +EXPORT bool gs_timer_range_get_data(gs_timer_range_t *range, bool *disjoint, + uint64_t *frequency); + +EXPORT bool gs_nv12_available(void); #define GS_USE_DEBUG_MARKERS 0 #if GS_USE_DEBUG_MARKERS -static const float GS_DEBUG_COLOR_DEFAULT[] = { 0.5f, 0.5f, 0.5f, 1.0f }; -static const float GS_DEBUG_COLOR_RENDER_VIDEO[] = { 0.0f, 0.5f, 0.0f, 1.0f }; -static const float GS_DEBUG_COLOR_MAIN_TEXTURE[] = { 0.0f, 0.25f, 0.0f, 1.0f }; -static const float GS_DEBUG_COLOR_DISPLAY[] = { 0.0f, 0.5f, 0.5f, 1.0f }; -static const float GS_DEBUG_COLOR_SOURCE[] = { 0.0f, 0.5f, 5.0f, 1.0f }; -static const float GS_DEBUG_COLOR_ITEM[] = { 0.5f, 0.0f, 0.0f, 1.0f }; -static const float GS_DEBUG_COLOR_ITEM_TEXTURE[] = { 0.25f, 0.0f, 0.0f, 1.0f }; -static const float GS_DEBUG_COLOR_CONVERT_FORMAT[] = { 0.5f, 0.5f, 0.0f, 1.0f }; +static const float GS_DEBUG_COLOR_DEFAULT[] = {0.5f, 0.5f, 0.5f, 1.0f}; +static const float GS_DEBUG_COLOR_RENDER_VIDEO[] = {0.0f, 0.5f, 0.0f, 1.0f}; +static const float GS_DEBUG_COLOR_MAIN_TEXTURE[] = {0.0f, 0.25f, 0.0f, 1.0f}; +static const float GS_DEBUG_COLOR_DISPLAY[] = {0.0f, 0.5f, 0.5f, 1.0f}; +static const float GS_DEBUG_COLOR_SOURCE[] = {0.0f, 0.5f, 5.0f, 1.0f}; +static const float GS_DEBUG_COLOR_ITEM[] = {0.5f, 0.0f, 0.0f, 1.0f}; +static const float GS_DEBUG_COLOR_ITEM_TEXTURE[] = {0.25f, 0.0f, 0.0f, 1.0f}; +static const float GS_DEBUG_COLOR_CONVERT_FORMAT[] = {0.5f, 0.5f, 0.0f, 1.0f}; #define GS_DEBUG_MARKER_BEGIN(color, markername) \ - gs_debug_marker_begin(color, markername) + gs_debug_marker_begin(color, markername) #define GS_DEBUG_MARKER_BEGIN_FORMAT(color, format, ...) \ - gs_debug_marker_begin_format(color, format, \ - __VA_ARGS__) + gs_debug_marker_begin_format(color, format, __VA_ARGS__) #define GS_DEBUG_MARKER_END() gs_debug_marker_end() #else #define GS_DEBUG_MARKER_BEGIN(color, markername) ((void)0) @@ -783,19 +813,17 @@ #define GS_DEBUG_MARKER_END() ((void)0) #endif -EXPORT void gs_debug_marker_begin(const float color[4], - const char *markername); -EXPORT void gs_debug_marker_begin_format(const float color[4], - const char *format, ...); -EXPORT void gs_debug_marker_end(void); +EXPORT void gs_debug_marker_begin(const float color[4], const char *markername); +EXPORT void gs_debug_marker_begin_format(const float color[4], + const char *format, ...); +EXPORT void gs_debug_marker_end(void); #ifdef __APPLE__ /** platform specific function for creating (GL_TEXTURE_RECTANGLE) textures * from shared surface resources */ EXPORT gs_texture_t *gs_texture_create_from_iosurface(void *iosurf); -EXPORT bool gs_texture_rebind_iosurface(gs_texture_t *texture, - void *iosurf); +EXPORT bool gs_texture_rebind_iosurface(gs_texture_t *texture, void *iosurf); #elif _WIN32 @@ -809,8 +837,9 @@ * Gets information about the monitor at the specific index, returns false * when there is no monitor at the specified index */ -EXPORT bool gs_get_duplicator_monitor_info(int monitor_idx, - struct gs_monitor_info *monitor_info); +EXPORT bool +gs_get_duplicator_monitor_info(int monitor_idx, + struct gs_monitor_info *monitor_info); /** creates a windows 8+ output duplicator (monitor capture) */ EXPORT gs_duplicator_t *gs_duplicator_create(int monitor_idx); @@ -828,16 +857,17 @@ /** creates a windows shared texture from a texture handle */ EXPORT gs_texture_t *gs_texture_open_shared(uint32_t handle); -#define GS_INVALID_HANDLE (uint32_t)-1 +#define GS_INVALID_HANDLE (uint32_t) - 1 EXPORT uint32_t gs_texture_get_shared_handle(gs_texture_t *tex); -#define GS_WAIT_INFINITE (uint32_t)-1 +#define GS_WAIT_INFINITE (uint32_t) - 1 /** * acquires a lock on a keyed mutex texture. * returns -1 on generic failure, ETIMEDOUT if timed out */ -EXPORT int gs_texture_acquire_sync(gs_texture_t *tex, uint64_t key, uint32_t ms); +EXPORT int gs_texture_acquire_sync(gs_texture_t *tex, uint64_t key, + uint32_t ms); /** * releases a lock on a keyed mutex texture to another device. @@ -846,10 +876,11 @@ EXPORT int gs_texture_release_sync(gs_texture_t *tex, uint64_t key); EXPORT bool gs_texture_create_nv12(gs_texture_t **tex_y, gs_texture_t **tex_uv, - uint32_t width, uint32_t height, uint32_t flags); + uint32_t width, uint32_t height, + uint32_t flags); -EXPORT gs_stagesurf_t *gs_stagesurface_create_nv12( - uint32_t width, uint32_t height); +EXPORT gs_stagesurf_t *gs_stagesurface_create_nv12(uint32_t width, + uint32_t height); #endif @@ -858,25 +889,44 @@ static inline uint32_t gs_get_format_bpp(enum gs_color_format format) { switch (format) { - case GS_A8: return 8; - case GS_R8: return 8; - case GS_RGBA: return 32; - case GS_BGRX: return 32; - case GS_BGRA: return 32; - case GS_R10G10B10A2: return 32; - case GS_RGBA16: return 64; - case GS_R16: return 16; - case GS_RGBA16F: return 64; - case GS_RGBA32F: return 128; - case GS_RG16F: return 32; - case GS_RG32F: return 64; - case GS_R16F: return 16; - case GS_R32F: return 32; - case GS_DXT1: return 4; - case GS_DXT3: return 8; - case GS_DXT5: return 8; - case GS_R8G8: return 16; - case GS_UNKNOWN: return 0; + case GS_A8: + return 8; + case GS_R8: + return 8; + case GS_RGBA: + return 32; + case GS_BGRX: + return 32; + case GS_BGRA: + return 32; + case GS_R10G10B10A2: + return 32; + case GS_RGBA16: + return 64; + case GS_R16: + return 16; + case GS_RGBA16F: + return 64; + case GS_RGBA32F: + return 128; + case GS_RG16F: + return 32; + case GS_RG32F: + return 64; + case GS_R16F: + return 16; + case GS_R32F: + return 32; + case GS_DXT1: + return 4; + case GS_DXT3: + return 8; + case GS_DXT5: + return 8; + case GS_R8G8: + return 16; + case GS_UNKNOWN: + return 0; } return 0;
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/image-file.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/image-file.c
Changed
@@ -41,7 +41,7 @@ static unsigned char *bi_def_bitmap_get_buffer(void *bitmap) { - return (unsigned char*)bitmap; + return (unsigned char *)bitmap; } static void bi_def_bitmap_destroy(void *bitmap) @@ -56,11 +56,12 @@ static inline int get_full_decoded_gif_size(gs_image_file_t *image) { - return image->gif.width * image->gif.height * 4 * image->gif.frame_count; + return image->gif.width * image->gif.height * 4 * + image->gif.frame_count; } static inline void *alloc_mem(gs_image_file_t *image, uint64_t *mem_usage, - size_t size) + size_t size) { UNUSED_PARAMETER(image); @@ -70,7 +71,7 @@ } static bool init_animated_gif(gs_image_file_t *image, const char *path, - uint64_t *mem_usage) + uint64_t *mem_usage) { bool is_animated_gif = true; gif_result result; @@ -107,24 +108,26 @@ do { result = gif_initialise(&image->gif, size, image->gif_data); if (result < 0) { - blog(LOG_WARNING, "Failed to initialize gif '%s', " - "possible file corruption", path); + blog(LOG_WARNING, + "Failed to initialize gif '%s', " + "possible file corruption", + path); goto fail; } } while (result != GIF_OK); if (image->gif.width > 4096 || image->gif.height > 4096) { blog(LOG_WARNING, "Bad texture dimensions (%dx%d) in '%s'", - image->gif.width, image->gif.height, path); + image->gif.width, image->gif.height, path); goto fail; } max_size = (uint64_t)image->gif.width * (uint64_t)image->gif.height * - (uint64_t)image->gif.frame_count * 4LLU; + (uint64_t)image->gif.frame_count * 4LLU; if ((uint64_t)get_full_decoded_gif_size(image) != max_size) { blog(LOG_WARNING, "Gif '%s' overflowed maximum pointer size", - path); + path); goto fail; } @@ -132,15 +135,18 @@ if (image->is_animated_gif) { gif_decode_frame(&image->gif, 0); - image->animation_frame_cache = alloc_mem(image, mem_usage, - image->gif.frame_count * sizeof(uint8_t*)); - image->animation_frame_data = alloc_mem(image, mem_usage, - get_full_decoded_gif_size(image)); + image->animation_frame_cache = + alloc_mem(image, mem_usage, + image->gif.frame_count * sizeof(uint8_t *)); + image->animation_frame_data = alloc_mem( + image, mem_usage, get_full_decoded_gif_size(image)); for (unsigned int i = 0; i < image->gif.frame_count; i++) { if (gif_decode_frame(&image->gif, i) != GIF_OK) - blog(LOG_WARNING, "Couldn't decode frame %u " - "of '%s'", i, path); + blog(LOG_WARNING, + "Couldn't decode frame %u " + "of '%s'", + i, path); } gif_decode_frame(&image->gif, 0); @@ -174,7 +180,7 @@ } static void gs_image_file_init_internal(gs_image_file_t *image, - const char *file, uint64_t *mem_usage) + const char *file, uint64_t *mem_usage) { size_t len; @@ -193,12 +199,12 @@ return; } - image->texture_data = gs_create_texture_file_data(file, - &image->format, &image->cx, &image->cy); + image->texture_data = gs_create_texture_file_data( + file, &image->format, &image->cx, &image->cy); if (mem_usage) { *mem_usage += image->cx * image->cy * - gs_get_format_bpp(image->format) / 8; + gs_get_format_bpp(image->format) / 8; } image->loaded = !!image->texture_data; @@ -245,14 +251,13 @@ if (image->is_animated_gif) { image->texture = gs_texture_create( - image->cx, image->cy, image->format, 1, - (const uint8_t**)&image->gif.frame_image, - GS_DYNAMIC); + image->cx, image->cy, image->format, 1, + (const uint8_t **)&image->gif.frame_image, GS_DYNAMIC); } else { image->texture = gs_texture_create( - image->cx, image->cy, image->format, 1, - (const uint8_t**)&image->texture_data, 0); + image->cx, image->cy, image->format, 1, + (const uint8_t **)&image->texture_data, 0); bfree(image->texture_data); image->texture_data = NULL; } @@ -267,7 +272,7 @@ } static inline int calculate_new_frame(gs_image_file_t *image, - uint64_t elapsed_time_ns, int loops) + uint64_t elapsed_time_ns, int loops) { int new_frame = image->cur_frame; @@ -297,8 +302,9 @@ int last_frame; /* if looped, decode frame 0 */ - last_frame = (new_frame < image->last_decoded_frame) ? - 0 : image->last_decoded_frame + 1; + last_frame = (new_frame < image->last_decoded_frame) + ? 0 + : image->last_decoded_frame + 1; /* decode missed frames */ for (int i = last_frame; i < new_frame; i++) { @@ -309,14 +315,13 @@ /* decode actual desired frame */ if (gif_decode_frame(&image->gif, new_frame) == GIF_OK) { size_t pos = new_frame * image->gif.width * - image->gif.height * 4; + image->gif.height * 4; image->animation_frame_cache[new_frame] = image->animation_frame_data + pos; memcpy(image->animation_frame_cache[new_frame], - image->gif.frame_image, - image->gif.width * - image->gif.height * 4); + image->gif.frame_image, + image->gif.width * image->gif.height * 4); image->last_decoded_frame = new_frame; } @@ -337,8 +342,8 @@ loops = 0; if (!loops || image->cur_loop < loops) { - int new_frame = calculate_new_frame(image, elapsed_time_ns, - loops); + int new_frame = + calculate_new_frame(image, elapsed_time_ns, loops); if (new_frame != image->cur_frame) { decode_new_frame(image, new_frame); @@ -358,6 +363,6 @@ decode_new_frame(image, image->cur_frame); gs_texture_set_image(image->texture, - image->animation_frame_cache[image->cur_frame], - image->gif.width * 4, false); + image->animation_frame_cache[image->cur_frame], + image->gif.width * 4, false); }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/image-file.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/image-file.h
Changed
@@ -59,7 +59,7 @@ EXPORT void gs_image_file_init_texture(gs_image_file_t *image); EXPORT bool gs_image_file_tick(gs_image_file_t *image, - uint64_t elapsed_time_ns); + uint64_t elapsed_time_ns); EXPORT void gs_image_file_update_texture(gs_image_file_t *image); EXPORT void gs_image_file2_init(gs_image_file2_t *if2, const char *file); @@ -76,7 +76,7 @@ } static inline bool gs_image_file2_tick(gs_image_file2_t *if2, - uint64_t elapsed_time_ns) + uint64_t elapsed_time_ns) { return gs_image_file_tick(&if2->image, elapsed_time_ns); }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/input.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/input.h
Changed
@@ -23,123 +23,123 @@ extern "C" { #endif -#define KBC_ESCAPE 0x0 -#define KBC_1 0x1 -#define KBC_2 0x2 -#define KBC_3 0x3 -#define KBC_4 0x4 -#define KBC_5 0x5 -#define KBC_6 0x6 -#define KBC_7 0x7 -#define KBC_8 0x8 -#define KBC_9 0x9 -#define KBC_0 0xA -#define KBC_MINUS 0xB -#define KBC_EQUALS 0xC -#define KBC_BACK 0xD -#define KBC_TAB 0xE -#define KBC_Q 0xF -#define KBC_W 0x10 -#define KBC_E 0x11 -#define KBC_R 0x12 -#define KBC_T 0x13 -#define KBC_Y 0x14 -#define KBC_U 0x15 -#define KBC_I 0x16 -#define KBC_O 0x17 -#define KBC_P 0x18 -#define KBC_LBRACKET 0x19 -#define KBC_RBRACKET 0x1A -#define KBC_RETURN 0x1B -#define KBC_LCONTROL 0x1C -#define KBC_A 0x1D -#define KBC_S 0x1E -#define KBC_D 0x1F -#define KBC_F 0x20 -#define KBC_G 0x21 -#define KBC_H 0x22 -#define KBC_J 0x23 -#define KBC_K 0x24 -#define KBC_L 0x25 -#define KBC_SEMICOLON 0x26 -#define KBC_APOSTROPHE 0x27 -#define KBC_TILDE 0x28 -#define KBC_LSHIFT 0x29 -#define KBC_BACKSLASH 0x2A -#define KBC_Z 0x2B -#define KBC_X 0x2C -#define KBC_C 0x2D -#define KBC_V 0x2E -#define KBC_B 0x2F -#define KBC_N 0x30 -#define KBC_M 0x31 -#define KBC_COMMA 0x32 -#define KBC_PERIOD 0x33 -#define KBC_SLASH 0x34 -#define KBC_RSHIFT 0x35 -#define KBC_MULTIPLY 0x36 -#define KBC_LALT 0x37 -#define KBC_SPACE 0x38 -#define KBC_CAPSLOCK 0x39 -#define KBC_F1 0x3A -#define KBC_F2 0x3B -#define KBC_F3 0x3C -#define KBC_F4 0x3D -#define KBC_F5 0x3E -#define KBC_F6 0x3F -#define KBC_F7 0x40 -#define KBC_F8 0x41 -#define KBC_F9 0x42 -#define KBC_F10 0x43 -#define KBC_NUMLOCK 0x44 -#define KBC_SCROLLLOCK 0x45 -#define KBC_NUMPAD7 0x46 -#define KBC_NUMPAD8 0x47 -#define KBC_NUMPAD9 0x48 -#define KBC_SUBTRACT 0x49 -#define KBC_NUMPAD4 0x4A -#define KBC_NUMPAD5 0x4B -#define KBC_NUMPAD6 0x4C -#define KBC_ADD 0x4D -#define KBC_NUMPAD1 0x4E -#define KBC_NUMPAD2 0x4F -#define KBC_NUMPAD3 0x50 -#define KBC_NUMPAD0 0x51 -#define KBC_DECIMAL 0x52 -#define KBC_F11 0x53 -#define KBC_F12 0x54 -#define KBC_NUMPADENTER 0x55 -#define KBC_RCONTROL 0x56 -#define KBC_DIVIDE 0x57 -#define KBC_SYSRQ 0x58 -#define KBC_RALT 0x59 -#define KBC_PAUSE 0x5A -#define KBC_HOME 0x5B -#define KBC_UP 0x5C -#define KBC_PAGEDOWN 0x5D -#define KBC_LEFT 0x5E -#define KBC_RIGHT 0x5F -#define KBC_END 0x60 -#define KBC_DOWN 0x61 -#define KBC_PAGEUP 0x62 -#define KBC_INSERT 0x63 -#define KBC_DELETE 0x64 +#define KBC_ESCAPE 0x0 +#define KBC_1 0x1 +#define KBC_2 0x2 +#define KBC_3 0x3 +#define KBC_4 0x4 +#define KBC_5 0x5 +#define KBC_6 0x6 +#define KBC_7 0x7 +#define KBC_8 0x8 +#define KBC_9 0x9 +#define KBC_0 0xA +#define KBC_MINUS 0xB +#define KBC_EQUALS 0xC +#define KBC_BACK 0xD +#define KBC_TAB 0xE +#define KBC_Q 0xF +#define KBC_W 0x10 +#define KBC_E 0x11 +#define KBC_R 0x12 +#define KBC_T 0x13 +#define KBC_Y 0x14 +#define KBC_U 0x15 +#define KBC_I 0x16 +#define KBC_O 0x17 +#define KBC_P 0x18 +#define KBC_LBRACKET 0x19 +#define KBC_RBRACKET 0x1A +#define KBC_RETURN 0x1B +#define KBC_LCONTROL 0x1C +#define KBC_A 0x1D +#define KBC_S 0x1E +#define KBC_D 0x1F +#define KBC_F 0x20 +#define KBC_G 0x21 +#define KBC_H 0x22 +#define KBC_J 0x23 +#define KBC_K 0x24 +#define KBC_L 0x25 +#define KBC_SEMICOLON 0x26 +#define KBC_APOSTROPHE 0x27 +#define KBC_TILDE 0x28 +#define KBC_LSHIFT 0x29 +#define KBC_BACKSLASH 0x2A +#define KBC_Z 0x2B +#define KBC_X 0x2C +#define KBC_C 0x2D +#define KBC_V 0x2E +#define KBC_B 0x2F +#define KBC_N 0x30 +#define KBC_M 0x31 +#define KBC_COMMA 0x32 +#define KBC_PERIOD 0x33 +#define KBC_SLASH 0x34 +#define KBC_RSHIFT 0x35 +#define KBC_MULTIPLY 0x36 +#define KBC_LALT 0x37 +#define KBC_SPACE 0x38 +#define KBC_CAPSLOCK 0x39 +#define KBC_F1 0x3A +#define KBC_F2 0x3B +#define KBC_F3 0x3C +#define KBC_F4 0x3D +#define KBC_F5 0x3E +#define KBC_F6 0x3F +#define KBC_F7 0x40 +#define KBC_F8 0x41 +#define KBC_F9 0x42 +#define KBC_F10 0x43 +#define KBC_NUMLOCK 0x44 +#define KBC_SCROLLLOCK 0x45 +#define KBC_NUMPAD7 0x46 +#define KBC_NUMPAD8 0x47 +#define KBC_NUMPAD9 0x48 +#define KBC_SUBTRACT 0x49 +#define KBC_NUMPAD4 0x4A +#define KBC_NUMPAD5 0x4B +#define KBC_NUMPAD6 0x4C +#define KBC_ADD 0x4D +#define KBC_NUMPAD1 0x4E +#define KBC_NUMPAD2 0x4F +#define KBC_NUMPAD3 0x50 +#define KBC_NUMPAD0 0x51 +#define KBC_DECIMAL 0x52 +#define KBC_F11 0x53 +#define KBC_F12 0x54 +#define KBC_NUMPADENTER 0x55 +#define KBC_RCONTROL 0x56 +#define KBC_DIVIDE 0x57 +#define KBC_SYSRQ 0x58 +#define KBC_RALT 0x59 +#define KBC_PAUSE 0x5A +#define KBC_HOME 0x5B +#define KBC_UP 0x5C +#define KBC_PAGEDOWN 0x5D +#define KBC_LEFT 0x5E +#define KBC_RIGHT 0x5F +#define KBC_END 0x60 +#define KBC_DOWN 0x61 +#define KBC_PAGEUP 0x62 +#define KBC_INSERT 0x63 +#define KBC_DELETE 0x64 -#define MOUSE_LEFTBUTTON 0x65 -#define MOUSE_MIDDLEBUTTON 0x66 -#define MOUSE_RIGHTBUTTON 0x67 -#define MOUSE_WHEEL 0x68 -#define MOUSE_MOVE 0x69 +#define MOUSE_LEFTBUTTON 0x65 +#define MOUSE_MIDDLEBUTTON 0x66 +#define MOUSE_RIGHTBUTTON 0x67 +#define MOUSE_WHEEL 0x68 +#define MOUSE_MOVE 0x69 -#define KBC_CONTROL 0xFFFFFFFE -#define KBC_ALT 0xFFFFFFFD -#define KBC_SHIFT 0xFFFFFFFC +#define KBC_CONTROL 0xFFFFFFFE +#define KBC_ALT 0xFFFFFFFD +#define KBC_SHIFT 0xFFFFFFFC -#define STATE_LBUTTONDOWN (1<<0) -#define STATE_RBUTTONDOWN (1<<1) -#define STATE_MBUTTONDOWN (1<<2) -#define STATE_X4BUTTONDOWN (1<<3) -#define STATE_X5BUTTONDOWN (1<<4) +#define STATE_LBUTTONDOWN (1 << 0) +#define STATE_RBUTTONDOWN (1 << 1) +#define STATE_MBUTTONDOWN (1 << 2) +#define STATE_X4BUTTONDOWN (1 << 3) +#define STATE_X5BUTTONDOWN (1 << 4) /* wrapped opaque data types */ struct input_subsystem;
View file
obs-studio-24.0.0.tar.xz/libobs/graphics/libnsgif/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/math-defs.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/math-defs.h
Changed
@@ -25,19 +25,19 @@ #endif #ifndef M_PI -#define M_PI 3.1415926535897932384626433832795f +#define M_PI 3.1415926535897932384626433832795f #endif -#define RAD(val) ((val)*0.0174532925199432957692369076848f) -#define DEG(val) ((val)*57.295779513082320876798154814105f) -#define LARGE_EPSILON 1e-2f -#define EPSILON 1e-4f -#define TINY_EPSILON 1e-5f -#define M_INFINITE 3.4e38f +#define RAD(val) ((val)*0.0174532925199432957692369076848f) +#define DEG(val) ((val)*57.295779513082320876798154814105f) +#define LARGE_EPSILON 1e-2f +#define EPSILON 1e-4f +#define TINY_EPSILON 1e-5f +#define M_INFINITE 3.4e38f static inline bool close_float(float f1, float f2, float precision) { - return fabsf(f1-f2) <= precision; + return fabsf(f1 - f2) <= precision; } #ifdef __cplusplus
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/math-extra.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/math-extra.c
Changed
@@ -24,12 +24,12 @@ void polar_to_cart(struct vec3 *dst, const struct vec3 *v) { struct vec3 cart; - float sinx = cosf(v->x); - float sinx_z = v->z * sinx; + float sinx = cosf(v->x); + float sinx_z = v->z * sinx; cart.x = sinx_z * sinf(v->y); cart.z = sinx_z * cosf(v->y); - cart.y = v->z * sinf(v->x); + cart.y = v->z * sinf(v->x); vec3_copy(dst, &cart); } @@ -65,28 +65,28 @@ } float calc_torquef(float val1, float val2, float torque, float min_adjust, - float t) + float t) { float out = val1; float dist; - bool over; + bool over; if (close_float(val1, val2, EPSILON)) return val1; - dist = (val2-val1)*torque; + dist = (val2 - val1) * torque; over = dist > 0.0f; if (over) { if (dist < min_adjust) /* prevents from going too slow */ dist = min_adjust; - out += dist*t; /* add torque */ - if (out > val2) /* clamp if overshoot */ + out += dist * t; /* add torque */ + if (out > val2) /* clamp if overshoot */ out = val2; } else { if (dist > -min_adjust) dist = -min_adjust; - out += dist*t; + out += dist * t; if (out < val2) out = val2; } @@ -94,9 +94,8 @@ return out; } -void calc_torque(struct vec3 *dst, const struct vec3 *v1, - const struct vec3 *v2, float torque, float min_adjust, - float t) +void calc_torque(struct vec3 *dst, const struct vec3 *v1, const struct vec3 *v2, + float torque, float min_adjust, float t) { struct vec3 line, dir; float orig_dist, torque_dist, adjust_dist; @@ -108,26 +107,26 @@ vec3_sub(&line, v2, v1); orig_dist = vec3_len(&line); - vec3_mulf(&dir, &line, 1.0f/orig_dist); + vec3_mulf(&dir, &line, 1.0f / orig_dist); - torque_dist = orig_dist*torque; /* use distance to determine speed */ - if (torque_dist < min_adjust) /* prevent from going too slow */ + torque_dist = orig_dist * torque; /* use distance to determine speed */ + if (torque_dist < min_adjust) /* prevent from going too slow */ torque_dist = min_adjust; - adjust_dist = torque_dist*t; + adjust_dist = torque_dist * t; - if (adjust_dist <= (orig_dist-LARGE_EPSILON)) { + if (adjust_dist <= (orig_dist - LARGE_EPSILON)) { vec3_mulf(dst, &dir, adjust_dist); vec3_add(dst, dst, v1); /* add torque */ } else { - vec3_copy(dst, v2); /* clamp if overshoot */ + vec3_copy(dst, v2); /* clamp if overshoot */ } } float rand_float(int positive_only) { if (positive_only) - return (float)((double)rand()/(double)RAND_MAX); + return (float)((double)rand() / (double)RAND_MAX); else - return (float)(((double)rand()/(double)RAND_MAX*2.0)-1.0); + return (float)(((double)rand() / (double)RAND_MAX * 2.0) - 1.0); }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/math-extra.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/math-extra.h
Changed
@@ -40,20 +40,20 @@ EXPORT void polar_to_norm(struct vec3 *dst, const struct vec2 *polar); EXPORT float calc_torquef(float val1, float val2, float torque, - float min_adjust, float t); + float min_adjust, float t); EXPORT void calc_torque(struct vec3 *dst, const struct vec3 *v1, - const struct vec3 *v2, float torque, float min_adjust, - float t); + const struct vec3 *v2, float torque, float min_adjust, + float t); static inline float get_percentage(float start, float end, float mid) { - return (mid-start) / (end-start); + return (mid - start) / (end - start); } static inline float get_percentagei(int start, int end, int mid) { - return (float)(mid-start) / (float)(end-start); + return (float)(mid - start) / (float)(end - start); } EXPORT float rand_float(int positive_only);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/matrix3.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/matrix3.c
Changed
@@ -21,11 +21,10 @@ #include "plane.h" #include "quat.h" - void matrix3_from_quat(struct matrix3 *dst, const struct quat *q) { float norm = quat_dot(q, q); - float s = (norm > 0.0f) ? (2.0f/norm) : 0.0f; + float s = (norm > 0.0f) ? (2.0f / norm) : 0.0f; float xx = q->x * q->x * s; float yy = q->y * q->y * s; @@ -63,7 +62,7 @@ } void matrix3_mul(struct matrix3 *dst, const struct matrix3 *m1, - const struct matrix3 *m2) + const struct matrix3 *m2) { if (dst == m2) { struct matrix3 temp; @@ -81,7 +80,7 @@ } void matrix3_rotate(struct matrix3 *dst, const struct matrix3 *m, - const struct quat *q) + const struct quat *q) { struct matrix3 temp; matrix3_from_quat(&temp, q); @@ -89,7 +88,7 @@ } void matrix3_rotate_aa(struct matrix3 *dst, const struct matrix3 *m, - const struct axisang *aa) + const struct axisang *aa) { struct matrix3 temp; matrix3_from_axisang(&temp, aa); @@ -97,7 +96,7 @@ } void matrix3_scale(struct matrix3 *dst, const struct matrix3 *m, - const struct vec3 *v) + const struct vec3 *v) { vec3_mul(&dst->x, &m->x, v); vec3_mul(&dst->y, &m->y, v); @@ -122,12 +121,12 @@ { struct matrix4 m4; matrix4_from_matrix3(&m4, m); - matrix4_inv((struct matrix4*)dst, &m4); + matrix4_inv((struct matrix4 *)dst, &m4); dst->t.w = 0.0f; } void matrix3_mirror(struct matrix3 *dst, const struct matrix3 *m, - const struct plane *p) + const struct plane *p) { vec3_mirrorv(&dst->x, &m->x, &p->dir); vec3_mirrorv(&dst->y, &m->y, &p->dir); @@ -136,7 +135,7 @@ } void matrix3_mirrorv(struct matrix3 *dst, const struct matrix3 *m, - const struct vec3 *v) + const struct vec3 *v) { vec3_mirrorv(&dst->x, &m->x, v); vec3_mirrorv(&dst->y, &m->y, v);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/matrix3.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/matrix3.h
Changed
@@ -53,34 +53,35 @@ } EXPORT void matrix3_from_quat(struct matrix3 *dst, const struct quat *q); -EXPORT void matrix3_from_axisang(struct matrix3 *dst, - const struct axisang *aa); +EXPORT void matrix3_from_axisang(struct matrix3 *dst, const struct axisang *aa); EXPORT void matrix3_from_matrix4(struct matrix3 *dst, const struct matrix4 *m); EXPORT void matrix3_mul(struct matrix3 *dst, const struct matrix3 *m1, - const struct matrix3 *m2); + const struct matrix3 *m2); static inline void matrix3_translate(struct matrix3 *dst, - const struct matrix3 *m, const struct vec3 *v) + const struct matrix3 *m, + const struct vec3 *v) { vec3_sub(&dst->t, &m->t, v); } EXPORT void matrix3_rotate(struct matrix3 *dst, const struct matrix3 *m, - const struct quat *q); + const struct quat *q); EXPORT void matrix3_rotate_aa(struct matrix3 *dst, const struct matrix3 *m, - const struct axisang *aa); + const struct axisang *aa); EXPORT void matrix3_scale(struct matrix3 *dst, const struct matrix3 *m, - const struct vec3 *v); + const struct vec3 *v); EXPORT void matrix3_transpose(struct matrix3 *dst, const struct matrix3 *m); EXPORT void matrix3_inv(struct matrix3 *dst, const struct matrix3 *m); EXPORT void matrix3_mirror(struct matrix3 *dst, const struct matrix3 *m, - const struct plane *p); + const struct plane *p); EXPORT void matrix3_mirrorv(struct matrix3 *dst, const struct matrix3 *m, - const struct vec3 *v); + const struct vec3 *v); static inline void matrix3_translate3f(struct matrix3 *dst, - const struct matrix3 *m, float x, float y, float z) + const struct matrix3 *m, float x, + float y, float z) { struct vec3 v; vec3_set(&v, x, y, z); @@ -88,15 +89,16 @@ } static inline void matrix3_rotate_aa4f(struct matrix3 *dst, - const struct matrix3 *m, float x, float y, float z, float rot) + const struct matrix3 *m, float x, + float y, float z, float rot) { struct axisang aa; axisang_set(&aa, x, y, z, rot); matrix3_rotate_aa(dst, m, &aa); } -static inline void matrix3_scale3f(struct matrix3 *dst, - const struct matrix3 *m, float x, float y, float z) +static inline void matrix3_scale3f(struct matrix3 *dst, const struct matrix3 *m, + float x, float y, float z) { struct vec3 v; vec3_set(&v, x, y, z);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/matrix4.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/matrix4.c
Changed
@@ -32,7 +32,7 @@ void matrix4_from_quat(struct matrix4 *dst, const struct quat *q) { float norm = quat_dot(q, q); - float s = (norm > 0.0f) ? (2.0f/norm) : 0.0f; + float s = (norm > 0.0f) ? (2.0f / norm) : 0.0f; float xx = q->x * q->x * s; float yy = q->y * q->y * s; @@ -58,26 +58,27 @@ } void matrix4_mul(struct matrix4 *dst, const struct matrix4 *m1, - const struct matrix4 *m2) + const struct matrix4 *m2) { - const struct vec4 *m1v = (const struct vec4*)m1; - const float *m2f = (const float*)m2; + const struct vec4 *m1v = (const struct vec4 *)m1; + const float *m2f = (const float *)m2; struct vec4 out[4]; int i, j; for (i = 0; i < 4; i++) { - for (j=0; j<4; j++) { + for (j = 0; j < 4; j++) { struct vec4 temp; - vec4_set(&temp, m2f[j], m2f[j+4], m2f[j+8], m2f[j+12]); + vec4_set(&temp, m2f[j], m2f[j + 4], m2f[j + 8], + m2f[j + 12]); out[i].ptr[j] = vec4_dot(&m1v[i], &temp); } } - matrix4_copy(dst, (struct matrix4*)out); + matrix4_copy(dst, (struct matrix4 *)out); } -static inline void get_3x3_submatrix(float *dst, const struct matrix4 *m, - int i, int j) +static inline void get_3x3_submatrix(float *dst, const struct matrix4 *m, int i, + int j) { const float *mf = (const float *)m; int ti, tj, idst, jdst; @@ -86,7 +87,7 @@ if (ti < i) idst = ti; else if (ti > i) - idst = ti-1; + idst = ti - 1; else continue; @@ -94,20 +95,20 @@ if (tj < j) jdst = tj; else if (tj > j) - jdst = tj-1; + jdst = tj - 1; else continue; - dst[(idst*3) + jdst] = mf[(ti*4) + tj]; + dst[(idst * 3) + jdst] = mf[(ti * 4) + tj]; } } } static inline float get_3x3_determinant(const float *m) { - return (m[0] * ((m[4]*m[8]) - (m[7]*m[5]))) - - (m[1] * ((m[3]*m[8]) - (m[6]*m[5]))) + - (m[2] * ((m[3]*m[7]) - (m[6]*m[4]))); + return (m[0] * ((m[4] * m[8]) - (m[7] * m[5]))) - + (m[1] * ((m[3] * m[8]) - (m[6] * m[5]))) + + (m[2] * ((m[3] * m[7]) - (m[6] * m[4]))); } float matrix4_determinant(const struct matrix4 *m) @@ -117,10 +118,10 @@ float m3x3[9]; int n; - for (n = 0; n < 4; n++, i *= -1.0f) { + for (n = 0; n < 4; n++, i = -i) { // NOLINT(clang-tidy-cert-flp30-c) get_3x3_submatrix(m3x3, m, 0, n); - det = get_3x3_determinant(m3x3); + det = get_3x3_determinant(m3x3); result += mf[n] * det * i; } @@ -128,7 +129,7 @@ } void matrix4_translate3v(struct matrix4 *dst, const struct matrix4 *m, - const struct vec3 *v) + const struct vec3 *v) { struct matrix4 temp; vec4_set(&temp.x, 1.0f, 0.0f, 0.0f, 0.0f); @@ -140,7 +141,7 @@ } void matrix4_translate4v(struct matrix4 *dst, const struct matrix4 *m, - const struct vec4 *v) + const struct vec4 *v) { struct matrix4 temp; vec4_set(&temp.x, 1.0f, 0.0f, 0.0f, 0.0f); @@ -152,7 +153,7 @@ } void matrix4_rotate(struct matrix4 *dst, const struct matrix4 *m, - const struct quat *q) + const struct quat *q) { struct matrix4 temp; matrix4_from_quat(&temp, q); @@ -160,7 +161,7 @@ } void matrix4_rotate_aa(struct matrix4 *dst, const struct matrix4 *m, - const struct axisang *aa) + const struct axisang *aa) { struct matrix4 temp; matrix4_from_axisang(&temp, aa); @@ -168,7 +169,7 @@ } void matrix4_scale(struct matrix4 *dst, const struct matrix4 *m, - const struct vec3 *v) + const struct vec3 *v) { struct matrix4 temp; vec4_set(&temp.x, v->x, 0.0f, 0.0f, 0.0f); @@ -179,7 +180,7 @@ } void matrix4_translate3v_i(struct matrix4 *dst, const struct vec3 *v, - const struct matrix4 *m) + const struct matrix4 *m) { struct matrix4 temp; vec4_set(&temp.x, 1.0f, 0.0f, 0.0f, 0.0f); @@ -191,7 +192,7 @@ } void matrix4_translate4v_i(struct matrix4 *dst, const struct vec4 *v, - const struct matrix4 *m) + const struct matrix4 *m) { struct matrix4 temp; vec4_set(&temp.x, 1.0f, 0.0f, 0.0f, 0.0f); @@ -203,7 +204,7 @@ } void matrix4_rotate_i(struct matrix4 *dst, const struct quat *q, - const struct matrix4 *m) + const struct matrix4 *m) { struct matrix4 temp; matrix4_from_quat(&temp, q); @@ -211,7 +212,7 @@ } void matrix4_rotate_aa_i(struct matrix4 *dst, const struct axisang *aa, - const struct matrix4 *m) + const struct matrix4 *m) { struct matrix4 temp; matrix4_from_axisang(&temp, aa); @@ -219,7 +220,7 @@ } void matrix4_scale_i(struct matrix4 *dst, const struct vec3 *v, - const struct matrix4 *m) + const struct matrix4 *m) { struct matrix4 temp; vec4_set(&temp.x, v->x, 0.0f, 0.0f, 0.0f); @@ -234,7 +235,7 @@ struct vec4 *dstv; float det; float m3x3[9]; - int i, j, sign; + int i, j, sign; if (dst == m) { struct matrix4 temp = *m; @@ -242,17 +243,17 @@ } dstv = (struct vec4 *)dst; - det = matrix4_determinant(m); + det = matrix4_determinant(m); if (fabs(det) < 0.0005f) return false; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { - sign = 1 - ((i+j) % 2) * 2; + sign = 1 - ((i + j) % 2) * 2; get_3x3_submatrix(m3x3, m, i, j); - dstv[j].ptr[i] = get_3x3_determinant(m3x3) * - (float)sign / det; + dstv[j].ptr[i] = + get_3x3_determinant(m3x3) * (float)sign / det; } }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/matrix4.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/matrix4.h
Changed
@@ -55,40 +55,40 @@ EXPORT void matrix4_from_matrix3(struct matrix4 *dst, const struct matrix3 *m); EXPORT void matrix4_from_quat(struct matrix4 *dst, const struct quat *q); -EXPORT void matrix4_from_axisang(struct matrix4 *dst, - const struct axisang *aa); +EXPORT void matrix4_from_axisang(struct matrix4 *dst, const struct axisang *aa); EXPORT void matrix4_mul(struct matrix4 *dst, const struct matrix4 *m1, - const struct matrix4 *m2); + const struct matrix4 *m2); EXPORT float matrix4_determinant(const struct matrix4 *m); EXPORT void matrix4_translate3v(struct matrix4 *dst, const struct matrix4 *m, - const struct vec3 *v); + const struct vec3 *v); EXPORT void matrix4_translate4v(struct matrix4 *dst, const struct matrix4 *m, - const struct vec4 *v); + const struct vec4 *v); EXPORT void matrix4_rotate(struct matrix4 *dst, const struct matrix4 *m, - const struct quat *q); + const struct quat *q); EXPORT void matrix4_rotate_aa(struct matrix4 *dst, const struct matrix4 *m, - const struct axisang *aa); + const struct axisang *aa); EXPORT void matrix4_scale(struct matrix4 *dst, const struct matrix4 *m, - const struct vec3 *v); + const struct vec3 *v); EXPORT bool matrix4_inv(struct matrix4 *dst, const struct matrix4 *m); EXPORT void matrix4_transpose(struct matrix4 *dst, const struct matrix4 *m); EXPORT void matrix4_translate3v_i(struct matrix4 *dst, const struct vec3 *v, - const struct matrix4 *m); + const struct matrix4 *m); EXPORT void matrix4_translate4v_i(struct matrix4 *dst, const struct vec4 *v, - const struct matrix4 *m); + const struct matrix4 *m); EXPORT void matrix4_rotate_i(struct matrix4 *dst, const struct quat *q, - const struct matrix4 *m); + const struct matrix4 *m); EXPORT void matrix4_rotate_aa_i(struct matrix4 *dst, const struct axisang *aa, - const struct matrix4 *m); + const struct matrix4 *m); EXPORT void matrix4_scale_i(struct matrix4 *dst, const struct vec3 *v, - const struct matrix4 *m); + const struct matrix4 *m); static inline void matrix4_translate3f(struct matrix4 *dst, - const struct matrix4 *m, float x, float y, float z) + const struct matrix4 *m, float x, + float y, float z) { struct vec3 v; vec3_set(&v, x, y, z); @@ -96,15 +96,16 @@ } static inline void matrix4_rotate_aa4f(struct matrix4 *dst, - const struct matrix4 *m, float x, float y, float z, float rot) + const struct matrix4 *m, float x, + float y, float z, float rot) { struct axisang aa; axisang_set(&aa, x, y, z, rot); matrix4_rotate_aa(dst, m, &aa); } -static inline void matrix4_scale3f(struct matrix4 *dst, - const struct matrix4 *m, float x, float y, float z) +static inline void matrix4_scale3f(struct matrix4 *dst, const struct matrix4 *m, + float x, float y, float z) { struct vec3 v; vec3_set(&v, x, y, z);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/plane.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/plane.c
Changed
@@ -19,10 +19,8 @@ #include "matrix3.h" #include "plane.h" -void plane_from_tri(struct plane *dst, - const struct vec3 *v1, - const struct vec3 *v2, - const struct vec3 *v3) +void plane_from_tri(struct plane *dst, const struct vec3 *v1, + const struct vec3 *v2, const struct vec3 *v3) { struct vec3 temp; @@ -34,7 +32,7 @@ } void plane_transform(struct plane *dst, const struct plane *p, - const struct matrix4 *m) + const struct matrix4 *m) { struct vec3 temp; @@ -48,7 +46,7 @@ } void plane_transform3x4(struct plane *dst, const struct plane *p, - const struct matrix3 *m) + const struct matrix3 *m) { struct vec3 temp; @@ -60,7 +58,7 @@ } bool plane_intersection_ray(const struct plane *p, const struct vec3 *orig, - const struct vec3 *dir, float *t) + const struct vec3 *dir, float *t) { float c = vec3_dot(&p->dir, dir); @@ -74,10 +72,10 @@ } bool plane_intersection_line(const struct plane *p, const struct vec3 *v1, - const struct vec3 *v2, float *t) + const struct vec3 *v2, float *t) { float p1_dist, p2_dist, p1_abs_dist, dist2; - bool p1_over, p2_over; + bool p1_over, p2_over; p1_dist = vec3_plane_dist(v1, p); p2_dist = vec3_plane_dist(v2, p); @@ -108,11 +106,9 @@ return true; } -bool plane_tri_inside(const struct plane *p, - const struct vec3 *v1, - const struct vec3 *v2, - const struct vec3 *v3, - float precision) +bool plane_tri_inside(const struct plane *p, const struct vec3 *v1, + const struct vec3 *v2, const struct vec3 *v3, + float precision) { /* bit 1: part or all is behind the plane */ /* bit 2: part or all is in front of the plane */ @@ -140,7 +136,7 @@ } bool plane_line_inside(const struct plane *p, const struct vec3 *v1, - const struct vec3 *v2, float precision) + const struct vec3 *v2, float precision) { /* bit 1: part or all is behind the plane */ /* bit 2: part or all is in front of the plane */
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/plane.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/plane.h
Changed
@@ -29,7 +29,7 @@ struct plane { struct vec3 dir; - float dist; + float dist; }; static inline void plane_copy(struct plane *dst, const struct plane *p) @@ -39,52 +39,50 @@ } static inline void plane_set(struct plane *dst, const struct vec3 *dir, - float dist) + float dist) { vec3_copy(&dst->dir, dir); dst->dist = dist; } static inline void plane_setf(struct plane *dst, float a, float b, float c, - float d) + float d) { vec3_set(&dst->dir, a, b, c); dst->dist = d; } -EXPORT void plane_from_tri(struct plane *dst, - const struct vec3 *v1, - const struct vec3 *v2, - const struct vec3 *v3); +EXPORT void plane_from_tri(struct plane *dst, const struct vec3 *v1, + const struct vec3 *v2, const struct vec3 *v3); EXPORT void plane_transform(struct plane *dst, const struct plane *p, - const struct matrix4 *m); + const struct matrix4 *m); EXPORT void plane_transform3x4(struct plane *dst, const struct plane *p, - const struct matrix3 *m); + const struct matrix3 *m); EXPORT bool plane_intersection_ray(const struct plane *p, - const struct vec3 *orig, const struct vec3 *dir, float *t); + const struct vec3 *orig, + const struct vec3 *dir, float *t); EXPORT bool plane_intersection_line(const struct plane *p, - const struct vec3 *v1, const struct vec3 *v2, float *t); + const struct vec3 *v1, + const struct vec3 *v2, float *t); -EXPORT bool plane_tri_inside(const struct plane *p, - const struct vec3 *v1, - const struct vec3 *v2, - const struct vec3 *v3, - float precision); +EXPORT bool plane_tri_inside(const struct plane *p, const struct vec3 *v1, + const struct vec3 *v2, const struct vec3 *v3, + float precision); EXPORT bool plane_line_inside(const struct plane *p, const struct vec3 *v1, - const struct vec3 *v2, float precision); + const struct vec3 *v2, float precision); static inline bool plane_close(const struct plane *p1, const struct plane *p2, - float precision) + float precision) { return vec3_close(&p1->dir, &p2->dir, precision) && close_float(p1->dist, p2->dist, precision); } static inline bool plane_coplanar(const struct plane *p1, - const struct plane *p2, float precision) + const struct plane *p2, float precision) { float cos_angle = vec3_dot(&p1->dir, &p2->dir);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/quat.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/quat.c
Changed
@@ -47,12 +47,12 @@ void quat_from_axisang(struct quat *dst, const struct axisang *aa) { float halfa = aa->w * 0.5f; - float sine = sinf(halfa); + float sine = sinf(halfa); dst->x = aa->x * sine; dst->y = aa->y * sine; dst->z = aa->z * sine; - dst->w = cosf(halfa); + dst->w = cosf(halfa); } struct f4x4 { @@ -61,7 +61,7 @@ void quat_from_matrix3(struct quat *dst, const struct matrix3 *m) { - quat_from_matrix4(dst, (const struct matrix4*)m); + quat_from_matrix4(dst, (const struct matrix4 *)m); } void quat_from_matrix4(struct quat *dst, const struct matrix4 *m) @@ -69,7 +69,7 @@ float tr = (m->x.x + m->y.y + m->z.z); float inv_half; float four_d; - int i,j,k; + int i, j, k; if (tr > 0.0f) { four_d = sqrtf(tr + 1.0f); @@ -80,27 +80,28 @@ dst->y = (m->z.x - m->x.z) * inv_half; dst->z = (m->x.y - m->y.x) * inv_half; } else { - struct f4x4 *val = (struct f4x4*)m; + struct f4x4 *val = (struct f4x4 *)m; i = (m->x.x > m->y.y) ? 0 : 1; if (m->z.z > val->ptr[i][i]) i = 2; - j = (i+1) % 3; - k = (i+2) % 3; + j = (i + 1) % 3; + k = (i + 2) % 3; /* ---------------------------------- */ - four_d = sqrtf((val->ptr[i][i] - val->ptr[j][j] - - val->ptr[k][k]) + 1.0f); + four_d = sqrtf( + (val->ptr[i][i] - val->ptr[j][j] - val->ptr[k][k]) + + 1.0f); dst->ptr[i] = four_d * 0.5f; inv_half = 0.5f / four_d; - dst->ptr[j] = (val->ptr[i][j] + val->ptr[j][i]) * inv_half; - dst->ptr[k] = (val->ptr[i][k] + val->ptr[k][i]) * inv_half; - dst->w = (val->ptr[j][k] - val->ptr[k][j]) * inv_half; + dst->ptr[j] = (val->ptr[i][j] + val->ptr[j][i]) * inv_half; + dst->ptr[k] = (val->ptr[i][k] + val->ptr[k][i]) * inv_half; + dst->w = (val->ptr[j][k] - val->ptr[k][j]) * inv_half; } } @@ -115,8 +116,8 @@ { struct vec3 new_dir; struct quat xz_rot, yz_rot; - bool xz_valid; - bool yz_valid; + bool xz_valid; + bool yz_valid; struct axisang aa; vec3_norm(&new_dir, dir); @@ -126,12 +127,12 @@ quat_identity(&yz_rot); xz_valid = close_float(new_dir.x, 0.0f, EPSILON) || - close_float(new_dir.z, 0.0f, EPSILON); + close_float(new_dir.z, 0.0f, EPSILON); yz_valid = close_float(new_dir.y, 0.0f, EPSILON); if (xz_valid) { axisang_set(&aa, 0.0f, 1.0f, 0.0f, - atan2f(new_dir.x, new_dir.z)); + atan2f(new_dir.x, new_dir.z)); quat_from_axisang(&xz_rot, &aa); } @@ -151,31 +152,31 @@ void quat_log(struct quat *dst, const struct quat *q) { float angle = acosf(q->w); - float sine = sinf(angle); - float w = q->w; + float sine = sinf(angle); + float w = q->w; quat_copy(dst, q); dst->w = 0.0f; if ((fabsf(w) < 1.0f) && (fabsf(sine) >= EPSILON)) { - sine = angle/sine; + sine = angle / sine; quat_mulf(dst, dst, sine); } } void quat_exp(struct quat *dst, const struct quat *q) { - float length = sqrtf(q->x*q->x + q->y*q->y + q->z*q->z); - float sine = sinf(length); + float length = sqrtf(q->x * q->x + q->y * q->y + q->z * q->z); + float sine = sinf(length); quat_copy(dst, q); - sine = (length > EPSILON) ? (sine/length) : 1.0f; + sine = (length > EPSILON) ? (sine / length) : 1.0f; quat_mulf(dst, dst, sine); dst->w = cosf(length); } void quat_interpolate(struct quat *dst, const struct quat *q1, - const struct quat *q2, float t) + const struct quat *q2, float t) { float dot = quat_dot(q1, q2); float anglef = acosf(dot); @@ -183,10 +184,10 @@ struct quat temp; if (anglef >= EPSILON) { - sine = sinf(anglef); - sinei = 1/sine; - sinet = sinf(anglef*t)*sinei; - sineti = sinf(anglef*(1.0f-t))*sinei; + sine = sinf(anglef); + sinei = 1 / sine; + sinet = sinf(anglef * t) * sinei; + sineti = sinf(anglef * (1.0f - t)) * sinei; quat_mulf(&temp, q1, sineti); quat_mulf(dst, q2, sinet); @@ -199,7 +200,7 @@ } void quat_get_tangent(struct quat *dst, const struct quat *prev, - const struct quat *q, const struct quat *next) + const struct quat *q, const struct quat *next) { struct quat temp; @@ -209,14 +210,13 @@ quat_mulf(dst, &temp, 0.5f); } -void quat_interpolate_cubic(struct quat *dst, - const struct quat *q1, const struct quat *q2, - const struct quat *m1, const struct quat *m2, - float t) +void quat_interpolate_cubic(struct quat *dst, const struct quat *q1, + const struct quat *q2, const struct quat *m1, + const struct quat *m2, float t) { struct quat temp1, temp2; quat_interpolate(&temp1, q1, q2, t); quat_interpolate(&temp2, m1, m2, t); - quat_interpolate(dst, &temp1, &temp2, 2.0f*(1.0f-t)*t); + quat_interpolate(dst, &temp1, &temp2, 2.0f * (1.0f - t) * t); }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/quat.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/quat.h
Changed
@@ -40,7 +40,9 @@ struct quat { union { - struct {float x, y, z, w;}; + struct { + float x, y, z, w; + }; float ptr[4]; __m128 m; }; @@ -53,7 +55,7 @@ } static inline void quat_set(struct quat *dst, float x, float y, float z, - float w) + float w) { dst->m = _mm_set_ps(x, y, z, w); } @@ -64,40 +66,36 @@ } static inline void quat_add(struct quat *dst, const struct quat *q1, - const struct quat *q2) + const struct quat *q2) { dst->m = _mm_add_ps(q1->m, q2->m); } static inline void quat_sub(struct quat *dst, const struct quat *q1, - const struct quat *q2) + const struct quat *q2) { dst->m = _mm_sub_ps(q1->m, q2->m); } EXPORT void quat_mul(struct quat *dst, const struct quat *q1, - const struct quat *q2); + const struct quat *q2); -static inline void quat_addf(struct quat *dst, const struct quat *q, - float f) +static inline void quat_addf(struct quat *dst, const struct quat *q, float f) { dst->m = _mm_add_ps(q->m, _mm_set1_ps(f)); } -static inline void quat_subf(struct quat *dst, const struct quat *q, - float f) +static inline void quat_subf(struct quat *dst, const struct quat *q, float f) { dst->m = _mm_sub_ps(q->m, _mm_set1_ps(f)); } -static inline void quat_mulf(struct quat *dst, const struct quat *q, - float f) +static inline void quat_mulf(struct quat *dst, const struct quat *q, float f) { dst->m = _mm_mul_ps(q->m, _mm_set1_ps(f)); } -static inline void quat_divf(struct quat *dst, const struct quat *q, - float f) +static inline void quat_divf(struct quat *dst, const struct quat *q, float f) { dst->m = _mm_div_ps(q->m, _mm_set1_ps(f)); } @@ -145,19 +143,17 @@ static inline void quat_norm(struct quat *dst, const struct quat *q) { float dot_val = quat_dot(q, q); - dst->m = (dot_val > 0.0f) ? - _mm_mul_ps(q->m, _mm_set1_ps(1.0f/sqrtf(dot_val))) : - _mm_setzero_ps(); + dst->m = (dot_val > 0.0f) + ? _mm_mul_ps(q->m, _mm_set1_ps(1.0f / sqrtf(dot_val))) + : _mm_setzero_ps(); } static inline bool quat_close(const struct quat *q1, const struct quat *q2, - float epsilon) + float epsilon) { struct quat test; quat_sub(&test, q1, q2); - return test.x < epsilon && - test.y < epsilon && - test.z < epsilon && + return test.x < epsilon && test.y < epsilon && test.z < epsilon && test.w < epsilon; } @@ -172,12 +168,12 @@ EXPORT void quat_exp(struct quat *dst, const struct quat *q); EXPORT void quat_interpolate(struct quat *dst, const struct quat *q1, - const struct quat *q2, float t); + const struct quat *q2, float t); EXPORT void quat_get_tangent(struct quat *dst, const struct quat *prev, - const struct quat *q, const struct quat *next); + const struct quat *q, const struct quat *next); EXPORT void quat_interpolate_cubic(struct quat *dst, const struct quat *q1, - const struct quat *q2, const struct quat *m1, - const struct quat *m2, float t); + const struct quat *q2, const struct quat *m1, + const struct quat *m2, float t); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/shader-parser.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/shader-parser.c
Changed
@@ -53,12 +53,12 @@ if (astrcmpi(filter, "Anisotropy") == 0) return GS_FILTER_ANISOTROPIC; - else if (astrcmpi(filter, "Point") == 0 || - strcmp(filter, "MIN_MAG_MIP_POINT") == 0) + else if (astrcmpi(filter, "Point") == 0 || + strcmp(filter, "MIN_MAG_MIP_POINT") == 0) return GS_FILTER_POINT; - else if (astrcmpi(filter, "Linear") == 0 || - strcmp(filter, "MIN_MAG_MIP_LINEAR") == 0) + else if (astrcmpi(filter, "Linear") == 0 || + strcmp(filter, "MIN_MAG_MIP_LINEAR") == 0) return GS_FILTER_LINEAR; else if (strcmp(filter, "MIN_MAG_POINT_MIP_LINEAR") == 0) @@ -99,7 +99,7 @@ } void shader_sampler_convert(struct shader_sampler *ss, - struct gs_sampler_info *info) + struct gs_sampler_info *info) { size_t i; memset(info, 0, sizeof(struct gs_sampler_info)); @@ -128,22 +128,26 @@ /* ------------------------------------------------------------------------- */ static int sp_parse_sampler_state_item(struct shader_parser *sp, - struct shader_sampler *ss) + struct shader_sampler *ss) { int ret; char *state = NULL, *value = NULL; ret = cf_next_name(&sp->cfp, &state, "state name", ";"); - if (ret != PARSE_SUCCESS) goto fail; + if (ret != PARSE_SUCCESS) + goto fail; ret = cf_next_token_should_be(&sp->cfp, "=", ";", NULL); - if (ret != PARSE_SUCCESS) goto fail; + if (ret != PARSE_SUCCESS) + goto fail; ret = cf_next_token_copy(&sp->cfp, &value); - if (ret != PARSE_SUCCESS) goto fail; + if (ret != PARSE_SUCCESS) + goto fail; ret = cf_next_token_should_be(&sp->cfp, ";", ";", NULL); - if (ret != PARSE_SUCCESS) goto fail; + if (ret != PARSE_SUCCESS) + goto fail; da_push_back(ss->states, &state); da_push_back(ss->values, &value); @@ -191,17 +195,20 @@ } static inline int sp_parse_struct_var(struct shader_parser *sp, - struct shader_var *var) + struct shader_var *var) { int code; /* -------------------------------------- */ /* variable type */ - if (!cf_next_valid_token(&sp->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&sp->cfp)) + return PARSE_EOF; - if (cf_token_is(&sp->cfp, ";")) return PARSE_CONTINUE; - if (cf_token_is(&sp->cfp, "}")) return PARSE_BREAK; + if (cf_token_is(&sp->cfp, ";")) + return PARSE_CONTINUE; + if (cf_token_is(&sp->cfp, "}")) + return PARSE_BREAK; code = cf_token_is_type(&sp->cfp, CFTOKEN_NAME, "type name", ";"); if (code != PARSE_SUCCESS) @@ -212,13 +219,15 @@ /* -------------------------------------- */ /* variable name */ - if (!cf_next_valid_token(&sp->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&sp->cfp)) + return PARSE_EOF; - if (cf_token_is(&sp->cfp, ";")) return PARSE_UNEXPECTED_CONTINUE; - if (cf_token_is(&sp->cfp, "}")) return PARSE_UNEXPECTED_BREAK; + if (cf_token_is(&sp->cfp, ";")) + return PARSE_UNEXPECTED_CONTINUE; + if (cf_token_is(&sp->cfp, "}")) + return PARSE_UNEXPECTED_BREAK; - code = cf_token_is_type(&sp->cfp, CFTOKEN_NAME, "variable name", - ";"); + code = cf_token_is_type(&sp->cfp, CFTOKEN_NAME, "variable name", ";"); if (code != PARSE_SUCCESS) return code; @@ -227,24 +236,27 @@ /* -------------------------------------- */ /* variable mapping if any (POSITION, TEXCOORD, etc) */ - if (!cf_next_valid_token(&sp->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&sp->cfp)) + return PARSE_EOF; if (cf_token_is(&sp->cfp, ":")) { - if (!cf_next_valid_token(&sp->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&sp->cfp)) + return PARSE_EOF; if (cf_token_is(&sp->cfp, ";")) return PARSE_UNEXPECTED_CONTINUE; if (cf_token_is(&sp->cfp, "}")) return PARSE_UNEXPECTED_BREAK; - code = cf_token_is_type(&sp->cfp, CFTOKEN_NAME, - "mapping name", ";"); + code = cf_token_is_type(&sp->cfp, CFTOKEN_NAME, "mapping name", + ";"); if (code != PARSE_SUCCESS) return code; cf_copy_token(&sp->cfp, &var->mapping); - if (!cf_next_valid_token(&sp->cfp)) return PARSE_EOF; + if (!cf_next_valid_token(&sp->cfp)) + return PARSE_EOF; } /* -------------------------------------- */ @@ -314,7 +326,7 @@ } static inline int sp_check_for_keyword(struct shader_parser *sp, - const char *keyword, bool *val) + const char *keyword, bool *val) { bool new_val = cf_token_is(&sp->cfp, keyword); if (new_val) { @@ -323,7 +335,7 @@ if (new_val && *val) cf_adderror(&sp->cfp, "'$1' keyword already specified", - LEX_WARNING, keyword, NULL, NULL); + LEX_WARNING, keyword, NULL, NULL); *val = new_val; return PARSE_CONTINUE; @@ -333,7 +345,7 @@ } static inline int sp_parse_func_param(struct shader_parser *sp, - struct shader_var *var) + struct shader_var *var) { int code; bool var_type_keyword = false; @@ -384,7 +396,7 @@ if (cf_token_is(&sp->cfp, ":")) { code = cf_next_name(&sp->cfp, &var->mapping, - "mapping specifier", ")"); + "mapping specifier", ")"); if (code != PARSE_SUCCESS) return code; @@ -396,7 +408,7 @@ } static bool sp_parse_func_params(struct shader_parser *sp, - struct shader_func *func) + struct shader_func *func) { struct cf_token peek; int code; @@ -449,8 +461,8 @@ /* if function is mapped to something, for example COLOR */ if (cf_token_is(&sp->cfp, ":")) { char *mapping = NULL; - int errorcode = cf_next_name(&sp->cfp, &mapping, "mapping", - "{"); + int errorcode = + cf_next_name(&sp->cfp, &mapping, "mapping", "{"); if (errorcode != PARSE_SUCCESS) goto error; @@ -482,17 +494,18 @@ /* parses "array[count]" */ static bool sp_parse_param_array(struct shader_parser *sp, - struct shader_var *param) + struct shader_var *param) { if (!cf_next_valid_token(&sp->cfp)) return false; if (sp->cfp.cur_token->type != CFTOKEN_NUM || !valid_int_str(sp->cfp.cur_token->str.array, - sp->cfp.cur_token->str.len)) + sp->cfp.cur_token->str.len)) return false; - param->array_count =(int)strtol(sp->cfp.cur_token->str.array, NULL, 10); + param->array_count = + (int)strtol(sp->cfp.cur_token->str.array, NULL, 10); if (cf_next_token_should_be(&sp->cfp, "]", ";", NULL) == PARSE_EOF) return false; @@ -504,7 +517,8 @@ } static inline int sp_parse_param_assign_intfloat(struct shader_parser *sp, - struct shader_var *param, bool is_float) + struct shader_var *param, + bool is_float) { int code; bool is_negative = false; @@ -525,11 +539,13 @@ if (is_float) { float f = (float)os_strtod(sp->cfp.cur_token->str.array); - if (is_negative) f = -f; + if (is_negative) + f = -f; da_push_back_array(param->default_val, &f, sizeof(float)); } else { long l = strtol(sp->cfp.cur_token->str.array, NULL, 10); - if (is_negative) l = -l; + if (is_negative) + l = -l; da_push_back_array(param->default_val, &l, sizeof(long)); } @@ -541,47 +557,50 @@ * for float3x3, float4x4, etc */ static inline int sp_parse_param_assign_float_array(struct shader_parser *sp, - struct shader_var *param) + struct shader_var *param) { - const char *float_type = param->type+5; + const char *float_type = param->type + 5; int float_count = 0, code, i; /* -------------------------------------------- */ if (float_type[0] < '1' || float_type[0] > '4') - cf_adderror(&sp->cfp, "Invalid row count", LEX_ERROR, - NULL, NULL, NULL); + cf_adderror(&sp->cfp, "Invalid row count", LEX_ERROR, NULL, + NULL, NULL); - float_count = float_type[0]-'0'; + float_count = float_type[0] - '0'; if (float_type[1] == 'x') { if (float_type[2] < '1' || float_type[2] > '4') - cf_adderror(&sp->cfp, "Invalid column count", - LEX_ERROR, NULL, NULL, NULL); + cf_adderror(&sp->cfp, "Invalid column count", LEX_ERROR, + NULL, NULL, NULL); - float_count *= float_type[2]-'0'; + float_count *= float_type[2] - '0'; } /* -------------------------------------------- */ code = cf_next_token_should_be(&sp->cfp, "{", ";", NULL); - if (code != PARSE_SUCCESS) return code; + if (code != PARSE_SUCCESS) + return code; for (i = 0; i < float_count; i++) { - char *next = ((i+1) < float_count) ? "," : "}"; + char *next = ((i + 1) < float_count) ? "," : "}"; code = sp_parse_param_assign_intfloat(sp, param, true); - if (code != PARSE_SUCCESS) return code; + if (code != PARSE_SUCCESS) + return code; code = cf_next_token_should_be(&sp->cfp, next, ";", NULL); - if (code != PARSE_SUCCESS) return code; + if (code != PARSE_SUCCESS) + return code; } return PARSE_SUCCESS; } static int sp_parse_param_assignment_val(struct shader_parser *sp, - struct shader_var *param) + struct shader_var *param) { if (strcmp(param->type, "int") == 0) return sp_parse_param_assign_intfloat(sp, param, false); @@ -591,13 +610,13 @@ return sp_parse_param_assign_float_array(sp, param); cf_adderror(&sp->cfp, "Invalid type '$1' used for assignment", - LEX_ERROR, param->type, NULL, NULL); + LEX_ERROR, param->type, NULL, NULL); return PARSE_CONTINUE; } static inline bool sp_parse_param_assign(struct shader_parser *sp, - struct shader_var *param) + struct shader_var *param) { if (sp_parse_param_assignment_val(sp, param) != PARSE_SUCCESS) return false; @@ -608,8 +627,8 @@ return true; } -static void sp_parse_param(struct shader_parser *sp, - char *type, char *name, bool is_const, bool is_uniform) +static void sp_parse_param(struct shader_parser *sp, char *type, char *name, + bool is_const, bool is_uniform) { struct shader_var param; shader_var_init_param(¶m, type, name, is_uniform, is_const); @@ -631,10 +650,10 @@ shader_var_free(¶m); } -static bool sp_get_var_specifiers(struct shader_parser *sp, - bool *is_const, bool *is_uniform) +static bool sp_get_var_specifiers(struct shader_parser *sp, bool *is_const, + bool *is_uniform) { - while(true) { + while (true) { int code = sp_check_for_keyword(sp, "const", is_const); if (code == PARSE_EOF) return false; @@ -654,12 +673,13 @@ } static inline void report_invalid_func_keyword(struct shader_parser *sp, - const char *name, bool val) + const char *name, bool val) { if (val) - cf_adderror(&sp->cfp, "'$1' keyword cannot be used with a " - "function", LEX_ERROR, - name, NULL, NULL); + cf_adderror(&sp->cfp, + "'$1' keyword cannot be used with a " + "function", + LEX_ERROR, name, NULL, NULL); } static void sp_parse_other(struct shader_parser *sp) @@ -679,8 +699,8 @@ goto error; if (cf_token_is(&sp->cfp, "(")) { - report_invalid_func_keyword(sp, "const", is_const); - report_invalid_func_keyword(sp, "uniform", is_uniform); + report_invalid_func_keyword(sp, "const", is_const); + report_invalid_func_keyword(sp, "uniform", is_uniform); sp_parse_function(sp, type, name); return; @@ -695,7 +715,7 @@ } bool shader_parse(struct shader_parser *sp, const char *shader, - const char *file) + const char *file) { if (!cf_parser_parse(&sp->cfp, shader, file)) return false; @@ -713,7 +733,7 @@ } else if (cf_token_is(&sp->cfp, "{")) { cf_adderror(&sp->cfp, "Unexpected code segment", - LEX_ERROR, NULL, NULL, NULL); + LEX_ERROR, NULL, NULL, NULL); cf_pass_pair(&sp->cfp, '{', '}'); } else {
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/shader-parser.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/shader-parser.h
Changed
@@ -61,9 +61,9 @@ memset(sv, 0, sizeof(struct shader_var)); } -static inline void shader_var_init_param(struct shader_var *sv, - char *type, char *name, bool is_uniform, - bool is_const) +static inline void shader_var_init_param(struct shader_var *sv, char *type, + char *name, bool is_uniform, + bool is_const) { if (is_uniform) sv->var_type = SHADER_VAR_UNIFORM; @@ -72,10 +72,11 @@ else sv->var_type = SHADER_VAR_NONE; - sv->type = type; - sv->name = name; - sv->mapping = NULL; + sv->type = type; + sv->name = name; + sv->mapping = NULL; sv->array_count = 0; + sv->gl_sampler_id = (size_t)-1; da_init(sv->default_val); } @@ -91,8 +92,8 @@ struct shader_sampler { char *name; - DARRAY(char*) states; - DARRAY(char*) values; + DARRAY(char *) states; + DARRAY(char *) values; }; static inline void shader_sampler_init(struct shader_sampler *ss) @@ -114,7 +115,7 @@ } EXPORT void shader_sampler_convert(struct shader_sampler *ss, - struct gs_sampler_info *info); + struct gs_sampler_info *info); /* ------------------------------------------------------------------------- */ @@ -133,7 +134,7 @@ size_t i; for (i = 0; i < ss->vars.num; i++) - shader_var_free(ss->vars.array+i); + shader_var_free(ss->vars.array + i); bfree(ss->name); da_free(ss->vars); @@ -150,16 +151,16 @@ struct cf_token *start, *end; }; -static inline void shader_func_init(struct shader_func *sf, - char *return_type, char *name) +static inline void shader_func_init(struct shader_func *sf, char *return_type, + char *name) { da_init(sf->params); - sf->return_type = return_type; + sf->return_type = return_type; sf->mapping = NULL; - sf->name = name; - sf->start = NULL; - sf->end = NULL; + sf->name = name; + sf->start = NULL; + sf->end = NULL; } static inline void shader_func_free(struct shader_func *sf) @@ -167,7 +168,7 @@ size_t i; for (i = 0; i < sf->params.num; i++) - shader_var_free(sf->params.array+i); + shader_var_free(sf->params.array + i); bfree(sf->name); bfree(sf->return_type); @@ -180,10 +181,10 @@ struct shader_parser { struct cf_parser cfp; - DARRAY(struct shader_var) params; - DARRAY(struct shader_struct) structs; + DARRAY(struct shader_var) params; + DARRAY(struct shader_struct) structs; DARRAY(struct shader_sampler) samplers; - DARRAY(struct shader_func) funcs; + DARRAY(struct shader_func) funcs; }; static inline void shader_parser_init(struct shader_parser *sp) @@ -201,13 +202,13 @@ size_t i; for (i = 0; i < sp->params.num; i++) - shader_var_free(sp->params.array+i); + shader_var_free(sp->params.array + i); for (i = 0; i < sp->structs.num; i++) - shader_struct_free(sp->structs.array+i); + shader_struct_free(sp->structs.array + i); for (i = 0; i < sp->samplers.num; i++) - shader_sampler_free(sp->samplers.array+i); + shader_sampler_free(sp->samplers.array + i); for (i = 0; i < sp->funcs.num; i++) - shader_func_free(sp->funcs.array+i); + shader_func_free(sp->funcs.array + i); cf_parser_free(&sp->cfp); da_free(sp->params); @@ -217,19 +218,19 @@ } EXPORT bool shader_parse(struct shader_parser *sp, const char *shader, - const char *file); + const char *file); static inline char *shader_parser_geterrors(struct shader_parser *sp) { return error_data_buildstring(&sp->cfp.error_list); } -static inline struct shader_var *shader_parser_getparam( - struct shader_parser *sp, const char *param_name) +static inline struct shader_var * +shader_parser_getparam(struct shader_parser *sp, const char *param_name) { size_t i; for (i = 0; i < sp->params.num; i++) { - struct shader_var *param = sp->params.array+i; + struct shader_var *param = sp->params.array + i; if (strcmp(param->name, param_name) == 0) return param; } @@ -237,12 +238,12 @@ return NULL; } -static inline struct shader_struct *shader_parser_getstruct( - struct shader_parser *sp, const char *struct_name) +static inline struct shader_struct * +shader_parser_getstruct(struct shader_parser *sp, const char *struct_name) { size_t i; for (i = 0; i < sp->structs.num; i++) { - struct shader_struct *st = sp->structs.array+i; + struct shader_struct *st = sp->structs.array + i; if (strcmp(st->name, struct_name) == 0) return st; } @@ -250,12 +251,12 @@ return NULL; } -static inline struct shader_sampler *shader_parser_getsampler( - struct shader_parser *sp, const char *sampler_name) +static inline struct shader_sampler * +shader_parser_getsampler(struct shader_parser *sp, const char *sampler_name) { size_t i; for (i = 0; i < sp->samplers.num; i++) { - struct shader_sampler *sampler = sp->samplers.array+i; + struct shader_sampler *sampler = sp->samplers.array + i; if (strcmp(sampler->name, sampler_name) == 0) return sampler; } @@ -263,12 +264,12 @@ return NULL; } -static inline struct shader_func *shader_parser_getfunc( - struct shader_parser *sp, const char *func_name) +static inline struct shader_func * +shader_parser_getfunc(struct shader_parser *sp, const char *func_name) { size_t i; for (i = 0; i < sp->funcs.num; i++) { - struct shader_func *func = sp->funcs.array+i; + struct shader_func *func = sp->funcs.array + i; if (strcmp(func->name, func_name) == 0) return func; }
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/texture-render.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/texture-render.c
Changed
@@ -24,23 +24,23 @@ #include "graphics.h" struct gs_texture_render { - gs_texture_t *target, *prev_target; + gs_texture_t *target, *prev_target; gs_zstencil_t *zs, *prev_zs; uint32_t cx, cy; - enum gs_color_format format; + enum gs_color_format format; enum gs_zstencil_format zsformat; bool rendered; }; gs_texrender_t *gs_texrender_create(enum gs_color_format format, - enum gs_zstencil_format zsformat) + enum gs_zstencil_format zsformat) { struct gs_texture_render *texrender; texrender = bzalloc(sizeof(struct gs_texture_render)); - texrender->format = format; + texrender->format = format; texrender->zsformat = zsformat; return texrender; @@ -56,7 +56,7 @@ } static bool texrender_resetbuffer(gs_texrender_t *texrender, uint32_t cx, - uint32_t cy) + uint32_t cy) { if (!texrender) return false; @@ -65,12 +65,12 @@ gs_zstencil_destroy(texrender->zs); texrender->target = NULL; - texrender->zs = NULL; - texrender->cx = cx; - texrender->cy = cy; + texrender->zs = NULL; + texrender->cx = cx; + texrender->cy = cy; - texrender->target = gs_texture_create(cx, cy, texrender->format, - 1, NULL, GS_RENDER_TARGET); + texrender->target = gs_texture_create(cx, cy, texrender->format, 1, + NULL, GS_RENDER_TARGET); if (!texrender->target) return false; @@ -108,7 +108,7 @@ gs_matrix_identity(); texrender->prev_target = gs_get_render_target(); - texrender->prev_zs = gs_get_zstencil_target(); + texrender->prev_zs = gs_get_zstencil_target(); gs_set_render_target(texrender->target, texrender->zs); gs_set_viewport(0, 0, texrender->cx, texrender->cy);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/vec2.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/vec2.h
Changed
@@ -52,51 +52,47 @@ } static inline void vec2_add(struct vec2 *dst, const struct vec2 *v1, - const struct vec2 *v2) + const struct vec2 *v2) { - vec2_set(dst, v1->x+v2->x, v1->y+v2->y); + vec2_set(dst, v1->x + v2->x, v1->y + v2->y); } static inline void vec2_sub(struct vec2 *dst, const struct vec2 *v1, - const struct vec2 *v2) + const struct vec2 *v2) { - vec2_set(dst, v1->x-v2->x, v1->y-v2->y); + vec2_set(dst, v1->x - v2->x, v1->y - v2->y); } static inline void vec2_mul(struct vec2 *dst, const struct vec2 *v1, - const struct vec2 *v2) + const struct vec2 *v2) { - vec2_set(dst, v1->x*v2->x, v1->y*v2->y); + vec2_set(dst, v1->x * v2->x, v1->y * v2->y); } static inline void vec2_div(struct vec2 *dst, const struct vec2 *v1, - const struct vec2 *v2) + const struct vec2 *v2) { - vec2_set(dst, v1->x/v2->x, v1->y/v2->y); + vec2_set(dst, v1->x / v2->x, v1->y / v2->y); } -static inline void vec2_addf(struct vec2 *dst, const struct vec2 *v, - float f) +static inline void vec2_addf(struct vec2 *dst, const struct vec2 *v, float f) { - vec2_set(dst, v->x+f, v->y+f); + vec2_set(dst, v->x + f, v->y + f); } -static inline void vec2_subf(struct vec2 *dst, const struct vec2 *v, - float f) +static inline void vec2_subf(struct vec2 *dst, const struct vec2 *v, float f) { - vec2_set(dst, v->x-f, v->y-f); + vec2_set(dst, v->x - f, v->y - f); } -static inline void vec2_mulf(struct vec2 *dst, const struct vec2 *v, - float f) +static inline void vec2_mulf(struct vec2 *dst, const struct vec2 *v, float f) { - vec2_set(dst, v->x*f, v->y*f); + vec2_set(dst, v->x * f, v->y * f); } -static inline void vec2_divf(struct vec2 *dst, const struct vec2 *v, - float f) +static inline void vec2_divf(struct vec2 *dst, const struct vec2 *v, float f) { - vec2_set(dst, v->x/f, v->y/f); + vec2_set(dst, v->x / f, v->y / f); } static inline void vec2_neg(struct vec2 *dst, const struct vec2 *v) @@ -106,12 +102,12 @@ static inline float vec2_dot(const struct vec2 *v1, const struct vec2 *v2) { - return v1->x*v2->x + v1->y*v2->y; + return v1->x * v2->x + v1->y * v2->y; } static inline float vec2_len(const struct vec2 *v) { - return sqrtf(v->x*v->x + v->y*v->y); + return sqrtf(v->x * v->x + v->y * v->y); } static inline float vec2_dist(const struct vec2 *v1, const struct vec2 *v2) @@ -121,8 +117,7 @@ return vec2_len(&temp); } -static inline void vec2_minf(struct vec2 *dst, const struct vec2 *v, - float val) +static inline void vec2_minf(struct vec2 *dst, const struct vec2 *v, float val) { if (v->x < val) dst->x = val; @@ -131,7 +126,7 @@ } static inline void vec2_min(struct vec2 *dst, const struct vec2 *v, - const struct vec2 *min_v) + const struct vec2 *min_v) { if (v->x < min_v->x) dst->x = min_v->x; @@ -139,8 +134,7 @@ dst->y = min_v->y; } -static inline void vec2_maxf(struct vec2 *dst, const struct vec2 *v, - float val) +static inline void vec2_maxf(struct vec2 *dst, const struct vec2 *v, float val) { if (v->x > val) dst->x = val; @@ -149,7 +143,7 @@ } static inline void vec2_max(struct vec2 *dst, const struct vec2 *v, - const struct vec2 *max_v) + const struct vec2 *max_v) { if (v->x > max_v->x) dst->x = max_v->x; @@ -161,7 +155,7 @@ EXPORT void vec2_floor(struct vec2 *dst, const struct vec2 *v); EXPORT void vec2_ceil(struct vec2 *dst, const struct vec2 *v); EXPORT int vec2_close(const struct vec2 *v1, const struct vec2 *v2, - float epsilon); + float epsilon); EXPORT void vec2_norm(struct vec2 *dst, const struct vec2 *v); #ifdef __cplusplus
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/vec3.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/vec3.c
Changed
@@ -35,7 +35,7 @@ } void vec3_rotate(struct vec3 *dst, const struct vec3 *v, - const struct matrix3 *m) + const struct matrix3 *m) { struct vec3 temp; vec3_copy(&temp, v); @@ -47,7 +47,7 @@ } void vec3_transform(struct vec3 *dst, const struct vec3 *v, - const struct matrix4 *m) + const struct matrix4 *m) { struct vec4 v4; vec4_from_vec3(&v4, v); @@ -56,7 +56,7 @@ } void vec3_transform3x4(struct vec3 *dst, const struct vec3 *v, - const struct matrix3 *m) + const struct matrix3 *m) { struct vec3 temp; vec3_sub(&temp, v, &m->t); @@ -75,7 +75,7 @@ } void vec3_mirrorv(struct vec3 *dst, const struct vec3 *v, - const struct vec3 *vec) + const struct vec3 *vec) { struct vec3 temp; vec3_mulf(&temp, vec, vec3_dot(v, vec) * 2.0f);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/vec3.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/vec3.h
Changed
@@ -58,54 +58,50 @@ EXPORT void vec3_from_vec4(struct vec3 *dst, const struct vec4 *v); static inline void vec3_add(struct vec3 *dst, const struct vec3 *v1, - const struct vec3 *v2) + const struct vec3 *v2) { dst->m = _mm_add_ps(v1->m, v2->m); dst->w = 0.0f; } static inline void vec3_sub(struct vec3 *dst, const struct vec3 *v1, - const struct vec3 *v2) + const struct vec3 *v2) { dst->m = _mm_sub_ps(v1->m, v2->m); dst->w = 0.0f; } static inline void vec3_mul(struct vec3 *dst, const struct vec3 *v1, - const struct vec3 *v2) + const struct vec3 *v2) { dst->m = _mm_mul_ps(v1->m, v2->m); } static inline void vec3_div(struct vec3 *dst, const struct vec3 *v1, - const struct vec3 *v2) + const struct vec3 *v2) { dst->m = _mm_div_ps(v1->m, v2->m); dst->w = 0.0f; } -static inline void vec3_addf(struct vec3 *dst, const struct vec3 *v, - float f) +static inline void vec3_addf(struct vec3 *dst, const struct vec3 *v, float f) { dst->m = _mm_add_ps(v->m, _mm_set1_ps(f)); dst->w = 0.0f; } -static inline void vec3_subf(struct vec3 *dst, const struct vec3 *v, - float f) +static inline void vec3_subf(struct vec3 *dst, const struct vec3 *v, float f) { dst->m = _mm_sub_ps(v->m, _mm_set1_ps(f)); dst->w = 0.0f; } -static inline void vec3_mulf(struct vec3 *dst, const struct vec3 *v, - float f) +static inline void vec3_mulf(struct vec3 *dst, const struct vec3 *v, float f) { dst->m = _mm_mul_ps(v->m, _mm_set1_ps(f)); } -static inline void vec3_divf(struct vec3 *dst, const struct vec3 *v, - float f) +static inline void vec3_divf(struct vec3 *dst, const struct vec3 *v, float f) { dst->m = _mm_div_ps(v->m, _mm_set1_ps(f)); dst->w = 0.0f; @@ -121,7 +117,7 @@ } static inline void vec3_cross(struct vec3 *dst, const struct vec3 *v1, - const struct vec3 *v2) + const struct vec3 *v2) { __m128 s1v1 = _mm_shuffle_ps(v1->m, v1->m, _MM_SHUFFLE(3, 0, 2, 1)); __m128 s1v2 = _mm_shuffle_ps(v2->m, v2->m, _MM_SHUFFLE(3, 1, 0, 2)); @@ -157,13 +153,13 @@ static inline void vec3_norm(struct vec3 *dst, const struct vec3 *v) { float dot_val = vec3_dot(v, v); - dst->m = (dot_val > 0.0f) ? - _mm_mul_ps(v->m, _mm_set1_ps(1.0f/sqrtf(dot_val))) : - _mm_setzero_ps(); + dst->m = (dot_val > 0.0f) + ? _mm_mul_ps(v->m, _mm_set1_ps(1.0f / sqrtf(dot_val))) + : _mm_setzero_ps(); } static inline bool vec3_close(const struct vec3 *v1, const struct vec3 *v2, - float epsilon) + float epsilon) { struct vec3 test; vec3_sub(&test, v1, v2); @@ -171,28 +167,26 @@ } static inline void vec3_min(struct vec3 *dst, const struct vec3 *v1, - const struct vec3 *v2) + const struct vec3 *v2) { dst->m = _mm_min_ps(v1->m, v2->m); dst->w = 0.0f; } -static inline void vec3_minf(struct vec3 *dst, const struct vec3 *v, - float f) +static inline void vec3_minf(struct vec3 *dst, const struct vec3 *v, float f) { dst->m = _mm_min_ps(v->m, _mm_set1_ps(f)); dst->w = 0.0f; } static inline void vec3_max(struct vec3 *dst, const struct vec3 *v1, - const struct vec3 *v2) + const struct vec3 *v2) { dst->m = _mm_max_ps(v1->m, v2->m); dst->w = 0.0f; } -static inline void vec3_maxf(struct vec3 *dst, const struct vec3 *v, - float f) +static inline void vec3_maxf(struct vec3 *dst, const struct vec3 *v, float f) { dst->m = _mm_max_ps(v->m, _mm_set1_ps(f)); dst->w = 0.0f; @@ -225,17 +219,17 @@ EXPORT float vec3_plane_dist(const struct vec3 *v, const struct plane *p); EXPORT void vec3_transform(struct vec3 *dst, const struct vec3 *v, - const struct matrix4 *m); + const struct matrix4 *m); EXPORT void vec3_rotate(struct vec3 *dst, const struct vec3 *v, - const struct matrix3 *m); + const struct matrix3 *m); EXPORT void vec3_transform3x4(struct vec3 *dst, const struct vec3 *v, - const struct matrix3 *m); + const struct matrix3 *m); EXPORT void vec3_mirror(struct vec3 *dst, const struct vec3 *v, - const struct plane *p); + const struct plane *p); EXPORT void vec3_mirrorv(struct vec3 *dst, const struct vec3 *v, - const struct vec3 *vec); + const struct vec3 *vec); EXPORT void vec3_rand(struct vec3 *dst, int positive_only);
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/vec4.c -> obs-studio-24.0.0.tar.xz/libobs/graphics/vec4.c
Changed
@@ -26,7 +26,7 @@ } void vec4_transform(struct vec4 *dst, const struct vec4 *v, - const struct matrix4 *m) + const struct matrix4 *m) { struct vec4 temp; struct matrix4 transpose;
View file
obs-studio-23.2.1.tar.xz/libobs/graphics/vec4.h -> obs-studio-24.0.0.tar.xz/libobs/graphics/vec4.h
Changed
@@ -43,7 +43,7 @@ } static inline void vec4_set(struct vec4 *dst, float x, float y, float z, - float w) + float w) { dst->m = _mm_set_ps(w, z, y, x); } @@ -56,49 +56,45 @@ EXPORT void vec4_from_vec3(struct vec4 *dst, const struct vec3 *v); static inline void vec4_add(struct vec4 *dst, const struct vec4 *v1, - const struct vec4 *v2) + const struct vec4 *v2) { dst->m = _mm_add_ps(v1->m, v2->m); } static inline void vec4_sub(struct vec4 *dst, const struct vec4 *v1, - const struct vec4 *v2) + const struct vec4 *v2) { dst->m = _mm_sub_ps(v1->m, v2->m); } static inline void vec4_mul(struct vec4 *dst, const struct vec4 *v1, - const struct vec4 *v2) + const struct vec4 *v2) { dst->m = _mm_mul_ps(v1->m, v2->m); } static inline void vec4_div(struct vec4 *dst, const struct vec4 *v1, - const struct vec4 *v2) + const struct vec4 *v2) { dst->m = _mm_div_ps(v1->m, v2->m); } -static inline void vec4_addf(struct vec4 *dst, const struct vec4 *v, - float f) +static inline void vec4_addf(struct vec4 *dst, const struct vec4 *v, float f) { dst->m = _mm_add_ps(v->m, _mm_set1_ps(f)); } -static inline void vec4_subf(struct vec4 *dst, const struct vec4 *v, - float f) +static inline void vec4_subf(struct vec4 *dst, const struct vec4 *v, float f) { dst->m = _mm_sub_ps(v->m, _mm_set1_ps(f)); } -static inline void vec4_mulf(struct vec4 *dst, const struct vec4 *v, - float f) +static inline void vec4_mulf(struct vec4 *dst, const struct vec4 *v, float f) { dst->m = _mm_mul_ps(v->m, _mm_set1_ps(f)); } -static inline void vec4_divf(struct vec4 *dst, const struct vec4 *v, - float f) +static inline void vec4_divf(struct vec4 *dst, const struct vec4 *v, float f) { dst->m = _mm_div_ps(v->m, _mm_set1_ps(f)); } @@ -139,42 +135,38 @@ static inline void vec4_norm(struct vec4 *dst, const struct vec4 *v) { float dot_val = vec4_dot(v, v); - dst->m = (dot_val > 0.0f) ? - _mm_mul_ps(v->m, _mm_set1_ps(1.0f/sqrtf(dot_val))) : - _mm_setzero_ps(); + dst->m = (dot_val > 0.0f) + ? _mm_mul_ps(v->m, _mm_set1_ps(1.0f / sqrtf(dot_val))) + : _mm_setzero_ps(); } static inline int vec4_close(const struct vec4 *v1, const struct vec4 *v2, - float epsilon) + float epsilon) { struct vec4 test; vec4_sub(&test, v1, v2); - return test.x < epsilon && - test.y < epsilon && - test.z < epsilon && + return test.x < epsilon && test.y < epsilon && test.z < epsilon && test.w < epsilon; } static inline void vec4_min(struct vec4 *dst, const struct vec4 *v1, - const struct vec4 *v2) + const struct vec4 *v2) { dst->m = _mm_min_ps(v1->m, v2->m); } -static inline void vec4_minf(struct vec4 *dst, const struct vec4 *v, - float f) +static inline void vec4_minf(struct vec4 *dst, const struct vec4 *v, float f) { dst->m = _mm_min_ps(v->m, _mm_set1_ps(f)); } static inline void vec4_max(struct vec4 *dst, const struct vec4 *v1, - const struct vec4 *v2) + const struct vec4 *v2) { dst->m = _mm_max_ps(v1->m, v2->m); } -static inline void vec4_maxf(struct vec4 *dst, const struct vec4 *v, - float f) +static inline void vec4_maxf(struct vec4 *dst, const struct vec4 *v, float f) { dst->m = _mm_max_ps(v->m, _mm_set1_ps(f)); } @@ -206,7 +198,7 @@ static inline uint32_t vec4_to_rgba(const struct vec4 *src) { uint32_t val; - val = (uint32_t)((double)src->x * 255.0); + val = (uint32_t)((double)src->x * 255.0); val |= (uint32_t)((double)src->y * 255.0) << 8; val |= (uint32_t)((double)src->z * 255.0) << 16; val |= (uint32_t)((double)src->w * 255.0) << 24; @@ -216,7 +208,7 @@ static inline uint32_t vec4_to_bgra(const struct vec4 *src) { uint32_t val; - val = (uint32_t)((double)src->z * 255.0); + val = (uint32_t)((double)src->z * 255.0); val |= (uint32_t)((double)src->y * 255.0) << 8; val |= (uint32_t)((double)src->x * 255.0) << 16; val |= (uint32_t)((double)src->w * 255.0) << 24; @@ -225,28 +217,28 @@ static inline void vec4_from_rgba(struct vec4 *dst, uint32_t rgba) { - dst->x = (float)((double)(rgba&0xFF) * (1.0/255.0)); + dst->x = (float)((double)(rgba & 0xFF) * (1.0 / 255.0)); rgba >>= 8; - dst->y = (float)((double)(rgba&0xFF) * (1.0/255.0)); + dst->y = (float)((double)(rgba & 0xFF) * (1.0 / 255.0)); rgba >>= 8; - dst->z = (float)((double)(rgba&0xFF) * (1.0/255.0)); + dst->z = (float)((double)(rgba & 0xFF) * (1.0 / 255.0)); rgba >>= 8; - dst->w = (float)((double)(rgba&0xFF) * (1.0/255.0)); + dst->w = (float)((double)(rgba & 0xFF) * (1.0 / 255.0)); } static inline void vec4_from_bgra(struct vec4 *dst, uint32_t bgra) { - dst->z = (float)((double)(bgra&0xFF) * (1.0/255.0)); + dst->z = (float)((double)(bgra & 0xFF) * (1.0 / 255.0)); bgra >>= 8; - dst->y = (float)((double)(bgra&0xFF) * (1.0/255.0)); + dst->y = (float)((double)(bgra & 0xFF) * (1.0 / 255.0)); bgra >>= 8; - dst->x = (float)((double)(bgra&0xFF) * (1.0/255.0)); + dst->x = (float)((double)(bgra & 0xFF) * (1.0 / 255.0)); bgra >>= 8; - dst->w = (float)((double)(bgra&0xFF) * (1.0/255.0)); + dst->w = (float)((double)(bgra & 0xFF) * (1.0 / 255.0)); } EXPORT void vec4_transform(struct vec4 *dst, const struct vec4 *v, - const struct matrix4 *m); + const struct matrix4 *m); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/libobs.pc.in -> obs-studio-24.0.0.tar.xz/libobs/libobs.pc.in
Changed
@@ -1,7 +1,7 @@ -prefix=@DEST_DIR@ +prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -libdir=${prefix}/@OBS_LIBRARY_DESTINATION@ -includedir=${prefix}/include +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: libobs Description: OBS Studio Library
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/audio-io.c -> obs-studio-24.0.0.tar.xz/libobs/media-io/audio-io.c
Changed
@@ -31,11 +31,14 @@ /* #define DEBUG_AUDIO */ -#define nop() do {int invalid = 0;} while(0) +#define nop() \ + do { \ + int invalid = 0; \ + } while (0) struct audio_input { struct audio_convert_info conversion; - audio_resampler_t *resampler; + audio_resampler_t *resampler; audio_output_callback_t callback; void *param; @@ -52,20 +55,20 @@ }; struct audio_output { - struct audio_output_info info; - size_t block_size; - size_t channels; - size_t planes; + struct audio_output_info info; + size_t block_size; + size_t channels; + size_t planes; - pthread_t thread; - os_event_t *stop_event; + pthread_t thread; + os_event_t *stop_event; - bool initialized; + bool initialized; - audio_input_callback_t input_cb; - void *input_param; - pthread_mutex_t input_mutex; - struct audio_mix mixes[MAX_AUDIO_MIXES]; + audio_input_callback_t input_cb; + void *input_param; + pthread_mutex_t input_mutex; + struct audio_mix mixes[MAX_AUDIO_MIXES]; }; /* ------------------------------------------------------------------------- */ @@ -84,7 +87,7 @@ static inline double positive_round(double val) { - return floor(val+0.5); + return floor(val + 0.5); } static int64_t ts_diff_frames(const audio_t *audio, uint64_t ts1, uint64_t ts2) @@ -116,33 +119,32 @@ #endif static bool resample_audio_output(struct audio_input *input, - struct audio_data *data) + struct audio_data *data) { bool success = true; if (input->resampler) { - uint8_t *output[MAX_AV_PLANES]; + uint8_t *output[MAX_AV_PLANES]; uint32_t frames; uint64_t offset; memset(output, 0, sizeof(output)); - success = audio_resampler_resample(input->resampler, - output, &frames, &offset, - (const uint8_t *const *)data->data, - data->frames); + success = audio_resampler_resample( + input->resampler, output, &frames, &offset, + (const uint8_t *const *)data->data, data->frames); for (size_t i = 0; i < MAX_AV_PLANES; i++) data->data[i] = output[i]; - data->frames = frames; + data->frames = frames; data->timestamp -= offset; } return success; } -static inline void do_audio_output(struct audio_output *audio, - size_t mix_idx, uint64_t timestamp, uint32_t frames) +static inline void do_audio_output(struct audio_output *audio, size_t mix_idx, + uint64_t timestamp, uint32_t frames) { struct audio_mix *mix = &audio->mixes[mix_idx]; struct audio_data data; @@ -150,10 +152,10 @@ pthread_mutex_lock(&audio->input_mutex); for (size_t i = mix->inputs.num; i > 0; i--) { - struct audio_input *input = mix->inputs.array+(i-1); + struct audio_input *input = mix->inputs.array + (i - 1); for (size_t i = 0; i < audio->planes; i++) - data.data[i] = (uint8_t*)mix->buffer[i]; + data.data[i] = (uint8_t *)mix->buffer[i]; data.frames = frames; data.timestamp = timestamp; @@ -181,7 +183,7 @@ while (mix_data < mix_end) { float val = *mix_data; - val = (val > 1.0f) ? 1.0f : val; + val = (val > 1.0f) ? 1.0f : val; val = (val < -1.0f) ? -1.0f : val; *(mix_data++) = val; } @@ -189,8 +191,8 @@ } } -static void input_and_output(struct audio_output *audio, - uint64_t audio_time, uint64_t prev_time) +static void input_and_output(struct audio_output *audio, uint64_t audio_time, + uint64_t prev_time) { size_t bytes = AUDIO_OUTPUT_FRAMES * audio->block_size; struct audio_output_data data[MAX_AUDIO_MIXES]; @@ -202,7 +204,7 @@ #ifdef DEBUG_AUDIO blog(LOG_DEBUG, "audio_time: %llu, prev_time: %llu, bytes: %lu", - audio_time, prev_time, bytes); + audio_time, prev_time, bytes); #endif /* get mixers */ @@ -217,8 +219,9 @@ for (size_t mix_idx = 0; mix_idx < MAX_AUDIO_MIXES; mix_idx++) { struct audio_mix *mix = &audio->mixes[mix_idx]; - memset(mix->buffer[0], 0, AUDIO_OUTPUT_FRAMES * - MAX_AUDIO_CHANNELS * sizeof(float)); + memset(mix->buffer[0], 0, + AUDIO_OUTPUT_FRAMES * MAX_AUDIO_CHANNELS * + sizeof(float)); for (size_t i = 0; i < audio->planes; i++) data[mix_idx].data[i] = mix->buffer[i]; @@ -226,7 +229,7 @@ /* get new audio data */ success = audio->input_cb(audio->input_param, prev_time, audio_time, - &new_ts, active_mixes, data); + &new_ts, active_mixes, data); if (!success) return; @@ -246,15 +249,14 @@ uint64_t start_time = os_gettime_ns(); uint64_t prev_time = start_time; uint64_t audio_time = prev_time; - uint32_t audio_wait_time = - (uint32_t)(audio_frames_to_ns(rate, AUDIO_OUTPUT_FRAMES) / - 1000000); + uint32_t audio_wait_time = (uint32_t)( + audio_frames_to_ns(rate, AUDIO_OUTPUT_FRAMES) / 1000000); os_set_thread_name("audio-io: audio thread"); const char *audio_thread_name = profile_store_name(obs_get_profiler_name_store(), - "audio_thread(%s)", audio->info.name); + "audio_thread(%s)", audio->info.name); while (os_event_try(audio->stop_event) == EAGAIN) { uint64_t cur_time; @@ -266,8 +268,8 @@ cur_time = os_gettime_ns(); while (audio_time <= cur_time) { samples += AUDIO_OUTPUT_FRAMES; - audio_time = start_time + - audio_frames_to_ns(rate, samples); + audio_time = + start_time + audio_frames_to_ns(rate, samples); input_and_output(audio, audio_time, prev_time); prev_time = audio_time; @@ -284,12 +286,12 @@ /* ------------------------------------------------------------------------- */ static size_t audio_get_input_idx(const audio_t *audio, size_t mix_idx, - audio_output_callback_t callback, void *param) + audio_output_callback_t callback, void *param) { const struct audio_mix *mix = &audio->mixes[mix_idx]; for (size_t i = 0; i < mix->inputs.num; i++) { - struct audio_input *input = mix->inputs.array+i; + struct audio_input *input = mix->inputs.array + i; if (input->callback == callback && input->param == param) return i; @@ -299,27 +301,25 @@ } static inline bool audio_input_init(struct audio_input *input, - struct audio_output *audio) + struct audio_output *audio) { - if (input->conversion.format != audio->info.format || + if (input->conversion.format != audio->info.format || input->conversion.samples_per_sec != audio->info.samples_per_sec || - input->conversion.speakers != audio->info.speakers) { + input->conversion.speakers != audio->info.speakers) { struct resample_info from = { - .format = audio->info.format, + .format = audio->info.format, .samples_per_sec = audio->info.samples_per_sec, - .speakers = audio->info.speakers - }; + .speakers = audio->info.speakers}; struct resample_info to = { - .format = input->conversion.format, + .format = input->conversion.format, .samples_per_sec = input->conversion.samples_per_sec, - .speakers = input->conversion.speakers - }; + .speakers = input->conversion.speakers}; input->resampler = audio_resampler_create(&to, &from); if (!input->resampler) { blog(LOG_ERROR, "audio_input_init: Failed to " - "create resampler"); + "create resampler"); return false; } } else { @@ -330,12 +330,13 @@ } bool audio_output_connect(audio_t *audio, size_t mi, - const struct audio_convert_info *conversion, - audio_output_callback_t callback, void *param) + const struct audio_convert_info *conversion, + audio_output_callback_t callback, void *param) { bool success = false; - if (!audio || mi >= MAX_AUDIO_MIXES) return false; + if (!audio || mi >= MAX_AUDIO_MIXES) + return false; pthread_mutex_lock(&audio->input_mutex); @@ -343,7 +344,7 @@ struct audio_mix *mix = &audio->mixes[mi]; struct audio_input input; input.callback = callback; - input.param = param; + input.param = param; if (conversion) { input.conversion = *conversion; @@ -373,16 +374,17 @@ } void audio_output_disconnect(audio_t *audio, size_t mix_idx, - audio_output_callback_t callback, void *param) + audio_output_callback_t callback, void *param) { - if (!audio || mix_idx >= MAX_AUDIO_MIXES) return; + if (!audio || mix_idx >= MAX_AUDIO_MIXES) + return; pthread_mutex_lock(&audio->input_mutex); size_t idx = audio_get_input_idx(audio, mix_idx, callback, param); if (idx != DARRAY_INVALID) { struct audio_mix *mix = &audio->mixes[mix_idx]; - audio_input_free(mix->inputs.array+idx); + audio_input_free(mix->inputs.array + idx); da_erase(mix->inputs, idx); } @@ -409,12 +411,12 @@ goto fail; memcpy(&out->info, info, sizeof(struct audio_output_info)); - out->channels = get_audio_channels(info->speakers); - out->planes = planar ? out->channels : 1; - out->input_cb = info->input_callback; - out->input_param= info->input_param; + out->channels = get_audio_channels(info->speakers); + out->planes = planar ? out->channels : 1; + out->input_cb = info->input_callback; + out->input_param = info->input_param; out->block_size = (planar ? 1 : out->channels) * - get_audio_bytes_per_channel(info->format); + get_audio_bytes_per_channel(info->format); if (pthread_mutexattr_init(&attr) != 0) goto fail; @@ -452,7 +454,7 @@ struct audio_mix *mix = &audio->mixes[mix_idx]; for (size_t i = 0; i < mix->inputs.num; i++) - audio_input_free(mix->inputs.array+i); + audio_input_free(mix->inputs.array + i); da_free(mix->inputs); } @@ -468,7 +470,8 @@ bool audio_output_active(const audio_t *audio) { - if (!audio) return false; + if (!audio) + return false; for (size_t mix_idx = 0; mix_idx < MAX_AUDIO_MIXES; mix_idx++) { const struct audio_mix *mix = &audio->mixes[mix_idx];
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/audio-io.h -> obs-studio-24.0.0.tar.xz/libobs/media-io/audio-io.h
Changed
@@ -25,13 +25,13 @@ extern "C" { #endif -#define MAX_AUDIO_MIXES 6 -#define MAX_AUDIO_CHANNELS 8 +#define MAX_AUDIO_MIXES 6 +#define MAX_AUDIO_CHANNELS 8 #define AUDIO_OUTPUT_FRAMES 1024 -#define TOTAL_AUDIO_SIZE \ - (MAX_AUDIO_MIXES * MAX_AUDIO_CHANNELS * \ - AUDIO_OUTPUT_FRAMES * sizeof(float)) +#define TOTAL_AUDIO_SIZE \ + (MAX_AUDIO_MIXES * MAX_AUDIO_CHANNELS * AUDIO_OUTPUT_FRAMES * \ + sizeof(float)) /* * Base audio output component. Use this to create an audio output track @@ -65,58 +65,67 @@ * https://trac.ffmpeg.org/wiki/AudioChannelManipulation */ enum speaker_layout { - SPEAKERS_UNKNOWN, /**< Unknown setting, fallback is stereo. */ - SPEAKERS_MONO, /**< Channels: MONO */ - SPEAKERS_STEREO, /**< Channels: FL, FR */ - SPEAKERS_2POINT1, /**< Channels: FL, FR, LFE */ - SPEAKERS_4POINT0, /**< Channels: FL, FR, FC, RC */ - SPEAKERS_4POINT1, /**< Channels: FL, FR, FC, LFE, RC */ - SPEAKERS_5POINT1, /**< Channels: FL, FR, FC, LFE, RL, RR */ - SPEAKERS_7POINT1=8, /**< Channels: FL, FR, FC, LFE, RL, RR, SL, SR */ + SPEAKERS_UNKNOWN, /**< Unknown setting, fallback is stereo. */ + SPEAKERS_MONO, /**< Channels: MONO */ + SPEAKERS_STEREO, /**< Channels: FL, FR */ + SPEAKERS_2POINT1, /**< Channels: FL, FR, LFE */ + SPEAKERS_4POINT0, /**< Channels: FL, FR, FC, RC */ + SPEAKERS_4POINT1, /**< Channels: FL, FR, FC, LFE, RC */ + SPEAKERS_5POINT1, /**< Channels: FL, FR, FC, LFE, RL, RR */ + SPEAKERS_7POINT1 = 8, /**< Channels: FL, FR, FC, LFE, RL, RR, SL, SR */ }; struct audio_data { - uint8_t *data[MAX_AV_PLANES]; - uint32_t frames; - uint64_t timestamp; + uint8_t *data[MAX_AV_PLANES]; + uint32_t frames; + uint64_t timestamp; }; struct audio_output_data { - float *data[MAX_AUDIO_CHANNELS]; + float *data[MAX_AUDIO_CHANNELS]; }; -typedef bool (*audio_input_callback_t)(void *param, - uint64_t start_ts, uint64_t end_ts, uint64_t *new_ts, - uint32_t active_mixers, struct audio_output_data *mixes); +typedef bool (*audio_input_callback_t)(void *param, uint64_t start_ts, + uint64_t end_ts, uint64_t *new_ts, + uint32_t active_mixers, + struct audio_output_data *mixes); struct audio_output_info { - const char *name; + const char *name; - uint32_t samples_per_sec; - enum audio_format format; + uint32_t samples_per_sec; + enum audio_format format; enum speaker_layout speakers; audio_input_callback_t input_callback; - void *input_param; + void *input_param; }; struct audio_convert_info { - uint32_t samples_per_sec; - enum audio_format format; + uint32_t samples_per_sec; + enum audio_format format; enum speaker_layout speakers; }; static inline uint32_t get_audio_channels(enum speaker_layout speakers) { switch (speakers) { - case SPEAKERS_MONO: return 1; - case SPEAKERS_STEREO: return 2; - case SPEAKERS_2POINT1: return 3; - case SPEAKERS_4POINT0: return 4; - case SPEAKERS_4POINT1: return 5; - case SPEAKERS_5POINT1: return 6; - case SPEAKERS_7POINT1: return 8; - case SPEAKERS_UNKNOWN: return 0; + case SPEAKERS_MONO: + return 1; + case SPEAKERS_STEREO: + return 2; + case SPEAKERS_2POINT1: + return 3; + case SPEAKERS_4POINT0: + return 4; + case SPEAKERS_4POINT1: + return 5; + case SPEAKERS_5POINT1: + return 6; + case SPEAKERS_7POINT1: + return 8; + case SPEAKERS_UNKNOWN: + return 0; } return 0; @@ -169,23 +178,22 @@ } static inline size_t get_audio_planes(enum audio_format format, - enum speaker_layout speakers) + enum speaker_layout speakers) { return (is_audio_planar(format) ? get_audio_channels(speakers) : 1); } static inline size_t get_audio_size(enum audio_format format, - enum speaker_layout speakers, uint32_t frames) + enum speaker_layout speakers, + uint32_t frames) { bool planar = is_audio_planar(format); return (planar ? 1 : get_audio_channels(speakers)) * - get_audio_bytes_per_channel(format) * - frames; + get_audio_bytes_per_channel(format) * frames; } -static inline uint64_t audio_frames_to_ns(size_t sample_rate, - uint64_t frames) +static inline uint64_t audio_frames_to_ns(size_t sample_rate, uint64_t frames) { util_uint128_t val; val = util_mul64_64(frames, 1000000000ULL); @@ -193,8 +201,7 @@ return val.low; } -static inline uint64_t ns_to_audio_frames(size_t sample_rate, - uint64_t frames) +static inline uint64_t ns_to_audio_frames(size_t sample_rate, uint64_t frames) { util_uint128_t val; val = util_mul64_64(frames, sample_rate); @@ -202,21 +209,22 @@ return val.low; } -#define AUDIO_OUTPUT_SUCCESS 0 +#define AUDIO_OUTPUT_SUCCESS 0 #define AUDIO_OUTPUT_INVALIDPARAM -1 -#define AUDIO_OUTPUT_FAIL -2 +#define AUDIO_OUTPUT_FAIL -2 EXPORT int audio_output_open(audio_t **audio, struct audio_output_info *info); EXPORT void audio_output_close(audio_t *audio); typedef void (*audio_output_callback_t)(void *param, size_t mix_idx, - struct audio_data *data); + struct audio_data *data); EXPORT bool audio_output_connect(audio_t *video, size_t mix_idx, - const struct audio_convert_info *conversion, - audio_output_callback_t callback, void *param); + const struct audio_convert_info *conversion, + audio_output_callback_t callback, void *param); EXPORT void audio_output_disconnect(audio_t *video, size_t mix_idx, - audio_output_callback_t callback, void *param); + audio_output_callback_t callback, + void *param); EXPORT bool audio_output_active(const audio_t *audio); @@ -224,9 +232,8 @@ EXPORT size_t audio_output_get_planes(const audio_t *audio); EXPORT size_t audio_output_get_channels(const audio_t *audio); EXPORT uint32_t audio_output_get_sample_rate(const audio_t *audio); -EXPORT const struct audio_output_info *audio_output_get_info( - const audio_t *audio); - +EXPORT const struct audio_output_info * +audio_output_get_info(const audio_t *audio); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/audio-resampler-ffmpeg.c -> obs-studio-24.0.0.tar.xz/libobs/media-io/audio-resampler-ffmpeg.c
Changed
@@ -23,34 +23,43 @@ #include <libswresample/swresample.h> struct audio_resampler { - struct SwrContext *context; - bool opened; + struct SwrContext *context; + bool opened; - uint32_t input_freq; - uint64_t input_layout; + uint32_t input_freq; + uint64_t input_layout; enum AVSampleFormat input_format; - uint8_t *output_buffer[MAX_AV_PLANES]; - uint64_t output_layout; + uint8_t *output_buffer[MAX_AV_PLANES]; + uint64_t output_layout; enum AVSampleFormat output_format; - int output_size; - uint32_t output_ch; - uint32_t output_freq; - uint32_t output_planes; + int output_size; + uint32_t output_ch; + uint32_t output_freq; + uint32_t output_planes; }; static inline enum AVSampleFormat convert_audio_format(enum audio_format format) { switch (format) { - case AUDIO_FORMAT_UNKNOWN: return AV_SAMPLE_FMT_S16; - case AUDIO_FORMAT_U8BIT: return AV_SAMPLE_FMT_U8; - case AUDIO_FORMAT_16BIT: return AV_SAMPLE_FMT_S16; - case AUDIO_FORMAT_32BIT: return AV_SAMPLE_FMT_S32; - case AUDIO_FORMAT_FLOAT: return AV_SAMPLE_FMT_FLT; - case AUDIO_FORMAT_U8BIT_PLANAR: return AV_SAMPLE_FMT_U8P; - case AUDIO_FORMAT_16BIT_PLANAR: return AV_SAMPLE_FMT_S16P; - case AUDIO_FORMAT_32BIT_PLANAR: return AV_SAMPLE_FMT_S32P; - case AUDIO_FORMAT_FLOAT_PLANAR: return AV_SAMPLE_FMT_FLTP; + case AUDIO_FORMAT_UNKNOWN: + return AV_SAMPLE_FMT_S16; + case AUDIO_FORMAT_U8BIT: + return AV_SAMPLE_FMT_U8; + case AUDIO_FORMAT_16BIT: + return AV_SAMPLE_FMT_S16; + case AUDIO_FORMAT_32BIT: + return AV_SAMPLE_FMT_S32; + case AUDIO_FORMAT_FLOAT: + return AV_SAMPLE_FMT_FLT; + case AUDIO_FORMAT_U8BIT_PLANAR: + return AV_SAMPLE_FMT_U8P; + case AUDIO_FORMAT_16BIT_PLANAR: + return AV_SAMPLE_FMT_S16P; + case AUDIO_FORMAT_32BIT_PLANAR: + return AV_SAMPLE_FMT_S32P; + case AUDIO_FORMAT_FLOAT_PLANAR: + return AV_SAMPLE_FMT_FLTP; } /* shouldn't get here */ @@ -60,14 +69,22 @@ static inline uint64_t convert_speaker_layout(enum speaker_layout layout) { switch (layout) { - case SPEAKERS_UNKNOWN: return 0; - case SPEAKERS_MONO: return AV_CH_LAYOUT_MONO; - case SPEAKERS_STEREO: return AV_CH_LAYOUT_STEREO; - case SPEAKERS_2POINT1: return AV_CH_LAYOUT_SURROUND; - case SPEAKERS_4POINT0: return AV_CH_LAYOUT_4POINT0; - case SPEAKERS_4POINT1: return AV_CH_LAYOUT_4POINT1; - case SPEAKERS_5POINT1: return AV_CH_LAYOUT_5POINT1_BACK; - case SPEAKERS_7POINT1: return AV_CH_LAYOUT_7POINT1; + case SPEAKERS_UNKNOWN: + return 0; + case SPEAKERS_MONO: + return AV_CH_LAYOUT_MONO; + case SPEAKERS_STEREO: + return AV_CH_LAYOUT_STEREO; + case SPEAKERS_2POINT1: + return AV_CH_LAYOUT_SURROUND; + case SPEAKERS_4POINT0: + return AV_CH_LAYOUT_4POINT0; + case SPEAKERS_4POINT1: + return AV_CH_LAYOUT_4POINT1; + case SPEAKERS_5POINT1: + return AV_CH_LAYOUT_5POINT1_BACK; + case SPEAKERS_7POINT1: + return AV_CH_LAYOUT_7POINT1; } /* shouldn't get here */ @@ -75,26 +92,27 @@ } audio_resampler_t *audio_resampler_create(const struct resample_info *dst, - const struct resample_info *src) + const struct resample_info *src) { struct audio_resampler *rs = bzalloc(sizeof(struct audio_resampler)); int errcode; - rs->opened = false; - rs->input_freq = src->samples_per_sec; - rs->input_layout = convert_speaker_layout(src->speakers); - rs->input_format = convert_audio_format(src->format); - rs->output_size = 0; - rs->output_ch = get_audio_channels(dst->speakers); - rs->output_freq = dst->samples_per_sec; + rs->opened = false; + rs->input_freq = src->samples_per_sec; + rs->input_layout = convert_speaker_layout(src->speakers); + rs->input_format = convert_audio_format(src->format); + rs->output_size = 0; + rs->output_ch = get_audio_channels(dst->speakers); + rs->output_freq = dst->samples_per_sec; rs->output_layout = convert_speaker_layout(dst->speakers); rs->output_format = convert_audio_format(dst->format); rs->output_planes = is_audio_planar(dst->format) ? rs->output_ch : 1; - rs->context = swr_alloc_set_opts(NULL, - rs->output_layout, rs->output_format, dst->samples_per_sec, - rs->input_layout, rs->input_format, src->samples_per_sec, - 0, NULL); + rs->context = swr_alloc_set_opts(NULL, rs->output_layout, + rs->output_format, + dst->samples_per_sec, rs->input_layout, + rs->input_format, src->samples_per_sec, + 0, NULL); if (!rs->context) { blog(LOG_ERROR, "swr_alloc_set_opts failed"); @@ -104,23 +122,25 @@ if (rs->input_layout == AV_CH_LAYOUT_MONO && rs->output_ch > 1) { const double matrix[MAX_AUDIO_CHANNELS][MAX_AUDIO_CHANNELS] = { - {1}, - {1, 1}, - {1, 1, 0}, - {1, 1, 1, 1}, - {1, 1, 1, 0, 1}, - {1, 1, 1, 1, 1, 1}, - {1, 1, 1, 0, 1, 1, 1}, - {1, 1, 1, 0, 1, 1, 1, 1}, + {1}, + {1, 1}, + {1, 1, 0}, + {1, 1, 1, 1}, + {1, 1, 1, 0, 1}, + {1, 1, 1, 1, 1, 1}, + {1, 1, 1, 0, 1, 1, 1}, + {1, 1, 1, 0, 1, 1, 1, 1}, }; - if (swr_set_matrix(rs->context, matrix[rs->output_ch - 1], 1) < 0) - blog(LOG_DEBUG, "swr_set_matrix failed for mono upmix\n"); + if (swr_set_matrix(rs->context, matrix[rs->output_ch - 1], 1) < + 0) + blog(LOG_DEBUG, + "swr_set_matrix failed for mono upmix\n"); } errcode = swr_init(rs->context); if (errcode != 0) { blog(LOG_ERROR, "avresample_open failed: error code %d", - errcode); + errcode); audio_resampler_destroy(rs); return NULL; } @@ -140,20 +160,21 @@ } } -bool audio_resampler_resample(audio_resampler_t *rs, - uint8_t *output[], uint32_t *out_frames, uint64_t *ts_offset, - const uint8_t *const input[], uint32_t in_frames) +bool audio_resampler_resample(audio_resampler_t *rs, uint8_t *output[], + uint32_t *out_frames, uint64_t *ts_offset, + const uint8_t *const input[], uint32_t in_frames) { - if (!rs) return false; + if (!rs) + return false; struct SwrContext *context = rs->context; int ret; int64_t delay = swr_get_delay(context, rs->input_freq); - int estimated = (int)av_rescale_rnd( - delay + (int64_t)in_frames, - (int64_t)rs->output_freq, (int64_t)rs->input_freq, - AV_ROUND_UP); + int estimated = (int)av_rescale_rnd(delay + (int64_t)in_frames, + (int64_t)rs->output_freq, + (int64_t)rs->input_freq, + AV_ROUND_UP); *ts_offset = (uint64_t)swr_get_delay(context, 1000000000); @@ -163,14 +184,13 @@ av_freep(&rs->output_buffer[0]); av_samples_alloc(rs->output_buffer, NULL, rs->output_ch, - estimated, rs->output_format, 0); + estimated, rs->output_format, 0); rs->output_size = estimated; } - ret = swr_convert(context, - rs->output_buffer, rs->output_size, - (const uint8_t**)input, in_frames); + ret = swr_convert(context, rs->output_buffer, rs->output_size, + (const uint8_t **)input, in_frames); if (ret < 0) { blog(LOG_ERROR, "swr_convert failed: %d", ret);
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/audio-resampler.h -> obs-studio-24.0.0.tar.xz/libobs/media-io/audio-resampler.h
Changed
@@ -28,18 +28,21 @@ typedef struct audio_resampler audio_resampler_t; struct resample_info { - uint32_t samples_per_sec; - enum audio_format format; + uint32_t samples_per_sec; + enum audio_format format; enum speaker_layout speakers; }; -EXPORT audio_resampler_t *audio_resampler_create(const struct resample_info *dst, - const struct resample_info *src); +EXPORT audio_resampler_t * +audio_resampler_create(const struct resample_info *dst, + const struct resample_info *src); EXPORT void audio_resampler_destroy(audio_resampler_t *resampler); EXPORT bool audio_resampler_resample(audio_resampler_t *resampler, - uint8_t *output[], uint32_t *out_frames, uint64_t *ts_offset, - const uint8_t *const input[], uint32_t in_frames); + uint8_t *output[], uint32_t *out_frames, + uint64_t *ts_offset, + const uint8_t *const input[], + uint32_t in_frames); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/format-conversion.c -> obs-studio-24.0.0.tar.xz/libobs/media-io/format-conversion.c
Changed
@@ -22,194 +22,191 @@ /* ...surprisingly, if I don't use a macro to force inlining, it causes the * CPU usage to boost by a tremendous amount in debug builds. */ -#define get_m128_32_0(val) (*((uint32_t*)&val)) -#define get_m128_32_1(val) (*(((uint32_t*)&val)+1)) - -#define pack_shift(lum_plane, lum_pos0, lum_pos1, line1, line2, mask, sh) \ -do { \ - __m128i pack_val = _mm_packs_epi32( \ - _mm_srli_si128(_mm_and_si128(line1, mask), sh), \ - _mm_srli_si128(_mm_and_si128(line2, mask), sh)); \ - pack_val = _mm_packus_epi16(pack_val, pack_val); \ - \ - *(uint32_t*)(lum_plane+lum_pos0) = get_m128_32_0(pack_val); \ - *(uint32_t*)(lum_plane+lum_pos1) = get_m128_32_1(pack_val); \ -} while (false) - -#define pack_val(lum_plane, lum_pos0, lum_pos1, line1, line2, mask) \ -do { \ - __m128i pack_val = _mm_packs_epi32( \ - _mm_and_si128(line1, mask), \ - _mm_and_si128(line2, mask)); \ - pack_val = _mm_packus_epi16(pack_val, pack_val); \ - \ - *(uint32_t*)(lum_plane+lum_pos0) = get_m128_32_0(pack_val); \ - *(uint32_t*)(lum_plane+lum_pos1) = get_m128_32_1(pack_val); \ -} while (false) - -#define pack_ch_1plane(uv_plane, chroma_pos, line1, line2, uv_mask) \ -do { \ - __m128i add_val = _mm_add_epi64( \ - _mm_and_si128(line1, uv_mask), \ - _mm_and_si128(line2, uv_mask)); \ - __m128i avg_val = _mm_add_epi64( \ - add_val, \ - _mm_shuffle_epi32(add_val, _MM_SHUFFLE(2, 3, 0, 1))); \ - avg_val = _mm_srai_epi16(avg_val, 2); \ - avg_val = _mm_shuffle_epi32(avg_val, _MM_SHUFFLE(3, 1, 2, 0)); \ - avg_val = _mm_packus_epi16(avg_val, avg_val); \ - \ - *(uint32_t*)(uv_plane+chroma_pos) = get_m128_32_0(avg_val); \ -} while (false) - -#define pack_ch_2plane(u_plane, v_plane, chroma_pos, line1, line2, uv_mask) \ -do { \ - uint32_t packed_vals; \ - \ - __m128i add_val = _mm_add_epi64( \ - _mm_and_si128(line1, uv_mask), \ - _mm_and_si128(line2, uv_mask)); \ - __m128i avg_val = _mm_add_epi64( \ - add_val, \ - _mm_shuffle_epi32(add_val, _MM_SHUFFLE(2, 3, 0, 1))); \ - avg_val = _mm_srai_epi16(avg_val, 2); \ - avg_val = _mm_shuffle_epi32(avg_val, _MM_SHUFFLE(3, 1, 2, 0)); \ - avg_val = _mm_shufflelo_epi16(avg_val, _MM_SHUFFLE(3, 1, 2, 0)); \ - avg_val = _mm_packus_epi16(avg_val, avg_val); \ - \ - packed_vals = get_m128_32_0(avg_val); \ - \ - *(uint16_t*)(u_plane+chroma_pos) = (uint16_t)(packed_vals); \ - *(uint16_t*)(v_plane+chroma_pos) = (uint16_t)(packed_vals>>16); \ -} while (false) - +#define get_m128_32_0(val) (*((uint32_t *)&val)) +#define get_m128_32_1(val) (*(((uint32_t *)&val) + 1)) + +#define pack_shift(lum_plane, lum_pos0, lum_pos1, line1, line2, mask, sh) \ + do { \ + __m128i pack_val = _mm_packs_epi32( \ + _mm_srli_si128(_mm_and_si128(line1, mask), sh), \ + _mm_srli_si128(_mm_and_si128(line2, mask), sh)); \ + pack_val = _mm_packus_epi16(pack_val, pack_val); \ + \ + *(uint32_t *)(lum_plane + lum_pos0) = get_m128_32_0(pack_val); \ + *(uint32_t *)(lum_plane + lum_pos1) = get_m128_32_1(pack_val); \ + } while (false) + +#define pack_val(lum_plane, lum_pos0, lum_pos1, line1, line2, mask) \ + do { \ + __m128i pack_val = \ + _mm_packs_epi32(_mm_and_si128(line1, mask), \ + _mm_and_si128(line2, mask)); \ + pack_val = _mm_packus_epi16(pack_val, pack_val); \ + \ + *(uint32_t *)(lum_plane + lum_pos0) = get_m128_32_0(pack_val); \ + *(uint32_t *)(lum_plane + lum_pos1) = get_m128_32_1(pack_val); \ + } while (false) + +#define pack_ch_1plane(uv_plane, chroma_pos, line1, line2, uv_mask) \ + do { \ + __m128i add_val = \ + _mm_add_epi64(_mm_and_si128(line1, uv_mask), \ + _mm_and_si128(line2, uv_mask)); \ + __m128i avg_val = _mm_add_epi64( \ + add_val, \ + _mm_shuffle_epi32(add_val, _MM_SHUFFLE(2, 3, 0, 1))); \ + avg_val = _mm_srai_epi16(avg_val, 2); \ + avg_val = _mm_shuffle_epi32(avg_val, _MM_SHUFFLE(3, 1, 2, 0)); \ + avg_val = _mm_packus_epi16(avg_val, avg_val); \ + \ + *(uint32_t *)(uv_plane + chroma_pos) = get_m128_32_0(avg_val); \ + } while (false) + +#define pack_ch_2plane(u_plane, v_plane, chroma_pos, line1, line2, uv_mask) \ + do { \ + uint32_t packed_vals; \ + \ + __m128i add_val = \ + _mm_add_epi64(_mm_and_si128(line1, uv_mask), \ + _mm_and_si128(line2, uv_mask)); \ + __m128i avg_val = _mm_add_epi64( \ + add_val, \ + _mm_shuffle_epi32(add_val, _MM_SHUFFLE(2, 3, 0, 1))); \ + avg_val = _mm_srai_epi16(avg_val, 2); \ + avg_val = _mm_shuffle_epi32(avg_val, _MM_SHUFFLE(3, 1, 2, 0)); \ + avg_val = \ + _mm_shufflelo_epi16(avg_val, _MM_SHUFFLE(3, 1, 2, 0)); \ + avg_val = _mm_packus_epi16(avg_val, avg_val); \ + \ + packed_vals = get_m128_32_0(avg_val); \ + \ + *(uint16_t *)(u_plane + chroma_pos) = (uint16_t)(packed_vals); \ + *(uint16_t *)(v_plane + chroma_pos) = \ + (uint16_t)(packed_vals >> 16); \ + } while (false) static FORCE_INLINE uint32_t min_uint32(uint32_t a, uint32_t b) { return a < b ? a : b; } -void compress_uyvx_to_i420( - const uint8_t *input, uint32_t in_linesize, - uint32_t start_y, uint32_t end_y, - uint8_t *output[], const uint32_t out_linesize[]) +void compress_uyvx_to_i420(const uint8_t *input, uint32_t in_linesize, + uint32_t start_y, uint32_t end_y, uint8_t *output[], + const uint32_t out_linesize[]) { - uint8_t *lum_plane = output[0]; - uint8_t *u_plane = output[1]; - uint8_t *v_plane = output[2]; - uint32_t width = min_uint32(in_linesize, out_linesize[0]); + uint8_t *lum_plane = output[0]; + uint8_t *u_plane = output[1]; + uint8_t *v_plane = output[2]; + uint32_t width = min_uint32(in_linesize, out_linesize[0]); uint32_t y; __m128i lum_mask = _mm_set1_epi32(0x0000FF00); - __m128i uv_mask = _mm_set1_epi16(0x00FF); + __m128i uv_mask = _mm_set1_epi16(0x00FF); for (y = start_y; y < end_y; y += 2) { - uint32_t y_pos = y * in_linesize; - uint32_t chroma_y_pos = (y>>1) * out_linesize[1]; - uint32_t lum_y_pos = y * out_linesize[0]; + uint32_t y_pos = y * in_linesize; + uint32_t chroma_y_pos = (y >> 1) * out_linesize[1]; + uint32_t lum_y_pos = y * out_linesize[0]; uint32_t x; for (x = 0; x < width; x += 4) { - const uint8_t *img = input + y_pos + x*4; - uint32_t lum_pos0 = lum_y_pos + x; - uint32_t lum_pos1 = lum_pos0 + out_linesize[0]; + const uint8_t *img = input + y_pos + x * 4; + uint32_t lum_pos0 = lum_y_pos + x; + uint32_t lum_pos1 = lum_pos0 + out_linesize[0]; - __m128i line1 = _mm_load_si128((const __m128i*)img); + __m128i line1 = _mm_load_si128((const __m128i *)img); __m128i line2 = _mm_load_si128( - (const __m128i*)(img + in_linesize)); + (const __m128i *)(img + in_linesize)); - pack_shift(lum_plane, lum_pos0, lum_pos1, - line1, line2, lum_mask, 1); + pack_shift(lum_plane, lum_pos0, lum_pos1, line1, line2, + lum_mask, 1); pack_ch_2plane(u_plane, v_plane, - chroma_y_pos + (x>>1), - line1, line2, uv_mask); + chroma_y_pos + (x >> 1), line1, line2, + uv_mask); } } } -void compress_uyvx_to_nv12( - const uint8_t *input, uint32_t in_linesize, - uint32_t start_y, uint32_t end_y, - uint8_t *output[], const uint32_t out_linesize[]) +void compress_uyvx_to_nv12(const uint8_t *input, uint32_t in_linesize, + uint32_t start_y, uint32_t end_y, uint8_t *output[], + const uint32_t out_linesize[]) { - uint8_t *lum_plane = output[0]; + uint8_t *lum_plane = output[0]; uint8_t *chroma_plane = output[1]; - uint32_t width = min_uint32(in_linesize, out_linesize[0]); + uint32_t width = min_uint32(in_linesize, out_linesize[0]); uint32_t y; __m128i lum_mask = _mm_set1_epi32(0x0000FF00); - __m128i uv_mask = _mm_set1_epi16(0x00FF); + __m128i uv_mask = _mm_set1_epi16(0x00FF); for (y = start_y; y < end_y; y += 2) { - uint32_t y_pos = y * in_linesize; - uint32_t chroma_y_pos = (y>>1) * out_linesize[1]; - uint32_t lum_y_pos = y * out_linesize[0]; + uint32_t y_pos = y * in_linesize; + uint32_t chroma_y_pos = (y >> 1) * out_linesize[1]; + uint32_t lum_y_pos = y * out_linesize[0]; uint32_t x; for (x = 0; x < width; x += 4) { - const uint8_t *img = input + y_pos + x*4; - uint32_t lum_pos0 = lum_y_pos + x; - uint32_t lum_pos1 = lum_pos0 + out_linesize[0]; + const uint8_t *img = input + y_pos + x * 4; + uint32_t lum_pos0 = lum_y_pos + x; + uint32_t lum_pos1 = lum_pos0 + out_linesize[0]; - __m128i line1 = _mm_load_si128((const __m128i*)img); + __m128i line1 = _mm_load_si128((const __m128i *)img); __m128i line2 = _mm_load_si128( - (const __m128i*)(img + in_linesize)); + (const __m128i *)(img + in_linesize)); - pack_shift(lum_plane, lum_pos0, lum_pos1, - line1, line2, lum_mask, 1); - pack_ch_1plane(chroma_plane, chroma_y_pos + x, - line1, line2, uv_mask); + pack_shift(lum_plane, lum_pos0, lum_pos1, line1, line2, + lum_mask, 1); + pack_ch_1plane(chroma_plane, chroma_y_pos + x, line1, + line2, uv_mask); } } } -void convert_uyvx_to_i444( - const uint8_t *input, uint32_t in_linesize, - uint32_t start_y, uint32_t end_y, - uint8_t *output[], const uint32_t out_linesize[]) +void convert_uyvx_to_i444(const uint8_t *input, uint32_t in_linesize, + uint32_t start_y, uint32_t end_y, uint8_t *output[], + const uint32_t out_linesize[]) { - uint8_t *lum_plane = output[0]; - uint8_t *u_plane = output[1]; - uint8_t *v_plane = output[2]; - uint32_t width = min_uint32(in_linesize, out_linesize[0]); + uint8_t *lum_plane = output[0]; + uint8_t *u_plane = output[1]; + uint8_t *v_plane = output[2]; + uint32_t width = min_uint32(in_linesize, out_linesize[0]); uint32_t y; __m128i lum_mask = _mm_set1_epi32(0x0000FF00); - __m128i u_mask = _mm_set1_epi32(0x000000FF); - __m128i v_mask = _mm_set1_epi32(0x00FF0000); + __m128i u_mask = _mm_set1_epi32(0x000000FF); + __m128i v_mask = _mm_set1_epi32(0x00FF0000); for (y = start_y; y < end_y; y += 2) { - uint32_t y_pos = y * in_linesize; - uint32_t lum_y_pos = y * out_linesize[0]; + uint32_t y_pos = y * in_linesize; + uint32_t lum_y_pos = y * out_linesize[0]; uint32_t x; for (x = 0; x < width; x += 4) { - const uint8_t *img = input + y_pos + x*4; - uint32_t lum_pos0 = lum_y_pos + x; - uint32_t lum_pos1 = lum_pos0 + out_linesize[0]; + const uint8_t *img = input + y_pos + x * 4; + uint32_t lum_pos0 = lum_y_pos + x; + uint32_t lum_pos1 = lum_pos0 + out_linesize[0]; - __m128i line1 = _mm_load_si128((const __m128i*)img); + __m128i line1 = _mm_load_si128((const __m128i *)img); __m128i line2 = _mm_load_si128( - (const __m128i*)(img + in_linesize)); - - pack_shift(lum_plane, lum_pos0, lum_pos1, - line1, line2, lum_mask, 1); - pack_val(u_plane, lum_pos0, lum_pos1, - line1, line2, u_mask); - pack_shift(v_plane, lum_pos0, lum_pos1, - line1, line2, v_mask, 2); + (const __m128i *)(img + in_linesize)); + + pack_shift(lum_plane, lum_pos0, lum_pos1, line1, line2, + lum_mask, 1); + pack_val(u_plane, lum_pos0, lum_pos1, line1, line2, + u_mask); + pack_shift(v_plane, lum_pos0, lum_pos1, line1, line2, + v_mask, 2); } } } -void decompress_420( - const uint8_t *const input[], const uint32_t in_linesize[], - uint32_t start_y, uint32_t end_y, - uint8_t *output, uint32_t out_linesize) +void decompress_420(const uint8_t *const input[], const uint32_t in_linesize[], + uint32_t start_y, uint32_t end_y, uint8_t *output, + uint32_t out_linesize) { - uint32_t start_y_d2 = start_y/2; - uint32_t width_d2 = in_linesize[0]/2; - uint32_t height_d2 = end_y/2; + uint32_t start_y_d2 = start_y / 2; + uint32_t width_d2 = in_linesize[0] / 2; + uint32_t height_d2 = end_y / 2; uint32_t y; for (y = start_y_d2; y < height_d2; y++) { @@ -221,8 +218,8 @@ lum0 = input[0] + y * 2 * in_linesize[0]; lum1 = lum0 + in_linesize[0]; - output0 = (uint32_t*)(output + y * 2 * out_linesize); - output1 = (uint32_t*)((uint8_t*)output0 + out_linesize); + output0 = (uint32_t *)(output + y * 2 * out_linesize); + output1 = (uint32_t *)((uint8_t *)output0 + out_linesize); for (x = 0; x < width_d2; x++) { uint32_t out; @@ -237,14 +234,13 @@ } } -void decompress_nv12( - const uint8_t *const input[], const uint32_t in_linesize[], - uint32_t start_y, uint32_t end_y, - uint8_t *output, uint32_t out_linesize) +void decompress_nv12(const uint8_t *const input[], const uint32_t in_linesize[], + uint32_t start_y, uint32_t end_y, uint8_t *output, + uint32_t out_linesize) { - uint32_t start_y_d2 = start_y/2; - uint32_t width_d2 = min_uint32(in_linesize[0], out_linesize)/2; - uint32_t height_d2 = end_y/2; + uint32_t start_y_d2 = start_y / 2; + uint32_t width_d2 = min_uint32(in_linesize[0], out_linesize) / 2; + uint32_t height_d2 = end_y / 2; uint32_t y; for (y = start_y_d2; y < height_d2; y++) { @@ -253,11 +249,11 @@ register uint32_t *output0, *output1; uint32_t x; - chroma = (const uint16_t*)(input[1] + y * in_linesize[1]); + chroma = (const uint16_t *)(input[1] + y * in_linesize[1]); lum0 = input[0] + y * 2 * in_linesize[0]; lum1 = lum0 + in_linesize[0]; - output0 = (uint32_t*)(output + y * 2 * out_linesize); - output1 = (uint32_t*)((uint8_t*)output0 + out_linesize); + output0 = (uint32_t *)(output + y * 2 * out_linesize); + output1 = (uint32_t *)((uint8_t *)output0 + out_linesize); for (x = 0; x < width_d2; x++) { uint32_t out = *(chroma++) << 8; @@ -271,31 +267,29 @@ } } -void decompress_422( - const uint8_t *input, uint32_t in_linesize, - uint32_t start_y, uint32_t end_y, - uint8_t *output, uint32_t out_linesize, - bool leading_lum) +void decompress_422(const uint8_t *input, uint32_t in_linesize, + uint32_t start_y, uint32_t end_y, uint8_t *output, + uint32_t out_linesize, bool leading_lum) { - uint32_t width_d2 = min_uint32(in_linesize, out_linesize)/2; + uint32_t width_d2 = min_uint32(in_linesize, out_linesize) / 2; uint32_t y; register const uint32_t *input32; register const uint32_t *input32_end; - register uint32_t *output32; + register uint32_t *output32; if (leading_lum) { for (y = start_y; y < end_y; y++) { - input32 = (const uint32_t*)(input + y*in_linesize); + input32 = (const uint32_t *)(input + y * in_linesize); input32_end = input32 + width_d2; - output32 = (uint32_t*)(output + y*out_linesize); + output32 = (uint32_t *)(output + y * out_linesize); - while(input32 < input32_end) { + while (input32 < input32_end) { register uint32_t dw = *input32; output32[0] = dw; dw &= 0xFFFFFF00; - dw |= (uint8_t)(dw>>16); + dw |= (uint8_t)(dw >> 16); output32[1] = dw; output32 += 2; @@ -304,16 +298,16 @@ } } else { for (y = start_y; y < end_y; y++) { - input32 = (const uint32_t*)(input + y*in_linesize); + input32 = (const uint32_t *)(input + y * in_linesize); input32_end = input32 + width_d2; - output32 = (uint32_t*)(output + y*out_linesize); + output32 = (uint32_t *)(output + y * out_linesize); while (input32 < input32_end) { register uint32_t dw = *input32; output32[0] = dw; dw &= 0xFFFF00FF; - dw |= (dw>>16) & 0xFF00; + dw |= (dw >> 16) & 0xFF00; output32[1] = dw; output32 += 2;
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/format-conversion.h -> obs-studio-24.0.0.tar.xz/libobs/media-io/format-conversion.h
Changed
@@ -27,36 +27,34 @@ * Functions for converting to and from packed 444 YUV */ -EXPORT void compress_uyvx_to_i420( - const uint8_t *input, uint32_t in_linesize, - uint32_t start_y, uint32_t end_y, - uint8_t *output[], const uint32_t out_linesize[]); - -EXPORT void compress_uyvx_to_nv12( - const uint8_t *input, uint32_t in_linesize, - uint32_t start_y, uint32_t end_y, - uint8_t *output[], const uint32_t out_linesize[]); - -EXPORT void convert_uyvx_to_i444( - const uint8_t *input, uint32_t in_linesize, - uint32_t start_y, uint32_t end_y, - uint8_t *output[], const uint32_t out_linesize[]); - -EXPORT void decompress_nv12( - const uint8_t *const input[], const uint32_t in_linesize[], - uint32_t start_y, uint32_t end_y, - uint8_t *output, uint32_t out_linesize); - -EXPORT void decompress_420( - const uint8_t *const input[], const uint32_t in_linesize[], - uint32_t start_y, uint32_t end_y, - uint8_t *output, uint32_t out_linesize); - -EXPORT void decompress_422( - const uint8_t *input, uint32_t in_linesize, - uint32_t start_y, uint32_t end_y, - uint8_t *output, uint32_t out_linesize, - bool leading_lum); +EXPORT void compress_uyvx_to_i420(const uint8_t *input, uint32_t in_linesize, + uint32_t start_y, uint32_t end_y, + uint8_t *output[], + const uint32_t out_linesize[]); + +EXPORT void compress_uyvx_to_nv12(const uint8_t *input, uint32_t in_linesize, + uint32_t start_y, uint32_t end_y, + uint8_t *output[], + const uint32_t out_linesize[]); + +EXPORT void convert_uyvx_to_i444(const uint8_t *input, uint32_t in_linesize, + uint32_t start_y, uint32_t end_y, + uint8_t *output[], + const uint32_t out_linesize[]); + +EXPORT void decompress_nv12(const uint8_t *const input[], + const uint32_t in_linesize[], uint32_t start_y, + uint32_t end_y, uint8_t *output, + uint32_t out_linesize); + +EXPORT void decompress_420(const uint8_t *const input[], + const uint32_t in_linesize[], uint32_t start_y, + uint32_t end_y, uint8_t *output, + uint32_t out_linesize); + +EXPORT void decompress_422(const uint8_t *input, uint32_t in_linesize, + uint32_t start_y, uint32_t end_y, uint8_t *output, + uint32_t out_linesize, bool leading_lum); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/frame-rate.h -> obs-studio-24.0.0.tar.xz/libobs/media-io/frame-rate.h
Changed
@@ -9,20 +9,20 @@ uint32_t denominator; }; -static inline double media_frames_per_second_to_frame_interval( - struct media_frames_per_second fps) +static inline double +media_frames_per_second_to_frame_interval(struct media_frames_per_second fps) { return (double)fps.denominator / fps.numerator; } -static inline double media_frames_per_second_to_fps( - struct media_frames_per_second fps) +static inline double +media_frames_per_second_to_fps(struct media_frames_per_second fps) { return (double)fps.numerator / fps.denominator; } -static inline bool media_frames_per_second_is_valid( - struct media_frames_per_second fps) +static inline bool +media_frames_per_second_is_valid(struct media_frames_per_second fps) { return fps.numerator && fps.denominator; }
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/media-remux.c -> obs-studio-24.0.0.tar.xz/libobs/media-io/media-remux.c
Changed
@@ -54,7 +54,7 @@ int ret = avformat_open_input(&job->ifmt_ctx, in_filename, NULL, NULL); if (ret < 0) { blog(LOG_ERROR, "media_remux: Could not open input file '%s'", - in_filename); + in_filename); return false; } @@ -76,16 +76,16 @@ int ret; avformat_alloc_output_context2(&job->ofmt_ctx, NULL, NULL, - out_filename); + out_filename); if (!job->ofmt_ctx) { blog(LOG_ERROR, "media_remux: Could not create output context"); return false; } for (unsigned i = 0; i < job->ifmt_ctx->nb_streams; i++) { - AVStream *in_stream = job->ifmt_ctx->streams[i]; - AVStream *out_stream = avformat_new_stream(job->ofmt_ctx, - in_stream->codec->codec); + AVStream *in_stream = job->ifmt_ctx->streams[i]; + AVStream *out_stream = avformat_new_stream( + job->ofmt_ctx, in_stream->codec->codec); if (!out_stream) { blog(LOG_ERROR, "media_remux: Failed to allocate output" " stream"); @@ -97,7 +97,7 @@ ret = avcodec_parameters_from_context(par, in_stream->codec); if (ret == 0) ret = avcodec_parameters_to_context(out_stream->codec, - par); + par); avcodec_parameters_free(&par); #else ret = avcodec_copy_context(out_stream->codec, in_stream->codec); @@ -124,8 +124,10 @@ ret = avio_open(&job->ofmt_ctx->pb, out_filename, AVIO_FLAG_WRITE); if (ret < 0) { - blog(LOG_ERROR, "media_remux: Failed to open output" - " file '%s'", out_filename); + blog(LOG_ERROR, + "media_remux: Failed to open output" + " file '%s'", + out_filename); return false; } } @@ -134,7 +136,7 @@ } bool media_remux_job_create(media_remux_job_t *job, const char *in_filename, - const char *out_filename) + const char *out_filename) { if (!job) return false; @@ -152,7 +154,9 @@ init_size(*job, in_filename); +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); +#endif if (!init_input(*job, in_filename)) goto fail; @@ -167,23 +171,23 @@ return false; } -static inline void process_packet(AVPacket *pkt, - AVStream *in_stream, AVStream *out_stream) +static inline void process_packet(AVPacket *pkt, AVStream *in_stream, + AVStream *out_stream) { pkt->pts = av_rescale_q_rnd(pkt->pts, in_stream->time_base, - out_stream->time_base, - AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); + out_stream->time_base, + AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX); pkt->dts = av_rescale_q_rnd(pkt->dts, in_stream->time_base, - out_stream->time_base, - AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); - pkt->duration = (int)av_rescale_q(pkt->duration, - in_stream->time_base, out_stream->time_base); + out_stream->time_base, + AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX); + pkt->duration = (int)av_rescale_q(pkt->duration, in_stream->time_base, + out_stream->time_base); pkt->pos = -1; - } static inline int process_packets(media_remux_job_t job, - media_remux_progress_callback callback, void *data) + media_remux_progress_callback callback, + void *data) { AVPacket pkt; @@ -192,9 +196,10 @@ ret = av_read_frame(job->ifmt_ctx, &pkt); if (ret < 0) { if (ret != AVERROR_EOF) - blog(LOG_ERROR, "media_remux: Error reading" - " packet: %s", - av_err2str(ret)); + blog(LOG_ERROR, + "media_remux: Error reading" + " packet: %s", + av_err2str(ret)); break; } @@ -206,14 +211,14 @@ } process_packet(&pkt, job->ifmt_ctx->streams[pkt.stream_index], - job->ofmt_ctx->streams[pkt.stream_index]); + job->ofmt_ctx->streams[pkt.stream_index]); ret = av_interleaved_write_frame(job->ofmt_ctx, &pkt); av_packet_unref(&pkt); if (ret < 0) { blog(LOG_ERROR, "media_remux: Error muxing packet: %s", - av_err2str(ret)); + av_err2str(ret)); break; } } @@ -222,7 +227,7 @@ } bool media_remux_job_process(media_remux_job_t job, - media_remux_progress_callback callback, void *data) + media_remux_progress_callback callback, void *data) { int ret; bool success = false; @@ -233,7 +238,7 @@ ret = avformat_write_header(job->ofmt_ctx, NULL); if (ret < 0) { blog(LOG_ERROR, "media_remux: Error opening output file: %s", - av_err2str(ret)); + av_err2str(ret)); return success; } @@ -246,7 +251,7 @@ ret = av_write_trailer(job->ofmt_ctx); if (ret < 0) { blog(LOG_ERROR, "media_remux: av_write_trailer: %s", - av_err2str(ret)); + av_err2str(ret)); success = false; }
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/media-remux.h -> obs-studio-24.0.0.tar.xz/libobs/media-io/media-remux.h
Changed
@@ -22,16 +22,18 @@ struct media_remux_job; typedef struct media_remux_job *media_remux_job_t; -typedef bool (media_remux_progress_callback)(void *data, float percent); +typedef bool(media_remux_progress_callback)(void *data, float percent); #ifdef __cplusplus extern "C" { #endif EXPORT bool media_remux_job_create(media_remux_job_t *job, - const char *in_filename, const char *out_filename); + const char *in_filename, + const char *out_filename); EXPORT bool media_remux_job_process(media_remux_job_t job, - media_remux_progress_callback callback, void *data); + media_remux_progress_callback callback, + void *data); EXPORT void media_remux_job_destroy(media_remux_job_t job); #ifdef __cplusplus
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/video-fourcc.c -> obs-studio-24.0.0.tar.xz/libobs/media-io/video-fourcc.c
Changed
@@ -24,31 +24,29 @@ enum video_format video_format_from_fourcc(uint32_t fourcc) { switch (fourcc) { - case MAKE_FOURCC('U','Y','V','Y'): - case MAKE_FOURCC('H','D','Y','C'): - case MAKE_FOURCC('U','Y','N','V'): - case MAKE_FOURCC('U','Y','N','Y'): - case MAKE_FOURCC('u','y','v','1'): - case MAKE_FOURCC('2','v','u','y'): - case MAKE_FOURCC('2','V','u','y'): - return VIDEO_FORMAT_UYVY; - - case MAKE_FOURCC('Y','U','Y','2'): - case MAKE_FOURCC('Y','4','2','2'): - case MAKE_FOURCC('V','4','2','2'): - case MAKE_FOURCC('V','Y','U','Y'): - case MAKE_FOURCC('Y','U','N','V'): - case MAKE_FOURCC('y','u','v','2'): - case MAKE_FOURCC('y','u','v','s'): - return VIDEO_FORMAT_YUY2; - - case MAKE_FOURCC('Y','V','Y','U'): - return VIDEO_FORMAT_YVYU; - - case MAKE_FOURCC('Y','8','0','0'): - return VIDEO_FORMAT_Y800; - + case MAKE_FOURCC('U', 'Y', 'V', 'Y'): + case MAKE_FOURCC('H', 'D', 'Y', 'C'): + case MAKE_FOURCC('U', 'Y', 'N', 'V'): + case MAKE_FOURCC('U', 'Y', 'N', 'Y'): + case MAKE_FOURCC('u', 'y', 'v', '1'): + case MAKE_FOURCC('2', 'v', 'u', 'y'): + case MAKE_FOURCC('2', 'V', 'u', 'y'): + return VIDEO_FORMAT_UYVY; + + case MAKE_FOURCC('Y', 'U', 'Y', '2'): + case MAKE_FOURCC('Y', '4', '2', '2'): + case MAKE_FOURCC('V', '4', '2', '2'): + case MAKE_FOURCC('V', 'Y', 'U', 'Y'): + case MAKE_FOURCC('Y', 'U', 'N', 'V'): + case MAKE_FOURCC('y', 'u', 'v', '2'): + case MAKE_FOURCC('y', 'u', 'v', 's'): + return VIDEO_FORMAT_YUY2; + + case MAKE_FOURCC('Y', 'V', 'Y', 'U'): + return VIDEO_FORMAT_YVYU; + + case MAKE_FOURCC('Y', '8', '0', '0'): + return VIDEO_FORMAT_Y800; } return VIDEO_FORMAT_NONE; } -
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/video-frame.c -> obs-studio-24.0.0.tar.xz/libobs/media-io/video-frame.c
Changed
@@ -17,18 +17,18 @@ #include "video-frame.h" -#define ALIGN_SIZE(size, align) \ - size = (((size)+(align-1)) & (~(align-1))) +#define ALIGN_SIZE(size, align) size = (((size) + (align - 1)) & (~(align - 1))) /* messy code alarm */ void video_frame_init(struct video_frame *frame, enum video_format format, - uint32_t width, uint32_t height) + uint32_t width, uint32_t height) { size_t size; size_t offsets[MAX_AV_PLANES]; - int alignment = base_get_alignment(); + int alignment = base_get_alignment(); - if (!frame) return; + if (!frame) + return; memset(frame, 0, sizeof(struct video_frame)); memset(offsets, 0, sizeof(offsets)); @@ -41,27 +41,27 @@ size = width * height; ALIGN_SIZE(size, alignment); offsets[0] = size; - size += (width/2) * (height/2); + size += (width / 2) * (height / 2); ALIGN_SIZE(size, alignment); offsets[1] = size; - size += (width/2) * (height/2); + size += (width / 2) * (height / 2); ALIGN_SIZE(size, alignment); frame->data[0] = bmalloc(size); - frame->data[1] = (uint8_t*)frame->data[0] + offsets[0]; - frame->data[2] = (uint8_t*)frame->data[0] + offsets[1]; + frame->data[1] = (uint8_t *)frame->data[0] + offsets[0]; + frame->data[2] = (uint8_t *)frame->data[0] + offsets[1]; frame->linesize[0] = width; - frame->linesize[1] = width/2; - frame->linesize[2] = width/2; + frame->linesize[1] = width / 2; + frame->linesize[2] = width / 2; break; case VIDEO_FORMAT_NV12: size = width * height; ALIGN_SIZE(size, alignment); offsets[0] = size; - size += (width/2) * (height/2) * 2; + size += (width / 2) * (height / 2) * 2; ALIGN_SIZE(size, alignment); frame->data[0] = bmalloc(size); - frame->data[1] = (uint8_t*)frame->data[0] + offsets[0]; + frame->data[1] = (uint8_t *)frame->data[0] + offsets[0]; frame->linesize[0] = width; frame->linesize[1] = width; break; @@ -79,33 +79,124 @@ size = width * height * 2; ALIGN_SIZE(size, alignment); frame->data[0] = bmalloc(size); - frame->linesize[0] = width*2; + frame->linesize[0] = width * 2; break; case VIDEO_FORMAT_RGBA: case VIDEO_FORMAT_BGRA: case VIDEO_FORMAT_BGRX: + case VIDEO_FORMAT_AYUV: size = width * height * 4; ALIGN_SIZE(size, alignment); frame->data[0] = bmalloc(size); - frame->linesize[0] = width*4; + frame->linesize[0] = width * 4; break; case VIDEO_FORMAT_I444: size = width * height; ALIGN_SIZE(size, alignment); frame->data[0] = bmalloc(size * 3); - frame->data[1] = (uint8_t*)frame->data[0] + size; - frame->data[2] = (uint8_t*)frame->data[1] + size; + frame->data[1] = (uint8_t *)frame->data[0] + size; + frame->data[2] = (uint8_t *)frame->data[1] + size; + frame->linesize[0] = width; + frame->linesize[1] = width; + frame->linesize[2] = width; + break; + + case VIDEO_FORMAT_BGR3: + size = width * height * 3; + ALIGN_SIZE(size, alignment); + frame->data[0] = bmalloc(size); + frame->linesize[0] = width * 3; + break; + + case VIDEO_FORMAT_I422: + size = width * height; + ALIGN_SIZE(size, alignment); + offsets[0] = size; + size += (width / 2) * height; + ALIGN_SIZE(size, alignment); + offsets[1] = size; + size += (width / 2) * height; + ALIGN_SIZE(size, alignment); + frame->data[0] = bmalloc(size); + frame->data[1] = (uint8_t *)frame->data[0] + offsets[0]; + frame->data[2] = (uint8_t *)frame->data[0] + offsets[1]; + frame->linesize[0] = width; + frame->linesize[1] = width / 2; + frame->linesize[2] = width / 2; + break; + + case VIDEO_FORMAT_I40A: + size = width * height; + ALIGN_SIZE(size, alignment); + offsets[0] = size; + size += (width / 2) * (height / 2); + ALIGN_SIZE(size, alignment); + offsets[1] = size; + size += (width / 2) * (height / 2); + ALIGN_SIZE(size, alignment); + offsets[2] = size; + size += width * height; + ALIGN_SIZE(size, alignment); + frame->data[0] = bmalloc(size); + frame->data[1] = (uint8_t *)frame->data[0] + offsets[0]; + frame->data[2] = (uint8_t *)frame->data[0] + offsets[1]; + frame->data[3] = (uint8_t *)frame->data[0] + offsets[2]; + frame->linesize[0] = width; + frame->linesize[1] = width / 2; + frame->linesize[2] = width / 2; + frame->linesize[3] = width; + break; + + case VIDEO_FORMAT_I42A: + size = width * height; + ALIGN_SIZE(size, alignment); + offsets[0] = size; + size += (width / 2) * height; + ALIGN_SIZE(size, alignment); + offsets[1] = size; + size += (width / 2) * height; + ALIGN_SIZE(size, alignment); + offsets[2] = size; + size += width * height; + ALIGN_SIZE(size, alignment); + frame->data[0] = bmalloc(size); + frame->data[1] = (uint8_t *)frame->data[0] + offsets[0]; + frame->data[2] = (uint8_t *)frame->data[0] + offsets[1]; + frame->data[3] = (uint8_t *)frame->data[0] + offsets[2]; + frame->linesize[0] = width; + frame->linesize[1] = width / 2; + frame->linesize[2] = width / 2; + frame->linesize[3] = width; + break; + + case VIDEO_FORMAT_YUVA: + size = width * height; + ALIGN_SIZE(size, alignment); + offsets[0] = size; + size += width * height; + ALIGN_SIZE(size, alignment); + offsets[1] = size; + size += width * height; + ALIGN_SIZE(size, alignment); + offsets[2] = size; + size += width * height; + ALIGN_SIZE(size, alignment); + frame->data[0] = bmalloc(size); + frame->data[1] = (uint8_t *)frame->data[0] + offsets[0]; + frame->data[2] = (uint8_t *)frame->data[0] + offsets[1]; + frame->data[3] = (uint8_t *)frame->data[0] + offsets[2]; frame->linesize[0] = width; frame->linesize[1] = width; frame->linesize[2] = width; + frame->linesize[3] = width; break; } } void video_frame_copy(struct video_frame *dst, const struct video_frame *src, - enum video_format format, uint32_t cy) + enum video_format format, uint32_t cy) { switch (format) { case VIDEO_FORMAT_NONE: @@ -129,13 +220,31 @@ case VIDEO_FORMAT_RGBA: case VIDEO_FORMAT_BGRA: case VIDEO_FORMAT_BGRX: + case VIDEO_FORMAT_BGR3: + case VIDEO_FORMAT_AYUV: memcpy(dst->data[0], src->data[0], src->linesize[0] * cy); break; case VIDEO_FORMAT_I444: + case VIDEO_FORMAT_I422: + memcpy(dst->data[0], src->data[0], src->linesize[0] * cy); + memcpy(dst->data[1], src->data[1], src->linesize[1] * cy); + memcpy(dst->data[2], src->data[2], src->linesize[2] * cy); + break; + + case VIDEO_FORMAT_I40A: + memcpy(dst->data[0], src->data[0], src->linesize[0] * cy); + memcpy(dst->data[1], src->data[1], src->linesize[1] * cy / 2); + memcpy(dst->data[2], src->data[2], src->linesize[2] * cy / 2); + memcpy(dst->data[3], src->data[3], src->linesize[3] * cy); + break; + + case VIDEO_FORMAT_I42A: + case VIDEO_FORMAT_YUVA: memcpy(dst->data[0], src->data[0], src->linesize[0] * cy); memcpy(dst->data[1], src->data[1], src->linesize[1] * cy); memcpy(dst->data[2], src->data[2], src->linesize[2] * cy); + memcpy(dst->data[3], src->data[3], src->linesize[3] * cy); break; } }
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/video-frame.h -> obs-studio-24.0.0.tar.xz/libobs/media-io/video-frame.h
Changed
@@ -21,12 +21,13 @@ #include "video-io.h" struct video_frame { - uint8_t *data[MAX_AV_PLANES]; + uint8_t *data[MAX_AV_PLANES]; uint32_t linesize[MAX_AV_PLANES]; }; EXPORT void video_frame_init(struct video_frame *frame, - enum video_format format, uint32_t width, uint32_t height); + enum video_format format, uint32_t width, + uint32_t height); static inline void video_frame_free(struct video_frame *frame) { @@ -36,12 +37,12 @@ } } -static inline struct video_frame *video_frame_create( - enum video_format format, uint32_t width, uint32_t height) +static inline struct video_frame * +video_frame_create(enum video_format format, uint32_t width, uint32_t height) { struct video_frame *frame; - frame = (struct video_frame*)bzalloc(sizeof(struct video_frame)); + frame = (struct video_frame *)bzalloc(sizeof(struct video_frame)); video_frame_init(frame, format, width, height); return frame; } @@ -55,5 +56,5 @@ } EXPORT void video_frame_copy(struct video_frame *dst, - const struct video_frame *src, enum video_format format, - uint32_t height); + const struct video_frame *src, + enum video_format format, uint32_t height);
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/video-io.c -> obs-studio-24.0.0.tar.xz/libobs/media-io/video-io.c
Changed
@@ -40,10 +40,10 @@ }; struct video_input { - struct video_scale_info conversion; - video_scaler_t *scaler; - struct video_frame frame[MAX_CONVERT_BUFFERS]; - int cur_frame; + struct video_scale_info conversion; + video_scaler_t *scaler; + struct video_frame frame[MAX_CONVERT_BUFFERS]; + int cur_frame; void (*callback)(void *param, struct video_data *frame); void *param; @@ -57,35 +57,35 @@ } struct video_output { - struct video_output_info info; + struct video_output_info info; - pthread_t thread; - pthread_mutex_t data_mutex; - bool stop; + pthread_t thread; + pthread_mutex_t data_mutex; + bool stop; - os_sem_t *update_semaphore; - uint64_t frame_time; - volatile long skipped_frames; - volatile long total_frames; + os_sem_t *update_semaphore; + uint64_t frame_time; + volatile long skipped_frames; + volatile long total_frames; - bool initialized; + bool initialized; - pthread_mutex_t input_mutex; + pthread_mutex_t input_mutex; DARRAY(struct video_input) inputs; - size_t available_frames; - size_t first_added; - size_t last_added; - struct cached_frame_info cache[MAX_CACHE_SIZE]; + size_t available_frames; + size_t first_added; + size_t last_added; + struct cached_frame_info cache[MAX_CACHE_SIZE]; - volatile bool raw_active; - volatile long gpu_refs; + volatile bool raw_active; + volatile long gpu_refs; }; /* ------------------------------------------------------------------------- */ static inline bool scale_video_output(struct video_input *input, - struct video_data *data) + struct video_data *data) { bool success = true; @@ -97,14 +97,14 @@ frame = &input->frame[input->cur_frame]; - success = video_scaler_scale(input->scaler, - frame->data, frame->linesize, - (const uint8_t * const*)data->data, - data->linesize); + success = video_scaler_scale(input->scaler, frame->data, + frame->linesize, + (const uint8_t *const *)data->data, + data->linesize); if (success) { for (size_t i = 0; i < MAX_AV_PLANES; i++) { - data->data[i] = frame->data[i]; + data->data[i] = frame->data[i]; data->linesize[i] = frame->linesize[i]; } } else { @@ -134,7 +134,7 @@ pthread_mutex_lock(&video->input_mutex); for (size_t i = 0; i < video->inputs.num; i++) { - struct video_input *input = video->inputs.array+i; + struct video_input *input = video->inputs.array + i; struct video_data frame = frame_info->frame; if (scale_video_output(input, &frame)) @@ -177,7 +177,7 @@ const char *video_thread_name = profile_store_name(obs_get_profiler_name_store(), - "video_thread(%s)", video->info.name); + "video_thread(%s)", video->info.name); while (os_sem_wait(video->update_semaphore) == 0) { if (video->stop) @@ -212,10 +212,10 @@ for (size_t i = 0; i < video->info.cache_size; i++) { struct video_frame *frame; - frame = (struct video_frame*)&video->cache[i]; + frame = (struct video_frame *)&video->cache[i]; - video_frame_init(frame, video->info.format, - video->info.width, video->info.height); + video_frame_init(frame, video->info.format, video->info.width, + video->info.height); } video->available_frames = video->info.cache_size; @@ -235,7 +235,7 @@ memcpy(&out->info, info, sizeof(struct video_output_info)); out->frame_time = (uint64_t)(1000000000.0 * (double)info->fps_den / - (double)info->fps_num); + (double)info->fps_num); out->initialized = false; if (pthread_mutexattr_init(&attr) != 0) @@ -274,7 +274,7 @@ da_free(video->inputs); for (size_t i = 0; i < video->info.cache_size; i++) - video_frame_free((struct video_frame*)&video->cache[i]); + video_frame_free((struct video_frame *)&video->cache[i]); os_sem_destroy(video->update_semaphore); pthread_mutex_destroy(&video->data_mutex); @@ -283,11 +283,12 @@ } static size_t video_get_input_idx(const video_t *video, - void (*callback)(void *param, struct video_data *frame), - void *param) + void (*callback)(void *param, + struct video_data *frame), + void *param) { for (size_t i = 0; i < video->inputs.num; i++) { - struct video_input *input = video->inputs.array+i; + struct video_input *input = video->inputs.array + i; if (input->callback == callback && input->param == param) return i; } @@ -296,38 +297,37 @@ } static inline bool video_input_init(struct video_input *input, - struct video_output *video) + struct video_output *video) { - if (input->conversion.width != video->info.width || + if (input->conversion.width != video->info.width || input->conversion.height != video->info.height || input->conversion.format != video->info.format) { - struct video_scale_info from = { - .format = video->info.format, - .width = video->info.width, - .height = video->info.height, - .range = video->info.range, - .colorspace = video->info.colorspace - }; + struct video_scale_info from = {.format = video->info.format, + .width = video->info.width, + .height = video->info.height, + .range = video->info.range, + .colorspace = + video->info.colorspace}; int ret = video_scaler_create(&input->scaler, - &input->conversion, &from, - VIDEO_SCALE_FAST_BILINEAR); + &input->conversion, &from, + VIDEO_SCALE_FAST_BILINEAR); if (ret != VIDEO_SCALER_SUCCESS) { if (ret == VIDEO_SCALER_BAD_CONVERSION) blog(LOG_ERROR, "video_input_init: Bad " - "scale conversion type"); + "scale conversion type"); else blog(LOG_ERROR, "video_input_init: Failed to " - "create scaler"); + "create scaler"); return false; } for (size_t i = 0; i < MAX_CONVERT_BUFFERS; i++) video_frame_init(&input->frame[i], - input->conversion.format, - input->conversion.width, - input->conversion.height); + input->conversion.format, + input->conversion.width, + input->conversion.height); } return true; @@ -339,10 +339,9 @@ os_atomic_set_long(&video->total_frames, 0); } -bool video_output_connect(video_t *video, - const struct video_scale_info *conversion, - void (*callback)(void *param, struct video_data *frame), - void *param) +bool video_output_connect( + video_t *video, const struct video_scale_info *conversion, + void (*callback)(void *param, struct video_data *frame), void *param) { bool success = false; @@ -356,14 +355,14 @@ memset(&input, 0, sizeof(input)); input.callback = callback; - input.param = param; + input.param = param; if (conversion) { input.conversion = *conversion; } else { - input.conversion.format = video->info.format; - input.conversion.width = video->info.width; - input.conversion.height = video->info.height; + input.conversion.format = video->info.format; + input.conversion.width = video->info.width; + input.conversion.height = video->info.height; } if (input.conversion.width == 0) @@ -393,22 +392,22 @@ long skipped = os_atomic_load_long(&video->skipped_frames); double percentage_skipped = (double)skipped / - (double)os_atomic_load_long(&video->total_frames) * - 100.0; + (double)os_atomic_load_long(&video->total_frames) * 100.0; if (skipped) - blog(LOG_INFO, "Video stopped, number of " - "skipped frames due " - "to encoding lag: " - "%ld/%ld (%0.1f%%)", - video->skipped_frames, - video->total_frames, - percentage_skipped); + blog(LOG_INFO, + "Video stopped, number of " + "skipped frames due " + "to encoding lag: " + "%ld/%ld (%0.1f%%)", + video->skipped_frames, video->total_frames, + percentage_skipped); } void video_output_disconnect(video_t *video, - void (*callback)(void *param, struct video_data *frame), - void *param) + void (*callback)(void *param, + struct video_data *frame), + void *param) { if (!video || !callback) return; @@ -417,7 +416,7 @@ size_t idx = video_get_input_idx(video, callback, param); if (idx != DARRAY_INVALID) { - video_input_free(video->inputs.array+idx); + video_input_free(video->inputs.array + idx); da_erase(video->inputs, idx); if (video->inputs.num == 0) { @@ -433,7 +432,8 @@ bool video_output_active(const video_t *video) { - if (!video) return false; + if (!video) + return false; return os_atomic_load_bool(&video->raw_active); } @@ -443,12 +443,13 @@ } bool video_output_lock_frame(video_t *video, struct video_frame *frame, - int count, uint64_t timestamp) + int count, uint64_t timestamp) { struct cached_frame_info *cfi; bool locked; - if (!video) return false; + if (!video) + return false; pthread_mutex_lock(&video->data_mutex); @@ -480,7 +481,8 @@ void video_output_unlock_frame(video_t *video) { - if (!video) return; + if (!video) + return; pthread_mutex_lock(&video->data_mutex);
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/video-io.h -> obs-studio-24.0.0.tar.xz/libobs/media-io/video-io.h
Changed
@@ -50,6 +50,24 @@ /* planar 4:4:4 */ VIDEO_FORMAT_I444, + + /* more packed uncompressed formats */ + VIDEO_FORMAT_BGR3, + + /* planar 4:2:2 */ + VIDEO_FORMAT_I422, + + /* planar 4:2:0 with alpha */ + VIDEO_FORMAT_I40A, + + /* planar 4:2:2 with alpha */ + VIDEO_FORMAT_I42A, + + /* planar 4:4:4 with alpha */ + VIDEO_FORMAT_YUVA, + + /* packed 4:4:4 with alpha */ + VIDEO_FORMAT_AYUV, }; enum video_colorspace { @@ -65,20 +83,20 @@ }; struct video_data { - uint8_t *data[MAX_AV_PLANES]; - uint32_t linesize[MAX_AV_PLANES]; - uint64_t timestamp; + uint8_t *data[MAX_AV_PLANES]; + uint32_t linesize[MAX_AV_PLANES]; + uint64_t timestamp; }; struct video_output_info { - const char *name; + const char *name; enum video_format format; - uint32_t fps_num; - uint32_t fps_den; - uint32_t width; - uint32_t height; - size_t cache_size; + uint32_t fps_num; + uint32_t fps_den; + uint32_t width; + uint32_t height; + size_t cache_size; enum video_colorspace colorspace; enum video_range_type range; @@ -89,16 +107,22 @@ switch (format) { case VIDEO_FORMAT_I420: case VIDEO_FORMAT_NV12: + case VIDEO_FORMAT_I422: case VIDEO_FORMAT_YVYU: case VIDEO_FORMAT_YUY2: case VIDEO_FORMAT_UYVY: case VIDEO_FORMAT_I444: + case VIDEO_FORMAT_I40A: + case VIDEO_FORMAT_I42A: + case VIDEO_FORMAT_YUVA: + case VIDEO_FORMAT_AYUV: return true; case VIDEO_FORMAT_NONE: case VIDEO_FORMAT_RGBA: case VIDEO_FORMAT_BGRA: case VIDEO_FORMAT_BGRX: case VIDEO_FORMAT_Y800: + case VIDEO_FORMAT_BGR3: return false; } @@ -108,16 +132,38 @@ static inline const char *get_video_format_name(enum video_format format) { switch (format) { - case VIDEO_FORMAT_I420: return "I420"; - case VIDEO_FORMAT_NV12: return "NV12"; - case VIDEO_FORMAT_YVYU: return "YVYU"; - case VIDEO_FORMAT_YUY2: return "YUY2"; - case VIDEO_FORMAT_UYVY: return "UYVY"; - case VIDEO_FORMAT_RGBA: return "RGBA"; - case VIDEO_FORMAT_BGRA: return "BGRA"; - case VIDEO_FORMAT_BGRX: return "BGRX"; - case VIDEO_FORMAT_I444: return "I444"; - case VIDEO_FORMAT_Y800: return "Y800"; + case VIDEO_FORMAT_I420: + return "I420"; + case VIDEO_FORMAT_NV12: + return "NV12"; + case VIDEO_FORMAT_I422: + return "I422"; + case VIDEO_FORMAT_YVYU: + return "YVYU"; + case VIDEO_FORMAT_YUY2: + return "YUY2"; + case VIDEO_FORMAT_UYVY: + return "UYVY"; + case VIDEO_FORMAT_RGBA: + return "RGBA"; + case VIDEO_FORMAT_BGRA: + return "BGRA"; + case VIDEO_FORMAT_BGRX: + return "BGRX"; + case VIDEO_FORMAT_I444: + return "I444"; + case VIDEO_FORMAT_Y800: + return "Y800"; + case VIDEO_FORMAT_BGR3: + return "BGR3"; + case VIDEO_FORMAT_I40A: + return "I40A"; + case VIDEO_FORMAT_I42A: + return "I42A"; + case VIDEO_FORMAT_YUVA: + return "YUVA"; + case VIDEO_FORMAT_AYUV: + return "AYUV"; case VIDEO_FORMAT_NONE:; } @@ -127,7 +173,8 @@ static inline const char *get_video_colorspace_name(enum video_colorspace cs) { switch (cs) { - case VIDEO_CS_709: return "709"; + case VIDEO_CS_709: + return "709"; case VIDEO_CS_601: case VIDEO_CS_DEFAULT:; } @@ -135,20 +182,19 @@ return "601"; } -static inline enum video_range_type resolve_video_range( - enum video_format format, enum video_range_type range) +static inline enum video_range_type +resolve_video_range(enum video_format format, enum video_range_type range) { if (range == VIDEO_RANGE_DEFAULT) { - range = format_is_yuv(format) - ? VIDEO_RANGE_PARTIAL - : VIDEO_RANGE_FULL; + range = format_is_yuv(format) ? VIDEO_RANGE_PARTIAL + : VIDEO_RANGE_FULL; } return range; } static inline const char *get_video_range_name(enum video_format format, - enum video_range_type range) + enum video_range_type range) { range = resolve_video_range(format, range); return range == VIDEO_RANGE_FULL ? "Full" : "Partial"; @@ -163,9 +209,9 @@ }; struct video_scale_info { - enum video_format format; - uint32_t width; - uint32_t height; + enum video_format format; + uint32_t width; + uint32_t height; enum video_range_type range; enum video_colorspace colorspace; }; @@ -173,30 +219,32 @@ EXPORT enum video_format video_format_from_fourcc(uint32_t fourcc); EXPORT bool video_format_get_parameters(enum video_colorspace color_space, - enum video_range_type range, float matrix[16], - float min_range[3], float max_range[3]); + enum video_range_type range, + float matrix[16], float min_range[3], + float max_range[3]); -#define VIDEO_OUTPUT_SUCCESS 0 +#define VIDEO_OUTPUT_SUCCESS 0 #define VIDEO_OUTPUT_INVALIDPARAM -1 -#define VIDEO_OUTPUT_FAIL -2 +#define VIDEO_OUTPUT_FAIL -2 EXPORT int video_output_open(video_t **video, struct video_output_info *info); EXPORT void video_output_close(video_t *video); -EXPORT bool video_output_connect(video_t *video, - const struct video_scale_info *conversion, - void (*callback)(void *param, struct video_data *frame), - void *param); +EXPORT bool +video_output_connect(video_t *video, const struct video_scale_info *conversion, + void (*callback)(void *param, struct video_data *frame), + void *param); EXPORT void video_output_disconnect(video_t *video, - void (*callback)(void *param, struct video_data *frame), - void *param); + void (*callback)(void *param, + struct video_data *frame), + void *param); EXPORT bool video_output_active(const video_t *video); -EXPORT const struct video_output_info *video_output_get_info( - const video_t *video); +EXPORT const struct video_output_info * +video_output_get_info(const video_t *video); EXPORT bool video_output_lock_frame(video_t *video, struct video_frame *frame, - int count, uint64_t timestamp); + int count, uint64_t timestamp); EXPORT void video_output_unlock_frame(video_t *video); EXPORT uint64_t video_output_get_frame_time(const video_t *video); EXPORT void video_output_stop(video_t *video); @@ -215,7 +263,6 @@ extern void video_output_inc_texture_frames(video_t *video); extern void video_output_inc_texture_skipped_frames(video_t *video); - #ifdef __cplusplus } #endif
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/video-matrices.c -> obs-studio-24.0.0.tar.xz/libobs/media-io/video-matrices.c
Changed
@@ -37,69 +37,59 @@ } format_info[] = { {VIDEO_CS_601, - 0.114f, 0.299f, {16, 16, 16}, {235, 240, 240}, - {{16, 128, 128}, {0, 128, 128}}, + 0.114f, + 0.299f, + {16, 16, 16}, + {235, 240, 240}, + {{16, 128, 128}, {0, 128, 128}}, #ifndef COMPUTE_MATRICES - { 16.0f/255.0f, 16.0f/255.0f, 16.0f/255.0f}, - {235.0f/255.0f, 240.0f/255.0f, 240.0f/255.0f}, - { - { - 1.164384f, 0.000000f, 1.596027f, -0.874202f, - 1.164384f, -0.391762f, -0.812968f, 0.531668f, - 1.164384f, 2.017232f, 0.000000f, -1.085631f, - 0.000000f, 0.000000f, 0.000000f, 1.000000f - }, - { - 1.000000f, 0.000000f, 1.407520f, -0.706520f, - 1.000000f, -0.345491f, -0.716948f, 0.533303f, - 1.000000f, 1.778976f, 0.000000f, -0.892976f, - 0.000000f, 0.000000f, 0.000000f, 1.000000f - } - } + {16.0f / 255.0f, 16.0f / 255.0f, 16.0f / 255.0f}, + {235.0f / 255.0f, 240.0f / 255.0f, 240.0f / 255.0f}, + {{1.164384f, 0.000000f, 1.596027f, -0.874202f, 1.164384f, -0.391762f, + -0.812968f, 0.531668f, 1.164384f, 2.017232f, 0.000000f, -1.085631f, + 0.000000f, 0.000000f, 0.000000f, 1.000000f}, + {1.000000f, 0.000000f, 1.407520f, -0.706520f, 1.000000f, -0.345491f, + -0.716948f, 0.533303f, 1.000000f, 1.778976f, 0.000000f, -0.892976f, + 0.000000f, 0.000000f, 0.000000f, 1.000000f}} #endif }, {VIDEO_CS_709, - 0.0722f, 0.2126f, {16, 16, 16}, {235, 240, 240}, - {{16, 128, 128}, {0, 128, 128}}, + 0.0722f, + 0.2126f, + {16, 16, 16}, + {235, 240, 240}, + {{16, 128, 128}, {0, 128, 128}}, #ifndef COMPUTE_MATRICES - { 16.0f/255.0f, 16.0f/255.0f, 16.0f/255.0f}, - {235.0f/255.0f, 240.0f/255.0f, 240.0f/255.0f}, - { - { - 1.164384f, 0.000000f, 1.792741f, -0.972945f, - 1.164384f, -0.213249f, -0.532909f, 0.301483f, - 1.164384f, 2.112402f, 0.000000f, -1.133402f, - 0.000000f, 0.000000f, 0.000000f, 1.000000f - }, - { - 1.000000f, 0.000000f, 1.581000f, -0.793600f, - 1.000000f, -0.188062f, -0.469967f, 0.330305f, - 1.000000f, 1.862906f, 0.000000f, -0.935106f, - 0.000000f, 0.000000f, 0.000000f, 1.000000f - } - } + {16.0f / 255.0f, 16.0f / 255.0f, 16.0f / 255.0f}, + {235.0f / 255.0f, 240.0f / 255.0f, 240.0f / 255.0f}, + {{1.164384f, 0.000000f, 1.792741f, -0.972945f, 1.164384f, -0.213249f, + -0.532909f, 0.301483f, 1.164384f, 2.112402f, 0.000000f, -1.133402f, + 0.000000f, 0.000000f, 0.000000f, 1.000000f}, + {1.000000f, 0.000000f, 1.581000f, -0.793600f, 1.000000f, -0.188062f, + -0.469967f, 0.330305f, 1.000000f, 1.862906f, 0.000000f, -0.935106f, + 0.000000f, 0.000000f, 0.000000f, 1.000000f}} #endif }, }; -#define NUM_FORMATS (sizeof(format_info)/sizeof(format_info[0])) +#define NUM_FORMATS (sizeof(format_info) / sizeof(format_info[0])) #ifdef COMPUTE_MATRICES static void log_matrix(float const matrix[16]) { - blog(LOG_DEBUG, "\n% f, % f, % f, % f" \ - "\n% f, % f, % f, % f" \ - "\n% f, % f, % f, % f" \ - "\n% f, % f, % f, % f", - matrix[ 0], matrix[ 1], matrix[ 2], matrix[ 3], - matrix[ 4], matrix[ 5], matrix[ 6], matrix[ 7], - matrix[ 8], matrix[ 9], matrix[10], matrix[11], - matrix[12], matrix[13], matrix[14], matrix[15]); + blog(LOG_DEBUG, + "\n% f, % f, % f, % f" + "\n% f, % f, % f, % f" + "\n% f, % f, % f, % f" + "\n% f, % f, % f, % f", + matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5], + matrix[6], matrix[7], matrix[8], matrix[9], matrix[10], matrix[11], + matrix[12], matrix[13], matrix[14], matrix[15]); } static void initialize_matrix(float const Kb, float const Kr, - int const range_min[3], int const range_max[3], - int const black_levels[3], float matrix[16]) + int const range_min[3], int const range_max[3], + int const black_levels[3], float matrix[16]) { struct matrix3 color_matrix; @@ -107,35 +97,29 @@ int uvals = (range_max[1] - range_min[1]) / 2; int vvals = (range_max[2] - range_min[2]) / 2; - vec3_set(&color_matrix.x, 255./yvals, - 0., - 255./vvals * (1. - Kr)); - vec3_set(&color_matrix.y, 255./yvals, - 255./uvals * (Kb - 1.) * Kb / (1. - Kb - Kr), - 255./vvals * (Kr - 1.) * Kr / (1. - Kb - Kr)); - vec3_set(&color_matrix.z, 255./yvals, - 255./uvals * (1. - Kb), - 0.); + vec3_set(&color_matrix.x, 255. / yvals, 0., 255. / vvals * (1. - Kr)); + vec3_set(&color_matrix.y, 255. / yvals, + 255. / uvals * (Kb - 1.) * Kb / (1. - Kb - Kr), + 255. / vvals * (Kr - 1.) * Kr / (1. - Kb - Kr)); + vec3_set(&color_matrix.z, 255. / yvals, 255. / uvals * (1. - Kb), 0.); struct vec3 offsets, multiplied; - vec3_set(&offsets, - -black_levels[0]/255., - -black_levels[1]/255., - -black_levels[2]/255.); + vec3_set(&offsets, -black_levels[0] / 255., -black_levels[1] / 255., + -black_levels[2] / 255.); vec3_rotate(&multiplied, &offsets, &color_matrix); - matrix[ 0] = color_matrix.x.x; - matrix[ 1] = color_matrix.x.y; - matrix[ 2] = color_matrix.x.z; - matrix[ 3] = multiplied.x; + matrix[0] = color_matrix.x.x; + matrix[1] = color_matrix.x.y; + matrix[2] = color_matrix.x.z; + matrix[3] = multiplied.x; - matrix[ 4] = color_matrix.y.x; - matrix[ 5] = color_matrix.y.y; - matrix[ 6] = color_matrix.y.z; - matrix[ 7] = multiplied.y; + matrix[4] = color_matrix.y.x; + matrix[5] = color_matrix.y.y; + matrix[6] = color_matrix.y.z; + matrix[7] = multiplied.y; - matrix[ 8] = color_matrix.z.x; - matrix[ 9] = color_matrix.z.y; + matrix[8] = color_matrix.z.x; + matrix[9] = color_matrix.z.y; matrix[10] = color_matrix.z.z; matrix[11] = multiplied.z; @@ -147,26 +131,26 @@ static void initialize_matrices() { - static int range_min[] = { 0, 0, 0}; + static int range_min[] = {0, 0, 0}; static int range_max[] = {255, 255, 255}; for (size_t i = 0; i < NUM_FORMATS; i++) { initialize_matrix(format_info[i].Kb, format_info[i].Kr, - range_min, range_max, - format_info[i].black_levels[1], - format_info[i].matrix[1]); + range_min, range_max, + format_info[i].black_levels[1], + format_info[i].matrix[1]); initialize_matrix(format_info[i].Kb, format_info[i].Kr, - format_info[i].range_min, - format_info[i].range_max, - format_info[i].black_levels[0], - format_info[i].matrix[0]); + format_info[i].range_min, + format_info[i].range_max, + format_info[i].black_levels[0], + format_info[i].matrix[0]); for (int j = 0; j < 3; j++) { format_info[i].float_range_min[j] = - format_info[i].range_min[j]/255.; + format_info[i].range_min[j] / 255.; format_info[i].float_range_max[j] = - format_info[i].range_max[j]/255.; + format_info[i].range_max[j] / 255.; } } } @@ -178,8 +162,8 @@ static const float full_max[3] = {1.0f, 1.0f, 1.0f}; bool video_format_get_parameters(enum video_colorspace color_space, - enum video_range_type range, float matrix[16], - float range_min[3], float range_max[3]) + enum video_range_type range, float matrix[16], + float range_min[3], float range_max[3]) { #ifdef COMPUTE_MATRICES if (!matrices_initialized) { @@ -196,7 +180,7 @@ int full_range = range == VIDEO_RANGE_FULL ? 1 : 0; memcpy(matrix, format_info[i].matrix[full_range], - sizeof(float) * 16); + sizeof(float) * 16); if (range == VIDEO_RANGE_FULL) { if (range_min) @@ -208,11 +192,11 @@ if (range_min) memcpy(range_min, format_info[i].float_range_min, - sizeof(float) * 3); + sizeof(float) * 3); if (range_max) memcpy(range_max, format_info[i].float_range_max, - sizeof(float) * 3); + sizeof(float) * 3); return true; }
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/video-scaler-ffmpeg.c -> obs-studio-24.0.0.tar.xz/libobs/media-io/video-scaler-ffmpeg.c
Changed
@@ -25,21 +25,43 @@ int src_height; }; -static inline enum AVPixelFormat get_ffmpeg_video_format( - enum video_format format) +static inline enum AVPixelFormat +get_ffmpeg_video_format(enum video_format format) { switch (format) { - case VIDEO_FORMAT_NONE: return AV_PIX_FMT_NONE; - case VIDEO_FORMAT_I420: return AV_PIX_FMT_YUV420P; - case VIDEO_FORMAT_NV12: return AV_PIX_FMT_NV12; - case VIDEO_FORMAT_YVYU: return AV_PIX_FMT_NONE; - case VIDEO_FORMAT_YUY2: return AV_PIX_FMT_YUYV422; - case VIDEO_FORMAT_UYVY: return AV_PIX_FMT_UYVY422; - case VIDEO_FORMAT_RGBA: return AV_PIX_FMT_RGBA; - case VIDEO_FORMAT_BGRA: return AV_PIX_FMT_BGRA; - case VIDEO_FORMAT_BGRX: return AV_PIX_FMT_BGRA; - case VIDEO_FORMAT_Y800: return AV_PIX_FMT_GRAY8; - case VIDEO_FORMAT_I444: return AV_PIX_FMT_YUV444P; + case VIDEO_FORMAT_I420: + return AV_PIX_FMT_YUV420P; + case VIDEO_FORMAT_NV12: + return AV_PIX_FMT_NV12; + case VIDEO_FORMAT_YUY2: + return AV_PIX_FMT_YUYV422; + case VIDEO_FORMAT_UYVY: + return AV_PIX_FMT_UYVY422; + case VIDEO_FORMAT_RGBA: + return AV_PIX_FMT_RGBA; + case VIDEO_FORMAT_BGRA: + return AV_PIX_FMT_BGRA; + case VIDEO_FORMAT_BGRX: + return AV_PIX_FMT_BGRA; + case VIDEO_FORMAT_Y800: + return AV_PIX_FMT_GRAY8; + case VIDEO_FORMAT_I444: + return AV_PIX_FMT_YUV444P; + case VIDEO_FORMAT_BGR3: + return AV_PIX_FMT_BGR24; + case VIDEO_FORMAT_I422: + return AV_PIX_FMT_YUV422P; + case VIDEO_FORMAT_I40A: + return AV_PIX_FMT_YUVA420P; + case VIDEO_FORMAT_I42A: + return AV_PIX_FMT_YUVA422P; + case VIDEO_FORMAT_YUVA: + return AV_PIX_FMT_YUVA444P; + case VIDEO_FORMAT_NONE: + case VIDEO_FORMAT_YVYU: + case VIDEO_FORMAT_AYUV: + /* not supported by FFmpeg */ + return AV_PIX_FMT_NONE; } return AV_PIX_FMT_NONE; @@ -48,11 +70,16 @@ static inline int get_ffmpeg_scale_type(enum video_scale_type type) { switch (type) { - case VIDEO_SCALE_DEFAULT: return SWS_FAST_BILINEAR; - case VIDEO_SCALE_POINT: return SWS_POINT; - case VIDEO_SCALE_FAST_BILINEAR: return SWS_FAST_BILINEAR; - case VIDEO_SCALE_BILINEAR: return SWS_BILINEAR | SWS_AREA; - case VIDEO_SCALE_BICUBIC: return SWS_BICUBIC; + case VIDEO_SCALE_DEFAULT: + return SWS_FAST_BILINEAR; + case VIDEO_SCALE_POINT: + return SWS_POINT; + case VIDEO_SCALE_FAST_BILINEAR: + return SWS_FAST_BILINEAR; + case VIDEO_SCALE_BILINEAR: + return SWS_BILINEAR | SWS_AREA; + case VIDEO_SCALE_BICUBIC: + return SWS_BICUBIC; } return SWS_POINT; @@ -61,9 +88,12 @@ static inline const int *get_ffmpeg_coeffs(enum video_colorspace cs) { switch (cs) { - case VIDEO_CS_DEFAULT: return sws_getCoefficients(SWS_CS_ITU601); - case VIDEO_CS_601: return sws_getCoefficients(SWS_CS_ITU601); - case VIDEO_CS_709: return sws_getCoefficients(SWS_CS_ITU709); + case VIDEO_CS_DEFAULT: + return sws_getCoefficients(SWS_CS_ITU601); + case VIDEO_CS_601: + return sws_getCoefficients(SWS_CS_ITU601); + case VIDEO_CS_709: + return sws_getCoefficients(SWS_CS_ITU709); } return sws_getCoefficients(SWS_CS_ITU601); @@ -72,58 +102,59 @@ static inline int get_ffmpeg_range_type(enum video_range_type type) { switch (type) { - case VIDEO_RANGE_DEFAULT: return 0; - case VIDEO_RANGE_PARTIAL: return 0; - case VIDEO_RANGE_FULL: return 1; + case VIDEO_RANGE_DEFAULT: + return 0; + case VIDEO_RANGE_PARTIAL: + return 0; + case VIDEO_RANGE_FULL: + return 1; } return 0; } -#define FIXED_1_0 (1<<16) +#define FIXED_1_0 (1 << 16) int video_scaler_create(video_scaler_t **scaler_out, - const struct video_scale_info *dst, - const struct video_scale_info *src, - enum video_scale_type type) + const struct video_scale_info *dst, + const struct video_scale_info *src, + enum video_scale_type type) { enum AVPixelFormat format_src = get_ffmpeg_video_format(src->format); enum AVPixelFormat format_dst = get_ffmpeg_video_format(dst->format); - int scale_type = get_ffmpeg_scale_type(type); - const int *coeff_src = get_ffmpeg_coeffs(src->colorspace); - const int *coeff_dst = get_ffmpeg_coeffs(dst->colorspace); - int range_src = get_ffmpeg_range_type(src->range); - int range_dst = get_ffmpeg_range_type(dst->range); + int scale_type = get_ffmpeg_scale_type(type); + const int *coeff_src = get_ffmpeg_coeffs(src->colorspace); + const int *coeff_dst = get_ffmpeg_coeffs(dst->colorspace); + int range_src = get_ffmpeg_range_type(src->range); + int range_dst = get_ffmpeg_range_type(dst->range); struct video_scaler *scaler; int ret; if (!scaler_out) return VIDEO_SCALER_FAILED; - if (format_src == AV_PIX_FMT_NONE || - format_dst == AV_PIX_FMT_NONE) + if (format_src == AV_PIX_FMT_NONE || format_dst == AV_PIX_FMT_NONE) return VIDEO_SCALER_BAD_CONVERSION; scaler = bzalloc(sizeof(struct video_scaler)); scaler->src_height = src->height; - scaler->swscale = sws_getCachedContext(NULL, - src->width, src->height, format_src, - dst->width, dst->height, format_dst, - scale_type, NULL, NULL, NULL); + scaler->swscale = sws_getCachedContext(NULL, src->width, src->height, + format_src, dst->width, + dst->height, format_dst, + scale_type, NULL, NULL, NULL); if (!scaler->swscale) { blog(LOG_ERROR, "video_scaler_create: Could not create " - "swscale"); + "swscale"); goto fail; } - ret = sws_setColorspaceDetails(scaler->swscale, - coeff_src, range_src, - coeff_dst, range_dst, - 0, FIXED_1_0, FIXED_1_0); + ret = sws_setColorspaceDetails(scaler->swscale, coeff_src, range_src, + coeff_dst, range_dst, 0, FIXED_1_0, + FIXED_1_0); if (ret < 0) { blog(LOG_DEBUG, "video_scaler_create: " - "sws_setColorspaceDetails failed, ignoring"); + "sws_setColorspaceDetails failed, ignoring"); } *scaler_out = scaler; @@ -142,20 +173,20 @@ } } -bool video_scaler_scale(video_scaler_t *scaler, - uint8_t *output[], const uint32_t out_linesize[], - const uint8_t *const input[], const uint32_t in_linesize[]) +bool video_scaler_scale(video_scaler_t *scaler, uint8_t *output[], + const uint32_t out_linesize[], + const uint8_t *const input[], + const uint32_t in_linesize[]) { if (!scaler) return false; - int ret = sws_scale(scaler->swscale, - input, (const int *)in_linesize, - 0, scaler->src_height, - output, (const int *)out_linesize); + int ret = sws_scale(scaler->swscale, input, (const int *)in_linesize, 0, + scaler->src_height, output, + (const int *)out_linesize); if (ret <= 0) { blog(LOG_ERROR, "video_scaler_scale: sws_scale failed: %d", - ret); + ret); return false; }
View file
obs-studio-23.2.1.tar.xz/libobs/media-io/video-scaler.h -> obs-studio-24.0.0.tar.xz/libobs/media-io/video-scaler.h
Changed
@@ -27,19 +27,20 @@ struct video_scaler; typedef struct video_scaler video_scaler_t; -#define VIDEO_SCALER_SUCCESS 0 +#define VIDEO_SCALER_SUCCESS 0 #define VIDEO_SCALER_BAD_CONVERSION -1 -#define VIDEO_SCALER_FAILED -2 +#define VIDEO_SCALER_FAILED -2 EXPORT int video_scaler_create(video_scaler_t **scaler, - const struct video_scale_info *dst, - const struct video_scale_info *src, - enum video_scale_type type); + const struct video_scale_info *dst, + const struct video_scale_info *src, + enum video_scale_type type); EXPORT void video_scaler_destroy(video_scaler_t *scaler); -EXPORT bool video_scaler_scale(video_scaler_t *scaler, - uint8_t *output[], const uint32_t out_linesize[], - const uint8_t *const input[], const uint32_t in_linesize[]); +EXPORT bool video_scaler_scale(video_scaler_t *scaler, uint8_t *output[], + const uint32_t out_linesize[], + const uint8_t *const input[], + const uint32_t in_linesize[]); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-audio-controls.c -> obs-studio-24.0.0.tar.xz/libobs/obs-audio-controls.c
Changed
@@ -38,45 +38,45 @@ typedef float (*obs_fader_conversion_t)(const float val); struct fader_cb { - obs_fader_changed_t callback; - void *param; + obs_fader_changed_t callback; + void *param; }; struct obs_fader { - pthread_mutex_t mutex; + pthread_mutex_t mutex; obs_fader_conversion_t def_to_db; obs_fader_conversion_t db_to_def; - obs_source_t *source; - enum obs_fader_type type; - float max_db; - float min_db; - float cur_db; - bool ignore_next_signal; - - pthread_mutex_t callback_mutex; - DARRAY(struct fader_cb)callbacks; + obs_source_t *source; + enum obs_fader_type type; + float max_db; + float min_db; + float cur_db; + bool ignore_next_signal; + + pthread_mutex_t callback_mutex; + DARRAY(struct fader_cb) callbacks; }; struct meter_cb { obs_volmeter_updated_t callback; - void *param; + void *param; }; struct obs_volmeter { - pthread_mutex_t mutex; - obs_source_t *source; - enum obs_fader_type type; - float cur_db; + pthread_mutex_t mutex; + obs_source_t *source; + enum obs_fader_type type; + float cur_db; - pthread_mutex_t callback_mutex; - DARRAY(struct meter_cb) callbacks; + pthread_mutex_t callback_mutex; + DARRAY(struct meter_cb) callbacks; - enum obs_peak_meter_type peak_meter_type; - unsigned int update_ms; - float prev_samples[MAX_AUDIO_CHANNELS][4]; + enum obs_peak_meter_type peak_meter_type; + unsigned int update_ms; + float prev_samples[MAX_AUDIO_CHANNELS][4]; - float magnitude[MAX_AUDIO_CHANNELS]; - float peak[MAX_AUDIO_CHANNELS]; + float magnitude[MAX_AUDIO_CHANNELS]; + float peak[MAX_AUDIO_CHANNELS]; }; static float cubic_def_to_db(const float def) @@ -157,12 +157,12 @@ return def; } -#define LOG_OFFSET_DB 6.0f -#define LOG_RANGE_DB 96.0f +#define LOG_OFFSET_DB 6.0f +#define LOG_RANGE_DB 96.0f /* equals -log10f(LOG_OFFSET_DB) */ #define LOG_OFFSET_VAL -0.77815125038364363f /* equals -log10f(-LOG_RANGE_DB + LOG_OFFSET_DB) */ -#define LOG_RANGE_VAL -2.00860017176191756f +#define LOG_RANGE_VAL -2.00860017176191756f static float log_def_to_db(const float def) { @@ -171,9 +171,10 @@ else if (def <= 0.0f) return -INFINITY; - return -(LOG_RANGE_DB + LOG_OFFSET_DB) * powf( - (LOG_RANGE_DB + LOG_OFFSET_DB) / LOG_OFFSET_DB, -def) - + LOG_OFFSET_DB; + return -(LOG_RANGE_DB + LOG_OFFSET_DB) * + powf((LOG_RANGE_DB + LOG_OFFSET_DB) / LOG_OFFSET_DB, + -def) + + LOG_OFFSET_DB; } static float log_db_to_def(const float db) @@ -183,8 +184,8 @@ else if (db <= -96.0f) return 0.0f; - return (-log10f(-db + LOG_OFFSET_DB) - LOG_RANGE_VAL) - / (LOG_OFFSET_VAL - LOG_RANGE_VAL); + return (-log10f(-db + LOG_OFFSET_DB) - LOG_RANGE_VAL) / + (LOG_OFFSET_VAL - LOG_RANGE_VAL); } static void signal_volume_changed(struct obs_fader *fader, const float db) @@ -198,9 +199,9 @@ } static void signal_levels_updated(struct obs_volmeter *volmeter, - const float magnitude[MAX_AUDIO_CHANNELS], - const float peak[MAX_AUDIO_CHANNELS], - const float input_peak[MAX_AUDIO_CHANNELS]) + const float magnitude[MAX_AUDIO_CHANNELS], + const float peak[MAX_AUDIO_CHANNELS], + const float input_peak[MAX_AUDIO_CHANNELS]) { pthread_mutex_lock(&volmeter->callback_mutex); for (size_t i = volmeter->callbacks.num; i > 0; i--) { @@ -212,7 +213,7 @@ static void fader_source_volume_changed(void *vptr, calldata_t *calldata) { - struct obs_fader *fader = (struct obs_fader *) vptr; + struct obs_fader *fader = (struct obs_fader *)vptr; pthread_mutex_lock(&fader->mutex); @@ -222,9 +223,9 @@ return; } - const float mul = (float)calldata_float(calldata, "volume"); - const float db = mul_to_db(mul); - fader->cur_db = db; + const float mul = (float)calldata_float(calldata, "volume"); + const float db = mul_to_db(mul); + fader->cur_db = db; pthread_mutex_unlock(&fader->mutex); @@ -233,11 +234,11 @@ static void volmeter_source_volume_changed(void *vptr, calldata_t *calldata) { - struct obs_volmeter *volmeter = (struct obs_volmeter *) vptr; + struct obs_volmeter *volmeter = (struct obs_volmeter *)vptr; pthread_mutex_lock(&volmeter->mutex); - float mul = (float) calldata_float(calldata, "volume"); + float mul = (float)calldata_float(calldata, "volume"); volmeter->cur_db = mul_to_db(mul); pthread_mutex_unlock(&volmeter->mutex); @@ -246,7 +247,7 @@ static void fader_source_destroyed(void *vptr, calldata_t *calldata) { UNUSED_PARAMETER(calldata); - struct obs_fader *fader = (struct obs_fader *) vptr; + struct obs_fader *fader = (struct obs_fader *)vptr; obs_fader_detach_source(fader); } @@ -254,7 +255,7 @@ static void volmeter_source_destroyed(void *vptr, calldata_t *calldata) { UNUSED_PARAMETER(calldata); - struct obs_volmeter *volmeter = (struct obs_volmeter *) vptr; + struct obs_volmeter *volmeter = (struct obs_volmeter *)vptr; obs_volmeter_detach_source(volmeter); } @@ -271,43 +272,44 @@ /* msb(h, g, f, e) lsb(d, c, b, a) --> msb(h, h, g, f) lsb(e, d, c, b) */ -#define SHIFT_RIGHT_2PS(msb, lsb) {\ - __m128 tmp = _mm_shuffle_ps(lsb, msb, _MM_SHUFFLE(0, 0, 3, 3));\ - lsb = _mm_shuffle_ps(lsb, tmp, _MM_SHUFFLE(2, 1, 2, 1));\ - msb = _mm_shuffle_ps(msb, msb, _MM_SHUFFLE(3, 3, 2, 1));\ -} +#define SHIFT_RIGHT_2PS(msb, lsb) \ + { \ + __m128 tmp = \ + _mm_shuffle_ps(lsb, msb, _MM_SHUFFLE(0, 0, 3, 3)); \ + lsb = _mm_shuffle_ps(lsb, tmp, _MM_SHUFFLE(2, 1, 2, 1)); \ + msb = _mm_shuffle_ps(msb, msb, _MM_SHUFFLE(3, 3, 2, 1)); \ + } /* x(d, c, b, a) --> (|d|, |c|, |b|, |a|) */ -#define abs_ps(v) \ - _mm_andnot_ps(_mm_set1_ps(-0.f), v) +#define abs_ps(v) _mm_andnot_ps(_mm_set1_ps(-0.f), v) /* Take cross product of a vector with a matrix resulting in vector. */ -#define VECTOR_MATRIX_CROSS_PS(out, v, m0, m1, m2, m3) \ -{\ - out = _mm_mul_ps(v, m0);\ - __m128 mul1 = _mm_mul_ps(v, m1);\ - __m128 mul2 = _mm_mul_ps(v, m2);\ - __m128 mul3 = _mm_mul_ps(v, m3);\ -\ - _MM_TRANSPOSE4_PS(out, mul1, mul2, mul3);\ -\ - out = _mm_add_ps(out, mul1);\ - out = _mm_add_ps(out, mul2);\ - out = _mm_add_ps(out, mul3);\ -} +#define VECTOR_MATRIX_CROSS_PS(out, v, m0, m1, m2, m3) \ + { \ + out = _mm_mul_ps(v, m0); \ + __m128 mul1 = _mm_mul_ps(v, m1); \ + __m128 mul2 = _mm_mul_ps(v, m2); \ + __m128 mul3 = _mm_mul_ps(v, m3); \ + \ + _MM_TRANSPOSE4_PS(out, mul1, mul2, mul3); \ + \ + out = _mm_add_ps(out, mul1); \ + out = _mm_add_ps(out, mul2); \ + out = _mm_add_ps(out, mul3); \ + } /* x4(d, c, b, a) --> max(a, b, c, d) */ -#define hmax_ps(r, x4) \ - do { \ - float x4_mem[4]; \ +#define hmax_ps(r, x4) \ + do { \ + float x4_mem[4]; \ _mm_storeu_ps(x4_mem, x4); \ - r = x4_mem[0]; \ - r = fmaxf(r, x4_mem[1]); \ - r = fmaxf(r, x4_mem[2]); \ - r = fmaxf(r, x4_mem[3]); \ + r = x4_mem[0]; \ + r = fmaxf(r, x4_mem[1]); \ + r = fmaxf(r, x4_mem[2]); \ + r = fmaxf(r, x4_mem[3]); \ } while (false) /* Calculate the true peak over a set of samples. @@ -323,15 +325,19 @@ * @returns 5 times oversampled true-peak from the set of samples. */ static float get_true_peak(__m128 previous_samples, const float *samples, - size_t nr_samples) + size_t nr_samples) { /* These are normalized-sinc parameters for interpolating over sample * points which are located at x-coords: -1.5, -0.5, +0.5, +1.5. * And oversample points at x-coords: -0.3, -0.1, 0.1, 0.3. */ - const __m128 m3 = _mm_set_ps(-0.155915f, 0.935489f, 0.233872f, -0.103943f); - const __m128 m1 = _mm_set_ps(-0.216236f, 0.756827f, 0.504551f, -0.189207f); - const __m128 p1 = _mm_set_ps(-0.189207f, 0.504551f, 0.756827f, -0.216236f); - const __m128 p3 = _mm_set_ps(-0.103943f, 0.233872f, 0.935489f, -0.155915f); + const __m128 m3 = + _mm_set_ps(-0.155915f, 0.935489f, 0.233872f, -0.103943f); + const __m128 m1 = + _mm_set_ps(-0.216236f, 0.756827f, 0.504551f, -0.189207f); + const __m128 p1 = + _mm_set_ps(-0.189207f, 0.504551f, 0.756827f, -0.216236f); + const __m128 p3 = + _mm_set_ps(-0.103943f, 0.233872f, 0.935489f, -0.155915f); __m128 work = previous_samples; __m128 peak = previous_samples; @@ -370,7 +376,7 @@ * over. They will have come from a previous iteration. */ static float get_sample_peak(__m128 previous_samples, const float *samples, - size_t nr_samples) + size_t nr_samples) { __m128 peak = previous_samples; for (size_t i = 0; (i + 3) < nr_samples; i += 4) { @@ -384,7 +390,8 @@ } static void volmeter_process_peak_last_samples(obs_volmeter_t *volmeter, - int channel_nr, float *samples, size_t nr_samples) + int channel_nr, float *samples, + size_t nr_samples) { /* Take the last 4 samples that need to be used for the next peak * calculation. If there are less than 4 samples in total the new @@ -395,38 +402,39 @@ break; case 1: volmeter->prev_samples[channel_nr][0] = - volmeter->prev_samples[channel_nr][1]; + volmeter->prev_samples[channel_nr][1]; volmeter->prev_samples[channel_nr][1] = - volmeter->prev_samples[channel_nr][2]; + volmeter->prev_samples[channel_nr][2]; volmeter->prev_samples[channel_nr][2] = - volmeter->prev_samples[channel_nr][3]; - volmeter->prev_samples[channel_nr][3] = samples[nr_samples-1]; + volmeter->prev_samples[channel_nr][3]; + volmeter->prev_samples[channel_nr][3] = samples[nr_samples - 1]; break; case 2: volmeter->prev_samples[channel_nr][0] = - volmeter->prev_samples[channel_nr][2]; + volmeter->prev_samples[channel_nr][2]; volmeter->prev_samples[channel_nr][1] = - volmeter->prev_samples[channel_nr][3]; - volmeter->prev_samples[channel_nr][2] = samples[nr_samples-2]; - volmeter->prev_samples[channel_nr][3] = samples[nr_samples-1]; + volmeter->prev_samples[channel_nr][3]; + volmeter->prev_samples[channel_nr][2] = samples[nr_samples - 2]; + volmeter->prev_samples[channel_nr][3] = samples[nr_samples - 1]; break; case 3: volmeter->prev_samples[channel_nr][0] = - volmeter->prev_samples[channel_nr][3]; - volmeter->prev_samples[channel_nr][1] = samples[nr_samples-3]; - volmeter->prev_samples[channel_nr][2] = samples[nr_samples-2]; - volmeter->prev_samples[channel_nr][3] = samples[nr_samples-1]; + volmeter->prev_samples[channel_nr][3]; + volmeter->prev_samples[channel_nr][1] = samples[nr_samples - 3]; + volmeter->prev_samples[channel_nr][2] = samples[nr_samples - 2]; + volmeter->prev_samples[channel_nr][3] = samples[nr_samples - 1]; break; default: - volmeter->prev_samples[channel_nr][0] = samples[nr_samples-4]; - volmeter->prev_samples[channel_nr][1] = samples[nr_samples-3]; - volmeter->prev_samples[channel_nr][2] = samples[nr_samples-2]; - volmeter->prev_samples[channel_nr][3] = samples[nr_samples-1]; + volmeter->prev_samples[channel_nr][0] = samples[nr_samples - 4]; + volmeter->prev_samples[channel_nr][1] = samples[nr_samples - 3]; + volmeter->prev_samples[channel_nr][2] = samples[nr_samples - 2]; + volmeter->prev_samples[channel_nr][3] = samples[nr_samples - 1]; } } static void volmeter_process_peak(obs_volmeter_t *volmeter, - const struct audio_data *data, int nr_channels) + const struct audio_data *data, + int nr_channels) { int nr_samples = data->frames; int channel_nr = 0; @@ -437,8 +445,8 @@ } if (((uintptr_t)samples & 0xf) > 0) { printf("Audio plane %i is not aligned %p skipping " - "peak volume measurement.\n", - plane_nr, samples); + "peak volume measurement.\n", + plane_nr, samples); volmeter->peak[channel_nr] = 1.0; channel_nr++; continue; @@ -446,26 +454,25 @@ /* volmeter->prev_samples may not be aligned to 16 bytes; * use unaligned load. */ - __m128 previous_samples = _mm_loadu_ps( - volmeter->prev_samples[channel_nr]); + __m128 previous_samples = + _mm_loadu_ps(volmeter->prev_samples[channel_nr]); float peak; switch (volmeter->peak_meter_type) { case TRUE_PEAK_METER: peak = get_true_peak(previous_samples, samples, - nr_samples); + nr_samples); break; case SAMPLE_PEAK_METER: default: peak = get_sample_peak(previous_samples, samples, - nr_samples); + nr_samples); break; - } - volmeter_process_peak_last_samples(volmeter, channel_nr, samples, - nr_samples); + volmeter_process_peak_last_samples(volmeter, channel_nr, + samples, nr_samples); volmeter->peak[channel_nr] = peak; @@ -479,7 +486,8 @@ } static void volmeter_process_magnitude(obs_volmeter_t *volmeter, - const struct audio_data *data, int nr_channels) + const struct audio_data *data, + int nr_channels) { size_t nr_samples = data->frames; @@ -502,7 +510,7 @@ } static void volmeter_process_audio_data(obs_volmeter_t *volmeter, - const struct audio_data *data) + const struct audio_data *data) { int nr_channels = get_nr_channels_from_audio_data(data); @@ -511,9 +519,10 @@ } static void volmeter_source_data_received(void *vptr, obs_source_t *source, - const struct audio_data *data, bool muted) + const struct audio_data *data, + bool muted) { - struct obs_volmeter *volmeter = (struct obs_volmeter *) vptr; + struct obs_volmeter *volmeter = (struct obs_volmeter *)vptr; float mul; float magnitude[MAX_AUDIO_CHANNELS]; float peak[MAX_AUDIO_CHANNELS]; @@ -527,16 +536,14 @@ // And convert to dB. mul = muted ? 0.0f : db_to_mul(volmeter->cur_db); for (int channel_nr = 0; channel_nr < MAX_AUDIO_CHANNELS; - channel_nr++) { - magnitude[channel_nr] = mul_to_db( - volmeter->magnitude[channel_nr] * mul); - peak[channel_nr] = mul_to_db( - volmeter->peak[channel_nr] * mul); + channel_nr++) { + magnitude[channel_nr] = + mul_to_db(volmeter->magnitude[channel_nr] * mul); + peak[channel_nr] = mul_to_db(volmeter->peak[channel_nr] * mul); /* The input-peak is NOT adjusted with volume, so that the user * can check the input-gain. */ - input_peak[channel_nr] = mul_to_db( - volmeter->peak[channel_nr]); + input_peak[channel_nr] = mul_to_db(volmeter->peak[channel_nr]); } pthread_mutex_unlock(&volmeter->mutex); @@ -559,24 +566,24 @@ if (pthread_mutex_init(&fader->callback_mutex, NULL) != 0) goto fail; - switch(type) { + switch (type) { case OBS_FADER_CUBIC: fader->def_to_db = cubic_def_to_db; fader->db_to_def = cubic_db_to_def; - fader->max_db = 0.0f; - fader->min_db = -INFINITY; + fader->max_db = 0.0f; + fader->min_db = -INFINITY; break; case OBS_FADER_IEC: fader->def_to_db = iec_def_to_db; fader->db_to_def = iec_db_to_def; - fader->max_db = 0.0f; - fader->min_db = -INFINITY; + fader->max_db = 0.0f; + fader->min_db = -INFINITY; break; case OBS_FADER_LOG: fader->def_to_db = log_def_to_db; fader->db_to_def = log_db_to_def; - fader->max_db = 0.0f; - fader->min_db = -96.0f; + fader->max_db = 0.0f; + fader->min_db = -96.0f; break; default: goto fail; @@ -610,21 +617,21 @@ pthread_mutex_lock(&fader->mutex); - bool clamped = false; + bool clamped = false; fader->cur_db = db; if (fader->cur_db > fader->max_db) { fader->cur_db = fader->max_db; - clamped = true; + clamped = true; } if (fader->cur_db < fader->min_db) { fader->cur_db = -INFINITY; - clamped = true; + clamped = true; } fader->ignore_next_signal = true; - obs_source_t *src = fader->source; - const float mul = db_to_mul(fader->cur_db); + obs_source_t *src = fader->source; + const float mul = db_to_mul(fader->cur_db); pthread_mutex_unlock(&fader->mutex); @@ -697,10 +704,9 @@ obs_fader_detach_source(fader); sh = obs_source_get_signal_handler(source); - signal_handler_connect(sh, "volume", - fader_source_volume_changed, fader); - signal_handler_connect(sh, "destroy", - fader_source_destroyed, fader); + signal_handler_connect(sh, "volume", fader_source_volume_changed, + fader); + signal_handler_connect(sh, "destroy", fader_source_destroyed, fader); vol = obs_source_get_volume(source); pthread_mutex_lock(&fader->mutex); @@ -730,15 +736,13 @@ return; sh = obs_source_get_signal_handler(source); - signal_handler_disconnect(sh, "volume", - fader_source_volume_changed, fader); - signal_handler_disconnect(sh, "destroy", - fader_source_destroyed, fader); - + signal_handler_disconnect(sh, "volume", fader_source_volume_changed, + fader); + signal_handler_disconnect(sh, "destroy", fader_source_destroyed, fader); } void obs_fader_add_callback(obs_fader_t *fader, obs_fader_changed_t callback, - void *param) + void *param) { struct fader_cb cb = {callback, param}; @@ -751,7 +755,7 @@ } void obs_fader_remove_callback(obs_fader_t *fader, obs_fader_changed_t callback, - void *param) + void *param) { struct fader_cb cb = {callback, param}; @@ -810,12 +814,12 @@ obs_volmeter_detach_source(volmeter); sh = obs_source_get_signal_handler(source); - signal_handler_connect(sh, "volume", - volmeter_source_volume_changed, volmeter); - signal_handler_connect(sh, "destroy", - volmeter_source_destroyed, volmeter); - obs_source_add_audio_capture_callback(source, - volmeter_source_data_received, volmeter); + signal_handler_connect(sh, "volume", volmeter_source_volume_changed, + volmeter); + signal_handler_connect(sh, "destroy", volmeter_source_destroyed, + volmeter); + obs_source_add_audio_capture_callback( + source, volmeter_source_data_received, volmeter); vol = obs_source_get_volume(source); pthread_mutex_lock(&volmeter->mutex); @@ -845,16 +849,16 @@ return; sh = obs_source_get_signal_handler(source); - signal_handler_disconnect(sh, "volume", - volmeter_source_volume_changed, volmeter); - signal_handler_disconnect(sh, "destroy", - volmeter_source_destroyed, volmeter); - obs_source_remove_audio_capture_callback(source, - volmeter_source_data_received, volmeter); + signal_handler_disconnect(sh, "volume", volmeter_source_volume_changed, + volmeter); + signal_handler_disconnect(sh, "destroy", volmeter_source_destroyed, + volmeter); + obs_source_remove_audio_capture_callback( + source, volmeter_source_data_received, volmeter); } void obs_volmeter_set_peak_meter_type(obs_volmeter_t *volmeter, - enum obs_peak_meter_type peak_meter_type) + enum obs_peak_meter_type peak_meter_type) { pthread_mutex_lock(&volmeter->mutex); volmeter->peak_meter_type = peak_meter_type; @@ -862,7 +866,7 @@ } void obs_volmeter_set_update_interval(obs_volmeter_t *volmeter, - const unsigned int ms) + const unsigned int ms) { if (!volmeter || !ms) return; @@ -907,7 +911,7 @@ } void obs_volmeter_add_callback(obs_volmeter_t *volmeter, - obs_volmeter_updated_t callback, void *param) + obs_volmeter_updated_t callback, void *param) { struct meter_cb cb = {callback, param}; @@ -920,7 +924,7 @@ } void obs_volmeter_remove_callback(obs_volmeter_t *volmeter, - obs_volmeter_updated_t callback, void *param) + obs_volmeter_updated_t callback, void *param) { struct meter_cb cb = {callback, param};
View file
obs-studio-23.2.1.tar.xz/libobs/obs-audio-controls.h -> obs-studio-24.0.0.tar.xz/libobs/obs-audio-controls.h
Changed
@@ -178,9 +178,10 @@ typedef void (*obs_fader_changed_t)(void *param, float db); EXPORT void obs_fader_add_callback(obs_fader_t *fader, - obs_fader_changed_t callback, void *param); + obs_fader_changed_t callback, void *param); EXPORT void obs_fader_remove_callback(obs_fader_t *fader, - obs_fader_changed_t callback, void *param); + obs_fader_changed_t callback, + void *param); /** * @brief Create a volume meter @@ -213,7 +214,7 @@ * signal. */ EXPORT bool obs_volmeter_attach_source(obs_volmeter_t *volmeter, - obs_source_t *source); + obs_source_t *source); /** * @brief Detach the volume meter from the currently attached source @@ -226,8 +227,9 @@ * @param volmeter pointer to the volume meter object * @param peak_meter_type set if true-peak needs to be measured. */ -EXPORT void obs_volmeter_set_peak_meter_type(obs_volmeter_t *volmeter, - enum obs_peak_meter_type peak_meter_type); +EXPORT void +obs_volmeter_set_peak_meter_type(obs_volmeter_t *volmeter, + enum obs_peak_meter_type peak_meter_type); /** * @brief Set the update interval for the volume meter @@ -248,7 +250,7 @@ * circumstances. */ EXPORT void obs_volmeter_set_update_interval(obs_volmeter_t *volmeter, - const unsigned int ms); + const unsigned int ms); /** * @brief Get the update interval currently used for the volume meter @@ -263,15 +265,17 @@ */ EXPORT int obs_volmeter_get_nr_channels(obs_volmeter_t *volmeter); -typedef void (*obs_volmeter_updated_t)(void *param, - const float magnitude[MAX_AUDIO_CHANNELS], - const float peak[MAX_AUDIO_CHANNELS], - const float input_peak[MAX_AUDIO_CHANNELS]); +typedef void (*obs_volmeter_updated_t)( + void *param, const float magnitude[MAX_AUDIO_CHANNELS], + const float peak[MAX_AUDIO_CHANNELS], + const float input_peak[MAX_AUDIO_CHANNELS]); EXPORT void obs_volmeter_add_callback(obs_volmeter_t *volmeter, - obs_volmeter_updated_t callback, void *param); + obs_volmeter_updated_t callback, + void *param); EXPORT void obs_volmeter_remove_callback(obs_volmeter_t *volmeter, - obs_volmeter_updated_t callback, void *param); + obs_volmeter_updated_t callback, + void *param); EXPORT float obs_mul_to_db(float mul); EXPORT float obs_db_to_mul(float db);
View file
obs-studio-23.2.1.tar.xz/libobs/obs-audio.c -> obs-studio-24.0.0.tar.xz/libobs/obs-audio.c
Changed
@@ -32,7 +32,8 @@ if (da_find(audio->render_order, &source, 0) == DARRAY_INVALID) { obs_source_t *s = obs_source_get_ref(source); - if (s) da_push_back(audio->render_order, &s); + if (s) + da_push_back(audio->render_order, &s); } UNUSED_PARAMETER(parent); @@ -44,8 +45,8 @@ } static inline void mix_audio(struct audio_output_data *mixes, - obs_source_t *source, size_t channels, size_t sample_rate, - struct ts_info *ts) + obs_source_t *source, size_t channels, + size_t sample_rate, struct ts_info *ts) { size_t total_floats = AUDIO_OUTPUT_FRAMES; size_t start_point = 0; @@ -54,8 +55,8 @@ return; if (source->audio_ts != ts->start) { - start_point = convert_time_to_frames(sample_rate, - source->audio_ts - ts->start); + start_point = convert_time_to_frames( + sample_rate, source->audio_ts - ts->start); if (start_point == AUDIO_OUTPUT_FRAMES) return; @@ -79,18 +80,18 @@ } static void ignore_audio(obs_source_t *source, size_t channels, - size_t sample_rate) + size_t sample_rate) { size_t num_floats = source->audio_input_buf[0].size / sizeof(float); if (num_floats) { for (size_t ch = 0; ch < channels; ch++) circlebuf_pop_front(&source->audio_input_buf[ch], NULL, - source->audio_input_buf[ch].size); + source->audio_input_buf[ch].size); source->last_audio_input_buf_size = 0; source->audio_ts += (uint64_t)num_floats * 1000000000ULL / - (uint64_t)sample_rate; + (uint64_t)sample_rate; } } @@ -112,14 +113,14 @@ source->pending_stop = true; #if DEBUG_AUDIO == 1 blog(LOG_DEBUG, "doing pending stop trick: '%s'", - source->context.name); + source->context.name); #endif return true; } for (size_t ch = 0; ch < channels; ch++) circlebuf_pop_front(&source->audio_input_buf[ch], NULL, - source->audio_input_buf[ch].size); + source->audio_input_buf[ch].size); source->pending_stop = false; source->audio_ts = 0; @@ -138,8 +139,8 @@ #define MAX_AUDIO_SIZE (AUDIO_OUTPUT_FRAMES * sizeof(float)) static inline void discard_audio(struct obs_core_audio *audio, - obs_source_t *source, size_t channels, size_t sample_rate, - struct ts_info *ts) + obs_source_t *source, size_t channels, + size_t sample_rate, struct ts_info *ts) { size_t total_floats = AUDIO_OUTPUT_FRAMES; size_t size; @@ -155,10 +156,11 @@ if (ts->end <= source->audio_ts) { #if DEBUG_AUDIO == 1 - blog(LOG_DEBUG, "can't discard, source " - "timestamp (%"PRIu64") >= " - "end timestamp (%"PRIu64")", - source->audio_ts, ts->end); + blog(LOG_DEBUG, + "can't discard, source " + "timestamp (%" PRIu64 ") >= " + "end timestamp (%" PRIu64 ")", + source->audio_ts, ts->end); #endif return; } @@ -171,10 +173,11 @@ #if DEBUG_AUDIO == 1 if (is_audio_source) { - blog(LOG_DEBUG, "can't discard, source " - "timestamp (%"PRIu64") < " - "start timestamp (%"PRIu64")", - source->audio_ts, ts->start); + blog(LOG_DEBUG, + "can't discard, source " + "timestamp (%" PRIu64 ") < " + "start timestamp (%" PRIu64 ")", + source->audio_ts, ts->start); } #endif if (audio->total_buffering_ticks == MAX_BUFFERING_TICKS) @@ -184,8 +187,8 @@ if (source->audio_ts != ts->start && source->audio_ts != (ts->start - 1)) { - size_t start_point = convert_time_to_frames(sample_rate, - source->audio_ts - ts->start); + size_t start_point = convert_time_to_frames( + sample_rate, source->audio_ts - ts->start); if (start_point == AUDIO_OUTPUT_FRAMES) { #if DEBUG_AUDIO == 1 if (is_audio_source) @@ -208,6 +211,7 @@ if (is_audio_source) blog(LOG_DEBUG, "can't discard, data still pending"); #endif + source->audio_ts = ts->end; return; } @@ -218,8 +222,7 @@ #if DEBUG_AUDIO == 1 if (is_audio_source) - blog(LOG_DEBUG, "audio discarded, new ts: %"PRIu64, - ts->end); + blog(LOG_DEBUG, "audio discarded, new ts: %" PRIu64, ts->end); #endif source->pending_stop = false; @@ -227,8 +230,8 @@ } static void add_audio_buffering(struct obs_core_audio *audio, - size_t sample_rate, struct ts_info *ts, uint64_t min_ts, - const char *buffering_name) + size_t sample_rate, struct ts_info *ts, + uint64_t min_ts, const char *buffering_name) { struct ts_info new_ts; uint64_t offset; @@ -257,44 +260,50 @@ ms = ticks * AUDIO_OUTPUT_FRAMES * 1000 / sample_rate; total_ms = audio->total_buffering_ticks * AUDIO_OUTPUT_FRAMES * 1000 / - sample_rate; + sample_rate; - blog(LOG_INFO, "adding %d milliseconds of audio buffering, total " - "audio buffering is now %d milliseconds" - " (source: %s)\n", - (int)ms, (int)total_ms, buffering_name); + blog(LOG_INFO, + "adding %d milliseconds of audio buffering, total " + "audio buffering is now %d milliseconds" + " (source: %s)\n", + (int)ms, (int)total_ms, buffering_name); #if DEBUG_AUDIO == 1 - blog(LOG_DEBUG, "min_ts (%"PRIu64") < start timestamp " - "(%"PRIu64")", min_ts, ts->start); - blog(LOG_DEBUG, "old buffered ts: %"PRIu64"-%"PRIu64, - ts->start, ts->end); + blog(LOG_DEBUG, + "min_ts (%" PRIu64 ") < start timestamp " + "(%" PRIu64 ")", + min_ts, ts->start); + blog(LOG_DEBUG, "old buffered ts: %" PRIu64 "-%" PRIu64, ts->start, + ts->end); #endif - new_ts.start = audio->buffered_ts - audio_frames_to_ns(sample_rate, - audio->buffering_wait_ticks * AUDIO_OUTPUT_FRAMES); + new_ts.start = + audio->buffered_ts - + audio_frames_to_ns(sample_rate, audio->buffering_wait_ticks * + AUDIO_OUTPUT_FRAMES); while (ticks--) { int cur_ticks = ++audio->buffering_wait_ticks; new_ts.end = new_ts.start; - new_ts.start = audio->buffered_ts - audio_frames_to_ns( - sample_rate, - cur_ticks * AUDIO_OUTPUT_FRAMES); + new_ts.start = + audio->buffered_ts - + audio_frames_to_ns(sample_rate, + cur_ticks * AUDIO_OUTPUT_FRAMES); #if DEBUG_AUDIO == 1 - blog(LOG_DEBUG, "add buffered ts: %"PRIu64"-%"PRIu64, - new_ts.start, new_ts.end); + blog(LOG_DEBUG, "add buffered ts: %" PRIu64 "-%" PRIu64, + new_ts.start, new_ts.end); #endif circlebuf_push_front(&audio->buffered_timestamps, &new_ts, - sizeof(new_ts)); + sizeof(new_ts)); } *ts = new_ts; } static bool audio_buffer_insuffient(struct obs_source *source, - size_t sample_rate, uint64_t min_ts) + size_t sample_rate, uint64_t min_ts) { size_t total_floats = AUDIO_OUTPUT_FRAMES; size_t size; @@ -304,10 +313,9 @@ return false; } - if (source->audio_ts != min_ts && - source->audio_ts != (min_ts - 1)) { - size_t start_point = convert_time_to_frames(sample_rate, - source->audio_ts - min_ts); + if (source->audio_ts != min_ts && source->audio_ts != (min_ts - 1)) { + size_t start_point = convert_time_to_frames( + sample_rate, source->audio_ts - min_ts); if (start_point >= AUDIO_OUTPUT_FRAMES) return false; @@ -325,39 +333,39 @@ } static inline const char *find_min_ts(struct obs_core_data *data, - uint64_t *min_ts) + uint64_t *min_ts) { obs_source_t *buffering_source = NULL; struct obs_source *source = data->first_audio_source; while (source) { if (!source->audio_pending && source->audio_ts && - source->audio_ts < *min_ts) { + source->audio_ts < *min_ts) { *min_ts = source->audio_ts; buffering_source = source; } - source = (struct obs_source*)source->next_audio_source; + source = (struct obs_source *)source->next_audio_source; } return buffering_source ? obs_source_get_name(buffering_source) : NULL; } static inline bool mark_invalid_sources(struct obs_core_data *data, - size_t sample_rate, uint64_t min_ts) + size_t sample_rate, uint64_t min_ts) { bool recalculate = false; struct obs_source *source = data->first_audio_source; while (source) { - recalculate |= audio_buffer_insuffient(source, sample_rate, - min_ts); - source = (struct obs_source*)source->next_audio_source; + recalculate |= + audio_buffer_insuffient(source, sample_rate, min_ts); + source = (struct obs_source *)source->next_audio_source; } return recalculate; } static inline const char *calc_min_ts(struct obs_core_data *data, - size_t sample_rate, uint64_t *min_ts) + size_t sample_rate, uint64_t *min_ts) { const char *buffering_name = find_min_ts(data, min_ts); if (mark_invalid_sources(data, sample_rate, *min_ts)) @@ -371,9 +379,9 @@ obs_source_release(audio->render_order.array[i]); } -bool audio_callback(void *param, - uint64_t start_ts_in, uint64_t end_ts_in, uint64_t *out_ts, - uint32_t mixers, struct audio_output_data *mixes) +bool audio_callback(void *param, uint64_t start_ts_in, uint64_t end_ts_in, + uint64_t *out_ts, uint32_t mixers, + struct audio_output_data *mixes) { struct obs_core_data *data = &obs->data; struct obs_core_audio *audio = &obs->audio; @@ -404,7 +412,7 @@ obs_source_t *source = obs_get_output_source(i); if (source) { obs_source_enum_active_tree(source, push_audio_tree, - audio); + audio); push_audio_tree(NULL, source, audio); da_push_back(audio->root_nodes, &source); obs_source_release(source); @@ -416,7 +424,7 @@ source = data->first_audio_source; while (source) { push_audio_tree(NULL, source, audio); - source = (struct obs_source*)source->next_audio_source; + source = (struct obs_source *)source->next_audio_source; } pthread_mutex_unlock(&data->audio_sources_mutex); @@ -426,7 +434,7 @@ for (size_t i = 0; i < audio->render_order.num; i++) { obs_source_t *source = audio->render_order.array[i]; obs_source_audio_render(source, mixers, channels, sample_rate, - audio_size); + audio_size); } /* ------------------------------------------------ */ @@ -439,7 +447,7 @@ /* if a source has gone backward in time, buffer */ if (min_ts < ts.start) add_audio_buffering(audio, sample_rate, &ts, min_ts, - buffering_name); + buffering_name); /* ------------------------------------------------ */ /* mix audio */ @@ -454,7 +462,7 @@ if (source->audio_output_buf[0][0] && source->audio_ts) mix_audio(mixes, source, channels, sample_rate, - &ts); + &ts); pthread_mutex_unlock(&source->audio_buf_mutex); } @@ -470,7 +478,7 @@ discard_audio(audio, source, channels, sample_rate, &ts); pthread_mutex_unlock(&source->audio_buf_mutex); - source = (struct obs_source*)source->next_audio_source; + source = (struct obs_source *)source->next_audio_source; } pthread_mutex_unlock(&data->audio_sources_mutex);
View file
obs-studio-23.2.1.tar.xz/libobs/obs-avc.c -> obs-studio-24.0.0.tar.xz/libobs/obs-avc.c
Changed
@@ -27,7 +27,8 @@ nal_start = obs_avc_find_startcode(data, end); while (true) { - while (nal_start < end && !*(nal_start++)); + while (nal_start < end && !*(nal_start++)) + ; if (nal_start == end) break; @@ -48,7 +49,7 @@ * scenarios that I was unaware of, so instead of just searching for {0, 0, 1} * we'll just use the code from FFmpeg - http://www.ffmpeg.org/ */ static const uint8_t *ff_avc_find_startcode_internal(const uint8_t *p, - const uint8_t *end) + const uint8_t *end) { const uint8_t *a = p + 4 - ((intptr_t)p & 3); @@ -58,21 +59,21 @@ } for (end -= 3; p < end; p += 4) { - uint32_t x = *(const uint32_t*)p; + uint32_t x = *(const uint32_t *)p; if ((x - 0x01010101) & (~x) & 0x80808080) { if (p[1] == 0) { if (p[0] == 0 && p[2] == 1) return p; if (p[2] == 0 && p[3] == 1) - return p+1; + return p + 1; } if (p[3] == 0) { if (p[2] == 0 && p[4] == 1) - return p+2; + return p + 2; if (p[4] == 0 && p[5] == 1) - return p+3; + return p + 3; } } } @@ -87,8 +88,9 @@ const uint8_t *obs_avc_find_startcode(const uint8_t *p, const uint8_t *end) { - const uint8_t *out= ff_avc_find_startcode_internal(p, end); - if (p < out && out < end && !out[-1]) out--; + const uint8_t *out = ff_avc_find_startcode_internal(p, end); + if (p < out && out < end && !out[-1]) + out--; return out; } @@ -98,15 +100,16 @@ } static void serialize_avc_data(struct serializer *s, const uint8_t *data, - size_t size, bool *is_keyframe, int *priority) + size_t size, bool *is_keyframe, int *priority) { const uint8_t *nal_start, *nal_end; - const uint8_t *end = data+size; + const uint8_t *end = data + size; int type; nal_start = obs_avc_find_startcode(data, end); while (true) { - while (nal_start < end && !*(nal_start++)); + while (nal_start < end && !*(nal_start++)) + ; if (nal_start == end) break; @@ -128,7 +131,7 @@ } void obs_parse_avc_packet(struct encoder_packet *avc_packet, - const struct encoder_packet *src) + const struct encoder_packet *src) { struct array_output_data output; struct serializer s; @@ -139,32 +142,32 @@ serialize(&s, &ref, sizeof(ref)); serialize_avc_data(&s, src->data, src->size, &avc_packet->keyframe, - &avc_packet->priority); + &avc_packet->priority); - avc_packet->data = output.bytes.array + sizeof(ref); - avc_packet->size = output.bytes.num - sizeof(ref); + avc_packet->data = output.bytes.array + sizeof(ref); + avc_packet->size = output.bytes.num - sizeof(ref); avc_packet->drop_priority = get_drop_priority(avc_packet->priority); } static inline bool has_start_code(const uint8_t *data) { if (data[0] != 0 || data[1] != 0) - return false; + return false; return data[2] == 1 || (data[2] == 0 && data[3] == 1); } -static void get_sps_pps(const uint8_t *data, size_t size, - const uint8_t **sps, size_t *sps_size, - const uint8_t **pps, size_t *pps_size) +static void get_sps_pps(const uint8_t *data, size_t size, const uint8_t **sps, + size_t *sps_size, const uint8_t **pps, size_t *pps_size) { const uint8_t *nal_start, *nal_end; - const uint8_t *end = data+size; + const uint8_t *end = data + size; int type; nal_start = obs_avc_find_startcode(data, end); while (true) { - while (nal_start < end && !*(nal_start++)); + while (nal_start < end && !*(nal_start++)) + ; if (nal_start == end) break; @@ -193,7 +196,8 @@ array_output_serializer_init(&s, &output); - if (size <= 6) return 0; + if (size <= 6) + return 0; if (!has_start_code(data)) { *header = bmemdup(data, size); @@ -205,7 +209,7 @@ return 0; s_w8(&s, 0x01); - s_write(&s, sps+1, 3); + s_write(&s, sps + 1, 3); s_w8(&s, 0xff); s_w8(&s, 0xe1); @@ -220,9 +224,9 @@ } void obs_extract_avc_headers(const uint8_t *packet, size_t size, - uint8_t **new_packet_data, size_t *new_packet_size, - uint8_t **header_data, size_t *header_size, - uint8_t **sei_data, size_t *sei_size) + uint8_t **new_packet_data, size_t *new_packet_size, + uint8_t **header_data, size_t *header_size, + uint8_t **sei_data, size_t *sei_size) { DARRAY(uint8_t) new_packet; DARRAY(uint8_t) header; @@ -240,7 +244,8 @@ while (nal_end != end) { nal_codestart = nal_start; - while (nal_start < end && !*(nal_start++)); + while (nal_start < end && !*(nal_start++)) + ; if (nal_start == end) break; @@ -253,14 +258,14 @@ if (type == OBS_NAL_SPS || type == OBS_NAL_PPS) { da_push_back_array(header, nal_codestart, - nal_end - nal_codestart); + nal_end - nal_codestart); } else if (type == OBS_NAL_SEI) { da_push_back_array(sei, nal_codestart, - nal_end - nal_codestart); + nal_end - nal_codestart); } else { da_push_back_array(new_packet, nal_codestart, - nal_end - nal_codestart); + nal_end - nal_codestart); } nal_start = nal_end;
View file
obs-studio-23.2.1.tar.xz/libobs/obs-avc.h -> obs-studio-24.0.0.tar.xz/libobs/obs-avc.h
Changed
@@ -25,40 +25,39 @@ struct encoder_packet; -enum { - OBS_NAL_UNKNOWN = 0, - OBS_NAL_SLICE = 1, - OBS_NAL_SLICE_DPA = 2, - OBS_NAL_SLICE_DPB = 3, - OBS_NAL_SLICE_DPC = 4, - OBS_NAL_SLICE_IDR = 5, - OBS_NAL_SEI = 6, - OBS_NAL_SPS = 7, - OBS_NAL_PPS = 8, - OBS_NAL_AUD = 9, - OBS_NAL_FILLER = 12, +enum { OBS_NAL_UNKNOWN = 0, + OBS_NAL_SLICE = 1, + OBS_NAL_SLICE_DPA = 2, + OBS_NAL_SLICE_DPB = 3, + OBS_NAL_SLICE_DPC = 4, + OBS_NAL_SLICE_IDR = 5, + OBS_NAL_SEI = 6, + OBS_NAL_SPS = 7, + OBS_NAL_PPS = 8, + OBS_NAL_AUD = 9, + OBS_NAL_FILLER = 12, }; -enum { - OBS_NAL_PRIORITY_DISPOSABLE = 0, - OBS_NAL_PRIORITY_LOW = 1, - OBS_NAL_PRIORITY_HIGH = 2, - OBS_NAL_PRIORITY_HIGHEST = 3, +enum { OBS_NAL_PRIORITY_DISPOSABLE = 0, + OBS_NAL_PRIORITY_LOW = 1, + OBS_NAL_PRIORITY_HIGH = 2, + OBS_NAL_PRIORITY_HIGHEST = 3, }; /* Helpers for parsing AVC NAL units. */ EXPORT bool obs_avc_keyframe(const uint8_t *data, size_t size); EXPORT const uint8_t *obs_avc_find_startcode(const uint8_t *p, - const uint8_t *end); + const uint8_t *end); EXPORT void obs_parse_avc_packet(struct encoder_packet *avc_packet, - const struct encoder_packet *src); + const struct encoder_packet *src); EXPORT size_t obs_parse_avc_header(uint8_t **header, const uint8_t *data, - size_t size); + size_t size); EXPORT void obs_extract_avc_headers(const uint8_t *packet, size_t size, - uint8_t **new_packet_data, size_t *new_packet_size, - uint8_t **header_data, size_t *header_size, - uint8_t **sei_data, size_t *sei_size); + uint8_t **new_packet_data, + size_t *new_packet_size, + uint8_t **header_data, size_t *header_size, + uint8_t **sei_data, size_t *sei_size); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-cocoa.c -> obs-studio-24.0.0.tar.xz/libobs/obs-cocoa.c
Changed
@@ -45,7 +45,7 @@ }; static const int module_patterns_size = - sizeof(module_bin)/sizeof(module_bin[0]); + sizeof(module_bin) / sizeof(module_bin[0]); void add_default_module_paths(void) { @@ -63,9 +63,9 @@ static void log_processor_name(void) { - char *name = NULL; + char *name = NULL; size_t size; - int ret; + int ret; ret = sysctlbyname("machdep.cpu.brand_string", NULL, &size, NULL, 0); if (ret != 0) @@ -82,9 +82,9 @@ static void log_processor_speed(void) { - size_t size; + size_t size; long long freq; - int ret; + int ret; size = sizeof(freq); ret = sysctlbyname("hw.cpufrequency", &freq, &size, NULL, 0); @@ -95,30 +95,29 @@ static void log_processor_cores(void) { blog(LOG_INFO, "Physical Cores: %d, Logical Cores: %d", - os_get_physical_cores(), os_get_logical_cores()); + os_get_physical_cores(), os_get_logical_cores()); } static void log_available_memory(void) { - size_t size; + size_t size; long long memory_available; - int ret; + int ret; size = sizeof(memory_available); ret = sysctlbyname("hw.memsize", &memory_available, &size, NULL, 0); if (ret == 0) blog(LOG_INFO, "Physical Memory: %lldMB Total", - memory_available / 1024 / 1024); + memory_available / 1024 / 1024); } static void log_os_name(id pi, SEL UTF8String) { - unsigned long os_id = (unsigned long)objc_msgSend(pi, - sel_registerName("operatingSystem")); + unsigned long os_id = (unsigned long)objc_msgSend( + pi, sel_registerName("operatingSystem")); - id os = objc_msgSend(pi, - sel_registerName("operatingSystemName")); - const char *name = (const char*)objc_msgSend(os, UTF8String); + id os = objc_msgSend(pi, sel_registerName("operatingSystemName")); + const char *name = (const char *)objc_msgSend(os, UTF8String); if (os_id == 5 /*NSMACHOperatingSystem*/) { blog(LOG_INFO, "OS Name: Mac OS X (%s)", name); @@ -131,8 +130,8 @@ static void log_os_version(id pi, SEL UTF8String) { id vs = objc_msgSend(pi, - sel_registerName("operatingSystemVersionString")); - const char *version = (const char*)objc_msgSend(vs, UTF8String); + sel_registerName("operatingSystemVersionString")); + const char *version = (const char *)objc_msgSend(vs, UTF8String); blog(LOG_INFO, "OS Version: %s", version ? version : "Unknown"); } @@ -140,8 +139,8 @@ static void log_os(void) { Class NSProcessInfo = objc_getClass("NSProcessInfo"); - id pi = objc_msgSend((id)NSProcessInfo, - sel_registerName("processInfo")); + id pi = objc_msgSend((id)NSProcessInfo, + sel_registerName("processInfo")); SEL UTF8String = sel_registerName("UTF8String"); @@ -151,12 +150,11 @@ static void log_kernel_version(void) { - char kernel_version[1024]; + char kernel_version[1024]; size_t size = sizeof(kernel_version); - int ret; + int ret; - ret = sysctlbyname("kern.osrelease", kernel_version, &size, - NULL, 0); + ret = sysctlbyname("kern.osrelease", kernel_version, &size, NULL, 0); if (ret == 0) blog(LOG_INFO, "Kernel Version: %s", kernel_version); } @@ -171,12 +169,11 @@ log_kernel_version(); } - static bool dstr_from_cfstring(struct dstr *str, CFStringRef ref) { - CFIndex length = CFStringGetLength(ref); - CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, - kCFStringEncodingUTF8); + CFIndex length = CFStringGetLength(ref); + CFIndex max_size = CFStringGetMaximumSizeForEncoding( + length, kCFStringEncodingUTF8); dstr_reserve(str, max_size); if (!CFStringGetCString(ref, str->array, max_size, @@ -188,11 +185,11 @@ } struct obs_hotkeys_platform { - volatile long refs; - TISInputSourceRef tis; - CFDataRef layout_data; - UCKeyboardLayout *layout; - IOHIDManagerRef manager; + volatile long refs; + TISInputSourceRef tis; + CFDataRef layout_data; + UCKeyboardLayout *layout; + IOHIDManagerRef manager; DARRAY(IOHIDElementRef) keys[OBS_KEY_LAST_VALUE]; }; @@ -213,194 +210,303 @@ int obs_key_to_virtual_key(obs_key_t code) { switch (code) { - case OBS_KEY_A: return kVK_ANSI_A; - case OBS_KEY_B: return kVK_ANSI_B; - case OBS_KEY_C: return kVK_ANSI_C; - case OBS_KEY_D: return kVK_ANSI_D; - case OBS_KEY_E: return kVK_ANSI_E; - case OBS_KEY_F: return kVK_ANSI_F; - case OBS_KEY_G: return kVK_ANSI_G; - case OBS_KEY_H: return kVK_ANSI_H; - case OBS_KEY_I: return kVK_ANSI_I; - case OBS_KEY_J: return kVK_ANSI_J; - case OBS_KEY_K: return kVK_ANSI_K; - case OBS_KEY_L: return kVK_ANSI_L; - case OBS_KEY_M: return kVK_ANSI_M; - case OBS_KEY_N: return kVK_ANSI_N; - case OBS_KEY_O: return kVK_ANSI_O; - case OBS_KEY_P: return kVK_ANSI_P; - case OBS_KEY_Q: return kVK_ANSI_Q; - case OBS_KEY_R: return kVK_ANSI_R; - case OBS_KEY_S: return kVK_ANSI_S; - case OBS_KEY_T: return kVK_ANSI_T; - case OBS_KEY_U: return kVK_ANSI_U; - case OBS_KEY_V: return kVK_ANSI_V; - case OBS_KEY_W: return kVK_ANSI_W; - case OBS_KEY_X: return kVK_ANSI_X; - case OBS_KEY_Y: return kVK_ANSI_Y; - case OBS_KEY_Z: return kVK_ANSI_Z; - - case OBS_KEY_1: return kVK_ANSI_1; - case OBS_KEY_2: return kVK_ANSI_2; - case OBS_KEY_3: return kVK_ANSI_3; - case OBS_KEY_4: return kVK_ANSI_4; - case OBS_KEY_5: return kVK_ANSI_5; - case OBS_KEY_6: return kVK_ANSI_6; - case OBS_KEY_7: return kVK_ANSI_7; - case OBS_KEY_8: return kVK_ANSI_8; - case OBS_KEY_9: return kVK_ANSI_9; - case OBS_KEY_0: return kVK_ANSI_0; - - case OBS_KEY_RETURN: return kVK_Return; - case OBS_KEY_ESCAPE: return kVK_Escape; - case OBS_KEY_BACKSPACE: return kVK_Delete; - case OBS_KEY_TAB: return kVK_Tab; - case OBS_KEY_SPACE: return kVK_Space; - case OBS_KEY_MINUS: return kVK_ANSI_Minus; - case OBS_KEY_EQUAL: return kVK_ANSI_Equal; - case OBS_KEY_BRACKETLEFT: return kVK_ANSI_LeftBracket; - case OBS_KEY_BRACKETRIGHT: return kVK_ANSI_RightBracket; - case OBS_KEY_BACKSLASH: return kVK_ANSI_Backslash; - case OBS_KEY_SEMICOLON: return kVK_ANSI_Semicolon; - case OBS_KEY_QUOTE: return kVK_ANSI_Quote; - case OBS_KEY_DEAD_GRAVE: return kVK_ANSI_Grave; - case OBS_KEY_COMMA: return kVK_ANSI_Comma; - case OBS_KEY_PERIOD: return kVK_ANSI_Period; - case OBS_KEY_SLASH: return kVK_ANSI_Slash; - case OBS_KEY_CAPSLOCK: return kVK_CapsLock; - case OBS_KEY_SECTION: return kVK_ISO_Section; - - case OBS_KEY_F1: return kVK_F1; - case OBS_KEY_F2: return kVK_F2; - case OBS_KEY_F3: return kVK_F3; - case OBS_KEY_F4: return kVK_F4; - case OBS_KEY_F5: return kVK_F5; - case OBS_KEY_F6: return kVK_F6; - case OBS_KEY_F7: return kVK_F7; - case OBS_KEY_F8: return kVK_F8; - case OBS_KEY_F9: return kVK_F9; - case OBS_KEY_F10: return kVK_F10; - case OBS_KEY_F11: return kVK_F11; - case OBS_KEY_F12: return kVK_F12; - - case OBS_KEY_HELP: return kVK_Help; - case OBS_KEY_HOME: return kVK_Home; - case OBS_KEY_PAGEUP: return kVK_PageUp; - case OBS_KEY_DELETE: return kVK_ForwardDelete; - case OBS_KEY_END: return kVK_End; - case OBS_KEY_PAGEDOWN: return kVK_PageDown; - - case OBS_KEY_RIGHT: return kVK_RightArrow; - case OBS_KEY_LEFT: return kVK_LeftArrow; - case OBS_KEY_DOWN: return kVK_DownArrow; - case OBS_KEY_UP: return kVK_UpArrow; - - case OBS_KEY_CLEAR: return kVK_ANSI_KeypadClear; - case OBS_KEY_NUMSLASH: return kVK_ANSI_KeypadDivide; - case OBS_KEY_NUMASTERISK: return kVK_ANSI_KeypadMultiply; - case OBS_KEY_NUMMINUS: return kVK_ANSI_KeypadMinus; - case OBS_KEY_NUMPLUS: return kVK_ANSI_KeypadPlus; - case OBS_KEY_ENTER: return kVK_ANSI_KeypadEnter; - - case OBS_KEY_NUM1: return kVK_ANSI_Keypad1; - case OBS_KEY_NUM2: return kVK_ANSI_Keypad2; - case OBS_KEY_NUM3: return kVK_ANSI_Keypad3; - case OBS_KEY_NUM4: return kVK_ANSI_Keypad4; - case OBS_KEY_NUM5: return kVK_ANSI_Keypad5; - case OBS_KEY_NUM6: return kVK_ANSI_Keypad6; - case OBS_KEY_NUM7: return kVK_ANSI_Keypad7; - case OBS_KEY_NUM8: return kVK_ANSI_Keypad8; - case OBS_KEY_NUM9: return kVK_ANSI_Keypad9; - case OBS_KEY_NUM0: return kVK_ANSI_Keypad0; - - case OBS_KEY_NUMPERIOD: return kVK_ANSI_KeypadDecimal; - case OBS_KEY_NUMEQUAL: return kVK_ANSI_KeypadEquals; - - case OBS_KEY_F13: return kVK_F13; - case OBS_KEY_F14: return kVK_F14; - case OBS_KEY_F15: return kVK_F15; - case OBS_KEY_F16: return kVK_F16; - case OBS_KEY_F17: return kVK_F17; - case OBS_KEY_F18: return kVK_F18; - case OBS_KEY_F19: return kVK_F19; - case OBS_KEY_F20: return kVK_F20; - - case OBS_KEY_CONTROL: return kVK_Control; - case OBS_KEY_SHIFT: return kVK_Shift; - case OBS_KEY_ALT: return kVK_Option; - case OBS_KEY_META: return kVK_Command; - //case OBS_KEY_CONTROL: return kVK_RightControl; - //case OBS_KEY_SHIFT: return kVK_RightShift; - //case OBS_KEY_ALT: return kVK_RightOption; - //case OBS_KEY_META: return 0x36; + case OBS_KEY_A: + return kVK_ANSI_A; + case OBS_KEY_B: + return kVK_ANSI_B; + case OBS_KEY_C: + return kVK_ANSI_C; + case OBS_KEY_D: + return kVK_ANSI_D; + case OBS_KEY_E: + return kVK_ANSI_E; + case OBS_KEY_F: + return kVK_ANSI_F; + case OBS_KEY_G: + return kVK_ANSI_G; + case OBS_KEY_H: + return kVK_ANSI_H; + case OBS_KEY_I: + return kVK_ANSI_I; + case OBS_KEY_J: + return kVK_ANSI_J; + case OBS_KEY_K: + return kVK_ANSI_K; + case OBS_KEY_L: + return kVK_ANSI_L; + case OBS_KEY_M: + return kVK_ANSI_M; + case OBS_KEY_N: + return kVK_ANSI_N; + case OBS_KEY_O: + return kVK_ANSI_O; + case OBS_KEY_P: + return kVK_ANSI_P; + case OBS_KEY_Q: + return kVK_ANSI_Q; + case OBS_KEY_R: + return kVK_ANSI_R; + case OBS_KEY_S: + return kVK_ANSI_S; + case OBS_KEY_T: + return kVK_ANSI_T; + case OBS_KEY_U: + return kVK_ANSI_U; + case OBS_KEY_V: + return kVK_ANSI_V; + case OBS_KEY_W: + return kVK_ANSI_W; + case OBS_KEY_X: + return kVK_ANSI_X; + case OBS_KEY_Y: + return kVK_ANSI_Y; + case OBS_KEY_Z: + return kVK_ANSI_Z; + + case OBS_KEY_1: + return kVK_ANSI_1; + case OBS_KEY_2: + return kVK_ANSI_2; + case OBS_KEY_3: + return kVK_ANSI_3; + case OBS_KEY_4: + return kVK_ANSI_4; + case OBS_KEY_5: + return kVK_ANSI_5; + case OBS_KEY_6: + return kVK_ANSI_6; + case OBS_KEY_7: + return kVK_ANSI_7; + case OBS_KEY_8: + return kVK_ANSI_8; + case OBS_KEY_9: + return kVK_ANSI_9; + case OBS_KEY_0: + return kVK_ANSI_0; + + case OBS_KEY_RETURN: + return kVK_Return; + case OBS_KEY_ESCAPE: + return kVK_Escape; + case OBS_KEY_BACKSPACE: + return kVK_Delete; + case OBS_KEY_TAB: + return kVK_Tab; + case OBS_KEY_SPACE: + return kVK_Space; + case OBS_KEY_MINUS: + return kVK_ANSI_Minus; + case OBS_KEY_EQUAL: + return kVK_ANSI_Equal; + case OBS_KEY_BRACKETLEFT: + return kVK_ANSI_LeftBracket; + case OBS_KEY_BRACKETRIGHT: + return kVK_ANSI_RightBracket; + case OBS_KEY_BACKSLASH: + return kVK_ANSI_Backslash; + case OBS_KEY_SEMICOLON: + return kVK_ANSI_Semicolon; + case OBS_KEY_QUOTE: + return kVK_ANSI_Quote; + case OBS_KEY_DEAD_GRAVE: + return kVK_ANSI_Grave; + case OBS_KEY_COMMA: + return kVK_ANSI_Comma; + case OBS_KEY_PERIOD: + return kVK_ANSI_Period; + case OBS_KEY_SLASH: + return kVK_ANSI_Slash; + case OBS_KEY_CAPSLOCK: + return kVK_CapsLock; + case OBS_KEY_SECTION: + return kVK_ISO_Section; + + case OBS_KEY_F1: + return kVK_F1; + case OBS_KEY_F2: + return kVK_F2; + case OBS_KEY_F3: + return kVK_F3; + case OBS_KEY_F4: + return kVK_F4; + case OBS_KEY_F5: + return kVK_F5; + case OBS_KEY_F6: + return kVK_F6; + case OBS_KEY_F7: + return kVK_F7; + case OBS_KEY_F8: + return kVK_F8; + case OBS_KEY_F9: + return kVK_F9; + case OBS_KEY_F10: + return kVK_F10; + case OBS_KEY_F11: + return kVK_F11; + case OBS_KEY_F12: + return kVK_F12; + + case OBS_KEY_HELP: + return kVK_Help; + case OBS_KEY_HOME: + return kVK_Home; + case OBS_KEY_PAGEUP: + return kVK_PageUp; + case OBS_KEY_DELETE: + return kVK_ForwardDelete; + case OBS_KEY_END: + return kVK_End; + case OBS_KEY_PAGEDOWN: + return kVK_PageDown; + + case OBS_KEY_RIGHT: + return kVK_RightArrow; + case OBS_KEY_LEFT: + return kVK_LeftArrow; + case OBS_KEY_DOWN: + return kVK_DownArrow; + case OBS_KEY_UP: + return kVK_UpArrow; + + case OBS_KEY_CLEAR: + return kVK_ANSI_KeypadClear; + case OBS_KEY_NUMSLASH: + return kVK_ANSI_KeypadDivide; + case OBS_KEY_NUMASTERISK: + return kVK_ANSI_KeypadMultiply; + case OBS_KEY_NUMMINUS: + return kVK_ANSI_KeypadMinus; + case OBS_KEY_NUMPLUS: + return kVK_ANSI_KeypadPlus; + case OBS_KEY_ENTER: + return kVK_ANSI_KeypadEnter; + + case OBS_KEY_NUM1: + return kVK_ANSI_Keypad1; + case OBS_KEY_NUM2: + return kVK_ANSI_Keypad2; + case OBS_KEY_NUM3: + return kVK_ANSI_Keypad3; + case OBS_KEY_NUM4: + return kVK_ANSI_Keypad4; + case OBS_KEY_NUM5: + return kVK_ANSI_Keypad5; + case OBS_KEY_NUM6: + return kVK_ANSI_Keypad6; + case OBS_KEY_NUM7: + return kVK_ANSI_Keypad7; + case OBS_KEY_NUM8: + return kVK_ANSI_Keypad8; + case OBS_KEY_NUM9: + return kVK_ANSI_Keypad9; + case OBS_KEY_NUM0: + return kVK_ANSI_Keypad0; + + case OBS_KEY_NUMPERIOD: + return kVK_ANSI_KeypadDecimal; + case OBS_KEY_NUMEQUAL: + return kVK_ANSI_KeypadEquals; + + case OBS_KEY_F13: + return kVK_F13; + case OBS_KEY_F14: + return kVK_F14; + case OBS_KEY_F15: + return kVK_F15; + case OBS_KEY_F16: + return kVK_F16; + case OBS_KEY_F17: + return kVK_F17; + case OBS_KEY_F18: + return kVK_F18; + case OBS_KEY_F19: + return kVK_F19; + case OBS_KEY_F20: + return kVK_F20; + + case OBS_KEY_CONTROL: + return kVK_Control; + case OBS_KEY_SHIFT: + return kVK_Shift; + case OBS_KEY_ALT: + return kVK_Option; + case OBS_KEY_META: + return kVK_Command; + //case OBS_KEY_CONTROL: return kVK_RightControl; + //case OBS_KEY_SHIFT: return kVK_RightShift; + //case OBS_KEY_ALT: return kVK_RightOption; + //case OBS_KEY_META: return 0x36; case OBS_KEY_NONE: case OBS_KEY_LAST_VALUE: default: - break; + break; } return INVALID_KEY; } static bool localized_key_to_str(obs_key_t key, struct dstr *str) { -#define MAP_KEY(k, s) case k: \ +#define MAP_KEY(k, s) \ + case k: \ dstr_copy(str, obs_get_hotkey_translation(k, s)); \ return true -#define MAP_BUTTON(i) case OBS_KEY_MOUSE ## i: \ +#define MAP_BUTTON(i) \ + case OBS_KEY_MOUSE##i: \ dstr_copy(str, obs_get_hotkey_translation(key, "Mouse " #i)); \ return true switch (key) { - MAP_KEY(OBS_KEY_SPACE, "Space"); - MAP_KEY(OBS_KEY_NUMEQUAL, "= (Keypad)"); - MAP_KEY(OBS_KEY_NUMASTERISK, "* (Keypad)"); - MAP_KEY(OBS_KEY_NUMPLUS, "+ (Keypad)"); - MAP_KEY(OBS_KEY_NUMMINUS, "- (Keypad)"); - MAP_KEY(OBS_KEY_NUMPERIOD, ". (Keypad)"); - MAP_KEY(OBS_KEY_NUMSLASH, "/ (Keypad)"); - MAP_KEY(OBS_KEY_NUM0, "0 (Keypad)"); - MAP_KEY(OBS_KEY_NUM1, "1 (Keypad)"); - MAP_KEY(OBS_KEY_NUM2, "2 (Keypad)"); - MAP_KEY(OBS_KEY_NUM3, "3 (Keypad)"); - MAP_KEY(OBS_KEY_NUM4, "4 (Keypad)"); - MAP_KEY(OBS_KEY_NUM5, "5 (Keypad)"); - MAP_KEY(OBS_KEY_NUM6, "6 (Keypad)"); - MAP_KEY(OBS_KEY_NUM7, "7 (Keypad)"); - MAP_KEY(OBS_KEY_NUM8, "8 (Keypad)"); - MAP_KEY(OBS_KEY_NUM9, "9 (Keypad)"); - - MAP_BUTTON(1); - MAP_BUTTON(2); - MAP_BUTTON(3); - MAP_BUTTON(4); - MAP_BUTTON(5); - MAP_BUTTON(6); - MAP_BUTTON(7); - MAP_BUTTON(8); - MAP_BUTTON(9); - MAP_BUTTON(10); - MAP_BUTTON(11); - MAP_BUTTON(12); - MAP_BUTTON(13); - MAP_BUTTON(14); - MAP_BUTTON(15); - MAP_BUTTON(16); - MAP_BUTTON(17); - MAP_BUTTON(18); - MAP_BUTTON(19); - MAP_BUTTON(20); - MAP_BUTTON(21); - MAP_BUTTON(22); - MAP_BUTTON(23); - MAP_BUTTON(24); - MAP_BUTTON(25); - MAP_BUTTON(26); - MAP_BUTTON(27); - MAP_BUTTON(28); - MAP_BUTTON(29); - default: break; + MAP_KEY(OBS_KEY_SPACE, "Space"); + MAP_KEY(OBS_KEY_NUMEQUAL, "= (Keypad)"); + MAP_KEY(OBS_KEY_NUMASTERISK, "* (Keypad)"); + MAP_KEY(OBS_KEY_NUMPLUS, "+ (Keypad)"); + MAP_KEY(OBS_KEY_NUMMINUS, "- (Keypad)"); + MAP_KEY(OBS_KEY_NUMPERIOD, ". (Keypad)"); + MAP_KEY(OBS_KEY_NUMSLASH, "/ (Keypad)"); + MAP_KEY(OBS_KEY_NUM0, "0 (Keypad)"); + MAP_KEY(OBS_KEY_NUM1, "1 (Keypad)"); + MAP_KEY(OBS_KEY_NUM2, "2 (Keypad)"); + MAP_KEY(OBS_KEY_NUM3, "3 (Keypad)"); + MAP_KEY(OBS_KEY_NUM4, "4 (Keypad)"); + MAP_KEY(OBS_KEY_NUM5, "5 (Keypad)"); + MAP_KEY(OBS_KEY_NUM6, "6 (Keypad)"); + MAP_KEY(OBS_KEY_NUM7, "7 (Keypad)"); + MAP_KEY(OBS_KEY_NUM8, "8 (Keypad)"); + MAP_KEY(OBS_KEY_NUM9, "9 (Keypad)"); + + MAP_BUTTON(1); + MAP_BUTTON(2); + MAP_BUTTON(3); + MAP_BUTTON(4); + MAP_BUTTON(5); + MAP_BUTTON(6); + MAP_BUTTON(7); + MAP_BUTTON(8); + MAP_BUTTON(9); + MAP_BUTTON(10); + MAP_BUTTON(11); + MAP_BUTTON(12); + MAP_BUTTON(13); + MAP_BUTTON(14); + MAP_BUTTON(15); + MAP_BUTTON(16); + MAP_BUTTON(17); + MAP_BUTTON(18); + MAP_BUTTON(19); + MAP_BUTTON(20); + MAP_BUTTON(21); + MAP_BUTTON(22); + MAP_BUTTON(23); + MAP_BUTTON(24); + MAP_BUTTON(25); + MAP_BUTTON(26); + MAP_BUTTON(27); + MAP_BUTTON(28); + MAP_BUTTON(29); + default: + break; } #undef MAP_BUTTON #undef MAP_KEY @@ -410,56 +516,61 @@ static bool code_to_str(int code, struct dstr *str) { -#define MAP_GLYPH(c, g) \ - case c: dstr_from_wcs(str, (wchar_t[]){g, 0}); return true -#define MAP_STR(c, s) case c: dstr_copy(str, s); return true +#define MAP_GLYPH(c, g) \ + case c: \ + dstr_from_wcs(str, (wchar_t[]){g, 0}); \ + return true +#define MAP_STR(c, s) \ + case c: \ + dstr_copy(str, s); \ + return true switch (code) { - MAP_GLYPH(kVK_Return, 0x21A9); - MAP_GLYPH(kVK_Escape, 0x238B); - MAP_GLYPH(kVK_Delete, 0x232B); - MAP_GLYPH(kVK_Tab, 0x21e5); - MAP_GLYPH(kVK_CapsLock, 0x21EA); - MAP_GLYPH(kVK_ANSI_KeypadClear, 0x2327); - MAP_GLYPH(kVK_ANSI_KeypadEnter, 0x2305); - MAP_GLYPH(kVK_Help, 0x003F); - MAP_GLYPH(kVK_Home, 0x2196); - MAP_GLYPH(kVK_PageUp, 0x21de); - MAP_GLYPH(kVK_ForwardDelete, 0x2326); - MAP_GLYPH(kVK_End, 0x2198); - MAP_GLYPH(kVK_PageDown, 0x21df); - - MAP_GLYPH(kVK_RightArrow, 0x2192); - MAP_GLYPH(kVK_LeftArrow, 0x2190); - MAP_GLYPH(kVK_DownArrow, 0x2193); - MAP_GLYPH(kVK_UpArrow, 0x2191); - - MAP_STR (kVK_F1, "F1"); - MAP_STR (kVK_F2, "F2"); - MAP_STR (kVK_F3, "F3"); - MAP_STR (kVK_F4, "F4"); - MAP_STR (kVK_F5, "F5"); - MAP_STR (kVK_F6, "F6"); - MAP_STR (kVK_F7, "F7"); - MAP_STR (kVK_F8, "F8"); - MAP_STR (kVK_F9, "F9"); - MAP_STR (kVK_F10, "F10"); - MAP_STR (kVK_F11, "F11"); - MAP_STR (kVK_F12, "F12"); - MAP_STR (kVK_F13, "F13"); - MAP_STR (kVK_F14, "F14"); - MAP_STR (kVK_F15, "F15"); - MAP_STR (kVK_F16, "F16"); - MAP_STR (kVK_F17, "F17"); - MAP_STR (kVK_F18, "F18"); - MAP_STR (kVK_F19, "F19"); - MAP_STR (kVK_F20, "F20"); - MAP_GLYPH(kVK_Control, kControlUnicode); - MAP_GLYPH(kVK_Shift, kShiftUnicode); - MAP_GLYPH(kVK_Option, kOptionUnicode); - MAP_GLYPH(kVK_Command, kCommandUnicode); - MAP_GLYPH(kVK_RightControl, kControlUnicode); - MAP_GLYPH(kVK_RightShift, kShiftUnicode); - MAP_GLYPH(kVK_RightOption, kOptionUnicode); + MAP_GLYPH(kVK_Return, 0x21A9); + MAP_GLYPH(kVK_Escape, 0x238B); + MAP_GLYPH(kVK_Delete, 0x232B); + MAP_GLYPH(kVK_Tab, 0x21e5); + MAP_GLYPH(kVK_CapsLock, 0x21EA); + MAP_GLYPH(kVK_ANSI_KeypadClear, 0x2327); + MAP_GLYPH(kVK_ANSI_KeypadEnter, 0x2305); + MAP_GLYPH(kVK_Help, 0x003F); + MAP_GLYPH(kVK_Home, 0x2196); + MAP_GLYPH(kVK_PageUp, 0x21de); + MAP_GLYPH(kVK_ForwardDelete, 0x2326); + MAP_GLYPH(kVK_End, 0x2198); + MAP_GLYPH(kVK_PageDown, 0x21df); + + MAP_GLYPH(kVK_RightArrow, 0x2192); + MAP_GLYPH(kVK_LeftArrow, 0x2190); + MAP_GLYPH(kVK_DownArrow, 0x2193); + MAP_GLYPH(kVK_UpArrow, 0x2191); + + MAP_STR(kVK_F1, "F1"); + MAP_STR(kVK_F2, "F2"); + MAP_STR(kVK_F3, "F3"); + MAP_STR(kVK_F4, "F4"); + MAP_STR(kVK_F5, "F5"); + MAP_STR(kVK_F6, "F6"); + MAP_STR(kVK_F7, "F7"); + MAP_STR(kVK_F8, "F8"); + MAP_STR(kVK_F9, "F9"); + MAP_STR(kVK_F10, "F10"); + MAP_STR(kVK_F11, "F11"); + MAP_STR(kVK_F12, "F12"); + MAP_STR(kVK_F13, "F13"); + MAP_STR(kVK_F14, "F14"); + MAP_STR(kVK_F15, "F15"); + MAP_STR(kVK_F16, "F16"); + MAP_STR(kVK_F17, "F17"); + MAP_STR(kVK_F18, "F18"); + MAP_STR(kVK_F19, "F19"); + MAP_STR(kVK_F20, "F20"); + MAP_GLYPH(kVK_Control, kControlUnicode); + MAP_GLYPH(kVK_Shift, kShiftUnicode); + MAP_GLYPH(kVK_Option, kOptionUnicode); + MAP_GLYPH(kVK_Command, kCommandUnicode); + MAP_GLYPH(kVK_RightControl, kControlUnicode); + MAP_GLYPH(kVK_RightShift, kShiftUnicode); + MAP_GLYPH(kVK_RightOption, kOptionUnicode); } #undef MAP_STR #undef MAP_GLYPH @@ -477,9 +588,10 @@ return; if (code == INVALID_KEY) { - blog(LOG_ERROR, "hotkey-cocoa: Got invalid key while " - "translating key '%d' (%s)", - key, obs_key_to_name(key)); + blog(LOG_ERROR, + "hotkey-cocoa: Got invalid key while " + "translating key '%d' (%s)", + key, obs_key_to_name(key)); goto err; } @@ -493,70 +605,64 @@ } if (!plat) { - blog(LOG_ERROR, "hotkey-cocoa: Could not get hotkey platform " - "while translating key '%d' (%s)", - key, obs_key_to_name(key)); + blog(LOG_ERROR, + "hotkey-cocoa: Could not get hotkey platform " + "while translating key '%d' (%s)", + key, obs_key_to_name(key)); goto err; } const UniCharCount max_length = 16; - UInt32 dead_key_state = 0; - UniChar buffer[max_length]; - UniCharCount len = 0; - - OSStatus err = UCKeyTranslate(plat->layout, - code, - kUCKeyActionDown, - 0x104, //caps lock for upper case letters - LMGetKbdType(), - kUCKeyTranslateNoDeadKeysBit, - &dead_key_state, - max_length, - &len, - buffer); + UInt32 dead_key_state = 0; + UniChar buffer[max_length]; + UniCharCount len = 0; + + OSStatus err = + UCKeyTranslate(plat->layout, code, kUCKeyActionDown, + 0x104, //caps lock for upper case letters + LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit, + &dead_key_state, max_length, &len, buffer); if (err == noErr && len <= 0 && dead_key_state) { - err = UCKeyTranslate(plat->layout, - kVK_Space, - kUCKeyActionDown, - 0x104, - LMGetKbdType(), - kUCKeyTranslateNoDeadKeysBit, - &dead_key_state, - max_length, - &len, - buffer); + err = UCKeyTranslate(plat->layout, kVK_Space, kUCKeyActionDown, + 0x104, LMGetKbdType(), + kUCKeyTranslateNoDeadKeysBit, + &dead_key_state, max_length, &len, buffer); } hotkeys_release(plat); if (err != noErr) { - blog(LOG_ERROR, "hotkey-cocoa: Error while translating key '%d'" - " (0x%x, %s) to string: %d", key, code, - obs_key_to_name(key), err); + blog(LOG_ERROR, + "hotkey-cocoa: Error while translating key '%d'" + " (0x%x, %s) to string: %d", + key, code, obs_key_to_name(key), err); goto err; } if (len == 0) { - blog(LOG_ERROR, "hotkey-cocoa: Got 0 length string while " - "translating '%d' (0x%x, %s) to string", - key, code, obs_key_to_name(key)); + blog(LOG_ERROR, + "hotkey-cocoa: Got 0 length string while " + "translating '%d' (0x%x, %s) to string", + key, code, obs_key_to_name(key)); goto err; } - CFStringRef string = CFStringCreateWithCharactersNoCopy(NULL, - buffer, len, kCFAllocatorNull); + CFStringRef string = CFStringCreateWithCharactersNoCopy( + NULL, buffer, len, kCFAllocatorNull); if (!string) { - blog(LOG_ERROR, "hotkey-cocoa: Could not create CFStringRef " - "while translating '%d' (0x%x, %s) to string", - key, code, obs_key_to_name(key)); + blog(LOG_ERROR, + "hotkey-cocoa: Could not create CFStringRef " + "while translating '%d' (0x%x, %s) to string", + key, code, obs_key_to_name(key)); goto err; } if (!dstr_from_cfstring(str, string)) { - blog(LOG_ERROR, "hotkey-cocoa: Could not translate CFStringRef " - "to CString while translating '%d' (0x%x, %s)", - key, code, obs_key_to_name(key)); + blog(LOG_ERROR, + "hotkey-cocoa: Could not translate CFStringRef " + "to CString while translating '%d' (0x%x, %s)", + key, code, obs_key_to_name(key)); goto release; } @@ -573,8 +679,8 @@ #define OBS_COCOA_MODIFIER_SIZE 7 static void unichar_to_utf8(const UniChar *c, char *buff) { - CFStringRef string = CFStringCreateWithCharactersNoCopy(NULL, c, 2, - kCFAllocatorNull); + CFStringRef string = CFStringCreateWithCharactersNoCopy( + NULL, c, 2, kCFAllocatorNull); if (!string) { blog(LOG_ERROR, "hotkey-cocoa: Could not create CFStringRef " "while populating modifier strings"); @@ -583,9 +689,10 @@ if (!CFStringGetCString(string, buff, OBS_COCOA_MODIFIER_SIZE, kCFStringEncodingUTF8)) - blog(LOG_ERROR, "hotkey-cocoa: Error while populating " - " modifier string with glyph %d (0x%x)", - c[0], c[0]); + blog(LOG_ERROR, + "hotkey-cocoa: Error while populating " + " modifier string with glyph %d (0x%x)", + c[0], c[0]); CFRelease(string); } @@ -596,10 +703,10 @@ static char cmd_str[OBS_COCOA_MODIFIER_SIZE]; static void init_utf_8_strings(void) { - const UniChar ctrl_uni[] = {kControlUnicode, 0}; - const UniChar opt_uni[] = {kOptionUnicode, 0}; + const UniChar ctrl_uni[] = {kControlUnicode, 0}; + const UniChar opt_uni[] = {kOptionUnicode, 0}; const UniChar shift_uni[] = {kShiftUnicode, 0}; - const UniChar cmd_uni[] = {kCommandUnicode, 0}; + const UniChar cmd_uni[] = {kCommandUnicode, 0}; unichar_to_utf8(ctrl_uni, ctrl_str); unichar_to_utf8(opt_uni, opt_str); @@ -616,19 +723,21 @@ int res = pthread_once(&strings_token, init_utf_8_strings); if (res) { - blog(LOG_ERROR, "hotkeys-cocoa: Error while translating " - "modifiers %d (0x%x)", res, res); + blog(LOG_ERROR, + "hotkeys-cocoa: Error while translating " + "modifiers %d (0x%x)", + res, res); dstr_move(str, &key_str); return; } #define CHECK_MODIFIER(mod, str) ((key.modifiers & mod) ? str : "") dstr_printf(str, "%s%s%s%s%s", - CHECK_MODIFIER(INTERACT_CONTROL_KEY, ctrl_str), - CHECK_MODIFIER(INTERACT_ALT_KEY, opt_str), - CHECK_MODIFIER(INTERACT_SHIFT_KEY, shift_str), - CHECK_MODIFIER(INTERACT_COMMAND_KEY, cmd_str), - key_str.len ? key_str.array : ""); + CHECK_MODIFIER(INTERACT_CONTROL_KEY, ctrl_str), + CHECK_MODIFIER(INTERACT_ALT_KEY, opt_str), + CHECK_MODIFIER(INTERACT_SHIFT_KEY, shift_str), + CHECK_MODIFIER(INTERACT_COMMAND_KEY, cmd_str), + key_str.len ? key_str.array : ""); #undef CHECK_MODIFIER dstr_free(&key_str); @@ -637,9 +746,8 @@ static inline CFDictionaryRef copy_device_mask(UInt32 page, UInt32 usage) { CFMutableDictionaryRef dict = CFDictionaryCreateMutable( - kCFAllocatorDefault, 2, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + kCFAllocatorDefault, 2, &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); CFNumberRef value; // Add the page value. @@ -655,8 +763,8 @@ return dict; } -static CFSetRef copy_devices(obs_hotkeys_platform_t *plat, - UInt32 page, UInt32 usage) +static CFSetRef copy_devices(obs_hotkeys_platform_t *plat, UInt32 page, + UInt32 usage) { CFDictionaryRef mask = copy_device_mask(page, usage); IOHIDManagerSetDeviceMatching(plat->manager, mask); @@ -676,204 +784,377 @@ static UInt16 usage_to_carbon(UInt32 usage) { - switch (usage) - { - case kHIDUsage_KeyboardErrorRollOver: return INVALID_KEY; - case kHIDUsage_KeyboardPOSTFail: return INVALID_KEY; - case kHIDUsage_KeyboardErrorUndefined: return INVALID_KEY; - - case kHIDUsage_KeyboardA: return kVK_ANSI_A; - case kHIDUsage_KeyboardB: return kVK_ANSI_B; - case kHIDUsage_KeyboardC: return kVK_ANSI_C; - case kHIDUsage_KeyboardD: return kVK_ANSI_D; - case kHIDUsage_KeyboardE: return kVK_ANSI_E; - case kHIDUsage_KeyboardF: return kVK_ANSI_F; - case kHIDUsage_KeyboardG: return kVK_ANSI_G; - case kHIDUsage_KeyboardH: return kVK_ANSI_H; - case kHIDUsage_KeyboardI: return kVK_ANSI_I; - case kHIDUsage_KeyboardJ: return kVK_ANSI_J; - case kHIDUsage_KeyboardK: return kVK_ANSI_K; - case kHIDUsage_KeyboardL: return kVK_ANSI_L; - case kHIDUsage_KeyboardM: return kVK_ANSI_M; - case kHIDUsage_KeyboardN: return kVK_ANSI_N; - case kHIDUsage_KeyboardO: return kVK_ANSI_O; - case kHIDUsage_KeyboardP: return kVK_ANSI_P; - case kHIDUsage_KeyboardQ: return kVK_ANSI_Q; - case kHIDUsage_KeyboardR: return kVK_ANSI_R; - case kHIDUsage_KeyboardS: return kVK_ANSI_S; - case kHIDUsage_KeyboardT: return kVK_ANSI_T; - case kHIDUsage_KeyboardU: return kVK_ANSI_U; - case kHIDUsage_KeyboardV: return kVK_ANSI_V; - case kHIDUsage_KeyboardW: return kVK_ANSI_W; - case kHIDUsage_KeyboardX: return kVK_ANSI_X; - case kHIDUsage_KeyboardY: return kVK_ANSI_Y; - case kHIDUsage_KeyboardZ: return kVK_ANSI_Z; - - case kHIDUsage_Keyboard1: return kVK_ANSI_1; - case kHIDUsage_Keyboard2: return kVK_ANSI_2; - case kHIDUsage_Keyboard3: return kVK_ANSI_3; - case kHIDUsage_Keyboard4: return kVK_ANSI_4; - case kHIDUsage_Keyboard5: return kVK_ANSI_5; - case kHIDUsage_Keyboard6: return kVK_ANSI_6; - case kHIDUsage_Keyboard7: return kVK_ANSI_7; - case kHIDUsage_Keyboard8: return kVK_ANSI_8; - case kHIDUsage_Keyboard9: return kVK_ANSI_9; - case kHIDUsage_Keyboard0: return kVK_ANSI_0; - - case kHIDUsage_KeyboardReturnOrEnter: return kVK_Return; - case kHIDUsage_KeyboardEscape: return kVK_Escape; - case kHIDUsage_KeyboardDeleteOrBackspace: return kVK_Delete; - case kHIDUsage_KeyboardTab: return kVK_Tab; - case kHIDUsage_KeyboardSpacebar: return kVK_Space; - case kHIDUsage_KeyboardHyphen: return kVK_ANSI_Minus; - case kHIDUsage_KeyboardEqualSign: return kVK_ANSI_Equal; - case kHIDUsage_KeyboardOpenBracket: return kVK_ANSI_LeftBracket; - case kHIDUsage_KeyboardCloseBracket: return kVK_ANSI_RightBracket; - case kHIDUsage_KeyboardBackslash: return kVK_ANSI_Backslash; - case kHIDUsage_KeyboardNonUSPound: return INVALID_KEY; - case kHIDUsage_KeyboardSemicolon: return kVK_ANSI_Semicolon; - case kHIDUsage_KeyboardQuote: return kVK_ANSI_Quote; - case kHIDUsage_KeyboardGraveAccentAndTilde: return kVK_ANSI_Grave; - case kHIDUsage_KeyboardComma: return kVK_ANSI_Comma; - case kHIDUsage_KeyboardPeriod: return kVK_ANSI_Period; - case kHIDUsage_KeyboardSlash: return kVK_ANSI_Slash; - case kHIDUsage_KeyboardCapsLock: return kVK_CapsLock; - - case kHIDUsage_KeyboardF1: return kVK_F1; - case kHIDUsage_KeyboardF2: return kVK_F2; - case kHIDUsage_KeyboardF3: return kVK_F3; - case kHIDUsage_KeyboardF4: return kVK_F4; - case kHIDUsage_KeyboardF5: return kVK_F5; - case kHIDUsage_KeyboardF6: return kVK_F6; - case kHIDUsage_KeyboardF7: return kVK_F7; - case kHIDUsage_KeyboardF8: return kVK_F8; - case kHIDUsage_KeyboardF9: return kVK_F9; - case kHIDUsage_KeyboardF10: return kVK_F10; - case kHIDUsage_KeyboardF11: return kVK_F11; - case kHIDUsage_KeyboardF12: return kVK_F12; - - case kHIDUsage_KeyboardPrintScreen: return INVALID_KEY; - case kHIDUsage_KeyboardScrollLock: return INVALID_KEY; - case kHIDUsage_KeyboardPause: return INVALID_KEY; - case kHIDUsage_KeyboardInsert: return kVK_Help; - case kHIDUsage_KeyboardHome: return kVK_Home; - case kHIDUsage_KeyboardPageUp: return kVK_PageUp; - case kHIDUsage_KeyboardDeleteForward: return kVK_ForwardDelete; - case kHIDUsage_KeyboardEnd: return kVK_End; - case kHIDUsage_KeyboardPageDown: return kVK_PageDown; - - case kHIDUsage_KeyboardRightArrow: return kVK_RightArrow; - case kHIDUsage_KeyboardLeftArrow: return kVK_LeftArrow; - case kHIDUsage_KeyboardDownArrow: return kVK_DownArrow; - case kHIDUsage_KeyboardUpArrow: return kVK_UpArrow; - - case kHIDUsage_KeypadNumLock: return kVK_ANSI_KeypadClear; - case kHIDUsage_KeypadSlash: return kVK_ANSI_KeypadDivide; - case kHIDUsage_KeypadAsterisk: return kVK_ANSI_KeypadMultiply; - case kHIDUsage_KeypadHyphen: return kVK_ANSI_KeypadMinus; - case kHIDUsage_KeypadPlus: return kVK_ANSI_KeypadPlus; - case kHIDUsage_KeypadEnter: return kVK_ANSI_KeypadEnter; - - case kHIDUsage_Keypad1: return kVK_ANSI_Keypad1; - case kHIDUsage_Keypad2: return kVK_ANSI_Keypad2; - case kHIDUsage_Keypad3: return kVK_ANSI_Keypad3; - case kHIDUsage_Keypad4: return kVK_ANSI_Keypad4; - case kHIDUsage_Keypad5: return kVK_ANSI_Keypad5; - case kHIDUsage_Keypad6: return kVK_ANSI_Keypad6; - case kHIDUsage_Keypad7: return kVK_ANSI_Keypad7; - case kHIDUsage_Keypad8: return kVK_ANSI_Keypad8; - case kHIDUsage_Keypad9: return kVK_ANSI_Keypad9; - case kHIDUsage_Keypad0: return kVK_ANSI_Keypad0; - - case kHIDUsage_KeypadPeriod: return kVK_ANSI_KeypadDecimal; - case kHIDUsage_KeyboardNonUSBackslash: return INVALID_KEY; - case kHIDUsage_KeyboardApplication: return kVK_F13; - case kHIDUsage_KeyboardPower: return INVALID_KEY; - case kHIDUsage_KeypadEqualSign: return kVK_ANSI_KeypadEquals; - - case kHIDUsage_KeyboardF13: return kVK_F13; - case kHIDUsage_KeyboardF14: return kVK_F14; - case kHIDUsage_KeyboardF15: return kVK_F15; - case kHIDUsage_KeyboardF16: return kVK_F16; - case kHIDUsage_KeyboardF17: return kVK_F17; - case kHIDUsage_KeyboardF18: return kVK_F18; - case kHIDUsage_KeyboardF19: return kVK_F19; - case kHIDUsage_KeyboardF20: return kVK_F20; - case kHIDUsage_KeyboardF21: return INVALID_KEY; - case kHIDUsage_KeyboardF22: return INVALID_KEY; - case kHIDUsage_KeyboardF23: return INVALID_KEY; - case kHIDUsage_KeyboardF24: return INVALID_KEY; - - case kHIDUsage_KeyboardExecute: return INVALID_KEY; - case kHIDUsage_KeyboardHelp: return INVALID_KEY; - case kHIDUsage_KeyboardMenu: return 0x7F; - case kHIDUsage_KeyboardSelect: return kVK_ANSI_KeypadEnter; - case kHIDUsage_KeyboardStop: return INVALID_KEY; - case kHIDUsage_KeyboardAgain: return INVALID_KEY; - case kHIDUsage_KeyboardUndo: return INVALID_KEY; - case kHIDUsage_KeyboardCut: return INVALID_KEY; - case kHIDUsage_KeyboardCopy: return INVALID_KEY; - case kHIDUsage_KeyboardPaste: return INVALID_KEY; - case kHIDUsage_KeyboardFind: return INVALID_KEY; - - case kHIDUsage_KeyboardMute: return kVK_Mute; - case kHIDUsage_KeyboardVolumeUp: return kVK_VolumeUp; - case kHIDUsage_KeyboardVolumeDown: return kVK_VolumeDown; - - case kHIDUsage_KeyboardLockingCapsLock: return INVALID_KEY; - case kHIDUsage_KeyboardLockingNumLock: return INVALID_KEY; - case kHIDUsage_KeyboardLockingScrollLock: return INVALID_KEY; - - case kHIDUsage_KeypadComma: return INVALID_KEY; - case kHIDUsage_KeypadEqualSignAS400: return INVALID_KEY; - case kHIDUsage_KeyboardInternational1: return INVALID_KEY; - case kHIDUsage_KeyboardInternational2: return INVALID_KEY; - case kHIDUsage_KeyboardInternational3: return INVALID_KEY; - case kHIDUsage_KeyboardInternational4: return INVALID_KEY; - case kHIDUsage_KeyboardInternational5: return INVALID_KEY; - case kHIDUsage_KeyboardInternational6: return INVALID_KEY; - case kHIDUsage_KeyboardInternational7: return INVALID_KEY; - case kHIDUsage_KeyboardInternational8: return INVALID_KEY; - case kHIDUsage_KeyboardInternational9: return INVALID_KEY; - - case kHIDUsage_KeyboardLANG1: return INVALID_KEY; - case kHIDUsage_KeyboardLANG2: return INVALID_KEY; - case kHIDUsage_KeyboardLANG3: return INVALID_KEY; - case kHIDUsage_KeyboardLANG4: return INVALID_KEY; - case kHIDUsage_KeyboardLANG5: return INVALID_KEY; - case kHIDUsage_KeyboardLANG6: return INVALID_KEY; - case kHIDUsage_KeyboardLANG7: return INVALID_KEY; - case kHIDUsage_KeyboardLANG8: return INVALID_KEY; - case kHIDUsage_KeyboardLANG9: return INVALID_KEY; - - case kHIDUsage_KeyboardAlternateErase: return INVALID_KEY; - case kHIDUsage_KeyboardSysReqOrAttention: return INVALID_KEY; - case kHIDUsage_KeyboardCancel: return INVALID_KEY; - case kHIDUsage_KeyboardClear: return INVALID_KEY; - case kHIDUsage_KeyboardPrior: return INVALID_KEY; - case kHIDUsage_KeyboardReturn: return INVALID_KEY; - case kHIDUsage_KeyboardSeparator: return INVALID_KEY; - case kHIDUsage_KeyboardOut: return INVALID_KEY; - case kHIDUsage_KeyboardOper: return INVALID_KEY; - case kHIDUsage_KeyboardClearOrAgain: return INVALID_KEY; - case kHIDUsage_KeyboardCrSelOrProps: return INVALID_KEY; - case kHIDUsage_KeyboardExSel: return INVALID_KEY; - - /* 0xa5-0xdf Reserved */ - - case kHIDUsage_KeyboardLeftControl: return kVK_Control; - case kHIDUsage_KeyboardLeftShift: return kVK_Shift; - case kHIDUsage_KeyboardLeftAlt: return kVK_Option; - case kHIDUsage_KeyboardLeftGUI: return kVK_Command; - case kHIDUsage_KeyboardRightControl: return kVK_RightControl; - case kHIDUsage_KeyboardRightShift: return kVK_RightShift; - case kHIDUsage_KeyboardRightAlt: return kVK_RightOption; - case kHIDUsage_KeyboardRightGUI: return 0x36; //?? - - /* 0xe8-0xffff Reserved */ - - case kHIDUsage_Keyboard_Reserved: return INVALID_KEY; - default: return INVALID_KEY; + switch (usage) { + case kHIDUsage_KeyboardErrorRollOver: + return INVALID_KEY; + case kHIDUsage_KeyboardPOSTFail: + return INVALID_KEY; + case kHIDUsage_KeyboardErrorUndefined: + return INVALID_KEY; + + case kHIDUsage_KeyboardA: + return kVK_ANSI_A; + case kHIDUsage_KeyboardB: + return kVK_ANSI_B; + case kHIDUsage_KeyboardC: + return kVK_ANSI_C; + case kHIDUsage_KeyboardD: + return kVK_ANSI_D; + case kHIDUsage_KeyboardE: + return kVK_ANSI_E; + case kHIDUsage_KeyboardF: + return kVK_ANSI_F; + case kHIDUsage_KeyboardG: + return kVK_ANSI_G; + case kHIDUsage_KeyboardH: + return kVK_ANSI_H; + case kHIDUsage_KeyboardI: + return kVK_ANSI_I; + case kHIDUsage_KeyboardJ: + return kVK_ANSI_J; + case kHIDUsage_KeyboardK: + return kVK_ANSI_K; + case kHIDUsage_KeyboardL: + return kVK_ANSI_L; + case kHIDUsage_KeyboardM: + return kVK_ANSI_M; + case kHIDUsage_KeyboardN: + return kVK_ANSI_N; + case kHIDUsage_KeyboardO: + return kVK_ANSI_O; + case kHIDUsage_KeyboardP: + return kVK_ANSI_P; + case kHIDUsage_KeyboardQ: + return kVK_ANSI_Q; + case kHIDUsage_KeyboardR: + return kVK_ANSI_R; + case kHIDUsage_KeyboardS: + return kVK_ANSI_S; + case kHIDUsage_KeyboardT: + return kVK_ANSI_T; + case kHIDUsage_KeyboardU: + return kVK_ANSI_U; + case kHIDUsage_KeyboardV: + return kVK_ANSI_V; + case kHIDUsage_KeyboardW: + return kVK_ANSI_W; + case kHIDUsage_KeyboardX: + return kVK_ANSI_X; + case kHIDUsage_KeyboardY: + return kVK_ANSI_Y; + case kHIDUsage_KeyboardZ: + return kVK_ANSI_Z; + + case kHIDUsage_Keyboard1: + return kVK_ANSI_1; + case kHIDUsage_Keyboard2: + return kVK_ANSI_2; + case kHIDUsage_Keyboard3: + return kVK_ANSI_3; + case kHIDUsage_Keyboard4: + return kVK_ANSI_4; + case kHIDUsage_Keyboard5: + return kVK_ANSI_5; + case kHIDUsage_Keyboard6: + return kVK_ANSI_6; + case kHIDUsage_Keyboard7: + return kVK_ANSI_7; + case kHIDUsage_Keyboard8: + return kVK_ANSI_8; + case kHIDUsage_Keyboard9: + return kVK_ANSI_9; + case kHIDUsage_Keyboard0: + return kVK_ANSI_0; + + case kHIDUsage_KeyboardReturnOrEnter: + return kVK_Return; + case kHIDUsage_KeyboardEscape: + return kVK_Escape; + case kHIDUsage_KeyboardDeleteOrBackspace: + return kVK_Delete; + case kHIDUsage_KeyboardTab: + return kVK_Tab; + case kHIDUsage_KeyboardSpacebar: + return kVK_Space; + case kHIDUsage_KeyboardHyphen: + return kVK_ANSI_Minus; + case kHIDUsage_KeyboardEqualSign: + return kVK_ANSI_Equal; + case kHIDUsage_KeyboardOpenBracket: + return kVK_ANSI_LeftBracket; + case kHIDUsage_KeyboardCloseBracket: + return kVK_ANSI_RightBracket; + case kHIDUsage_KeyboardBackslash: + return kVK_ANSI_Backslash; + case kHIDUsage_KeyboardNonUSPound: + return INVALID_KEY; + case kHIDUsage_KeyboardSemicolon: + return kVK_ANSI_Semicolon; + case kHIDUsage_KeyboardQuote: + return kVK_ANSI_Quote; + case kHIDUsage_KeyboardGraveAccentAndTilde: + return kVK_ANSI_Grave; + case kHIDUsage_KeyboardComma: + return kVK_ANSI_Comma; + case kHIDUsage_KeyboardPeriod: + return kVK_ANSI_Period; + case kHIDUsage_KeyboardSlash: + return kVK_ANSI_Slash; + case kHIDUsage_KeyboardCapsLock: + return kVK_CapsLock; + + case kHIDUsage_KeyboardF1: + return kVK_F1; + case kHIDUsage_KeyboardF2: + return kVK_F2; + case kHIDUsage_KeyboardF3: + return kVK_F3; + case kHIDUsage_KeyboardF4: + return kVK_F4; + case kHIDUsage_KeyboardF5: + return kVK_F5; + case kHIDUsage_KeyboardF6: + return kVK_F6; + case kHIDUsage_KeyboardF7: + return kVK_F7; + case kHIDUsage_KeyboardF8: + return kVK_F8; + case kHIDUsage_KeyboardF9: + return kVK_F9; + case kHIDUsage_KeyboardF10: + return kVK_F10; + case kHIDUsage_KeyboardF11: + return kVK_F11; + case kHIDUsage_KeyboardF12: + return kVK_F12; + + case kHIDUsage_KeyboardPrintScreen: + return INVALID_KEY; + case kHIDUsage_KeyboardScrollLock: + return INVALID_KEY; + case kHIDUsage_KeyboardPause: + return INVALID_KEY; + case kHIDUsage_KeyboardInsert: + return kVK_Help; + case kHIDUsage_KeyboardHome: + return kVK_Home; + case kHIDUsage_KeyboardPageUp: + return kVK_PageUp; + case kHIDUsage_KeyboardDeleteForward: + return kVK_ForwardDelete; + case kHIDUsage_KeyboardEnd: + return kVK_End; + case kHIDUsage_KeyboardPageDown: + return kVK_PageDown; + + case kHIDUsage_KeyboardRightArrow: + return kVK_RightArrow; + case kHIDUsage_KeyboardLeftArrow: + return kVK_LeftArrow; + case kHIDUsage_KeyboardDownArrow: + return kVK_DownArrow; + case kHIDUsage_KeyboardUpArrow: + return kVK_UpArrow; + + case kHIDUsage_KeypadNumLock: + return kVK_ANSI_KeypadClear; + case kHIDUsage_KeypadSlash: + return kVK_ANSI_KeypadDivide; + case kHIDUsage_KeypadAsterisk: + return kVK_ANSI_KeypadMultiply; + case kHIDUsage_KeypadHyphen: + return kVK_ANSI_KeypadMinus; + case kHIDUsage_KeypadPlus: + return kVK_ANSI_KeypadPlus; + case kHIDUsage_KeypadEnter: + return kVK_ANSI_KeypadEnter; + + case kHIDUsage_Keypad1: + return kVK_ANSI_Keypad1; + case kHIDUsage_Keypad2: + return kVK_ANSI_Keypad2; + case kHIDUsage_Keypad3: + return kVK_ANSI_Keypad3; + case kHIDUsage_Keypad4: + return kVK_ANSI_Keypad4; + case kHIDUsage_Keypad5: + return kVK_ANSI_Keypad5; + case kHIDUsage_Keypad6: + return kVK_ANSI_Keypad6; + case kHIDUsage_Keypad7: + return kVK_ANSI_Keypad7; + case kHIDUsage_Keypad8: + return kVK_ANSI_Keypad8; + case kHIDUsage_Keypad9: + return kVK_ANSI_Keypad9; + case kHIDUsage_Keypad0: + return kVK_ANSI_Keypad0; + + case kHIDUsage_KeypadPeriod: + return kVK_ANSI_KeypadDecimal; + case kHIDUsage_KeyboardNonUSBackslash: + return INVALID_KEY; + case kHIDUsage_KeyboardApplication: + return kVK_F13; + case kHIDUsage_KeyboardPower: + return INVALID_KEY; + case kHIDUsage_KeypadEqualSign: + return kVK_ANSI_KeypadEquals; + + case kHIDUsage_KeyboardF13: + return kVK_F13; + case kHIDUsage_KeyboardF14: + return kVK_F14; + case kHIDUsage_KeyboardF15: + return kVK_F15; + case kHIDUsage_KeyboardF16: + return kVK_F16; + case kHIDUsage_KeyboardF17: + return kVK_F17; + case kHIDUsage_KeyboardF18: + return kVK_F18; + case kHIDUsage_KeyboardF19: + return kVK_F19; + case kHIDUsage_KeyboardF20: + return kVK_F20; + case kHIDUsage_KeyboardF21: + return INVALID_KEY; + case kHIDUsage_KeyboardF22: + return INVALID_KEY; + case kHIDUsage_KeyboardF23: + return INVALID_KEY; + case kHIDUsage_KeyboardF24: + return INVALID_KEY; + + case kHIDUsage_KeyboardExecute: + return INVALID_KEY; + case kHIDUsage_KeyboardHelp: + return INVALID_KEY; + case kHIDUsage_KeyboardMenu: + return 0x7F; + case kHIDUsage_KeyboardSelect: + return kVK_ANSI_KeypadEnter; + case kHIDUsage_KeyboardStop: + return INVALID_KEY; + case kHIDUsage_KeyboardAgain: + return INVALID_KEY; + case kHIDUsage_KeyboardUndo: + return INVALID_KEY; + case kHIDUsage_KeyboardCut: + return INVALID_KEY; + case kHIDUsage_KeyboardCopy: + return INVALID_KEY; + case kHIDUsage_KeyboardPaste: + return INVALID_KEY; + case kHIDUsage_KeyboardFind: + return INVALID_KEY; + + case kHIDUsage_KeyboardMute: + return kVK_Mute; + case kHIDUsage_KeyboardVolumeUp: + return kVK_VolumeUp; + case kHIDUsage_KeyboardVolumeDown: + return kVK_VolumeDown; + + case kHIDUsage_KeyboardLockingCapsLock: + return INVALID_KEY; + case kHIDUsage_KeyboardLockingNumLock: + return INVALID_KEY; + case kHIDUsage_KeyboardLockingScrollLock: + return INVALID_KEY; + + case kHIDUsage_KeypadComma: + return INVALID_KEY; + case kHIDUsage_KeypadEqualSignAS400: + return INVALID_KEY; + case kHIDUsage_KeyboardInternational1: + return INVALID_KEY; + case kHIDUsage_KeyboardInternational2: + return INVALID_KEY; + case kHIDUsage_KeyboardInternational3: + return INVALID_KEY; + case kHIDUsage_KeyboardInternational4: + return INVALID_KEY; + case kHIDUsage_KeyboardInternational5: + return INVALID_KEY; + case kHIDUsage_KeyboardInternational6: + return INVALID_KEY; + case kHIDUsage_KeyboardInternational7: + return INVALID_KEY; + case kHIDUsage_KeyboardInternational8: + return INVALID_KEY; + case kHIDUsage_KeyboardInternational9: + return INVALID_KEY; + + case kHIDUsage_KeyboardLANG1: + return INVALID_KEY; + case kHIDUsage_KeyboardLANG2: + return INVALID_KEY; + case kHIDUsage_KeyboardLANG3: + return INVALID_KEY; + case kHIDUsage_KeyboardLANG4: + return INVALID_KEY; + case kHIDUsage_KeyboardLANG5: + return INVALID_KEY; + case kHIDUsage_KeyboardLANG6: + return INVALID_KEY; + case kHIDUsage_KeyboardLANG7: + return INVALID_KEY; + case kHIDUsage_KeyboardLANG8: + return INVALID_KEY; + case kHIDUsage_KeyboardLANG9: + return INVALID_KEY; + + case kHIDUsage_KeyboardAlternateErase: + return INVALID_KEY; + case kHIDUsage_KeyboardSysReqOrAttention: + return INVALID_KEY; + case kHIDUsage_KeyboardCancel: + return INVALID_KEY; + case kHIDUsage_KeyboardClear: + return INVALID_KEY; + case kHIDUsage_KeyboardPrior: + return INVALID_KEY; + case kHIDUsage_KeyboardReturn: + return INVALID_KEY; + case kHIDUsage_KeyboardSeparator: + return INVALID_KEY; + case kHIDUsage_KeyboardOut: + return INVALID_KEY; + case kHIDUsage_KeyboardOper: + return INVALID_KEY; + case kHIDUsage_KeyboardClearOrAgain: + return INVALID_KEY; + case kHIDUsage_KeyboardCrSelOrProps: + return INVALID_KEY; + case kHIDUsage_KeyboardExSel: + return INVALID_KEY; + + /* 0xa5-0xdf Reserved */ + + case kHIDUsage_KeyboardLeftControl: + return kVK_Control; + case kHIDUsage_KeyboardLeftShift: + return kVK_Shift; + case kHIDUsage_KeyboardLeftAlt: + return kVK_Option; + case kHIDUsage_KeyboardLeftGUI: + return kVK_Command; + case kHIDUsage_KeyboardRightControl: + return kVK_RightControl; + case kHIDUsage_KeyboardRightShift: + return kVK_RightShift; + case kHIDUsage_KeyboardRightAlt: + return kVK_RightOption; + case kHIDUsage_KeyboardRightGUI: + return 0x36; //?? + + /* 0xe8-0xffff Reserved */ + + case kHIDUsage_Keyboard_Reserved: + return INVALID_KEY; + default: + return INVALID_KEY; } return INVALID_KEY; } @@ -881,126 +1162,236 @@ obs_key_t obs_key_from_virtual_key(int code) { switch (code) { - case kVK_ANSI_A: return OBS_KEY_A; - case kVK_ANSI_B: return OBS_KEY_B; - case kVK_ANSI_C: return OBS_KEY_C; - case kVK_ANSI_D: return OBS_KEY_D; - case kVK_ANSI_E: return OBS_KEY_E; - case kVK_ANSI_F: return OBS_KEY_F; - case kVK_ANSI_G: return OBS_KEY_G; - case kVK_ANSI_H: return OBS_KEY_H; - case kVK_ANSI_I: return OBS_KEY_I; - case kVK_ANSI_J: return OBS_KEY_J; - case kVK_ANSI_K: return OBS_KEY_K; - case kVK_ANSI_L: return OBS_KEY_L; - case kVK_ANSI_M: return OBS_KEY_M; - case kVK_ANSI_N: return OBS_KEY_N; - case kVK_ANSI_O: return OBS_KEY_O; - case kVK_ANSI_P: return OBS_KEY_P; - case kVK_ANSI_Q: return OBS_KEY_Q; - case kVK_ANSI_R: return OBS_KEY_R; - case kVK_ANSI_S: return OBS_KEY_S; - case kVK_ANSI_T: return OBS_KEY_T; - case kVK_ANSI_U: return OBS_KEY_U; - case kVK_ANSI_V: return OBS_KEY_V; - case kVK_ANSI_W: return OBS_KEY_W; - case kVK_ANSI_X: return OBS_KEY_X; - case kVK_ANSI_Y: return OBS_KEY_Y; - case kVK_ANSI_Z: return OBS_KEY_Z; - - case kVK_ANSI_1: return OBS_KEY_1; - case kVK_ANSI_2: return OBS_KEY_2; - case kVK_ANSI_3: return OBS_KEY_3; - case kVK_ANSI_4: return OBS_KEY_4; - case kVK_ANSI_5: return OBS_KEY_5; - case kVK_ANSI_6: return OBS_KEY_6; - case kVK_ANSI_7: return OBS_KEY_7; - case kVK_ANSI_8: return OBS_KEY_8; - case kVK_ANSI_9: return OBS_KEY_9; - case kVK_ANSI_0: return OBS_KEY_0; - - case kVK_Return: return OBS_KEY_RETURN; - case kVK_Escape: return OBS_KEY_ESCAPE; - case kVK_Delete: return OBS_KEY_BACKSPACE; - case kVK_Tab: return OBS_KEY_TAB; - case kVK_Space: return OBS_KEY_SPACE; - case kVK_ANSI_Minus: return OBS_KEY_MINUS; - case kVK_ANSI_Equal: return OBS_KEY_EQUAL; - case kVK_ANSI_LeftBracket: return OBS_KEY_BRACKETLEFT; - case kVK_ANSI_RightBracket: return OBS_KEY_BRACKETRIGHT; - case kVK_ANSI_Backslash: return OBS_KEY_BACKSLASH; - case kVK_ANSI_Semicolon: return OBS_KEY_SEMICOLON; - case kVK_ANSI_Quote: return OBS_KEY_QUOTE; - case kVK_ANSI_Grave: return OBS_KEY_DEAD_GRAVE; - case kVK_ANSI_Comma: return OBS_KEY_COMMA; - case kVK_ANSI_Period: return OBS_KEY_PERIOD; - case kVK_ANSI_Slash: return OBS_KEY_SLASH; - case kVK_CapsLock: return OBS_KEY_CAPSLOCK; - case kVK_ISO_Section: return OBS_KEY_SECTION; - - case kVK_F1: return OBS_KEY_F1; - case kVK_F2: return OBS_KEY_F2; - case kVK_F3: return OBS_KEY_F3; - case kVK_F4: return OBS_KEY_F4; - case kVK_F5: return OBS_KEY_F5; - case kVK_F6: return OBS_KEY_F6; - case kVK_F7: return OBS_KEY_F7; - case kVK_F8: return OBS_KEY_F8; - case kVK_F9: return OBS_KEY_F9; - case kVK_F10: return OBS_KEY_F10; - case kVK_F11: return OBS_KEY_F11; - case kVK_F12: return OBS_KEY_F12; - - case kVK_Help: return OBS_KEY_HELP; - case kVK_Home: return OBS_KEY_HOME; - case kVK_PageUp: return OBS_KEY_PAGEUP; - case kVK_ForwardDelete: return OBS_KEY_DELETE; - case kVK_End: return OBS_KEY_END; - case kVK_PageDown: return OBS_KEY_PAGEDOWN; - - case kVK_RightArrow: return OBS_KEY_RIGHT; - case kVK_LeftArrow: return OBS_KEY_LEFT; - case kVK_DownArrow: return OBS_KEY_DOWN; - case kVK_UpArrow: return OBS_KEY_UP; - - case kVK_ANSI_KeypadClear: return OBS_KEY_CLEAR; - case kVK_ANSI_KeypadDivide: return OBS_KEY_NUMSLASH; - case kVK_ANSI_KeypadMultiply: return OBS_KEY_NUMASTERISK; - case kVK_ANSI_KeypadMinus: return OBS_KEY_NUMMINUS; - case kVK_ANSI_KeypadPlus: return OBS_KEY_NUMPLUS; - case kVK_ANSI_KeypadEnter: return OBS_KEY_ENTER; - - case kVK_ANSI_Keypad1: return OBS_KEY_NUM1; - case kVK_ANSI_Keypad2: return OBS_KEY_NUM2; - case kVK_ANSI_Keypad3: return OBS_KEY_NUM3; - case kVK_ANSI_Keypad4: return OBS_KEY_NUM4; - case kVK_ANSI_Keypad5: return OBS_KEY_NUM5; - case kVK_ANSI_Keypad6: return OBS_KEY_NUM6; - case kVK_ANSI_Keypad7: return OBS_KEY_NUM7; - case kVK_ANSI_Keypad8: return OBS_KEY_NUM8; - case kVK_ANSI_Keypad9: return OBS_KEY_NUM9; - case kVK_ANSI_Keypad0: return OBS_KEY_NUM0; - - case kVK_ANSI_KeypadDecimal: return OBS_KEY_NUMPERIOD; - case kVK_ANSI_KeypadEquals: return OBS_KEY_NUMEQUAL; - - case kVK_F13: return OBS_KEY_F13; - case kVK_F14: return OBS_KEY_F14; - case kVK_F15: return OBS_KEY_F15; - case kVK_F16: return OBS_KEY_F16; - case kVK_F17: return OBS_KEY_F17; - case kVK_F18: return OBS_KEY_F18; - case kVK_F19: return OBS_KEY_F19; - case kVK_F20: return OBS_KEY_F20; - - case kVK_Control: return OBS_KEY_CONTROL; - case kVK_Shift: return OBS_KEY_SHIFT; - case kVK_Option: return OBS_KEY_ALT; - case kVK_Command: return OBS_KEY_META; - case kVK_RightControl: return OBS_KEY_CONTROL; - case kVK_RightShift: return OBS_KEY_SHIFT; - case kVK_RightOption: return OBS_KEY_ALT; - case 0x36: return OBS_KEY_META; + case kVK_ANSI_A: + return OBS_KEY_A; + case kVK_ANSI_B: + return OBS_KEY_B; + case kVK_ANSI_C: + return OBS_KEY_C; + case kVK_ANSI_D: + return OBS_KEY_D; + case kVK_ANSI_E: + return OBS_KEY_E; + case kVK_ANSI_F: + return OBS_KEY_F; + case kVK_ANSI_G: + return OBS_KEY_G; + case kVK_ANSI_H: + return OBS_KEY_H; + case kVK_ANSI_I: + return OBS_KEY_I; + case kVK_ANSI_J: + return OBS_KEY_J; + case kVK_ANSI_K: + return OBS_KEY_K; + case kVK_ANSI_L: + return OBS_KEY_L; + case kVK_ANSI_M: + return OBS_KEY_M; + case kVK_ANSI_N: + return OBS_KEY_N; + case kVK_ANSI_O: + return OBS_KEY_O; + case kVK_ANSI_P: + return OBS_KEY_P; + case kVK_ANSI_Q: + return OBS_KEY_Q; + case kVK_ANSI_R: + return OBS_KEY_R; + case kVK_ANSI_S: + return OBS_KEY_S; + case kVK_ANSI_T: + return OBS_KEY_T; + case kVK_ANSI_U: + return OBS_KEY_U; + case kVK_ANSI_V: + return OBS_KEY_V; + case kVK_ANSI_W: + return OBS_KEY_W; + case kVK_ANSI_X: + return OBS_KEY_X; + case kVK_ANSI_Y: + return OBS_KEY_Y; + case kVK_ANSI_Z: + return OBS_KEY_Z; + + case kVK_ANSI_1: + return OBS_KEY_1; + case kVK_ANSI_2: + return OBS_KEY_2; + case kVK_ANSI_3: + return OBS_KEY_3; + case kVK_ANSI_4: + return OBS_KEY_4; + case kVK_ANSI_5: + return OBS_KEY_5; + case kVK_ANSI_6: + return OBS_KEY_6; + case kVK_ANSI_7: + return OBS_KEY_7; + case kVK_ANSI_8: + return OBS_KEY_8; + case kVK_ANSI_9: + return OBS_KEY_9; + case kVK_ANSI_0: + return OBS_KEY_0; + + case kVK_Return: + return OBS_KEY_RETURN; + case kVK_Escape: + return OBS_KEY_ESCAPE; + case kVK_Delete: + return OBS_KEY_BACKSPACE; + case kVK_Tab: + return OBS_KEY_TAB; + case kVK_Space: + return OBS_KEY_SPACE; + case kVK_ANSI_Minus: + return OBS_KEY_MINUS; + case kVK_ANSI_Equal: + return OBS_KEY_EQUAL; + case kVK_ANSI_LeftBracket: + return OBS_KEY_BRACKETLEFT; + case kVK_ANSI_RightBracket: + return OBS_KEY_BRACKETRIGHT; + case kVK_ANSI_Backslash: + return OBS_KEY_BACKSLASH; + case kVK_ANSI_Semicolon: + return OBS_KEY_SEMICOLON; + case kVK_ANSI_Quote: + return OBS_KEY_QUOTE; + case kVK_ANSI_Grave: + return OBS_KEY_DEAD_GRAVE; + case kVK_ANSI_Comma: + return OBS_KEY_COMMA; + case kVK_ANSI_Period: + return OBS_KEY_PERIOD; + case kVK_ANSI_Slash: + return OBS_KEY_SLASH; + case kVK_CapsLock: + return OBS_KEY_CAPSLOCK; + case kVK_ISO_Section: + return OBS_KEY_SECTION; + + case kVK_F1: + return OBS_KEY_F1; + case kVK_F2: + return OBS_KEY_F2; + case kVK_F3: + return OBS_KEY_F3; + case kVK_F4: + return OBS_KEY_F4; + case kVK_F5: + return OBS_KEY_F5; + case kVK_F6: + return OBS_KEY_F6; + case kVK_F7: + return OBS_KEY_F7; + case kVK_F8: + return OBS_KEY_F8; + case kVK_F9: + return OBS_KEY_F9; + case kVK_F10: + return OBS_KEY_F10; + case kVK_F11: + return OBS_KEY_F11; + case kVK_F12: + return OBS_KEY_F12; + + case kVK_Help: + return OBS_KEY_HELP; + case kVK_Home: + return OBS_KEY_HOME; + case kVK_PageUp: + return OBS_KEY_PAGEUP; + case kVK_ForwardDelete: + return OBS_KEY_DELETE; + case kVK_End: + return OBS_KEY_END; + case kVK_PageDown: + return OBS_KEY_PAGEDOWN; + + case kVK_RightArrow: + return OBS_KEY_RIGHT; + case kVK_LeftArrow: + return OBS_KEY_LEFT; + case kVK_DownArrow: + return OBS_KEY_DOWN; + case kVK_UpArrow: + return OBS_KEY_UP; + + case kVK_ANSI_KeypadClear: + return OBS_KEY_CLEAR; + case kVK_ANSI_KeypadDivide: + return OBS_KEY_NUMSLASH; + case kVK_ANSI_KeypadMultiply: + return OBS_KEY_NUMASTERISK; + case kVK_ANSI_KeypadMinus: + return OBS_KEY_NUMMINUS; + case kVK_ANSI_KeypadPlus: + return OBS_KEY_NUMPLUS; + case kVK_ANSI_KeypadEnter: + return OBS_KEY_ENTER; + + case kVK_ANSI_Keypad1: + return OBS_KEY_NUM1; + case kVK_ANSI_Keypad2: + return OBS_KEY_NUM2; + case kVK_ANSI_Keypad3: + return OBS_KEY_NUM3; + case kVK_ANSI_Keypad4: + return OBS_KEY_NUM4; + case kVK_ANSI_Keypad5: + return OBS_KEY_NUM5; + case kVK_ANSI_Keypad6: + return OBS_KEY_NUM6; + case kVK_ANSI_Keypad7: + return OBS_KEY_NUM7; + case kVK_ANSI_Keypad8: + return OBS_KEY_NUM8; + case kVK_ANSI_Keypad9: + return OBS_KEY_NUM9; + case kVK_ANSI_Keypad0: + return OBS_KEY_NUM0; + + case kVK_ANSI_KeypadDecimal: + return OBS_KEY_NUMPERIOD; + case kVK_ANSI_KeypadEquals: + return OBS_KEY_NUMEQUAL; + + case kVK_F13: + return OBS_KEY_F13; + case kVK_F14: + return OBS_KEY_F14; + case kVK_F15: + return OBS_KEY_F15; + case kVK_F16: + return OBS_KEY_F16; + case kVK_F17: + return OBS_KEY_F17; + case kVK_F18: + return OBS_KEY_F18; + case kVK_F19: + return OBS_KEY_F19; + case kVK_F20: + return OBS_KEY_F20; + + case kVK_Control: + return OBS_KEY_CONTROL; + case kVK_Shift: + return OBS_KEY_SHIFT; + case kVK_Option: + return OBS_KEY_ALT; + case kVK_Command: + return OBS_KEY_META; + case kVK_RightControl: + return OBS_KEY_CONTROL; + case kVK_RightShift: + return OBS_KEY_SHIFT; + case kVK_RightOption: + return OBS_KEY_ALT; + case 0x36: + return OBS_KEY_META; case kVK_Function: case kVK_Mute: @@ -1013,24 +1404,25 @@ static inline void load_key(obs_hotkeys_platform_t *plat, IOHIDElementRef key) { - UInt32 usage_code = IOHIDElementGetUsage(key); + UInt32 usage_code = IOHIDElementGetUsage(key); UInt16 carbon_code = usage_to_carbon(usage_code); - if (carbon_code == INVALID_KEY) return; + if (carbon_code == INVALID_KEY) + return; obs_key_t obs_key = obs_key_from_virtual_key(carbon_code); if (obs_key == OBS_KEY_NONE) return; da_push_back(plat->keys[obs_key], &key); - CFRetain(*(IOHIDElementRef*)da_end(plat->keys[obs_key])); + CFRetain(*(IOHIDElementRef *)da_end(plat->keys[obs_key])); } static inline void load_keyboard(obs_hotkeys_platform_t *plat, - IOHIDDeviceRef keyboard) + IOHIDDeviceRef keyboard) { - CFArrayRef keys = IOHIDDeviceCopyMatchingElements(keyboard, NULL, - kIOHIDOptionsTypeNone); + CFArrayRef keys = IOHIDDeviceCopyMatchingElements( + keyboard, NULL, kIOHIDOptionsTypeNone); if (!keys) { blog(LOG_ERROR, "hotkeys-cocoa: Getting keyboard keys failed"); @@ -1061,7 +1453,7 @@ static bool init_keyboard(obs_hotkeys_platform_t *plat) { CFSetRef keyboards = copy_devices(plat, kHIDPage_GenericDesktop, - kHIDUsage_GD_Keyboard); + kHIDUsage_GD_Keyboard); if (!keyboards) return false; @@ -1110,8 +1502,8 @@ static bool log_layout_name(TISInputSourceRef tis) { struct dstr layout_name = {0}; - CFStringRef sid = (CFStringRef)TISGetInputSourceProperty(tis, - kTISPropertyInputSourceID); + CFStringRef sid = (CFStringRef)TISGetInputSourceProperty( + tis, kTISPropertyInputSourceID); if (!sid) { blog(LOG_ERROR, "hotkeys-cocoa: Failed getting InputSourceID"); return false; @@ -1145,9 +1537,9 @@ return false; } - plat->tis = TISCopyCurrentKeyboardLayoutInputSource(); - plat->layout_data = (CFDataRef)TISGetInputSourceProperty(plat->tis, - kTISPropertyUnicodeKeyLayoutData); + plat->tis = TISCopyCurrentKeyboardLayoutInputSource(); + plat->layout_data = (CFDataRef)TISGetInputSourceProperty( + plat->tis, kTISPropertyUnicodeKeyLayoutData); if (!plat->layout_data) { blog(LOG_ERROR, "hotkeys-cocoa: Failed getting LayoutData"); @@ -1155,13 +1547,13 @@ } CFRetain(plat->layout_data); - plat->layout = (UCKeyboardLayout*)CFDataGetBytePtr(plat->layout_data); + plat->layout = (UCKeyboardLayout *)CFDataGetBytePtr(plat->layout_data); - plat->manager = IOHIDManagerCreate(kCFAllocatorDefault, - kIOHIDOptionsTypeNone); + plat->manager = + IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); - IOReturn openStatus = IOHIDManagerOpen(plat->manager, - kIOHIDOptionsTypeNone); + IOReturn openStatus = + IOHIDManagerOpen(plat->manager, kIOHIDOptionsTypeNone); if (openStatus != kIOReturnSuccess) { blog(LOG_ERROR, "hotkeys-cocoa: Failed opening HIDManager"); goto fail; @@ -1178,7 +1570,8 @@ } static void input_method_changed(CFNotificationCenterRef nc, void *observer, - CFStringRef name, const void *object, CFDictionaryRef user_info) + CFStringRef name, const void *object, + CFDictionaryRef user_info) { UNUSED_PARAMETER(nc); UNUSED_PARAMETER(name); @@ -1195,7 +1588,7 @@ plat = hotkeys->platform_context; if (new_plat && plat && - new_plat->layout_data == plat->layout_data) { + new_plat->layout_data == plat->layout_data) { pthread_mutex_unlock(&hotkeys->mutex); hotkeys_release(new_plat); return; @@ -1207,21 +1600,20 @@ pthread_mutex_unlock(&hotkeys->mutex); calldata_t params = {0}; - signal_handler_signal(hotkeys->signals, - "hotkey_layout_change", ¶ms); + signal_handler_signal(hotkeys->signals, "hotkey_layout_change", + ¶ms); if (plat) hotkeys_release(plat); } } - bool obs_hotkeys_platform_init(struct obs_core_hotkeys *hotkeys) { CFNotificationCenterAddObserver( - CFNotificationCenterGetDistributedCenter(), - hotkeys, input_method_changed, - kTISNotifySelectedKeyboardInputSourceChanged, NULL, - CFNotificationSuspensionBehaviorDeliverImmediately); + CFNotificationCenterGetDistributedCenter(), hotkeys, + input_method_changed, + kTISNotifySelectedKeyboardInputSourceChanged, NULL, + CFNotificationSuspensionBehaviorDeliverImmediately); input_method_changed(NULL, hotkeys, NULL, NULL, NULL); return hotkeys->platform_context != NULL; @@ -1230,8 +1622,7 @@ void obs_hotkeys_platform_free(struct obs_core_hotkeys *hotkeys) { CFNotificationCenterRemoveEveryObserver( - CFNotificationCenterGetDistributedCenter(), - hotkeys); + CFNotificationCenterGetDistributedCenter(), hotkeys); hotkeys_release(hotkeys->platform_context); } @@ -1241,36 +1632,39 @@ { int button = 0; switch (key) { -#define MAP_BUTTON(n) case OBS_KEY_MOUSE ## n: button = n - 1; break - MAP_BUTTON(1); - MAP_BUTTON(2); - MAP_BUTTON(3); - MAP_BUTTON(4); - MAP_BUTTON(5); - MAP_BUTTON(6); - MAP_BUTTON(7); - MAP_BUTTON(8); - MAP_BUTTON(9); - MAP_BUTTON(10); - MAP_BUTTON(11); - MAP_BUTTON(12); - MAP_BUTTON(13); - MAP_BUTTON(14); - MAP_BUTTON(15); - MAP_BUTTON(16); - MAP_BUTTON(17); - MAP_BUTTON(18); - MAP_BUTTON(19); - MAP_BUTTON(20); - MAP_BUTTON(21); - MAP_BUTTON(22); - MAP_BUTTON(23); - MAP_BUTTON(24); - MAP_BUTTON(25); - MAP_BUTTON(26); - MAP_BUTTON(27); - MAP_BUTTON(28); - MAP_BUTTON(29); +#define MAP_BUTTON(n) \ + case OBS_KEY_MOUSE##n: \ + button = n - 1; \ + break + MAP_BUTTON(1); + MAP_BUTTON(2); + MAP_BUTTON(3); + MAP_BUTTON(4); + MAP_BUTTON(5); + MAP_BUTTON(6); + MAP_BUTTON(7); + MAP_BUTTON(8); + MAP_BUTTON(9); + MAP_BUTTON(10); + MAP_BUTTON(11); + MAP_BUTTON(12); + MAP_BUTTON(13); + MAP_BUTTON(14); + MAP_BUTTON(15); + MAP_BUTTON(16); + MAP_BUTTON(17); + MAP_BUTTON(18); + MAP_BUTTON(19); + MAP_BUTTON(20); + MAP_BUTTON(21); + MAP_BUTTON(22); + MAP_BUTTON(23); + MAP_BUTTON(24); + MAP_BUTTON(25); + MAP_BUTTON(26); + MAP_BUTTON(27); + MAP_BUTTON(28); + MAP_BUTTON(29); break; #undef MAP_BUTTON @@ -1280,15 +1674,15 @@ Class NSEvent = objc_getClass("NSEvent"); SEL pressedMouseButtons = sel_registerName("pressedMouseButtons"); - NSUInteger buttons = (NSUInteger)objc_msgSend((id)NSEvent, - pressedMouseButtons); + NSUInteger buttons = + (NSUInteger)objc_msgSend((id)NSEvent, pressedMouseButtons); *pressed = (buttons & (1 << button)) != 0; return true; } bool obs_hotkeys_platform_is_pressed(obs_hotkeys_platform_t *plat, - obs_key_t key) + obs_key_t key) { bool mouse_pressed = false; if (mouse_button_pressed(key, &mouse_pressed)) @@ -1302,11 +1696,11 @@ for (size_t i = 0; i < plat->keys[key].num;) { IOHIDElementRef element = plat->keys[key].array[i]; - IOHIDValueRef value = 0; - IOHIDDeviceRef device = IOHIDElementGetDevice(element); - + IOHIDValueRef value = 0; + IOHIDDeviceRef device = IOHIDElementGetDevice(element); + if (IOHIDDeviceGetValue(device, element, &value) != - kIOReturnSuccess) { + kIOReturnSuccess) { i += 1; continue; }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-config.h -> obs-studio-24.0.0.tar.xz/libobs/obs-config.h
Changed
@@ -27,45 +27,42 @@ /* * Increment if major breaking API changes */ -#define LIBOBS_API_MAJOR_VER 23 +#define LIBOBS_API_MAJOR_VER 24 /* * Increment if backward-compatible additions * * Reset to zero each major version */ -#define LIBOBS_API_MINOR_VER 2 +#define LIBOBS_API_MINOR_VER 0 /* * Increment if backward-compatible bug fix * * Reset to zero each major or minor version */ -#define LIBOBS_API_PATCH_VER 1 +#define LIBOBS_API_PATCH_VER 0 #define MAKE_SEMANTIC_VERSION(major, minor, patch) \ - ((major << 24) | \ - (minor << 16) | \ - patch ) + ((major << 24) | (minor << 16) | patch) -#define LIBOBS_API_VER \ - MAKE_SEMANTIC_VERSION(LIBOBS_API_MAJOR_VER, \ - LIBOBS_API_MINOR_VER, \ - LIBOBS_API_PATCH_VER) +#define LIBOBS_API_VER \ + MAKE_SEMANTIC_VERSION(LIBOBS_API_MAJOR_VER, LIBOBS_API_MINOR_VER, \ + LIBOBS_API_PATCH_VER) #ifdef HAVE_OBSCONFIG_H -# include "obsconfig.h" +#include "obsconfig.h" #else -# define OBS_VERSION "unknown" -# define OBS_DATA_PATH "../../data" -# define OBS_INSTALL_PREFIX "" -# define OBS_PLUGIN_DESTINATION "obs-plugins" -# define OBS_RELATIVE_PREFIX "../../" -# define OBS_RELEASE_CANDIDATE_MAJOR 0 -# define OBS_RELEASE_CANDIDATE_MINOR 0 -# define OBS_RELEASE_CANDIDATE_PATCH 0 -# define OBS_RELEASE_CANDIDATE_VER 0 -# define OBS_RELEASE_CANDIDATE 0 +#define OBS_VERSION "unknown" +#define OBS_DATA_PATH "../../data" +#define OBS_INSTALL_PREFIX "" +#define OBS_PLUGIN_DESTINATION "obs-plugins" +#define OBS_RELATIVE_PREFIX "../../" +#define OBS_RELEASE_CANDIDATE_MAJOR 0 +#define OBS_RELEASE_CANDIDATE_MINOR 0 +#define OBS_RELEASE_CANDIDATE_PATCH 0 +#define OBS_RELEASE_CANDIDATE_VER 0 +#define OBS_RELEASE_CANDIDATE 0 #endif #define OBS_INSTALL_DATA_PATH OBS_INSTALL_PREFIX OBS_DATA_PATH
View file
obs-studio-23.2.1.tar.xz/libobs/obs-data.c -> obs-studio-24.0.0.tar.xz/libobs/obs-data.c
Changed
@@ -29,35 +29,35 @@ #include <jansson.h> struct obs_data_item { - volatile long ref; - struct obs_data *parent; + volatile long ref; + struct obs_data *parent; struct obs_data_item *next; - enum obs_data_type type; - size_t name_len; - size_t data_len; - size_t data_size; - size_t default_len; - size_t default_size; - size_t autoselect_size; - size_t capacity; + enum obs_data_type type; + size_t name_len; + size_t data_len; + size_t data_size; + size_t default_len; + size_t default_size; + size_t autoselect_size; + size_t capacity; }; struct obs_data { - volatile long ref; - char *json; + volatile long ref; + char *json; struct obs_data_item *first_item; }; struct obs_data_array { - volatile long ref; - DARRAY(obs_data_t*) objects; + volatile long ref; + DARRAY(obs_data_t *) objects; }; struct obs_data_number { enum obs_data_number_type type; union { long long int_val; - double double_val; + double double_val; }; }; @@ -77,20 +77,20 @@ size_t alignment = base_get_alignment(); size_t total_size; - total_size = sizeof(struct obs_data_item) + (name_size + alignment-1); - total_size &= ~(alignment-1); + total_size = sizeof(struct obs_data_item) + (name_size + alignment - 1); + total_size &= ~(alignment - 1); return total_size - sizeof(struct obs_data_item); } static inline char *get_item_name(struct obs_data_item *item) { - return (char*)item + sizeof(struct obs_data_item); + return (char *)item + sizeof(struct obs_data_item); } static inline void *get_data_ptr(obs_data_item_t *item) { - return (uint8_t*)get_item_name(item) + item->name_len; + return (uint8_t *)get_item_name(item) + item->name_len; } static inline void *get_item_data(struct obs_data_item *item) @@ -102,7 +102,7 @@ static inline void *get_default_data_ptr(obs_data_item_t *item) { - return (uint8_t*)get_data_ptr(item) + item->data_len; + return (uint8_t *)get_data_ptr(item) + item->data_len; } static inline void *get_item_default_data(struct obs_data_item *item) @@ -112,7 +112,7 @@ static inline void *get_autoselect_data_ptr(obs_data_item_t *item) { - return (uint8_t*)get_default_data_ptr(item) + item->default_len; + return (uint8_t *)get_default_data_ptr(item) + item->default_len; } static inline void *get_item_autoselect_data(struct obs_data_item *item) @@ -122,8 +122,8 @@ static inline size_t obs_data_item_total_size(struct obs_data_item *item) { - return sizeof(struct obs_data_item) + item->name_len + - item->data_len + item->default_len + item->autoselect_size; + return sizeof(struct obs_data_item) + item->name_len + item->data_len + + item->default_len + item->autoselect_size; } static inline obs_data_t *get_item_obj(struct obs_data_item *item) @@ -143,7 +143,7 @@ if (!item || !item->default_size) return NULL; - return *(obs_data_t**)get_default_data_ptr(item); + return *(obs_data_t **)get_default_data_ptr(item); } static inline obs_data_t *get_item_autoselect_obj(struct obs_data_item *item) @@ -151,7 +151,7 @@ if (!item || !item->autoselect_size) return NULL; - return *(obs_data_t**)get_autoselect_data_ptr(item); + return *(obs_data_t **)get_autoselect_data_ptr(item); } static inline obs_data_array_t *get_item_array(struct obs_data_item *item) @@ -161,26 +161,26 @@ if (!item) return NULL; - array = (obs_data_array_t**)get_item_data(item); + array = (obs_data_array_t **)get_item_data(item); return array ? *array : NULL; } -static inline obs_data_array_t *get_item_default_array( - struct obs_data_item *item) +static inline obs_data_array_t * +get_item_default_array(struct obs_data_item *item) { if (!item || !item->default_size) return NULL; - return *(obs_data_array_t**)get_default_data_ptr(item); + return *(obs_data_array_t **)get_default_data_ptr(item); } -static inline obs_data_array_t *get_item_autoselect_array( - struct obs_data_item *item) +static inline obs_data_array_t * +get_item_autoselect_array(struct obs_data_item *item) { if (!item || !item->autoselect_size) return NULL; - return *(obs_data_array_t**)get_autoselect_data_ptr(item); + return *(obs_data_array_t **)get_autoselect_data_ptr(item); } static inline void item_data_release(struct obs_data_item *item) @@ -262,8 +262,10 @@ } static struct obs_data_item *obs_data_item_create(const char *name, - const void *data, size_t size, enum obs_data_type type, - bool default_data, bool autoselect_data) + const void *data, size_t size, + enum obs_data_type type, + bool default_data, + bool autoselect_data) { struct obs_data_item *item; size_t name_size, total_size; @@ -277,9 +279,9 @@ item = bzalloc(total_size); item->capacity = total_size; - item->type = type; + item->type = type; item->name_len = name_size; - item->ref = 1; + item->ref = 1; if (default_data) { item->default_len = size; @@ -301,20 +303,20 @@ } static struct obs_data_item **get_item_prev_next(struct obs_data *data, - struct obs_data_item *current) + struct obs_data_item *current) { if (!current || !data) return NULL; struct obs_data_item **prev_next = &data->first_item; - struct obs_data_item *item = data->first_item; + struct obs_data_item *item = data->first_item; while (item) { if (item == current) return prev_next; prev_next = &item->next; - item = item->next; + item = item->next; } return NULL; @@ -322,8 +324,8 @@ static inline void obs_data_item_detach(struct obs_data_item *item) { - struct obs_data_item **prev_next = get_item_prev_next(item->parent, - item); + struct obs_data_item **prev_next = + get_item_prev_next(item->parent, item); if (prev_next) { *prev_next = item->next; @@ -332,17 +334,17 @@ } static inline void obs_data_item_reattach(struct obs_data_item *old_ptr, - struct obs_data_item *new_ptr) + struct obs_data_item *new_ptr) { - struct obs_data_item **prev_next = get_item_prev_next(new_ptr->parent, - old_ptr); + struct obs_data_item **prev_next = + get_item_prev_next(new_ptr->parent, old_ptr); if (prev_next) *prev_next = new_ptr; } -static struct obs_data_item *obs_data_item_ensure_capacity( - struct obs_data_item *item) +static struct obs_data_item * +obs_data_item_ensure_capacity(struct obs_data_item *item) { size_t new_size = obs_data_item_total_size(item); struct obs_data_item *new_item; @@ -367,39 +369,41 @@ } static inline void move_data(obs_data_item_t *old_item, void *old_data, - obs_data_item_t *item, void *data, size_t len) + obs_data_item_t *item, void *data, size_t len) { - ptrdiff_t old_offset = (uint8_t*)old_data - (uint8_t*)old_item; - ptrdiff_t new_offset = (uint8_t*)data - (uint8_t*)item; + ptrdiff_t old_offset = (uint8_t *)old_data - (uint8_t *)old_item; + ptrdiff_t new_offset = (uint8_t *)data - (uint8_t *)item; if (!old_data) return; - memmove((uint8_t*)item + new_offset, (uint8_t*)item + old_offset, len); + memmove((uint8_t *)item + new_offset, (uint8_t *)item + old_offset, + len); } -static inline void obs_data_item_setdata( - struct obs_data_item **p_item, const void *data, size_t size, - enum obs_data_type type) +static inline void obs_data_item_setdata(struct obs_data_item **p_item, + const void *data, size_t size, + enum obs_data_type type) { if (!p_item || !*p_item) return; struct obs_data_item *item = *p_item; ptrdiff_t old_default_data_pos = - (uint8_t*)get_default_data_ptr(item) - (uint8_t*)item; + (uint8_t *)get_default_data_ptr(item) - (uint8_t *)item; item_data_release(item); item->data_size = size; - item->type = type; - item->data_len = (item->default_size || item->autoselect_size) ? - get_align_size(size) : size; + item->type = type; + item->data_len = (item->default_size || item->autoselect_size) + ? get_align_size(size) + : size; item = obs_data_item_ensure_capacity(item); if (item->default_size || item->autoselect_size) memmove(get_default_data_ptr(item), - (uint8_t*)item + old_default_data_pos, - item->default_len + item->autoselect_size); + (uint8_t *)item + old_default_data_pos, + item->default_len + item->autoselect_size); if (size) { memcpy(get_item_data(item), data, size); @@ -409,9 +413,9 @@ *p_item = item; } -static inline void obs_data_item_set_default_data( - struct obs_data_item **p_item, const void *data, size_t size, - enum obs_data_type type) +static inline void obs_data_item_set_default_data(struct obs_data_item **p_item, + const void *data, size_t size, + enum obs_data_type type) { if (!p_item || !*p_item) return; @@ -420,18 +424,15 @@ void *old_autoselect_data = get_autoselect_data_ptr(item); item_default_data_release(item); - item->type = type; + item->type = type; item->default_size = size; - item->default_len = item->autoselect_size ? - get_align_size(size) : size; - item->data_len = item->data_size ? - get_align_size(item->data_size) : 0; + item->default_len = item->autoselect_size ? get_align_size(size) : size; + item->data_len = item->data_size ? get_align_size(item->data_size) : 0; item = obs_data_item_ensure_capacity(item); if (item->autoselect_size) move_data(*p_item, old_autoselect_data, item, - get_autoselect_data_ptr(item), - item->autoselect_size); + get_autoselect_data_ptr(item), item->autoselect_size); if (size) { memcpy(get_item_default_data(item), data, size); @@ -441,9 +442,10 @@ *p_item = item; } -static inline void obs_data_item_set_autoselect_data( - struct obs_data_item **p_item, const void *data, size_t size, - enum obs_data_type type) +static inline void +obs_data_item_set_autoselect_data(struct obs_data_item **p_item, + const void *data, size_t size, + enum obs_data_type type) { if (!p_item || !*p_item) return; @@ -452,11 +454,10 @@ item_autoselect_data_release(item); item->autoselect_size = size; - item->type = type; - item->data_len = item->data_size ? - get_align_size(item->data_size) : 0; - item->default_len = item->default_size ? - get_align_size(item->default_size) : 0; + item->type = type; + item->data_len = item->data_size ? get_align_size(item->data_size) : 0; + item->default_len = + item->default_size ? get_align_size(item->default_size) : 0; item = obs_data_item_ensure_capacity(item); if (size) { @@ -470,7 +471,7 @@ /* ------------------------------------------------------------------------- */ static void obs_data_add_json_item(obs_data_t *data, const char *key, - json_t *json); + json_t *json); static inline void obs_data_add_json_object_data(obs_data_t *data, json_t *jobj) { @@ -483,7 +484,7 @@ } static inline void obs_data_add_json_object(obs_data_t *data, const char *key, - json_t *jobj) + json_t *jobj) { obs_data_t *sub_obj = obs_data_create(); @@ -493,7 +494,7 @@ } static void obs_data_add_json_array(obs_data_t *data, const char *key, - json_t *jarray) + json_t *jarray) { obs_data_array_t *array = obs_data_array_create(); size_t idx; @@ -516,7 +517,7 @@ } static void obs_data_add_json_item(obs_data_t *data, const char *key, - json_t *json) + json_t *json) { if (json_is_object(json)) obs_data_add_json_object(data, key, json); @@ -537,14 +538,14 @@ /* ------------------------------------------------------------------------- */ static inline void set_json_string(json_t *json, const char *name, - obs_data_item_t *item) + obs_data_item_t *item) { const char *val = obs_data_item_get_string(item); json_object_set_new(json, name, json_string(val)); } static inline void set_json_number(json_t *json, const char *name, - obs_data_item_t *item) + obs_data_item_t *item) { enum obs_data_number_type type = obs_data_item_numtype(item); @@ -558,7 +559,7 @@ } static inline void set_json_bool(json_t *json, const char *name, - obs_data_item_t *item) + obs_data_item_t *item) { bool val = obs_data_item_get_bool(item); json_object_set_new(json, name, val ? json_true() : json_false()); @@ -567,7 +568,7 @@ static json_t *obs_data_to_json(obs_data_t *data); static inline void set_json_obj(json_t *json, const char *name, - obs_data_item_t *item) + obs_data_item_t *item) { obs_data_t *obj = obs_data_item_get_obj(item); json_object_set_new(json, name, obs_data_to_json(obj)); @@ -575,15 +576,15 @@ } static inline void set_json_array(json_t *json, const char *name, - obs_data_item_t *item) + obs_data_item_t *item) { - json_t *jarray = json_array(); - obs_data_array_t *array = obs_data_item_get_array(item); - size_t count = obs_data_array_count(array); + json_t *jarray = json_array(); + obs_data_array_t *array = obs_data_item_get_array(item); + size_t count = obs_data_array_count(array); for (size_t idx = 0; idx < count; idx++) { obs_data_t *sub_item = obs_data_array_item(array, idx); - json_t *jitem = obs_data_to_json(sub_item); + json_t *jitem = obs_data_to_json(sub_item); json_array_append_new(jarray, jitem); obs_data_release(sub_item); } @@ -599,7 +600,7 @@ for (item = obs_data_first(data); item; obs_data_item_next(&item)) { enum obs_data_type type = obs_data_item_gettype(item); - const char *name = get_item_name(item); + const char *name = get_item_name(item); if (!obs_data_item_has_user_value(item)) continue; @@ -640,9 +641,10 @@ obs_data_add_json_object_data(data, root); json_decref(root); } else { - blog(LOG_ERROR, "obs-data.c: [obs_data_create_from_json] " - "Failed reading json string (%d): %s", - error.line, error.text); + blog(LOG_ERROR, + "obs-data.c: [obs_data_create_from_json] " + "Failed reading json string (%d): %s", + error.line, error.text); obs_data_release(data); data = NULL; } @@ -664,7 +666,7 @@ } obs_data_t *obs_data_create_from_json_file_safe(const char *json_file, - const char *backup_ext) + const char *backup_ext) { obs_data_t *file_data = obs_data_create_from_json_file(json_file); if (!file_data && backup_ext && *backup_ext) { @@ -676,9 +678,10 @@ dstr_cat(&backup_file, backup_ext); if (os_file_exists(backup_file.array)) { - blog(LOG_WARNING, "obs-data.c: " - "[obs_data_create_from_json_file_safe] " - "attempting backup file"); + blog(LOG_WARNING, + "obs-data.c: " + "[obs_data_create_from_json_file_safe] " + "attempting backup file"); /* delete current file if corrupt to prevent it from * being backed up again */ @@ -716,7 +719,8 @@ void obs_data_release(obs_data_t *data) { - if (!data) return; + if (!data) + return; if (os_atomic_dec_long(&data->ref) == 0) obs_data_destroy(data); @@ -724,7 +728,8 @@ const char *obs_data_get_json(obs_data_t *data) { - if (!data) return NULL; + if (!data) + return NULL; /* NOTE: don't use libobs bfree for json text */ free(data->json); @@ -743,20 +748,20 @@ if (json && *json) { return os_quick_write_utf8_file(file, json, strlen(json), - false); + false); } return false; } bool obs_data_save_json_safe(obs_data_t *data, const char *file, - const char *temp_ext, const char *backup_ext) + const char *temp_ext, const char *backup_ext) { const char *json = obs_data_get_json(data); if (json && *json) { - return os_quick_write_utf8_file_safe(file, json, strlen(json), - false, temp_ext, backup_ext); + return os_quick_write_utf8_file_safe( + file, json, strlen(json), false, temp_ext, backup_ext); } return false; @@ -764,7 +769,8 @@ static struct obs_data_item *get_item(struct obs_data *data, const char *name) { - if (!data) return NULL; + if (!data) + return NULL; struct obs_data_item *item = data->first_item; @@ -779,33 +785,33 @@ } static void set_item_data(struct obs_data *data, struct obs_data_item **item, - const char *name, const void *ptr, size_t size, - enum obs_data_type type, - bool default_data, bool autoselect_data) + const char *name, const void *ptr, size_t size, + enum obs_data_type type, bool default_data, + bool autoselect_data) { obs_data_item_t *new_item = NULL; if ((!item || (item && !*item)) && data) { new_item = obs_data_item_create(name, ptr, size, type, - default_data, autoselect_data); + default_data, autoselect_data); obs_data_item_t *prev = obs_data_first(data); obs_data_item_t *next = obs_data_first(data); obs_data_item_next(&next); - for (; prev && next; obs_data_item_next(&prev), - obs_data_item_next(&next)) { + for (; prev && next; + obs_data_item_next(&prev), obs_data_item_next(&next)) { if (strcmp(get_item_name(next), name) > 0) break; } new_item->parent = data; if (prev && strcmp(get_item_name(prev), name) < 0) { - prev->next = new_item; + prev->next = new_item; new_item->next = next; } else { data->first_item = new_item; - new_item->next = prev; + new_item->next = prev; } if (!prev) @@ -824,8 +830,8 @@ } static inline void set_item(struct obs_data *data, obs_data_item_t **item, - const char *name, - const void *ptr, size_t size, enum obs_data_type type) + const char *name, const void *ptr, size_t size, + enum obs_data_type type) { obs_data_item_t *actual_item = NULL; @@ -841,8 +847,8 @@ } static inline void set_item_def(struct obs_data *data, obs_data_item_t **item, - const char *name, - const void *ptr, size_t size, enum obs_data_type type) + const char *name, const void *ptr, size_t size, + enum obs_data_type type) { obs_data_item_t *actual_item = NULL; @@ -861,8 +867,8 @@ } static inline void set_item_auto(struct obs_data *data, obs_data_item_t **item, - const char *name, - const void *ptr, size_t size, enum obs_data_type type) + const char *name, const void *ptr, size_t size, + enum obs_data_type type) { obs_data_item_t *actual_item = NULL; @@ -878,8 +884,8 @@ } static void copy_obj(struct obs_data *data, const char *name, - struct obs_data *obj, - void (*callback)(obs_data_t *, const char *, obs_data_t *)) + struct obs_data *obj, + void (*callback)(obs_data_t *, const char *, obs_data_t *)) { if (obj) { obs_data_t *new_obj = obs_data_create(); @@ -890,8 +896,9 @@ } static void copy_array(struct obs_data *data, const char *name, - struct obs_data_array *array, - void (*callback)(obs_data_t*, const char*, obs_data_array_t*)) + struct obs_data_array *array, + void (*callback)(obs_data_t *, const char *, + obs_data_array_t *)) { if (array) { obs_data_array_t *new_array = obs_data_array_create(); @@ -932,7 +939,7 @@ } else { if (item->data_size) set_item(data, NULL, name, ptr, item->data_size, - item->type); + item->type); } } @@ -982,7 +989,7 @@ size = item->default_len + item->autoselect_size; if (size) - memmove(ptr, (uint8_t*)ptr + item->data_len, size); + memmove(ptr, (uint8_t *)ptr + item->data_len, size); item->data_size = 0; item->data_len = 0; @@ -1004,63 +1011,66 @@ } } -typedef void (*set_item_t)(obs_data_t*, obs_data_item_t**, const char*, - const void*, size_t, enum obs_data_type); +typedef void (*set_item_t)(obs_data_t *, obs_data_item_t **, const char *, + const void *, size_t, enum obs_data_type); static inline void obs_set_string(obs_data_t *data, obs_data_item_t **item, - const char *name, - const char *val, set_item_t set_item_) + const char *name, const char *val, + set_item_t set_item_) { - if (!val) val = ""; - set_item_(data, item, name, val, strlen(val)+1, OBS_DATA_STRING); + if (!val) + val = ""; + set_item_(data, item, name, val, strlen(val) + 1, OBS_DATA_STRING); } static inline void obs_set_int(obs_data_t *data, obs_data_item_t **item, - const char *name, - long long val, set_item_t set_item_) + const char *name, long long val, + set_item_t set_item_) { struct obs_data_number num; - num.type = OBS_DATA_NUM_INT; + num.type = OBS_DATA_NUM_INT; num.int_val = val; set_item_(data, item, name, &num, sizeof(struct obs_data_number), - OBS_DATA_NUMBER); + OBS_DATA_NUMBER); } static inline void obs_set_double(obs_data_t *data, obs_data_item_t **item, - const char *name, - double val, set_item_t set_item_) + const char *name, double val, + set_item_t set_item_) { struct obs_data_number num; - num.type = OBS_DATA_NUM_DOUBLE; + num.type = OBS_DATA_NUM_DOUBLE; num.double_val = val; set_item_(data, item, name, &num, sizeof(struct obs_data_number), - OBS_DATA_NUMBER); + OBS_DATA_NUMBER); } static inline void obs_set_bool(obs_data_t *data, obs_data_item_t **item, - const char *name, - bool val, set_item_t set_item_) + const char *name, bool val, + set_item_t set_item_) { set_item_(data, item, name, &val, sizeof(bool), OBS_DATA_BOOLEAN); } static inline void obs_set_obj(obs_data_t *data, obs_data_item_t **item, - const char *name, - obs_data_t *obj, set_item_t set_item_) + const char *name, obs_data_t *obj, + set_item_t set_item_) { - set_item_(data, item, name, &obj, sizeof(obs_data_t*), OBS_DATA_OBJECT); + set_item_(data, item, name, &obj, sizeof(obs_data_t *), + OBS_DATA_OBJECT); } static inline void obs_set_array(obs_data_t *data, obs_data_item_t **item, - const char *name, - obs_data_array_t *array, set_item_t set_item_) + const char *name, obs_data_array_t *array, + set_item_t set_item_) { - set_item_(data, item, name, &array, sizeof(obs_data_t*), OBS_DATA_ARRAY); + set_item_(data, item, name, &array, sizeof(obs_data_t *), + OBS_DATA_ARRAY); } static inline void obs_take_obj(obs_data_t *data, obs_data_item_t **item, - const char *name, - obs_data_t *obj, set_item_t set_item_) + const char *name, obs_data_t *obj, + set_item_t set_item_) { obs_set_obj(data, item, name, obj, set_item_); obs_data_release(obj); @@ -1092,13 +1102,13 @@ } void obs_data_set_array(obs_data_t *data, const char *name, - obs_data_array_t *array) + obs_data_array_t *array) { obs_set_array(data, NULL, name, array, set_item); } void obs_data_set_default_string(obs_data_t *data, const char *name, - const char *val) + const char *val) { obs_set_string(data, NULL, name, val, set_item_def); } @@ -1118,25 +1128,26 @@ obs_set_bool(data, NULL, name, val, set_item_def); } -void obs_data_set_default_obj(obs_data_t *data, const char *name, obs_data_t *obj) +void obs_data_set_default_obj(obs_data_t *data, const char *name, + obs_data_t *obj) { obs_set_obj(data, NULL, name, obj, set_item_def); } void obs_data_set_autoselect_string(obs_data_t *data, const char *name, - const char *val) + const char *val) { obs_set_string(data, NULL, name, val, set_item_auto); } void obs_data_set_autoselect_int(obs_data_t *data, const char *name, - long long val) + long long val) { obs_set_int(data, NULL, name, val, set_item_auto); } void obs_data_set_autoselect_double(obs_data_t *data, const char *name, - double val) + double val) { obs_set_double(data, NULL, name, val, set_item_auto); } @@ -1147,13 +1158,13 @@ } void obs_data_set_autoselect_obj(obs_data_t *data, const char *name, - obs_data_t *obj) + obs_data_t *obj) { obs_set_obj(data, NULL, name, obj, set_item_auto); } void obs_data_set_autoselect_array(obs_data_t *data, const char *name, - obs_data_array_t *arr) + obs_data_array_t *arr) { obs_set_array(data, NULL, name, arr, set_item_auto); } @@ -1244,7 +1255,7 @@ } obs_data_array_t *obs_data_get_autoselect_array(obs_data_t *data, - const char *name) + const char *name) { return obs_data_item_get_autoselect_array(get_item(data, name)); } @@ -1320,7 +1331,7 @@ } void obs_data_array_push_back_array(obs_data_array_t *array, - obs_data_array_t *array2) + obs_data_array_t *array2) { if (!array || !array2) return; @@ -1404,8 +1415,8 @@ if (item->default_size || item->autoselect_size) move_data(item, old_non_user_data, item, - get_default_data_ptr(item), - item->default_len + item->autoselect_size); + get_default_data_ptr(item), + item->default_len + item->autoselect_size); } void obs_data_item_unset_default_value(obs_data_item_t *item) @@ -1421,8 +1432,7 @@ if (item->autoselect_size) move_data(item, old_autoselect_data, item, - get_autoselect_data_ptr(item), - item->autoselect_size); + get_autoselect_data_ptr(item), item->autoselect_size); } void obs_data_item_unset_autoselect_value(obs_data_item_t *item) @@ -1574,12 +1584,13 @@ } void obs_data_item_set_default_array(obs_data_item_t **item, - obs_data_array_t *val) + obs_data_array_t *val) { obs_set_array(NULL, item, NULL, val, set_item_def); } -void obs_data_item_set_autoselect_string(obs_data_item_t **item, const char *val) +void obs_data_item_set_autoselect_string(obs_data_item_t **item, + const char *val) { obs_set_string(NULL, item, NULL, val, set_item_auto); } @@ -1605,90 +1616,94 @@ } void obs_data_item_set_autoselect_array(obs_data_item_t **item, - obs_data_array_t *val) + obs_data_array_t *val) { obs_set_array(NULL, item, NULL, val, set_item_auto); } static inline bool item_valid(struct obs_data_item *item, - enum obs_data_type type) + enum obs_data_type type) { return item && item->type == type; } -typedef void *(*get_data_t)(obs_data_item_t*); +typedef void *(*get_data_t)(obs_data_item_t *); static inline const char *data_item_get_string(obs_data_item_t *item, - get_data_t get_data) + get_data_t get_data) { - return item_valid(item, OBS_DATA_STRING) && get_data(item) ? - get_data(item) : ""; + return item_valid(item, OBS_DATA_STRING) && get_data(item) + ? get_data(item) + : ""; } static inline long long item_int(struct obs_data_item *item, - get_data_t get_data) + get_data_t get_data) { if (item && get_data(item)) { struct obs_data_number *num = get_data(item); - return (num->type == OBS_DATA_NUM_INT) ? - num->int_val : (long long)num->double_val; + return (num->type == OBS_DATA_NUM_INT) + ? num->int_val + : (long long)num->double_val; } return 0; } static inline long long data_item_get_int(obs_data_item_t *item, - get_data_t get_data) + get_data_t get_data) { return item_int(item_valid(item, OBS_DATA_NUMBER) ? item : NULL, get_data); } static inline double item_double(struct obs_data_item *item, - get_data_t get_data) + get_data_t get_data) { if (item && get_data(item)) { struct obs_data_number *num = get_data(item); - return (num->type == OBS_DATA_NUM_INT) ? - (double)num->int_val : num->double_val; + return (num->type == OBS_DATA_NUM_INT) ? (double)num->int_val + : num->double_val; } return 0.0; } static inline double data_item_get_double(obs_data_item_t *item, - get_data_t get_data) + get_data_t get_data) { return item_double(item_valid(item, OBS_DATA_NUMBER) ? item : NULL, - get_data); + get_data); } -static inline bool data_item_get_bool(obs_data_item_t *item, get_data_t get_data) +static inline bool data_item_get_bool(obs_data_item_t *item, + get_data_t get_data) { - return item_valid(item, OBS_DATA_BOOLEAN) && get_data(item) ? - *(bool*)get_data(item) : false; + return item_valid(item, OBS_DATA_BOOLEAN) && get_data(item) + ? *(bool *)get_data(item) + : false; } -typedef obs_data_t *(*get_obj_t)(obs_data_item_t*); +typedef obs_data_t *(*get_obj_t)(obs_data_item_t *); static inline obs_data_t *data_item_get_obj(obs_data_item_t *item, - get_obj_t get_obj) + get_obj_t get_obj) { - obs_data_t *obj = item_valid(item, OBS_DATA_OBJECT) ? - get_obj(item) : NULL; + obs_data_t *obj = item_valid(item, OBS_DATA_OBJECT) ? get_obj(item) + : NULL; if (obj) os_atomic_inc_long(&obj->ref); return obj; } -typedef obs_data_array_t *(*get_array_t)(obs_data_item_t*); +typedef obs_data_array_t *(*get_array_t)(obs_data_item_t *); static inline obs_data_array_t *data_item_get_array(obs_data_item_t *item, - get_array_t get_array) + get_array_t get_array) { - obs_data_array_t *array = item_valid(item, OBS_DATA_ARRAY) ? - get_array(item) : NULL; + obs_data_array_t *array = + item_valid(item, OBS_DATA_ARRAY) ? get_array(item) : NULL; if (array) os_atomic_inc_long(&array->ref); @@ -1788,10 +1803,10 @@ /* ------------------------------------------------------------------------- */ /* Helper functions for certain structures */ -typedef void (*set_obj_t)(obs_data_t*, const char*, obs_data_t*); +typedef void (*set_obj_t)(obs_data_t *, const char *, obs_data_t *); static inline void set_vec2(obs_data_t *data, const char *name, - const struct vec2 *val, set_obj_t set_obj) + const struct vec2 *val, set_obj_t set_obj) { obs_data_t *obj = obs_data_create(); obs_data_set_double(obj, "x", val->x); @@ -1801,7 +1816,7 @@ } static inline void set_vec3(obs_data_t *data, const char *name, - const struct vec3 *val, set_obj_t set_obj) + const struct vec3 *val, set_obj_t set_obj) { obs_data_t *obj = obs_data_create(); obs_data_set_double(obj, "x", val->x); @@ -1812,7 +1827,7 @@ } static inline void set_vec4(obs_data_t *data, const char *name, - const struct vec4 *val, set_obj_t set_obj) + const struct vec4 *val, set_obj_t set_obj) { obs_data_t *obj = obs_data_create(); obs_data_set_double(obj, "x", val->x); @@ -1824,7 +1839,7 @@ } static inline void set_quat(obs_data_t *data, const char *name, - const struct quat *val, set_obj_t set_obj) + const struct quat *val, set_obj_t set_obj) { obs_data_t *obj = obs_data_create(); obs_data_set_double(obj, "x", val->x); @@ -1836,80 +1851,81 @@ } void obs_data_set_vec2(obs_data_t *data, const char *name, - const struct vec2 *val) + const struct vec2 *val) { set_vec2(data, name, val, obs_data_set_obj); } void obs_data_set_vec3(obs_data_t *data, const char *name, - const struct vec3 *val) + const struct vec3 *val) { set_vec3(data, name, val, obs_data_set_obj); } void obs_data_set_vec4(obs_data_t *data, const char *name, - const struct vec4 *val) + const struct vec4 *val) { set_vec4(data, name, val, obs_data_set_obj); } void obs_data_set_quat(obs_data_t *data, const char *name, - const struct quat *val) + const struct quat *val) { set_quat(data, name, val, obs_data_set_obj); } void obs_data_set_default_vec2(obs_data_t *data, const char *name, - const struct vec2 *val) + const struct vec2 *val) { set_vec2(data, name, val, obs_data_set_default_obj); } void obs_data_set_default_vec3(obs_data_t *data, const char *name, - const struct vec3 *val) + const struct vec3 *val) { set_vec3(data, name, val, obs_data_set_default_obj); } void obs_data_set_default_vec4(obs_data_t *data, const char *name, - const struct vec4 *val) + const struct vec4 *val) { set_vec4(data, name, val, obs_data_set_default_obj); } void obs_data_set_default_quat(obs_data_t *data, const char *name, - const struct quat *val) + const struct quat *val) { set_quat(data, name, val, obs_data_set_default_obj); } void obs_data_set_autoselect_vec2(obs_data_t *data, const char *name, - const struct vec2 *val) + const struct vec2 *val) { set_vec2(data, name, val, obs_data_set_autoselect_obj); } void obs_data_set_autoselect_vec3(obs_data_t *data, const char *name, - const struct vec3 *val) + const struct vec3 *val) { set_vec3(data, name, val, obs_data_set_autoselect_obj); } void obs_data_set_autoselect_vec4(obs_data_t *data, const char *name, - const struct vec4 *val) + const struct vec4 *val) { set_vec4(data, name, val, obs_data_set_autoselect_obj); } void obs_data_set_autoselect_quat(obs_data_t *data, const char *name, - const struct quat *val) + const struct quat *val) { set_quat(data, name, val, obs_data_set_autoselect_obj); } static inline void get_vec2(obs_data_t *obj, struct vec2 *val) { - if (!obj) return; + if (!obj) + return; val->x = (float)obs_data_get_double(obj, "x"); val->y = (float)obs_data_get_double(obj, "y"); @@ -1918,7 +1934,8 @@ static inline void get_vec3(obs_data_t *obj, struct vec3 *val) { - if (!obj) return; + if (!obj) + return; val->x = (float)obs_data_get_double(obj, "x"); val->y = (float)obs_data_get_double(obj, "y"); @@ -1928,7 +1945,8 @@ static inline void get_vec4(obs_data_t *obj, struct vec4 *val) { - if (!obj) return; + if (!obj) + return; val->x = (float)obs_data_get_double(obj, "x"); val->y = (float)obs_data_get_double(obj, "y"); @@ -1939,7 +1957,8 @@ static inline void get_quat(obs_data_t *obj, struct quat *val) { - if (!obj) return; + if (!obj) + return; val->x = (float)obs_data_get_double(obj, "x"); val->y = (float)obs_data_get_double(obj, "y"); @@ -1969,49 +1988,49 @@ } void obs_data_get_default_vec2(obs_data_t *data, const char *name, - struct vec2 *val) + struct vec2 *val) { get_vec2(obs_data_get_default_obj(data, name), val); } void obs_data_get_default_vec3(obs_data_t *data, const char *name, - struct vec3 *val) + struct vec3 *val) { get_vec3(obs_data_get_default_obj(data, name), val); } void obs_data_get_default_vec4(obs_data_t *data, const char *name, - struct vec4 *val) + struct vec4 *val) { get_vec4(obs_data_get_default_obj(data, name), val); } void obs_data_get_default_quat(obs_data_t *data, const char *name, - struct quat *val) + struct quat *val) { get_quat(obs_data_get_default_obj(data, name), val); } void obs_data_get_autoselect_vec2(obs_data_t *data, const char *name, - struct vec2 *val) + struct vec2 *val) { get_vec2(obs_data_get_autoselect_obj(data, name), val); } void obs_data_get_autoselect_vec3(obs_data_t *data, const char *name, - struct vec3 *val) + struct vec3 *val) { get_vec3(obs_data_get_autoselect_obj(data, name), val); } void obs_data_get_autoselect_vec4(obs_data_t *data, const char *name, - struct vec4 *val) + struct vec4 *val) { get_vec4(obs_data_get_autoselect_obj(data, name), val); } void obs_data_get_autoselect_quat(obs_data_t *data, const char *name, - struct quat *val) + struct quat *val) { get_quat(obs_data_get_autoselect_obj(data, name), val); } @@ -2019,9 +2038,8 @@ /* ------------------------------------------------------------------------- */ /* Helper functions for media_frames_per_seconds */ -static inline obs_data_t *make_frames_per_second( - struct media_frames_per_second fps, - const char *option) +static inline obs_data_t * +make_frames_per_second(struct media_frames_per_second fps, const char *option) { obs_data_t *obj = obs_data_create(); @@ -2037,33 +2055,37 @@ } void obs_data_set_frames_per_second(obs_data_t *data, const char *name, - struct media_frames_per_second fps, const char *option) + struct media_frames_per_second fps, + const char *option) { obs_take_obj(data, NULL, name, make_frames_per_second(fps, option), - set_item); + set_item); } void obs_data_set_default_frames_per_second(obs_data_t *data, const char *name, - struct media_frames_per_second fps, const char *option) + struct media_frames_per_second fps, + const char *option) { obs_take_obj(data, NULL, name, make_frames_per_second(fps, option), - set_item_def); + set_item_def); } -void obs_data_set_autoselect_frames_per_second(obs_data_t *data, - const char *name, struct media_frames_per_second fps, - const char *option) +void obs_data_set_autoselect_frames_per_second( + obs_data_t *data, const char *name, struct media_frames_per_second fps, + const char *option) { obs_take_obj(data, NULL, name, make_frames_per_second(fps, option), - set_item_auto); + set_item_auto); } static inline bool get_option(obs_data_t *data, const char **option) { - if (!option) return false; + if (!option) + return false; struct obs_data_item *opt = obs_data_item_byname(data, "option"); - if (!opt) return false; + if (!opt) + return false; *option = obs_data_item_get_string(opt); obs_data_item_release(&opt); @@ -2076,14 +2098,17 @@ #define CLAMP(x, min, max) ((x) < min ? min : ((x) > max ? max : (x))) static inline bool get_frames_per_second(obs_data_t *data, - struct media_frames_per_second *fps, - const char **option) + struct media_frames_per_second *fps, + const char **option) { - if (!data) return false; + if (!data) + return false; - if (get_option(data, option)) return true; + if (get_option(data, option)) + return true; - if (!fps) goto free; + if (!fps) + goto free; struct obs_data_item *num = obs_data_item_byname(data, "numerator"); struct obs_data_item *den = obs_data_item_byname(data, "denominator"); @@ -2096,7 +2121,7 @@ long long num_ll = obs_data_item_get_int(num); long long den_ll = obs_data_item_get_int(den); - fps->numerator = (uint32_t)CLAMP(num_ll, 0, (long long)UINT32_MAX); + fps->numerator = (uint32_t)CLAMP(num_ll, 0, (long long)UINT32_MAX); fps->denominator = (uint32_t)CLAMP(den_ll, 0, (long long)UINT32_MAX); obs_data_item_release(&num); @@ -2112,64 +2137,71 @@ } bool obs_data_get_frames_per_second(obs_data_t *data, const char *name, - struct media_frames_per_second *fps, const char **option) + struct media_frames_per_second *fps, + const char **option) { return get_frames_per_second(obs_data_get_obj(data, name), fps, option); } bool obs_data_get_default_frames_per_second(obs_data_t *data, const char *name, - struct media_frames_per_second *fps, const char **option) + struct media_frames_per_second *fps, + const char **option) { - return get_frames_per_second(obs_data_get_default_obj(data, name), - fps, option); + return get_frames_per_second(obs_data_get_default_obj(data, name), fps, + option); } -bool obs_data_get_autoselect_frames_per_second(obs_data_t *data, - const char *name, struct media_frames_per_second *fps, - const char **option) +bool obs_data_get_autoselect_frames_per_second( + obs_data_t *data, const char *name, struct media_frames_per_second *fps, + const char **option) { return get_frames_per_second(obs_data_get_autoselect_obj(data, name), - fps, option); + fps, option); } void obs_data_item_set_frames_per_second(obs_data_item_t **item, - struct media_frames_per_second fps, const char *option) + struct media_frames_per_second fps, + const char *option) { obs_take_obj(NULL, item, NULL, make_frames_per_second(fps, option), - set_item); + set_item); } -void obs_data_item_set_default_frames_per_second(obs_data_item_t **item, - struct media_frames_per_second fps, const char *option) +void obs_data_item_set_default_frames_per_second( + obs_data_item_t **item, struct media_frames_per_second fps, + const char *option) { obs_take_obj(NULL, item, NULL, make_frames_per_second(fps, option), - set_item_def); + set_item_def); } -void obs_data_item_set_autoselect_frames_per_second(obs_data_item_t **item, - struct media_frames_per_second fps, const char *option) +void obs_data_item_set_autoselect_frames_per_second( + obs_data_item_t **item, struct media_frames_per_second fps, + const char *option) { obs_take_obj(NULL, item, NULL, make_frames_per_second(fps, option), - set_item_auto); + set_item_auto); } bool obs_data_item_get_frames_per_second(obs_data_item_t *item, - struct media_frames_per_second *fps, const char **option) + struct media_frames_per_second *fps, + const char **option) { - return get_frames_per_second(obs_data_item_get_obj(item), - fps, option); + return get_frames_per_second(obs_data_item_get_obj(item), fps, option); } -bool obs_data_item_get_default_frames_per_second(obs_data_item_t *item, - struct media_frames_per_second *fps, const char **option) +bool obs_data_item_get_default_frames_per_second( + obs_data_item_t *item, struct media_frames_per_second *fps, + const char **option) { - return get_frames_per_second(obs_data_item_get_default_obj(item), - fps, option); + return get_frames_per_second(obs_data_item_get_default_obj(item), fps, + option); } -bool obs_data_item_get_autoselect_frames_per_second(obs_data_item_t *item, - struct media_frames_per_second *fps, const char **option) +bool obs_data_item_get_autoselect_frames_per_second( + obs_data_item_t *item, struct media_frames_per_second *fps, + const char **option) { return get_frames_per_second(obs_data_item_get_autoselect_obj(item), - fps, option); + fps, option); }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-data.h -> obs-studio-24.0.0.tar.xz/libobs/obs-data.h
Changed
@@ -39,8 +39,8 @@ struct obs_data; struct obs_data_item; struct obs_data_array; -typedef struct obs_data obs_data_t; -typedef struct obs_data_item obs_data_item_t; +typedef struct obs_data obs_data_t; +typedef struct obs_data_item obs_data_item_t; typedef struct obs_data_array obs_data_array_t; enum obs_data_type { @@ -65,14 +65,15 @@ EXPORT obs_data_t *obs_data_create_from_json(const char *json_string); EXPORT obs_data_t *obs_data_create_from_json_file(const char *json_file); EXPORT obs_data_t *obs_data_create_from_json_file_safe(const char *json_file, - const char *backup_ext); + const char *backup_ext); EXPORT void obs_data_addref(obs_data_t *data); EXPORT void obs_data_release(obs_data_t *data); EXPORT const char *obs_data_get_json(obs_data_t *data); EXPORT bool obs_data_save_json(obs_data_t *data, const char *file); EXPORT bool obs_data_save_json_safe(obs_data_t *data, const char *file, - const char *temp_ext, const char *backup_ext); + const char *temp_ext, + const char *backup_ext); EXPORT void obs_data_apply(obs_data_t *target, obs_data_t *apply_data); @@ -81,28 +82,28 @@ /* Set functions */ EXPORT void obs_data_set_string(obs_data_t *data, const char *name, - const char *val); -EXPORT void obs_data_set_int(obs_data_t *data, const char *name, - long long val); + const char *val); +EXPORT void obs_data_set_int(obs_data_t *data, const char *name, long long val); EXPORT void obs_data_set_double(obs_data_t *data, const char *name, double val); EXPORT void obs_data_set_bool(obs_data_t *data, const char *name, bool val); -EXPORT void obs_data_set_obj(obs_data_t *data, const char *name, obs_data_t *obj); +EXPORT void obs_data_set_obj(obs_data_t *data, const char *name, + obs_data_t *obj); EXPORT void obs_data_set_array(obs_data_t *data, const char *name, - obs_data_array_t *array); + obs_data_array_t *array); /* * Default value functions. */ EXPORT void obs_data_set_default_string(obs_data_t *data, const char *name, - const char *val); + const char *val); EXPORT void obs_data_set_default_int(obs_data_t *data, const char *name, - long long val); + long long val); EXPORT void obs_data_set_default_double(obs_data_t *data, const char *name, - double val); + double val); EXPORT void obs_data_set_default_bool(obs_data_t *data, const char *name, - bool val); + bool val); EXPORT void obs_data_set_default_obj(obs_data_t *data, const char *name, - obs_data_t *obj); + obs_data_t *obj); /* * Application overrides @@ -110,15 +111,15 @@ * settings aren't appropriate */ EXPORT void obs_data_set_autoselect_string(obs_data_t *data, const char *name, - const char *val); + const char *val); EXPORT void obs_data_set_autoselect_int(obs_data_t *data, const char *name, - long long val); + long long val); EXPORT void obs_data_set_autoselect_double(obs_data_t *data, const char *name, - double val); + double val); EXPORT void obs_data_set_autoselect_bool(obs_data_t *data, const char *name, - bool val); + bool val); EXPORT void obs_data_set_autoselect_obj(obs_data_t *data, const char *name, - obs_data_t *obj); + obs_data_t *obj); /* * Get functions @@ -131,23 +132,25 @@ EXPORT obs_data_array_t *obs_data_get_array(obs_data_t *data, const char *name); EXPORT const char *obs_data_get_default_string(obs_data_t *data, - const char *name); + const char *name); EXPORT long long obs_data_get_default_int(obs_data_t *data, const char *name); EXPORT double obs_data_get_default_double(obs_data_t *data, const char *name); EXPORT bool obs_data_get_default_bool(obs_data_t *data, const char *name); EXPORT obs_data_t *obs_data_get_default_obj(obs_data_t *data, const char *name); EXPORT obs_data_array_t *obs_data_get_default_array(obs_data_t *data, - const char *name); + const char *name); EXPORT const char *obs_data_get_autoselect_string(obs_data_t *data, - const char *name); -EXPORT long long obs_data_get_autoselect_int(obs_data_t *data, const char *name); -EXPORT double obs_data_get_autoselect_double(obs_data_t *data, const char *name); + const char *name); +EXPORT long long obs_data_get_autoselect_int(obs_data_t *data, + const char *name); +EXPORT double obs_data_get_autoselect_double(obs_data_t *data, + const char *name); EXPORT bool obs_data_get_autoselect_bool(obs_data_t *data, const char *name); EXPORT obs_data_t *obs_data_get_autoselect_obj(obs_data_t *data, - const char *name); + const char *name); EXPORT obs_data_array_t *obs_data_get_autoselect_array(obs_data_t *data, - const char *name); + const char *name); /* Array functions */ EXPORT obs_data_array_t *obs_data_array_create(); @@ -156,11 +159,12 @@ EXPORT size_t obs_data_array_count(obs_data_array_t *array); EXPORT obs_data_t *obs_data_array_item(obs_data_array_t *array, size_t idx); -EXPORT size_t obs_data_array_push_back(obs_data_array_t *array, obs_data_t *obj); +EXPORT size_t obs_data_array_push_back(obs_data_array_t *array, + obs_data_t *obj); EXPORT void obs_data_array_insert(obs_data_array_t *array, size_t idx, - obs_data_t *obj); + obs_data_t *obj); EXPORT void obs_data_array_push_back_array(obs_data_array_t *array, - obs_data_array_t *array2); + obs_data_array_t *array2); EXPORT void obs_data_array_erase(obs_data_array_t *array, size_t idx); /* ------------------------------------------------------------------------- */ @@ -189,7 +193,8 @@ /* Item iteration */ EXPORT obs_data_item_t *obs_data_first(obs_data_t *data); -EXPORT obs_data_item_t *obs_data_item_byname(obs_data_t *data, const char *name); +EXPORT obs_data_item_t *obs_data_item_byname(obs_data_t *data, + const char *name); EXPORT bool obs_data_item_next(obs_data_item_t **item); EXPORT void obs_data_item_release(obs_data_item_t **item); EXPORT void obs_data_item_remove(obs_data_item_t **item); @@ -206,29 +211,31 @@ EXPORT void obs_data_item_set_bool(obs_data_item_t **item, bool val); EXPORT void obs_data_item_set_obj(obs_data_item_t **item, obs_data_t *val); EXPORT void obs_data_item_set_array(obs_data_item_t **item, - obs_data_array_t *val); + obs_data_array_t *val); EXPORT void obs_data_item_set_default_string(obs_data_item_t **item, - const char *val); -EXPORT void obs_data_item_set_default_int(obs_data_item_t **item, long long val); -EXPORT void obs_data_item_set_default_double(obs_data_item_t **item, double val); + const char *val); +EXPORT void obs_data_item_set_default_int(obs_data_item_t **item, + long long val); +EXPORT void obs_data_item_set_default_double(obs_data_item_t **item, + double val); EXPORT void obs_data_item_set_default_bool(obs_data_item_t **item, bool val); EXPORT void obs_data_item_set_default_obj(obs_data_item_t **item, - obs_data_t *val); + obs_data_t *val); EXPORT void obs_data_item_set_default_array(obs_data_item_t **item, - obs_data_array_t *val); + obs_data_array_t *val); EXPORT void obs_data_item_set_autoselect_string(obs_data_item_t **item, - const char *val); + const char *val); EXPORT void obs_data_item_set_autoselect_int(obs_data_item_t **item, - long long val); + long long val); EXPORT void obs_data_item_set_autoselect_double(obs_data_item_t **item, - double val); + double val); EXPORT void obs_data_item_set_autoselect_bool(obs_data_item_t **item, bool val); EXPORT void obs_data_item_set_autoselect_obj(obs_data_item_t **item, - obs_data_t *val); + obs_data_t *val); EXPORT void obs_data_item_set_autoselect_array(obs_data_item_t **item, - obs_data_array_t *val); + obs_data_array_t *val); /* Item get functions */ EXPORT const char *obs_data_item_get_string(obs_data_item_t *item); @@ -250,106 +257,114 @@ EXPORT double obs_data_item_get_autoselect_double(obs_data_item_t *item); EXPORT bool obs_data_item_get_autoselect_bool(obs_data_item_t *item); EXPORT obs_data_t *obs_data_item_get_autoselect_obj(obs_data_item_t *item); -EXPORT obs_data_array_t *obs_data_item_get_autoselect_array( - obs_data_item_t *item); +EXPORT obs_data_array_t * +obs_data_item_get_autoselect_array(obs_data_item_t *item); /* ------------------------------------------------------------------------- */ /* Helper functions for certain structures */ EXPORT void obs_data_set_vec2(obs_data_t *data, const char *name, - const struct vec2 *val); + const struct vec2 *val); EXPORT void obs_data_set_vec3(obs_data_t *data, const char *name, - const struct vec3 *val); + const struct vec3 *val); EXPORT void obs_data_set_vec4(obs_data_t *data, const char *name, - const struct vec4 *val); + const struct vec4 *val); EXPORT void obs_data_set_quat(obs_data_t *data, const char *name, - const struct quat *val); + const struct quat *val); EXPORT void obs_data_set_default_vec2(obs_data_t *data, const char *name, - const struct vec2 *val); + const struct vec2 *val); EXPORT void obs_data_set_default_vec3(obs_data_t *data, const char *name, - const struct vec3 *val); + const struct vec3 *val); EXPORT void obs_data_set_default_vec4(obs_data_t *data, const char *name, - const struct vec4 *val); + const struct vec4 *val); EXPORT void obs_data_set_default_quat(obs_data_t *data, const char *name, - const struct quat *val); + const struct quat *val); EXPORT void obs_data_set_autoselect_vec2(obs_data_t *data, const char *name, - const struct vec2 *val); + const struct vec2 *val); EXPORT void obs_data_set_autoselect_vec3(obs_data_t *data, const char *name, - const struct vec3 *val); + const struct vec3 *val); EXPORT void obs_data_set_autoselect_vec4(obs_data_t *data, const char *name, - const struct vec4 *val); + const struct vec4 *val); EXPORT void obs_data_set_autoselect_quat(obs_data_t *data, const char *name, - const struct quat *val); + const struct quat *val); EXPORT void obs_data_get_vec2(obs_data_t *data, const char *name, - struct vec2 *val); + struct vec2 *val); EXPORT void obs_data_get_vec3(obs_data_t *data, const char *name, - struct vec3 *val); + struct vec3 *val); EXPORT void obs_data_get_vec4(obs_data_t *data, const char *name, - struct vec4 *val); + struct vec4 *val); EXPORT void obs_data_get_quat(obs_data_t *data, const char *name, - struct quat *val); + struct quat *val); EXPORT void obs_data_get_default_vec2(obs_data_t *data, const char *name, - struct vec2 *val); + struct vec2 *val); EXPORT void obs_data_get_default_vec3(obs_data_t *data, const char *name, - struct vec3 *val); + struct vec3 *val); EXPORT void obs_data_get_default_vec4(obs_data_t *data, const char *name, - struct vec4 *val); + struct vec4 *val); EXPORT void obs_data_get_default_quat(obs_data_t *data, const char *name, - struct quat *val); + struct quat *val); EXPORT void obs_data_get_autoselect_vec2(obs_data_t *data, const char *name, - struct vec2 *val); + struct vec2 *val); EXPORT void obs_data_get_autoselect_vec3(obs_data_t *data, const char *name, - struct vec3 *val); + struct vec3 *val); EXPORT void obs_data_get_autoselect_vec4(obs_data_t *data, const char *name, - struct vec4 *val); + struct vec4 *val); EXPORT void obs_data_get_autoselect_quat(obs_data_t *data, const char *name, - struct quat *val); + struct quat *val); /* ------------------------------------------------------------------------- */ /* Helper functions for media_frames_per_second/OBS_PROPERTY_FRAME_RATE */ -EXPORT void obs_data_set_frames_per_second(obs_data_t *data, - const char *name, - struct media_frames_per_second fps, const char *option); -EXPORT void obs_data_set_default_frames_per_second(obs_data_t *data, - const char *name, - struct media_frames_per_second fps, const char *option); -EXPORT void obs_data_set_autoselect_frames_per_second(obs_data_t *data, - const char *name, - struct media_frames_per_second fps, const char *option); - -EXPORT bool obs_data_get_frames_per_second(obs_data_t *data, - const char *name, - struct media_frames_per_second *fps, const char **option); -EXPORT bool obs_data_get_default_frames_per_second(obs_data_t *data, - const char *name, - struct media_frames_per_second *fps, const char **option); -EXPORT bool obs_data_get_autoselect_frames_per_second(obs_data_t *data, - const char *name, - struct media_frames_per_second *fps, const char **option); - -EXPORT void obs_data_item_set_frames_per_second( - obs_data_item_t **item, - struct media_frames_per_second fps, const char *option); -EXPORT void obs_data_item_set_default_frames_per_second( - obs_data_item_t **item, - struct media_frames_per_second fps, const char *option); +EXPORT void obs_data_set_frames_per_second(obs_data_t *data, const char *name, + struct media_frames_per_second fps, + const char *option); +EXPORT void +obs_data_set_default_frames_per_second(obs_data_t *data, const char *name, + struct media_frames_per_second fps, + const char *option); +EXPORT void +obs_data_set_autoselect_frames_per_second(obs_data_t *data, const char *name, + struct media_frames_per_second fps, + const char *option); + +EXPORT bool obs_data_get_frames_per_second(obs_data_t *data, const char *name, + struct media_frames_per_second *fps, + const char **option); +EXPORT bool +obs_data_get_default_frames_per_second(obs_data_t *data, const char *name, + struct media_frames_per_second *fps, + const char **option); +EXPORT bool +obs_data_get_autoselect_frames_per_second(obs_data_t *data, const char *name, + struct media_frames_per_second *fps, + const char **option); + +EXPORT void +obs_data_item_set_frames_per_second(obs_data_item_t **item, + struct media_frames_per_second fps, + const char *option); +EXPORT void +obs_data_item_set_default_frames_per_second(obs_data_item_t **item, + struct media_frames_per_second fps, + const char *option); EXPORT void obs_data_item_set_autoselect_frames_per_second( - obs_data_item_t **item, - struct media_frames_per_second fps, const char *option); - -EXPORT bool obs_data_item_get_frames_per_second( - obs_data_item_t *item, - struct media_frames_per_second *fps, const char **option); -EXPORT bool obs_data_item_get_default_frames_per_second( - obs_data_item_t *item, - struct media_frames_per_second *fps, const char **option); + obs_data_item_t **item, struct media_frames_per_second fps, + const char *option); + +EXPORT bool +obs_data_item_get_frames_per_second(obs_data_item_t *item, + struct media_frames_per_second *fps, + const char **option); +EXPORT bool +obs_data_item_get_default_frames_per_second(obs_data_item_t *item, + struct media_frames_per_second *fps, + const char **option); EXPORT bool obs_data_item_get_autoselect_frames_per_second( - obs_data_item_t *item, - struct media_frames_per_second *fps, const char **option); + obs_data_item_t *item, struct media_frames_per_second *fps, + const char **option); /* ------------------------------------------------------------------------- */ /* OBS-specific functions */
View file
obs-studio-23.2.1.tar.xz/libobs/obs-defs.h -> obs-studio-24.0.0.tar.xz/libobs/obs-defs.h
Changed
@@ -21,30 +21,30 @@ #define MAX_CHANNELS 64 #define OBS_ALIGN_CENTER (0) -#define OBS_ALIGN_LEFT (1<<0) -#define OBS_ALIGN_RIGHT (1<<1) -#define OBS_ALIGN_TOP (1<<2) -#define OBS_ALIGN_BOTTOM (1<<3) - -#define MODULE_SUCCESS 0 -#define MODULE_ERROR -1 -#define MODULE_FILE_NOT_FOUND -2 -#define MODULE_MISSING_EXPORTS -3 -#define MODULE_INCOMPATIBLE_VER -4 - -#define OBS_OUTPUT_SUCCESS 0 -#define OBS_OUTPUT_BAD_PATH -1 +#define OBS_ALIGN_LEFT (1 << 0) +#define OBS_ALIGN_RIGHT (1 << 1) +#define OBS_ALIGN_TOP (1 << 2) +#define OBS_ALIGN_BOTTOM (1 << 3) + +#define MODULE_SUCCESS 0 +#define MODULE_ERROR -1 +#define MODULE_FILE_NOT_FOUND -2 +#define MODULE_MISSING_EXPORTS -3 +#define MODULE_INCOMPATIBLE_VER -4 + +#define OBS_OUTPUT_SUCCESS 0 +#define OBS_OUTPUT_BAD_PATH -1 #define OBS_OUTPUT_CONNECT_FAILED -2 #define OBS_OUTPUT_INVALID_STREAM -3 -#define OBS_OUTPUT_ERROR -4 -#define OBS_OUTPUT_DISCONNECTED -5 -#define OBS_OUTPUT_UNSUPPORTED -6 -#define OBS_OUTPUT_NO_SPACE -7 -#define OBS_OUTPUT_ENCODE_ERROR -8 - -#define OBS_VIDEO_SUCCESS 0 -#define OBS_VIDEO_FAIL -1 -#define OBS_VIDEO_NOT_SUPPORTED -2 -#define OBS_VIDEO_INVALID_PARAM -3 +#define OBS_OUTPUT_ERROR -4 +#define OBS_OUTPUT_DISCONNECTED -5 +#define OBS_OUTPUT_UNSUPPORTED -6 +#define OBS_OUTPUT_NO_SPACE -7 +#define OBS_OUTPUT_ENCODE_ERROR -8 + +#define OBS_VIDEO_SUCCESS 0 +#define OBS_VIDEO_FAIL -1 +#define OBS_VIDEO_NOT_SUPPORTED -2 +#define OBS_VIDEO_INVALID_PARAM -3 #define OBS_VIDEO_CURRENTLY_ACTIVE -4 #define OBS_VIDEO_MODULE_NOT_FOUND -5
View file
obs-studio-23.2.1.tar.xz/libobs/obs-display.c -> obs-studio-24.0.0.tar.xz/libobs/obs-display.c
Changed
@@ -20,7 +20,7 @@ #include "obs-internal.h" bool obs_display_init(struct obs_display *display, - const struct gs_init_data *graphics_data) + const struct gs_init_data *graphics_data) { pthread_mutex_init_value(&display->draw_callbacks_mutex); pthread_mutex_init_value(&display->draw_info_mutex); @@ -29,7 +29,7 @@ display->swap = gs_swapchain_create(graphics_data); if (!display->swap) { blog(LOG_ERROR, "obs_display_init: Failed to " - "create swap chain"); + "create swap chain"); return false; } @@ -51,7 +51,7 @@ } obs_display_t *obs_display_create(const struct gs_init_data *graphics_data, - uint32_t background_color) + uint32_t background_color) { struct obs_display *display = bzalloc(sizeof(struct obs_display)); @@ -64,8 +64,8 @@ display = NULL; } else { pthread_mutex_lock(&obs->data.displays_mutex); - display->prev_next = &obs->data.first_display; - display->next = obs->data.first_display; + display->prev_next = &obs->data.first_display; + display->next = obs->data.first_display; obs->data.first_display = display; if (display->next) display->next->prev_next = &display->next; @@ -109,7 +109,8 @@ void obs_display_resize(obs_display_t *display, uint32_t cx, uint32_t cy) { - if (!display) return; + if (!display) + return; pthread_mutex_lock(&display->draw_info_mutex); @@ -121,10 +122,12 @@ } void obs_display_add_draw_callback(obs_display_t *display, - void (*draw)(void *param, uint32_t cx, uint32_t cy), - void *param) + void (*draw)(void *param, uint32_t cx, + uint32_t cy), + void *param) { - if (!display) return; + if (!display) + return; struct draw_callback data = {draw, param}; @@ -134,10 +137,12 @@ } void obs_display_remove_draw_callback(obs_display_t *display, - void (*draw)(void *param, uint32_t cx, uint32_t cy), - void *param) + void (*draw)(void *param, uint32_t cx, + uint32_t cy), + void *param) { - if (!display) return; + if (!display) + return; struct draw_callback data = {draw, param}; @@ -147,7 +152,8 @@ } static inline void render_display_begin(struct obs_display *display, - uint32_t cx, uint32_t cy, bool size_changed) + uint32_t cx, uint32_t cy, + bool size_changed) { struct vec4 clear_color; @@ -162,7 +168,7 @@ clear_color.w = 1.0f; gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH | GS_CLEAR_STENCIL, - &clear_color, 1.0f, 0); + &clear_color, 1.0f, 0); gs_enable_depth_test(false); /* gs_enable_blending(false); */ @@ -182,7 +188,8 @@ uint32_t cx, cy; bool size_changed; - if (!display || !display->enabled) return; + if (!display || !display->enabled) + return; GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_DISPLAY, "obs_display"); @@ -207,7 +214,7 @@ for (size_t i = 0; i < display->draw_callbacks.num; i++) { struct draw_callback *callback; - callback = display->draw_callbacks.array+i; + callback = display->draw_callbacks.array + i; callback->draw(callback->param, cx, cy); } @@ -238,8 +245,7 @@ display->background_color = color; } -void obs_display_size(obs_display_t *display, - uint32_t *width, uint32_t *height) +void obs_display_size(obs_display_t *display, uint32_t *width, uint32_t *height) { *width = 0; *height = 0;
View file
obs-studio-23.2.1.tar.xz/libobs/obs-encoder.c -> obs-studio-24.0.0.tar.xz/libobs/obs-encoder.c
Changed
@@ -18,15 +18,14 @@ #include "obs.h" #include "obs-internal.h" -#define encoder_active(encoder) \ - os_atomic_load_bool(&encoder->active) +#define encoder_active(encoder) os_atomic_load_bool(&encoder->active) #define set_encoder_active(encoder, val) \ os_atomic_set_bool(&encoder->active, val) struct obs_encoder_info *find_encoder(const char *id) { for (size_t i = 0; i < obs->encoder_types.num; i++) { - struct obs_encoder_info *info = obs->encoder_types.array+i; + struct obs_encoder_info *info = obs->encoder_types.array + i; if (strcmp(info->id, id) == 0) return info; @@ -42,20 +41,21 @@ } static bool init_encoder(struct obs_encoder *encoder, const char *name, - obs_data_t *settings, obs_data_t *hotkey_data) + obs_data_t *settings, obs_data_t *hotkey_data) { pthread_mutexattr_t attr; pthread_mutex_init_value(&encoder->init_mutex); pthread_mutex_init_value(&encoder->callbacks_mutex); pthread_mutex_init_value(&encoder->outputs_mutex); + pthread_mutex_init_value(&encoder->pause.mutex); if (pthread_mutexattr_init(&attr) != 0) return false; if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) return false; if (!obs_context_data_init(&encoder->context, OBS_OBJ_TYPE_ENCODER, - settings, name, hotkey_data, false)) + settings, name, hotkey_data, false)) return false; if (pthread_mutex_init(&encoder->init_mutex, &attr) != 0) return false; @@ -63,16 +63,23 @@ return false; if (pthread_mutex_init(&encoder->outputs_mutex, NULL) != 0) return false; + if (pthread_mutex_init(&encoder->pause.mutex, NULL) != 0) + return false; - if (encoder->orig_info.get_defaults) + if (encoder->orig_info.get_defaults) { encoder->orig_info.get_defaults(encoder->context.settings); + } + if (encoder->orig_info.get_defaults2) { + encoder->orig_info.get_defaults2(encoder->context.settings, + encoder->orig_info.type_data); + } return true; } -static struct obs_encoder *create_encoder(const char *id, - enum obs_encoder_type type, const char *name, - obs_data_t *settings, size_t mixer_idx, obs_data_t *hotkey_data) +static struct obs_encoder * +create_encoder(const char *id, enum obs_encoder_type type, const char *name, + obs_data_t *settings, size_t mixer_idx, obs_data_t *hotkey_data) { struct obs_encoder *encoder; struct obs_encoder_info *ei = find_encoder(id); @@ -87,10 +94,10 @@ if (!ei) { blog(LOG_ERROR, "Encoder ID '%s' not found", id); - encoder->info.id = bstrdup(id); - encoder->info.type = type; + encoder->info.id = bstrdup(id); + encoder->info.type = type; encoder->owns_info_id = true; - encoder->orig_info = encoder->info; + encoder->orig_info = encoder->info; } else { encoder->info = *ei; encoder->orig_info = *ei; @@ -106,35 +113,38 @@ encoder->control = bzalloc(sizeof(obs_weak_encoder_t)); encoder->control->encoder = encoder; - obs_context_data_insert(&encoder->context, - &obs->data.encoders_mutex, - &obs->data.first_encoder); + obs_context_data_insert(&encoder->context, &obs->data.encoders_mutex, + &obs->data.first_encoder); blog(LOG_DEBUG, "encoder '%s' (%s) created", name, id); return encoder; } obs_encoder_t *obs_video_encoder_create(const char *id, const char *name, - obs_data_t *settings, obs_data_t *hotkey_data) + obs_data_t *settings, + obs_data_t *hotkey_data) { - if (!name || !id) return NULL; + if (!name || !id) + return NULL; return create_encoder(id, OBS_ENCODER_VIDEO, name, settings, 0, - hotkey_data); + hotkey_data); } obs_encoder_t *obs_audio_encoder_create(const char *id, const char *name, - obs_data_t *settings, size_t mixer_idx, obs_data_t *hotkey_data) + obs_data_t *settings, size_t mixer_idx, + obs_data_t *hotkey_data) { - if (!name || !id) return NULL; + if (!name || !id) + return NULL; return create_encoder(id, OBS_ENCODER_AUDIO, name, settings, mixer_idx, - hotkey_data); + hotkey_data); } static void receive_video(void *param, struct video_data *frame); static void receive_audio(void *param, size_t mix_idx, struct audio_data *data); static inline void get_audio_info(const struct obs_encoder *encoder, - struct audio_convert_info *info) + struct audio_convert_info *info) { const struct audio_output_info *aoi; aoi = audio_output_get_info(encoder->media); @@ -151,16 +161,16 @@ } static inline void get_video_info(struct obs_encoder *encoder, - struct video_scale_info *info) + struct video_scale_info *info) { const struct video_output_info *voi; voi = video_output_get_info(encoder->media); - info->format = voi->format; + info->format = voi->format; info->colorspace = voi->colorspace; - info->range = voi->range; - info->width = obs_encoder_get_width(encoder); - info->height = obs_encoder_get_height(encoder); + info->range = voi->range; + info->width = obs_encoder_get_width(encoder); + info->height = obs_encoder_get_height(encoder); if (encoder->info.get_video_info) encoder->info.get_video_info(encoder->context.data, info); @@ -171,18 +181,18 @@ static inline bool has_scaling(const struct obs_encoder *encoder) { - uint32_t video_width = video_output_get_width(encoder->media); + uint32_t video_width = video_output_get_width(encoder->media); uint32_t video_height = video_output_get_height(encoder->media); return encoder->scaled_width && encoder->scaled_height && - (video_width != encoder->scaled_width || - video_height != encoder->scaled_height); + (video_width != encoder->scaled_width || + video_height != encoder->scaled_height); } static inline bool gpu_encode_available(const struct obs_encoder *encoder) { - return (encoder->info.caps & OBS_ENCODER_CAP_PASS_TEXTURE) != 0 && - obs->video.using_nv12_tex; + return (encoder->info.caps & OBS_ENCODER_CAP_PASS_TEXTURE) != 0 && + obs->video.using_nv12_tex; } static void add_connection(struct obs_encoder *encoder) @@ -192,7 +202,7 @@ get_audio_info(encoder, &audio_info); audio_output_connect(encoder->media, encoder->mixer_idx, - &audio_info, receive_audio, encoder); + &audio_info, receive_audio, encoder); } else { struct video_scale_info info = {0}; get_video_info(encoder, &info); @@ -212,7 +222,7 @@ { if (encoder->info.type == OBS_ENCODER_AUDIO) { audio_output_disconnect(encoder->media, encoder->mixer_idx, - receive_audio, encoder); + receive_audio, encoder); } else { if (gpu_encode_available(encoder)) { stop_gpu_encode(encoder); @@ -251,7 +261,8 @@ da_free(encoder->outputs); pthread_mutex_unlock(&encoder->outputs_mutex); - blog(LOG_DEBUG, "encoder '%s' destroyed", encoder->context.name); + blog(LOG_DEBUG, "encoder '%s' destroyed", + encoder->context.name); free_audio_buffers(encoder); @@ -261,9 +272,10 @@ pthread_mutex_destroy(&encoder->init_mutex); pthread_mutex_destroy(&encoder->callbacks_mutex); pthread_mutex_destroy(&encoder->outputs_mutex); + pthread_mutex_destroy(&encoder->pause.mutex); obs_context_data_free(&encoder->context); if (encoder->owns_info_id) - bfree((void*)encoder->info.id); + bfree((void *)encoder->info.id); bfree(encoder); } } @@ -292,8 +304,9 @@ const char *obs_encoder_get_name(const obs_encoder_t *encoder) { - return obs_encoder_valid(encoder, "obs_encoder_get_name") ? - encoder->context.name : NULL; + return obs_encoder_valid(encoder, "obs_encoder_get_name") + ? encoder->context.name + : NULL; } void obs_encoder_set_name(obs_encoder_t *encoder, const char *name) @@ -308,10 +321,11 @@ static inline obs_data_t *get_defaults(const struct obs_encoder_info *info) { obs_data_t *settings = obs_data_create(); + if (info->get_defaults) { + info->get_defaults(settings); + } if (info->get_defaults2) { info->get_defaults2(settings, info->type_data); - } else if (info->get_defaults) { - info->get_defaults(settings); } return settings; } @@ -334,8 +348,8 @@ { const struct obs_encoder_info *ei = find_encoder(id); if (ei && (ei->get_properties || ei->get_properties2)) { - obs_data_t *defaults = get_defaults(ei); - obs_properties_t *properties; + obs_data_t *defaults = get_defaults(ei); + obs_properties_t *properties = NULL; if (ei->get_properties2) { properties = ei->get_properties2(NULL, ei->type_data); @@ -358,14 +372,14 @@ if (encoder->orig_info.get_properties2) { obs_properties_t *props; props = encoder->orig_info.get_properties2( - encoder->context.data, - encoder->orig_info.type_data); + encoder->context.data, encoder->orig_info.type_data); obs_properties_apply_settings(props, encoder->context.settings); return props; } else if (encoder->orig_info.get_properties) { obs_properties_t *props; - props = encoder->orig_info.get_properties(encoder->context.data); + props = encoder->orig_info.get_properties( + encoder->context.data); obs_properties_apply_settings(props, encoder->context.settings); return props; } @@ -382,18 +396,18 @@ if (encoder->info.update && encoder->context.data) encoder->info.update(encoder->context.data, - encoder->context.settings); + encoder->context.settings); } bool obs_encoder_get_extra_data(const obs_encoder_t *encoder, - uint8_t **extra_data, size_t *size) + uint8_t **extra_data, size_t *size) { if (!obs_encoder_valid(encoder, "obs_encoder_get_extra_data")) return false; if (encoder->info.get_extra_data && encoder->context.data) return encoder->info.get_extra_data(encoder->context.data, - extra_data, size); + extra_data, size); return false; } @@ -422,10 +436,10 @@ get_audio_info(encoder, &info); encoder->samplerate = info.samples_per_sec; - encoder->planes = get_audio_planes(info.format, info.speakers); - encoder->blocksize = get_audio_size(info.format, info.speakers, 1); - encoder->framesize = encoder->info.get_frame_size( - encoder->context.data); + encoder->planes = get_audio_planes(info.format, info.speakers); + encoder->blocksize = get_audio_size(info.format, info.speakers, 1); + encoder->framesize = + encoder->info.get_frame_size(encoder->context.data); encoder->framesize_bytes = encoder->blocksize * encoder->framesize; reset_audio_buffers(encoder); @@ -446,7 +460,7 @@ can_reroute = true; encoder->info = encoder->orig_info; encoder->context.data = encoder->orig_info.create( - encoder->context.settings, encoder); + encoder->context.settings, encoder); can_reroute = false; } if (!encoder->context.data) @@ -459,7 +473,8 @@ return true; } -void *obs_encoder_create_rerouted(obs_encoder_t *encoder, const char *reroute_id) +void *obs_encoder_create_rerouted(obs_encoder_t *encoder, + const char *reroute_id) { if (!obs_ptr_valid(encoder, "obs_encoder_reroute")) return NULL; @@ -485,7 +500,8 @@ { bool success; - if (!encoder) return false; + if (!encoder) + return false; pthread_mutex_lock(&encoder->init_mutex); success = obs_encoder_initialize_internal(encoder); @@ -499,22 +515,22 @@ pthread_mutex_lock(&encoder->init_mutex); if (encoder->context.data) { encoder->info.destroy(encoder->context.data); - encoder->context.data = NULL; - encoder->paired_encoder = NULL; - encoder->first_received = false; - encoder->offset_usec = 0; - encoder->start_ts = 0; + encoder->context.data = NULL; + encoder->paired_encoder = NULL; + encoder->first_received = false; + encoder->offset_usec = 0; + encoder->start_ts = 0; } pthread_mutex_unlock(&encoder->init_mutex); } -static inline size_t get_callback_idx( - const struct obs_encoder *encoder, - void (*new_packet)(void *param, struct encoder_packet *packet), - void *param) +static inline size_t +get_callback_idx(const struct obs_encoder *encoder, + void (*new_packet)(void *param, struct encoder_packet *packet), + void *param) { for (size_t i = 0; i < encoder->callbacks.num; i++) { - struct encoder_callback *cb = encoder->callbacks.array+i; + struct encoder_callback *cb = encoder->callbacks.array + i; if (cb->new_packet == new_packet && cb->param == param) return i; @@ -523,12 +539,23 @@ return DARRAY_INVALID; } -static inline void obs_encoder_start_internal(obs_encoder_t *encoder, - void (*new_packet)(void *param, struct encoder_packet *packet), - void *param) +void pause_reset(struct pause_data *pause) +{ + pthread_mutex_lock(&pause->mutex); + pause->last_video_ts = 0; + pause->ts_start = 0; + pause->ts_end = 0; + pause->ts_offset = 0; + pthread_mutex_unlock(&pause->mutex); +} + +static inline void obs_encoder_start_internal( + obs_encoder_t *encoder, + void (*new_packet)(void *param, struct encoder_packet *packet), + void *param) { struct encoder_callback cb = {false, new_packet, param}; - bool first = false; + bool first = false; if (!encoder->context.data) return; @@ -544,14 +571,18 @@ pthread_mutex_unlock(&encoder->callbacks_mutex); if (first) { + os_atomic_set_bool(&encoder->paused, false); + pause_reset(&encoder->pause); + encoder->cur_pts = 0; add_connection(encoder); } } void obs_encoder_start(obs_encoder_t *encoder, - void (*new_packet)(void *param, struct encoder_packet *packet), - void *param) + void (*new_packet)(void *param, + struct encoder_packet *packet), + void *param) { if (!obs_encoder_valid(encoder, "obs_encoder_start")) return; @@ -563,11 +594,12 @@ pthread_mutex_unlock(&encoder->init_mutex); } -static inline bool obs_encoder_stop_internal(obs_encoder_t *encoder, - void (*new_packet)(void *param, struct encoder_packet *packet), - void *param) +static inline bool obs_encoder_stop_internal( + obs_encoder_t *encoder, + void (*new_packet)(void *param, struct encoder_packet *packet), + void *param) { - bool last = false; + bool last = false; size_t idx; pthread_mutex_lock(&encoder->callbacks_mutex); @@ -595,8 +627,9 @@ } void obs_encoder_stop(obs_encoder_t *encoder, - void (*new_packet)(void *param, struct encoder_packet *packet), - void *param) + void (*new_packet)(void *param, + struct encoder_packet *packet), + void *param) { bool destroyed; @@ -613,8 +646,9 @@ const char *obs_encoder_get_codec(const obs_encoder_t *encoder) { - return obs_encoder_valid(encoder, "obs_encoder_get_codec") ? - encoder->info.codec : NULL; + return obs_encoder_valid(encoder, "obs_encoder_get_codec") + ? encoder->info.codec + : NULL; } const char *obs_get_encoder_codec(const char *id) @@ -625,8 +659,9 @@ enum obs_encoder_type obs_encoder_get_type(const obs_encoder_t *encoder) { - return obs_encoder_valid(encoder, "obs_encoder_get_type") ? - encoder->info.type : OBS_ENCODER_AUDIO; + return obs_encoder_valid(encoder, "obs_encoder_get_type") + ? encoder->info.type + : OBS_ENCODER_AUDIO; } enum obs_encoder_type obs_get_encoder_type(const char *id) @@ -636,24 +671,26 @@ } void obs_encoder_set_scaled_size(obs_encoder_t *encoder, uint32_t width, - uint32_t height) + uint32_t height) { if (!obs_encoder_valid(encoder, "obs_encoder_set_scaled_size")) return; if (encoder->info.type != OBS_ENCODER_VIDEO) { - blog(LOG_WARNING, "obs_encoder_set_scaled_size: " - "encoder '%s' is not a video encoder", - obs_encoder_get_name(encoder)); + blog(LOG_WARNING, + "obs_encoder_set_scaled_size: " + "encoder '%s' is not a video encoder", + obs_encoder_get_name(encoder)); return; } if (encoder_active(encoder)) { - blog(LOG_WARNING, "encoder '%s': Cannot set the scaled " - "resolution while the encoder is active", - obs_encoder_get_name(encoder)); + blog(LOG_WARNING, + "encoder '%s': Cannot set the scaled " + "resolution while the encoder is active", + obs_encoder_get_name(encoder)); return; } - encoder->scaled_width = width; + encoder->scaled_width = width; encoder->scaled_height = height; } @@ -662,17 +699,18 @@ if (!obs_encoder_valid(encoder, "obs_encoder_get_width")) return 0; if (encoder->info.type != OBS_ENCODER_VIDEO) { - blog(LOG_WARNING, "obs_encoder_get_width: " - "encoder '%s' is not a video encoder", - obs_encoder_get_name(encoder)); + blog(LOG_WARNING, + "obs_encoder_get_width: " + "encoder '%s' is not a video encoder", + obs_encoder_get_name(encoder)); return 0; } if (!encoder->media) return 0; - return encoder->scaled_width != 0 ? - encoder->scaled_width : - video_output_get_width(encoder->media); + return encoder->scaled_width != 0 + ? encoder->scaled_width + : video_output_get_width(encoder->media); } uint32_t obs_encoder_get_height(const obs_encoder_t *encoder) @@ -680,17 +718,18 @@ if (!obs_encoder_valid(encoder, "obs_encoder_get_height")) return 0; if (encoder->info.type != OBS_ENCODER_VIDEO) { - blog(LOG_WARNING, "obs_encoder_get_height: " - "encoder '%s' is not a video encoder", - obs_encoder_get_name(encoder)); + blog(LOG_WARNING, + "obs_encoder_get_height: " + "encoder '%s' is not a video encoder", + obs_encoder_get_name(encoder)); return 0; } if (!encoder->media) return 0; - return encoder->scaled_height != 0 ? - encoder->scaled_height : - video_output_get_height(encoder->media); + return encoder->scaled_height != 0 + ? encoder->scaled_height + : video_output_get_height(encoder->media); } uint32_t obs_encoder_get_sample_rate(const obs_encoder_t *encoder) @@ -698,17 +737,18 @@ if (!obs_encoder_valid(encoder, "obs_encoder_get_sample_rate")) return 0; if (encoder->info.type != OBS_ENCODER_AUDIO) { - blog(LOG_WARNING, "obs_encoder_get_sample_rate: " - "encoder '%s' is not an audio encoder", - obs_encoder_get_name(encoder)); + blog(LOG_WARNING, + "obs_encoder_get_sample_rate: " + "encoder '%s' is not an audio encoder", + obs_encoder_get_name(encoder)); return 0; } if (!encoder->media) return 0; - return encoder->samplerate != 0 ? - encoder->samplerate : - audio_output_get_sample_rate(encoder->media); + return encoder->samplerate != 0 + ? encoder->samplerate + : audio_output_get_sample_rate(encoder->media); } void obs_encoder_set_video(obs_encoder_t *encoder, video_t *video) @@ -718,9 +758,10 @@ if (!obs_encoder_valid(encoder, "obs_encoder_set_video")) return; if (encoder->info.type != OBS_ENCODER_VIDEO) { - blog(LOG_WARNING, "obs_encoder_set_video: " - "encoder '%s' is not a video encoder", - obs_encoder_get_name(encoder)); + blog(LOG_WARNING, + "obs_encoder_set_video: " + "encoder '%s' is not a video encoder", + obs_encoder_get_name(encoder)); return; } if (!video) @@ -728,7 +769,7 @@ voi = video_output_get_info(video); - encoder->media = video; + encoder->media = video; encoder->timebase_num = voi->fps_den; encoder->timebase_den = voi->fps_num; } @@ -738,15 +779,16 @@ if (!obs_encoder_valid(encoder, "obs_encoder_set_audio")) return; if (encoder->info.type != OBS_ENCODER_AUDIO) { - blog(LOG_WARNING, "obs_encoder_set_audio: " - "encoder '%s' is not an audio encoder", - obs_encoder_get_name(encoder)); + blog(LOG_WARNING, + "obs_encoder_set_audio: " + "encoder '%s' is not an audio encoder", + obs_encoder_get_name(encoder)); return; } if (!audio) return; - encoder->media = audio; + encoder->media = audio; encoder->timebase_num = 1; encoder->timebase_den = audio_output_get_sample_rate(audio); } @@ -756,9 +798,10 @@ if (!obs_encoder_valid(encoder, "obs_encoder_video")) return NULL; if (encoder->info.type != OBS_ENCODER_VIDEO) { - blog(LOG_WARNING, "obs_encoder_set_video: " - "encoder '%s' is not a video encoder", - obs_encoder_get_name(encoder)); + blog(LOG_WARNING, + "obs_encoder_set_video: " + "encoder '%s' is not a video encoder", + obs_encoder_get_name(encoder)); return NULL; } @@ -770,9 +813,10 @@ if (!obs_encoder_valid(encoder, "obs_encoder_audio")) return NULL; if (encoder->info.type != OBS_ENCODER_AUDIO) { - blog(LOG_WARNING, "obs_encoder_set_audio: " - "encoder '%s' is not an audio encoder", - obs_encoder_get_name(encoder)); + blog(LOG_WARNING, + "obs_encoder_set_audio: " + "encoder '%s' is not an audio encoder", + obs_encoder_get_name(encoder)); return NULL; } @@ -781,26 +825,28 @@ bool obs_encoder_active(const obs_encoder_t *encoder) { - return obs_encoder_valid(encoder, "obs_encoder_active") ? - encoder_active(encoder) : false; + return obs_encoder_valid(encoder, "obs_encoder_active") + ? encoder_active(encoder) + : false; } -static inline bool get_sei(const struct obs_encoder *encoder, - uint8_t **sei, size_t *size) +static inline bool get_sei(const struct obs_encoder *encoder, uint8_t **sei, + size_t *size) { if (encoder->info.get_sei_data) return encoder->info.get_sei_data(encoder->context.data, sei, - size); + size); return false; } static void send_first_video_packet(struct obs_encoder *encoder, - struct encoder_callback *cb, struct encoder_packet *packet) + struct encoder_callback *cb, + struct encoder_packet *packet) { struct encoder_packet first_packet; - DARRAY(uint8_t) data; - uint8_t *sei; - size_t size; + DARRAY(uint8_t) data; + uint8_t *sei; + size_t size; /* always wait for first keyframe */ if (!packet->keyframe) @@ -817,7 +863,7 @@ da_push_back_array(data, sei, size); da_push_back_array(data, packet->data, packet->size); - first_packet = *packet; + first_packet = *packet; first_packet.data = data.array; first_packet.size = data.num; @@ -828,7 +874,8 @@ } static inline void send_packet(struct obs_encoder *encoder, - struct encoder_callback *cb, struct encoder_packet *packet) + struct encoder_callback *cb, + struct encoder_packet *packet) { /* include SEI in first video packet */ if (encoder->info.type == OBS_ENCODER_VIDEO && !cb->sent_first_packet) @@ -861,11 +908,11 @@ } void send_off_encoder_packet(obs_encoder_t *encoder, bool success, - bool received, struct encoder_packet *pkt) + bool received, struct encoder_packet *pkt) { if (!success) { blog(LOG_ERROR, "Error encoding with encoder '%s'", - encoder->context.name); + encoder->context.name); full_stop(encoder); return; } @@ -879,14 +926,18 @@ /* we use system time here to ensure sync with other encoders, * you do not want to use relative timestamps here */ pkt->dts_usec = encoder->start_ts / 1000 + - packet_dts_usec(pkt) - encoder->offset_usec; + packet_dts_usec(pkt) - encoder->offset_usec; pkt->sys_dts_usec = pkt->dts_usec; + pthread_mutex_lock(&encoder->pause.mutex); + pkt->sys_dts_usec += encoder->pause.ts_offset / 1000; + pthread_mutex_unlock(&encoder->pause.mutex); + pthread_mutex_lock(&encoder->callbacks_mutex); for (size_t i = encoder->callbacks.num; i > 0; i--) { struct encoder_callback *cb; - cb = encoder->callbacks.array+(i-1); + cb = encoder->callbacks.array + (i - 1); send_packet(encoder, cb, pkt); } @@ -901,7 +952,7 @@ if (!encoder->profile_encoder_encode_name) encoder->profile_encoder_encode_name = profile_store_name(obs_get_profiler_name_store(), - "encode(%s)", encoder->context.name); + "encode(%s)", encoder->context.name); struct encoder_packet pkt = {0}; bool received = false; @@ -913,7 +964,7 @@ profile_start(encoder->profile_encoder_encode_name); success = encoder->info.encode(encoder->context.data, frame, &pkt, - &received); + &received); profile_end(encoder->profile_encoder_encode_name); send_off_encoder_packet(encoder, success, received, &pkt); @@ -922,14 +973,44 @@ return success; } +static inline bool video_pause_check_internal(struct pause_data *pause, + uint64_t ts) +{ + pause->last_video_ts = ts; + if (!pause->ts_start) { + return false; + } + + if (ts == pause->ts_end) { + pause->ts_start = 0; + pause->ts_end = 0; + + } else if (ts >= pause->ts_start) { + return true; + } + + return false; +} + +bool video_pause_check(struct pause_data *pause, uint64_t timestamp) +{ + bool ignore_frame; + + pthread_mutex_lock(&pause->mutex); + ignore_frame = video_pause_check_internal(pause, timestamp); + pthread_mutex_unlock(&pause->mutex); + + return ignore_frame; +} + static const char *receive_video_name = "receive_video"; static void receive_video(void *param, struct video_data *frame) { profile_start(receive_video_name); - struct obs_encoder *encoder = param; - struct obs_encoder *pair = encoder->paired_encoder; - struct encoder_frame enc_frame; + struct obs_encoder *encoder = param; + struct obs_encoder *pair = encoder->paired_encoder; + struct encoder_frame enc_frame; if (!encoder->first_received && pair) { if (!pair->first_received || @@ -938,10 +1019,13 @@ } } + if (video_pause_check(&encoder->pause, frame->timestamp)) + goto wait_for_audio; + memset(&enc_frame, 0, sizeof(struct encoder_frame)); for (size_t i = 0; i < MAX_AV_PLANES; i++) { - enc_frame.data[i] = frame->data[i]; + enc_frame.data[i] = frame->data[i]; enc_frame.linesize[i] = frame->linesize[i]; } @@ -949,7 +1033,7 @@ encoder->start_ts = frame->timestamp; enc_frame.frames = 1; - enc_frame.pts = encoder->cur_pts; + enc_frame.pts = encoder->cur_pts; if (do_encode(encoder, &enc_frame)) encoder->cur_pts += encoder->timebase_num; @@ -965,7 +1049,8 @@ } static inline void push_back_audio(struct obs_encoder *encoder, - struct audio_data *data, size_t size, size_t offset_size) + struct audio_data *data, size_t size, + size_t offset_size) { size -= offset_size; @@ -973,15 +1058,15 @@ if (size) for (size_t i = 0; i < encoder->planes; i++) circlebuf_push_back(&encoder->audio_input_buffer[i], - data->data[i] + offset_size, size); + data->data[i] + offset_size, size); } static inline size_t calc_offset_size(struct obs_encoder *encoder, - uint64_t v_start_ts, uint64_t a_start_ts) + uint64_t v_start_ts, uint64_t a_start_ts) { uint64_t offset = v_start_ts - a_start_ts; offset = (uint64_t)offset * (uint64_t)encoder->samplerate / - 1000000000ULL; + 1000000000ULL; return (size_t)offset * encoder->blocksize; } @@ -994,12 +1079,12 @@ for (size_t i = 0; i < MAX_AV_PLANES; i++) { audio.data[i] = encoder->audio_input_buffer[i].data; memset(&encoder->audio_input_buffer[i], 0, - sizeof(struct circlebuf)); + sizeof(struct circlebuf)); } if (encoder->first_raw_ts < v_start_ts) offset_size = calc_offset_size(encoder, v_start_ts, - encoder->first_raw_ts); + encoder->first_raw_ts); push_back_audio(encoder, &audio, size, offset_size); @@ -1017,7 +1102,7 @@ bool success = true; if (!encoder->start_ts && encoder->paired_encoder) { - uint64_t end_ts = data->timestamp; + uint64_t end_ts = data->timestamp; uint64_t v_start_ts = encoder->paired_encoder->start_ts; /* no video yet, so don't start audio */ @@ -1029,7 +1114,7 @@ /* audio starting point still not synced with video starting * point, so don't start audio */ end_ts += (uint64_t)data->frames * 1000000000ULL / - (uint64_t)encoder->samplerate; + (uint64_t)encoder->samplerate; if (end_ts <= v_start_ts) { success = false; goto fail; @@ -1038,7 +1123,7 @@ /* ready to start audio, truncate if necessary */ if (data->timestamp < v_start_ts) offset_size = calc_offset_size(encoder, v_start_ts, - data->timestamp); + data->timestamp); if (data->timestamp <= v_start_ts) clear_audio(encoder); @@ -1062,21 +1147,21 @@ static bool send_audio_data(struct obs_encoder *encoder) { - struct encoder_frame enc_frame; + struct encoder_frame enc_frame; memset(&enc_frame, 0, sizeof(struct encoder_frame)); for (size_t i = 0; i < encoder->planes; i++) { circlebuf_pop_front(&encoder->audio_input_buffer[i], - encoder->audio_output_buffer[i], - encoder->framesize_bytes); + encoder->audio_output_buffer[i], + encoder->framesize_bytes); - enc_frame.data[i] = encoder->audio_output_buffer[i]; + enc_frame.data[i] = encoder->audio_output_buffer[i]; enc_frame.linesize[i] = (uint32_t)encoder->framesize_bytes; } enc_frame.frames = (uint32_t)encoder->framesize; - enc_frame.pts = encoder->cur_pts; + enc_frame.pts = encoder->cur_pts; if (!do_encode(encoder, &enc_frame)) return false; @@ -1085,23 +1170,100 @@ return true; } +static void pause_audio(struct pause_data *pause, struct audio_data *data, + size_t sample_rate) +{ + uint64_t cutoff_frames = pause->ts_start - data->timestamp; + cutoff_frames = ns_to_audio_frames(sample_rate, cutoff_frames); + + data->frames = (uint32_t)cutoff_frames; +} + +static void unpause_audio(struct pause_data *pause, struct audio_data *data, + size_t sample_rate) +{ + uint64_t cutoff_frames = pause->ts_end - data->timestamp; + cutoff_frames = ns_to_audio_frames(sample_rate, cutoff_frames); + + for (size_t i = 0; i < MAX_AV_PLANES; i++) { + if (!data->data[i]) + break; + data->data[i] += cutoff_frames * sizeof(float); + } + + data->timestamp = pause->ts_start; + data->frames = data->frames - (uint32_t)cutoff_frames; + pause->ts_start = 0; + pause->ts_end = 0; +} + +static inline bool audio_pause_check_internal(struct pause_data *pause, + struct audio_data *data, + size_t sample_rate) +{ + uint64_t end_ts; + + if (!pause->ts_start) { + return false; + } + + end_ts = + data->timestamp + audio_frames_to_ns(sample_rate, data->frames); + + if (pause->ts_start >= data->timestamp) { + if (pause->ts_start <= end_ts) { + pause_audio(pause, data, sample_rate); + return !data->frames; + } + + } else { + if (pause->ts_end >= data->timestamp && + pause->ts_end <= end_ts) { + unpause_audio(pause, data, sample_rate); + return !data->frames; + } + + return true; + } + + return false; +} + +bool audio_pause_check(struct pause_data *pause, struct audio_data *data, + size_t sample_rate) +{ + bool ignore_audio; + + pthread_mutex_lock(&pause->mutex); + ignore_audio = audio_pause_check_internal(pause, data, sample_rate); + data->timestamp -= pause->ts_offset; + pthread_mutex_unlock(&pause->mutex); + + return ignore_audio; +} + static const char *receive_audio_name = "receive_audio"; -static void receive_audio(void *param, size_t mix_idx, struct audio_data *data) +static void receive_audio(void *param, size_t mix_idx, struct audio_data *in) { profile_start(receive_audio_name); struct obs_encoder *encoder = param; + struct audio_data audio = *in; if (!encoder->first_received) { - encoder->first_raw_ts = data->timestamp; + encoder->first_raw_ts = audio.timestamp; encoder->first_received = true; clear_audio(encoder); } - if (!buffer_audio(encoder, data)) + if (audio_pause_check(&encoder->pause, &audio, encoder->samplerate)) goto end; - while (encoder->audio_input_buffer[0].size >= encoder->framesize_bytes) { + if (!buffer_audio(encoder, &audio)) + goto end; + + while (encoder->audio_input_buffer[0].size >= + encoder->framesize_bytes) { if (!send_audio_data(encoder)) { break; } @@ -1114,9 +1276,10 @@ } void obs_encoder_add_output(struct obs_encoder *encoder, - struct obs_output *output) + struct obs_output *output) { - if (!encoder) return; + if (!encoder) + return; pthread_mutex_lock(&encoder->outputs_mutex); da_push_back(encoder->outputs, &output); @@ -1124,9 +1287,10 @@ } void obs_encoder_remove_output(struct obs_encoder *encoder, - struct obs_output *output) + struct obs_output *output) { - if (!encoder) return; + if (!encoder) + return; pthread_mutex_lock(&encoder->outputs_mutex); da_erase_item(encoder->outputs, &output); @@ -1134,19 +1298,19 @@ } void obs_encoder_packet_create_instance(struct encoder_packet *dst, - const struct encoder_packet *src) + const struct encoder_packet *src) { long *p_refs; *dst = *src; p_refs = bmalloc(src->size + sizeof(long)); - dst->data = (void*)(p_refs + 1); + dst->data = (void *)(p_refs + 1); *p_refs = 1; memcpy(dst->data, src->data, src->size); } void obs_duplicate_encoder_packet(struct encoder_packet *dst, - const struct encoder_packet *src) + const struct encoder_packet *src) { obs_encoder_packet_create_instance(dst, src); } @@ -1157,13 +1321,13 @@ } void obs_encoder_packet_ref(struct encoder_packet *dst, - struct encoder_packet *src) + struct encoder_packet *src) { if (!src) return; if (src->data) { - long *p_refs = ((long*)src->data) - 1; + long *p_refs = ((long *)src->data) - 1; os_atomic_inc_long(p_refs); } @@ -1176,7 +1340,7 @@ return; if (pkt->data) { - long *p_refs = ((long*)pkt->data) - 1; + long *p_refs = ((long *)pkt->data) - 1; if (os_atomic_dec_long(p_refs) == 0) bfree(p_refs); } @@ -1185,7 +1349,7 @@ } void obs_encoder_set_preferred_video_format(obs_encoder_t *encoder, - enum video_format format) + enum video_format format) { if (!encoder || encoder->info.type != OBS_ENCODER_VIDEO) return; @@ -1193,8 +1357,8 @@ encoder->preferred_format = format; } -enum video_format obs_encoder_get_preferred_video_format( - const obs_encoder_t *encoder) +enum video_format +obs_encoder_get_preferred_video_format(const obs_encoder_t *encoder) { if (!encoder || encoder->info.type != OBS_ENCODER_VIDEO) return VIDEO_FORMAT_NONE; @@ -1272,7 +1436,7 @@ } bool obs_weak_encoder_references_encoder(obs_weak_encoder_t *weak, - obs_encoder_t *encoder) + obs_encoder_t *encoder) { return weak && encoder && weak->encoder == encoder; } @@ -1280,13 +1444,15 @@ void *obs_encoder_get_type_data(obs_encoder_t *encoder) { return obs_encoder_valid(encoder, "obs_encoder_get_type_data") - ? encoder->orig_info.type_data : NULL; + ? encoder->orig_info.type_data + : NULL; } const char *obs_encoder_get_id(const obs_encoder_t *encoder) { return obs_encoder_valid(encoder, "obs_encoder_get_id") - ? encoder->orig_info.id : NULL; + ? encoder->orig_info.id + : NULL; } uint32_t obs_get_encoder_caps(const char *encoder_id) @@ -1298,5 +1464,13 @@ uint32_t obs_encoder_get_caps(const obs_encoder_t *encoder) { return obs_encoder_valid(encoder, "obs_encoder_get_caps") - ? encoder->orig_info.caps : 0; + ? encoder->orig_info.caps + : 0; +} + +bool obs_encoder_paused(const obs_encoder_t *encoder) +{ + return obs_encoder_valid(encoder, "obs_encoder_paused") + ? os_atomic_load_bool(&encoder->paused) + : false; }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-encoder.h -> obs-studio-24.0.0.tar.xz/libobs/obs-encoder.h
Changed
@@ -29,8 +29,9 @@ extern "C" { #endif -#define OBS_ENCODER_CAP_DEPRECATED (1<<0) -#define OBS_ENCODER_CAP_PASS_TEXTURE (1<<1) +#define OBS_ENCODER_CAP_DEPRECATED (1 << 0) +#define OBS_ENCODER_CAP_PASS_TEXTURE (1 << 1) +#define OBS_ENCODER_CAP_DYN_BITRATE (1 << 2) /** Specifies the encoder type */ enum obs_encoder_type { @@ -40,27 +41,27 @@ /** Encoder output packet */ struct encoder_packet { - uint8_t *data; /**< Packet data */ - size_t size; /**< Packet size */ + uint8_t *data; /**< Packet data */ + size_t size; /**< Packet size */ - int64_t pts; /**< Presentation timestamp */ - int64_t dts; /**< Decode timestamp */ + int64_t pts; /**< Presentation timestamp */ + int64_t dts; /**< Decode timestamp */ - int32_t timebase_num; /**< Timebase numerator */ - int32_t timebase_den; /**< Timebase denominator */ + int32_t timebase_num; /**< Timebase numerator */ + int32_t timebase_den; /**< Timebase denominator */ - enum obs_encoder_type type; /**< Encoder type */ + enum obs_encoder_type type; /**< Encoder type */ - bool keyframe; /**< Is a keyframe */ + bool keyframe; /**< Is a keyframe */ /* ---------------------------------------------------------------- */ /* Internal video variables (will be parsed automatically) */ /* DTS in microseconds */ - int64_t dts_usec; + int64_t dts_usec; /* System DTS in microseconds */ - int64_t sys_dts_usec; + int64_t sys_dts_usec; /** * Packet priority @@ -68,7 +69,7 @@ * This is generally use by video encoders to specify the priority * of the packet. */ - int priority; + int priority; /** * Dropped packet priority @@ -76,28 +77,28 @@ * If this packet needs to be dropped, the next packet must be of this * priority or higher to continue transmission. */ - int drop_priority; + int drop_priority; /** Audio track index (used with outputs) */ - size_t track_idx; + size_t track_idx; /** Encoder from which the track originated from */ - obs_encoder_t *encoder; + obs_encoder_t *encoder; }; /** Encoder input frame */ struct encoder_frame { /** Data for the frame/audio */ - uint8_t *data[MAX_AV_PLANES]; + uint8_t *data[MAX_AV_PLANES]; /** size of each plane */ - uint32_t linesize[MAX_AV_PLANES]; + uint32_t linesize[MAX_AV_PLANES]; /** Number of frames (audio only) */ - uint32_t frames; + uint32_t frames; /** Presentation timestamp */ - int64_t pts; + int64_t pts; }; /** @@ -161,7 +162,7 @@ * @return true if successful, false otherwise. */ bool (*encode)(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet); + struct encoder_packet *packet, bool *received_packet); /** Audio encoder only: Returns the frame size for this encoder */ size_t (*get_frame_size)(void *data); @@ -238,6 +239,9 @@ /** * Gets the default settings for this encoder + * + * If get_defaults is also defined both will be called, and the first + * call will be to get_defaults, then to get_defaults2. * * @param[out] settings Data to assign default settings to * @param[in] typedata Type Data @@ -254,12 +258,13 @@ obs_properties_t *(*get_properties2)(void *data, void *type_data); bool (*encode_texture)(void *data, uint32_t handle, int64_t pts, - uint64_t lock_key, uint64_t *next_key, - struct encoder_packet *packet, bool *received_packet); + uint64_t lock_key, uint64_t *next_key, + struct encoder_packet *packet, + bool *received_packet); }; EXPORT void obs_register_encoder_s(const struct obs_encoder_info *info, - size_t size); + size_t size); /** * Register an encoder definition to the current obs context. This should be
View file
obs-studio-23.2.1.tar.xz/libobs/obs-ffmpeg-compat.h -> obs-studio-24.0.0.tar.xz/libobs/obs-ffmpeg-compat.h
Changed
@@ -6,18 +6,20 @@ * a is the major version * b and c the minor and micro versions of libav * d and e the minor and micro versions of FFmpeg */ -#define LIBAVCODEC_VERSION_CHECK( a, b, c, d, e ) \ - ( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \ - (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) ) +#define LIBAVCODEC_VERSION_CHECK(a, b, c, d, e) \ + ((LIBAVCODEC_VERSION_MICRO < 100 && \ + LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, b, c)) || \ + (LIBAVCODEC_VERSION_MICRO >= 100 && \ + LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, d, e))) #if !LIBAVCODEC_VERSION_CHECK(54, 28, 0, 59, 100) -# define avcodec_free_frame av_freep +#define avcodec_free_frame av_freep #endif #if LIBAVCODEC_VERSION_INT < 0x371c01 -# define av_frame_alloc avcodec_alloc_frame -# define av_frame_unref avcodec_get_frame_defaults -# define av_frame_free avcodec_free_frame +#define av_frame_alloc avcodec_alloc_frame +#define av_frame_unref avcodec_get_frame_defaults +#define av_frame_free avcodec_free_frame #endif #if LIBAVCODEC_VERSION_MAJOR >= 58
View file
obs-studio-23.2.1.tar.xz/libobs/obs-hotkey-name-map.c -> obs-studio-24.0.0.tar.xz/libobs/obs-hotkey-name-map.c
Changed
@@ -69,7 +69,6 @@ struct obs_hotkey_name_map_node *node; }; - static inline obs_hotkey_name_map_node_t *new_node(void) { return bzalloc(sizeof(obs_hotkey_name_map_node_t)); @@ -88,12 +87,12 @@ static inline char *get_prefix(obs_hotkey_name_map_edge_t *e) { - return e->prefix_len >= NAME_MAP_COMPRESS_LENGTH ? - e->prefix : e->compressed_prefix; + return e->prefix_len >= NAME_MAP_COMPRESS_LENGTH ? e->prefix + : e->compressed_prefix; } static void set_prefix(obs_hotkey_name_map_edge_t *e, const char *prefix, - size_t l) + size_t l) { assert(e->prefix_len == 0); @@ -105,7 +104,7 @@ } static obs_hotkey_name_map_edge_t *add_leaf(obs_hotkey_name_map_node_t *node, - const char *key, size_t l, int v) + const char *key, size_t l, int v) { obs_hotkey_name_map_edge_t *e = da_push_back_new(node->children); @@ -135,19 +134,19 @@ } static void connect(obs_hotkey_name_map_edge_t *e, - obs_hotkey_name_map_node_t *n) + obs_hotkey_name_map_node_t *n) { e->node = n; } static void reduce_edge(obs_hotkey_name_map_edge_t *e, const char *key, - size_t l, int v) + size_t l, int v) { const char *str = get_prefix(e), *str_ = key; size_t common_length = 0; while (*str == *str_) { common_length += 1; - str += 1; + str += 1; str_ += 1; } @@ -171,8 +170,8 @@ RES_PREFIX_MATCHES, }; -static enum obs_hotkey_name_map_edge_compare_result compare_prefix( - obs_hotkey_name_map_edge_t *edge, const char *key, size_t l) +static enum obs_hotkey_name_map_edge_compare_result +compare_prefix(obs_hotkey_name_map_edge_t *edge, const char *key, size_t l) { uint8_t pref_len = edge->prefix_len; const char *str = get_prefix(edge); @@ -182,7 +181,6 @@ if (str[i] != key[i]) break; - if (i != 0 && pref_len == i) return l == i ? RES_MATCHES : RES_PREFIX_MATCHES; if (i != 0) @@ -191,8 +189,8 @@ } static void insert(obs_hotkey_name_map_edge_t *edge, - obs_hotkey_name_map_node_t *node, - const char *key, size_t l, int v) + obs_hotkey_name_map_node_t *node, const char *key, size_t l, + int v) { if (node->is_leaf && l > 0) { obs_hotkey_name_map_node_t *new_node_ = new_node(); @@ -220,7 +218,7 @@ case RES_MATCHES: case RES_PREFIX_MATCHES: insert(e, e->node, key + e->prefix_len, - l - e->prefix_len, v); + l - e->prefix_len, v); return; case RES_COMMON_PREFIX: @@ -233,7 +231,7 @@ } static void obs_hotkey_name_map_insert(obs_hotkey_name_map_t *trie, - const char *key, int v) + const char *key, int v) { if (!trie || !key) return; @@ -242,7 +240,7 @@ } static bool obs_hotkey_name_map_lookup(obs_hotkey_name_map_t *trie, - const char *key, int *v) + const char *key, int *v) { if (!trie || !key) return false; @@ -276,14 +274,16 @@ if (n->children.array[j].prefix_len) continue; - if (v) *v = - n->children.array[j].node->val; + if (v) + *v = n->children.array[j] + .node->val; return true; } return false; } - if (v) *v = n->val; + if (v) + *v = n->val; return true; } } @@ -310,7 +310,7 @@ obs_hotkey_name_map_edge_t *e = &node->children.array[i]; printf("%s", get_prefix(e)); - show_node(e->node, in+2); + show_node(e->node, in + 2); } } @@ -319,17 +319,19 @@ show_node(&trie->root, 0); } -static const char* obs_key_names[] = { +static const char *obs_key_names[] = { #define OBS_HOTKEY(x) #x, #include "obs-hotkeys.h" #undef OBS_HOTKEY }; -const char* obs_key_to_name(obs_key_t key) +const char *obs_key_to_name(obs_key_t key) { if (key >= OBS_KEY_LAST_VALUE) { - blog(LOG_ERROR, "obs-hotkey.c: queried unknown key " - "with code %d", (int)key); + blog(LOG_ERROR, + "obs-hotkey.c: queried unknown key " + "with code %d", + (int)key); return ""; } @@ -338,7 +340,9 @@ static obs_key_t obs_key_from_name_fallback(const char *name) { -#define OBS_HOTKEY(x) if (strcmp(#x, name) == 0) return x; +#define OBS_HOTKEY(x) \ + if (strcmp(#x, name) == 0) \ + return x; #include "obs-hotkeys.h" #undef OBS_HOTKEY return OBS_KEY_NONE; @@ -397,7 +401,8 @@ da_free(node->children); } - if (release && !node->is_leaf) bfree(node); + if (release && !node->is_leaf) + bfree(node); } void obs_hotkey_name_map_free(void)
View file
obs-studio-23.2.1.tar.xz/libobs/obs-hotkey.c -> obs-studio-24.0.0.tar.xz/libobs/obs-hotkey.c
Changed
@@ -63,8 +63,8 @@ return key->pair_partner_id; } -obs_key_combination_t obs_hotkey_binding_get_key_combination( - obs_hotkey_binding_t *binding) +obs_key_combination_t +obs_hotkey_binding_get_key_combination(obs_hotkey_binding_t *binding) { return binding->key; } @@ -105,8 +105,8 @@ } static inline bool find_pair_id(obs_hotkey_pair_id id, size_t *idx); -void obs_hotkey_pair_set_names(obs_hotkey_pair_id id, - const char *name0, const char *name1) +void obs_hotkey_pair_set_names(obs_hotkey_pair_id id, const char *name0, + const char *name1) { size_t idx; obs_hotkey_pair_t pair; @@ -120,8 +120,8 @@ obs_hotkey_set_name(pair.id[1], name1); } -void obs_hotkey_pair_set_descriptions(obs_hotkey_pair_id id, - const char *desc0, const char *desc1) +void obs_hotkey_pair_set_descriptions(obs_hotkey_pair_id id, const char *desc0, + const char *desc1) { size_t idx; obs_hotkey_pair_t pair; @@ -150,31 +150,31 @@ static inline void load_bindings(obs_hotkey_t *hotkey, obs_data_array_t *data); static inline void context_add_hotkey(struct obs_context_data *context, - obs_hotkey_id id) + obs_hotkey_id id) { da_push_back(context->hotkeys, &id); } -static inline obs_hotkey_id obs_hotkey_register_internal( - obs_hotkey_registerer_t type, void *registerer, - struct obs_context_data *context, - const char *name, const char *description, - obs_hotkey_func func, void *data) +static inline obs_hotkey_id +obs_hotkey_register_internal(obs_hotkey_registerer_t type, void *registerer, + struct obs_context_data *context, const char *name, + const char *description, obs_hotkey_func func, + void *data) { if ((obs->hotkeys.next_id + 1) == OBS_INVALID_HOTKEY_ID) blog(LOG_WARNING, "obs-hotkey: Available hotkey ids exhausted"); obs_hotkey_t *base_addr = obs->hotkeys.hotkeys.array; - obs_hotkey_id result = obs->hotkeys.next_id++; - obs_hotkey_t *hotkey = da_push_back_new(obs->hotkeys.hotkeys); - - hotkey->id = result; - hotkey->name = bstrdup(name); - hotkey->description = bstrdup(description); - hotkey->func = func; - hotkey->data = data; + obs_hotkey_id result = obs->hotkeys.next_id++; + obs_hotkey_t *hotkey = da_push_back_new(obs->hotkeys.hotkeys); + + hotkey->id = result; + hotkey->name = bstrdup(name); + hotkey->description = bstrdup(description); + hotkey->func = func; + hotkey->data = data; hotkey->registerer_type = type; - hotkey->registerer = registerer; + hotkey->registerer = registerer; hotkey->pair_partner_id = OBS_INVALID_HOTKEY_PAIR_ID; if (context) { @@ -195,81 +195,81 @@ } obs_hotkey_id obs_hotkey_register_frontend(const char *name, - const char *description, obs_hotkey_func func, void *data) + const char *description, + obs_hotkey_func func, void *data) { if (!lock()) return OBS_INVALID_HOTKEY_ID; - obs_hotkey_id id = obs_hotkey_register_internal( - OBS_HOTKEY_REGISTERER_FRONTEND, NULL, NULL, - name, description, func, data); + obs_hotkey_id id = obs_hotkey_register_internal( + OBS_HOTKEY_REGISTERER_FRONTEND, NULL, NULL, name, description, + func, data); unlock(); return id; } obs_hotkey_id obs_hotkey_register_encoder(obs_encoder_t *encoder, - const char *name, const char *description, - obs_hotkey_func func, void *data) + const char *name, + const char *description, + obs_hotkey_func func, void *data) { if (!encoder || !lock()) return OBS_INVALID_HOTKEY_ID; obs_hotkey_id id = obs_hotkey_register_internal( - OBS_HOTKEY_REGISTERER_ENCODER, - obs_encoder_get_weak_encoder(encoder), - &encoder->context, name, description, - func, data); + OBS_HOTKEY_REGISTERER_ENCODER, + obs_encoder_get_weak_encoder(encoder), &encoder->context, name, + description, func, data); unlock(); return id; } -obs_hotkey_id obs_hotkey_register_output(obs_output_t *output, - const char *name, const char *description, - obs_hotkey_func func, void *data) +obs_hotkey_id obs_hotkey_register_output(obs_output_t *output, const char *name, + const char *description, + obs_hotkey_func func, void *data) { if (!output || !lock()) return OBS_INVALID_HOTKEY_ID; obs_hotkey_id id = obs_hotkey_register_internal( - OBS_HOTKEY_REGISTERER_OUTPUT, - obs_output_get_weak_output(output), - &output->context, name, description, - func, data); + OBS_HOTKEY_REGISTERER_OUTPUT, + obs_output_get_weak_output(output), &output->context, name, + description, func, data); unlock(); return id; } obs_hotkey_id obs_hotkey_register_service(obs_service_t *service, - const char *name, const char *description, - obs_hotkey_func func, void *data) + const char *name, + const char *description, + obs_hotkey_func func, void *data) { if (!service || !lock()) return OBS_INVALID_HOTKEY_ID; obs_hotkey_id id = obs_hotkey_register_internal( - OBS_HOTKEY_REGISTERER_SERVICE, - obs_service_get_weak_service(service), - &service->context, name, description, - func, data); + OBS_HOTKEY_REGISTERER_SERVICE, + obs_service_get_weak_service(service), &service->context, name, + description, func, data); unlock(); return id; } obs_hotkey_id obs_hotkey_register_source(obs_source_t *source, const char *name, - const char *description, obs_hotkey_func func, void *data) + const char *description, + obs_hotkey_func func, void *data) { if (!source || source->context.private || !lock()) return OBS_INVALID_HOTKEY_ID; obs_hotkey_id id = obs_hotkey_register_internal( - OBS_HOTKEY_REGISTERER_SOURCE, - obs_source_get_weak_source(source), - &source->context, name, description, - func, data); + OBS_HOTKEY_REGISTERER_SOURCE, + obs_source_get_weak_source(source), &source->context, name, + description, func, data); unlock(); return id; @@ -278,16 +278,16 @@ static inline void fixup_pair_pointers(void); static obs_hotkey_pair_t *create_hotkey_pair(struct obs_context_data *context, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1) + obs_hotkey_active_func func0, + obs_hotkey_active_func func1, + void *data0, void *data1) { if ((obs->hotkeys.next_pair_id + 1) == OBS_INVALID_HOTKEY_PAIR_ID) blog(LOG_WARNING, "obs-hotkey: Available hotkey pair ids " - "exhausted"); + "exhausted"); obs_hotkey_pair_t *base_addr = obs->hotkeys.hotkey_pairs.array; - obs_hotkey_pair_t *pair = - da_push_back_new(obs->hotkeys.hotkey_pairs); + obs_hotkey_pair_t *pair = da_push_back_new(obs->hotkeys.hotkey_pairs); pair->pair_id = obs->hotkeys.next_pair_id++; pair->func[0] = func0; @@ -306,8 +306,8 @@ return pair; } -static void obs_hotkey_pair_first_func(void *data, - obs_hotkey_id id, obs_hotkey_t *hotkey, bool pressed) +static void obs_hotkey_pair_first_func(void *data, obs_hotkey_id id, + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); @@ -321,8 +321,8 @@ pair->pressed0 = pressed; } -static void obs_hotkey_pair_second_func(void *data, - obs_hotkey_id id, obs_hotkey_t *hotkey, bool pressed) +static void obs_hotkey_pair_second_func(void *data, obs_hotkey_id id, + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); @@ -338,30 +338,28 @@ static inline bool find_id(obs_hotkey_id id, size_t *idx); static obs_hotkey_pair_id register_hotkey_pair_internal( - obs_hotkey_registerer_t type, void *registerer, - void *(*weak_ref)(void*), - struct obs_context_data *context, - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1) + obs_hotkey_registerer_t type, void *registerer, + void *(*weak_ref)(void *), struct obs_context_data *context, + const char *name0, const char *description0, const char *name1, + const char *description1, obs_hotkey_active_func func0, + obs_hotkey_active_func func1, void *data0, void *data1) { if (!lock()) return OBS_INVALID_HOTKEY_PAIR_ID; - obs_hotkey_pair_t *pair = create_hotkey_pair(context, - func0, func1, data0, data1); + obs_hotkey_pair_t *pair = + create_hotkey_pair(context, func0, func1, data0, data1); - pair->id[0] = obs_hotkey_register_internal( - type, weak_ref(registerer), context, - name0, description0, - obs_hotkey_pair_first_func, pair); + pair->id[0] = obs_hotkey_register_internal(type, weak_ref(registerer), + context, name0, description0, + obs_hotkey_pair_first_func, + pair); - pair->id[1] = obs_hotkey_register_internal( - type, weak_ref(registerer), context, - name1, description1, - obs_hotkey_pair_second_func, pair); + pair->id[1] = obs_hotkey_register_internal(type, weak_ref(registerer), + context, name1, description1, + obs_hotkey_pair_second_func, + pair); size_t idx; if (find_id(pair->id[0], &idx)) @@ -382,15 +380,14 @@ } obs_hotkey_pair_id obs_hotkey_pair_register_frontend( - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1) + const char *name0, const char *description0, const char *name1, + const char *description1, obs_hotkey_active_func func0, + obs_hotkey_active_func func1, void *data0, void *data1) { - return register_hotkey_pair_internal( - OBS_HOTKEY_REGISTERER_FRONTEND, NULL, obs_id_, NULL, - name0, description0, name1, description1, - func0, func1, data0, data1); + return register_hotkey_pair_internal(OBS_HOTKEY_REGISTERER_FRONTEND, + NULL, obs_id_, NULL, name0, + description0, name1, description1, + func0, func1, data0, data1); } static inline void *weak_encoder_ref(void *ref) @@ -398,19 +395,19 @@ return obs_encoder_get_weak_encoder(ref); } -obs_hotkey_pair_id obs_hotkey_pair_register_encoder(obs_encoder_t *encoder, - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1) +obs_hotkey_pair_id obs_hotkey_pair_register_encoder( + obs_encoder_t *encoder, const char *name0, const char *description0, + const char *name1, const char *description1, + obs_hotkey_active_func func0, obs_hotkey_active_func func1, void *data0, + void *data1) { - if (!encoder) return OBS_INVALID_HOTKEY_PAIR_ID; - return register_hotkey_pair_internal( - OBS_HOTKEY_REGISTERER_ENCODER, encoder, - weak_encoder_ref, - &encoder->context, - name0, description0, name1, description1, - func0, func1, data0, data1); + if (!encoder) + return OBS_INVALID_HOTKEY_PAIR_ID; + return register_hotkey_pair_internal(OBS_HOTKEY_REGISTERER_ENCODER, + encoder, weak_encoder_ref, + &encoder->context, name0, + description0, name1, description1, + func0, func1, data0, data1); } static inline void *weak_output_ref(void *ref) @@ -418,19 +415,19 @@ return obs_output_get_weak_output(ref); } -obs_hotkey_pair_id obs_hotkey_pair_register_output(obs_output_t *output, - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1) +obs_hotkey_pair_id obs_hotkey_pair_register_output( + obs_output_t *output, const char *name0, const char *description0, + const char *name1, const char *description1, + obs_hotkey_active_func func0, obs_hotkey_active_func func1, void *data0, + void *data1) { - if (!output) return OBS_INVALID_HOTKEY_PAIR_ID; - return register_hotkey_pair_internal( - OBS_HOTKEY_REGISTERER_OUTPUT, output, - weak_output_ref, - &output->context, - name0, description0, name1, description1, - func0, func1, data0, data1); + if (!output) + return OBS_INVALID_HOTKEY_PAIR_ID; + return register_hotkey_pair_internal(OBS_HOTKEY_REGISTERER_OUTPUT, + output, weak_output_ref, + &output->context, name0, + description0, name1, description1, + func0, func1, data0, data1); } static inline void *weak_service_ref(void *ref) @@ -438,19 +435,19 @@ return obs_service_get_weak_service(ref); } -obs_hotkey_pair_id obs_hotkey_pair_register_service(obs_service_t *service, - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1) +obs_hotkey_pair_id obs_hotkey_pair_register_service( + obs_service_t *service, const char *name0, const char *description0, + const char *name1, const char *description1, + obs_hotkey_active_func func0, obs_hotkey_active_func func1, void *data0, + void *data1) { - if (!service) return OBS_INVALID_HOTKEY_PAIR_ID; - return register_hotkey_pair_internal( - OBS_HOTKEY_REGISTERER_SERVICE, service, - weak_service_ref, - &service->context, - name0, description0, name1, description1, - func0, func1, data0, data1); + if (!service) + return OBS_INVALID_HOTKEY_PAIR_ID; + return register_hotkey_pair_internal(OBS_HOTKEY_REGISTERER_SERVICE, + service, weak_service_ref, + &service->context, name0, + description0, name1, description1, + func0, func1, data0, data1); } static inline void *weak_source_ref(void *ref) @@ -458,27 +455,27 @@ return obs_source_get_weak_source(ref); } -obs_hotkey_pair_id obs_hotkey_pair_register_source(obs_source_t *source, - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1) +obs_hotkey_pair_id obs_hotkey_pair_register_source( + obs_source_t *source, const char *name0, const char *description0, + const char *name1, const char *description1, + obs_hotkey_active_func func0, obs_hotkey_active_func func1, void *data0, + void *data1) { - if (!source) return OBS_INVALID_HOTKEY_PAIR_ID; - return register_hotkey_pair_internal( - OBS_HOTKEY_REGISTERER_SOURCE, source, - weak_source_ref, - &source->context, - name0, description0, name1, description1, - func0, func1, data0, data1); + if (!source) + return OBS_INVALID_HOTKEY_PAIR_ID; + return register_hotkey_pair_internal(OBS_HOTKEY_REGISTERER_SOURCE, + source, weak_source_ref, + &source->context, name0, + description0, name1, description1, + func0, func1, data0, data1); } -typedef bool (*obs_hotkey_internal_enum_func)(void *data, - size_t idx, obs_hotkey_t *hotkey); +typedef bool (*obs_hotkey_internal_enum_func)(void *data, size_t idx, + obs_hotkey_t *hotkey); static inline void enum_hotkeys(obs_hotkey_internal_enum_func func, void *data) { - const size_t num = obs->hotkeys.hotkeys.num; + const size_t num = obs->hotkeys.hotkeys.num; obs_hotkey_t *array = obs->hotkeys.hotkeys.array; for (size_t i = 0; i < num; i++) { if (!func(data, i, &array[i])) @@ -487,12 +484,13 @@ } typedef bool (*obs_hotkey_pair_internal_enum_func)(size_t idx, - obs_hotkey_pair_t *pair, void *data); + obs_hotkey_pair_t *pair, + void *data); static inline void enum_hotkey_pairs(obs_hotkey_pair_internal_enum_func func, - void *data) + void *data) { - const size_t num = obs->hotkeys.hotkey_pairs.num; + const size_t num = obs->hotkeys.hotkey_pairs.num; obs_hotkey_pair_t *array = obs->hotkeys.hotkey_pairs.array; for (size_t i = 0; i < num; i++) { if (!func(i, &array[i], data)) @@ -500,13 +498,13 @@ } } -typedef bool (*obs_hotkey_binding_internal_enum_func)(void *data, - size_t idx, obs_hotkey_binding_t *binding); +typedef bool (*obs_hotkey_binding_internal_enum_func)( + void *data, size_t idx, obs_hotkey_binding_t *binding); static inline void enum_bindings(obs_hotkey_binding_internal_enum_func func, - void *data) + void *data) { - const size_t num = obs->hotkeys.bindings.num; + const size_t num = obs->hotkeys.bindings.num; obs_hotkey_binding_t *array = obs->hotkeys.bindings.array; for (size_t i = 0; i < num; i++) { if (!func(data, i, &array[i])) @@ -516,8 +514,8 @@ struct obs_hotkey_internal_find_forward { obs_hotkey_id id; - bool found; - size_t idx; + bool found; + size_t idx; }; static inline bool find_id_helper(void *data, size_t idx, obs_hotkey_t *hotkey) @@ -526,7 +524,7 @@ if (hotkey->id != find->id) return true; - find->idx = idx; + find->idx = idx; find->found = true; return false; } @@ -539,8 +537,8 @@ return find.found; } -static inline bool pointer_fixup_func(void *data, - size_t idx, obs_hotkey_binding_t *binding) +static inline bool pointer_fixup_func(void *data, size_t idx, + obs_hotkey_binding_t *binding) { UNUSED_PARAMETER(idx); UNUSED_PARAMETER(data); @@ -548,10 +546,10 @@ size_t idx_; if (!find_id(binding->hotkey_id, &idx_)) { bcrash("obs-hotkey: Could not find hotkey id '%" PRIuMAX "' " - "for binding '%s' (modifiers 0x%x)", - (uintmax_t)binding->hotkey_id, - obs_key_to_name(binding->key.key), - binding->key.modifiers); + "for binding '%s' (modifiers 0x%x)", + (uintmax_t)binding->hotkey_id, + obs_key_to_name(binding->key.key), + binding->key.modifiers); binding->hotkey = NULL; return true; } @@ -568,18 +566,18 @@ struct obs_hotkey_internal_find_pair_forward { obs_hotkey_pair_id id; - bool found; - size_t idx; + bool found; + size_t idx; }; static inline bool find_pair_id_helper(size_t idx, obs_hotkey_pair_t *pair, - void *data) + void *data) { struct obs_hotkey_internal_find_pair_forward *find = data; if (pair->pair_id != find->id) return true; - find->idx = idx; + find->idx = idx; find->found = true; return false; } @@ -592,8 +590,8 @@ return find.found; } -static inline bool pair_pointer_fixup_func(size_t idx, - obs_hotkey_pair_t *pair, void *data) +static inline bool pair_pointer_fixup_func(size_t idx, obs_hotkey_pair_t *pair, + void *data) { UNUSED_PARAMETER(idx); UNUSED_PARAMETER(data); @@ -613,9 +611,10 @@ } static inline void enum_context_hotkeys(struct obs_context_data *context, - obs_hotkey_internal_enum_func func, void *data) + obs_hotkey_internal_enum_func func, + void *data) { - const size_t num = context->hotkeys.num; + const size_t num = context->hotkeys.num; const obs_hotkey_id *array = context->hotkeys.array; obs_hotkey_t *hotkey_array = obs->hotkeys.hotkeys.array; for (size_t i = 0; i < num; i++) { @@ -629,14 +628,14 @@ } static inline void load_modifier(uint32_t *modifiers, obs_data_t *data, - const char *name, uint32_t flag) + const char *name, uint32_t flag) { if (obs_data_get_bool(data, name)) *modifiers |= flag; } static inline void create_binding(obs_hotkey_t *hotkey, - obs_key_combination_t combo) + obs_key_combination_t combo) { obs_hotkey_binding_t *binding = da_push_back_new(obs->hotkeys.bindings); if (!binding) @@ -644,7 +643,7 @@ binding->key = combo; binding->hotkey_id = hotkey->id; - binding->hotkey = hotkey; + binding->hotkey = hotkey; } static inline void load_binding(obs_hotkey_t *hotkey, obs_data_t *data) @@ -660,8 +659,8 @@ load_modifier(modifiers, data, "command", INTERACT_COMMAND_KEY); combo.key = obs_key_from_name(obs_data_get_string(data, "key")); - if (!modifiers && (combo.key == OBS_KEY_NONE || - combo.key >= OBS_KEY_LAST_VALUE)) + if (!modifiers && + (combo.key == OBS_KEY_NONE || combo.key >= OBS_KEY_LAST_VALUE)) return; create_binding(hotkey, combo); @@ -682,7 +681,7 @@ static inline void remove_bindings(obs_hotkey_id id); void obs_hotkey_load_bindings(obs_hotkey_id id, - obs_key_combination_t *combinations, size_t num) + obs_key_combination_t *combinations, size_t num) { size_t idx; @@ -714,8 +713,8 @@ unlock(); } -static inline bool enum_load_bindings(void *data, - size_t idx, obs_hotkey_t *hotkey) +static inline bool enum_load_bindings(void *data, size_t idx, + obs_hotkey_t *hotkey) { UNUSED_PARAMETER(idx); @@ -773,7 +772,7 @@ } void obs_hotkey_pair_load(obs_hotkey_pair_id id, obs_data_array_t *data0, - obs_data_array_t *data1) + obs_data_array_t *data1) { if ((!data0 && !data1) || !lock()) return; @@ -798,7 +797,7 @@ } static inline void save_modifier(uint32_t modifiers, obs_data_t *data, - const char *name, uint32_t flag) + const char *name, uint32_t flag) { if ((modifiers & flag) == flag) obs_data_set_bool(data, name, true); @@ -806,11 +805,11 @@ struct save_bindings_helper_t { obs_data_array_t *array; - obs_hotkey_t *hotkey; + obs_hotkey_t *hotkey; }; -static inline bool save_bindings_helper(void *data, - size_t idx, obs_hotkey_binding_t *binding) +static inline bool save_bindings_helper(void *data, size_t idx, + obs_hotkey_binding_t *binding) { UNUSED_PARAMETER(idx); struct save_bindings_helper_t *h = data; @@ -860,9 +859,8 @@ return result; } -void obs_hotkey_pair_save(obs_hotkey_pair_id id, - obs_data_array_t **p_data0, - obs_data_array_t **p_data1) +void obs_hotkey_pair_save(obs_hotkey_pair_id id, obs_data_array_t **p_data0, + obs_data_array_t **p_data1) { if ((!p_data0 && !p_data1) || !lock()) return; @@ -884,8 +882,8 @@ unlock(); } -static inline bool enum_save_hotkey(void *data, - size_t idx, obs_hotkey_t *hotkey) +static inline bool enum_save_hotkey(void *data, size_t idx, + obs_hotkey_t *hotkey) { UNUSED_PARAMETER(idx); @@ -963,14 +961,14 @@ bool found; }; -static inline bool binding_finder(void *data, - size_t idx, obs_hotkey_binding_t *binding) +static inline bool binding_finder(void *data, size_t idx, + obs_hotkey_binding_t *binding) { struct binding_find_data *find = data; if (binding->hotkey_id != find->id) return true; - *find->idx = idx; + *find->idx = idx; find->found = true; return false; } @@ -1099,7 +1097,7 @@ bool need_fixup = false; for (size_t i = 0; i < context->hotkeys.num; i++) need_fixup = unregister_hotkey(context->hotkeys.array[i]) || - need_fixup; + need_fixup; if (need_fixup) fixup_pointers(); @@ -1115,9 +1113,9 @@ bool need_fixup = false; for (size_t i = 0; i < context->hotkey_pairs.num; i++) - need_fixup = - unregister_hotkey_pair(context->hotkey_pairs.array[i]) - || need_fixup; + need_fixup = unregister_hotkey_pair( + context->hotkey_pairs.array[i]) || + need_fixup; if (need_fixup) fixup_pair_pointers(); @@ -1140,7 +1138,7 @@ void obs_hotkeys_free(void) { - const size_t num = obs->hotkeys.hotkeys.num; + const size_t num = obs->hotkeys.hotkeys.num; obs_hotkey_t *hotkeys = obs->hotkeys.hotkeys.array; for (size_t i = 0; i < num; i++) { bfree(hotkeys[i].name); @@ -1162,7 +1160,7 @@ struct obs_hotkey_internal_enum_forward { obs_hotkey_enum_func func; - void *data; + void *data; }; static inline bool enum_hotkey(void *data, size_t idx, obs_hotkey_t *hotkey) @@ -1193,18 +1191,18 @@ } static inline bool modifiers_match(obs_hotkey_binding_t *binding, - uint32_t modifiers_, bool strict_modifiers) + uint32_t modifiers_, bool strict_modifiers) { uint32_t modifiers = binding->key.modifiers; return !modifiers || - (!strict_modifiers && (modifiers & modifiers_) == modifiers) || - (strict_modifiers && modifiers == modifiers_); + (!strict_modifiers && (modifiers & modifiers_) == modifiers) || + (strict_modifiers && modifiers == modifiers_); } static inline bool is_pressed(obs_key_t key) { return obs_hotkeys_platform_is_pressed(obs->hotkeys.platform_context, - key); + key); } static inline void press_released_binding(obs_hotkey_binding_t *binding) @@ -1219,7 +1217,7 @@ hotkey->func(hotkey->data, hotkey->id, hotkey, true); else if (obs->hotkeys.router_func) obs->hotkeys.router_func(obs->hotkeys.router_func_data, - hotkey->id, true); + hotkey->id, true); } static inline void release_pressed_binding(obs_hotkey_binding_t *binding) @@ -1234,16 +1232,16 @@ hotkey->func(hotkey->data, hotkey->id, hotkey, false); else if (obs->hotkeys.router_func) obs->hotkeys.router_func(obs->hotkeys.router_func_data, - hotkey->id, false); + hotkey->id, false); } static inline void handle_binding(obs_hotkey_binding_t *binding, - uint32_t modifiers, bool no_press, bool strict_modifiers, - bool *pressed) + uint32_t modifiers, bool no_press, + bool strict_modifiers, bool *pressed) { - bool modifiers_match_ = modifiers_match(binding, modifiers, - strict_modifiers); - bool modifiers_only = binding->key.key == OBS_KEY_NONE; + bool modifiers_match_ = + modifiers_match(binding, modifiers, strict_modifiers); + bool modifiers_only = binding->key.key == OBS_KEY_NONE; if (!binding->key.modifiers) binding->modifiers_match = true; @@ -1258,7 +1256,7 @@ goto reset; if ((pressed && !*pressed) || - (!pressed && !is_pressed(binding->key.key))) + (!pressed && !is_pressed(binding->key.key))) goto reset; if (binding->pressed || no_press) @@ -1277,22 +1275,22 @@ struct obs_hotkey_internal_inject { obs_key_combination_t hotkey; - bool pressed; - bool strict_modifiers; + bool pressed; + bool strict_modifiers; }; -static inline bool inject_hotkey(void *data, - size_t idx, obs_hotkey_binding_t *binding) +static inline bool inject_hotkey(void *data, size_t idx, + obs_hotkey_binding_t *binding) { UNUSED_PARAMETER(idx); struct obs_hotkey_internal_inject *event = data; if (modifiers_match(binding, event->hotkey.modifiers, - event->strict_modifiers)) { + event->strict_modifiers)) { bool pressed = binding->key.key == event->hotkey.key && - event->pressed; + event->pressed; handle_binding(binding, event->hotkey.modifiers, false, - event->strict_modifiers, &pressed); + event->strict_modifiers, &pressed); } return true; @@ -1305,7 +1303,8 @@ struct obs_hotkey_internal_inject event = { {hotkey.modifiers, hotkey.key}, - pressed, obs->hotkeys.strict_modifiers, + pressed, + obs->hotkeys.strict_modifiers, }; enum_bindings(inject_hotkey, &event); unlock(); @@ -1331,19 +1330,19 @@ struct obs_query_hotkeys_helper { uint32_t modifiers; - bool no_press; - bool strict_modifiers; + bool no_press; + bool strict_modifiers; }; -static inline bool query_hotkey(void *data, - size_t idx, obs_hotkey_binding_t *binding) +static inline bool query_hotkey(void *data, size_t idx, + obs_hotkey_binding_t *binding) { UNUSED_PARAMETER(idx); struct obs_query_hotkeys_helper *param = - (struct obs_query_hotkeys_helper*)data; + (struct obs_query_hotkeys_helper *)data; handle_binding(binding, param->modifiers, param->no_press, - param->strict_modifiers, NULL); + param->strict_modifiers, NULL); return true; } @@ -1376,7 +1375,7 @@ const char *hotkey_thread_name = profile_store_name(obs_get_profiler_name_store(), - "obs_hotkey_thread(%g"NBSP"ms)", 25.); + "obs_hotkey_thread(%g" NBSP "ms)", 25.); profile_register_root(hotkey_thread_name, (uint64_t)25000000); while (os_event_timedwait(obs->hotkeys.stop_event, 25) == ETIMEDOUT) { @@ -1414,7 +1413,7 @@ } void obs_hotkey_set_callback_routing_func(obs_hotkey_callback_router_func func, - void *data) + void *data) { if (!lock()) return; @@ -1443,10 +1442,10 @@ } void obs_hotkeys_set_translations_s( - struct obs_hotkeys_translations *translations, size_t size) + struct obs_hotkeys_translations *translations, size_t size) { #define ADD_TRANSLATION(key_name, var_name) \ - if (t.var_name) \ + if (t.var_name) \ obs_set_key_translation(key_name, t.var_name); struct obs_hotkeys_translations t = {0}; @@ -1505,10 +1504,10 @@ dstr_cat(&numpad, " %1"); } -#define ADD_NUMPAD_NUM(idx) \ - dstr_copy_dstr(&button, &numpad); \ - dstr_replace(&button, "%1", #idx); \ - obs_set_key_translation(OBS_KEY_NUM ## idx, button.array) +#define ADD_NUMPAD_NUM(idx) \ + dstr_copy_dstr(&button, &numpad); \ + dstr_replace(&button, "%1", #idx); \ + obs_set_key_translation(OBS_KEY_NUM##idx, button.array) ADD_NUMPAD_NUM(0); ADD_NUMPAD_NUM(1); @@ -1530,10 +1529,10 @@ dstr_cat(&mouse, " %1"); } -#define ADD_MOUSE_NUM(idx) \ - dstr_copy_dstr(&button, &mouse); \ - dstr_replace(&button, "%1", #idx); \ - obs_set_key_translation(OBS_KEY_MOUSE ## idx, button.array) +#define ADD_MOUSE_NUM(idx) \ + dstr_copy_dstr(&button, &mouse); \ + dstr_replace(&button, "%1", #idx); \ + obs_set_key_translation(OBS_KEY_MOUSE##idx, button.array) ADD_MOUSE_NUM(1); ADD_MOUSE_NUM(2); @@ -1577,24 +1576,28 @@ return NULL; } - return obs->hotkeys.translations[key] ? - obs->hotkeys.translations[key] : def; + return obs->hotkeys.translations[key] ? obs->hotkeys.translations[key] + : def; } void obs_hotkey_update_atomic(obs_hotkey_atomic_update_func func, void *data) { - if (!lock()) return; + if (!lock()) + return; func(data); unlock(); } -void obs_hotkeys_set_audio_hotkeys_translations( - const char *mute, const char *unmute, - const char *push_to_mute, const char *push_to_talk) +void obs_hotkeys_set_audio_hotkeys_translations(const char *mute, + const char *unmute, + const char *push_to_mute, + const char *push_to_talk) { -#define SET_T(n) bfree(obs->hotkeys.n); obs->hotkeys.n = bstrdup(n) +#define SET_T(n) \ + bfree(obs->hotkeys.n); \ + obs->hotkeys.n = bstrdup(n) SET_T(mute); SET_T(unmute); SET_T(push_to_mute); @@ -1602,10 +1605,11 @@ #undef SET_T } -void obs_hotkeys_set_sceneitem_hotkeys_translations( - const char *show, const char *hide) +void obs_hotkeys_set_sceneitem_hotkeys_translations(const char *show, + const char *hide) { -#define SET_T(n) bfree(obs->hotkeys.sceneitem_##n); \ +#define SET_T(n) \ + bfree(obs->hotkeys.sceneitem_##n); \ obs->hotkeys.sceneitem_##n = bstrdup(n) SET_T(show); SET_T(hide);
View file
obs-studio-23.2.1.tar.xz/libobs/obs-hotkey.h -> obs-studio-24.0.0.tar.xz/libobs/obs-hotkey.h
Changed
@@ -43,7 +43,7 @@ typedef enum obs_key obs_key_t; struct obs_key_combination { - uint32_t modifiers; + uint32_t modifiers; obs_key_t key; }; typedef struct obs_key_combination obs_key_combination_t; @@ -65,27 +65,27 @@ EXPORT obs_hotkey_id obs_hotkey_get_id(const obs_hotkey_t *key); EXPORT const char *obs_hotkey_get_name(const obs_hotkey_t *key); EXPORT const char *obs_hotkey_get_description(const obs_hotkey_t *key); -EXPORT obs_hotkey_registerer_t obs_hotkey_get_registerer_type( - const obs_hotkey_t *key); +EXPORT obs_hotkey_registerer_t +obs_hotkey_get_registerer_type(const obs_hotkey_t *key); EXPORT void *obs_hotkey_get_registerer(const obs_hotkey_t *key); EXPORT obs_hotkey_id obs_hotkey_get_pair_partner_id(const obs_hotkey_t *key); - -EXPORT obs_key_combination_t obs_hotkey_binding_get_key_combination( - obs_hotkey_binding_t *binding); -EXPORT obs_hotkey_id obs_hotkey_binding_get_hotkey_id( - obs_hotkey_binding_t *binding); -EXPORT obs_hotkey_t *obs_hotkey_binding_get_hotkey( - obs_hotkey_binding_t *binding); +EXPORT obs_key_combination_t +obs_hotkey_binding_get_key_combination(obs_hotkey_binding_t *binding); +EXPORT obs_hotkey_id +obs_hotkey_binding_get_hotkey_id(obs_hotkey_binding_t *binding); +EXPORT obs_hotkey_t * +obs_hotkey_binding_get_hotkey(obs_hotkey_binding_t *binding); /* setter functions */ EXPORT void obs_hotkey_set_name(obs_hotkey_id id, const char *name); EXPORT void obs_hotkey_set_description(obs_hotkey_id id, const char *desc); -EXPORT void obs_hotkey_pair_set_names(obs_hotkey_pair_id id, - const char *name0, const char *name1); +EXPORT void obs_hotkey_pair_set_names(obs_hotkey_pair_id id, const char *name0, + const char *name1); EXPORT void obs_hotkey_pair_set_descriptions(obs_hotkey_pair_id id, - const char *desc0, const char *desc1); + const char *desc0, + const char *desc1); #ifndef SWIG struct obs_hotkeys_translations { @@ -134,81 +134,88 @@ * translations for these keys, it will use the operating system's translation * over these translations. If no translations are specified, it will use * the default English translations for that specific operating system. */ -EXPORT void obs_hotkeys_set_translations_s( - struct obs_hotkeys_translations *translations, size_t size); +EXPORT void +obs_hotkeys_set_translations_s(struct obs_hotkeys_translations *translations, + size_t size); #endif #define obs_hotkeys_set_translations(translations) \ - obs_hotkeys_set_translations_s(translations, \ - sizeof(struct obs_hotkeys_translations)) + obs_hotkeys_set_translations_s( \ + translations, sizeof(struct obs_hotkeys_translations)) -EXPORT void obs_hotkeys_set_audio_hotkeys_translations( - const char *mute, const char *unmute, - const char *push_to_mute, const char *push_to_talk); +EXPORT void +obs_hotkeys_set_audio_hotkeys_translations(const char *mute, const char *unmute, + const char *push_to_mute, + const char *push_to_talk); -EXPORT void obs_hotkeys_set_sceneitem_hotkeys_translations( - const char *show, const char *hide); +EXPORT void obs_hotkeys_set_sceneitem_hotkeys_translations(const char *show, + const char *hide); /* registering hotkeys (giving hotkeys a name and a function) */ -typedef void (*obs_hotkey_func)(void *data, - obs_hotkey_id id, obs_hotkey_t *hotkey, bool pressed); +typedef void (*obs_hotkey_func)(void *data, obs_hotkey_id id, + obs_hotkey_t *hotkey, bool pressed); EXPORT obs_hotkey_id obs_hotkey_register_frontend(const char *name, - const char *description, obs_hotkey_func func, void *data); + const char *description, + obs_hotkey_func func, + void *data); EXPORT obs_hotkey_id obs_hotkey_register_encoder(obs_encoder_t *encoder, - const char *name, const char *description, - obs_hotkey_func func, void *data); + const char *name, + const char *description, + obs_hotkey_func func, + void *data); EXPORT obs_hotkey_id obs_hotkey_register_output(obs_output_t *output, - const char *name, const char *description, - obs_hotkey_func func, void *data); + const char *name, + const char *description, + obs_hotkey_func func, + void *data); EXPORT obs_hotkey_id obs_hotkey_register_service(obs_service_t *service, - const char *name, const char *description, - obs_hotkey_func func, void *data); + const char *name, + const char *description, + obs_hotkey_func func, + void *data); EXPORT obs_hotkey_id obs_hotkey_register_source(obs_source_t *source, - const char *name, const char *description, - obs_hotkey_func func, void *data); + const char *name, + const char *description, + obs_hotkey_func func, + void *data); -typedef bool (*obs_hotkey_active_func)(void *data, - obs_hotkey_pair_id id, obs_hotkey_t *hotkey, bool pressed); +typedef bool (*obs_hotkey_active_func)(void *data, obs_hotkey_pair_id id, + obs_hotkey_t *hotkey, bool pressed); EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_frontend( - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1); + const char *name0, const char *description0, const char *name1, + const char *description1, obs_hotkey_active_func func0, + obs_hotkey_active_func func1, void *data0, void *data1); EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_encoder( - obs_encoder_t *encoder, - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1); + obs_encoder_t *encoder, const char *name0, const char *description0, + const char *name1, const char *description1, + obs_hotkey_active_func func0, obs_hotkey_active_func func1, void *data0, + void *data1); EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_output( - obs_output_t *output, - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1); + obs_output_t *output, const char *name0, const char *description0, + const char *name1, const char *description1, + obs_hotkey_active_func func0, obs_hotkey_active_func func1, void *data0, + void *data1); EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_service( - obs_service_t *service, - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1); + obs_service_t *service, const char *name0, const char *description0, + const char *name1, const char *description1, + obs_hotkey_active_func func0, obs_hotkey_active_func func1, void *data0, + void *data1); EXPORT obs_hotkey_pair_id obs_hotkey_pair_register_source( - obs_source_t *source, - const char *name0, const char *description0, - const char *name1, const char *description1, - obs_hotkey_active_func func0, obs_hotkey_active_func func1, - void *data0, void *data1); + obs_source_t *source, const char *name0, const char *description0, + const char *name1, const char *description1, + obs_hotkey_active_func func0, obs_hotkey_active_func func1, void *data0, + void *data1); EXPORT void obs_hotkey_unregister(obs_hotkey_id id); @@ -217,29 +224,29 @@ /* loading hotkeys (associating a hotkey with a physical key and modifiers) */ EXPORT void obs_hotkey_load_bindings(obs_hotkey_id id, - obs_key_combination_t *combinations, size_t num); + obs_key_combination_t *combinations, + size_t num); EXPORT void obs_hotkey_load(obs_hotkey_id id, obs_data_array_t *data); EXPORT void obs_hotkeys_load_encoder(obs_encoder_t *encoder, - obs_data_t *hotkeys); + obs_data_t *hotkeys); EXPORT void obs_hotkeys_load_output(obs_output_t *output, obs_data_t *hotkeys); EXPORT void obs_hotkeys_load_service(obs_service_t *service, - obs_data_t *hotkeys); + obs_data_t *hotkeys); EXPORT void obs_hotkeys_load_source(obs_source_t *source, obs_data_t *hotkeys); EXPORT void obs_hotkey_pair_load(obs_hotkey_pair_id id, obs_data_array_t *data0, - obs_data_array_t *data1); - + obs_data_array_t *data1); EXPORT obs_data_array_t *obs_hotkey_save(obs_hotkey_id id); EXPORT void obs_hotkey_pair_save(obs_hotkey_pair_id id, - obs_data_array_t **p_data0, - obs_data_array_t **p_data1); + obs_data_array_t **p_data0, + obs_data_array_t **p_data1); EXPORT obs_data_t *obs_hotkeys_save_encoder(obs_encoder_t *encoder); @@ -251,18 +258,18 @@ /* enumerating hotkeys */ -typedef bool (*obs_hotkey_enum_func)(void *data, - obs_hotkey_id id, obs_hotkey_t *key); +typedef bool (*obs_hotkey_enum_func)(void *data, obs_hotkey_id id, + obs_hotkey_t *key); EXPORT void obs_enum_hotkeys(obs_hotkey_enum_func func, void *data); /* enumerating bindings */ -typedef bool (*obs_hotkey_binding_enum_func)(void *data, - size_t idx, obs_hotkey_binding_t* binding); +typedef bool (*obs_hotkey_binding_enum_func)(void *data, size_t idx, + obs_hotkey_binding_t *binding); EXPORT void obs_enum_hotkey_bindings(obs_hotkey_binding_enum_func func, - void *data); + void *data); /* hotkey event control */ @@ -274,11 +281,12 @@ /* hotkey callback routing (trigger callbacks through e.g. a UI thread) */ -typedef void (*obs_hotkey_callback_router_func)(void *data, - obs_hotkey_id id, bool pressed); +typedef void (*obs_hotkey_callback_router_func)(void *data, obs_hotkey_id id, + bool pressed); -EXPORT void obs_hotkey_set_callback_routing_func(obs_hotkey_callback_router_func - func, void *data); +EXPORT void +obs_hotkey_set_callback_routing_func(obs_hotkey_callback_router_func func, + void *data); EXPORT void obs_hotkey_trigger_routed_callback(obs_hotkey_id id, bool pressed); @@ -290,12 +298,12 @@ typedef void (*obs_hotkey_atomic_update_func)(void *); EXPORT void obs_hotkey_update_atomic(obs_hotkey_atomic_update_func func, - void *data); + void *data); struct dstr; EXPORT void obs_key_to_str(obs_key_t key, struct dstr *str); EXPORT void obs_key_combination_to_str(obs_key_combination_t key, - struct dstr *str); + struct dstr *str); EXPORT obs_key_t obs_key_from_virtual_key(int code); EXPORT int obs_key_to_virtual_key(obs_key_t key);
View file
obs-studio-23.2.1.tar.xz/libobs/obs-hotkeys.h -> obs-studio-24.0.0.tar.xz/libobs/obs-hotkeys.h
Changed
@@ -437,7 +437,6 @@ OBS_HOTKEY(OBS_KEY_ZOOM) OBS_HOTKEY(OBS_KEY_CANCEL) - #ifndef OBS_MOUSE_BUTTON #define OBS_MOUSE_BUTTON(x) OBS_HOTKEY(x) #define OBS_MOUSE_BUTTON_DEFAULT 1
View file
obs-studio-23.2.1.tar.xz/libobs/obs-interaction.h -> obs-studio-24.0.0.tar.xz/libobs/obs-interaction.h
Changed
@@ -20,37 +20,37 @@ #include "util/c99defs.h" enum obs_interaction_flags { - INTERACT_NONE = 0, - INTERACT_CAPS_KEY = 1, - INTERACT_SHIFT_KEY = 1 << 1, - INTERACT_CONTROL_KEY = 1 << 2, - INTERACT_ALT_KEY = 1 << 3, - INTERACT_MOUSE_LEFT = 1 << 4, - INTERACT_MOUSE_MIDDLE = 1 << 5, - INTERACT_MOUSE_RIGHT = 1 << 6, - INTERACT_COMMAND_KEY = 1 << 7, - INTERACT_NUMLOCK_KEY = 1 << 8, - INTERACT_IS_KEY_PAD = 1 << 9, - INTERACT_IS_LEFT = 1 << 10, - INTERACT_IS_RIGHT = 1 << 11 + INTERACT_NONE = 0, + INTERACT_CAPS_KEY = 1, + INTERACT_SHIFT_KEY = 1 << 1, + INTERACT_CONTROL_KEY = 1 << 2, + INTERACT_ALT_KEY = 1 << 3, + INTERACT_MOUSE_LEFT = 1 << 4, + INTERACT_MOUSE_MIDDLE = 1 << 5, + INTERACT_MOUSE_RIGHT = 1 << 6, + INTERACT_COMMAND_KEY = 1 << 7, + INTERACT_NUMLOCK_KEY = 1 << 8, + INTERACT_IS_KEY_PAD = 1 << 9, + INTERACT_IS_LEFT = 1 << 10, + INTERACT_IS_RIGHT = 1 << 11, }; enum obs_mouse_button_type { MOUSE_LEFT, MOUSE_MIDDLE, - MOUSE_RIGHT + MOUSE_RIGHT, }; struct obs_mouse_event { - uint32_t modifiers; - int32_t x; - int32_t y; + uint32_t modifiers; + int32_t x; + int32_t y; }; struct obs_key_event { - uint32_t modifiers; - char *text; - uint32_t native_modifiers; - uint32_t native_scancode; - uint32_t native_vkey; + uint32_t modifiers; + char *text; + uint32_t native_modifiers; + uint32_t native_scancode; + uint32_t native_vkey; };
View file
obs-studio-23.2.1.tar.xz/libobs/obs-internal.h -> obs-studio-24.0.0.tar.xz/libobs/obs-internal.h
Changed
@@ -37,6 +37,7 @@ #include "obs.h" #define NUM_TEXTURES 2 +#define NUM_CHANNELS 3 #define MICROSECOND_DEN 1000000 #define NUM_ENCODE_TEXTURES 3 #define NUM_ENCODE_TEXTURE_FRAMES_TO_WAIT 1 @@ -60,7 +61,7 @@ /* validity checks */ static inline bool obs_object_valid(const void *obj, const char *f, - const char *t) + const char *t) { if (!obj) { blog(LOG_DEBUG, "%s: Null '%s' parameter", f, t); @@ -71,8 +72,8 @@ } #define obs_ptr_valid(ptr, func) obs_object_valid(ptr, func, #ptr) -#define obs_source_valid obs_ptr_valid -#define obs_output_valid obs_ptr_valid +#define obs_source_valid obs_ptr_valid +#define obs_output_valid obs_ptr_valid #define obs_encoder_valid obs_ptr_valid #define obs_service_valid obs_ptr_valid @@ -87,13 +88,13 @@ void *module; bool loaded; - bool (*load)(void); - void (*unload)(void); - void (*post_load)(void); - void (*set_locale)(const char *locale); - void (*free_locale)(void); - uint32_t (*ver)(void); - void (*set_pointer)(obs_module_t *module); + bool (*load)(void); + void (*unload)(void); + void (*post_load)(void); + void (*set_locale)(const char *locale); + void (*free_locale)(void); + uint32_t (*ver)(void); + void (*set_pointer)(obs_module_t *module); const char *(*name)(void); const char *(*description)(void); const char *(*author)(void); @@ -117,7 +118,7 @@ } static inline bool check_path(const char *data, const char *path, - struct dstr *output) + struct dstr *output) { dstr_copy(output, path); dstr_cat(output, data); @@ -125,32 +126,31 @@ return os_file_exists(output->array); } - /* ------------------------------------------------------------------------- */ /* hotkeys */ struct obs_hotkey { - obs_hotkey_id id; - char *name; - char *description; + obs_hotkey_id id; + char *name; + char *description; - obs_hotkey_func func; - void *data; - int pressed; + obs_hotkey_func func; + void *data; + int pressed; - obs_hotkey_registerer_t registerer_type; - void *registerer; + obs_hotkey_registerer_t registerer_type; + void *registerer; - obs_hotkey_id pair_partner_id; + obs_hotkey_id pair_partner_id; }; struct obs_hotkey_pair { - obs_hotkey_pair_id pair_id; - obs_hotkey_id id[2]; - obs_hotkey_active_func func[2]; - bool pressed0; - bool pressed1; - void *data[2]; + obs_hotkey_pair_id pair_id; + obs_hotkey_id id[2]; + obs_hotkey_active_func func[2]; + bool pressed0; + bool pressed1; + void *data[2]; }; typedef struct obs_hotkey_pair obs_hotkey_pair_t; @@ -163,7 +163,7 @@ bool obs_hotkeys_platform_init(struct obs_core_hotkeys *hotkeys); void obs_hotkeys_platform_free(struct obs_core_hotkeys *hotkeys); bool obs_hotkeys_platform_is_pressed(obs_hotkeys_platform_t *context, - obs_key_t key); + obs_key_t key); const char *obs_get_hotkey_translation(obs_key_t key, const char *def); @@ -173,52 +173,49 @@ void obs_hotkeys_free(void); struct obs_hotkey_binding { - obs_key_combination_t key; - bool pressed; - bool modifiers_match; + obs_key_combination_t key; + bool pressed; + bool modifiers_match; - obs_hotkey_id hotkey_id; - obs_hotkey_t *hotkey; + obs_hotkey_id hotkey_id; + obs_hotkey_t *hotkey; }; struct obs_hotkey_name_map; void obs_hotkey_name_map_free(void); - /* ------------------------------------------------------------------------- */ /* views */ struct obs_view { - pthread_mutex_t channels_mutex; - obs_source_t *channels[MAX_CHANNELS]; + pthread_mutex_t channels_mutex; + obs_source_t *channels[MAX_CHANNELS]; }; extern bool obs_view_init(struct obs_view *view); extern void obs_view_free(struct obs_view *view); - /* ------------------------------------------------------------------------- */ /* displays */ struct obs_display { - bool size_changed; - bool enabled; - uint32_t cx, cy; - uint32_t background_color; - gs_swapchain_t *swap; - pthread_mutex_t draw_callbacks_mutex; - pthread_mutex_t draw_info_mutex; - DARRAY(struct draw_callback) draw_callbacks; - - struct obs_display *next; - struct obs_display **prev_next; + bool size_changed; + bool enabled; + uint32_t cx, cy; + uint32_t background_color; + gs_swapchain_t *swap; + pthread_mutex_t draw_callbacks_mutex; + pthread_mutex_t draw_info_mutex; + DARRAY(struct draw_callback) draw_callbacks; + + struct obs_display *next; + struct obs_display **prev_next; }; extern bool obs_display_init(struct obs_display *display, - const struct gs_init_data *graphics_data); + const struct gs_init_data *graphics_data); extern void obs_display_free(struct obs_display *display); - /* ------------------------------------------------------------------------- */ /* core */ @@ -238,194 +235,191 @@ }; struct obs_core_video { - graphics_t *graphics; - gs_stagesurf_t *copy_surfaces[NUM_TEXTURES]; - gs_texture_t *render_textures[NUM_TEXTURES]; - gs_texture_t *output_textures[NUM_TEXTURES]; - gs_texture_t *convert_textures[NUM_TEXTURES]; - gs_texture_t *convert_uv_textures[NUM_TEXTURES]; - bool textures_rendered[NUM_TEXTURES]; - bool textures_output[NUM_TEXTURES]; - bool textures_copied[NUM_TEXTURES]; - bool textures_converted[NUM_TEXTURES]; - bool using_nv12_tex; - struct circlebuf vframe_info_buffer; - struct circlebuf vframe_info_buffer_gpu; - gs_effect_t *default_effect; - gs_effect_t *default_rect_effect; - gs_effect_t *opaque_effect; - gs_effect_t *solid_effect; - gs_effect_t *repeat_effect; - gs_effect_t *conversion_effect; - gs_effect_t *bicubic_effect; - gs_effect_t *lanczos_effect; - gs_effect_t *area_effect; - gs_effect_t *bilinear_lowres_effect; - gs_effect_t *premultiplied_alpha_effect; - gs_samplerstate_t *point_sampler; - gs_stagesurf_t *mapped_surface; - int cur_texture; - long raw_active; - long gpu_encoder_active; - pthread_mutex_t gpu_encoder_mutex; - struct circlebuf gpu_encoder_queue; - struct circlebuf gpu_encoder_avail_queue; - DARRAY(obs_encoder_t *) gpu_encoders; - os_sem_t *gpu_encode_semaphore; - os_event_t *gpu_encode_inactive; - pthread_t gpu_encode_thread; - bool gpu_encode_thread_initialized; - volatile bool gpu_encode_stop; - - uint64_t video_time; - uint64_t video_avg_frame_time_ns; - double video_fps; - video_t *video; - pthread_t video_thread; - uint32_t total_frames; - uint32_t lagged_frames; - bool thread_initialized; - - bool gpu_conversion; - const char *conversion_tech; - uint32_t conversion_height; - uint32_t plane_offsets[3]; - uint32_t plane_sizes[3]; - uint32_t plane_linewidth[3]; - - uint32_t output_width; - uint32_t output_height; - uint32_t base_width; - uint32_t base_height; - float color_matrix[16]; - enum obs_scale_type scale_type; - - gs_texture_t *transparent_texture; - - gs_effect_t *deinterlace_discard_effect; - gs_effect_t *deinterlace_discard_2x_effect; - gs_effect_t *deinterlace_linear_effect; - gs_effect_t *deinterlace_linear_2x_effect; - gs_effect_t *deinterlace_blend_effect; - gs_effect_t *deinterlace_blend_2x_effect; - gs_effect_t *deinterlace_yadif_effect; - gs_effect_t *deinterlace_yadif_2x_effect; - - struct obs_video_info ovi; + graphics_t *graphics; + gs_stagesurf_t *copy_surfaces[NUM_TEXTURES][NUM_CHANNELS]; + gs_texture_t *render_texture; + gs_texture_t *output_texture; + gs_texture_t *convert_textures[NUM_CHANNELS]; + bool texture_rendered; + bool textures_copied[NUM_TEXTURES]; + bool texture_converted; + bool using_nv12_tex; + struct circlebuf vframe_info_buffer; + struct circlebuf vframe_info_buffer_gpu; + gs_effect_t *default_effect; + gs_effect_t *default_rect_effect; + gs_effect_t *opaque_effect; + gs_effect_t *solid_effect; + gs_effect_t *repeat_effect; + gs_effect_t *conversion_effect; + gs_effect_t *bicubic_effect; + gs_effect_t *lanczos_effect; + gs_effect_t *area_effect; + gs_effect_t *bilinear_lowres_effect; + gs_effect_t *premultiplied_alpha_effect; + gs_samplerstate_t *point_sampler; + gs_stagesurf_t *mapped_surfaces[NUM_CHANNELS]; + int cur_texture; + long raw_active; + long gpu_encoder_active; + pthread_mutex_t gpu_encoder_mutex; + struct circlebuf gpu_encoder_queue; + struct circlebuf gpu_encoder_avail_queue; + DARRAY(obs_encoder_t *) gpu_encoders; + os_sem_t *gpu_encode_semaphore; + os_event_t *gpu_encode_inactive; + pthread_t gpu_encode_thread; + bool gpu_encode_thread_initialized; + volatile bool gpu_encode_stop; + + uint64_t video_time; + uint64_t video_frame_interval_ns; + uint64_t video_avg_frame_time_ns; + double video_fps; + video_t *video; + pthread_t video_thread; + uint32_t total_frames; + uint32_t lagged_frames; + bool thread_initialized; + + bool gpu_conversion; + const char *conversion_techs[NUM_CHANNELS]; + bool conversion_needed; + float conversion_width_i; + + uint32_t output_width; + uint32_t output_height; + uint32_t base_width; + uint32_t base_height; + float color_matrix[16]; + enum obs_scale_type scale_type; + + gs_texture_t *transparent_texture; + + gs_effect_t *deinterlace_discard_effect; + gs_effect_t *deinterlace_discard_2x_effect; + gs_effect_t *deinterlace_linear_effect; + gs_effect_t *deinterlace_linear_2x_effect; + gs_effect_t *deinterlace_blend_effect; + gs_effect_t *deinterlace_blend_2x_effect; + gs_effect_t *deinterlace_yadif_effect; + gs_effect_t *deinterlace_yadif_2x_effect; + + struct obs_video_info ovi; }; struct audio_monitor; struct obs_core_audio { - audio_t *audio; + audio_t *audio; - DARRAY(struct obs_source*) render_order; - DARRAY(struct obs_source*) root_nodes; + DARRAY(struct obs_source *) render_order; + DARRAY(struct obs_source *) root_nodes; - uint64_t buffered_ts; - struct circlebuf buffered_timestamps; - int buffering_wait_ticks; - int total_buffering_ticks; + uint64_t buffered_ts; + struct circlebuf buffered_timestamps; + int buffering_wait_ticks; + int total_buffering_ticks; - float user_volume; + float user_volume; - pthread_mutex_t monitoring_mutex; - DARRAY(struct audio_monitor*) monitors; - char *monitoring_device_name; - char *monitoring_device_id; + pthread_mutex_t monitoring_mutex; + DARRAY(struct audio_monitor *) monitors; + char *monitoring_device_name; + char *monitoring_device_id; }; /* user sources, output channels, and displays */ struct obs_core_data { - struct obs_source *first_source; - struct obs_source *first_audio_source; - struct obs_display *first_display; - struct obs_output *first_output; - struct obs_encoder *first_encoder; - struct obs_service *first_service; - - pthread_mutex_t sources_mutex; - pthread_mutex_t displays_mutex; - pthread_mutex_t outputs_mutex; - pthread_mutex_t encoders_mutex; - pthread_mutex_t services_mutex; - pthread_mutex_t audio_sources_mutex; - pthread_mutex_t draw_callbacks_mutex; - DARRAY(struct draw_callback) draw_callbacks; - DARRAY(struct tick_callback) tick_callbacks; - - struct obs_view main_view; - - long long unnamed_index; - - obs_data_t *private_data; - - volatile bool valid; + struct obs_source *first_source; + struct obs_source *first_audio_source; + struct obs_display *first_display; + struct obs_output *first_output; + struct obs_encoder *first_encoder; + struct obs_service *first_service; + + pthread_mutex_t sources_mutex; + pthread_mutex_t displays_mutex; + pthread_mutex_t outputs_mutex; + pthread_mutex_t encoders_mutex; + pthread_mutex_t services_mutex; + pthread_mutex_t audio_sources_mutex; + pthread_mutex_t draw_callbacks_mutex; + DARRAY(struct draw_callback) draw_callbacks; + DARRAY(struct tick_callback) tick_callbacks; + + struct obs_view main_view; + + long long unnamed_index; + + obs_data_t *private_data; + + volatile bool valid; }; /* user hotkeys */ struct obs_core_hotkeys { - pthread_mutex_t mutex; - DARRAY(obs_hotkey_t) hotkeys; - obs_hotkey_id next_id; - DARRAY(obs_hotkey_pair_t) hotkey_pairs; - obs_hotkey_pair_id next_pair_id; - - pthread_t hotkey_thread; - bool hotkey_thread_initialized; - os_event_t *stop_event; - bool thread_disable_press; - bool strict_modifiers; - bool reroute_hotkeys; - DARRAY(obs_hotkey_binding_t) bindings; + pthread_mutex_t mutex; + DARRAY(obs_hotkey_t) hotkeys; + obs_hotkey_id next_id; + DARRAY(obs_hotkey_pair_t) hotkey_pairs; + obs_hotkey_pair_id next_pair_id; + + pthread_t hotkey_thread; + bool hotkey_thread_initialized; + os_event_t *stop_event; + bool thread_disable_press; + bool strict_modifiers; + bool reroute_hotkeys; + DARRAY(obs_hotkey_binding_t) bindings; obs_hotkey_callback_router_func router_func; - void *router_func_data; + void *router_func_data; - obs_hotkeys_platform_t *platform_context; + obs_hotkeys_platform_t *platform_context; - pthread_once_t name_map_init_token; - struct obs_hotkey_name_map *name_map; + pthread_once_t name_map_init_token; + struct obs_hotkey_name_map *name_map; - signal_handler_t *signals; + signal_handler_t *signals; - char *translations[OBS_KEY_LAST_VALUE]; - char *mute; - char *unmute; - char *push_to_mute; - char *push_to_talk; - char *sceneitem_show; - char *sceneitem_hide; + char *translations[OBS_KEY_LAST_VALUE]; + char *mute; + char *unmute; + char *push_to_mute; + char *push_to_talk; + char *sceneitem_show; + char *sceneitem_hide; }; struct obs_core { - struct obs_module *first_module; - DARRAY(struct obs_module_path) module_paths; - - DARRAY(struct obs_source_info) source_types; - DARRAY(struct obs_source_info) input_types; - DARRAY(struct obs_source_info) filter_types; - DARRAY(struct obs_source_info) transition_types; - DARRAY(struct obs_output_info) output_types; + struct obs_module *first_module; + DARRAY(struct obs_module_path) module_paths; + + DARRAY(struct obs_source_info) source_types; + DARRAY(struct obs_source_info) input_types; + DARRAY(struct obs_source_info) filter_types; + DARRAY(struct obs_source_info) transition_types; + DARRAY(struct obs_output_info) output_types; DARRAY(struct obs_encoder_info) encoder_types; DARRAY(struct obs_service_info) service_types; - DARRAY(struct obs_modal_ui) modal_ui_callbacks; - DARRAY(struct obs_modeless_ui) modeless_ui_callbacks; + DARRAY(struct obs_modal_ui) modal_ui_callbacks; + DARRAY(struct obs_modeless_ui) modeless_ui_callbacks; - signal_handler_t *signals; - proc_handler_t *procs; + signal_handler_t *signals; + proc_handler_t *procs; - char *locale; - char *module_config_path; - bool name_store_owned; - profiler_name_store_t *name_store; + char *locale; + char *module_config_path; + bool name_store_owned; + profiler_name_store_t *name_store; /* segmented into multiple sub-structures to keep things a bit more * clean and organized */ - struct obs_core_video video; - struct obs_core_audio audio; - struct obs_core_data data; - struct obs_core_hotkeys hotkeys; + struct obs_core_video video; + struct obs_core_audio audio; + struct obs_core_data data; + struct obs_core_hotkeys hotkeys; }; extern struct obs_core *obs; @@ -434,59 +428,56 @@ extern gs_effect_t *obs_load_effect(gs_effect_t **effect, const char *file); -extern bool audio_callback(void *param, - uint64_t start_ts_in, uint64_t end_ts_in, uint64_t *out_ts, - uint32_t mixers, struct audio_output_data *mixes); +extern bool audio_callback(void *param, uint64_t start_ts_in, + uint64_t end_ts_in, uint64_t *out_ts, + uint32_t mixers, struct audio_output_data *mixes); -extern void start_raw_video(video_t *video, - const struct video_scale_info *conversion, +extern void +start_raw_video(video_t *video, const struct video_scale_info *conversion, void (*callback)(void *param, struct video_data *frame), void *param); extern void stop_raw_video(video_t *video, - void (*callback)(void *param, struct video_data *frame), - void *param); + void (*callback)(void *param, + struct video_data *frame), + void *param); /* ------------------------------------------------------------------------- */ /* obs shared context data */ struct obs_context_data { - char *name; - void *data; - obs_data_t *settings; - signal_handler_t *signals; - proc_handler_t *procs; - enum obs_obj_type type; + char *name; + void *data; + obs_data_t *settings; + signal_handler_t *signals; + proc_handler_t *procs; + enum obs_obj_type type; - DARRAY(obs_hotkey_id) hotkeys; - DARRAY(obs_hotkey_pair_id) hotkey_pairs; - obs_data_t *hotkey_data; + DARRAY(obs_hotkey_id) hotkeys; + DARRAY(obs_hotkey_pair_id) hotkey_pairs; + obs_data_t *hotkey_data; - DARRAY(char*) rename_cache; - pthread_mutex_t rename_cache_mutex; + DARRAY(char *) rename_cache; + pthread_mutex_t rename_cache_mutex; - pthread_mutex_t *mutex; - struct obs_context_data *next; - struct obs_context_data **prev_next; + pthread_mutex_t *mutex; + struct obs_context_data *next; + struct obs_context_data **prev_next; - bool private; + bool private; }; -extern bool obs_context_data_init( - struct obs_context_data *context, - enum obs_obj_type type, - obs_data_t *settings, - const char *name, - obs_data_t *hotkey_data, - bool private); +extern bool obs_context_data_init(struct obs_context_data *context, + enum obs_obj_type type, obs_data_t *settings, + const char *name, obs_data_t *hotkey_data, + bool private); extern void obs_context_data_free(struct obs_context_data *context); extern void obs_context_data_insert(struct obs_context_data *context, - pthread_mutex_t *mutex, void *first); + pthread_mutex_t *mutex, void *first); extern void obs_context_data_remove(struct obs_context_data *context); extern void obs_context_data_setname(struct obs_context_data *context, - const char *name); - + const char *name); /* ------------------------------------------------------------------------- */ /* ref-counting */ @@ -529,7 +520,6 @@ return false; } - /* ------------------------------------------------------------------------- */ /* sources */ @@ -551,7 +541,7 @@ enum audio_action_type type; union { float vol; - bool set; + bool set; }; }; @@ -566,177 +556,179 @@ }; struct obs_source { - struct obs_context_data context; - struct obs_source_info info; - struct obs_weak_source *control; + struct obs_context_data context; + struct obs_source_info info; + struct obs_weak_source *control; /* general exposed flags that can be set for the source */ - uint32_t flags; - uint32_t default_flags; + uint32_t flags; + uint32_t default_flags; /* indicates ownership of the info.id buffer */ - bool owns_info_id; + bool owns_info_id; /* signals to call the source update in the video thread */ - bool defer_update; + bool defer_update; /* ensures show/hide are only called once */ - volatile long show_refs; + volatile long show_refs; /* ensures activate/deactivate are only called once */ - volatile long activate_refs; + volatile long activate_refs; /* used to indicate that the source has been removed and all * references to it should be released (not exactly how I would prefer * to handle things but it's the best option) */ - bool removed; + bool removed; - bool active; - bool showing; + bool active; + bool showing; /* used to temporarily disable sources if needed */ - bool enabled; + bool enabled; /* timing (if video is present, is based upon video) */ - volatile bool timing_set; - volatile uint64_t timing_adjust; - uint64_t resample_offset; - uint64_t last_audio_ts; - uint64_t next_audio_ts_min; - uint64_t next_audio_sys_ts_min; - uint64_t last_frame_ts; - uint64_t last_sys_timestamp; - bool async_rendered; + volatile bool timing_set; + volatile uint64_t timing_adjust; + uint64_t resample_offset; + uint64_t last_audio_ts; + uint64_t next_audio_ts_min; + uint64_t next_audio_sys_ts_min; + uint64_t last_frame_ts; + uint64_t last_sys_timestamp; + bool async_rendered; /* audio */ - bool audio_failed; - bool audio_pending; - bool pending_stop; - bool user_muted; - bool muted; - struct obs_source *next_audio_source; - struct obs_source **prev_next_audio_source; - uint64_t audio_ts; - struct circlebuf audio_input_buf[MAX_AUDIO_CHANNELS]; - size_t last_audio_input_buf_size; - DARRAY(struct audio_action) audio_actions; - float *audio_output_buf[MAX_AUDIO_MIXES][MAX_AUDIO_CHANNELS]; - struct resample_info sample_info; - audio_resampler_t *resampler; - pthread_mutex_t audio_actions_mutex; - pthread_mutex_t audio_buf_mutex; - pthread_mutex_t audio_mutex; - pthread_mutex_t audio_cb_mutex; - DARRAY(struct audio_cb_info) audio_cb_list; - struct obs_audio_data audio_data; - size_t audio_storage_size; - uint32_t audio_mixers; - float user_volume; - float volume; - int64_t sync_offset; - int64_t last_sync_offset; - float balance; + bool audio_failed; + bool audio_pending; + bool pending_stop; + bool user_muted; + bool muted; + struct obs_source *next_audio_source; + struct obs_source **prev_next_audio_source; + uint64_t audio_ts; + struct circlebuf audio_input_buf[MAX_AUDIO_CHANNELS]; + size_t last_audio_input_buf_size; + DARRAY(struct audio_action) audio_actions; + float *audio_output_buf[MAX_AUDIO_MIXES][MAX_AUDIO_CHANNELS]; + float *audio_mix_buf[MAX_AUDIO_CHANNELS]; + struct resample_info sample_info; + audio_resampler_t *resampler; + pthread_mutex_t audio_actions_mutex; + pthread_mutex_t audio_buf_mutex; + pthread_mutex_t audio_mutex; + pthread_mutex_t audio_cb_mutex; + DARRAY(struct audio_cb_info) audio_cb_list; + struct obs_audio_data audio_data; + size_t audio_storage_size; + uint32_t audio_mixers; + float user_volume; + float volume; + int64_t sync_offset; + int64_t last_sync_offset; + float balance; /* async video data */ - gs_texture_t *async_texture; - gs_texrender_t *async_texrender; - struct obs_source_frame *cur_async_frame; - bool async_gpu_conversion; - enum video_format async_format; - bool async_full_range; - enum video_format async_cache_format; - bool async_cache_full_range; - enum gs_color_format async_texture_format; - int async_plane_offset[2]; - bool async_flip; - bool async_active; - bool async_update_texture; - bool async_unbuffered; - bool async_decoupled; - struct obs_source_frame *async_preload_frame; - DARRAY(struct async_frame) async_cache; - DARRAY(struct obs_source_frame*)async_frames; - pthread_mutex_t async_mutex; - uint32_t async_width; - uint32_t async_height; - uint32_t async_cache_width; - uint32_t async_cache_height; - uint32_t async_convert_width; - uint32_t async_convert_height; + gs_texture_t *async_textures[MAX_AV_PLANES]; + gs_texrender_t *async_texrender; + struct obs_source_frame *cur_async_frame; + bool async_gpu_conversion; + enum video_format async_format; + bool async_full_range; + enum video_format async_cache_format; + bool async_cache_full_range; + enum gs_color_format async_texture_formats[MAX_AV_PLANES]; + int async_channel_count; + bool async_flip; + bool async_active; + bool async_update_texture; + bool async_unbuffered; + bool async_decoupled; + struct obs_source_frame *async_preload_frame; + DARRAY(struct async_frame) async_cache; + DARRAY(struct obs_source_frame *) async_frames; + pthread_mutex_t async_mutex; + uint32_t async_width; + uint32_t async_height; + uint32_t async_cache_width; + uint32_t async_cache_height; + uint32_t async_convert_width[MAX_AV_PLANES]; + uint32_t async_convert_height[MAX_AV_PLANES]; /* async video deinterlacing */ - uint64_t deinterlace_offset; - uint64_t deinterlace_frame_ts; - gs_effect_t *deinterlace_effect; - struct obs_source_frame *prev_async_frame; - gs_texture_t *async_prev_texture; - gs_texrender_t *async_prev_texrender; - uint32_t deinterlace_half_duration; - enum obs_deinterlace_mode deinterlace_mode; - bool deinterlace_top_first; - bool deinterlace_rendered; + uint64_t deinterlace_offset; + uint64_t deinterlace_frame_ts; + gs_effect_t *deinterlace_effect; + struct obs_source_frame *prev_async_frame; + gs_texture_t *async_prev_textures[MAX_AV_PLANES]; + gs_texrender_t *async_prev_texrender; + uint32_t deinterlace_half_duration; + enum obs_deinterlace_mode deinterlace_mode; + bool deinterlace_top_first; + bool deinterlace_rendered; /* filters */ - struct obs_source *filter_parent; - struct obs_source *filter_target; - DARRAY(struct obs_source*) filters; - pthread_mutex_t filter_mutex; - gs_texrender_t *filter_texrender; - enum obs_allow_direct_render allow_direct; - bool rendering_filter; + struct obs_source *filter_parent; + struct obs_source *filter_target; + DARRAY(struct obs_source *) filters; + pthread_mutex_t filter_mutex; + gs_texrender_t *filter_texrender; + enum obs_allow_direct_render allow_direct; + bool rendering_filter; /* sources specific hotkeys */ - obs_hotkey_pair_id mute_unmute_key; - obs_hotkey_id push_to_mute_key; - obs_hotkey_id push_to_talk_key; - bool push_to_mute_enabled; - bool push_to_mute_pressed; - bool user_push_to_mute_pressed; - bool push_to_talk_enabled; - bool push_to_talk_pressed; - bool user_push_to_talk_pressed; - uint64_t push_to_mute_delay; - uint64_t push_to_mute_stop_time; - uint64_t push_to_talk_delay; - uint64_t push_to_talk_stop_time; + obs_hotkey_pair_id mute_unmute_key; + obs_hotkey_id push_to_mute_key; + obs_hotkey_id push_to_talk_key; + bool push_to_mute_enabled; + bool push_to_mute_pressed; + bool user_push_to_mute_pressed; + bool push_to_talk_enabled; + bool push_to_talk_pressed; + bool user_push_to_talk_pressed; + uint64_t push_to_mute_delay; + uint64_t push_to_mute_stop_time; + uint64_t push_to_talk_delay; + uint64_t push_to_talk_stop_time; /* transitions */ - uint64_t transition_start_time; - uint64_t transition_duration; - pthread_mutex_t transition_tex_mutex; - gs_texrender_t *transition_texrender[2]; - pthread_mutex_t transition_mutex; - obs_source_t *transition_sources[2]; - bool transitioning_video; - bool transitioning_audio; - bool transition_source_active[2]; - uint32_t transition_alignment; - uint32_t transition_actual_cx; - uint32_t transition_actual_cy; - uint32_t transition_cx; - uint32_t transition_cy; - uint32_t transition_fixed_duration; - bool transition_use_fixed_duration; - enum obs_transition_mode transition_mode; - enum obs_transition_scale_type transition_scale_type; - struct matrix4 transition_matrices[2]; - - struct audio_monitor *monitor; - enum obs_monitoring_type monitoring_type; - - obs_data_t *private_settings; + uint64_t transition_start_time; + uint64_t transition_duration; + pthread_mutex_t transition_tex_mutex; + gs_texrender_t *transition_texrender[2]; + pthread_mutex_t transition_mutex; + obs_source_t *transition_sources[2]; + bool transitioning_video; + bool transitioning_audio; + bool transition_source_active[2]; + uint32_t transition_alignment; + uint32_t transition_actual_cx; + uint32_t transition_actual_cy; + uint32_t transition_cx; + uint32_t transition_cy; + uint32_t transition_fixed_duration; + bool transition_use_fixed_duration; + enum obs_transition_mode transition_mode; + enum obs_transition_scale_type transition_scale_type; + struct matrix4 transition_matrices[2]; + + struct audio_monitor *monitor; + enum obs_monitoring_type monitoring_type; + + obs_data_t *private_settings; }; extern struct obs_source_info *get_source_info(const char *id); extern bool obs_source_init_context(struct obs_source *source, - obs_data_t *settings, const char *name, - obs_data_t *hotkey_data, bool private); + obs_data_t *settings, const char *name, + obs_data_t *hotkey_data, bool private); extern bool obs_transition_init(obs_source_t *transition); extern void obs_transition_free(obs_source_t *transition); extern void obs_transition_tick(obs_source_t *transition); extern void obs_transition_enum_sources(obs_source_t *transition, - obs_source_enum_proc_t enum_callback, void *param); + obs_source_enum_proc_t enum_callback, + void *param); extern void obs_transition_save(obs_source_t *source, obs_data_t *data); extern void obs_transition_load(obs_source_t *source, obs_data_t *data); @@ -748,11 +740,12 @@ enum view_type { MAIN_VIEW, - AUX_VIEW + AUX_VIEW, }; static inline void obs_source_dosignal(struct obs_source *source, - const char *signal_obs, const char *signal_source) + const char *signal_obs, + const char *signal_source) { struct calldata data; uint8_t stack[128]; @@ -763,11 +756,11 @@ signal_handler_signal(obs->signals, signal_obs, &data); if (signal_source) signal_handler_signal(source->context.signals, signal_source, - &data); + &data); } /* maximum timestamp variance in nanoseconds */ -#define MAX_TS_VAR 2000000000ULL +#define MAX_TS_VAR 2000000000ULL static inline bool frame_out_of_bounds(const obs_source_t *source, uint64_t ts) { @@ -777,45 +770,55 @@ return ((ts - source->last_frame_ts) > MAX_TS_VAR); } -static inline enum gs_color_format convert_video_format( - enum video_format format) +static inline enum gs_color_format +convert_video_format(enum video_format format) { - if (format == VIDEO_FORMAT_RGBA) + switch (format) { + case VIDEO_FORMAT_RGBA: return GS_RGBA; - else if (format == VIDEO_FORMAT_BGRA) + case VIDEO_FORMAT_BGRA: + case VIDEO_FORMAT_I40A: + case VIDEO_FORMAT_I42A: + case VIDEO_FORMAT_YUVA: + case VIDEO_FORMAT_AYUV: return GS_BGRA; - - return GS_BGRX; + default: + return GS_BGRX; + } } extern void obs_source_activate(obs_source_t *source, enum view_type type); extern void obs_source_deactivate(obs_source_t *source, enum view_type type); extern void obs_source_video_tick(obs_source_t *source, float seconds); extern float obs_source_get_target_volume(obs_source_t *source, - obs_source_t *target); + obs_source_t *target); extern void obs_source_audio_render(obs_source_t *source, uint32_t mixers, - size_t channels, size_t sample_rate, size_t size); + size_t channels, size_t sample_rate, + size_t size); extern void add_alignment(struct vec2 *v, uint32_t align, int cx, int cy); extern struct obs_source_frame *filter_async_video(obs_source_t *source, - struct obs_source_frame *in); + struct obs_source_frame *in); extern bool update_async_texture(struct obs_source *source, - const struct obs_source_frame *frame, - gs_texture_t *tex, gs_texrender_t *texrender); + const struct obs_source_frame *frame, + gs_texture_t *tex, gs_texrender_t *texrender); +extern bool update_async_textures(struct obs_source *source, + const struct obs_source_frame *frame, + gs_texture_t *tex[MAX_AV_PLANES], + gs_texrender_t *texrender); extern bool set_async_texture_size(struct obs_source *source, - const struct obs_source_frame *frame); + const struct obs_source_frame *frame); extern void remove_async_frame(obs_source_t *source, - struct obs_source_frame *frame); + struct obs_source_frame *frame); extern void set_deinterlace_texture_size(obs_source_t *source); extern void deinterlace_process_last_frame(obs_source_t *source, - uint64_t sys_time); + uint64_t sys_time); extern void deinterlace_update_async_video(obs_source_t *source); extern void deinterlace_render(obs_source_t *s); - /* ------------------------------------------------------------------------- */ /* outputs */ @@ -839,89 +842,115 @@ }; #define CAPTION_LINE_CHARS (32) -#define CAPTION_LINE_BYTES (4*CAPTION_LINE_CHARS) +#define CAPTION_LINE_BYTES (4 * CAPTION_LINE_CHARS) struct caption_text { - char text[CAPTION_LINE_BYTES+1]; + char text[CAPTION_LINE_BYTES + 1]; double display_duration; struct caption_text *next; }; +struct pause_data { + pthread_mutex_t mutex; + uint64_t last_video_ts; + uint64_t ts_start; + uint64_t ts_end; + uint64_t ts_offset; +}; + +extern bool video_pause_check(struct pause_data *pause, uint64_t timestamp); +extern bool audio_pause_check(struct pause_data *pause, struct audio_data *data, + size_t sample_rate); +extern void pause_reset(struct pause_data *pause); + struct obs_output { - struct obs_context_data context; - struct obs_output_info info; - struct obs_weak_output *control; + struct obs_context_data context; + struct obs_output_info info; + struct obs_weak_output *control; /* indicates ownership of the info.id buffer */ - bool owns_info_id; - - bool received_video; - bool received_audio; - volatile bool data_active; - volatile bool end_data_capture_thread_active; - int64_t video_offset; - int64_t audio_offsets[MAX_AUDIO_MIXES]; - int64_t highest_audio_ts; - int64_t highest_video_ts; - pthread_t end_data_capture_thread; - os_event_t *stopping_event; - pthread_mutex_t interleaved_mutex; - DARRAY(struct encoder_packet) interleaved_packets; - int stop_code; - - int reconnect_retry_sec; - int reconnect_retry_max; - int reconnect_retries; - int reconnect_retry_cur_sec; - pthread_t reconnect_thread; - os_event_t *reconnect_stop_event; - volatile bool reconnecting; - volatile bool reconnect_thread_active; - - uint32_t starting_drawn_count; - uint32_t starting_lagged_count; - uint32_t starting_frame_count; - - int total_frames; - - volatile bool active; - video_t *video; - audio_t *audio; - obs_encoder_t *video_encoder; - obs_encoder_t *audio_encoders[MAX_AUDIO_MIXES]; - obs_service_t *service; - size_t mixer_mask; - - uint32_t scaled_width; - uint32_t scaled_height; - - bool video_conversion_set; - bool audio_conversion_set; - struct video_scale_info video_conversion; - struct audio_convert_info audio_conversion; - - pthread_mutex_t caption_mutex; - double caption_timestamp; - struct caption_text *caption_head; - struct caption_text *caption_tail; - - bool valid; - - uint64_t active_delay_ns; - encoded_callback_t delay_callback; - struct circlebuf delay_data; /* struct delay_data */ - pthread_mutex_t delay_mutex; - uint32_t delay_sec; - uint32_t delay_flags; - uint32_t delay_cur_flags; - volatile long delay_restart_refs; - volatile bool delay_active; - volatile bool delay_capturing; - - char *last_error_message; + bool owns_info_id; + + bool received_video; + bool received_audio; + volatile bool data_active; + volatile bool end_data_capture_thread_active; + int64_t video_offset; + int64_t audio_offsets[MAX_AUDIO_MIXES]; + int64_t highest_audio_ts; + int64_t highest_video_ts; + pthread_t end_data_capture_thread; + os_event_t *stopping_event; + pthread_mutex_t interleaved_mutex; + DARRAY(struct encoder_packet) interleaved_packets; + int stop_code; + + int reconnect_retry_sec; + int reconnect_retry_max; + int reconnect_retries; + int reconnect_retry_cur_sec; + pthread_t reconnect_thread; + os_event_t *reconnect_stop_event; + volatile bool reconnecting; + volatile bool reconnect_thread_active; + + uint32_t starting_drawn_count; + uint32_t starting_lagged_count; + uint32_t starting_frame_count; + + int total_frames; + + volatile bool active; + volatile bool paused; + video_t *video; + audio_t *audio; + obs_encoder_t *video_encoder; + obs_encoder_t *audio_encoders[MAX_AUDIO_MIXES]; + obs_service_t *service; + size_t mixer_mask; + + struct pause_data pause; + + struct circlebuf audio_buffer[MAX_AUDIO_MIXES][MAX_AV_PLANES]; + uint64_t audio_start_ts; + uint64_t video_start_ts; + size_t audio_size; + size_t planes; + size_t sample_rate; + size_t total_audio_frames; + + uint32_t scaled_width; + uint32_t scaled_height; + + bool video_conversion_set; + bool audio_conversion_set; + struct video_scale_info video_conversion; + struct audio_convert_info audio_conversion; + + pthread_mutex_t caption_mutex; + double caption_timestamp; + struct caption_text *caption_head; + struct caption_text *caption_tail; + + bool valid; + + uint64_t active_delay_ns; + encoded_callback_t delay_callback; + struct circlebuf delay_data; /* struct delay_data */ + pthread_mutex_t delay_mutex; + uint32_t delay_sec; + uint32_t delay_flags; + uint32_t delay_cur_flags; + volatile long delay_restart_refs; + volatile bool delay_active; + volatile bool delay_capturing; + + char *last_error_message; + + float audio_data[MAX_AUDIO_CHANNELS][AUDIO_OUTPUT_FRAMES]; }; static inline void do_output_signal(struct obs_output *output, - const char *signal) + const char *signal) { struct calldata params = {0}; calldata_set_ptr(¶ms, "output", output); @@ -935,18 +964,18 @@ extern void obs_output_delay_stop(obs_output_t *output); extern bool obs_output_actual_start(obs_output_t *output); extern void obs_output_actual_stop(obs_output_t *output, bool force, - uint64_t ts); + uint64_t ts); extern const struct obs_output_info *find_output(const char *id); extern void obs_output_remove_encoder(struct obs_output *output, - struct obs_encoder *encoder); + struct obs_encoder *encoder); -extern void obs_encoder_packet_create_instance(struct encoder_packet *dst, - const struct encoder_packet *src); +extern void +obs_encoder_packet_create_instance(struct encoder_packet *dst, + const struct encoder_packet *src); void obs_output_destroy(obs_output_t *output); - /* ------------------------------------------------------------------------- */ /* encoders */ @@ -962,64 +991,67 @@ }; struct obs_encoder { - struct obs_context_data context; - struct obs_encoder_info info; - struct obs_weak_encoder *control; + struct obs_context_data context; + struct obs_encoder_info info; + struct obs_weak_encoder *control; /* allows re-routing to another encoder */ - struct obs_encoder_info orig_info; + struct obs_encoder_info orig_info; - pthread_mutex_t init_mutex; + pthread_mutex_t init_mutex; - uint32_t samplerate; - size_t planes; - size_t blocksize; - size_t framesize; - size_t framesize_bytes; + uint32_t samplerate; + size_t planes; + size_t blocksize; + size_t framesize; + size_t framesize_bytes; - size_t mixer_idx; + size_t mixer_idx; - uint32_t scaled_width; - uint32_t scaled_height; - enum video_format preferred_format; + uint32_t scaled_width; + uint32_t scaled_height; + enum video_format preferred_format; - volatile bool active; - bool initialized; + volatile bool active; + volatile bool paused; + bool initialized; /* indicates ownership of the info.id buffer */ - bool owns_info_id; + bool owns_info_id; - uint32_t timebase_num; - uint32_t timebase_den; + uint32_t timebase_num; + uint32_t timebase_den; - int64_t cur_pts; + int64_t cur_pts; - struct circlebuf audio_input_buffer[MAX_AV_PLANES]; - uint8_t *audio_output_buffer[MAX_AV_PLANES]; + struct circlebuf audio_input_buffer[MAX_AV_PLANES]; + uint8_t *audio_output_buffer[MAX_AV_PLANES]; /* if a video encoder is paired with an audio encoder, make it start * up at the specific timestamp. if this is the audio encoder, * wait_for_video makes it wait until it's ready to sync up with * video */ - bool wait_for_video; - bool first_received; - struct obs_encoder *paired_encoder; - int64_t offset_usec; - uint64_t first_raw_ts; - uint64_t start_ts; + bool wait_for_video; + bool first_received; + struct obs_encoder *paired_encoder; + int64_t offset_usec; + uint64_t first_raw_ts; + uint64_t start_ts; - pthread_mutex_t outputs_mutex; - DARRAY(obs_output_t*) outputs; + pthread_mutex_t outputs_mutex; + DARRAY(obs_output_t *) outputs; - bool destroy_on_stop; + bool destroy_on_stop; /* stores the video/audio media output pointer. video_t *or audio_t **/ - void *media; + void *media; - pthread_mutex_t callbacks_mutex; + pthread_mutex_t callbacks_mutex; DARRAY(struct encoder_callback) callbacks; - const char *profile_encoder_encode_name; + struct pause_data pause; + + const char *profile_encoder_encode_name; }; extern struct obs_encoder_info *find_encoder(const char *id); @@ -1028,23 +1060,25 @@ extern void obs_encoder_shutdown(obs_encoder_t *encoder); extern void obs_encoder_start(obs_encoder_t *encoder, - void (*new_packet)(void *param, struct encoder_packet *packet), - void *param); + void (*new_packet)(void *param, + struct encoder_packet *packet), + void *param); extern void obs_encoder_stop(obs_encoder_t *encoder, - void (*new_packet)(void *param, struct encoder_packet *packet), - void *param); + void (*new_packet)(void *param, + struct encoder_packet *packet), + void *param); extern void obs_encoder_add_output(struct obs_encoder *encoder, - struct obs_output *output); + struct obs_output *output); extern void obs_encoder_remove_output(struct obs_encoder *encoder, - struct obs_output *output); + struct obs_output *output); extern bool start_gpu_encode(obs_encoder_t *encoder); extern void stop_gpu_encode(obs_encoder_t *encoder); extern bool do_encode(struct obs_encoder *encoder, struct encoder_frame *frame); extern void send_off_encoder_packet(obs_encoder_t *encoder, bool success, - bool received, struct encoder_packet *pkt); + bool received, struct encoder_packet *pkt); void obs_encoder_destroy(obs_encoder_t *encoder); @@ -1057,16 +1091,16 @@ }; struct obs_service { - struct obs_context_data context; - struct obs_service_info info; - struct obs_weak_service *control; + struct obs_context_data context; + struct obs_service_info info; + struct obs_weak_service *control; /* indicates ownership of the info.id buffer */ - bool owns_info_id; + bool owns_info_id; - bool active; - bool destroy; - struct obs_output *output; + bool active; + bool destroy; + struct obs_output *output; }; extern const struct obs_service_info *find_service(const char *id); @@ -1074,7 +1108,6 @@ extern void obs_service_activate(struct obs_service *service); extern void obs_service_deactivate(struct obs_service *service, bool remove); extern bool obs_service_initialize(struct obs_service *service, - struct obs_output *output); + struct obs_output *output); void obs_service_destroy(obs_service_t *service); -
View file
obs-studio-23.2.1.tar.xz/libobs/obs-module.c -> obs-studio-24.0.0.tar.xz/libobs/obs-module.c
Changed
@@ -26,9 +26,10 @@ static inline int req_func_not_found(const char *name, const char *path) { - blog(LOG_DEBUG, "Required module function '%s' in module '%s' not " - "found, loading of module failed", - name, path); + blog(LOG_DEBUG, + "Required module function '%s' in module '%s' not " + "found, loading of module failed", + name, path); return MODULE_MISSING_EXPORTS; } @@ -47,13 +48,13 @@ return req_func_not_found("obs_module_ver", path); /* optional exports */ - mod->unload = os_dlsym(mod->module, "obs_module_unload"); - mod->post_load = os_dlsym(mod->module, "obs_module_post_load"); - mod->set_locale = os_dlsym(mod->module, "obs_module_set_locale"); + mod->unload = os_dlsym(mod->module, "obs_module_unload"); + mod->post_load = os_dlsym(mod->module, "obs_module_post_load"); + mod->set_locale = os_dlsym(mod->module, "obs_module_set_locale"); mod->free_locale = os_dlsym(mod->module, "obs_module_free_locale"); - mod->name = os_dlsym(mod->module, "obs_module_name"); + mod->name = os_dlsym(mod->module, "obs_module_name"); mod->description = os_dlsym(mod->module, "obs_module_description"); - mod->author = os_dlsym(mod->module, "obs_module_author"); + mod->author = os_dlsym(mod->module, "obs_module_author"); return MODULE_SUCCESS; } @@ -77,7 +78,7 @@ #endif int obs_open_module(obs_module_t **module, const char *path, - const char *data_path) + const char *data_path) { struct obs_module mod = {0}; int errorcode; @@ -108,12 +109,12 @@ if (errorcode != MODULE_SUCCESS) return errorcode; - mod.bin_path = bstrdup(path); - mod.file = strrchr(mod.bin_path, '/'); - mod.file = (!mod.file) ? mod.bin_path : (mod.file + 1); - mod.mod_name = get_module_name(mod.file); + mod.bin_path = bstrdup(path); + mod.file = strrchr(mod.bin_path, '/'); + mod.file = (!mod.file) ? mod.bin_path : (mod.file + 1); + mod.mod_name = get_module_name(mod.file); mod.data_path = bstrdup(data_path); - mod.next = obs->first_module; + mod.next = obs->first_module; if (mod.file) { blog(LOG_DEBUG, "Loading module: %s", mod.file); @@ -138,13 +139,13 @@ const char *profile_name = profile_store_name(obs_get_profiler_name_store(), - "obs_init_module(%s)", module->file); + "obs_init_module(%s)", module->file); profile_start(profile_name); module->loaded = module->load(); if (!module->loaded) blog(LOG_WARNING, "Failed to initialize module '%s'", - module->file); + module->file); profile_end(profile_name); return module->loaded; @@ -226,9 +227,10 @@ { struct obs_module_path omp; - if (!obs || !bin || !data) return; + if (!obs || !bin || !data) + return; - omp.bin = bstrdup(bin); + omp.bin = bstrdup(bin); omp.data = bstrdup(data); da_push_back(obs->module_paths, &omp); } @@ -240,7 +242,7 @@ int code = obs_open_module(&module, info->bin_path, info->data_path); if (code != MODULE_SUCCESS) { blog(LOG_DEBUG, "Failed to load module file '%s': %d", - info->bin_path, code); + info->bin_path, code); return; } @@ -274,7 +276,7 @@ } static inline void make_data_dir(struct dstr *parsed_data_dir, - const char *data_dir, const char *name) + const char *data_dir, const char *name) { dstr_copy(parsed_data_dir, data_dir); dstr_replace(parsed_data_dir, "%module%", name); @@ -298,7 +300,7 @@ } static bool parse_binary_from_directory(struct dstr *parsed_bin_path, - const char *bin_path, const char *file) + const char *bin_path, const char *file) { struct dstr directory = {0}; bool found = true; @@ -330,16 +332,17 @@ return found; } -static void process_found_module(struct obs_module_path *omp, - const char *path, bool directory, - obs_find_module_callback_t callback, void *param) +static void process_found_module(struct obs_module_path *omp, const char *path, + bool directory, + obs_find_module_callback_t callback, + void *param) { struct obs_module_info info; - struct dstr name = {0}; - struct dstr parsed_bin_path = {0}; - const char *file; - char *parsed_data_dir; - bool bin_found = true; + struct dstr name = {0}; + struct dstr parsed_bin_path = {0}; + const char *file; + char *parsed_data_dir; + bool bin_found = true; file = strrchr(path, '/'); file = file ? (file + 1) : path; @@ -356,13 +359,13 @@ dstr_copy(&parsed_bin_path, path); } else { bin_found = parse_binary_from_directory(&parsed_bin_path, - omp->bin, file); + omp->bin, file); } parsed_data_dir = make_data_directory(name.array, omp->data); if (parsed_data_dir && bin_found) { - info.bin_path = parsed_bin_path.array; + info.bin_path = parsed_bin_path.array; info.data_path = parsed_data_dir; callback(param, &info); } @@ -373,7 +376,8 @@ } static void find_modules_in_path(struct obs_module_path *omp, - obs_find_module_callback_t callback, void *param) + obs_find_module_callback_t callback, + void *param) { struct dstr search_path = {0}; char *module_start; @@ -398,10 +402,9 @@ if (os_glob(search_path.array, 0, &gi) == 0) { for (size_t i = 0; i < gi->gl_pathc; i++) { if (search_directories == gi->gl_pathv[i].directory) - process_found_module(omp, - gi->gl_pathv[i].path, - search_directories, - callback, param); + process_found_module(omp, gi->gl_pathv[i].path, + search_directories, + callback, param); } os_globfree(gi); @@ -458,10 +461,10 @@ } lookup_t *obs_module_load_locale(obs_module_t *module, - const char *default_locale, const char *locale) + const char *default_locale, const char *locale) { - struct dstr str = {0}; - lookup_t *lookup = NULL; + struct dstr str = {0}; + lookup_t *lookup = NULL; if (!module || !default_locale || !locale) { blog(LOG_WARNING, "obs_module_load_locale: Invalid parameters"); @@ -480,7 +483,7 @@ if (!lookup) { blog(LOG_WARNING, "Failed to load '%s' text for module: '%s'", - default_locale, module->file); + default_locale, module->file); goto cleanup; } @@ -495,7 +498,7 @@ if (!text_lookup_add(lookup, file)) blog(LOG_WARNING, "Failed to load '%s' text for module: '%s'", - locale, module->file); + locale, module->file); bfree(file); cleanup: @@ -503,51 +506,53 @@ return lookup; } -#define REGISTER_OBS_DEF(size_var, structure, dest, info) \ - do { \ - struct structure data = {0}; \ - if (!size_var) { \ - blog(LOG_ERROR, "Tried to register " #structure \ - " outside of obs_module_load"); \ - return; \ - } \ - \ - if (size_var > sizeof(data)) { \ - blog(LOG_ERROR, "Tried to register " #structure \ - " with size %llu which is more " \ - "than libobs currently supports " \ - "(%llu)", \ - (long long unsigned)size_var, \ - (long long unsigned)sizeof(data));\ - goto error; \ - } \ - \ - memcpy(&data, info, size_var); \ - da_push_back(dest, &data); \ +#define REGISTER_OBS_DEF(size_var, structure, dest, info) \ + do { \ + struct structure data = {0}; \ + if (!size_var) { \ + blog(LOG_ERROR, "Tried to register " #structure \ + " outside of obs_module_load"); \ + return; \ + } \ + \ + if (size_var > sizeof(data)) { \ + blog(LOG_ERROR, \ + "Tried to register " #structure \ + " with size %llu which is more " \ + "than libobs currently supports " \ + "(%llu)", \ + (long long unsigned)size_var, \ + (long long unsigned)sizeof(data)); \ + goto error; \ + } \ + \ + memcpy(&data, info, size_var); \ + da_push_back(dest, &data); \ } while (false) -#define CHECK_REQUIRED_VAL(type, info, val, func) \ - do { \ +#define CHECK_REQUIRED_VAL(type, info, val, func) \ + do { \ if ((offsetof(type, val) + sizeof(info->val) > size) || \ - !info->val) { \ - blog(LOG_ERROR, "Required value '" #val "' for " \ - "'%s' not found. " #func \ - " failed.", info->id); \ - goto error; \ - } \ + !info->val) { \ + blog(LOG_ERROR, \ + "Required value '" #val "' for " \ + "'%s' not found. " #func " failed.", \ + info->id); \ + goto error; \ + } \ } while (false) -#define HANDLE_ERROR(size_var, structure, info) \ - do { \ - struct structure data = {0}; \ - if (!size_var) \ - return; \ - \ - memcpy(&data, info, sizeof(data) < size_var ? \ - sizeof(data) : size_var); \ - \ - if (info->type_data && info->free_type_data) \ - info->free_type_data(info->type_data); \ +#define HANDLE_ERROR(size_var, structure, info) \ + do { \ + struct structure data = {0}; \ + if (!size_var) \ + return; \ + \ + memcpy(&data, info, \ + sizeof(data) < size_var ? sizeof(data) : size_var); \ + \ + if (info->type_data && info->free_type_data) \ + info->free_type_data(info->type_data); \ } while (false) #define source_warn(format, ...) \ @@ -572,13 +577,14 @@ array = &obs->transition_types.da; } else if (info->type != OBS_SOURCE_TYPE_SCENE) { source_warn("Tried to register unknown source type: %u", - info->type); + info->type); goto error; } if (get_source_info(info->id)) { source_warn("Source '%s' already exists! " - "Duplicate library?", info->id); + "Duplicate library?", + info->id); goto error; } @@ -593,25 +599,27 @@ if (data.type == OBS_SOURCE_TYPE_TRANSITION) { if (data.get_width) source_warn("get_width ignored registering " - "transition '%s'", - data.id); + "transition '%s'", + data.id); if (data.get_height) source_warn("get_height ignored registering " - "transition '%s'", - data.id); + "transition '%s'", + data.id); data.output_flags |= OBS_SOURCE_COMPOSITE | OBS_SOURCE_VIDEO | - OBS_SOURCE_CUSTOM_DRAW; + OBS_SOURCE_CUSTOM_DRAW; } if ((data.output_flags & OBS_SOURCE_COMPOSITE) != 0) { if ((data.output_flags & OBS_SOURCE_AUDIO) != 0) { source_warn("Source '%s': Composite sources " - "cannot be audio sources", info->id); + "cannot be audio sources", + info->id); goto error; } if ((data.output_flags & OBS_SOURCE_ASYNC) != 0) { source_warn("Source '%s': Composite sources " - "cannot be async sources", info->id); + "cannot be async sources", + info->id); goto error; } } @@ -619,14 +627,12 @@ #define CHECK_REQUIRED_VAL_(info, val, func) \ CHECK_REQUIRED_VAL(struct obs_source_info, info, val, func) CHECK_REQUIRED_VAL_(info, get_name, obs_register_source); - CHECK_REQUIRED_VAL_(info, create, obs_register_source); - CHECK_REQUIRED_VAL_(info, destroy, obs_register_source); - if (info->type != OBS_SOURCE_TYPE_FILTER && - info->type != OBS_SOURCE_TYPE_TRANSITION && + if (info->type != OBS_SOURCE_TYPE_FILTER && + info->type != OBS_SOURCE_TYPE_TRANSITION && (info->output_flags & OBS_SOURCE_VIDEO) != 0 && (info->output_flags & OBS_SOURCE_ASYNC) == 0) { - CHECK_REQUIRED_VAL_(info, get_width, obs_register_source); + CHECK_REQUIRED_VAL_(info, get_width, obs_register_source); CHECK_REQUIRED_VAL_(info, get_height, obs_register_source); } @@ -637,9 +643,10 @@ if (size > sizeof(data)) { source_warn("Tried to register obs_source_info with size " - "%llu which is more than libobs currently " - "supports (%llu)", (long long unsigned)size, - (long long unsigned)sizeof(data)); + "%llu which is more than libobs currently " + "supports (%llu)", + (long long unsigned)size, + (long long unsigned)sizeof(data)); goto error; } @@ -656,32 +663,33 @@ { if (find_output(info->id)) { output_warn("Output id '%s' already exists! " - "Duplicate library?", info->id); + "Duplicate library?", + info->id); goto error; } #define CHECK_REQUIRED_VAL_(info, val, func) \ CHECK_REQUIRED_VAL(struct obs_output_info, info, val, func) CHECK_REQUIRED_VAL_(info, get_name, obs_register_output); - CHECK_REQUIRED_VAL_(info, create, obs_register_output); - CHECK_REQUIRED_VAL_(info, destroy, obs_register_output); - CHECK_REQUIRED_VAL_(info, start, obs_register_output); - CHECK_REQUIRED_VAL_(info, stop, obs_register_output); + CHECK_REQUIRED_VAL_(info, create, obs_register_output); + CHECK_REQUIRED_VAL_(info, destroy, obs_register_output); + CHECK_REQUIRED_VAL_(info, start, obs_register_output); + CHECK_REQUIRED_VAL_(info, stop, obs_register_output); if (info->flags & OBS_OUTPUT_ENCODED) { CHECK_REQUIRED_VAL_(info, encoded_packet, obs_register_output); } else { if (info->flags & OBS_OUTPUT_VIDEO) CHECK_REQUIRED_VAL_(info, raw_video, - obs_register_output); + obs_register_output); if (info->flags & OBS_OUTPUT_AUDIO) { if (info->flags & OBS_OUTPUT_MULTI_TRACK) { CHECK_REQUIRED_VAL_(info, raw_audio2, - obs_register_output); + obs_register_output); } else { CHECK_REQUIRED_VAL_(info, raw_audio, - obs_register_output); + obs_register_output); } } } @@ -698,15 +706,16 @@ { if (find_encoder(info->id)) { encoder_warn("Encoder id '%s' already exists! " - "Duplicate library?", info->id); + "Duplicate library?", + info->id); goto error; } #define CHECK_REQUIRED_VAL_(info, val, func) \ CHECK_REQUIRED_VAL(struct obs_encoder_info, info, val, func) CHECK_REQUIRED_VAL_(info, get_name, obs_register_encoder); - CHECK_REQUIRED_VAL_(info, create, obs_register_encoder); - CHECK_REQUIRED_VAL_(info, destroy, obs_register_encoder); + CHECK_REQUIRED_VAL_(info, create, obs_register_encoder); + CHECK_REQUIRED_VAL_(info, destroy, obs_register_encoder); if ((info->caps & OBS_ENCODER_CAP_PASS_TEXTURE) != 0) CHECK_REQUIRED_VAL_(info, encode_texture, obs_register_encoder); @@ -728,15 +737,16 @@ { if (find_service(info->id)) { service_warn("Service id '%s' already exists! " - "Duplicate library?", info->id); + "Duplicate library?", + info->id); goto error; } #define CHECK_REQUIRED_VAL_(info, val, func) \ CHECK_REQUIRED_VAL(struct obs_service_info, info, val, func) CHECK_REQUIRED_VAL_(info, get_name, obs_register_service); - CHECK_REQUIRED_VAL_(info, create, obs_register_service); - CHECK_REQUIRED_VAL_(info, destroy, obs_register_service); + CHECK_REQUIRED_VAL_(info, create, obs_register_service); + CHECK_REQUIRED_VAL_(info, destroy, obs_register_service); #undef CHECK_REQUIRED_VAL_ REGISTER_OBS_DEF(size, obs_service_info, obs->service_types, info); @@ -750,9 +760,9 @@ { #define CHECK_REQUIRED_VAL_(info, val, func) \ CHECK_REQUIRED_VAL(struct obs_modal_ui, info, val, func) - CHECK_REQUIRED_VAL_(info, task, obs_register_modal_ui); + CHECK_REQUIRED_VAL_(info, task, obs_register_modal_ui); CHECK_REQUIRED_VAL_(info, target, obs_register_modal_ui); - CHECK_REQUIRED_VAL_(info, exec, obs_register_modal_ui); + CHECK_REQUIRED_VAL_(info, exec, obs_register_modal_ui); #undef CHECK_REQUIRED_VAL_ REGISTER_OBS_DEF(size, obs_modal_ui, obs->modal_ui_callbacks, info); @@ -766,13 +776,13 @@ { #define CHECK_REQUIRED_VAL_(info, val, func) \ CHECK_REQUIRED_VAL(struct obs_modeless_ui, info, val, func) - CHECK_REQUIRED_VAL_(info, task, obs_register_modeless_ui); + CHECK_REQUIRED_VAL_(info, task, obs_register_modeless_ui); CHECK_REQUIRED_VAL_(info, target, obs_register_modeless_ui); CHECK_REQUIRED_VAL_(info, create, obs_register_modeless_ui); #undef CHECK_REQUIRED_VAL_ REGISTER_OBS_DEF(size, obs_modeless_ui, obs->modeless_ui_callbacks, - info); + info); return; error:
View file
obs-studio-23.2.1.tar.xz/libobs/obs-module.h -> obs-studio-24.0.0.tar.xz/libobs/obs-module.h
Changed
@@ -73,16 +73,16 @@ */ /** Required: Declares a libobs module. */ -#define OBS_DECLARE_MODULE() \ - static obs_module_t *obs_module_pointer; \ - MODULE_EXPORT void obs_module_set_pointer(obs_module_t *module); \ - void obs_module_set_pointer(obs_module_t *module) \ - { \ - obs_module_pointer = module; \ - } \ - obs_module_t *obs_current_module(void) {return obs_module_pointer;} \ - MODULE_EXPORT uint32_t obs_module_ver(void); \ - uint32_t obs_module_ver(void) {return LIBOBS_API_VER;} +#define OBS_DECLARE_MODULE() \ + static obs_module_t *obs_module_pointer; \ + MODULE_EXPORT void obs_module_set_pointer(obs_module_t *module); \ + void obs_module_set_pointer(obs_module_t *module) \ + { \ + obs_module_pointer = module; \ + } \ + obs_module_t *obs_current_module(void) { return obs_module_pointer; } \ + MODULE_EXPORT uint32_t obs_module_ver(void); \ + uint32_t obs_module_ver(void) { return LIBOBS_API_VER; } /** * Required: Called when the module is loaded. Use this function to load all @@ -107,28 +107,29 @@ MODULE_EXPORT void obs_module_free_locale(void); /** Optional: Use this macro in a module to use default locale handling. */ -#define OBS_MODULE_USE_DEFAULT_LOCALE(module_name, default_locale) \ - lookup_t *obs_module_lookup = NULL; \ - const char *obs_module_text(const char *val) \ - { \ - const char *out = val; \ - text_lookup_getstr(obs_module_lookup, val, &out); \ - return out; \ - } \ - bool obs_module_get_string(const char *val, const char **out) \ - { \ +#define OBS_MODULE_USE_DEFAULT_LOCALE(module_name, default_locale) \ + lookup_t *obs_module_lookup = NULL; \ + const char *obs_module_text(const char *val) \ + { \ + const char *out = val; \ + text_lookup_getstr(obs_module_lookup, val, &out); \ + return out; \ + } \ + bool obs_module_get_string(const char *val, const char **out) \ + { \ return text_lookup_getstr(obs_module_lookup, val, out); \ - } \ - void obs_module_set_locale(const char *locale) \ - { \ - if (obs_module_lookup) text_lookup_destroy(obs_module_lookup); \ - obs_module_lookup = obs_module_load_locale( \ - obs_current_module(), \ - default_locale, locale); \ - } \ - void obs_module_free_locale(void) \ - { \ - text_lookup_destroy(obs_module_lookup); \ + } \ + void obs_module_set_locale(const char *locale) \ + { \ + if (obs_module_lookup) \ + text_lookup_destroy(obs_module_lookup); \ + obs_module_lookup = obs_module_load_locale( \ + obs_current_module(), default_locale, locale); \ + } \ + void obs_module_free_locale(void) \ + { \ + text_lookup_destroy(obs_module_lookup); \ + obs_module_lookup = NULL; \ } /** Helper function for looking up locale if default locale handler was used */ @@ -137,7 +138,7 @@ /** Helper function for looking up locale if default locale handler was used, * returns true if text found, otherwise false */ MODULE_EXTERN bool obs_module_get_string(const char *lookup_string, - const char **translated_string); + const char **translated_string); /** Helper function that returns the current module */ MODULE_EXTERN obs_module_t *obs_current_module(void); @@ -163,9 +164,9 @@ * * @param name Author name(s) */ -#define OBS_MODULE_AUTHOR(name) \ +#define OBS_MODULE_AUTHOR(name) \ MODULE_EXPORT const char *obs_module_author(void); \ - const char *obs_module_author(void) {return name;} + const char *obs_module_author(void) { return name; } /** Optional: Returns the full name of the module */ MODULE_EXPORT const char *obs_module_name(void);
View file
obs-studio-23.2.1.tar.xz/libobs/obs-nix.c -> obs-studio-24.0.0.tar.xz/libobs/obs-nix.c
Changed
@@ -48,10 +48,9 @@ #define BIT_STRING "32bit" #endif -static const char *module_bin[] = { - "../../obs-plugins/" BIT_STRING, - OBS_INSTALL_PREFIX "/" OBS_PLUGIN_DESTINATION -}; +static const char *module_bin[] = {"../../obs-plugins/" BIT_STRING, + OBS_INSTALL_PREFIX + "/" OBS_PLUGIN_DESTINATION}; static const char *module_data[] = { OBS_DATA_PATH "/obs-plugins/%module%", @@ -59,7 +58,7 @@ }; static const int module_patterns_size = - sizeof(module_bin)/sizeof(module_bin[0]); + sizeof(module_bin) / sizeof(module_bin[0]); void add_default_module_paths(void) { @@ -74,14 +73,13 @@ char *find_libobs_data_file(const char *file) { struct dstr output; - dstr_init(&output); + dstr_init(&output); if (check_path(file, OBS_DATA_PATH "/libobs/", &output)) return output.array; - if (OBS_INSTALL_PREFIX [0] != 0) { - if (check_path(file, OBS_INSTALL_DATA_PATH "/libobs/", - &output)) + if (OBS_INSTALL_PREFIX[0] != 0) { + if (check_path(file, OBS_INSTALL_DATA_PATH "/libobs/", &output)) return output.array; } @@ -92,7 +90,7 @@ static void log_processor_cores(void) { blog(LOG_INFO, "Physical Cores: %d, Logical Cores: %d", - os_get_physical_cores(), os_get_logical_cores()); + os_get_physical_cores(), os_get_logical_cores()); } #if defined(__linux__) @@ -222,10 +220,11 @@ if (sysinfo(&info) < 0) return; - blog(LOG_INFO, "Physical Memory: %"PRIu64"MB Total, %"PRIu64"MB Free", - (uint64_t)info.totalram * info.mem_unit / 1024 / 1024, - ((uint64_t)info.freeram + (uint64_t)info.bufferram) * - info.mem_unit / 1024 / 1024); + blog(LOG_INFO, + "Physical Memory: %" PRIu64 "MB Total, %" PRIu64 "MB Free", + (uint64_t)info.totalram * info.mem_unit / 1024 / 1024, + ((uint64_t)info.freeram + (uint64_t)info.bufferram) * + info.mem_unit / 1024 / 1024); } static void log_kernel_version(void) @@ -245,21 +244,24 @@ return; } - int protocol_version = ProtocolVersion(dpy); - int protocol_revision = ProtocolRevision(dpy); - int vendor_release = VendorRelease(dpy); - const char *vendor_name = ServerVendor(dpy); + int protocol_version = ProtocolVersion(dpy); + int protocol_revision = ProtocolRevision(dpy); + int vendor_release = VendorRelease(dpy); + const char *vendor_name = ServerVendor(dpy); if (strstr(vendor_name, "X.Org")) { - blog(LOG_INFO, "Window System: X%d.%d, Vendor: %s, Version: %d" - ".%d.%d", protocol_version, protocol_revision, - vendor_name, vendor_release / 10000000, - (vendor_release / 100000) % 100, - (vendor_release / 1000) % 100); + blog(LOG_INFO, + "Window System: X%d.%d, Vendor: %s, Version: %d" + ".%d.%d", + protocol_version, protocol_revision, vendor_name, + vendor_release / 10000000, (vendor_release / 100000) % 100, + (vendor_release / 1000) % 100); } else { - blog(LOG_INFO, "Window System: X%d.%d - vendor string: %s - " - "vendor release: %d", protocol_version, - protocol_revision, vendor_name, vendor_release); + blog(LOG_INFO, + "Window System: X%d.%d - vendor string: %s - " + "vendor release: %d", + protocol_version, protocol_revision, vendor_name, + vendor_release); } XCloseDisplay(dpy); @@ -365,288 +367,556 @@ #endif }; -#define MOUSE_1 (1<<16) -#define MOUSE_2 (2<<16) -#define MOUSE_3 (3<<16) -#define MOUSE_4 (4<<16) -#define MOUSE_5 (5<<16) +#define MOUSE_1 (1 << 16) +#define MOUSE_2 (2 << 16) +#define MOUSE_3 (3 << 16) +#define MOUSE_4 (4 << 16) +#define MOUSE_5 (5 << 16) static int get_keysym(obs_key_t key) { switch (key) { - case OBS_KEY_RETURN: return XK_Return; - case OBS_KEY_ESCAPE: return XK_Escape; - case OBS_KEY_TAB: return XK_Tab; - case OBS_KEY_BACKSPACE: return XK_BackSpace; - case OBS_KEY_INSERT: return XK_Insert; - case OBS_KEY_DELETE: return XK_Delete; - case OBS_KEY_PAUSE: return XK_Pause; - case OBS_KEY_PRINT: return XK_Print; - case OBS_KEY_HOME: return XK_Home; - case OBS_KEY_END: return XK_End; - case OBS_KEY_LEFT: return XK_Left; - case OBS_KEY_UP: return XK_Up; - case OBS_KEY_RIGHT: return XK_Right; - case OBS_KEY_DOWN: return XK_Down; - case OBS_KEY_PAGEUP: return XK_Prior; - case OBS_KEY_PAGEDOWN: return XK_Next; - - case OBS_KEY_SHIFT: return XK_Shift_L; - case OBS_KEY_CONTROL: return XK_Control_L; - case OBS_KEY_ALT: return XK_Alt_L; - case OBS_KEY_CAPSLOCK: return XK_Caps_Lock; - case OBS_KEY_NUMLOCK: return XK_Num_Lock; - case OBS_KEY_SCROLLLOCK: return XK_Scroll_Lock; - - case OBS_KEY_F1: return XK_F1; - case OBS_KEY_F2: return XK_F2; - case OBS_KEY_F3: return XK_F3; - case OBS_KEY_F4: return XK_F4; - case OBS_KEY_F5: return XK_F5; - case OBS_KEY_F6: return XK_F6; - case OBS_KEY_F7: return XK_F7; - case OBS_KEY_F8: return XK_F8; - case OBS_KEY_F9: return XK_F9; - case OBS_KEY_F10: return XK_F10; - case OBS_KEY_F11: return XK_F11; - case OBS_KEY_F12: return XK_F12; - case OBS_KEY_F13: return XK_F13; - case OBS_KEY_F14: return XK_F14; - case OBS_KEY_F15: return XK_F15; - case OBS_KEY_F16: return XK_F16; - case OBS_KEY_F17: return XK_F17; - case OBS_KEY_F18: return XK_F18; - case OBS_KEY_F19: return XK_F19; - case OBS_KEY_F20: return XK_F20; - case OBS_KEY_F21: return XK_F21; - case OBS_KEY_F22: return XK_F22; - case OBS_KEY_F23: return XK_F23; - case OBS_KEY_F24: return XK_F24; - case OBS_KEY_F25: return XK_F25; - case OBS_KEY_F26: return XK_F26; - case OBS_KEY_F27: return XK_F27; - case OBS_KEY_F28: return XK_F28; - case OBS_KEY_F29: return XK_F29; - case OBS_KEY_F30: return XK_F30; - case OBS_KEY_F31: return XK_F31; - case OBS_KEY_F32: return XK_F32; - case OBS_KEY_F33: return XK_F33; - case OBS_KEY_F34: return XK_F34; - case OBS_KEY_F35: return XK_F35; - - case OBS_KEY_MENU: return XK_Menu; - case OBS_KEY_HYPER_L: return XK_Hyper_L; - case OBS_KEY_HYPER_R: return XK_Hyper_R; - case OBS_KEY_HELP: return XK_Help; - case OBS_KEY_SPACE: return XK_space; - - case OBS_KEY_EXCLAM: return XK_exclam; - case OBS_KEY_QUOTEDBL: return XK_quotedbl; - case OBS_KEY_NUMBERSIGN: return XK_numbersign; - case OBS_KEY_DOLLAR: return XK_dollar; - case OBS_KEY_PERCENT: return XK_percent; - case OBS_KEY_AMPERSAND: return XK_ampersand; - case OBS_KEY_APOSTROPHE: return XK_apostrophe; - case OBS_KEY_PARENLEFT: return XK_parenleft; - case OBS_KEY_PARENRIGHT: return XK_parenright; - case OBS_KEY_ASTERISK: return XK_asterisk; - case OBS_KEY_PLUS: return XK_plus; - case OBS_KEY_COMMA: return XK_comma; - case OBS_KEY_MINUS: return XK_minus; - case OBS_KEY_PERIOD: return XK_period; - case OBS_KEY_SLASH: return XK_slash; - case OBS_KEY_0: return XK_0; - case OBS_KEY_1: return XK_1; - case OBS_KEY_2: return XK_2; - case OBS_KEY_3: return XK_3; - case OBS_KEY_4: return XK_4; - case OBS_KEY_5: return XK_5; - case OBS_KEY_6: return XK_6; - case OBS_KEY_7: return XK_7; - case OBS_KEY_8: return XK_8; - case OBS_KEY_9: return XK_9; - case OBS_KEY_NUMEQUAL: return XK_KP_Equal; - case OBS_KEY_NUMASTERISK: return XK_KP_Multiply; - case OBS_KEY_NUMPLUS: return XK_KP_Add; - case OBS_KEY_NUMCOMMA: return XK_KP_Separator; - case OBS_KEY_NUMMINUS: return XK_KP_Subtract; - case OBS_KEY_NUMPERIOD: return XK_KP_Decimal; - case OBS_KEY_NUMSLASH: return XK_KP_Divide; - case OBS_KEY_NUM0: return XK_KP_0; - case OBS_KEY_NUM1: return XK_KP_1; - case OBS_KEY_NUM2: return XK_KP_2; - case OBS_KEY_NUM3: return XK_KP_3; - case OBS_KEY_NUM4: return XK_KP_4; - case OBS_KEY_NUM5: return XK_KP_5; - case OBS_KEY_NUM6: return XK_KP_6; - case OBS_KEY_NUM7: return XK_KP_7; - case OBS_KEY_NUM8: return XK_KP_8; - case OBS_KEY_NUM9: return XK_KP_9; - case OBS_KEY_COLON: return XK_colon; - case OBS_KEY_SEMICOLON: return XK_semicolon; - case OBS_KEY_LESS: return XK_less; - case OBS_KEY_EQUAL: return XK_equal; - case OBS_KEY_GREATER: return XK_greater; - case OBS_KEY_QUESTION: return XK_question; - case OBS_KEY_AT: return XK_at; - case OBS_KEY_A: return XK_A; - case OBS_KEY_B: return XK_B; - case OBS_KEY_C: return XK_C; - case OBS_KEY_D: return XK_D; - case OBS_KEY_E: return XK_E; - case OBS_KEY_F: return XK_F; - case OBS_KEY_G: return XK_G; - case OBS_KEY_H: return XK_H; - case OBS_KEY_I: return XK_I; - case OBS_KEY_J: return XK_J; - case OBS_KEY_K: return XK_K; - case OBS_KEY_L: return XK_L; - case OBS_KEY_M: return XK_M; - case OBS_KEY_N: return XK_N; - case OBS_KEY_O: return XK_O; - case OBS_KEY_P: return XK_P; - case OBS_KEY_Q: return XK_Q; - case OBS_KEY_R: return XK_R; - case OBS_KEY_S: return XK_S; - case OBS_KEY_T: return XK_T; - case OBS_KEY_U: return XK_U; - case OBS_KEY_V: return XK_V; - case OBS_KEY_W: return XK_W; - case OBS_KEY_X: return XK_X; - case OBS_KEY_Y: return XK_Y; - case OBS_KEY_Z: return XK_Z; - case OBS_KEY_BRACKETLEFT: return XK_bracketleft; - case OBS_KEY_BACKSLASH: return XK_backslash; - case OBS_KEY_BRACKETRIGHT: return XK_bracketright; - case OBS_KEY_ASCIICIRCUM: return XK_asciicircum; - case OBS_KEY_UNDERSCORE: return XK_underscore; - case OBS_KEY_QUOTELEFT: return XK_quoteleft; - case OBS_KEY_BRACELEFT: return XK_braceleft; - case OBS_KEY_BAR: return XK_bar; - case OBS_KEY_BRACERIGHT: return XK_braceright; - case OBS_KEY_ASCIITILDE: return XK_grave; - case OBS_KEY_NOBREAKSPACE: return XK_nobreakspace; - case OBS_KEY_EXCLAMDOWN: return XK_exclamdown; - case OBS_KEY_CENT: return XK_cent; - case OBS_KEY_STERLING: return XK_sterling; - case OBS_KEY_CURRENCY: return XK_currency; - case OBS_KEY_YEN: return XK_yen; - case OBS_KEY_BROKENBAR: return XK_brokenbar; - case OBS_KEY_SECTION: return XK_section; - case OBS_KEY_DIAERESIS: return XK_diaeresis; - case OBS_KEY_COPYRIGHT: return XK_copyright; - case OBS_KEY_ORDFEMININE: return XK_ordfeminine; - case OBS_KEY_GUILLEMOTLEFT: return XK_guillemotleft; - case OBS_KEY_NOTSIGN: return XK_notsign; - case OBS_KEY_HYPHEN: return XK_hyphen; - case OBS_KEY_REGISTERED: return XK_registered; - case OBS_KEY_MACRON: return XK_macron; - case OBS_KEY_DEGREE: return XK_degree; - case OBS_KEY_PLUSMINUS: return XK_plusminus; - case OBS_KEY_TWOSUPERIOR: return XK_twosuperior; - case OBS_KEY_THREESUPERIOR: return XK_threesuperior; - case OBS_KEY_ACUTE: return XK_acute; - case OBS_KEY_MU: return XK_mu; - case OBS_KEY_PARAGRAPH: return XK_paragraph; - case OBS_KEY_PERIODCENTERED: return XK_periodcentered; - case OBS_KEY_CEDILLA: return XK_cedilla; - case OBS_KEY_ONESUPERIOR: return XK_onesuperior; - case OBS_KEY_MASCULINE: return XK_masculine; - case OBS_KEY_GUILLEMOTRIGHT: return XK_guillemotright; - case OBS_KEY_ONEQUARTER: return XK_onequarter; - case OBS_KEY_ONEHALF: return XK_onehalf; - case OBS_KEY_THREEQUARTERS: return XK_threequarters; - case OBS_KEY_QUESTIONDOWN: return XK_questiondown; - case OBS_KEY_AGRAVE: return XK_Agrave; - case OBS_KEY_AACUTE: return XK_Aacute; - case OBS_KEY_ACIRCUMFLEX: return XK_Acircumflex; - case OBS_KEY_ATILDE: return XK_Atilde; - case OBS_KEY_ADIAERESIS: return XK_Adiaeresis; - case OBS_KEY_ARING: return XK_Aring; - case OBS_KEY_AE: return XK_AE; - case OBS_KEY_CCEDILLA: return XK_cedilla; - case OBS_KEY_EGRAVE: return XK_Egrave; - case OBS_KEY_EACUTE: return XK_Eacute; - case OBS_KEY_ECIRCUMFLEX: return XK_Ecircumflex; - case OBS_KEY_EDIAERESIS: return XK_Ediaeresis; - case OBS_KEY_IGRAVE: return XK_Igrave; - case OBS_KEY_IACUTE: return XK_Iacute; - case OBS_KEY_ICIRCUMFLEX: return XK_Icircumflex; - case OBS_KEY_IDIAERESIS: return XK_Idiaeresis; - case OBS_KEY_ETH: return XK_ETH; - case OBS_KEY_NTILDE: return XK_Ntilde; - case OBS_KEY_OGRAVE: return XK_Ograve; - case OBS_KEY_OACUTE: return XK_Oacute; - case OBS_KEY_OCIRCUMFLEX: return XK_Ocircumflex; - case OBS_KEY_ODIAERESIS: return XK_Odiaeresis; - case OBS_KEY_MULTIPLY: return XK_multiply; - case OBS_KEY_OOBLIQUE: return XK_Ooblique; - case OBS_KEY_UGRAVE: return XK_Ugrave; - case OBS_KEY_UACUTE: return XK_Uacute; - case OBS_KEY_UCIRCUMFLEX: return XK_Ucircumflex; - case OBS_KEY_UDIAERESIS: return XK_Udiaeresis; - case OBS_KEY_YACUTE: return XK_Yacute; - case OBS_KEY_THORN: return XK_Thorn; - case OBS_KEY_SSHARP: return XK_ssharp; - case OBS_KEY_DIVISION: return XK_division; - case OBS_KEY_YDIAERESIS: return XK_Ydiaeresis; - case OBS_KEY_MULTI_KEY: return XK_Multi_key; - case OBS_KEY_CODEINPUT: return XK_Codeinput; - case OBS_KEY_SINGLECANDIDATE: return XK_SingleCandidate; - case OBS_KEY_MULTIPLECANDIDATE: return XK_MultipleCandidate; - case OBS_KEY_PREVIOUSCANDIDATE: return XK_PreviousCandidate; - case OBS_KEY_MODE_SWITCH: return XK_Mode_switch; - case OBS_KEY_KANJI: return XK_Kanji; - case OBS_KEY_MUHENKAN: return XK_Muhenkan; - case OBS_KEY_HENKAN: return XK_Henkan; - case OBS_KEY_ROMAJI: return XK_Romaji; - case OBS_KEY_HIRAGANA: return XK_Hiragana; - case OBS_KEY_KATAKANA: return XK_Katakana; - case OBS_KEY_HIRAGANA_KATAKANA: return XK_Hiragana_Katakana; - case OBS_KEY_ZENKAKU: return XK_Zenkaku; - case OBS_KEY_HANKAKU: return XK_Hankaku; - case OBS_KEY_ZENKAKU_HANKAKU: return XK_Zenkaku_Hankaku; - case OBS_KEY_TOUROKU: return XK_Touroku; - case OBS_KEY_MASSYO: return XK_Massyo; - case OBS_KEY_KANA_LOCK: return XK_Kana_Lock; - case OBS_KEY_KANA_SHIFT: return XK_Kana_Shift; - case OBS_KEY_EISU_SHIFT: return XK_Eisu_Shift; - case OBS_KEY_EISU_TOGGLE: return XK_Eisu_toggle; - case OBS_KEY_HANGUL: return XK_Hangul; - case OBS_KEY_HANGUL_START: return XK_Hangul_Start; - case OBS_KEY_HANGUL_END: return XK_Hangul_End; - case OBS_KEY_HANGUL_HANJA: return XK_Hangul_Hanja; - case OBS_KEY_HANGUL_JAMO: return XK_Hangul_Jamo; - case OBS_KEY_HANGUL_ROMAJA: return XK_Hangul_Romaja; - case OBS_KEY_HANGUL_BANJA: return XK_Hangul_Banja; - case OBS_KEY_HANGUL_PREHANJA: return XK_Hangul_PreHanja; - case OBS_KEY_HANGUL_POSTHANJA: return XK_Hangul_PostHanja; - case OBS_KEY_HANGUL_SPECIAL: return XK_Hangul_Special; - case OBS_KEY_DEAD_GRAVE: return XK_dead_grave; - case OBS_KEY_DEAD_ACUTE: return XK_dead_acute; - case OBS_KEY_DEAD_CIRCUMFLEX: return XK_dead_circumflex; - case OBS_KEY_DEAD_TILDE: return XK_dead_tilde; - case OBS_KEY_DEAD_MACRON: return XK_dead_macron; - case OBS_KEY_DEAD_BREVE: return XK_dead_breve; - case OBS_KEY_DEAD_ABOVEDOT: return XK_dead_abovedot; - case OBS_KEY_DEAD_DIAERESIS: return XK_dead_diaeresis; - case OBS_KEY_DEAD_ABOVERING: return XK_dead_abovering; - case OBS_KEY_DEAD_DOUBLEACUTE: return XK_dead_doubleacute; - case OBS_KEY_DEAD_CARON: return XK_dead_caron; - case OBS_KEY_DEAD_CEDILLA: return XK_dead_cedilla; - case OBS_KEY_DEAD_OGONEK: return XK_dead_ogonek; - case OBS_KEY_DEAD_IOTA: return XK_dead_iota; - case OBS_KEY_DEAD_VOICED_SOUND: return XK_dead_voiced_sound; - case OBS_KEY_DEAD_SEMIVOICED_SOUND: return XK_dead_semivoiced_sound; - case OBS_KEY_DEAD_BELOWDOT: return XK_dead_belowdot; - case OBS_KEY_DEAD_HOOK: return XK_dead_hook; - case OBS_KEY_DEAD_HORN: return XK_dead_horn; - - case OBS_KEY_MOUSE1: return MOUSE_1; - case OBS_KEY_MOUSE2: return MOUSE_2; - case OBS_KEY_MOUSE3: return MOUSE_3; - case OBS_KEY_MOUSE4: return MOUSE_4; - case OBS_KEY_MOUSE5: return MOUSE_5; + case OBS_KEY_RETURN: + return XK_Return; + case OBS_KEY_ESCAPE: + return XK_Escape; + case OBS_KEY_TAB: + return XK_Tab; + case OBS_KEY_BACKSPACE: + return XK_BackSpace; + case OBS_KEY_INSERT: + return XK_Insert; + case OBS_KEY_DELETE: + return XK_Delete; + case OBS_KEY_PAUSE: + return XK_Pause; + case OBS_KEY_PRINT: + return XK_Print; + case OBS_KEY_HOME: + return XK_Home; + case OBS_KEY_END: + return XK_End; + case OBS_KEY_LEFT: + return XK_Left; + case OBS_KEY_UP: + return XK_Up; + case OBS_KEY_RIGHT: + return XK_Right; + case OBS_KEY_DOWN: + return XK_Down; + case OBS_KEY_PAGEUP: + return XK_Prior; + case OBS_KEY_PAGEDOWN: + return XK_Next; + + case OBS_KEY_SHIFT: + return XK_Shift_L; + case OBS_KEY_CONTROL: + return XK_Control_L; + case OBS_KEY_ALT: + return XK_Alt_L; + case OBS_KEY_CAPSLOCK: + return XK_Caps_Lock; + case OBS_KEY_NUMLOCK: + return XK_Num_Lock; + case OBS_KEY_SCROLLLOCK: + return XK_Scroll_Lock; + + case OBS_KEY_F1: + return XK_F1; + case OBS_KEY_F2: + return XK_F2; + case OBS_KEY_F3: + return XK_F3; + case OBS_KEY_F4: + return XK_F4; + case OBS_KEY_F5: + return XK_F5; + case OBS_KEY_F6: + return XK_F6; + case OBS_KEY_F7: + return XK_F7; + case OBS_KEY_F8: + return XK_F8; + case OBS_KEY_F9: + return XK_F9; + case OBS_KEY_F10: + return XK_F10; + case OBS_KEY_F11: + return XK_F11; + case OBS_KEY_F12: + return XK_F12; + case OBS_KEY_F13: + return XK_F13; + case OBS_KEY_F14: + return XK_F14; + case OBS_KEY_F15: + return XK_F15; + case OBS_KEY_F16: + return XK_F16; + case OBS_KEY_F17: + return XK_F17; + case OBS_KEY_F18: + return XK_F18; + case OBS_KEY_F19: + return XK_F19; + case OBS_KEY_F20: + return XK_F20; + case OBS_KEY_F21: + return XK_F21; + case OBS_KEY_F22: + return XK_F22; + case OBS_KEY_F23: + return XK_F23; + case OBS_KEY_F24: + return XK_F24; + case OBS_KEY_F25: + return XK_F25; + case OBS_KEY_F26: + return XK_F26; + case OBS_KEY_F27: + return XK_F27; + case OBS_KEY_F28: + return XK_F28; + case OBS_KEY_F29: + return XK_F29; + case OBS_KEY_F30: + return XK_F30; + case OBS_KEY_F31: + return XK_F31; + case OBS_KEY_F32: + return XK_F32; + case OBS_KEY_F33: + return XK_F33; + case OBS_KEY_F34: + return XK_F34; + case OBS_KEY_F35: + return XK_F35; + + case OBS_KEY_MENU: + return XK_Menu; + case OBS_KEY_HYPER_L: + return XK_Hyper_L; + case OBS_KEY_HYPER_R: + return XK_Hyper_R; + case OBS_KEY_HELP: + return XK_Help; + case OBS_KEY_SPACE: + return XK_space; + + case OBS_KEY_EXCLAM: + return XK_exclam; + case OBS_KEY_QUOTEDBL: + return XK_quotedbl; + case OBS_KEY_NUMBERSIGN: + return XK_numbersign; + case OBS_KEY_DOLLAR: + return XK_dollar; + case OBS_KEY_PERCENT: + return XK_percent; + case OBS_KEY_AMPERSAND: + return XK_ampersand; + case OBS_KEY_APOSTROPHE: + return XK_apostrophe; + case OBS_KEY_PARENLEFT: + return XK_parenleft; + case OBS_KEY_PARENRIGHT: + return XK_parenright; + case OBS_KEY_ASTERISK: + return XK_asterisk; + case OBS_KEY_PLUS: + return XK_plus; + case OBS_KEY_COMMA: + return XK_comma; + case OBS_KEY_MINUS: + return XK_minus; + case OBS_KEY_PERIOD: + return XK_period; + case OBS_KEY_SLASH: + return XK_slash; + case OBS_KEY_0: + return XK_0; + case OBS_KEY_1: + return XK_1; + case OBS_KEY_2: + return XK_2; + case OBS_KEY_3: + return XK_3; + case OBS_KEY_4: + return XK_4; + case OBS_KEY_5: + return XK_5; + case OBS_KEY_6: + return XK_6; + case OBS_KEY_7: + return XK_7; + case OBS_KEY_8: + return XK_8; + case OBS_KEY_9: + return XK_9; + case OBS_KEY_NUMEQUAL: + return XK_KP_Equal; + case OBS_KEY_NUMASTERISK: + return XK_KP_Multiply; + case OBS_KEY_NUMPLUS: + return XK_KP_Add; + case OBS_KEY_NUMCOMMA: + return XK_KP_Separator; + case OBS_KEY_NUMMINUS: + return XK_KP_Subtract; + case OBS_KEY_NUMPERIOD: + return XK_KP_Decimal; + case OBS_KEY_NUMSLASH: + return XK_KP_Divide; + case OBS_KEY_NUM0: + return XK_KP_0; + case OBS_KEY_NUM1: + return XK_KP_1; + case OBS_KEY_NUM2: + return XK_KP_2; + case OBS_KEY_NUM3: + return XK_KP_3; + case OBS_KEY_NUM4: + return XK_KP_4; + case OBS_KEY_NUM5: + return XK_KP_5; + case OBS_KEY_NUM6: + return XK_KP_6; + case OBS_KEY_NUM7: + return XK_KP_7; + case OBS_KEY_NUM8: + return XK_KP_8; + case OBS_KEY_NUM9: + return XK_KP_9; + case OBS_KEY_COLON: + return XK_colon; + case OBS_KEY_SEMICOLON: + return XK_semicolon; + case OBS_KEY_LESS: + return XK_less; + case OBS_KEY_EQUAL: + return XK_equal; + case OBS_KEY_GREATER: + return XK_greater; + case OBS_KEY_QUESTION: + return XK_question; + case OBS_KEY_AT: + return XK_at; + case OBS_KEY_A: + return XK_A; + case OBS_KEY_B: + return XK_B; + case OBS_KEY_C: + return XK_C; + case OBS_KEY_D: + return XK_D; + case OBS_KEY_E: + return XK_E; + case OBS_KEY_F: + return XK_F; + case OBS_KEY_G: + return XK_G; + case OBS_KEY_H: + return XK_H; + case OBS_KEY_I: + return XK_I; + case OBS_KEY_J: + return XK_J; + case OBS_KEY_K: + return XK_K; + case OBS_KEY_L: + return XK_L; + case OBS_KEY_M: + return XK_M; + case OBS_KEY_N: + return XK_N; + case OBS_KEY_O: + return XK_O; + case OBS_KEY_P: + return XK_P; + case OBS_KEY_Q: + return XK_Q; + case OBS_KEY_R: + return XK_R; + case OBS_KEY_S: + return XK_S; + case OBS_KEY_T: + return XK_T; + case OBS_KEY_U: + return XK_U; + case OBS_KEY_V: + return XK_V; + case OBS_KEY_W: + return XK_W; + case OBS_KEY_X: + return XK_X; + case OBS_KEY_Y: + return XK_Y; + case OBS_KEY_Z: + return XK_Z; + case OBS_KEY_BRACKETLEFT: + return XK_bracketleft; + case OBS_KEY_BACKSLASH: + return XK_backslash; + case OBS_KEY_BRACKETRIGHT: + return XK_bracketright; + case OBS_KEY_ASCIICIRCUM: + return XK_asciicircum; + case OBS_KEY_UNDERSCORE: + return XK_underscore; + case OBS_KEY_QUOTELEFT: + return XK_quoteleft; + case OBS_KEY_BRACELEFT: + return XK_braceleft; + case OBS_KEY_BAR: + return XK_bar; + case OBS_KEY_BRACERIGHT: + return XK_braceright; + case OBS_KEY_ASCIITILDE: + return XK_grave; + case OBS_KEY_NOBREAKSPACE: + return XK_nobreakspace; + case OBS_KEY_EXCLAMDOWN: + return XK_exclamdown; + case OBS_KEY_CENT: + return XK_cent; + case OBS_KEY_STERLING: + return XK_sterling; + case OBS_KEY_CURRENCY: + return XK_currency; + case OBS_KEY_YEN: + return XK_yen; + case OBS_KEY_BROKENBAR: + return XK_brokenbar; + case OBS_KEY_SECTION: + return XK_section; + case OBS_KEY_DIAERESIS: + return XK_diaeresis; + case OBS_KEY_COPYRIGHT: + return XK_copyright; + case OBS_KEY_ORDFEMININE: + return XK_ordfeminine; + case OBS_KEY_GUILLEMOTLEFT: + return XK_guillemotleft; + case OBS_KEY_NOTSIGN: + return XK_notsign; + case OBS_KEY_HYPHEN: + return XK_hyphen; + case OBS_KEY_REGISTERED: + return XK_registered; + case OBS_KEY_MACRON: + return XK_macron; + case OBS_KEY_DEGREE: + return XK_degree; + case OBS_KEY_PLUSMINUS: + return XK_plusminus; + case OBS_KEY_TWOSUPERIOR: + return XK_twosuperior; + case OBS_KEY_THREESUPERIOR: + return XK_threesuperior; + case OBS_KEY_ACUTE: + return XK_acute; + case OBS_KEY_MU: + return XK_mu; + case OBS_KEY_PARAGRAPH: + return XK_paragraph; + case OBS_KEY_PERIODCENTERED: + return XK_periodcentered; + case OBS_KEY_CEDILLA: + return XK_cedilla; + case OBS_KEY_ONESUPERIOR: + return XK_onesuperior; + case OBS_KEY_MASCULINE: + return XK_masculine; + case OBS_KEY_GUILLEMOTRIGHT: + return XK_guillemotright; + case OBS_KEY_ONEQUARTER: + return XK_onequarter; + case OBS_KEY_ONEHALF: + return XK_onehalf; + case OBS_KEY_THREEQUARTERS: + return XK_threequarters; + case OBS_KEY_QUESTIONDOWN: + return XK_questiondown; + case OBS_KEY_AGRAVE: + return XK_Agrave; + case OBS_KEY_AACUTE: + return XK_Aacute; + case OBS_KEY_ACIRCUMFLEX: + return XK_Acircumflex; + case OBS_KEY_ATILDE: + return XK_Atilde; + case OBS_KEY_ADIAERESIS: + return XK_Adiaeresis; + case OBS_KEY_ARING: + return XK_Aring; + case OBS_KEY_AE: + return XK_AE; + case OBS_KEY_CCEDILLA: + return XK_cedilla; + case OBS_KEY_EGRAVE: + return XK_Egrave; + case OBS_KEY_EACUTE: + return XK_Eacute; + case OBS_KEY_ECIRCUMFLEX: + return XK_Ecircumflex; + case OBS_KEY_EDIAERESIS: + return XK_Ediaeresis; + case OBS_KEY_IGRAVE: + return XK_Igrave; + case OBS_KEY_IACUTE: + return XK_Iacute; + case OBS_KEY_ICIRCUMFLEX: + return XK_Icircumflex; + case OBS_KEY_IDIAERESIS: + return XK_Idiaeresis; + case OBS_KEY_ETH: + return XK_ETH; + case OBS_KEY_NTILDE: + return XK_Ntilde; + case OBS_KEY_OGRAVE: + return XK_Ograve; + case OBS_KEY_OACUTE: + return XK_Oacute; + case OBS_KEY_OCIRCUMFLEX: + return XK_Ocircumflex; + case OBS_KEY_ODIAERESIS: + return XK_Odiaeresis; + case OBS_KEY_MULTIPLY: + return XK_multiply; + case OBS_KEY_OOBLIQUE: + return XK_Ooblique; + case OBS_KEY_UGRAVE: + return XK_Ugrave; + case OBS_KEY_UACUTE: + return XK_Uacute; + case OBS_KEY_UCIRCUMFLEX: + return XK_Ucircumflex; + case OBS_KEY_UDIAERESIS: + return XK_Udiaeresis; + case OBS_KEY_YACUTE: + return XK_Yacute; + case OBS_KEY_THORN: + return XK_Thorn; + case OBS_KEY_SSHARP: + return XK_ssharp; + case OBS_KEY_DIVISION: + return XK_division; + case OBS_KEY_YDIAERESIS: + return XK_Ydiaeresis; + case OBS_KEY_MULTI_KEY: + return XK_Multi_key; + case OBS_KEY_CODEINPUT: + return XK_Codeinput; + case OBS_KEY_SINGLECANDIDATE: + return XK_SingleCandidate; + case OBS_KEY_MULTIPLECANDIDATE: + return XK_MultipleCandidate; + case OBS_KEY_PREVIOUSCANDIDATE: + return XK_PreviousCandidate; + case OBS_KEY_MODE_SWITCH: + return XK_Mode_switch; + case OBS_KEY_KANJI: + return XK_Kanji; + case OBS_KEY_MUHENKAN: + return XK_Muhenkan; + case OBS_KEY_HENKAN: + return XK_Henkan; + case OBS_KEY_ROMAJI: + return XK_Romaji; + case OBS_KEY_HIRAGANA: + return XK_Hiragana; + case OBS_KEY_KATAKANA: + return XK_Katakana; + case OBS_KEY_HIRAGANA_KATAKANA: + return XK_Hiragana_Katakana; + case OBS_KEY_ZENKAKU: + return XK_Zenkaku; + case OBS_KEY_HANKAKU: + return XK_Hankaku; + case OBS_KEY_ZENKAKU_HANKAKU: + return XK_Zenkaku_Hankaku; + case OBS_KEY_TOUROKU: + return XK_Touroku; + case OBS_KEY_MASSYO: + return XK_Massyo; + case OBS_KEY_KANA_LOCK: + return XK_Kana_Lock; + case OBS_KEY_KANA_SHIFT: + return XK_Kana_Shift; + case OBS_KEY_EISU_SHIFT: + return XK_Eisu_Shift; + case OBS_KEY_EISU_TOGGLE: + return XK_Eisu_toggle; + case OBS_KEY_HANGUL: + return XK_Hangul; + case OBS_KEY_HANGUL_START: + return XK_Hangul_Start; + case OBS_KEY_HANGUL_END: + return XK_Hangul_End; + case OBS_KEY_HANGUL_HANJA: + return XK_Hangul_Hanja; + case OBS_KEY_HANGUL_JAMO: + return XK_Hangul_Jamo; + case OBS_KEY_HANGUL_ROMAJA: + return XK_Hangul_Romaja; + case OBS_KEY_HANGUL_BANJA: + return XK_Hangul_Banja; + case OBS_KEY_HANGUL_PREHANJA: + return XK_Hangul_PreHanja; + case OBS_KEY_HANGUL_POSTHANJA: + return XK_Hangul_PostHanja; + case OBS_KEY_HANGUL_SPECIAL: + return XK_Hangul_Special; + case OBS_KEY_DEAD_GRAVE: + return XK_dead_grave; + case OBS_KEY_DEAD_ACUTE: + return XK_dead_acute; + case OBS_KEY_DEAD_CIRCUMFLEX: + return XK_dead_circumflex; + case OBS_KEY_DEAD_TILDE: + return XK_dead_tilde; + case OBS_KEY_DEAD_MACRON: + return XK_dead_macron; + case OBS_KEY_DEAD_BREVE: + return XK_dead_breve; + case OBS_KEY_DEAD_ABOVEDOT: + return XK_dead_abovedot; + case OBS_KEY_DEAD_DIAERESIS: + return XK_dead_diaeresis; + case OBS_KEY_DEAD_ABOVERING: + return XK_dead_abovering; + case OBS_KEY_DEAD_DOUBLEACUTE: + return XK_dead_doubleacute; + case OBS_KEY_DEAD_CARON: + return XK_dead_caron; + case OBS_KEY_DEAD_CEDILLA: + return XK_dead_cedilla; + case OBS_KEY_DEAD_OGONEK: + return XK_dead_ogonek; + case OBS_KEY_DEAD_IOTA: + return XK_dead_iota; + case OBS_KEY_DEAD_VOICED_SOUND: + return XK_dead_voiced_sound; + case OBS_KEY_DEAD_SEMIVOICED_SOUND: + return XK_dead_semivoiced_sound; + case OBS_KEY_DEAD_BELOWDOT: + return XK_dead_belowdot; + case OBS_KEY_DEAD_HOOK: + return XK_dead_hook; + case OBS_KEY_DEAD_HORN: + return XK_dead_horn; + + case OBS_KEY_MOUSE1: + return MOUSE_1; + case OBS_KEY_MOUSE2: + return MOUSE_2; + case OBS_KEY_MOUSE3: + return MOUSE_3; + case OBS_KEY_MOUSE4: + return MOUSE_4; + case OBS_KEY_MOUSE5: + return MOUSE_5; /* TODO: Implement keys for non-US keyboards */ default:; @@ -661,7 +931,7 @@ } static obs_key_t key_from_base_keysym(obs_hotkeys_platform_t *context, - xcb_keysym_t code) + xcb_keysym_t code) { for (size_t i = 0; i < OBS_KEY_LAST_VALUE; i++) { if (context->base_keysyms[i] == (xcb_keysym_t)code) { @@ -673,16 +943,17 @@ } static inline void add_key(obs_hotkeys_platform_t *context, obs_key_t key, - int code) + int code) { xcb_keycode_t kc = (xcb_keycode_t)code; da_push_back(context->keycodes[key].list, &kc); if (context->keycodes[key].list.num > 1) { - blog(LOG_DEBUG, "found alternate keycode %d for %s " - "which already has keycode %d", - code, obs_key_to_name(key), - (int)context->keycodes[key].list.array[0]); + blog(LOG_DEBUG, + "found alternate keycode %d for %s " + "which already has keycode %d", + code, obs_key_to_name(key), + (int)context->keycodes[key].list.array[0]); } } @@ -701,8 +972,8 @@ context->min_keycode = setup->min_keycode; - cookie = xcb_get_keyboard_mapping(connection, - mincode, maxcode - mincode + 1); + cookie = xcb_get_keyboard_mapping(connection, mincode, + maxcode - mincode + 1); reply = xcb_get_keyboard_mapping_reply(connection, cookie, &error); @@ -716,8 +987,8 @@ context->num_keysyms = (maxcode - mincode + 1) * syms_per_code; context->syms_per_code = syms_per_code; - context->keysyms = bmemdup(keysyms, - sizeof(xcb_keysym_t) * context->num_keysyms); + context->keysyms = + bmemdup(keysyms, sizeof(xcb_keysym_t) * context->num_keysyms); for (code = mincode; code <= maxcode; code++) { const xcb_keysym_t *sym; @@ -744,7 +1015,6 @@ } } } - } error1: @@ -755,7 +1025,7 @@ } static xcb_screen_t *default_screen(obs_hotkeys_platform_t *context, - xcb_connection_t *connection) + xcb_connection_t *connection) { int def_screen_idx = XDefaultScreen(context->display); xcb_screen_iterator_t iter; @@ -772,7 +1042,7 @@ } static inline xcb_window_t root_window(obs_hotkeys_platform_t *context, - xcb_connection_t *connection) + xcb_connection_t *connection) { xcb_screen_t *screen = default_screen(context, connection); if (screen) @@ -783,19 +1053,18 @@ #if USE_XINPUT static inline void registerMouseEvents(struct obs_core_hotkeys *hotkeys) { - obs_hotkeys_platform_t *context = hotkeys->platform_context; - xcb_connection_t *connection = XGetXCBConnection( - context->display); - xcb_window_t window = root_window(context, connection); + obs_hotkeys_platform_t *context = hotkeys->platform_context; + xcb_connection_t *connection = XGetXCBConnection(context->display); + xcb_window_t window = root_window(context, connection); struct { - xcb_input_event_mask_t head; + xcb_input_event_mask_t head; xcb_input_xi_event_mask_t mask; } mask; mask.head.deviceid = XCB_INPUT_DEVICE_ALL_MASTER; mask.head.mask_len = sizeof(mask.mask) / sizeof(uint32_t); - mask.mask = XCB_INPUT_XI_EVENT_MASK_RAW_BUTTON_PRESS | - XCB_INPUT_XI_EVENT_MASK_RAW_BUTTON_RELEASE; + mask.mask = XCB_INPUT_XI_EVENT_MASK_RAW_BUTTON_PRESS | + XCB_INPUT_XI_EVENT_MASK_RAW_BUTTON_RELEASE; xcb_input_xi_select_events(connection, window, 1, &mask.head); xcb_flush(connection); @@ -834,7 +1103,7 @@ } static bool mouse_button_pressed(xcb_connection_t *connection, - obs_hotkeys_platform_t *context, obs_key_t key) + obs_hotkeys_platform_t *context, obs_key_t key) { bool ret = false; @@ -845,13 +1114,14 @@ xcb_generic_event_t *ev; while ((ev = xcb_poll_for_event(connection))) { if ((ev->response_type & ~80) == XCB_GE_GENERIC) { - switch (((xcb_ge_event_t *) ev)->event_type) { + switch (((xcb_ge_event_t *)ev)->event_type) { case XCB_INPUT_RAW_BUTTON_PRESS: { xcb_input_raw_button_press_event_t *mot; - mot = (xcb_input_raw_button_press_event_t *) ev; + mot = (xcb_input_raw_button_press_event_t *)ev; if (mot->detail < XINPUT_MOUSE_LEN) { - context->pressed[mot->detail-1] = true; - context->update[mot->detail-1] = true; + context->pressed[mot->detail - 1] = + true; + context->update[mot->detail - 1] = true; } else { blog(LOG_WARNING, "Unsupported button"); } @@ -859,9 +1129,9 @@ } case XCB_INPUT_RAW_BUTTON_RELEASE: { xcb_input_raw_button_release_event_t *mot; - mot = (xcb_input_raw_button_release_event_t *) ev; + mot = (xcb_input_raw_button_release_event_t *)ev; if (mot->detail < XINPUT_MOUSE_LEN) - context->update[mot->detail-1] = true; + context->update[mot->detail - 1] = true; else blog(LOG_WARNING, "Unsupported button"); break; @@ -984,9 +1254,15 @@ uint16_t buttons = reply->mask; switch (key) { - case OBS_KEY_MOUSE1: ret = buttons & XCB_BUTTON_MASK_1; break; - case OBS_KEY_MOUSE2: ret = buttons & XCB_BUTTON_MASK_3; break; - case OBS_KEY_MOUSE3: ret = buttons & XCB_BUTTON_MASK_2; break; + case OBS_KEY_MOUSE1: + ret = buttons & XCB_BUTTON_MASK_1; + break; + case OBS_KEY_MOUSE2: + ret = buttons & XCB_BUTTON_MASK_3; + break; + case OBS_KEY_MOUSE3: + ret = buttons & XCB_BUTTON_MASK_2; + break; default:; } } @@ -998,27 +1274,27 @@ } static inline bool keycode_pressed(xcb_query_keymap_reply_t *reply, - xcb_keycode_t code) + xcb_keycode_t code) { return (reply->keys[code / 8] & (1 << (code % 8))) != 0; } static bool key_pressed(xcb_connection_t *connection, - obs_hotkeys_platform_t *context, obs_key_t key) + obs_hotkeys_platform_t *context, obs_key_t key) { struct keycode_list *codes = &context->keycodes[key]; xcb_generic_error_t *error = NULL; xcb_query_keymap_reply_t *reply; bool pressed = false; - reply = xcb_query_keymap_reply(connection, - xcb_query_keymap(connection), &error); + reply = xcb_query_keymap_reply(connection, xcb_query_keymap(connection), + &error); if (error) { blog(LOG_WARNING, "xcb_query_keymap failed"); } else if (key == OBS_KEY_META) { pressed = keycode_pressed(reply, context->super_l_code) || - keycode_pressed(reply, context->super_r_code); + keycode_pressed(reply, context->super_r_code); } else { for (size_t i = 0; i < codes->list.num; i++) { @@ -1035,7 +1311,7 @@ } bool obs_hotkeys_platform_is_pressed(obs_hotkeys_platform_t *context, - obs_key_t key) + obs_key_t key) { xcb_connection_t *conn = XGetXCBConnection(context->display); @@ -1079,7 +1355,7 @@ dstr_copy(dstr, obs->hotkeys.translations[key]); } else { dstr_printf(dstr, "Mouse %d", - (int)(key - OBS_KEY_MOUSE1 + 1)); + (int)(key - OBS_KEY_MOUSE1 + 1)); } return; } @@ -1089,7 +1365,7 @@ dstr_copy(dstr, obs->hotkeys.translations[key]); } else { dstr_printf(dstr, "Numpad %d", - (int)(key - OBS_KEY_NUM0)); + (int)(key - OBS_KEY_NUM0)); } return; } @@ -1098,41 +1374,69 @@ dstr_copy(dstr, obs_get_hotkey_translation(key, def)) switch (key) { - case OBS_KEY_INSERT: return translate_key(key, "Insert"); - case OBS_KEY_DELETE: return translate_key(key, "Delete"); - case OBS_KEY_HOME: return translate_key(key, "Home"); - case OBS_KEY_END: return translate_key(key, "End"); - case OBS_KEY_PAGEUP: return translate_key(key, "Page Up"); - case OBS_KEY_PAGEDOWN: return translate_key(key, "Page Down"); - case OBS_KEY_NUMLOCK: return translate_key(key, "Num Lock"); - case OBS_KEY_SCROLLLOCK: return translate_key(key, "Scroll Lock"); - case OBS_KEY_CAPSLOCK: return translate_key(key, "Caps Lock"); - case OBS_KEY_BACKSPACE: return translate_key(key, "Backspace"); - case OBS_KEY_TAB: return translate_key(key, "Tab"); - case OBS_KEY_PRINT: return translate_key(key, "Print"); - case OBS_KEY_PAUSE: return translate_key(key, "Pause"); - case OBS_KEY_LEFT: return translate_key(key, "Left"); - case OBS_KEY_RIGHT: return translate_key(key, "Right"); - case OBS_KEY_UP: return translate_key(key, "Up"); - case OBS_KEY_DOWN: return translate_key(key, "Down"); - case OBS_KEY_SHIFT: return translate_key(key, "Shift"); - case OBS_KEY_ALT: return translate_key(key, "Alt"); - case OBS_KEY_CONTROL: return translate_key(key, "Control"); - case OBS_KEY_META: return translate_key(key, "Super"); - case OBS_KEY_MENU: return translate_key(key, "Menu"); - case OBS_KEY_NUMASTERISK: return translate_key(key, "Numpad *"); - case OBS_KEY_NUMPLUS: return translate_key(key, "Numpad +"); - case OBS_KEY_NUMCOMMA: return translate_key(key, "Numpad ,"); - case OBS_KEY_NUMPERIOD: return translate_key(key, "Numpad ."); - case OBS_KEY_NUMSLASH: return translate_key(key, "Numpad /"); - case OBS_KEY_SPACE: return translate_key(key, "Space"); - case OBS_KEY_ESCAPE: return translate_key(key, "Escape"); + case OBS_KEY_INSERT: + return translate_key(key, "Insert"); + case OBS_KEY_DELETE: + return translate_key(key, "Delete"); + case OBS_KEY_HOME: + return translate_key(key, "Home"); + case OBS_KEY_END: + return translate_key(key, "End"); + case OBS_KEY_PAGEUP: + return translate_key(key, "Page Up"); + case OBS_KEY_PAGEDOWN: + return translate_key(key, "Page Down"); + case OBS_KEY_NUMLOCK: + return translate_key(key, "Num Lock"); + case OBS_KEY_SCROLLLOCK: + return translate_key(key, "Scroll Lock"); + case OBS_KEY_CAPSLOCK: + return translate_key(key, "Caps Lock"); + case OBS_KEY_BACKSPACE: + return translate_key(key, "Backspace"); + case OBS_KEY_TAB: + return translate_key(key, "Tab"); + case OBS_KEY_PRINT: + return translate_key(key, "Print"); + case OBS_KEY_PAUSE: + return translate_key(key, "Pause"); + case OBS_KEY_LEFT: + return translate_key(key, "Left"); + case OBS_KEY_RIGHT: + return translate_key(key, "Right"); + case OBS_KEY_UP: + return translate_key(key, "Up"); + case OBS_KEY_DOWN: + return translate_key(key, "Down"); + case OBS_KEY_SHIFT: + return translate_key(key, "Shift"); + case OBS_KEY_ALT: + return translate_key(key, "Alt"); + case OBS_KEY_CONTROL: + return translate_key(key, "Control"); + case OBS_KEY_META: + return translate_key(key, "Super"); + case OBS_KEY_MENU: + return translate_key(key, "Menu"); + case OBS_KEY_NUMASTERISK: + return translate_key(key, "Numpad *"); + case OBS_KEY_NUMPLUS: + return translate_key(key, "Numpad +"); + case OBS_KEY_NUMCOMMA: + return translate_key(key, "Numpad ,"); + case OBS_KEY_NUMPERIOD: + return translate_key(key, "Numpad ."); + case OBS_KEY_NUMSLASH: + return translate_key(key, "Numpad /"); + case OBS_KEY_SPACE: + return translate_key(key, "Space"); + case OBS_KEY_ESCAPE: + return translate_key(key, "Escape"); default:; } if (key >= OBS_KEY_F1 && key <= OBS_KEY_F35) { - dstr_printf(dstr, "F%d", - (int)(key - OBS_KEY_F1 + 1)); + dstr_printf(dstr, "F%d", (int)(key - OBS_KEY_F1 + 1)); return; } @@ -1151,7 +1455,7 @@ } static obs_key_t key_from_keycode(obs_hotkeys_platform_t *context, - xcb_keycode_t code) + xcb_keycode_t code) { for (size_t i = 0; i < OBS_KEY_LAST_VALUE; i++) { struct keycode_list *codes = &context->keycodes[i]; @@ -1214,7 +1518,7 @@ } void obs_key_combination_to_str(obs_key_combination_t combination, - struct dstr *str) + struct dstr *str) { if ((combination.modifiers & INTERACT_CONTROL_KEY) != 0) { add_combo_key(OBS_KEY_CONTROL, str);
View file
obs-studio-23.2.1.tar.xz/libobs/obs-output-delay.c -> obs-studio-24.0.0.tar.xz/libobs/obs-output-delay.c
Changed
@@ -29,12 +29,12 @@ } static inline void push_packet(struct obs_output *output, - struct encoder_packet *packet, uint64_t t) + struct encoder_packet *packet, uint64_t t) { struct delay_data dd = {0}; dd.msg = DELAY_MSG_PACKET; - dd.ts = t; + dd.ts = t; obs_encoder_packet_create_instance(&dd.packet, packet); pthread_mutex_lock(&output->delay_mutex); @@ -43,7 +43,7 @@ } static inline void process_delay_data(struct obs_output *output, - struct delay_data *dd) + struct delay_data *dd) { switch (dd->msg) { case DELAY_MSG_PACKET: @@ -98,7 +98,7 @@ } else if (elapsed_time > output->active_delay_ns) { circlebuf_pop_front(&output->delay_data, NULL, - sizeof(dd)); + sizeof(dd)); popped = true; } } @@ -118,7 +118,8 @@ struct obs_output *output = data; uint64_t t = os_gettime_ns(); push_packet(output, packet, t); - while (pop_packet(output, t)); + while (pop_packet(output, t)) + ; } void obs_output_signal_delay(obs_output_t *output, const char *signal) @@ -136,7 +137,7 @@ { struct delay_data dd = { .msg = DELAY_MSG_START, - .ts = os_gettime_ns(), + .ts = os_gettime_ns(), }; if (!delay_active(output)) { @@ -170,7 +171,7 @@ { struct delay_data dd = { .msg = DELAY_MSG_STOP, - .ts = os_gettime_ns(), + .ts = os_gettime_ns(), }; pthread_mutex_lock(&output->delay_mutex); @@ -181,15 +182,16 @@ } void obs_output_set_delay(obs_output_t *output, uint32_t delay_sec, - uint32_t flags) + uint32_t flags) { if (!obs_output_valid(output, "obs_output_set_delay")) return; if ((output->info.flags & OBS_OUTPUT_ENCODED) == 0) { - blog(LOG_WARNING, "Output '%s': Tried to set a delay " - "value on a non-encoded output", - output->context.name); + blog(LOG_WARNING, + "Output '%s': Tried to set a delay " + "value on a non-encoded output", + output->context.name); return; } @@ -199,12 +201,14 @@ uint32_t obs_output_get_delay(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_set_delay") ? - output->delay_sec : 0; + return obs_output_valid(output, "obs_output_set_delay") + ? output->delay_sec + : 0; } uint32_t obs_output_get_active_delay(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_set_delay") ? - (uint32_t)(output->active_delay_ns / 1000000000ULL) : 0; + return obs_output_valid(output, "obs_output_set_delay") + ? (uint32_t)(output->active_delay_ns / 1000000000ULL) + : 0; }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-output.c -> obs-studio-24.0.0.tar.xz/libobs/obs-output.c
Changed
@@ -60,7 +60,7 @@ size_t i; for (i = 0; i < obs->output_types.num; i++) if (strcmp(obs->output_types.array[i].id, id) == 0) - return obs->output_types.array+i; + return obs->output_types.array + i; return NULL; } @@ -74,20 +74,22 @@ static const char *output_signals[] = { "void start(ptr output)", "void stop(ptr output, int code)", + "void pause(ptr output)", + "void unpause(ptr output)", "void starting(ptr output)", "void stopping(ptr output)", "void activate(ptr output)", "void deactivate(ptr output)", "void reconnect(ptr output)", "void reconnect_success(ptr output)", - NULL + NULL, }; static bool init_output_handlers(struct obs_output *output, const char *name, - obs_data_t *settings, obs_data_t *hotkey_data) + obs_data_t *settings, obs_data_t *hotkey_data) { if (!obs_context_data_init(&output->context, OBS_OBJ_TYPE_OUTPUT, - settings, name, hotkey_data, false)) + settings, name, hotkey_data, false)) return false; signal_handler_add_array(output->context.signals, output_signals); @@ -95,7 +97,7 @@ } obs_output_t *obs_output_create(const char *id, const char *name, - obs_data_t *settings, obs_data_t *hotkey_data) + obs_data_t *settings, obs_data_t *hotkey_data) { const struct obs_output_info *info = find_output(id); struct obs_output *output; @@ -105,6 +107,7 @@ pthread_mutex_init_value(&output->interleaved_mutex); pthread_mutex_init_value(&output->delay_mutex); pthread_mutex_init_value(&output->caption_mutex); + pthread_mutex_init_value(&output->pause.mutex); if (pthread_mutex_init(&output->interleaved_mutex, NULL) != 0) goto fail; @@ -112,6 +115,8 @@ goto fail; if (pthread_mutex_init(&output->caption_mutex, NULL) != 0) goto fail; + if (pthread_mutex_init(&output->pause.mutex, NULL) != 0) + goto fail; if (os_event_init(&output->stopping_event, OS_EVENT_TYPE_MANUAL) != 0) goto fail; if (!init_output_handlers(output, name, settings, hotkey_data)) @@ -122,35 +127,34 @@ if (!info) { blog(LOG_ERROR, "Output ID '%s' not found", id); - output->info.id = bstrdup(id); + output->info.id = bstrdup(id); output->owns_info_id = true; } else { output->info = *info; } - output->video = obs_get_video(); - output->audio = obs_get_audio(); + output->video = obs_get_video(); + output->audio = obs_get_audio(); if (output->info.get_defaults) output->info.get_defaults(output->context.settings); ret = os_event_init(&output->reconnect_stop_event, - OS_EVENT_TYPE_MANUAL); + OS_EVENT_TYPE_MANUAL); if (ret < 0) goto fail; output->reconnect_retry_sec = 2; output->reconnect_retry_max = 20; - output->valid = true; + output->valid = true; output->control = bzalloc(sizeof(obs_weak_output_t)); output->control->output = output; - obs_context_data_insert(&output->context, - &obs->data.outputs_mutex, - &obs->data.first_output); + obs_context_data_insert(&output->context, &obs->data.outputs_mutex, + &obs->data.first_output); if (info) - output->context.data = info->create(output->context.settings, - output); + output->context.data = + info->create(output->context.settings, output); if (!output->context.data) blog(LOG_ERROR, "Failed to create output '%s'!", name); @@ -165,10 +169,20 @@ static inline void free_packets(struct obs_output *output) { for (size_t i = 0; i < output->interleaved_packets.num; i++) - obs_encoder_packet_release(output->interleaved_packets.array+i); + obs_encoder_packet_release(output->interleaved_packets.array + + i); da_free(output->interleaved_packets); } +static inline void clear_audio_buffers(obs_output_t *output) +{ + for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { + for (size_t j = 0; j < MAX_AV_PLANES; j++) { + circlebuf_free(&output->audio_buffer[i][j]); + } + } +} + void obs_output_destroy(obs_output_t *output) { if (output) { @@ -192,18 +206,20 @@ if (output->video_encoder) { obs_encoder_remove_output(output->video_encoder, - output); + output); } for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { if (output->audio_encoders[i]) { obs_encoder_remove_output( - output->audio_encoders[i], - output); + output->audio_encoders[i], output); } } + clear_audio_buffers(output); + os_event_destroy(output->stopping_event); + pthread_mutex_destroy(&output->pause.mutex); pthread_mutex_destroy(&output->caption_mutex); pthread_mutex_destroy(&output->interleaved_mutex); pthread_mutex_destroy(&output->delay_mutex); @@ -211,7 +227,7 @@ obs_context_data_free(&output->context); circlebuf_free(&output->delay_data); if (output->owns_info_id) - bfree((void*)output->info.id); + bfree((void *)output->info.id); if (output->last_error_message) bfree(output->last_error_message); bfree(output); @@ -220,8 +236,9 @@ const char *obs_output_get_name(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_get_name") ? - output->context.name : NULL; + return obs_output_valid(output, "obs_output_get_name") + ? output->context.name + : NULL; } bool obs_output_actual_start(obs_output_t *output) @@ -287,7 +304,7 @@ { struct obs_core_video *video = &obs->video; - uint32_t drawn = video->total_frames - output->starting_drawn_count; + uint32_t drawn = video->total_frames - output->starting_drawn_count; uint32_t lagged = video->lagged_frames - output->starting_lagged_count; int dropped = obs_output_get_frames_dropped(output); @@ -297,38 +314,40 @@ double percentage_dropped = 0.0f; if (drawn) - percentage_lagged = (double)lagged / (double)drawn * 100.0; + percentage_lagged = (double)lagged / (double)drawn * 100.0; if (dropped) percentage_dropped = (double)dropped / (double)total * 100.0; blog(LOG_INFO, "Output '%s': stopping", output->context.name); if (!dropped || !total) blog(LOG_INFO, "Output '%s': Total frames output: %d", - output->context.name, total); + output->context.name, total); else - blog(LOG_INFO, "Output '%s': Total frames output: %d" - " (%d attempted)", - output->context.name, total - dropped, total); + blog(LOG_INFO, + "Output '%s': Total frames output: %d" + " (%d attempted)", + output->context.name, total - dropped, total); if (!lagged || !drawn) - blog(LOG_INFO, "Output '%s': Total drawn frames: %"PRIu32, - output->context.name, drawn); + blog(LOG_INFO, "Output '%s': Total drawn frames: %" PRIu32, + output->context.name, drawn); else - blog(LOG_INFO, "Output '%s': Total drawn frames: %"PRIu32 - " (%"PRIu32" attempted)", - output->context.name, drawn - lagged, drawn); + blog(LOG_INFO, + "Output '%s': Total drawn frames: %" PRIu32 " (%" PRIu32 + " attempted)", + output->context.name, drawn - lagged, drawn); if (drawn && lagged) - blog(LOG_INFO, "Output '%s': Number of lagged frames due " - "to rendering lag/stalls: %"PRIu32" (%0.1f%%)", - output->context.name, - lagged, percentage_lagged); + blog(LOG_INFO, + "Output '%s': Number of lagged frames due " + "to rendering lag/stalls: %" PRIu32 " (%0.1f%%)", + output->context.name, lagged, percentage_lagged); if (total && dropped) - blog(LOG_INFO, "Output '%s': Number of dropped frames due " - "to insufficient bandwidth/connection stalls: " - "%d (%0.1f%%)", - output->context.name, - dropped, percentage_dropped); + blog(LOG_INFO, + "Output '%s': Number of dropped frames due " + "to insufficient bandwidth/connection stalls: " + "%d (%0.1f%%)", + output->context.name, dropped, percentage_dropped); } static inline void signal_stop(struct obs_output *output); @@ -340,6 +359,9 @@ if (stopping(output) && !force) return; + + obs_output_pause(output, false); + os_event_reset(output->stopping_event); was_reconnecting = reconnecting(output) && !delay_active(output); @@ -419,14 +441,15 @@ bool obs_output_active(const obs_output_t *output) { - return (output != NULL) ? - (active(output) || reconnecting(output)) : false; + return (output != NULL) ? (active(output) || reconnecting(output)) + : false; } uint32_t obs_output_get_flags(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_get_flags") ? - output->info.flags : 0; + return obs_output_valid(output, "obs_output_get_flags") + ? output->info.flags + : 0; } uint32_t obs_get_output_flags(const char *id) @@ -453,7 +476,7 @@ { const struct obs_output_info *info = find_output(id); if (info && info->get_properties) { - obs_data_t *defaults = get_defaults(info); + obs_data_t *defaults = get_defaults(info); obs_properties_t *properties; properties = info->get_properties(NULL); @@ -488,7 +511,7 @@ if (output->info.update) output->info.update(output->context.data, - output->context.settings); + output->context.settings); } obs_data_t *obs_output_get_settings(const obs_output_t *output) @@ -502,29 +525,196 @@ bool obs_output_can_pause(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_can_pause") ? - (output->info.pause != NULL) : false; + return obs_output_valid(output, "obs_output_can_pause") + ? !!(output->info.flags & OBS_OUTPUT_CAN_PAUSE) + : false; +} + +static inline void end_pause(struct pause_data *pause, uint64_t ts) +{ + if (!pause->ts_end) { + pause->ts_end = ts; + pause->ts_offset += pause->ts_end - pause->ts_start; + } +} + +static inline uint64_t get_closest_v_ts(struct pause_data *pause) +{ + uint64_t interval = obs->video.video_frame_interval_ns; + uint64_t i2 = interval * 2; + uint64_t ts = os_gettime_ns(); + + return pause->last_video_ts + + ((ts - pause->last_video_ts + i2) / interval) * interval; +} + +static inline bool pause_can_start(struct pause_data *pause) +{ + return !pause->ts_start && !pause->ts_end; +} + +static inline bool pause_can_stop(struct pause_data *pause) +{ + return !!pause->ts_start && !pause->ts_end; +} + +static bool obs_encoded_output_pause(obs_output_t *output, bool pause) +{ + obs_encoder_t *venc; + obs_encoder_t *aenc[MAX_AUDIO_MIXES]; + uint64_t closest_v_ts; + bool success = false; + + venc = output->video_encoder; + for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) + aenc[i] = output->audio_encoders[i]; + + pthread_mutex_lock(&venc->pause.mutex); + for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { + if (aenc[i]) { + pthread_mutex_lock(&aenc[i]->pause.mutex); + } + } + + /* ---------------------------- */ + + closest_v_ts = get_closest_v_ts(&venc->pause); + + if (pause) { + if (!pause_can_start(&venc->pause)) { + goto fail; + } + for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { + if (aenc[i] && !pause_can_start(&aenc[i]->pause)) { + goto fail; + } + } + + os_atomic_set_bool(&venc->paused, true); + venc->pause.ts_start = closest_v_ts; + + for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { + if (aenc[i]) { + os_atomic_set_bool(&aenc[i]->paused, true); + aenc[i]->pause.ts_start = closest_v_ts; + } + } + } else { + if (!pause_can_stop(&venc->pause)) { + goto fail; + } + for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { + if (aenc[i] && !pause_can_stop(&aenc[i]->pause)) { + goto fail; + } + } + + os_atomic_set_bool(&venc->paused, false); + end_pause(&venc->pause, closest_v_ts); + + for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { + if (aenc[i]) { + os_atomic_set_bool(&aenc[i]->paused, false); + end_pause(&aenc[i]->pause, closest_v_ts); + } + } + } + + /* ---------------------------- */ + + success = true; + +fail: + for (size_t i = MAX_AUDIO_MIXES; i > 0; i--) { + if (aenc[i - 1]) { + pthread_mutex_unlock(&aenc[i - 1]->pause.mutex); + } + } + pthread_mutex_unlock(&venc->pause.mutex); + + return success; +} + +static bool obs_raw_output_pause(obs_output_t *output, bool pause) +{ + bool success; + uint64_t closest_v_ts; + + pthread_mutex_lock(&output->pause.mutex); + closest_v_ts = get_closest_v_ts(&output->pause); + if (pause) { + success = pause_can_start(&output->pause); + if (success) + output->pause.ts_start = closest_v_ts; + } else { + success = pause_can_stop(&output->pause); + if (success) + end_pause(&output->pause, closest_v_ts); + } + pthread_mutex_unlock(&output->pause.mutex); + + return success; } -void obs_output_pause(obs_output_t *output) +bool obs_output_pause(obs_output_t *output, bool pause) { + bool success; + if (!obs_output_valid(output, "obs_output_pause")) - return; + return false; + if ((output->info.flags & OBS_OUTPUT_CAN_PAUSE) == 0) + return false; + if (!os_atomic_load_bool(&output->active)) + return false; + if (os_atomic_load_bool(&output->paused) == pause) + return true; + + success = ((output->info.flags & OBS_OUTPUT_ENCODED) != 0) + ? obs_encoded_output_pause(output, pause) + : obs_raw_output_pause(output, pause); + if (success) { + os_atomic_set_bool(&output->paused, pause); + do_output_signal(output, pause ? "pause" : "unpause"); + + blog(LOG_INFO, "output %s %spaused", output->context.name, + pause ? "" : "un"); + } + return success; +} + +bool obs_output_paused(const obs_output_t *output) +{ + return obs_output_valid(output, "obs_output_paused") + ? os_atomic_load_bool(&output->paused) + : false; +} + +uint64_t obs_output_get_pause_offset(obs_output_t *output) +{ + uint64_t offset; + + if (!obs_output_valid(output, "obs_output_get_pause_offset")) + return 0; - if (output->info.pause) - output->info.pause(output->context.data); + pthread_mutex_lock(&output->pause.mutex); + offset = output->pause.ts_offset; + pthread_mutex_unlock(&output->pause.mutex); + + return offset; } signal_handler_t *obs_output_get_signal_handler(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_get_signal_handler") ? - output->context.signals : NULL; + return obs_output_valid(output, "obs_output_get_signal_handler") + ? output->context.signals + : NULL; } proc_handler_t *obs_output_get_proc_handler(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_get_proc_handler") ? - output->context.procs : NULL; + return obs_output_valid(output, "obs_output_get_proc_handler") + ? output->context.procs + : NULL; } void obs_output_set_media(obs_output_t *output, video_t *video, audio_t *audio) @@ -538,14 +728,14 @@ video_t *obs_output_video(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_video") ? - output->video : NULL; + return obs_output_valid(output, "obs_output_video") ? output->video + : NULL; } audio_t *obs_output_audio(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_audio") ? - output->audio : NULL; + return obs_output_valid(output, "obs_output_audio") ? output->audio + : NULL; } static inline size_t get_first_mixer(const obs_output_t *output) @@ -586,12 +776,13 @@ size_t obs_output_get_mixers(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_get_mixers") ? - output->mixer_mask : 0; + return obs_output_valid(output, "obs_output_get_mixers") + ? output->mixer_mask + : 0; } void obs_output_remove_encoder(struct obs_output *output, - struct obs_encoder *encoder) + struct obs_encoder *encoder) { if (!obs_output_valid(output, "obs_output_remove_encoder")) return; @@ -612,11 +803,12 @@ return; if (encoder && encoder->info.type != OBS_ENCODER_VIDEO) { blog(LOG_WARNING, "obs_output_set_video_encoder: " - "encoder passed is not a video encoder"); + "encoder passed is not a video encoder"); return; } - if (output->video_encoder == encoder) return; + if (output->video_encoder == encoder) + return; obs_encoder_remove_output(output->video_encoder, output); obs_encoder_add_output(encoder, output); @@ -625,17 +817,18 @@ /* set the preferred resolution on the encoder */ if (output->scaled_width && output->scaled_height) obs_encoder_set_scaled_size(output->video_encoder, - output->scaled_width, output->scaled_height); + output->scaled_width, + output->scaled_height); } void obs_output_set_audio_encoder(obs_output_t *output, obs_encoder_t *encoder, - size_t idx) + size_t idx) { if (!obs_output_valid(output, "obs_output_set_audio_encoder")) return; if (encoder && encoder->info.type != OBS_ENCODER_AUDIO) { blog(LOG_WARNING, "obs_output_set_audio_encoder: " - "encoder passed is not an audio encoder"); + "encoder passed is not an audio encoder"); return; } @@ -649,7 +842,8 @@ } } - if (output->audio_encoders[idx] == encoder) return; + if (output->audio_encoders[idx] == encoder) + return; obs_encoder_remove_output(output->audio_encoders[idx], output); obs_encoder_add_output(encoder, output); @@ -658,12 +852,13 @@ obs_encoder_t *obs_output_get_video_encoder(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_get_video_encoder") ? - output->video_encoder : NULL; + return obs_output_valid(output, "obs_output_get_video_encoder") + ? output->video_encoder + : NULL; } obs_encoder_t *obs_output_get_audio_encoder(const obs_output_t *output, - size_t idx) + size_t idx) { if (!obs_output_valid(output, "obs_output_get_audio_encoder")) return NULL; @@ -697,12 +892,13 @@ obs_service_t *obs_output_get_service(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_get_service") ? - output->service : NULL; + return obs_output_valid(output, "obs_output_get_service") + ? output->service + : NULL; } -void obs_output_set_reconnect_settings(obs_output_t *output, - int retry_count, int retry_sec) +void obs_output_set_reconnect_settings(obs_output_t *output, int retry_count, + int retry_sec) { if (!obs_output_valid(output, "obs_output_set_reconnect_settings")) return; @@ -736,12 +932,13 @@ int obs_output_get_total_frames(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_get_total_frames") ? - output->total_frames : 0; + return obs_output_valid(output, "obs_output_get_total_frames") + ? output->total_frames + : 0; } void obs_output_set_preferred_size(obs_output_t *output, uint32_t width, - uint32_t height) + uint32_t height) { if (!obs_output_valid(output, "obs_output_set_preferred_size")) return; @@ -749,19 +946,20 @@ return; if (active(output)) { - blog(LOG_WARNING, "output '%s': Cannot set the preferred " - "resolution while the output is active", - obs_output_get_name(output)); + blog(LOG_WARNING, + "output '%s': Cannot set the preferred " + "resolution while the output is active", + obs_output_get_name(output)); return; } - output->scaled_width = width; + output->scaled_width = width; output->scaled_height = height; if (output->info.flags & OBS_OUTPUT_ENCODED) { if (output->video_encoder) obs_encoder_set_scaled_size(output->video_encoder, - width, height); + width, height); } } @@ -775,9 +973,9 @@ if (output->info.flags & OBS_OUTPUT_ENCODED) return obs_encoder_get_width(output->video_encoder); else - return output->scaled_width != 0 ? - output->scaled_width : - video_output_get_width(output->video); + return output->scaled_width != 0 + ? output->scaled_width + : video_output_get_width(output->video); } uint32_t obs_output_get_height(const obs_output_t *output) @@ -790,13 +988,13 @@ if (output->info.flags & OBS_OUTPUT_ENCODED) return obs_encoder_get_height(output->video_encoder); else - return output->scaled_height != 0 ? - output->scaled_height : - video_output_get_height(output->video); + return output->scaled_height != 0 + ? output->scaled_height + : video_output_get_height(output->video); } void obs_output_set_video_conversion(obs_output_t *output, - const struct video_scale_info *conversion) + const struct video_scale_info *conversion) { if (!obs_output_valid(output, "obs_output_set_video_conversion")) return; @@ -807,8 +1005,8 @@ output->video_conversion_set = true; } -void obs_output_set_audio_conversion(obs_output_t *output, - const struct audio_convert_info *conversion) +void obs_output_set_audio_conversion( + obs_output_t *output, const struct audio_convert_info *conversion) { if (!obs_output_valid(output, "obs_output_set_audio_conversion")) return; @@ -875,7 +1073,8 @@ } static bool can_begin_data_capture(const struct obs_output *output, - bool encoded, bool has_video, bool has_audio, bool has_service) + bool encoded, bool has_video, bool has_audio, + bool has_service) { if (has_video) { if (encoded) { @@ -901,16 +1100,16 @@ static inline bool has_scaling(const struct obs_output *output) { - uint32_t video_width = video_output_get_width(output->video); + uint32_t video_width = video_output_get_width(output->video); uint32_t video_height = video_output_get_height(output->video); return output->scaled_width && output->scaled_height && - (video_width != output->scaled_width || - video_height != output->scaled_height); + (video_width != output->scaled_width || + video_height != output->scaled_height); } -static inline struct video_scale_info *get_video_conversion( - struct obs_output *output) +static inline struct video_scale_info * +get_video_conversion(struct obs_output *output) { if (output->video_conversion_set) { if (!output->video_conversion.width) @@ -927,25 +1126,25 @@ const struct video_output_info *info = video_output_get_info(output->video); - output->video_conversion.format = info->format; + output->video_conversion.format = info->format; output->video_conversion.colorspace = VIDEO_CS_DEFAULT; - output->video_conversion.range = VIDEO_RANGE_DEFAULT; - output->video_conversion.width = output->scaled_width; - output->video_conversion.height = output->scaled_height; + output->video_conversion.range = VIDEO_RANGE_DEFAULT; + output->video_conversion.width = output->scaled_width; + output->video_conversion.height = output->scaled_height; return &output->video_conversion; } return NULL; } -static inline struct audio_convert_info *get_audio_conversion( - struct obs_output *output) +static inline struct audio_convert_info * +get_audio_conversion(struct obs_output *output) { return output->audio_conversion_set ? &output->audio_conversion : NULL; } static size_t get_track_index(const struct obs_output *output, - struct encoder_packet *pkt) + struct encoder_packet *pkt) { for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) { struct obs_encoder *encoder = output->audio_encoders[i]; @@ -959,7 +1158,7 @@ } static inline void check_received(struct obs_output *output, - struct encoder_packet *out) + struct encoder_packet *out) { if (out->type == OBS_ENCODER_VIDEO) { if (!output->received_video) @@ -971,7 +1170,7 @@ } static inline void apply_interleaved_packet_offset(struct obs_output *output, - struct encoder_packet *out) + struct encoder_packet *out) { int64_t offset; @@ -979,8 +1178,9 @@ * may not currently be at 0 when we get data. so, we store the * current dts as offset and subtract that value from the dts/pts * of the output packet. */ - offset = (out->type == OBS_ENCODER_VIDEO) ? - output->video_offset : output->audio_offsets[out->track_idx]; + offset = (out->type == OBS_ENCODER_VIDEO) + ? output->video_offset + : output->audio_offsets[out->track_idx]; out->dts -= offset; out->pts -= offset; @@ -995,7 +1195,7 @@ } static inline bool has_higher_opposing_ts(struct obs_output *output, - struct encoder_packet *packet) + struct encoder_packet *packet) { if (packet->type == OBS_ENCODER_VIDEO) return output->highest_audio_ts > packet->dts_usec; @@ -1041,7 +1241,7 @@ obs_encoder_packet_release(out); *out = backup; - out->data = (uint8_t*)out_data.array + sizeof(ref); + out->data = (uint8_t *)out_data.array + sizeof(ref); out->size = out_data.num - sizeof(ref); sei_free(&sei); @@ -1071,14 +1271,13 @@ #if BUILD_CAPTIONS pthread_mutex_lock(&output->caption_mutex); - double frame_timestamp = (out.pts * out.timebase_num) / - (double)out.timebase_den; + double frame_timestamp = + (out.pts * out.timebase_num) / (double)out.timebase_den; if (output->caption_head && output->caption_timestamp <= frame_timestamp) { - blog(LOG_DEBUG,"Sending caption: %f \"%s\"", - frame_timestamp, - &output->caption_head->text[0]); + blog(LOG_DEBUG, "Sending caption: %f \"%s\"", + frame_timestamp, &output->caption_head->text[0]); double display_duration = output->caption_head->display_duration; @@ -1098,7 +1297,7 @@ } static inline void set_higher_ts(struct obs_output *output, - struct encoder_packet *packet) + struct encoder_packet *packet) { if (packet->type == OBS_ENCODER_VIDEO) { if (output->highest_video_ts < packet->dts_usec) @@ -1109,18 +1308,19 @@ } } -static inline struct encoder_packet *find_first_packet_type( - struct obs_output *output, enum obs_encoder_type type, - size_t audio_idx); +static inline struct encoder_packet * +find_first_packet_type(struct obs_output *output, enum obs_encoder_type type, + size_t audio_idx); static int find_first_packet_type_idx(struct obs_output *output, - enum obs_encoder_type type, size_t audio_idx); + enum obs_encoder_type type, + size_t audio_idx); /* gets the point where audio and video are closest together */ static size_t get_interleaved_start_idx(struct obs_output *output) { int64_t closest_diff = 0x7FFFFFFFFFFFFFFFLL; - struct encoder_packet *first_video = find_first_packet_type(output, - OBS_ENCODER_VIDEO, 0); + struct encoder_packet *first_video = + find_first_packet_type(output, OBS_ENCODER_VIDEO, 0); size_t video_idx = DARRAY_INVALID; size_t idx = 0; @@ -1170,7 +1370,7 @@ int audio_idx; audio_idx = find_first_packet_type_idx(output, - OBS_ENCODER_AUDIO, i); + OBS_ENCODER_AUDIO, i); if (audio_idx == -1) { output->received_audio = false; return -1; @@ -1212,10 +1412,9 @@ struct encoder_packet *packet = &output->interleaved_packets.array[i]; blog(LOG_DEBUG, "packet: %s %d, ts: %lld, pruned = %s", - packet->type == OBS_ENCODER_AUDIO ? - "audio" : "video", (int)packet->track_idx, - packet->dts_usec, - (int)i < prune_start ? "true" : "false"); + packet->type == OBS_ENCODER_AUDIO ? "audio" : "video", + (int)packet->track_idx, packet->dts_usec, + (int)i < prune_start ? "true" : "false"); } #endif @@ -1234,7 +1433,8 @@ } static int find_first_packet_type_idx(struct obs_output *output, - enum obs_encoder_type type, size_t audio_idx) + enum obs_encoder_type type, + size_t audio_idx) { for (size_t i = 0; i < output->interleaved_packets.num; i++) { struct encoder_packet *packet = @@ -1254,7 +1454,8 @@ } static int find_last_packet_type_idx(struct obs_output *output, - enum obs_encoder_type type, size_t audio_idx) + enum obs_encoder_type type, + size_t audio_idx) { for (size_t i = output->interleaved_packets.num; i > 0; i--) { struct encoder_packet *packet = @@ -1273,25 +1474,26 @@ return -1; } -static inline struct encoder_packet *find_first_packet_type( - struct obs_output *output, enum obs_encoder_type type, - size_t audio_idx) +static inline struct encoder_packet * +find_first_packet_type(struct obs_output *output, enum obs_encoder_type type, + size_t audio_idx) { int idx = find_first_packet_type_idx(output, type, audio_idx); return (idx != -1) ? &output->interleaved_packets.array[idx] : NULL; } -static inline struct encoder_packet *find_last_packet_type( - struct obs_output *output, enum obs_encoder_type type, - size_t audio_idx) +static inline struct encoder_packet * +find_last_packet_type(struct obs_output *output, enum obs_encoder_type type, + size_t audio_idx) { int idx = find_last_packet_type_idx(output, type, audio_idx); return (idx != -1) ? &output->interleaved_packets.array[idx] : NULL; } static bool get_audio_and_video_packets(struct obs_output *output, - struct encoder_packet **video, - struct encoder_packet **audio, size_t audio_mixes) + struct encoder_packet **video, + struct encoder_packet **audio, + size_t audio_mixes) { *video = find_first_packet_type(output, OBS_ENCODER_VIDEO, 0); if (!*video) @@ -1324,8 +1526,8 @@ return false; for (size_t i = 0; i < audio_mixes; i++) - last_audio[i] = find_last_packet_type(output, OBS_ENCODER_AUDIO, - i); + last_audio[i] = + find_last_packet_type(output, OBS_ENCODER_AUDIO, i); /* ensure that there is audio past the first video packet */ for (size_t i = 0; i < audio_mixes; i++) { @@ -1340,7 +1542,7 @@ if (start_idx) { discard_to_idx(output, start_idx); if (!get_audio_and_video_packets(output, &video, audio, - audio_mixes)) + audio_mixes)) return false; } @@ -1354,9 +1556,10 @@ int64_t a = audio[0]->dts_usec; int64_t diff = v - a; - blog(LOG_DEBUG, "output '%s' offset for video: %lld, audio: %lld, " - "diff: %lldms", output->context.name, v, a, - diff / 1000LL); + blog(LOG_DEBUG, + "output '%s' offset for video: %lld, audio: %lld, " + "diff: %lldms", + output->context.name, v, a, diff / 1000LL); #endif /* subtract offsets from highest TS offset variables */ @@ -1374,7 +1577,7 @@ } static inline void insert_interleaved_packet(struct obs_output *output, - struct encoder_packet *out) + struct encoder_packet *out) { size_t idx; for (idx = 0; idx < output->interleaved_packets.num; idx++) { @@ -1398,7 +1601,7 @@ old_array.da = output->interleaved_packets.da; memset(&output->interleaved_packets, 0, - sizeof(output->interleaved_packets)); + sizeof(output->interleaved_packets)); for (size_t i = 0; i < old_array.num; i++) insert_interleaved_packet(output, &old_array.array[i]); @@ -1407,7 +1610,7 @@ } static void discard_unused_audio_packets(struct obs_output *output, - int64_t dts_usec) + int64_t dts_usec) { size_t idx = 0; @@ -1425,9 +1628,9 @@ static void interleave_packets(void *data, struct encoder_packet *packet) { - struct obs_output *output = data; + struct obs_output *output = data; struct encoder_packet out; - bool was_started; + bool was_started; if (!active(output)) return; @@ -1438,8 +1641,7 @@ pthread_mutex_lock(&output->interleaved_mutex); /* if first video frame is not a keyframe, discard until received */ - if (!output->received_video && - packet->type == OBS_ENCODER_VIDEO && + if (!output->received_video && packet->type == OBS_ENCODER_VIDEO && !packet->keyframe) { discard_unused_audio_packets(output, packet->dts_usec); pthread_mutex_unlock(&output->interleaved_mutex); @@ -1503,33 +1705,117 @@ static void default_raw_video_callback(void *param, struct video_data *frame) { struct obs_output *output = param; + + if (video_pause_check(&output->pause, frame->timestamp)) + return; + if (data_active(output)) output->info.raw_video(output->context.data, frame); output->total_frames++; } +static bool prepare_audio(struct obs_output *output, + const struct audio_data *old, struct audio_data *new) +{ + if (!output->video_start_ts) { + pthread_mutex_lock(&output->pause.mutex); + output->video_start_ts = output->pause.last_video_ts; + pthread_mutex_unlock(&output->pause.mutex); + } + + if (!output->video_start_ts) + return false; + + /* ------------------ */ + + *new = *old; + + if (old->timestamp < output->video_start_ts) { + uint64_t duration = (uint64_t)old->frames * 1000000000 / + (uint64_t)output->sample_rate; + uint64_t end_ts = (old->timestamp + duration); + uint64_t cutoff; + + if (end_ts <= output->video_start_ts) + return false; + + cutoff = output->video_start_ts - old->timestamp; + new->timestamp += cutoff; + + cutoff = cutoff * (uint64_t)output->sample_rate / 1000000000; + + for (size_t i = 0; i < output->planes; i++) + new->data[i] += output->audio_size *(uint32_t)cutoff; + new->frames -= (uint32_t)cutoff; + } + + return true; +} static void default_raw_audio_callback(void *param, size_t mix_idx, - struct audio_data *frames) + struct audio_data *in) { struct obs_output *output = param; + struct audio_data out; + size_t frame_size_bytes; + if (!data_active(output)) return; - if (output->info.raw_audio2) - output->info.raw_audio2(output->context.data, mix_idx, frames); - else - output->info.raw_audio(output->context.data, frames); + /* -------------- */ + + if (!prepare_audio(output, in, &out)) + return; + if (audio_pause_check(&output->pause, &out, output->sample_rate)) + return; + if (!output->audio_start_ts) { + output->audio_start_ts = out.timestamp; + } + + frame_size_bytes = AUDIO_OUTPUT_FRAMES * output->audio_size; + + for (size_t i = 0; i < output->planes; i++) + circlebuf_push_back(&output->audio_buffer[mix_idx][i], + out.data[i], + out.frames * output->audio_size); + + /* -------------- */ + + while (output->audio_buffer[mix_idx][0].size > frame_size_bytes) { + for (size_t i = 0; i < output->planes; i++) { + circlebuf_pop_front(&output->audio_buffer[mix_idx][i], + output->audio_data[i], + frame_size_bytes); + out.data[i] = (uint8_t *)output->audio_data[i]; + } + + out.frames = AUDIO_OUTPUT_FRAMES; + out.timestamp = output->audio_start_ts + + audio_frames_to_ns(output->sample_rate, + output->total_audio_frames); + + pthread_mutex_lock(&output->pause.mutex); + out.timestamp += output->pause.ts_offset; + pthread_mutex_unlock(&output->pause.mutex); + + output->total_audio_frames += AUDIO_OUTPUT_FRAMES; + + if (output->info.raw_audio2) + output->info.raw_audio2(output->context.data, mix_idx, + &out); + else + output->info.raw_audio(output->context.data, &out); + } } static inline void start_audio_encoders(struct obs_output *output, - encoded_callback_t encoded_callback) + encoded_callback_t encoded_callback) { size_t num_mixes = num_audio_mixes(output); for (size_t i = 0; i < num_mixes; i++) { - obs_encoder_start(output->audio_encoders[i], - encoded_callback, output); + obs_encoder_start(output->audio_encoders[i], encoded_callback, + output); } } @@ -1538,27 +1824,26 @@ if (output->info.raw_audio2) { for (int idx = 0; idx < MAX_AUDIO_MIXES; idx++) { if ((output->mixer_mask & ((size_t)1 << idx)) != 0) { - audio_output_connect(output->audio, idx, - get_audio_conversion(output), - default_raw_audio_callback, - output); + audio_output_connect( + output->audio, idx, + get_audio_conversion(output), + default_raw_audio_callback, output); } } } else { audio_output_connect(output->audio, get_first_mixer(output), get_audio_conversion(output), - default_raw_audio_callback, - output); + default_raw_audio_callback, output); } } static void reset_packet_data(obs_output_t *output) { - output->received_audio = false; - output->received_video = false; + output->received_audio = false; + output->received_video = false; output->highest_audio_ts = 0; output->highest_video_ts = 0; - output->video_offset = 0; + output->video_offset = 0; for (size_t i = 0; i < MAX_AUDIO_MIXES; i++) output->audio_offsets[i] = 0; @@ -1572,7 +1857,7 @@ } static void hook_data_capture(struct obs_output *output, bool encoded, - bool has_video, bool has_audio) + bool has_video, bool has_audio) { encoded_callback_t encoded_callback; @@ -1581,8 +1866,9 @@ reset_packet_data(output); pthread_mutex_unlock(&output->interleaved_mutex); - encoded_callback = (has_video && has_audio) ? - interleave_packets : default_encoded_callback; + encoded_callback = (has_video && has_audio) + ? interleave_packets + : default_encoded_callback; if (output->delay_sec) { output->active_delay_ns = @@ -1592,18 +1878,18 @@ encoded_callback = process_delay; os_atomic_set_bool(&output->delay_active, true); - blog(LOG_INFO, "Output '%s': %"PRIu32" second delay " - "active, preserve on disconnect is %s", - output->context.name, - output->delay_sec, - preserve_active(output) ? "on" : "off"); + blog(LOG_INFO, + "Output '%s': %" PRIu32 " second delay " + "active, preserve on disconnect is %s", + output->context.name, output->delay_sec, + preserve_active(output) ? "on" : "off"); } if (has_audio) start_audio_encoders(output, encoded_callback); if (has_video) obs_encoder_start(output->video_encoder, - encoded_callback, output); + encoded_callback, output); } else { if (has_video) start_raw_video(output->video, @@ -1626,7 +1912,7 @@ calldata_init_fixed(¶ms, stack, sizeof(stack)); calldata_set_int(¶ms, "timeout_sec", - output->reconnect_retry_cur_sec); + output->reconnect_retry_cur_sec); calldata_set_ptr(¶ms, "output", output); signal_handler_signal(output->context.signals, "reconnect", ¶ms); } @@ -1651,8 +1937,8 @@ } static inline void convert_flags(const struct obs_output *output, - uint32_t flags, bool *encoded, bool *has_video, bool *has_audio, - bool *has_service) + uint32_t flags, bool *encoded, bool *has_video, + bool *has_audio, bool *has_service) { *encoded = (output->info.flags & OBS_OUTPUT_ENCODED) != 0; if (!flags) @@ -1660,34 +1946,36 @@ else flags &= output->info.flags; - *has_video = (flags & OBS_OUTPUT_VIDEO) != 0; - *has_audio = (flags & OBS_OUTPUT_AUDIO) != 0; + *has_video = (flags & OBS_OUTPUT_VIDEO) != 0; + *has_audio = (flags & OBS_OUTPUT_AUDIO) != 0; *has_service = (flags & OBS_OUTPUT_SERVICE) != 0; } bool obs_output_can_begin_data_capture(const obs_output_t *output, - uint32_t flags) + uint32_t flags) { bool encoded, has_video, has_audio, has_service; if (!obs_output_valid(output, "obs_output_can_begin_data_capture")) return false; - if (delay_active(output)) return true; - if (active(output)) return false; + if (delay_active(output)) + return true; + if (active(output)) + return false; if (data_capture_ending(output)) pthread_join(output->end_data_capture_thread, NULL); convert_flags(output, flags, &encoded, &has_video, &has_audio, - &has_service); + &has_service); return can_begin_data_capture(output, encoded, has_video, has_audio, - has_service); + has_service); } static inline bool initialize_audio_encoders(obs_output_t *output, - size_t num_mixes) + size_t num_mixes) { for (size_t i = 0; i < num_mixes; i++) { if (!obs_encoder_initialize(output->audio_encoders[i])) { @@ -1699,7 +1987,7 @@ } static inline obs_encoder_t *find_inactive_audio_encoder(obs_output_t *output, - size_t num_mixes) + size_t num_mixes) { for (size_t i = 0; i < num_mixes; i++) { struct obs_encoder *audio = output->audio_encoders[i]; @@ -1714,17 +2002,15 @@ static inline void pair_encoders(obs_output_t *output, size_t num_mixes) { struct obs_encoder *video = output->video_encoder; - struct obs_encoder *audio = find_inactive_audio_encoder(output, - num_mixes); + struct obs_encoder *audio = + find_inactive_audio_encoder(output, num_mixes); if (video && audio) { pthread_mutex_lock(&audio->init_mutex); pthread_mutex_lock(&video->init_mutex); - if (!audio->active && - !video->active && - !video->paired_encoder && - !audio->paired_encoder) { + if (!audio->active && !video->active && + !video->paired_encoder && !audio->paired_encoder) { audio->wait_for_video = true; audio->paired_encoder = video; @@ -1744,10 +2030,11 @@ if (!obs_output_valid(output, "obs_output_initialize_encoders")) return false; - if (active(output)) return delay_active(output); + if (active(output)) + return delay_active(output); convert_flags(output, flags, &encoded, &has_video, &has_audio, - &has_service); + &has_service); if (!encoded) return false; @@ -1779,6 +2066,42 @@ return true; } +static void reset_raw_output(obs_output_t *output) +{ + clear_audio_buffers(output); + + if (output->audio) { + const struct audio_output_info *aoi = + audio_output_get_info(output->audio); + struct audio_convert_info conv = output->audio_conversion; + struct audio_convert_info info = { + aoi->samples_per_sec, + aoi->format, + aoi->speakers, + }; + + if (output->audio_conversion_set) { + if (conv.samples_per_sec) + info.samples_per_sec = conv.samples_per_sec; + if (conv.format != AUDIO_FORMAT_UNKNOWN) + info.format = conv.format; + if (conv.speakers != SPEAKERS_UNKNOWN) + info.speakers = conv.speakers; + } + + output->sample_rate = info.samples_per_sec; + output->planes = get_audio_planes(info.format, info.speakers); + output->total_audio_frames = 0; + output->audio_size = + get_audio_size(info.format, info.speakers, 1); + } + + output->audio_start_ts = 0; + output->video_start_ts = 0; + + pause_reset(&output->pause); +} + bool obs_output_begin_data_capture(obs_output_t *output, uint32_t flags) { bool encoded, has_video, has_audio, has_service; @@ -1787,16 +2110,22 @@ if (!obs_output_valid(output, "obs_output_begin_data_capture")) return false; - if (delay_active(output)) return begin_delayed_capture(output); - if (active(output)) return false; + if (delay_active(output)) + return begin_delayed_capture(output); + if (active(output)) + return false; + + output->total_frames = 0; - output->total_frames = 0; + if ((output->info.flags & OBS_OUTPUT_ENCODED) == 0) { + reset_raw_output(output); + } convert_flags(output, flags, &encoded, &has_video, &has_audio, - &has_service); + &has_service); if (!can_begin_data_capture(output, encoded, has_video, has_audio, - has_service)) + has_service)) return false; num_mixes = num_audio_mixes(output); @@ -1827,13 +2156,13 @@ } static inline void stop_audio_encoders(obs_output_t *output, - encoded_callback_t encoded_callback) + encoded_callback_t encoded_callback) { size_t num_mixes = num_audio_mixes(output); for (size_t i = 0; i < num_mixes; i++) { - obs_encoder_stop(output->audio_encoders[i], - encoded_callback, output); + obs_encoder_stop(output->audio_encoders[i], encoded_callback, + output); } } @@ -1842,17 +2171,14 @@ if (output->info.raw_audio2) { for (int idx = 0; idx < MAX_AUDIO_MIXES; idx++) { if ((output->mixer_mask & ((size_t)1 << idx)) != 0) { - audio_output_disconnect(output->audio, - idx, - default_raw_audio_callback, - output); + audio_output_disconnect( + output->audio, idx, + default_raw_audio_callback, output); } } } else { - audio_output_disconnect(output->audio, - get_first_mixer(output), - default_raw_audio_callback, - output); + audio_output_disconnect(output->audio, get_first_mixer(output), + default_raw_audio_callback, output); } } @@ -1863,24 +2189,25 @@ obs_output_t *output = data; convert_flags(output, 0, &encoded, &has_video, &has_audio, - &has_service); + &has_service); if (encoded) { if (output->active_delay_ns) encoded_callback = process_delay; else - encoded_callback = (has_video && has_audio) ? - interleave_packets : default_encoded_callback; + encoded_callback = (has_video && has_audio) + ? interleave_packets + : default_encoded_callback; if (has_video) obs_encoder_stop(output->video_encoder, - encoded_callback, output); + encoded_callback, output); if (has_audio) stop_audio_encoders(output, encoded_callback); } else { if (has_video) stop_raw_video(output->video, - default_raw_video_callback, output); + default_raw_video_callback, output); if (has_audio) stop_raw_audio(output); } @@ -1900,7 +2227,7 @@ } static void obs_output_end_data_capture_internal(obs_output_t *output, - bool signal) + bool signal) { int ret; @@ -1937,10 +2264,12 @@ os_atomic_set_bool(&output->end_data_capture_thread_active, true); ret = pthread_create(&output->end_data_capture_thread, NULL, - end_data_capture_thread, output); + end_data_capture_thread, output); if (ret != 0) { - blog(LOG_WARNING, "Failed to create end_data_capture_thread " - "for output '%s'!", output->context.name); + blog(LOG_WARNING, + "Failed to create end_data_capture_thread " + "for output '%s'!", + output->context.name); end_data_capture_thread(output); } @@ -2008,15 +2337,14 @@ output->reconnect_retries++; output->stop_code = OBS_OUTPUT_DISCONNECTED; - ret = pthread_create(&output->reconnect_thread, NULL, - &reconnect_thread, output); + ret = pthread_create(&output->reconnect_thread, NULL, &reconnect_thread, + output); if (ret < 0) { blog(LOG_WARNING, "Failed to create reconnect thread"); os_atomic_set_bool(&output->reconnecting, false); } else { blog(LOG_INFO, "Output '%s': Reconnecting in %d seconds..", - output->context.name, - output->reconnect_retry_sec); + output->context.name, output->reconnect_retry_sec); signal_reconnect(output); } @@ -2027,7 +2355,7 @@ bool reconnect_active = output->reconnect_retry_max != 0; return (reconnecting(output) && code != OBS_OUTPUT_SUCCESS) || - (reconnect_active && code == OBS_OUTPUT_DISCONNECTED); + (reconnect_active && code == OBS_OUTPUT_DISCONNECTED); } void obs_output_signal_stop(obs_output_t *output, int code) @@ -2119,7 +2447,7 @@ } bool obs_weak_output_references_output(obs_weak_output_t *weak, - obs_output_t *output) + obs_output_t *output) { return weak && output && weak->output == output; } @@ -2127,23 +2455,25 @@ void *obs_output_get_type_data(obs_output_t *output) { return obs_output_valid(output, "obs_output_get_type_data") - ? output->info.type_data : NULL; + ? output->info.type_data + : NULL; } const char *obs_output_get_id(const obs_output_t *output) { - return obs_output_valid(output, "obs_output_get_id") - ? output->info.id : NULL; + return obs_output_valid(output, "obs_output_get_id") ? output->info.id + : NULL; } #if BUILD_CAPTIONS static struct caption_text *caption_text_new(const char *text, size_t bytes, - struct caption_text *tail, struct caption_text **head, - double display_duration) + struct caption_text *tail, + struct caption_text **head, + double display_duration) { struct caption_text *next = bzalloc(sizeof(struct caption_text)); - snprintf(&next->text[0], CAPTION_LINE_BYTES + 1, "%.*s", - (int)bytes, text); + snprintf(&next->text[0], CAPTION_LINE_BYTES + 1, "%.*s", (int)bytes, + text); next->display_duration = display_duration; if (!*head) { @@ -2163,7 +2493,7 @@ } void obs_output_output_caption_text2(obs_output_t *output, const char *text, - double display_duration) + double display_duration) { if (!obs_output_valid(output, "obs_output_output_caption_text2")) return; @@ -2176,11 +2506,9 @@ pthread_mutex_lock(&output->caption_mutex); - output->caption_tail = caption_text_new( - text, size, - output->caption_tail, - &output->caption_head, - display_duration); + output->caption_tail = + caption_text_new(text, size, output->caption_tail, + &output->caption_head, display_duration); pthread_mutex_unlock(&output->caption_mutex); } @@ -2193,8 +2521,10 @@ if (output->info.get_congestion) { float val = output->info.get_congestion(output->context.data); - if (val < 0.0f) val = 0.0f; - else if (val > 1.0f) val = 1.0f; + if (val < 0.0f) + val = 0.0f; + else if (val > 1.0f) + val = 1.0f; return val; } return 0; @@ -2242,12 +2572,14 @@ const char *obs_output_get_supported_video_codecs(const obs_output_t *output) { - return obs_output_valid(output, __FUNCTION__) ? - output->info.encoded_video_codecs : NULL; + return obs_output_valid(output, __FUNCTION__) + ? output->info.encoded_video_codecs + : NULL; } const char *obs_output_get_supported_audio_codecs(const obs_output_t *output) { - return obs_output_valid(output, __FUNCTION__) ? - output->info.encoded_audio_codecs : NULL; + return obs_output_valid(output, __FUNCTION__) + ? output->info.encoded_audio_codecs + : NULL; }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-output.h -> obs-studio-24.0.0.tar.xz/libobs/obs-output.h
Changed
@@ -21,12 +21,13 @@ extern "C" { #endif -#define OBS_OUTPUT_VIDEO (1<<0) -#define OBS_OUTPUT_AUDIO (1<<1) -#define OBS_OUTPUT_AV (OBS_OUTPUT_VIDEO | OBS_OUTPUT_AUDIO) -#define OBS_OUTPUT_ENCODED (1<<2) -#define OBS_OUTPUT_SERVICE (1<<3) -#define OBS_OUTPUT_MULTI_TRACK (1<<4) +#define OBS_OUTPUT_VIDEO (1 << 0) +#define OBS_OUTPUT_AUDIO (1 << 1) +#define OBS_OUTPUT_AV (OBS_OUTPUT_VIDEO | OBS_OUTPUT_AUDIO) +#define OBS_OUTPUT_ENCODED (1 << 2) +#define OBS_OUTPUT_SERVICE (1 << 3) +#define OBS_OUTPUT_MULTI_TRACK (1 << 4) +#define OBS_OUTPUT_CAN_PAUSE (1 << 5) struct encoder_packet; @@ -56,7 +57,7 @@ obs_properties_t *(*get_properties)(void *data); - void (*pause)(void *data); + void (*unused1)(void *data); uint64_t (*get_total_bytes)(void *data); @@ -77,7 +78,7 @@ }; EXPORT void obs_register_output_s(const struct obs_output_info *info, - size_t size); + size_t size); #define obs_register_output(info) \ obs_register_output_s(info, sizeof(struct obs_output_info))
View file
obs-studio-23.2.1.tar.xz/libobs/obs-properties.c -> obs-studio-24.0.0.tar.xz/libobs/obs-properties.c
Changed
@@ -41,15 +41,15 @@ bool disabled; union { - char *str; + char *str; long long ll; - double d; + double d; }; }; struct path_data { - char *filter; - char *default_path; + char *filter; + char *default_path; enum obs_path_type type; }; @@ -59,14 +59,14 @@ struct list_data { DARRAY(struct list_item) items; - enum obs_combo_type type; - enum obs_combo_format format; + enum obs_combo_type type; + enum obs_combo_format format; }; struct editable_list_data { enum obs_editable_list_type type; - char *filter; - char *default_path; + char *filter; + char *default_path; }; struct button_data { @@ -85,7 +85,7 @@ struct frame_rate_data { DARRAY(struct frame_rate_option) extra_options; - DARRAY(struct frame_rate_range) ranges; + DARRAY(struct frame_rate_range) ranges; }; struct group_data { @@ -107,7 +107,7 @@ } static inline void list_item_free(struct list_data *data, - struct list_item *item) + struct list_item *item) { bfree(item->name); if (data->format == OBS_COMBO_FORMAT_STRING) @@ -117,7 +117,7 @@ static inline void list_data_free(struct list_data *data) { for (size_t i = 0; i < data->items.num; i++) - list_item_free(data, data->items.array+i); + list_item_free(data, data->items.array + i); da_free(data->items); } @@ -147,16 +147,19 @@ da_free(data->ranges); } -static inline void group_data_free(struct group_data *data) { +static inline void group_data_free(struct group_data *data) +{ obs_properties_destroy(data->content); } -static inline void int_data_free(struct int_data *data) { +static inline void int_data_free(struct int_data *data) +{ if (data->suffix) bfree(data->suffix); } -static inline void float_data_free(struct float_data *data) { +static inline void float_data_free(struct float_data *data) +{ if (data->suffix) bfree(data->suffix); } @@ -164,30 +167,30 @@ struct obs_properties; struct obs_property { - char *name; - char *desc; - char *long_desc; - void *priv; - enum obs_property_type type; - bool visible; - bool enabled; + char *name; + char *desc; + char *long_desc; + void *priv; + enum obs_property_type type; + bool visible; + bool enabled; - struct obs_properties *parent; + struct obs_properties *parent; obs_property_modified_t modified; obs_property_modified2_t modified2; - struct obs_property *next; + struct obs_property *next; }; struct obs_properties { - void *param; - void (*destroy)(void *param); - uint32_t flags; + void *param; + void (*destroy)(void *param); + uint32_t flags; - struct obs_property *first_property; - struct obs_property **last; - struct obs_property *parent; + struct obs_property *first_property; + struct obs_property **last; + struct obs_property *parent; }; obs_properties_t *obs_properties_create(void) @@ -198,8 +201,8 @@ return props; } -void obs_properties_set_param(obs_properties_t *props, - void *param, void (*destroy)(void *param)) +void obs_properties_set_param(obs_properties_t *props, void *param, + void (*destroy)(void *param)) { if (!props) return; @@ -207,7 +210,7 @@ if (props->param && props->destroy) props->destroy(props->param); - props->param = param; + props->param = param; props->destroy = destroy; } @@ -228,7 +231,7 @@ } obs_properties_t *obs_properties_create_param(void *param, - void (*destroy)(void *param)) + void (*destroy)(void *param)) { struct obs_properties *props = obs_properties_create(); obs_properties_set_param(props, param, destroy); @@ -333,32 +336,50 @@ break; } + if (cur->type == OBS_PROPERTY_GROUP) { + obs_properties_remove_by_name( + obs_property_group_content(cur), name); + } + prev = cur; cur = cur->next; } } -void obs_properties_apply_settings(obs_properties_t *props, obs_data_t *settings) +void obs_properties_apply_settings_internal(obs_properties_t *props, + obs_data_t *settings, + obs_properties_t *realprops) { struct obs_property *p; - if (!props) - return; - p = props->first_property; while (p) { + if (p->type == OBS_PROPERTY_GROUP) { + obs_properties_apply_settings_internal( + obs_property_group_content(p), settings, + realprops); + } if (p->modified) - p->modified(props, p, settings); + p->modified(realprops, p, settings); else if (p->modified2) - p->modified2(p->priv, props, p, settings); + p->modified2(p->priv, realprops, p, settings); p = p->next; } } +void obs_properties_apply_settings(obs_properties_t *props, + obs_data_t *settings) +{ + if (!props) + return; + + obs_properties_apply_settings_internal(props, settings, props); +} + /* ------------------------------------------------------------------------- */ static inline void propertes_add(struct obs_properties *props, - struct obs_property *p) + struct obs_property *p) { *props->last = p; props->last = &p->next; @@ -367,39 +388,51 @@ static inline size_t get_property_size(enum obs_property_type type) { switch (type) { - case OBS_PROPERTY_INVALID: return 0; - case OBS_PROPERTY_BOOL: return 0; - case OBS_PROPERTY_INT: return sizeof(struct int_data); - case OBS_PROPERTY_FLOAT: return sizeof(struct float_data); - case OBS_PROPERTY_TEXT: return sizeof(struct text_data); - case OBS_PROPERTY_PATH: return sizeof(struct path_data); - case OBS_PROPERTY_LIST: return sizeof(struct list_data); - case OBS_PROPERTY_COLOR: return 0; - case OBS_PROPERTY_BUTTON: return sizeof(struct button_data); - case OBS_PROPERTY_FONT: return 0; + case OBS_PROPERTY_INVALID: + return 0; + case OBS_PROPERTY_BOOL: + return 0; + case OBS_PROPERTY_INT: + return sizeof(struct int_data); + case OBS_PROPERTY_FLOAT: + return sizeof(struct float_data); + case OBS_PROPERTY_TEXT: + return sizeof(struct text_data); + case OBS_PROPERTY_PATH: + return sizeof(struct path_data); + case OBS_PROPERTY_LIST: + return sizeof(struct list_data); + case OBS_PROPERTY_COLOR: + return 0; + case OBS_PROPERTY_BUTTON: + return sizeof(struct button_data); + case OBS_PROPERTY_FONT: + return 0; case OBS_PROPERTY_EDITABLE_LIST: return sizeof(struct editable_list_data); - case OBS_PROPERTY_FRAME_RATE:return sizeof(struct frame_rate_data); - case OBS_PROPERTY_GROUP: return sizeof(struct group_data); + case OBS_PROPERTY_FRAME_RATE: + return sizeof(struct frame_rate_data); + case OBS_PROPERTY_GROUP: + return sizeof(struct group_data); } return 0; } static inline struct obs_property *new_prop(struct obs_properties *props, - const char *name, const char *desc, - enum obs_property_type type) + const char *name, const char *desc, + enum obs_property_type type) { size_t data_size = get_property_size(type); struct obs_property *p; p = bzalloc(sizeof(struct obs_property) + data_size); - p->parent = props; + p->parent = props; p->enabled = true; p->visible = true; - p->type = type; - p->name = bstrdup(name); - p->desc = bstrdup(desc); + p->type = type; + p->name = bstrdup(name); + p->desc = bstrdup(desc); propertes_add(props, p); return p; @@ -427,7 +460,8 @@ } if (p->type == OBS_PROPERTY_GROUP) { - if (contains_prop(obs_property_group_content(p), name)) { + if (contains_prop(obs_property_group_content(p), + name)) { return true; } } @@ -445,11 +479,11 @@ static inline void *get_property_data(struct obs_property *prop) { - return (uint8_t*)prop + sizeof(struct obs_property); + return (uint8_t *)prop + sizeof(struct obs_property); } static inline void *get_type_data(struct obs_property *prop, - enum obs_property_type type) + enum obs_property_type type) { if (!prop || prop->type != type) return NULL; @@ -458,74 +492,82 @@ } obs_property_t *obs_properties_add_bool(obs_properties_t *props, - const char *name, const char *desc) + const char *name, const char *desc) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; return new_prop(props, name, desc, OBS_PROPERTY_BOOL); } -static obs_property_t *add_int(obs_properties_t *props, - const char *name, const char *desc, int min, int max, int step, - enum obs_number_type type) +static obs_property_t *add_int(obs_properties_t *props, const char *name, + const char *desc, int min, int max, int step, + enum obs_number_type type) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; struct obs_property *p = new_prop(props, name, desc, OBS_PROPERTY_INT); struct int_data *data = get_property_data(p); - data->min = min; - data->max = max; + data->min = min; + data->max = max; data->step = step; data->type = type; return p; } -static obs_property_t *add_flt(obs_properties_t *props, - const char *name, const char *desc, - double min, double max, double step, - enum obs_number_type type) +static obs_property_t *add_flt(obs_properties_t *props, const char *name, + const char *desc, double min, double max, + double step, enum obs_number_type type) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; - struct obs_property *p = new_prop(props, name, desc, - OBS_PROPERTY_FLOAT); + struct obs_property *p = + new_prop(props, name, desc, OBS_PROPERTY_FLOAT); struct float_data *data = get_property_data(p); - data->min = min; - data->max = max; + data->min = min; + data->max = max; data->step = step; data->type = type; return p; } obs_property_t *obs_properties_add_int(obs_properties_t *props, - const char *name, const char *desc, int min, int max, int step) + const char *name, const char *desc, + int min, int max, int step) { return add_int(props, name, desc, min, max, step, OBS_NUMBER_SCROLLER); } obs_property_t *obs_properties_add_float(obs_properties_t *props, - const char *name, const char *desc, - double min, double max, double step) + const char *name, const char *desc, + double min, double max, double step) { return add_flt(props, name, desc, min, max, step, OBS_NUMBER_SCROLLER); } obs_property_t *obs_properties_add_int_slider(obs_properties_t *props, - const char *name, const char *desc, int min, int max, int step) + const char *name, + const char *desc, int min, + int max, int step) { return add_int(props, name, desc, min, max, step, OBS_NUMBER_SLIDER); } obs_property_t *obs_properties_add_float_slider(obs_properties_t *props, - const char *name, const char *desc, - double min, double max, double step) + const char *name, + const char *desc, double min, + double max, double step) { return add_flt(props, name, desc, min, max, step, OBS_NUMBER_SLIDER); } obs_property_t *obs_properties_add_text(obs_properties_t *props, - const char *name, const char *desc, enum obs_text_type type) + const char *name, const char *desc, + enum obs_text_type type) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; struct obs_property *p = new_prop(props, name, desc, OBS_PROPERTY_TEXT); struct text_data *data = get_property_data(p); @@ -534,14 +576,17 @@ } obs_property_t *obs_properties_add_path(obs_properties_t *props, - const char *name, const char *desc, enum obs_path_type type, - const char *filter, const char *default_path) + const char *name, const char *desc, + enum obs_path_type type, + const char *filter, + const char *default_path) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; struct obs_property *p = new_prop(props, name, desc, OBS_PROPERTY_PATH); struct path_data *data = get_property_data(p); - data->type = type; + data->type = type; data->default_path = bstrdup(default_path); if (data->type == OBS_PATH_FILE) @@ -551,55 +596,62 @@ } obs_property_t *obs_properties_add_list(obs_properties_t *props, - const char *name, const char *desc, - enum obs_combo_type type, - enum obs_combo_format format) + const char *name, const char *desc, + enum obs_combo_type type, + enum obs_combo_format format) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; - if (type == OBS_COMBO_TYPE_EDITABLE && + if (type == OBS_COMBO_TYPE_EDITABLE && format != OBS_COMBO_FORMAT_STRING) { - blog(LOG_WARNING, "List '%s', error: Editable combo boxes " - "must be of the 'string' type", name); + blog(LOG_WARNING, + "List '%s', error: Editable combo boxes " + "must be of the 'string' type", + name); return NULL; } struct obs_property *p = new_prop(props, name, desc, OBS_PROPERTY_LIST); struct list_data *data = get_property_data(p); data->format = format; - data->type = type; + data->type = type; return p; } obs_property_t *obs_properties_add_color(obs_properties_t *props, - const char *name, const char *desc) + const char *name, const char *desc) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; return new_prop(props, name, desc, OBS_PROPERTY_COLOR); } obs_property_t *obs_properties_add_button(obs_properties_t *props, - const char *name, const char *text, - obs_property_clicked_t callback) + const char *name, const char *text, + obs_property_clicked_t callback) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; - struct obs_property *p = new_prop(props, name, text, - OBS_PROPERTY_BUTTON); + struct obs_property *p = + new_prop(props, name, text, OBS_PROPERTY_BUTTON); struct button_data *data = get_property_data(p); data->callback = callback; return p; } obs_property_t *obs_properties_add_button2(obs_properties_t *props, - const char *name, const char *text, - obs_property_clicked_t callback, void *priv) + const char *name, const char *text, + obs_property_clicked_t callback, + void *priv) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; - struct obs_property *p = new_prop(props, name, text, - OBS_PROPERTY_BUTTON); + struct obs_property *p = + new_prop(props, name, text, OBS_PROPERTY_BUTTON); struct button_data *data = get_property_data(p); data->callback = callback; p->priv = priv; @@ -607,20 +659,23 @@ } obs_property_t *obs_properties_add_font(obs_properties_t *props, - const char *name, const char *desc) + const char *name, const char *desc) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; return new_prop(props, name, desc, OBS_PROPERTY_FONT); } -obs_property_t *obs_properties_add_editable_list(obs_properties_t *props, - const char *name, const char *desc, - enum obs_editable_list_type type, const char *filter, - const char *default_path) +obs_property_t * +obs_properties_add_editable_list(obs_properties_t *props, const char *name, + const char *desc, + enum obs_editable_list_type type, + const char *filter, const char *default_path) { - if (!props || has_prop(props, name)) return NULL; - struct obs_property *p = new_prop(props, name, desc, - OBS_PROPERTY_EDITABLE_LIST); + if (!props || has_prop(props, name)) + return NULL; + struct obs_property *p = + new_prop(props, name, desc, OBS_PROPERTY_EDITABLE_LIST); struct editable_list_data *data = get_property_data(p); data->type = type; @@ -630,12 +685,14 @@ } obs_property_t *obs_properties_add_frame_rate(obs_properties_t *props, - const char *name, const char *desc) + const char *name, + const char *desc) { - if (!props || has_prop(props, name)) return NULL; + if (!props || has_prop(props, name)) + return NULL; - struct obs_property *p = new_prop(props, name, desc, - OBS_PROPERTY_FRAME_RATE); + struct obs_property *p = + new_prop(props, name, desc, OBS_PROPERTY_FRAME_RATE); struct frame_rate_data *data = get_property_data(p); da_init(data->extra_options); @@ -644,7 +701,7 @@ } static bool check_property_group_recursion(obs_properties_t *parent, - obs_properties_t *group) + obs_properties_t *group) { /* Scan the group for the parent. */ obs_property_t *current_property = group->first_property; @@ -670,7 +727,7 @@ } static bool check_property_group_duplicates(obs_properties_t *parent, - obs_properties_t *group) + obs_properties_t *group) { obs_property_t *current_property = group->first_property; while (current_property) { @@ -685,18 +742,24 @@ } obs_property_t *obs_properties_add_group(obs_properties_t *props, - const char *name, const char *desc, enum obs_group_type type, - obs_properties_t *group) + const char *name, const char *desc, + enum obs_group_type type, + obs_properties_t *group) { - if (!props || has_prop(props, name)) return NULL; - if (!group) return NULL; + if (!props || has_prop(props, name)) + return NULL; + if (!group) + return NULL; /* Prevent recursion. */ - if (props == group) return NULL; - if (check_property_group_recursion(props, group)) return NULL; + if (props == group) + return NULL; + if (check_property_group_recursion(props, group)) + return NULL; /* Prevent duplicate properties */ - if (check_property_group_duplicates(props, group)) return NULL; + if (check_property_group_duplicates(props, group)) + return NULL; obs_property_t *p = new_prop(props, name, desc, OBS_PROPERTY_GROUP); group->parent = p; @@ -723,7 +786,7 @@ } static inline struct list_data *get_list_fmt_data(struct obs_property *p, - enum obs_combo_format format) + enum obs_combo_format format) { struct list_data *data = get_list_data(p); return (data && data->format == format) ? data : NULL; @@ -741,13 +804,15 @@ } void obs_property_set_modified_callback(obs_property_t *p, - obs_property_modified_t modified) + obs_property_modified_t modified) { - if (p) p->modified = modified; + if (p) + p->modified = modified; } void obs_property_set_modified_callback2(obs_property_t *p, - obs_property_modified2_t modified2, void *priv) + obs_property_modified2_t modified2, + void *priv) { if (p) { p->modified2 = modified2; @@ -773,14 +838,14 @@ { struct obs_context_data *context = obj; if (p) { - struct button_data *data = get_type_data(p, - OBS_PROPERTY_BUTTON); + struct button_data *data = + get_type_data(p, OBS_PROPERTY_BUTTON); if (data && data->callback) { obs_properties_t *top = get_topmost_parent(p->parent); if (p->priv) return data->callback(top, p, p->priv); return data->callback(top, p, - (context ? context->data : NULL)); + (context ? context->data : NULL)); } } @@ -789,21 +854,22 @@ void obs_property_set_visible(obs_property_t *p, bool visible) { - if (p) p->visible = visible; + if (p) + p->visible = visible; } void obs_property_set_enabled(obs_property_t *p, bool enabled) { - if (p) p->enabled = enabled; + if (p) + p->enabled = enabled; } void obs_property_set_description(obs_property_t *p, const char *description) { if (p) { bfree(p->desc); - p->desc = description && *description - ? bstrdup(description) - : NULL; + p->desc = description && *description ? bstrdup(description) + : NULL; } } @@ -811,9 +877,8 @@ { if (p) { bfree(p->long_desc); - p->long_desc = long_desc && *long_desc - ? bstrdup(long_desc) - : NULL; + p->long_desc = long_desc && *long_desc ? bstrdup(long_desc) + : NULL; } } @@ -943,8 +1008,7 @@ return data ? data->format : OBS_COMBO_FORMAT_INVALID; } -void obs_property_int_set_limits(obs_property_t *p, - int min, int max, int step) +void obs_property_int_set_limits(obs_property_t *p, int min, int max, int step) { struct int_data *data = get_type_data(p, OBS_PROPERTY_INT); if (!data) @@ -955,8 +1019,8 @@ data->step = step; } -void obs_property_float_set_limits(obs_property_t *p, - double min, double max, double step) +void obs_property_float_set_limits(obs_property_t *p, double min, double max, + double step) { struct float_data *data = get_type_data(p, OBS_PROPERTY_FLOAT); if (!data) @@ -995,15 +1059,15 @@ } static size_t add_item(struct list_data *data, const char *name, - const void *val) + const void *val) { - struct list_item item = { NULL }; - item.name = bstrdup(name); + struct list_item item = {NULL}; + item.name = bstrdup(name); if (data->format == OBS_COMBO_FORMAT_INT) - item.ll = *(const long long*)val; + item.ll = *(const long long *)val; else if (data->format == OBS_COMBO_FORMAT_FLOAT) - item.d = *(const double*)val; + item.d = *(const double *)val; else item.str = bstrdup(val); @@ -1011,23 +1075,23 @@ } static void insert_item(struct list_data *data, size_t idx, const char *name, - const void *val) + const void *val) { - struct list_item item = { NULL }; - item.name = bstrdup(name); + struct list_item item = {NULL}; + item.name = bstrdup(name); if (data->format == OBS_COMBO_FORMAT_INT) - item.ll = *(const long long*)val; + item.ll = *(const long long *)val; else if (data->format == OBS_COMBO_FORMAT_FLOAT) - item.d = *(const double*)val; + item.d = *(const double *)val; else item.str = bstrdup(val); da_insert(data->items, idx, &item); } -size_t obs_property_list_add_string(obs_property_t *p, - const char *name, const char *val) +size_t obs_property_list_add_string(obs_property_t *p, const char *name, + const char *val) { struct list_data *data = get_list_data(p); if (data && data->format == OBS_COMBO_FORMAT_STRING) @@ -1035,8 +1099,8 @@ return 0; } -size_t obs_property_list_add_int(obs_property_t *p, - const char *name, long long val) +size_t obs_property_list_add_int(obs_property_t *p, const char *name, + long long val) { struct list_data *data = get_list_data(p); if (data && data->format == OBS_COMBO_FORMAT_INT) @@ -1044,8 +1108,8 @@ return 0; } -size_t obs_property_list_add_float(obs_property_t *p, - const char *name, double val) +size_t obs_property_list_add_float(obs_property_t *p, const char *name, + double val) { struct list_data *data = get_list_data(p); if (data && data->format == OBS_COMBO_FORMAT_FLOAT) @@ -1054,7 +1118,7 @@ } void obs_property_list_insert_string(obs_property_t *p, size_t idx, - const char *name, const char *val) + const char *name, const char *val) { struct list_data *data = get_list_data(p); if (data && data->format == OBS_COMBO_FORMAT_STRING) @@ -1062,7 +1126,7 @@ } void obs_property_list_insert_int(obs_property_t *p, size_t idx, - const char *name, long long val) + const char *name, long long val) { struct list_data *data = get_list_data(p); if (data && data->format == OBS_COMBO_FORMAT_INT) @@ -1070,7 +1134,7 @@ } void obs_property_list_insert_float(obs_property_t *p, size_t idx, - const char *name, double val) + const char *name, double val) { struct list_data *data = get_list_data(p); if (data && data->format == OBS_COMBO_FORMAT_FLOAT) @@ -1081,7 +1145,7 @@ { struct list_data *data = get_list_data(p); if (data && idx < data->items.num) { - list_item_free(data, data->items.array+idx); + list_item_free(data, data->items.array + idx); da_erase(data->items, idx); } } @@ -1095,12 +1159,12 @@ bool obs_property_list_item_disabled(obs_property_t *p, size_t idx) { struct list_data *data = get_list_data(p); - return (data && idx < data->items.num) ? - data->items.array[idx].disabled : false; + return (data && idx < data->items.num) ? data->items.array[idx].disabled + : false; } void obs_property_list_item_disable(obs_property_t *p, size_t idx, - bool disabled) + bool disabled) { struct list_data *data = get_list_data(p); if (!data || idx >= data->items.num) @@ -1111,49 +1175,47 @@ const char *obs_property_list_item_name(obs_property_t *p, size_t idx) { struct list_data *data = get_list_data(p); - return (data && idx < data->items.num) ? - data->items.array[idx].name : NULL; + return (data && idx < data->items.num) ? data->items.array[idx].name + : NULL; } const char *obs_property_list_item_string(obs_property_t *p, size_t idx) { struct list_data *data = get_list_fmt_data(p, OBS_COMBO_FORMAT_STRING); - return (data && idx < data->items.num) ? - data->items.array[idx].str : NULL; + return (data && idx < data->items.num) ? data->items.array[idx].str + : NULL; } long long obs_property_list_item_int(obs_property_t *p, size_t idx) { struct list_data *data = get_list_fmt_data(p, OBS_COMBO_FORMAT_INT); - return (data && idx < data->items.num) ? - data->items.array[idx].ll : 0; + return (data && idx < data->items.num) ? data->items.array[idx].ll : 0; } double obs_property_list_item_float(obs_property_t *p, size_t idx) { struct list_data *data = get_list_fmt_data(p, OBS_COMBO_FORMAT_FLOAT); - return (data && idx < data->items.num) ? - data->items.array[idx].d : 0.0; + return (data && idx < data->items.num) ? data->items.array[idx].d : 0.0; } enum obs_editable_list_type obs_property_editable_list_type(obs_property_t *p) { - struct editable_list_data *data = get_type_data(p, - OBS_PROPERTY_EDITABLE_LIST); + struct editable_list_data *data = + get_type_data(p, OBS_PROPERTY_EDITABLE_LIST); return data ? data->type : OBS_EDITABLE_LIST_TYPE_STRINGS; } const char *obs_property_editable_list_filter(obs_property_t *p) { - struct editable_list_data *data = get_type_data(p, - OBS_PROPERTY_EDITABLE_LIST); + struct editable_list_data *data = + get_type_data(p, OBS_PROPERTY_EDITABLE_LIST); return data ? data->filter : NULL; } const char *obs_property_editable_list_default_path(obs_property_t *p) { - struct editable_list_data *data = get_type_data(p, - OBS_PROPERTY_EDITABLE_LIST); + struct editable_list_data *data = + get_type_data(p, OBS_PROPERTY_EDITABLE_LIST); return data ? data->default_path : NULL; } @@ -1164,7 +1226,8 @@ { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - if (!data) return; + if (!data) + return; frame_rate_data_options_free(data); frame_rate_data_ranges_free(data); @@ -1174,7 +1237,8 @@ { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - if (!data) return; + if (!data) + return; frame_rate_data_options_free(data); } @@ -1183,33 +1247,36 @@ { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - if (!data) return; + if (!data) + return; frame_rate_data_ranges_free(data); } -size_t obs_property_frame_rate_option_add(obs_property_t *p, - const char *name, const char *description) +size_t obs_property_frame_rate_option_add(obs_property_t *p, const char *name, + const char *description) { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - if (!data) return DARRAY_INVALID; + if (!data) + return DARRAY_INVALID; struct frame_rate_option *opt = da_push_back_new(data->extra_options); - opt->name = bstrdup(name); + opt->name = bstrdup(name); opt->description = bstrdup(description); return data->extra_options.num - 1; } size_t obs_property_frame_rate_fps_range_add(obs_property_t *p, - struct media_frames_per_second min, - struct media_frames_per_second max) + struct media_frames_per_second min, + struct media_frames_per_second max) { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - if (!data) return DARRAY_INVALID; + if (!data) + return DARRAY_INVALID; struct frame_rate_range *rng = da_push_back_new(data->ranges); @@ -1220,25 +1287,28 @@ } void obs_property_frame_rate_option_insert(obs_property_t *p, size_t idx, - const char *name, const char *description) + const char *name, + const char *description) { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - if (!data) return; + if (!data) + return; struct frame_rate_option *opt = da_insert_new(data->extra_options, idx); - opt->name = bstrdup(name); + opt->name = bstrdup(name); opt->description = bstrdup(description); } -void obs_property_frame_rate_fps_range_insert(obs_property_t *p, size_t idx, - struct media_frames_per_second min, - struct media_frames_per_second max) +void obs_property_frame_rate_fps_range_insert( + obs_property_t *p, size_t idx, struct media_frames_per_second min, + struct media_frames_per_second max) { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - if (!data) return; + if (!data) + return; struct frame_rate_range *rng = da_insert_new(data->ranges, idx); @@ -1253,22 +1323,23 @@ return data ? data->extra_options.num : 0; } -const char *obs_property_frame_rate_option_name(obs_property_t *p, - size_t idx) +const char *obs_property_frame_rate_option_name(obs_property_t *p, size_t idx) { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - return data && data->extra_options.num > idx ? - data->extra_options.array[idx].name : NULL; + return data && data->extra_options.num > idx + ? data->extra_options.array[idx].name + : NULL; } -const char *obs_property_frame_rate_option_description( - obs_property_t *p, size_t idx) +const char *obs_property_frame_rate_option_description(obs_property_t *p, + size_t idx) { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - return data && data->extra_options.num > idx ? - data->extra_options.array[idx].description : NULL; + return data && data->extra_options.num > idx + ? data->extra_options.array[idx].description + : NULL; } size_t obs_property_frame_rate_fps_ranges_count(obs_property_t *p) @@ -1278,23 +1349,23 @@ return data ? data->ranges.num : 0; } -struct media_frames_per_second obs_property_frame_rate_fps_range_min( - obs_property_t *p, size_t idx) +struct media_frames_per_second +obs_property_frame_rate_fps_range_min(obs_property_t *p, size_t idx) { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - return data && data->ranges.num > idx ? - data->ranges.array[idx].min_time : - (struct media_frames_per_second){0}; + return data && data->ranges.num > idx + ? data->ranges.array[idx].min_time + : (struct media_frames_per_second){0}; } -struct media_frames_per_second obs_property_frame_rate_fps_range_max( - obs_property_t *p, size_t idx) +struct media_frames_per_second +obs_property_frame_rate_fps_range_max(obs_property_t *p, size_t idx) { struct frame_rate_data *data = get_type_data(p, OBS_PROPERTY_FRAME_RATE); - return data && data->ranges.num > idx ? - data->ranges.array[idx].max_time : - (struct media_frames_per_second){0}; + return data && data->ranges.num > idx + ? data->ranges.array[idx].max_time + : (struct media_frames_per_second){0}; } enum obs_text_type obs_proprety_text_type(obs_property_t *p)
View file
obs-studio-23.2.1.tar.xz/libobs/obs-properties.h -> obs-studio-24.0.0.tar.xz/libobs/obs-properties.h
Changed
@@ -40,7 +40,7 @@ #endif /** Only update when the user presses OK or Apply */ -#define OBS_PROPERTIES_DEFER_UPDATE (1<<0) +#define OBS_PROPERTIES_DEFER_UPDATE (1 << 0) enum obs_property_type { OBS_PROPERTY_INVALID, @@ -62,7 +62,7 @@ OBS_COMBO_FORMAT_INVALID, OBS_COMBO_FORMAT_INT, OBS_COMBO_FORMAT_FLOAT, - OBS_COMBO_FORMAT_STRING + OBS_COMBO_FORMAT_STRING, }; enum obs_combo_type { @@ -74,13 +74,13 @@ enum obs_editable_list_type { OBS_EDITABLE_LIST_TYPE_STRINGS, OBS_EDITABLE_LIST_TYPE_FILES, - OBS_EDITABLE_LIST_TYPE_FILES_AND_URLS + OBS_EDITABLE_LIST_TYPE_FILES_AND_URLS, }; enum obs_path_type { OBS_PATH_FILE, OBS_PATH_FILE_SAVE, - OBS_PATH_DIRECTORY + OBS_PATH_DIRECTORY, }; enum obs_text_type { @@ -91,7 +91,7 @@ enum obs_number_type { OBS_NUMBER_SCROLLER, - OBS_NUMBER_SLIDER + OBS_NUMBER_SLIDER, }; enum obs_group_type { @@ -100,34 +100,34 @@ OBS_GROUP_CHECKABLE, }; -#define OBS_FONT_BOLD (1<<0) -#define OBS_FONT_ITALIC (1<<1) -#define OBS_FONT_UNDERLINE (1<<2) -#define OBS_FONT_STRIKEOUT (1<<3) +#define OBS_FONT_BOLD (1 << 0) +#define OBS_FONT_ITALIC (1 << 1) +#define OBS_FONT_UNDERLINE (1 << 2) +#define OBS_FONT_STRIKEOUT (1 << 3) struct obs_properties; struct obs_property; typedef struct obs_properties obs_properties_t; -typedef struct obs_property obs_property_t; +typedef struct obs_property obs_property_t; /* ------------------------------------------------------------------------- */ EXPORT obs_properties_t *obs_properties_create(void); -EXPORT obs_properties_t *obs_properties_create_param(void *param, - void (*destroy)(void *param)); +EXPORT obs_properties_t * +obs_properties_create_param(void *param, void (*destroy)(void *param)); EXPORT void obs_properties_destroy(obs_properties_t *props); EXPORT void obs_properties_set_flags(obs_properties_t *props, uint32_t flags); EXPORT uint32_t obs_properties_get_flags(obs_properties_t *props); -EXPORT void obs_properties_set_param(obs_properties_t *props, - void *param, void (*destroy)(void *param)); +EXPORT void obs_properties_set_param(obs_properties_t *props, void *param, + void (*destroy)(void *param)); EXPORT void *obs_properties_get_param(obs_properties_t *props); EXPORT obs_property_t *obs_properties_first(obs_properties_t *props); EXPORT obs_property_t *obs_properties_get(obs_properties_t *props, - const char *property); + const char *property); EXPORT obs_properties_t *obs_properties_get_parent(obs_properties_t *props); @@ -142,14 +142,14 @@ * @param property Name of the property to remove. */ EXPORT void obs_properties_remove_by_name(obs_properties_t *props, - const char *property); + const char *property); /** * Applies settings to the properties by calling all the necessary * modification callbacks */ EXPORT void obs_properties_apply_settings(obs_properties_t *props, - obs_data_t *settings); + obs_data_t *settings); /* ------------------------------------------------------------------------- */ @@ -159,30 +159,39 @@ * otherwise return false. */ typedef bool (*obs_property_clicked_t)(obs_properties_t *props, - obs_property_t *property, void *data); + obs_property_t *property, void *data); EXPORT obs_property_t *obs_properties_add_bool(obs_properties_t *props, - const char *name, const char *description); + const char *name, + const char *description); EXPORT obs_property_t *obs_properties_add_int(obs_properties_t *props, - const char *name, const char *description, - int min, int max, int step); + const char *name, + const char *description, int min, + int max, int step); EXPORT obs_property_t *obs_properties_add_float(obs_properties_t *props, - const char *name, const char *description, - double min, double max, double step); + const char *name, + const char *description, + double min, double max, + double step); EXPORT obs_property_t *obs_properties_add_int_slider(obs_properties_t *props, - const char *name, const char *description, - int min, int max, int step); + const char *name, + const char *description, + int min, int max, + int step); EXPORT obs_property_t *obs_properties_add_float_slider(obs_properties_t *props, - const char *name, const char *description, - double min, double max, double step); + const char *name, + const char *description, + double min, double max, + double step); EXPORT obs_property_t *obs_properties_add_text(obs_properties_t *props, - const char *name, const char *description, - enum obs_text_type type); + const char *name, + const char *description, + enum obs_text_type type); /** * Adds a 'path' property. Can be a directory or a file. @@ -200,25 +209,29 @@ * double semi-colens. If multiple file types in a * filter, separate with space. */ -EXPORT obs_property_t *obs_properties_add_path(obs_properties_t *props, - const char *name, const char *description, - enum obs_path_type type, const char *filter, - const char *default_path); +EXPORT obs_property_t * +obs_properties_add_path(obs_properties_t *props, const char *name, + const char *description, enum obs_path_type type, + const char *filter, const char *default_path); EXPORT obs_property_t *obs_properties_add_list(obs_properties_t *props, - const char *name, const char *description, - enum obs_combo_type type, enum obs_combo_format format); + const char *name, + const char *description, + enum obs_combo_type type, + enum obs_combo_format format); EXPORT obs_property_t *obs_properties_add_color(obs_properties_t *props, - const char *name, const char *description); + const char *name, + const char *description); -EXPORT obs_property_t *obs_properties_add_button(obs_properties_t *props, - const char *name, const char *text, - obs_property_clicked_t callback); +EXPORT obs_property_t * +obs_properties_add_button(obs_properties_t *props, const char *name, + const char *text, obs_property_clicked_t callback); -EXPORT obs_property_t *obs_properties_add_button2(obs_properties_t *props, - const char *name, const char *text, - obs_property_clicked_t callback, void *priv); +EXPORT obs_property_t * +obs_properties_add_button2(obs_properties_t *props, const char *name, + const char *text, obs_property_clicked_t callback, + void *priv); /** * Adds a font selection property. @@ -230,20 +243,24 @@ * flags: font flags integer (OBS_FONT_* defined above) */ EXPORT obs_property_t *obs_properties_add_font(obs_properties_t *props, - const char *name, const char *description); + const char *name, + const char *description); -EXPORT obs_property_t *obs_properties_add_editable_list(obs_properties_t *props, - const char *name, const char *description, - enum obs_editable_list_type type, const char *filter, - const char *default_path); +EXPORT obs_property_t * +obs_properties_add_editable_list(obs_properties_t *props, const char *name, + const char *description, + enum obs_editable_list_type type, + const char *filter, const char *default_path); EXPORT obs_property_t *obs_properties_add_frame_rate(obs_properties_t *props, - const char *name, const char *description); + const char *name, + const char *description); EXPORT obs_property_t *obs_properties_add_group(obs_properties_t *props, - const char *name, const char *description, enum obs_group_type type, - obs_properties_t *group); - + const char *name, + const char *description, + enum obs_group_type type, + obs_properties_t *group); /* ------------------------------------------------------------------------- */ @@ -253,14 +270,17 @@ * otherwise return false. */ typedef bool (*obs_property_modified_t)(obs_properties_t *props, - obs_property_t *property, obs_data_t *settings); + obs_property_t *property, + obs_data_t *settings); typedef bool (*obs_property_modified2_t)(void *priv, obs_properties_t *props, - obs_property_t *property, obs_data_t *settings); + obs_property_t *property, + obs_data_t *settings); -EXPORT void obs_property_set_modified_callback(obs_property_t *p, - obs_property_modified_t modified); -EXPORT void obs_property_set_modified_callback2(obs_property_t *p, - obs_property_modified2_t modified, void *priv); +EXPORT void +obs_property_set_modified_callback(obs_property_t *p, + obs_property_modified_t modified); +EXPORT void obs_property_set_modified_callback2( + obs_property_t *p, obs_property_modified2_t modified, void *priv); EXPORT bool obs_property_modified(obs_property_t *p, obs_data_t *settings); EXPORT bool obs_property_button_clicked(obs_property_t *p, void *obj); @@ -269,72 +289,74 @@ EXPORT void obs_property_set_enabled(obs_property_t *p, bool enabled); EXPORT void obs_property_set_description(obs_property_t *p, - const char *description); + const char *description); EXPORT void obs_property_set_long_description(obs_property_t *p, - const char *long_description); + const char *long_description); -EXPORT const char * obs_property_name(obs_property_t *p); -EXPORT const char * obs_property_description(obs_property_t *p); -EXPORT const char * obs_property_long_description(obs_property_t *p); +EXPORT const char *obs_property_name(obs_property_t *p); +EXPORT const char *obs_property_description(obs_property_t *p); +EXPORT const char *obs_property_long_description(obs_property_t *p); EXPORT enum obs_property_type obs_property_get_type(obs_property_t *p); -EXPORT bool obs_property_enabled(obs_property_t *p); -EXPORT bool obs_property_visible(obs_property_t *p); - -EXPORT bool obs_property_next(obs_property_t **p); - -EXPORT int obs_property_int_min(obs_property_t *p); -EXPORT int obs_property_int_max(obs_property_t *p); -EXPORT int obs_property_int_step(obs_property_t *p); -EXPORT enum obs_number_type obs_property_int_type(obs_property_t *p); -EXPORT const char * obs_property_int_suffix(obs_property_t *p); -EXPORT double obs_property_float_min(obs_property_t *p); -EXPORT double obs_property_float_max(obs_property_t *p); -EXPORT double obs_property_float_step(obs_property_t *p); -EXPORT enum obs_number_type obs_property_float_type(obs_property_t *p); -EXPORT const char * obs_property_float_suffix(obs_property_t *p); -EXPORT enum obs_text_type obs_property_text_type(obs_property_t *p); -EXPORT enum obs_path_type obs_property_path_type(obs_property_t *p); -EXPORT const char * obs_property_path_filter(obs_property_t *p); -EXPORT const char * obs_property_path_default_path(obs_property_t *p); -EXPORT enum obs_combo_type obs_property_list_type(obs_property_t *p); -EXPORT enum obs_combo_format obs_property_list_format(obs_property_t *p); - -EXPORT void obs_property_int_set_limits(obs_property_t *p, - int min, int max, int step); -EXPORT void obs_property_float_set_limits(obs_property_t *p, - double min, double max, double step); +EXPORT bool obs_property_enabled(obs_property_t *p); +EXPORT bool obs_property_visible(obs_property_t *p); + +EXPORT bool obs_property_next(obs_property_t **p); + +EXPORT int obs_property_int_min(obs_property_t *p); +EXPORT int obs_property_int_max(obs_property_t *p); +EXPORT int obs_property_int_step(obs_property_t *p); +EXPORT enum obs_number_type obs_property_int_type(obs_property_t *p); +EXPORT const char *obs_property_int_suffix(obs_property_t *p); +EXPORT double obs_property_float_min(obs_property_t *p); +EXPORT double obs_property_float_max(obs_property_t *p); +EXPORT double obs_property_float_step(obs_property_t *p); +EXPORT enum obs_number_type obs_property_float_type(obs_property_t *p); +EXPORT const char *obs_property_float_suffix(obs_property_t *p); +EXPORT enum obs_text_type obs_property_text_type(obs_property_t *p); +EXPORT enum obs_path_type obs_property_path_type(obs_property_t *p); +EXPORT const char *obs_property_path_filter(obs_property_t *p); +EXPORT const char *obs_property_path_default_path(obs_property_t *p); +EXPORT enum obs_combo_type obs_property_list_type(obs_property_t *p); +EXPORT enum obs_combo_format obs_property_list_format(obs_property_t *p); + +EXPORT void obs_property_int_set_limits(obs_property_t *p, int min, int max, + int step); +EXPORT void obs_property_float_set_limits(obs_property_t *p, double min, + double max, double step); EXPORT void obs_property_int_set_suffix(obs_property_t *p, const char *suffix); -EXPORT void obs_property_float_set_suffix(obs_property_t *p, const char *suffix); +EXPORT void obs_property_float_set_suffix(obs_property_t *p, + const char *suffix); EXPORT void obs_property_list_clear(obs_property_t *p); -EXPORT size_t obs_property_list_add_string(obs_property_t *p, - const char *name, const char *val); -EXPORT size_t obs_property_list_add_int(obs_property_t *p, - const char *name, long long val); -EXPORT size_t obs_property_list_add_float(obs_property_t *p, - const char *name, double val); +EXPORT size_t obs_property_list_add_string(obs_property_t *p, const char *name, + const char *val); +EXPORT size_t obs_property_list_add_int(obs_property_t *p, const char *name, + long long val); +EXPORT size_t obs_property_list_add_float(obs_property_t *p, const char *name, + double val); EXPORT void obs_property_list_insert_string(obs_property_t *p, size_t idx, - const char *name, const char *val); + const char *name, const char *val); EXPORT void obs_property_list_insert_int(obs_property_t *p, size_t idx, - const char *name, long long val); + const char *name, long long val); EXPORT void obs_property_list_insert_float(obs_property_t *p, size_t idx, - const char *name, double val); + const char *name, double val); EXPORT void obs_property_list_item_disable(obs_property_t *p, size_t idx, - bool disabled); + bool disabled); EXPORT bool obs_property_list_item_disabled(obs_property_t *p, size_t idx); EXPORT void obs_property_list_item_remove(obs_property_t *p, size_t idx); -EXPORT size_t obs_property_list_item_count(obs_property_t *p); +EXPORT size_t obs_property_list_item_count(obs_property_t *p); EXPORT const char *obs_property_list_item_name(obs_property_t *p, size_t idx); EXPORT const char *obs_property_list_item_string(obs_property_t *p, size_t idx); -EXPORT long long obs_property_list_item_int(obs_property_t *p, size_t idx); -EXPORT double obs_property_list_item_float(obs_property_t *p, size_t idx); +EXPORT long long obs_property_list_item_int(obs_property_t *p, size_t idx); +EXPORT double obs_property_list_item_float(obs_property_t *p, size_t idx); -EXPORT enum obs_editable_list_type obs_property_editable_list_type(obs_property_t *p); +EXPORT enum obs_editable_list_type +obs_property_editable_list_type(obs_property_t *p); EXPORT const char *obs_property_editable_list_filter(obs_property_t *p); EXPORT const char *obs_property_editable_list_default_path(obs_property_t *p); @@ -343,36 +365,38 @@ EXPORT void obs_property_frame_rate_fps_ranges_clear(obs_property_t *p); EXPORT size_t obs_property_frame_rate_option_add(obs_property_t *p, - const char *name, const char *description); -EXPORT size_t obs_property_frame_rate_fps_range_add(obs_property_t *p, - struct media_frames_per_second min, - struct media_frames_per_second max); + const char *name, + const char *description); +EXPORT size_t obs_property_frame_rate_fps_range_add( + obs_property_t *p, struct media_frames_per_second min, + struct media_frames_per_second max); EXPORT void obs_property_frame_rate_option_insert(obs_property_t *p, size_t idx, - const char *name, const char *description); -EXPORT void obs_property_frame_rate_fps_range_insert(obs_property_t *p, - size_t idx, - struct media_frames_per_second min, - struct media_frames_per_second max); - -EXPORT size_t obs_property_frame_rate_options_count(obs_property_t *p); + const char *name, + const char *description); +EXPORT void +obs_property_frame_rate_fps_range_insert(obs_property_t *p, size_t idx, + struct media_frames_per_second min, + struct media_frames_per_second max); + +EXPORT size_t obs_property_frame_rate_options_count(obs_property_t *p); EXPORT const char *obs_property_frame_rate_option_name(obs_property_t *p, - size_t idx); -EXPORT const char *obs_property_frame_rate_option_description( - obs_property_t *p, size_t idx); + size_t idx); +EXPORT const char *obs_property_frame_rate_option_description(obs_property_t *p, + size_t idx); -EXPORT size_t obs_property_frame_rate_fps_ranges_count(obs_property_t *p); -EXPORT struct media_frames_per_second obs_property_frame_rate_fps_range_min( - obs_property_t *p, size_t idx); -EXPORT struct media_frames_per_second obs_property_frame_rate_fps_range_max( - obs_property_t *p, size_t idx); +EXPORT size_t obs_property_frame_rate_fps_ranges_count(obs_property_t *p); +EXPORT struct media_frames_per_second +obs_property_frame_rate_fps_range_min(obs_property_t *p, size_t idx); +EXPORT struct media_frames_per_second +obs_property_frame_rate_fps_range_max(obs_property_t *p, size_t idx); EXPORT enum obs_group_type obs_property_group_type(obs_property_t *p); EXPORT obs_properties_t *obs_property_group_content(obs_property_t *p); #ifndef SWIG DEPRECATED -EXPORT enum obs_text_type obs_proprety_text_type(obs_property_t *p); +EXPORT enum obs_text_type obs_proprety_text_type(obs_property_t *p); #endif #ifdef __cplusplus
View file
obs-studio-23.2.1.tar.xz/libobs/obs-scene.c -> obs-studio-24.0.0.tar.xz/libobs/obs-scene.c
Changed
@@ -25,15 +25,13 @@ static void resize_group(obs_sceneitem_t *group); static void resize_scene(obs_scene_t *scene); static void signal_parent(obs_scene_t *parent, const char *name, - calldata_t *params); -static void get_ungrouped_transform(obs_sceneitem_t *group, - struct vec2 *pos, - struct vec2 *scale, - float *rot); + calldata_t *params); +static void get_ungrouped_transform(obs_sceneitem_t *group, struct vec2 *pos, + struct vec2 *scale, float *rot); static inline bool crop_enabled(const struct obs_sceneitem_crop *crop); static inline bool item_texture_enabled(const struct obs_scene_item *item); static void init_hotkeys(obs_scene_t *scene, obs_sceneitem_t *item, - const char *name); + const char *name); /* NOTE: For proper mutex lock order (preventing mutual cross-locks), never * lock the graphics mutex inside either of the scene mutexes. @@ -54,7 +52,8 @@ "void item_select(ptr scene, ptr item)", "void item_deselect(ptr scene, ptr item)", "void item_transform(ptr scene, ptr item)", - NULL + "void item_locked(ptr scene, ptr item, bool locked)", + NULL, }; static inline void signal_item_remove(struct obs_scene_item *item) @@ -94,7 +93,7 @@ } signal_handler_add_array(obs_source_get_signal_handler(source), - obs_scene_signals); + obs_scene_signals); if (pthread_mutexattr_init(&attr) != 0) goto fail; @@ -151,7 +150,7 @@ static void remove_all_items(struct obs_scene *scene) { struct obs_scene_item *item; - DARRAY(struct obs_scene_item*) items; + DARRAY(struct obs_scene_item *) items; da_init(items); @@ -185,9 +184,8 @@ bfree(scene); } -static void scene_enum_sources(void *data, - obs_source_enum_proc_t enum_callback, - void *param, bool active) +static void scene_enum_sources(void *data, obs_source_enum_proc_t enum_callback, + void *param, bool active) { struct obs_scene *scene = data; struct obs_scene_item *item; @@ -211,15 +209,15 @@ } static void scene_enum_active_sources(void *data, - obs_source_enum_proc_t enum_callback, - void *param) + obs_source_enum_proc_t enum_callback, + void *param) { scene_enum_sources(data, enum_callback, param, true); } static void scene_enum_all_sources(void *data, - obs_source_enum_proc_t enum_callback, - void *param) + obs_source_enum_proc_t enum_callback, + void *param) { scene_enum_sources(data, enum_callback, param, false); } @@ -238,9 +236,10 @@ } static inline void attach_sceneitem(struct obs_scene *parent, - struct obs_scene_item *item, struct obs_scene_item *prev) + struct obs_scene_item *item, + struct obs_scene_item *prev) { - item->prev = prev; + item->prev = prev; item->parent = parent; if (prev) { @@ -270,15 +269,15 @@ } static void calculate_bounds_data(struct obs_scene_item *item, - struct vec2 *origin, struct vec2 *scale, - uint32_t *cx, uint32_t *cy) + struct vec2 *origin, struct vec2 *scale, + uint32_t *cx, uint32_t *cy) { - float width = (float)(*cx) * fabsf(scale->x); - float height = (float)(*cy) * fabsf(scale->y); - float item_aspect = width / height; - float bounds_aspect = item->bounds.x / item->bounds.y; - uint32_t bounds_type = item->bounds_type; - float width_diff, height_diff; + float width = (float)(*cx) * fabsf(scale->x); + float height = (float)(*cy) * fabsf(scale->y); + float item_aspect = width / height; + float bounds_aspect = item->bounds.x / item->bounds.y; + uint32_t bounds_type = item->bounds_type; + float width_diff, height_diff; if (item->bounds_type == OBS_BOUNDS_MAX_ONLY) if (width > item->bounds.x || height > item->bounds.y) @@ -286,15 +285,14 @@ if (bounds_type == OBS_BOUNDS_SCALE_INNER || bounds_type == OBS_BOUNDS_SCALE_OUTER) { - bool use_width = (bounds_aspect < item_aspect); + bool use_width = (bounds_aspect < item_aspect); float mul; if (item->bounds_type == OBS_BOUNDS_SCALE_OUTER) use_width = !use_width; - mul = use_width ? - item->bounds.x / width : - item->bounds.y / height; + mul = use_width ? item->bounds.x / width + : item->bounds.y / height; vec2_mulf(scale, scale, mul); @@ -309,26 +307,26 @@ scale->y = item->bounds.y / (float)(*cy); } - width = (float)(*cx) * scale->x; - height = (float)(*cy) * scale->y; - width_diff = item->bounds.x - width; + width = (float)(*cx) * scale->x; + height = (float)(*cy) * scale->y; + width_diff = item->bounds.x - width; height_diff = item->bounds.y - height; - *cx = (uint32_t)item->bounds.x; - *cy = (uint32_t)item->bounds.y; + *cx = (uint32_t)item->bounds.x; + *cy = (uint32_t)item->bounds.y; - add_alignment(origin, item->bounds_align, - (int)-width_diff, (int)-height_diff); + add_alignment(origin, item->bounds_align, (int)-width_diff, + (int)-height_diff); } static inline uint32_t calc_cx(const struct obs_scene_item *item, - uint32_t width) + uint32_t width) { uint32_t crop_cx = item->crop.left + item->crop.right; return (crop_cx > width) ? 2 : (width - crop_cx); } static inline uint32_t calc_cy(const struct obs_scene_item *item, - uint32_t height) + uint32_t height) { uint32_t crop_cy = item->crop.top + item->crop.bottom; return (crop_cy > height) ? 2 : (height - crop_cy); @@ -336,25 +334,25 @@ static void update_item_transform(struct obs_scene_item *item, bool update_tex) { - uint32_t width; - uint32_t height; - uint32_t cx; - uint32_t cy; - struct vec2 base_origin; - struct vec2 origin; - struct vec2 scale; + uint32_t width; + uint32_t height; + uint32_t cx; + uint32_t cy; + struct vec2 base_origin; + struct vec2 origin; + struct vec2 scale; struct calldata params; - uint8_t stack[128]; + uint8_t stack[128]; if (os_atomic_load_long(&item->defer_update) > 0) return; - width = obs_source_get_width(item->source); - height = obs_source_get_height(item->source); - cx = calc_cx(item, width); - cy = calc_cy(item, height); - scale = item->scale; - item->last_width = width; + width = obs_source_get_width(item->source); + height = obs_source_get_height(item->source); + cx = calc_cx(item, width); + cy = calc_cy(item, height); + scale = item->scale; + item->last_width = width; item->last_height = height; width = cx; @@ -375,14 +373,14 @@ add_alignment(&origin, item->align, (int)cx, (int)cy); matrix4_identity(&item->draw_transform); - matrix4_scale3f(&item->draw_transform, &item->draw_transform, - scale.x, scale.y, 1.0f); + matrix4_scale3f(&item->draw_transform, &item->draw_transform, scale.x, + scale.y, 1.0f); matrix4_translate3f(&item->draw_transform, &item->draw_transform, - -origin.x, -origin.y, 0.0f); - matrix4_rotate_aa4f(&item->draw_transform, &item->draw_transform, - 0.0f, 0.0f, 1.0f, RAD(item->rot)); + -origin.x, -origin.y, 0.0f); + matrix4_rotate_aa4f(&item->draw_transform, &item->draw_transform, 0.0f, + 0.0f, 1.0f, RAD(item->rot)); matrix4_translate3f(&item->draw_transform, &item->draw_transform, - item->pos.x, item->pos.y, 0.0f); + item->pos.x, item->pos.y, 0.0f); item->output_scale = scale; @@ -391,7 +389,7 @@ if (item->bounds_type != OBS_BOUNDS_NONE) { vec2_copy(&scale, &item->bounds); } else { - scale.x = (float)width * item->scale.x; + scale.x = (float)width * item->scale.x; scale.y = (float)height * item->scale.y; } @@ -400,14 +398,14 @@ add_alignment(&base_origin, item->align, (int)scale.x, (int)scale.y); matrix4_identity(&item->box_transform); - matrix4_scale3f(&item->box_transform, &item->box_transform, - scale.x, scale.y, 1.0f); + matrix4_scale3f(&item->box_transform, &item->box_transform, scale.x, + scale.y, 1.0f); matrix4_translate3f(&item->box_transform, &item->box_transform, - -base_origin.x, -base_origin.y, 0.0f); - matrix4_rotate_aa4f(&item->box_transform, &item->box_transform, - 0.0f, 0.0f, 1.0f, RAD(item->rot)); + -base_origin.x, -base_origin.y, 0.0f); + matrix4_rotate_aa4f(&item->box_transform, &item->box_transform, 0.0f, + 0.0f, 1.0f, RAD(item->rot)); matrix4_translate3f(&item->box_transform, &item->box_transform, - item->pos.x, item->pos.y, 0.0f); + item->pos.x, item->pos.y, 0.0f); /* ----------------------- */ @@ -435,7 +433,7 @@ static inline bool source_size_changed(struct obs_scene_item *item) { - uint32_t width = obs_source_get_width(item->source); + uint32_t width = obs_source_get_width(item->source); uint32_t height = obs_source_get_height(item->source); return item->last_width != width || item->last_height != height; @@ -459,29 +457,36 @@ static inline bool item_texture_enabled(const struct obs_scene_item *item) { return crop_enabled(&item->crop) || scale_filter_enabled(item) || - (item_is_scene(item) && !item->is_group); + (item_is_scene(item) && !item->is_group); } static void render_item_texture(struct obs_scene_item *item) { - GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_ITEM_TEXTURE, "render_item_texture"); - gs_texture_t *tex = gs_texrender_get_texture(item->item_render); + if (!tex) { + return; + } + + GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_ITEM_TEXTURE, + "render_item_texture"); + gs_effect_t *effect = obs->video.default_effect; enum obs_scale_type type = item->scale_filter; uint32_t cx = gs_texture_get_width(tex); uint32_t cy = gs_texture_get_height(tex); + const char *tech = "Draw"; if (type != OBS_SCALE_DISABLE) { if (type == OBS_SCALE_POINT) { - gs_eparam_t *image = gs_effect_get_param_by_name( - effect, "image"); + gs_eparam_t *image = + gs_effect_get_param_by_name(effect, "image"); gs_effect_set_next_sampler(image, - obs->video.point_sampler); + obs->video.point_sampler); } else if (!close_float(item->output_scale.x, 1.0f, EPSILON) || - !close_float(item->output_scale.y, 1.0f, EPSILON)) { + !close_float(item->output_scale.y, 1.0f, EPSILON)) { gs_eparam_t *scale_param; + gs_eparam_t *scale_i_param; if (item->output_scale.x < 0.5f || item->output_scale.y < 0.5f) { @@ -492,17 +497,26 @@ effect = obs->video.lanczos_effect; } else if (type == OBS_SCALE_AREA) { effect = obs->video.area_effect; + if ((item->output_scale.x >= 1.0f) && + (item->output_scale.y >= 1.0f)) + tech = "DrawUpscale"; } - scale_param = gs_effect_get_param_by_name(effect, - "base_dimension_i"); + scale_param = gs_effect_get_param_by_name( + effect, "base_dimension"); if (scale_param) { - struct vec2 base_res_i = { - 1.0f / (float)cx, - 1.0f / (float)cy - }; + struct vec2 base_res = {(float)cx, (float)cy}; + + gs_effect_set_vec2(scale_param, &base_res); + } + + scale_i_param = gs_effect_get_param_by_name( + effect, "base_dimension_i"); + if (scale_i_param) { + struct vec2 base_res_i = {1.0f / (float)cx, + 1.0f / (float)cy}; - gs_effect_set_vec2(scale_param, &base_res_i); + gs_effect_set_vec2(scale_i_param, &base_res_i); } } } @@ -510,7 +524,7 @@ gs_blend_state_push(); gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); - while (gs_effect_loop(effect, "Draw")) + while (gs_effect_loop(effect, tech)) obs_source_draw(tex, 0, 0, 0, 0, 0); gs_blend_state_pop(); @@ -521,10 +535,10 @@ static inline void render_item(struct obs_scene_item *item) { GS_DEBUG_MARKER_BEGIN_FORMAT(GS_DEBUG_COLOR_ITEM, "Item: %s", - obs_source_get_name(item->source)); + obs_source_get_name(item->source)); if (item->item_render) { - uint32_t width = obs_source_get_width(item->source); + uint32_t width = obs_source_get_width(item->source); uint32_t height = obs_source_get_height(item->source); if (!width || !height) { @@ -535,20 +549,18 @@ uint32_t cy = calc_cy(item, height); if (cx && cy && gs_texrender_begin(item->item_render, cx, cy)) { - float cx_scale = (float)width / (float)cx; + float cx_scale = (float)width / (float)cx; float cy_scale = (float)height / (float)cy; struct vec4 clear_color; vec4_zero(&clear_color); gs_clear(GS_CLEAR_COLOR, &clear_color, 0.0f, 0); gs_ortho(0.0f, (float)width, 0.0f, (float)height, - -100.0f, 100.0f); + -100.0f, 100.0f); gs_matrix_scale3f(cx_scale, cy_scale, 1.0f); - gs_matrix_translate3f( - -(float)item->crop.left, - -(float)item->crop.top, - 0.0f); + gs_matrix_translate3f(-(float)item->crop.left, + -(float)item->crop.top, 0.0f); obs_source_video_render(item->source); @@ -587,11 +599,14 @@ } /* assumes video lock */ -static void update_transforms_and_prune_sources(obs_scene_t *scene, - struct darray *remove_items, obs_sceneitem_t *group_sceneitem) +static void +update_transforms_and_prune_sources(obs_scene_t *scene, + struct darray *remove_items, + obs_sceneitem_t *group_sceneitem) { struct obs_scene_item *item = scene->first_item; - bool rebuild_group = group_sceneitem && + bool rebuild_group = + group_sceneitem && os_atomic_load_bool(&group_sceneitem->update_group_resize); while (item) { @@ -600,8 +615,8 @@ item = item->next; remove_without_release(del_item); - darray_push_back(sizeof(struct obs_scene_item*), - remove_items, &del_item); + darray_push_back(sizeof(struct obs_scene_item *), + remove_items, &del_item); rebuild_group = true; continue; } @@ -611,7 +626,7 @@ video_lock(group_scene); update_transforms_and_prune_sources(group_scene, - remove_items, item); + remove_items, item); video_unlock(group_scene); } @@ -631,7 +646,7 @@ static void scene_video_render(void *data, gs_effect_t *effect) { - DARRAY(struct obs_scene_item*) remove_items; + DARRAY(struct obs_scene_item *) remove_items; struct obs_scene *scene = data; struct obs_scene_item *item; @@ -641,7 +656,7 @@ if (!scene->is_group) { update_transforms_and_prune_sources(scene, &remove_items.da, - NULL); + NULL); } gs_blend_state_push(); @@ -675,7 +690,7 @@ if (os_atomic_load_long(&item->active_refs) > 0) { if (!vis) obs_source_remove_active_child(item->parent->source, - item->source); + item->source); } else if (vis) { obs_source_add_active_child(item->parent->source, item->source); } @@ -691,9 +706,9 @@ static void scene_load_item(struct obs_scene *scene, obs_data_t *item_data) { - const char *name = obs_data_get_string(item_data, "name"); - obs_source_t *source; - const char *scale_filter_str; + const char *name = obs_data_get_string(item_data, "name"); + obs_source_t *source; + const char *scale_filter_str; struct obs_scene_item *item; bool visible; bool lock; @@ -703,17 +718,20 @@ source = obs_get_source_by_name(name); if (!source) { - blog(LOG_WARNING, "[scene_load_item] Source %s not " - "found!", name); + blog(LOG_WARNING, + "[scene_load_item] Source %s not " + "found!", + name); return; } item = obs_scene_add(scene, source); if (!item) { - blog(LOG_WARNING, "[scene_load_item] Could not add source '%s' " - "to scene '%s'!", - name, obs_source_get_name(scene->source)); - + blog(LOG_WARNING, + "[scene_load_item] Could not add source '%s' " + "to scene '%s'!", + name, obs_source_get_name(scene->source)); + obs_source_release(source); return; } @@ -721,17 +739,17 @@ item->is_group = source->info.id == group_info.id; obs_data_set_default_int(item_data, "align", - OBS_ALIGN_TOP | OBS_ALIGN_LEFT); + OBS_ALIGN_TOP | OBS_ALIGN_LEFT); if (obs_data_has_user_value(item_data, "id")) item->id = obs_data_get_int(item_data, "id"); - item->rot = (float)obs_data_get_double(item_data, "rot"); - item->align = (uint32_t)obs_data_get_int(item_data, "align"); + item->rot = (float)obs_data_get_double(item_data, "rot"); + item->align = (uint32_t)obs_data_get_int(item_data, "align"); visible = obs_data_get_bool(item_data, "visible"); lock = obs_data_get_bool(item_data, "locked"); - obs_data_get_vec2(item_data, "pos", &item->pos); - obs_data_get_vec2(item_data, "scale", &item->scale); + obs_data_get_vec2(item_data, "pos", &item->pos); + obs_data_get_vec2(item_data, "scale", &item->scale); obs_data_release(item->private_settings); item->private_settings = @@ -742,17 +760,17 @@ set_visibility(item, visible); obs_sceneitem_set_locked(item, lock); - item->bounds_type = - (enum obs_bounds_type)obs_data_get_int(item_data, - "bounds_type"); + item->bounds_type = (enum obs_bounds_type)obs_data_get_int( + item_data, "bounds_type"); item->bounds_align = (uint32_t)obs_data_get_int(item_data, "bounds_align"); obs_data_get_vec2(item_data, "bounds", &item->bounds); - item->crop.left = (uint32_t)obs_data_get_int(item_data, "crop_left"); - item->crop.top = (uint32_t)obs_data_get_int(item_data, "crop_top"); - item->crop.right = (uint32_t)obs_data_get_int(item_data, "crop_right"); - item->crop.bottom = (uint32_t)obs_data_get_int(item_data, "crop_bottom"); + item->crop.left = (uint32_t)obs_data_get_int(item_data, "crop_left"); + item->crop.top = (uint32_t)obs_data_get_int(item_data, "crop_top"); + item->crop.right = (uint32_t)obs_data_get_int(item_data, "crop_right"); + item->crop.bottom = + (uint32_t)obs_data_get_int(item_data, "crop_bottom"); scale_filter_str = obs_data_get_string(item_data, "scale_filter"); item->scale_filter = OBS_SCALE_DISABLE; @@ -791,11 +809,12 @@ { struct obs_scene *scene = data; obs_data_array_t *items = obs_data_get_array(settings, "items"); - size_t count, i; + size_t count, i; remove_all_items(scene); - if (!items) return; + if (!items) + return; count = obs_data_array_count(items); @@ -820,11 +839,11 @@ static void scene_save(void *data, obs_data_t *settings); static void scene_save_item(obs_data_array_t *array, - struct obs_scene_item *item, - struct obs_scene_item *backup_group) + struct obs_scene_item *item, + struct obs_scene_item *backup_group) { obs_data_t *item_data = obs_data_create(); - const char *name = obs_source_get_name(item->source); + const char *name = obs_source_get_name(item->source); const char *scale_filter; struct vec2 pos = item->pos; struct vec2 scale = item->scale; @@ -834,22 +853,22 @@ get_ungrouped_transform(backup_group, &pos, &scale, &rot); } - obs_data_set_string(item_data, "name", name); - obs_data_set_bool (item_data, "visible", item->user_visible); - obs_data_set_bool (item_data, "locked", item->locked); - obs_data_set_double(item_data, "rot", rot); - obs_data_set_vec2 (item_data, "pos", &pos); - obs_data_set_vec2 (item_data, "scale", &scale); - obs_data_set_int (item_data, "align", (int)item->align); - obs_data_set_int (item_data, "bounds_type", (int)item->bounds_type); - obs_data_set_int (item_data, "bounds_align", (int)item->bounds_align); - obs_data_set_vec2 (item_data, "bounds", &item->bounds); - obs_data_set_int (item_data, "crop_left", (int)item->crop.left); - obs_data_set_int (item_data, "crop_top", (int)item->crop.top); - obs_data_set_int (item_data, "crop_right", (int)item->crop.right); - obs_data_set_int (item_data, "crop_bottom", (int)item->crop.bottom); - obs_data_set_int (item_data, "id", item->id); - obs_data_set_bool (item_data, "group_item_backup", !!backup_group); + obs_data_set_string(item_data, "name", name); + obs_data_set_bool(item_data, "visible", item->user_visible); + obs_data_set_bool(item_data, "locked", item->locked); + obs_data_set_double(item_data, "rot", rot); + obs_data_set_vec2(item_data, "pos", &pos); + obs_data_set_vec2(item_data, "scale", &scale); + obs_data_set_int(item_data, "align", (int)item->align); + obs_data_set_int(item_data, "bounds_type", (int)item->bounds_type); + obs_data_set_int(item_data, "bounds_align", (int)item->bounds_align); + obs_data_set_vec2(item_data, "bounds", &item->bounds); + obs_data_set_int(item_data, "crop_left", (int)item->crop.left); + obs_data_set_int(item_data, "crop_top", (int)item->crop.top); + obs_data_set_int(item_data, "crop_right", (int)item->crop.right); + obs_data_set_int(item_data, "crop_bottom", (int)item->crop.bottom); + obs_data_set_int(item_data, "id", item->id); + obs_data_set_bool(item_data, "group_item_backup", !!backup_group); if (item->is_group) { obs_scene_t *group_scene = item->source->context.data; @@ -884,8 +903,7 @@ obs_data_set_string(item_data, "scale_filter", scale_filter); - obs_data_set_obj(item_data, "private_settings", - item->private_settings); + obs_data_set_obj(item_data, "private_settings", item->private_settings); obs_data_array_push_back(array, item_data); obs_data_release(item_data); @@ -893,8 +911,8 @@ static void scene_save(void *data, obs_data_t *settings) { - struct obs_scene *scene = data; - obs_data_array_t *array = obs_data_array_create(); + struct obs_scene *scene = data; + obs_data_array_t *array = obs_data_array_create(); struct obs_scene_item *item; full_lock(scene); @@ -931,7 +949,8 @@ } static void apply_scene_item_audio_actions(struct obs_scene_item *item, - float **p_buf, uint64_t ts, size_t sample_rate) + float **p_buf, uint64_t ts, + size_t sample_rate) { bool cur_visible = item->visible; uint64_t frame_num = 0; @@ -955,7 +974,7 @@ timestamp = ts; new_frame_num = (timestamp - ts) * (uint64_t)sample_rate / - 1000000000ULL; + 1000000000ULL; if (ts && new_frame_num >= AUDIO_OUTPUT_FRAMES) break; @@ -984,13 +1003,13 @@ while (deref_count--) { if (os_atomic_dec_long(&item->active_refs) == 0) { obs_source_remove_active_child(item->parent->source, - item->source); + item->source); } } } -static bool apply_scene_item_volume(struct obs_scene_item *item, - float **buf, uint64_t ts, size_t sample_rate) +static bool apply_scene_item_volume(struct obs_scene_item *item, float **buf, + uint64_t ts, size_t sample_rate) { bool actions_pending; struct item_action action; @@ -1005,11 +1024,11 @@ if (actions_pending) { uint64_t duration = (uint64_t)AUDIO_OUTPUT_FRAMES * - 1000000000ULL / (uint64_t)sample_rate; + 1000000000ULL / (uint64_t)sample_rate; if (!ts || action.timestamp < (ts + duration)) { apply_scene_item_audio_actions(item, buf, ts, - sample_rate); + sample_rate); return true; } } @@ -1018,13 +1037,14 @@ } static void process_all_audio_actions(struct obs_scene_item *item, - size_t sample_rate) + size_t sample_rate) { - while (apply_scene_item_volume(item, NULL, 0, sample_rate)); + while (apply_scene_item_volume(item, NULL, 0, sample_rate)) + ; } static void mix_audio_with_buf(float *p_out, float *p_in, float *buf_in, - size_t pos, size_t count) + size_t pos, size_t count) { register float *out = p_out; register float *buf = buf_in + pos; @@ -1035,8 +1055,8 @@ *(out++) += *(in++) * *(buf++); } -static inline void mix_audio(float *p_out, float *p_in, - size_t pos, size_t count) +static inline void mix_audio(float *p_out, float *p_in, size_t pos, + size_t count) { register float *out = p_out; register float *in = p_in + pos; @@ -1047,8 +1067,9 @@ } static bool scene_audio_render(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio_output, uint32_t mixers, - size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio_output, + uint32_t mixers, size_t channels, + size_t sample_rate) { uint64_t timestamp = 0; float *buf = NULL; @@ -1091,7 +1112,7 @@ bool apply_buf; apply_buf = apply_scene_item_volume(item, &buf, timestamp, - sample_rate); + sample_rate); if (obs_source_audio_pending(item->source)) { item = item->next; @@ -1105,7 +1126,7 @@ } pos = (size_t)ns_to_audio_frames(sample_rate, - source_ts - timestamp); + source_ts - timestamp); count = AUDIO_OUTPUT_FRAMES - pos; if (!apply_buf && !item->visible) { @@ -1124,7 +1145,7 @@ if (apply_buf) mix_audio_with_buf(out, in, buf, pos, - count); + count); else mix_audio(out, in, pos, count); } @@ -1140,59 +1161,51 @@ return true; } -const struct obs_source_info scene_info = -{ - .id = "scene", - .type = OBS_SOURCE_TYPE_SCENE, - .output_flags = OBS_SOURCE_VIDEO | - OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_COMPOSITE, - .get_name = scene_getname, - .create = scene_create, - .destroy = scene_destroy, - .video_tick = scene_video_tick, - .video_render = scene_video_render, - .audio_render = scene_audio_render, - .get_width = scene_getwidth, - .get_height = scene_getheight, - .load = scene_load, - .save = scene_save, +const struct obs_source_info scene_info = { + .id = "scene", + .type = OBS_SOURCE_TYPE_SCENE, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | + OBS_SOURCE_COMPOSITE, + .get_name = scene_getname, + .create = scene_create, + .destroy = scene_destroy, + .video_tick = scene_video_tick, + .video_render = scene_video_render, + .audio_render = scene_audio_render, + .get_width = scene_getwidth, + .get_height = scene_getheight, + .load = scene_load, + .save = scene_save, .enum_active_sources = scene_enum_active_sources, - .enum_all_sources = scene_enum_all_sources -}; - -const struct obs_source_info group_info = -{ - .id = "group", - .type = OBS_SOURCE_TYPE_SCENE, - .output_flags = OBS_SOURCE_VIDEO | - OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_COMPOSITE, - .get_name = group_getname, - .create = scene_create, - .destroy = scene_destroy, - .video_tick = scene_video_tick, - .video_render = scene_video_render, - .audio_render = scene_audio_render, - .get_width = scene_getwidth, - .get_height = scene_getheight, - .load = scene_load, - .save = scene_save, + .enum_all_sources = scene_enum_all_sources}; + +const struct obs_source_info group_info = { + .id = "group", + .type = OBS_SOURCE_TYPE_SCENE, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | + OBS_SOURCE_COMPOSITE, + .get_name = group_getname, + .create = scene_create, + .destroy = scene_destroy, + .video_tick = scene_video_tick, + .video_render = scene_video_render, + .audio_render = scene_audio_render, + .get_width = scene_getwidth, + .get_height = scene_getheight, + .load = scene_load, + .save = scene_save, .enum_active_sources = scene_enum_active_sources, - .enum_all_sources = scene_enum_all_sources -}; + .enum_all_sources = scene_enum_all_sources}; static inline obs_scene_t *create_id(const char *id, const char *name) { - struct obs_source *source = obs_source_create(id, name, NULL, - NULL); + struct obs_source *source = obs_source_create(id, name, NULL, NULL); return source->context.data; } static inline obs_scene_t *create_private_id(const char *id, const char *name) { - struct obs_source *source = obs_source_create_private(id, name, - NULL); + struct obs_source *source = obs_source_create_private(id, name, NULL); return source->context.data; } @@ -1216,9 +1229,9 @@ } static inline obs_source_t *dup_child(struct darray *array, size_t idx, - obs_scene_t *new_scene, bool private) + obs_scene_t *new_scene, bool private) { - DARRAY(struct obs_scene_item*) old_items; + DARRAY(struct obs_scene_item *) old_items; obs_source_t *source; old_items.da = *array; @@ -1247,8 +1260,10 @@ } static inline void duplicate_item_data(struct obs_scene_item *dst, - struct obs_scene_item *src, bool defer_texture_update, - bool duplicate_hotkeys, bool duplicate_private_data) + struct obs_scene_item *src, + bool defer_texture_update, + bool duplicate_hotkeys, + bool duplicate_private_data) { struct obs_scene *dst_scene = dst->parent; @@ -1289,8 +1304,8 @@ } else { if (!dst->item_render && item_texture_enabled(dst)) { obs_enter_graphics(); - dst->item_render = gs_texrender_create( - GS_RGBA, GS_ZS_NONE); + dst->item_render = + gs_texrender_create(GS_RGBA, GS_ZS_NONE); obs_leave_graphics(); } } @@ -1301,11 +1316,11 @@ } obs_scene_t *obs_scene_duplicate(obs_scene_t *scene, const char *name, - enum obs_scene_duplicate_type type) + enum obs_scene_duplicate_type type) { - bool make_unique = ((int)type & (1<<0)) != 0; - bool make_private = ((int)type & (1<<1)) != 0; - DARRAY(struct obs_scene_item*) items; + bool make_unique = ((int)type & (1 << 0)) != 0; + bool make_private = ((int)type & (1 << 1)) != 0; + DARRAY(struct obs_scene_item *) items; struct obs_scene *new_scene; struct obs_scene_item *item; struct obs_source *source; @@ -1331,13 +1346,13 @@ /* --------------------------------- */ new_scene = make_private - ? create_private_id(scene->source->info.id, name) - : create_id(scene->source->info.id, name); + ? create_private_id(scene->source->info.id, name) + : create_id(scene->source->info.id, name); obs_source_copy_filters(new_scene->source, scene->source); obs_data_apply(new_scene->source->private_settings, - scene->source->private_settings); + scene->source->private_settings); /* never duplicate sub-items for groups */ if (scene->is_group) @@ -1345,9 +1360,9 @@ for (size_t i = 0; i < items.num; i++) { item = items.array[i]; - source = make_unique ? - dup_child(&items.da, i, new_scene, make_private) : - new_ref(item->source); + source = make_unique ? dup_child(&items.da, i, new_scene, + make_private) + : new_ref(item->source); if (source) { struct obs_scene_item *new_item = @@ -1359,7 +1374,7 @@ } duplicate_item_data(new_item, item, false, false, - false); + false); obs_source_release(source); } @@ -1453,8 +1468,9 @@ } void obs_scene_enum_items(obs_scene_t *scene, - bool (*callback)(obs_scene_t*, obs_sceneitem_t*, void*), - void *param) + bool (*callback)(obs_scene_t *, obs_sceneitem_t *, + void *), + void *param) { struct obs_scene_item *item; @@ -1495,7 +1511,7 @@ } static bool hotkey_show_sceneitem(void *data, obs_hotkey_pair_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -1512,7 +1528,7 @@ } static bool hotkey_hide_sceneitem(void *data, obs_hotkey_pair_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -1529,7 +1545,7 @@ } static void init_hotkeys(obs_scene_t *scene, obs_sceneitem_t *item, - const char *name) + const char *name) { struct dstr show = {0}; struct dstr hide = {0}; @@ -1546,11 +1562,10 @@ dstr_copy(&hide_desc, obs->hotkeys.sceneitem_hide); dstr_replace(&hide_desc, "%1", name); - item->toggle_visibility = obs_hotkey_pair_register_source(scene->source, - show.array, show_desc.array, - hide.array, hide_desc.array, - hotkey_show_sceneitem, hotkey_hide_sceneitem, - item, item); + item->toggle_visibility = obs_hotkey_pair_register_source( + scene->source, show.array, show_desc.array, hide.array, + hide_desc.array, hotkey_show_sceneitem, hotkey_hide_sceneitem, + item, item); dstr_free(&show); dstr_free(&hide); @@ -1559,20 +1574,20 @@ } static void sceneitem_rename_hotkey(const obs_sceneitem_t *scene_item, - const char *new_name) + const char *new_name) { - struct dstr show = { 0 }; - struct dstr hide = { 0 }; - struct dstr show_desc = { 0 }; - struct dstr hide_desc = { 0 }; + struct dstr show = {0}; + struct dstr hide = {0}; + struct dstr show_desc = {0}; + struct dstr hide_desc = {0}; dstr_copy(&show, "libobs.show_scene_item.%1"); dstr_replace(&show, "%1", new_name); dstr_copy(&hide, "libobs.hide_scene_item.%1"); dstr_replace(&hide, "%1", new_name); - obs_hotkey_pair_set_names(scene_item->toggle_visibility, - show.array, hide.array); + obs_hotkey_pair_set_names(scene_item->toggle_visibility, show.array, + hide.array); dstr_copy(&show_desc, obs->hotkeys.sceneitem_show); dstr_replace(&show_desc, "%1", new_name); @@ -1580,7 +1595,7 @@ dstr_replace(&hide_desc, "%1", new_name); obs_hotkey_pair_set_descriptions(scene_item->toggle_visibility, - show_desc.array, hide_desc.array); + show_desc.array, hide_desc.array); dstr_free(&show); dstr_free(&hide); @@ -1603,16 +1618,15 @@ } static obs_sceneitem_t *obs_scene_add_internal(obs_scene_t *scene, - obs_source_t *source, obs_sceneitem_t *insert_after) + obs_source_t *source, + obs_sceneitem_t *insert_after) { struct obs_scene_item *last; struct obs_scene_item *item; pthread_mutex_t mutex; - struct item_action action = { - .visible = true, - .timestamp = os_gettime_ns() - }; + struct item_action action = {.visible = true, + .timestamp = os_gettime_ns()}; if (!scene) return NULL; @@ -1629,17 +1643,17 @@ if (!obs_source_add_active_child(scene->source, source)) { blog(LOG_WARNING, "Failed to add source to scene due to " - "infinite source recursion"); + "infinite source recursion"); pthread_mutex_destroy(&mutex); return NULL; } item = bzalloc(sizeof(struct obs_scene_item)); - item->source = source; - item->id = ++scene->id_counter; - item->parent = scene; - item->ref = 1; - item->align = OBS_ALIGN_TOP | OBS_ALIGN_LEFT; + item->source = source; + item->id = ++scene->id_counter; + item->parent = scene; + item->ref = 1; + item->align = OBS_ALIGN_TOP | OBS_ALIGN_LEFT; item->actions_mutex = mutex; item->user_visible = true; item->locked = false; @@ -1670,7 +1684,8 @@ if (insert_after) { obs_sceneitem_t *next = insert_after->next; - if (next) next->prev = item; + if (next) + next->prev = item; item->next = insert_after->next; item->prev = insert_after; insert_after->next = item; @@ -1693,7 +1708,7 @@ init_hotkeys(scene, item, obs_source_get_name(source)); signal_handler_connect(obs_source_get_signal_handler(source), "rename", - sceneitem_renamed, item); + sceneitem_renamed, item); return item; } @@ -1708,7 +1723,7 @@ calldata_set_ptr(¶ms, "scene", scene); calldata_set_ptr(¶ms, "item", item); signal_handler_signal(scene->source->context.signals, "item_add", - ¶ms); + ¶ms); return item; } @@ -1724,8 +1739,8 @@ obs_hotkey_pair_unregister(item->toggle_visibility); pthread_mutex_destroy(&item->actions_mutex); signal_handler_disconnect( - obs_source_get_signal_handler(item->source), - "rename", sceneitem_renamed, item); + obs_source_get_signal_handler(item->source), "rename", + sceneitem_renamed, item); if (item->source) obs_source_release(item->source); da_free(item->audio_actions); @@ -1791,7 +1806,7 @@ } static void signal_parent(obs_scene_t *parent, const char *command, - calldata_t *params) + calldata_t *params) { calldata_set_ptr(params, "scene", parent); signal_handler_signal(parent->source->context.signals, command, params); @@ -1809,7 +1824,7 @@ item->selected = select; calldata_init_fixed(¶ms, stack, sizeof(stack)); - calldata_set_ptr(¶ms, "item", item); + calldata_set_ptr(¶ms, "item", item); signal_parent(item->parent, command, ¶ms); } @@ -1819,12 +1834,12 @@ return item ? item->selected : false; } -#define do_update_transform(item) \ - do { \ - if (!item->parent || item->parent->is_group) \ +#define do_update_transform(item) \ + do { \ + if (!item->parent || item->parent->is_group) \ os_atomic_set_bool(&item->update_transform, true); \ - else \ - update_item_transform(item, false); \ + else \ + update_item_transform(item, false); \ } while (false) void obs_sceneitem_set_pos(obs_sceneitem_t *item, const struct vec2 *pos) @@ -1872,9 +1887,10 @@ } void obs_sceneitem_set_order(obs_sceneitem_t *item, - enum obs_order_movement movement) + enum obs_order_movement movement) { - if (!item) return; + if (!item) + return; struct obs_scene_item *next, *prev; struct obs_scene *scene = item->parent; @@ -1914,10 +1930,10 @@ obs_scene_release(scene); } -void obs_sceneitem_set_order_position(obs_sceneitem_t *item, - int position) +void obs_sceneitem_set_order_position(obs_sceneitem_t *item, int position) { - if (!item) return; + if (!item) + return; struct obs_scene *scene = item->parent; struct obs_scene_item *next; @@ -1947,7 +1963,7 @@ } void obs_sceneitem_set_bounds_type(obs_sceneitem_t *item, - enum obs_bounds_type type) + enum obs_bounds_type type) { if (item) { item->bounds_type = type; @@ -1956,7 +1972,7 @@ } void obs_sceneitem_set_bounds_alignment(obs_sceneitem_t *item, - uint32_t alignment) + uint32_t alignment) { if (item) { item->bounds_align = alignment; @@ -2011,50 +2027,50 @@ } void obs_sceneitem_get_info(const obs_sceneitem_t *item, - struct obs_transform_info *info) + struct obs_transform_info *info) { if (item && info) { - info->pos = item->pos; - info->rot = item->rot; - info->scale = item->scale; - info->alignment = item->align; - info->bounds_type = item->bounds_type; + info->pos = item->pos; + info->rot = item->rot; + info->scale = item->scale; + info->alignment = item->align; + info->bounds_type = item->bounds_type; info->bounds_alignment = item->bounds_align; - info->bounds = item->bounds; + info->bounds = item->bounds; } } void obs_sceneitem_set_info(obs_sceneitem_t *item, - const struct obs_transform_info *info) + const struct obs_transform_info *info) { if (item && info) { - item->pos = info->pos; - item->rot = info->rot; - item->scale = info->scale; - item->align = info->alignment; - item->bounds_type = info->bounds_type; + item->pos = info->pos; + item->rot = info->rot; + item->scale = info->scale; + item->align = info->alignment; + item->bounds_type = info->bounds_type; item->bounds_align = info->bounds_alignment; - item->bounds = info->bounds; + item->bounds = info->bounds; do_update_transform(item); } } void obs_sceneitem_get_draw_transform(const obs_sceneitem_t *item, - struct matrix4 *transform) + struct matrix4 *transform) { if (item) matrix4_copy(transform, &item->draw_transform); } void obs_sceneitem_get_box_transform(const obs_sceneitem_t *item, - struct matrix4 *transform) + struct matrix4 *transform) { if (item) matrix4_copy(transform, &item->box_transform); } void obs_sceneitem_get_box_scale(const obs_sceneitem_t *item, - struct vec2 *scale) + struct vec2 *scale) { if (item) *scale = item->box_scale; @@ -2069,10 +2085,8 @@ { struct calldata cd; uint8_t stack[256]; - struct item_action action = { - .visible = visible, - .timestamp = os_gettime_ns() - }; + struct item_action action = {.visible = visible, + .timestamp = os_gettime_ns()}; if (!item) return false; @@ -2086,7 +2100,7 @@ if (visible) { if (os_atomic_inc_long(&item->active_refs) == 1) { if (!obs_source_add_active_child(item->parent->source, - item->source)) { + item->source)) { os_atomic_dec_long(&item->active_refs); return false; } @@ -2118,6 +2132,9 @@ bool obs_sceneitem_set_locked(obs_sceneitem_t *item, bool lock) { + struct calldata cd; + uint8_t stack[256]; + if (!item) return false; @@ -2129,11 +2146,17 @@ item->locked = lock; + calldata_init_fixed(&cd, stack, sizeof(stack)); + calldata_set_ptr(&cd, "item", item); + calldata_set_bool(&cd, "locked", lock); + + signal_parent(item->parent, "item_locked", &cd); + return true; } -static bool sceneitems_match(obs_scene_t *scene, obs_sceneitem_t * const *items, - size_t size, bool *order_matches) +static bool sceneitems_match(obs_scene_t *scene, obs_sceneitem_t *const *items, + size_t size, bool *order_matches) { obs_sceneitem_t *item = scene->first_item; @@ -2162,7 +2185,8 @@ } bool obs_scene_reorder_items(obs_scene_t *scene, - obs_sceneitem_t * const *item_order, size_t item_order_size) + obs_sceneitem_t *const *item_order, + size_t item_order_size) { if (!scene || !item_order_size) return false; @@ -2172,7 +2196,8 @@ bool order_matches = true; if (!sceneitems_match(scene, item_order, item_order_size, - &order_matches) || order_matches) { + &order_matches) || + order_matches) { full_unlock(scene); obs_scene_release(scene); return false; @@ -2199,7 +2224,7 @@ } void obs_scene_atomic_update(obs_scene_t *scene, - obs_scene_atomic_update_func func, void *data) + obs_scene_atomic_update_func func, void *data) { if (!scene) return; @@ -2212,16 +2237,14 @@ } static inline bool crop_equal(const struct obs_sceneitem_crop *crop1, - const struct obs_sceneitem_crop *crop2) + const struct obs_sceneitem_crop *crop2) { - return crop1->left == crop2->left && - crop1->right == crop2->right && - crop1->top == crop2->top && - crop1->bottom == crop2->bottom; + return crop1->left == crop2->left && crop1->right == crop2->right && + crop1->top == crop2->top && crop1->bottom == crop2->bottom; } void obs_sceneitem_set_crop(obs_sceneitem_t *item, - const struct obs_sceneitem_crop *crop) + const struct obs_sceneitem_crop *crop) { if (!obs_ptr_valid(item, "obs_sceneitem_set_crop")) return; @@ -2232,16 +2255,20 @@ memcpy(&item->crop, crop, sizeof(*crop)); - if (item->crop.left < 0) item->crop.left = 0; - if (item->crop.right < 0) item->crop.right = 0; - if (item->crop.top < 0) item->crop.top = 0; - if (item->crop.bottom < 0) item->crop.bottom = 0; + if (item->crop.left < 0) + item->crop.left = 0; + if (item->crop.right < 0) + item->crop.right = 0; + if (item->crop.top < 0) + item->crop.top = 0; + if (item->crop.bottom < 0) + item->crop.bottom = 0; os_atomic_set_bool(&item->update_transform, true); } void obs_sceneitem_get_crop(const obs_sceneitem_t *item, - struct obs_sceneitem_crop *crop) + struct obs_sceneitem_crop *crop) { if (!obs_ptr_valid(item, "obs_sceneitem_get_crop")) return; @@ -2252,7 +2279,7 @@ } void obs_sceneitem_set_scale_filter(obs_sceneitem_t *item, - enum obs_scale_type filter) + enum obs_scale_type filter) { if (!obs_ptr_valid(item, "obs_sceneitem_set_scale_filter")) return; @@ -2262,11 +2289,11 @@ os_atomic_set_bool(&item->update_transform, true); } -enum obs_scale_type obs_sceneitem_get_scale_filter( - obs_sceneitem_t *item) +enum obs_scale_type obs_sceneitem_get_scale_filter(obs_sceneitem_t *item) { - return obs_ptr_valid(item, "obs_sceneitem_get_scale_filter") ? - item->scale_filter : OBS_SCALE_DISABLE; + return obs_ptr_valid(item, "obs_sceneitem_get_scale_filter") + ? item->scale_filter + : OBS_SCALE_DISABLE; } void obs_sceneitem_defer_update_begin(obs_sceneitem_t *item) @@ -2329,10 +2356,8 @@ v2->y = v.y; } -static void get_ungrouped_transform(obs_sceneitem_t *group, - struct vec2 *pos, - struct vec2 *scale, - float *rot) +static void get_ungrouped_transform(obs_sceneitem_t *group, struct vec2 *pos, + struct vec2 *scale, float *rot) { struct matrix4 transform; struct matrix4 mat; @@ -2357,7 +2382,7 @@ } static void remove_group_transform(obs_sceneitem_t *group, - obs_sceneitem_t *item) + obs_sceneitem_t *item) { obs_scene_t *parent = item->parent; if (!parent || !group) @@ -2387,17 +2412,17 @@ vec4_set(&mat.t, 0.0f, 0.0f, 0.0f, 1.0f); matrix4_mul(&mat, &mat, &transform); - item->scale.x = vec4_len(&mat.x) * (item->scale.x > 0.0f ? 1.0f : -1.0f); - item->scale.y = vec4_len(&mat.y) * (item->scale.y > 0.0f ? 1.0f : -1.0f); + item->scale.x = + vec4_len(&mat.x) * (item->scale.x > 0.0f ? 1.0f : -1.0f); + item->scale.y = + vec4_len(&mat.y) * (item->scale.y > 0.0f ? 1.0f : -1.0f); item->rot -= group->rot; update_item_transform(item, false); } -static bool resize_scene_base(obs_scene_t *scene, - struct vec2 *minv, - struct vec2 *maxv, - struct vec2 *scale) +static bool resize_scene_base(obs_scene_t *scene, struct vec2 *minv, + struct vec2 *maxv, struct vec2 *scale) { vec2_set(minv, M_INFINITE, M_INFINITE); vec2_set(maxv, -M_INFINITE, -M_INFINITE); @@ -2410,16 +2435,20 @@ } while (item) { -#define get_min_max(x_val, y_val) \ - do { \ - struct vec3 v; \ - vec3_set(&v, x_val, y_val, 0.0f); \ - vec3_transform(&v, &v, &item->box_transform); \ - if (v.x < minv->x) minv->x = v.x; \ - if (v.y < minv->y) minv->y = v.y; \ - if (v.x > maxv->x) maxv->x = v.x; \ - if (v.y > maxv->y) maxv->y = v.y; \ - } while (false) +#define get_min_max(x_val, y_val) \ + do { \ + struct vec3 v; \ + vec3_set(&v, x_val, y_val, 0.0f); \ + vec3_transform(&v, &v, &item->box_transform); \ + if (v.x < minv->x) \ + minv->x = v.x; \ + if (v.y < minv->y) \ + minv->y = v.y; \ + if (v.x > maxv->x) \ + maxv->x = v.x; \ + if (v.y > maxv->y) \ + maxv->y = v.y; \ + } while (false) get_min_max(0.0f, 0.0f); get_min_max(1.0f, 0.0f); @@ -2496,8 +2525,8 @@ return obs_scene_insert_group(scene, name, NULL, 0); } -obs_sceneitem_t *obs_scene_insert_group(obs_scene_t *scene, - const char *name, obs_sceneitem_t **items, size_t count) +obs_sceneitem_t *obs_scene_insert_group(obs_scene_t *scene, const char *name, + obs_sceneitem_t **items, size_t count) { if (!scene) return NULL; @@ -2512,8 +2541,8 @@ obs_scene_t *sub_scene = create_id("group", name); obs_sceneitem_t *last_item = items ? items[count - 1] : NULL; - obs_sceneitem_t *item = obs_scene_add_internal( - scene, sub_scene->source, last_item); + obs_sceneitem_t *item = + obs_scene_add_internal(scene, sub_scene->source, last_item); obs_scene_release(sub_scene); @@ -2678,7 +2707,7 @@ } void obs_sceneitem_group_remove_item(obs_sceneitem_t *group, - obs_sceneitem_t *item) + obs_sceneitem_t *item) { if (!item || !group || !group->is_group) return; @@ -2713,9 +2742,10 @@ full_unlock(scene); } -static void build_current_order_info(obs_scene_t *scene, - struct obs_sceneitem_order_info **items_out, - size_t *size_out) +static void +build_current_order_info(obs_scene_t *scene, + struct obs_sceneitem_order_info **items_out, + size_t *size_out) { DARRAY(struct obs_sceneitem_order_info) items; da_init(items); @@ -2748,7 +2778,8 @@ } static bool sceneitems_match2(obs_scene_t *scene, - struct obs_sceneitem_order_info *items, size_t size) + struct obs_sceneitem_order_info *items, + size_t size) { struct obs_sceneitem_order_info *cur_items; size_t cur_size; @@ -2773,8 +2804,8 @@ return true; } -static obs_sceneitem_t *get_sceneitem_parent_group(obs_scene_t *scene, - obs_sceneitem_t *group_subitem) +static obs_sceneitem_t * +get_sceneitem_parent_group(obs_scene_t *scene, obs_sceneitem_t *group_subitem) { if (group_subitem->is_group) return NULL; @@ -2791,8 +2822,8 @@ } bool obs_scene_reorder_items2(obs_scene_t *scene, - struct obs_sceneitem_order_info *item_order, - size_t item_order_size) + struct obs_sceneitem_order_info *item_order, + size_t item_order_size) { if (!scene || !item_order_size || !item_order) return false; @@ -2853,7 +2884,7 @@ sub_prev->next = sub_item; apply_group_transform(sub_info->item, - sub_info->group); + sub_info->group); sub_prev = sub_item; } @@ -2881,14 +2912,14 @@ } obs_sceneitem_t *obs_sceneitem_get_group(obs_scene_t *scene, - obs_sceneitem_t *group_subitem) + obs_sceneitem_t *group_subitem) { if (!scene || !group_subitem || group_subitem->is_group) return NULL; full_lock(scene); - obs_sceneitem_t *group = get_sceneitem_parent_group(scene, - group_subitem); + obs_sceneitem_t *group = + get_sceneitem_parent_group(scene, group_subitem); full_unlock(scene); return group; @@ -2905,8 +2936,9 @@ } void obs_sceneitem_group_enum_items(obs_sceneitem_t *group, - bool (*callback)(obs_scene_t*, obs_sceneitem_t*, void*), - void *param) + bool (*callback)(obs_scene_t *, + obs_sceneitem_t *, void *), + void *param) { if (!group || !group->is_group) return;
View file
obs-studio-23.2.1.tar.xz/libobs/obs-scene.h -> obs-studio-24.0.0.tar.xz/libobs/obs-scene.h
Changed
@@ -29,54 +29,54 @@ }; struct obs_scene_item { - volatile long ref; - volatile bool removed; - - bool is_group; - bool update_transform; - bool update_group_resize; - - int64_t id; - - struct obs_scene *parent; - struct obs_source *source; - volatile long active_refs; - volatile long defer_update; - volatile long defer_group_resize; - bool user_visible; - bool visible; - bool selected; - bool locked; - - gs_texrender_t *item_render; + volatile long ref; + volatile bool removed; + + bool is_group; + bool update_transform; + bool update_group_resize; + + int64_t id; + + struct obs_scene *parent; + struct obs_source *source; + volatile long active_refs; + volatile long defer_update; + volatile long defer_group_resize; + bool user_visible; + bool visible; + bool selected; + bool locked; + + gs_texrender_t *item_render; struct obs_sceneitem_crop crop; - struct vec2 pos; - struct vec2 scale; - float rot; - uint32_t align; + struct vec2 pos; + struct vec2 scale; + float rot; + uint32_t align; /* last width/height of the source, this is used to check whether * the transform needs updating */ - uint32_t last_width; - uint32_t last_height; + uint32_t last_width; + uint32_t last_height; - struct vec2 output_scale; - enum obs_scale_type scale_filter; + struct vec2 output_scale; + enum obs_scale_type scale_filter; - struct matrix4 box_transform; - struct vec2 box_scale; - struct matrix4 draw_transform; + struct matrix4 box_transform; + struct vec2 box_scale; + struct matrix4 draw_transform; - enum obs_bounds_type bounds_type; - uint32_t bounds_align; - struct vec2 bounds; + enum obs_bounds_type bounds_type; + uint32_t bounds_align; + struct vec2 bounds; - obs_hotkey_pair_id toggle_visibility; + obs_hotkey_pair_id toggle_visibility; - obs_data_t *private_settings; + obs_data_t *private_settings; - pthread_mutex_t actions_mutex; + pthread_mutex_t actions_mutex; DARRAY(struct item_action) audio_actions; /* would do **prev_next, but not really great for reordering */ @@ -85,16 +85,16 @@ }; struct obs_scene { - struct obs_source *source; + struct obs_source *source; - bool is_group; - bool custom_size; - uint32_t cx; - uint32_t cy; + bool is_group; + bool custom_size; + uint32_t cx; + uint32_t cy; - int64_t id_counter; + int64_t id_counter; - pthread_mutex_t video_mutex; - pthread_mutex_t audio_mutex; + pthread_mutex_t video_mutex; + pthread_mutex_t audio_mutex; struct obs_scene_item *first_item; };
View file
obs-studio-23.2.1.tar.xz/libobs/obs-service.c -> obs-studio-24.0.0.tar.xz/libobs/obs-service.c
Changed
@@ -22,7 +22,7 @@ size_t i; for (i = 0; i < obs->service_types.num; i++) if (strcmp(obs->service_types.array[i].id, id) == 0) - return obs->service_types.array+i; + return obs->service_types.array + i; return NULL; } @@ -34,8 +34,10 @@ } static obs_service_t *obs_service_create_internal(const char *id, - const char *name, obs_data_t *settings, obs_data_t *hotkey_data, - bool private) + const char *name, + obs_data_t *settings, + obs_data_t *hotkey_data, + bool private) { const struct obs_service_info *info = find_service(id); struct obs_service *service; @@ -48,37 +50,36 @@ service = bzalloc(sizeof(struct obs_service)); if (!obs_context_data_init(&service->context, OBS_OBJ_TYPE_SERVICE, - settings, name, hotkey_data, private)) { + settings, name, hotkey_data, private)) { bfree(service); return NULL; } service->info = *info; - service->context.data = service->info.create( - service->context.settings, service); + service->context.data = + service->info.create(service->context.settings, service); if (!service->context.data) blog(LOG_ERROR, "Failed to create service '%s'!", name); service->control = bzalloc(sizeof(obs_weak_service_t)); service->control->service = service; - obs_context_data_insert(&service->context, - &obs->data.services_mutex, - &obs->data.first_service); + obs_context_data_insert(&service->context, &obs->data.services_mutex, + &obs->data.first_service); blog(LOG_DEBUG, "service '%s' (%s) created", name, id); return service; } -obs_service_t *obs_service_create(const char *id, - const char *name, obs_data_t *settings, obs_data_t *hotkey_data) +obs_service_t *obs_service_create(const char *id, const char *name, + obs_data_t *settings, obs_data_t *hotkey_data) { return obs_service_create_internal(id, name, settings, hotkey_data, - false); + false); } -obs_service_t *obs_service_create_private(const char *id, - const char *name, obs_data_t *settings) +obs_service_t *obs_service_create_private(const char *id, const char *name, + obs_data_t *settings) { return obs_service_create_internal(id, name, settings, NULL, true); } @@ -95,7 +96,7 @@ obs_context_data_free(&service->context); if (service->owns_info_id) - bfree((void*)service->info.id); + bfree((void *)service->info.id); bfree(service); } @@ -115,8 +116,9 @@ const char *obs_service_get_name(const obs_service_t *service) { - return obs_service_valid(service, "obs_service_get_name") ? - service->context.name : NULL; + return obs_service_valid(service, "obs_service_get_name") + ? service->context.name + : NULL; } static inline obs_data_t *get_defaults(const struct obs_service_info *info) @@ -137,7 +139,7 @@ { const struct obs_service_info *info = find_service(id); if (info && info->get_properties) { - obs_data_t *defaults = get_defaults(info); + obs_data_t *defaults = get_defaults(info); obs_properties_t *properties; properties = info->get_properties(NULL); @@ -165,8 +167,9 @@ const char *obs_service_get_type(const obs_service_t *service) { - return obs_service_valid(service, "obs_service_get_type") ? - service->info.id : NULL; + return obs_service_valid(service, "obs_service_get_type") + ? service->info.id + : NULL; } void obs_service_update(obs_service_t *service, obs_data_t *settings) @@ -178,7 +181,7 @@ if (service->info.update) service->info.update(service->context.data, - service->context.settings); + service->context.settings); } obs_data_t *obs_service_get_settings(const obs_service_t *service) @@ -192,14 +195,16 @@ signal_handler_t *obs_service_get_signal_handler(const obs_service_t *service) { - return obs_service_valid(service, "obs_service_get_signal_handler") ? - service->context.signals : NULL; + return obs_service_valid(service, "obs_service_get_signal_handler") + ? service->context.signals + : NULL; } proc_handler_t *obs_service_get_proc_handler(const obs_service_t *service) { - return obs_service_valid(service, "obs_service_get_proc_handler") ? - service->context.procs : NULL; + return obs_service_valid(service, "obs_service_get_proc_handler") + ? service->context.procs + : NULL; } const char *obs_service_get_url(const obs_service_t *service) @@ -207,7 +212,8 @@ if (!obs_service_valid(service, "obs_service_get_url")) return NULL; - if (!service->info.get_url) return NULL; + if (!service->info.get_url) + return NULL; return service->info.get_url(service->context.data); } @@ -216,7 +222,8 @@ if (!obs_service_valid(service, "obs_service_get_key")) return NULL; - if (!service->info.get_key) return NULL; + if (!service->info.get_key) + return NULL; return service->info.get_key(service->context.data); } @@ -225,7 +232,8 @@ if (!obs_service_valid(service, "obs_service_get_username")) return NULL; - if (!service->info.get_username) return NULL; + if (!service->info.get_username) + return NULL; return service->info.get_username(service->context.data); } @@ -234,7 +242,8 @@ if (!obs_service_valid(service, "obs_service_get_password")) return NULL; - if (!service->info.get_password) return NULL; + if (!service->info.get_password) + return NULL; return service->info.get_password(service->context.data); } @@ -243,9 +252,10 @@ if (!obs_service_valid(service, "obs_service_activate")) return; if (!service->output) { - blog(LOG_WARNING, "obs_service_deactivate: service '%s' " - "is not assigned to an output", - obs_service_get_name(service)); + blog(LOG_WARNING, + "obs_service_deactivate: service '%s' " + "is not assigned to an output", + obs_service_get_name(service)); return; } if (service->active) @@ -253,7 +263,7 @@ if (service->info.activate) service->info.activate(service->context.data, - service->context.settings); + service->context.settings); service->active = true; } @@ -262,13 +272,15 @@ if (!obs_service_valid(service, "obs_service_deactivate")) return; if (!service->output) { - blog(LOG_WARNING, "obs_service_deactivate: service '%s' " - "is not assigned to an output", - obs_service_get_name(service)); + blog(LOG_WARNING, + "obs_service_deactivate: service '%s' " + "is not assigned to an output", + obs_service_get_name(service)); return; } - if (!service->active) return; + if (!service->active) + return; if (service->info.deactivate) service->info.deactivate(service->context.data); @@ -281,7 +293,7 @@ } bool obs_service_initialize(struct obs_service *service, - struct obs_output *output) + struct obs_output *output) { if (!obs_service_valid(service, "obs_service_initialize")) return false; @@ -294,8 +306,8 @@ } void obs_service_apply_encoder_settings(obs_service_t *service, - obs_data_t *video_encoder_settings, - obs_data_t *audio_encoder_settings) + obs_data_t *video_encoder_settings, + obs_data_t *audio_encoder_settings) { if (!obs_service_valid(service, "obs_service_apply_encoder_settings")) return; @@ -304,7 +316,8 @@ if (video_encoder_settings || audio_encoder_settings) service->info.apply_encoder_settings(service->context.data, - video_encoder_settings, audio_encoder_settings); + video_encoder_settings, + audio_encoder_settings); } void obs_service_addref(obs_service_t *service) @@ -377,7 +390,7 @@ } bool obs_weak_service_references_service(obs_weak_service_t *weak, - obs_service_t *service) + obs_service_t *service) { return weak && service && weak->service == service; } @@ -385,13 +398,15 @@ void *obs_service_get_type_data(obs_service_t *service) { return obs_service_valid(service, "obs_service_get_type_data") - ? service->info.type_data : NULL; + ? service->info.type_data + : NULL; } const char *obs_service_get_id(const obs_service_t *service) { return obs_service_valid(service, "obs_service_get_id") - ? service->info.id : NULL; + ? service->info.id + : NULL; } const char *obs_service_get_output_type(const obs_service_t *service)
View file
obs-studio-23.2.1.tar.xz/libobs/obs-service.h -> obs-studio-24.0.0.tar.xz/libobs/obs-service.h
Changed
@@ -66,8 +66,8 @@ bool (*supports_multitrack)(void *data); void (*apply_encoder_settings)(void *data, - obs_data_t *video_encoder_settings, - obs_data_t *audio_encoder_settings); + obs_data_t *video_encoder_settings, + obs_data_t *audio_encoder_settings); void *type_data; void (*free_type_data)(void *type_data); @@ -78,7 +78,7 @@ }; EXPORT void obs_register_service_s(const struct obs_service_info *info, - size_t size); + size_t size); #define obs_register_service(info) \ obs_register_service_s(info, sizeof(struct obs_service_info))
View file
obs-studio-23.2.1.tar.xz/libobs/obs-source-deinterlace.c -> obs-studio-24.0.0.tar.xz/libobs/obs-source-deinterlace.c
Changed
@@ -21,7 +21,7 @@ { struct obs_source_frame *next_frame = source->async_frames.array[0]; struct obs_source_frame *prev_frame = NULL; - struct obs_source_frame *frame = NULL; + struct obs_source_frame *frame = NULL; uint64_t sys_offset = sys_time - source->last_sys_timestamp; uint64_t frame_time = next_frame->timestamp; uint64_t frame_offset = 0; @@ -34,8 +34,28 @@ next_frame = source->async_frames.array[0]; } - if (source->async_frames.num == 2) - source->async_frames.array[0]->prev_frame = true; + if (source->async_frames.num == 2) { + bool prev_frame = true; + if (source->async_unbuffered && + source->deinterlace_offset) { + const uint64_t timestamp = + source->async_frames.array[0]->timestamp; + const uint64_t after_timestamp = + source->async_frames.array[1]->timestamp; + const uint64_t duration = + after_timestamp - timestamp; + const uint64_t frame_end = + timestamp + source->deinterlace_offset + + duration; + if (sys_time < frame_end) { + // Don't skip ahead prematurely. + prev_frame = false; + source->deinterlace_frame_ts = + timestamp - duration; + } + } + source->async_frames.array[0]->prev_frame = prev_frame; + } source->deinterlace_offset = 0; source->last_frame_ts = next_frame->timestamp; return true; @@ -97,7 +117,7 @@ source->deinterlace_offset = 0; } - frame_time = next_frame->timestamp; + frame_time = next_frame->timestamp; frame_offset = frame_time - source->last_frame_ts; } @@ -119,21 +139,39 @@ static inline uint64_t uint64_diff(uint64_t ts1, uint64_t ts2) { - return (ts1 < ts2) ? (ts2 - ts1) : (ts1 - ts2); + return (ts1 < ts2) ? (ts2 - ts1) : (ts1 - ts2); } +#define TWOX_TOLERANCE 1000000 +#define TS_JUMP_THRESHOLD 70000000ULL + static inline void deinterlace_get_closest_frames(obs_source_t *s, - uint64_t sys_time) + uint64_t sys_time) { const struct video_output_info *info; uint64_t half_interval; + if (s->async_unbuffered && s->deinterlace_offset) { + // Want to keep frame if it has not elapsed. + const uint64_t frame_end = + s->deinterlace_frame_ts + s->deinterlace_offset + + ((uint64_t)s->deinterlace_half_duration * 2) - + TWOX_TOLERANCE; + if (sys_time < frame_end) { + // Process new frames if we think time jumped. + const uint64_t diff = frame_end - sys_time; + if (diff < TS_JUMP_THRESHOLD) { + return; + } + } + } + if (!s->async_frames.num) return; info = video_output_get_info(obs->video.video); half_interval = (uint64_t)info->fps_den * 500000000ULL / - (uint64_t)info->fps_num; + (uint64_t)info->fps_num; if (first_frame(s) || ready_deinterlace_frames(s, sys_time)) { uint64_t offset; @@ -149,13 +187,15 @@ da_erase(s->async_frames, 0); - s->deinterlace_half_duration = (uint32_t) - ((s->cur_async_frame->timestamp - - s->prev_async_frame->timestamp) / 2); + s->deinterlace_half_duration = + (uint32_t)((s->cur_async_frame->timestamp - + s->prev_async_frame->timestamp) / + 2); } else { - s->deinterlace_half_duration = (uint32_t) - ((s->cur_async_frame->timestamp - - s->deinterlace_frame_ts) / 2); + s->deinterlace_half_duration = + (uint32_t)((s->cur_async_frame->timestamp - + s->deinterlace_frame_ts) / + 2); } if (!s->last_frame_ts) @@ -168,8 +208,8 @@ if (!s->deinterlace_offset) { s->deinterlace_offset = offset; } else { - uint64_t offset_diff = uint64_diff( - s->deinterlace_offset, offset); + uint64_t offset_diff = + uint64_diff(s->deinterlace_offset, offset); if (offset_diff > half_interval) s->deinterlace_offset = offset; } @@ -196,24 +236,25 @@ source->async_prev_texrender = gs_texrender_create(GS_BGRX, GS_ZS_NONE); - source->async_prev_texture = gs_texture_create( - source->async_convert_width, - source->async_convert_height, - source->async_texture_format, - 1, NULL, GS_DYNAMIC); + for (int c = 0; c < source->async_channel_count; c++) + source->async_prev_textures[c] = gs_texture_create( + source->async_convert_width[c], + source->async_convert_height[c], + source->async_texture_formats[c], 1, NULL, + GS_DYNAMIC); } else { - enum gs_color_format format = convert_video_format( - source->async_format); + enum gs_color_format format = + convert_video_format(source->async_format); - source->async_prev_texture = gs_texture_create( - source->async_width, source->async_height, - format, 1, NULL, GS_DYNAMIC); + source->async_prev_textures[0] = gs_texture_create( + source->async_width, source->async_height, format, 1, + NULL, GS_DYNAMIC); } } static inline struct obs_source_frame *get_prev_frame(obs_source_t *source, - bool *updated) + bool *updated) { struct obs_source_frame *frame = NULL; @@ -247,17 +288,20 @@ if (frame) { if (set_async_texture_size(source, frame)) { - update_async_texture(source, frame, - source->async_prev_texture, - source->async_prev_texrender); + update_async_textures(source, frame, + source->async_prev_textures, + source->async_prev_texrender); } obs_source_release_frame(source, frame); } else if (updated) { /* swap cur/prev if no previous texture */ - gs_texture_t *prev_tex = source->async_prev_texture; - source->async_prev_texture = source->async_texture; - source->async_texture = prev_tex; + for (size_t c = 0; c < MAX_AV_PLANES; c++) { + gs_texture_t *prev_tex = source->async_prev_textures[c]; + source->async_prev_textures[c] = + source->async_textures[c]; + source->async_textures[c] = prev_tex; + } if (source->async_texrender) { gs_texrender_t *prev = source->async_prev_texrender; @@ -270,58 +314,60 @@ static inline gs_effect_t *get_effect(enum obs_deinterlace_mode mode) { switch (mode) { - case OBS_DEINTERLACE_MODE_DISABLE: return NULL; + case OBS_DEINTERLACE_MODE_DISABLE: + return NULL; case OBS_DEINTERLACE_MODE_DISCARD: return obs_load_effect(&obs->video.deinterlace_discard_effect, - "deinterlace_discard.effect"); + "deinterlace_discard.effect"); case OBS_DEINTERLACE_MODE_RETRO: - return obs_load_effect(&obs->video.deinterlace_discard_2x_effect, - "deinterlace_discard_2x.effect"); + return obs_load_effect( + &obs->video.deinterlace_discard_2x_effect, + "deinterlace_discard_2x.effect"); case OBS_DEINTERLACE_MODE_BLEND: return obs_load_effect(&obs->video.deinterlace_blend_effect, - "deinterlace_blend.effect"); + "deinterlace_blend.effect"); case OBS_DEINTERLACE_MODE_BLEND_2X: return obs_load_effect(&obs->video.deinterlace_blend_2x_effect, - "deinterlace_blend_2x.effect"); + "deinterlace_blend_2x.effect"); case OBS_DEINTERLACE_MODE_LINEAR: return obs_load_effect(&obs->video.deinterlace_linear_effect, - "deinterlace_linear.effect"); + "deinterlace_linear.effect"); case OBS_DEINTERLACE_MODE_LINEAR_2X: return obs_load_effect(&obs->video.deinterlace_linear_2x_effect, - "deinterlace_linear_2x.effect"); + "deinterlace_linear_2x.effect"); case OBS_DEINTERLACE_MODE_YADIF: return obs_load_effect(&obs->video.deinterlace_yadif_effect, - "deinterlace_yadif.effect"); + "deinterlace_yadif.effect"); case OBS_DEINTERLACE_MODE_YADIF_2X: return obs_load_effect(&obs->video.deinterlace_yadif_2x_effect, - "deinterlace_yadif_2x.effect"); + "deinterlace_yadif_2x.effect"); } return NULL; } -#define TWOX_TOLERANCE 1000000 - void deinterlace_render(obs_source_t *s) { gs_effect_t *effect = s->deinterlace_effect; uint64_t frame2_ts; gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); - gs_eparam_t *prev = gs_effect_get_param_by_name(effect, - "previous_image"); + gs_eparam_t *prev = + gs_effect_get_param_by_name(effect, "previous_image"); gs_eparam_t *field = gs_effect_get_param_by_name(effect, "field_order"); gs_eparam_t *frame2 = gs_effect_get_param_by_name(effect, "frame2"); - gs_eparam_t *dimensions = gs_effect_get_param_by_name(effect, - "dimensions"); + gs_eparam_t *dimensions = + gs_effect_get_param_by_name(effect, "dimensions"); struct vec2 size = {(float)s->async_width, (float)s->async_height}; - gs_texture_t *cur_tex = s->async_texrender ? - gs_texrender_get_texture(s->async_texrender) : - s->async_texture; - gs_texture_t *prev_tex = s->async_prev_texrender ? - gs_texrender_get_texture(s->async_prev_texrender) : - s->async_prev_texture; + gs_texture_t *cur_tex = + s->async_texrender + ? gs_texrender_get_texture(s->async_texrender) + : s->async_textures[0]; + gs_texture_t *prev_tex = + s->async_prev_texrender + ? gs_texrender_get_texture(s->async_prev_texrender) + : s->async_prev_textures[0]; if (!cur_tex || !prev_tex || !s->async_width || !s->async_height) return; @@ -332,23 +378,22 @@ gs_effect_set_vec2(dimensions, &size); frame2_ts = s->deinterlace_frame_ts + s->deinterlace_offset + - s->deinterlace_half_duration - TWOX_TOLERANCE; + s->deinterlace_half_duration - TWOX_TOLERANCE; gs_effect_set_bool(frame2, obs->video.video_time >= frame2_ts); while (gs_effect_loop(effect, "Draw")) gs_draw_sprite(NULL, s->async_flip ? GS_FLIP_V : 0, - s->async_width, s->async_height); + s->async_width, s->async_height); } static void enable_deinterlacing(obs_source_t *source, - enum obs_deinterlace_mode mode) + enum obs_deinterlace_mode mode) { obs_enter_graphics(); if (source->async_format != VIDEO_FORMAT_NONE && - source->async_width != 0 && - source->async_height != 0) + source->async_width != 0 && source->async_height != 0) set_deinterlace_texture_size(source); source->deinterlace_mode = mode; @@ -367,16 +412,20 @@ static void disable_deinterlacing(obs_source_t *source) { obs_enter_graphics(); - gs_texture_destroy(source->async_prev_texture); + gs_texture_destroy(source->async_prev_textures[0]); + gs_texture_destroy(source->async_prev_textures[1]); + gs_texture_destroy(source->async_prev_textures[2]); gs_texrender_destroy(source->async_prev_texrender); source->deinterlace_mode = OBS_DEINTERLACE_MODE_DISABLE; - source->async_prev_texture = NULL; + source->async_prev_textures[0] = NULL; + source->async_prev_textures[1] = NULL; + source->async_prev_textures[2] = NULL; source->async_prev_texrender = NULL; obs_leave_graphics(); } void obs_source_set_deinterlace_mode(obs_source_t *source, - enum obs_deinterlace_mode mode) + enum obs_deinterlace_mode mode) { if (!obs_source_valid(source, "obs_source_set_deinterlace_mode")) return; @@ -395,30 +444,31 @@ } } -enum obs_deinterlace_mode obs_source_get_deinterlace_mode( - const obs_source_t *source) +enum obs_deinterlace_mode +obs_source_get_deinterlace_mode(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_set_deinterlace_mode") ? - source->deinterlace_mode : OBS_DEINTERLACE_MODE_DISABLE; + return obs_source_valid(source, "obs_source_set_deinterlace_mode") + ? source->deinterlace_mode + : OBS_DEINTERLACE_MODE_DISABLE; } -void obs_source_set_deinterlace_field_order(obs_source_t *source, - enum obs_deinterlace_field_order field_order) +void obs_source_set_deinterlace_field_order( + obs_source_t *source, enum obs_deinterlace_field_order field_order) { if (!obs_source_valid(source, "obs_source_set_deinterlace_field_order")) return; - source->deinterlace_top_first = - field_order == OBS_DEINTERLACE_FIELD_ORDER_TOP; + source->deinterlace_top_first = field_order == + OBS_DEINTERLACE_FIELD_ORDER_TOP; } -enum obs_deinterlace_field_order obs_source_get_deinterlace_field_order( - const obs_source_t *source) +enum obs_deinterlace_field_order +obs_source_get_deinterlace_field_order(const obs_source_t *source) { if (!obs_source_valid(source, "obs_source_set_deinterlace_field_order")) return OBS_DEINTERLACE_FIELD_ORDER_TOP; return source->deinterlace_top_first - ? OBS_DEINTERLACE_FIELD_ORDER_TOP - : OBS_DEINTERLACE_FIELD_ORDER_BOTTOM; + ? OBS_DEINTERLACE_FIELD_ORDER_TOP + : OBS_DEINTERLACE_FIELD_ORDER_BOTTOM; }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-source-transition.c -> obs-studio-24.0.0.tar.xz/libobs/obs-source-transition.c
Changed
@@ -30,7 +30,7 @@ pthread_mutex_unlock(&transition->transition_tex_mutex) static inline bool transition_valid(const obs_source_t *transition, - const char *func) + const char *func) { if (!obs_ptr_valid(transition, func)) return false; @@ -101,14 +101,12 @@ static inline uint32_t get_cx(obs_source_t *tr) { - return tr->transition_cx ? - tr->transition_cx : tr->transition_actual_cx; + return tr->transition_cx ? tr->transition_cx : tr->transition_actual_cx; } static inline uint32_t get_cy(obs_source_t *tr) { - return tr->transition_cy ? - tr->transition_cy : tr->transition_actual_cy; + return tr->transition_cy ? tr->transition_cy : tr->transition_actual_cy; } static void recalculate_transition_matrix(obs_source_t *tr, size_t idx) @@ -153,9 +151,8 @@ if (scale_type == OBS_TRANSITION_SCALE_ASPECT) { bool use_width = tr_aspect < source_aspect; - scale.x = scale.y = use_width ? - tr_cx / source_cx : - tr_cy / source_cy; + scale.x = scale.y = use_width ? tr_cx / source_cx + : tr_cy / source_cy; } else if (scale_type == OBS_TRANSITION_SCALE_STRETCH) { scale.x = tr_cx / source_cx; @@ -166,9 +163,8 @@ source_cy *= scale.y; vec2_zero(&pos); - add_alignment(&pos, tr->transition_alignment, - (int)(tr_cx - source_cx), - (int)(tr_cy - source_cy)); + add_alignment(&pos, tr->transition_alignment, (int)(tr_cx - source_cx), + (int)(tr_cy - source_cy)); matrix4_identity(&mat); matrix4_scale3f(&mat, &mat, scale.x, scale.y, 1.0f); @@ -194,8 +190,10 @@ if (child) { uint32_t new_cx = obs_source_get_width(child); uint32_t new_cy = obs_source_get_height(child); - if (new_cx > cx) cx = new_cx; - if (new_cy > cy) cy = new_cy; + if (new_cx > cx) + cx = new_cx; + if (new_cy > cy) + cy = new_cy; } } @@ -217,9 +215,10 @@ } } -static void set_source(obs_source_t *transition, - enum obs_transition_target target, obs_source_t *new_child, - bool (*callback)(obs_source_t *t, size_t idx, obs_source_t *c)) +static void +set_source(obs_source_t *transition, enum obs_transition_target target, + obs_source_t *new_child, + bool (*callback)(obs_source_t *t, size_t idx, obs_source_t *c)) { size_t idx = (size_t)target; obs_source_t *old_child; @@ -244,7 +243,7 @@ if (already_active) { if (new_child) add_success = obs_source_add_active_child(transition, - new_child); + new_child); if (old_child && add_success) obs_source_remove_active_child(transition, old_child); } @@ -270,7 +269,7 @@ } obs_source_t *obs_transition_get_source(obs_source_t *transition, - enum obs_transition_target target) + enum obs_transition_target target) { size_t idx = (size_t)target; obs_source_t *ret; @@ -313,8 +312,8 @@ if (transition->transition_sources[idx] && !transition->transition_source_active[idx]) { - success = obs_source_add_active_child(transition, - transition->transition_sources[idx]); + success = obs_source_add_active_child( + transition, transition->transition_sources[idx]); if (success) transition->transition_source_active[idx] = true; } @@ -325,7 +324,7 @@ } static bool activate_transition(obs_source_t *transition, size_t idx, - obs_source_t *child) + obs_source_t *child) { if (!transition->transition_source_active[idx]) { if (!obs_source_add_active_child(transition, child)) @@ -346,8 +345,8 @@ } bool obs_transition_start(obs_source_t *transition, - enum obs_transition_mode mode, uint32_t duration_ms, - obs_source_t *dest) + enum obs_transition_mode mode, uint32_t duration_ms, + obs_source_t *dest) { bool active; bool same_as_source; @@ -378,14 +377,14 @@ } set_source(transition, OBS_TRANSITION_SOURCE_B, dest, - activate_transition); + activate_transition); if (dest == NULL && same_as_dest && !same_as_source) { transition->transitioning_video = true; transition->transitioning_audio = true; } obs_source_dosignal(transition, "source_transition_start", - "transition_start"); + "transition_start"); recalculate_transition_size(transition); recalculate_transition_matrices(transition); @@ -455,14 +454,14 @@ } static inline gs_texture_t *get_texture(obs_source_t *transition, - enum obs_transition_target target) + enum obs_transition_target target) { size_t idx = (size_t)target; return gs_texrender_get_texture(transition->transition_texrender[idx]); } void obs_transition_set_scale_type(obs_source_t *transition, - enum obs_transition_scale_type type) + enum obs_transition_scale_type type) { if (!transition_valid(transition, "obs_transition_set_scale_type")) return; @@ -470,12 +469,12 @@ transition->transition_scale_type = type; } -enum obs_transition_scale_type obs_transition_get_scale_type( - const obs_source_t *transition) +enum obs_transition_scale_type +obs_transition_get_scale_type(const obs_source_t *transition) { - return transition_valid(transition, "obs_transition_get_scale_type") ? - transition->transition_scale_type : - OBS_TRANSITION_SCALE_MAX_ONLY; + return transition_valid(transition, "obs_transition_get_scale_type") + ? transition->transition_scale_type + : OBS_TRANSITION_SCALE_MAX_ONLY; } void obs_transition_set_alignment(obs_source_t *transition, uint32_t alignment) @@ -488,12 +487,12 @@ uint32_t obs_transition_get_alignment(const obs_source_t *transition) { - return transition_valid(transition, "obs_transition_get_alignment") ? - transition->transition_alignment : 0; + return transition_valid(transition, "obs_transition_get_alignment") + ? transition->transition_alignment + : 0; } -void obs_transition_set_size(obs_source_t *transition, - uint32_t cx, uint32_t cy) +void obs_transition_set_size(obs_source_t *transition, uint32_t cx, uint32_t cy) { if (!transition_valid(transition, "obs_transition_set_size")) return; @@ -502,8 +501,8 @@ transition->transition_cy = cy; } -void obs_transition_get_size(const obs_source_t *transition, - uint32_t *cx, uint32_t *cy) +void obs_transition_get_size(const obs_source_t *transition, uint32_t *cx, + uint32_t *cy) { if (!transition_valid(transition, "obs_transition_set_size")) { *cx = 0; @@ -520,17 +519,16 @@ obs_source_t *child; lock_transition(tr); - child = transition_active(tr) ? - tr->transition_sources[1] : tr->transition_sources[0]; + child = transition_active(tr) ? tr->transition_sources[1] + : tr->transition_sources[0]; obs_data_set_string(data, "transition_source_a", - child ? child->context.name : ""); + child ? child->context.name : ""); obs_data_set_int(data, "transition_alignment", - tr->transition_alignment); - obs_data_set_int(data, "transition_mode", - (int64_t)tr->transition_mode); + tr->transition_alignment); + obs_data_set_int(data, "transition_mode", (int64_t)tr->transition_mode); obs_data_set_int(data, "transition_scale_type", - (int64_t)tr->transition_scale_type); + (int64_t)tr->transition_scale_type); obs_data_set_int(data, "transition_cx", tr->transition_cx); obs_data_set_int(data, "transition_cy", tr->transition_cy); unlock_transition(tr); @@ -550,17 +548,19 @@ source = obs_get_source_by_name(name); if (source) { if (!obs_source_add_active_child(tr, source)) { - blog(LOG_WARNING, "Cannot set transition '%s' " - "to source '%s' due to " - "infinite recursion", - tr->context.name, name); + blog(LOG_WARNING, + "Cannot set transition '%s' " + "to source '%s' due to " + "infinite recursion", + tr->context.name, name); obs_source_release(source); source = NULL; } } else { - blog(LOG_WARNING, "Failed to find source '%s' for " - "transition '%s'", - name, tr->context.name); + blog(LOG_WARNING, + "Failed to find source '%s' for " + "transition '%s'", + name, tr->context.name); } } @@ -585,7 +585,7 @@ }; static inline void copy_transition_state(obs_source_t *transition, - struct transition_state *state) + struct transition_state *state) { state->s[0] = transition->transition_sources[0]; state->s[1] = transition->transition_sources[1]; @@ -597,31 +597,32 @@ } static inline void enum_child(obs_source_t *tr, obs_source_t *child, - obs_source_enum_proc_t enum_callback, void *param) + obs_source_enum_proc_t enum_callback, void *param) { if (!child) return; if (child->context.data && child->info.enum_active_sources) child->info.enum_active_sources(child->context.data, - enum_callback, param); + enum_callback, param); enum_callback(tr, child, param); } void obs_transition_enum_sources(obs_source_t *transition, - obs_source_enum_proc_t cb, void *param) + obs_source_enum_proc_t cb, void *param) { lock_transition(transition); for (size_t i = 0; i < 2; i++) { if (transition->transition_sources[i]) - cb(transition, transition->transition_sources[i], param); + cb(transition, transition->transition_sources[i], + param); } unlock_transition(transition); } -static inline void render_child(obs_source_t *transition, - obs_source_t *child, size_t idx) +static inline void render_child(obs_source_t *transition, obs_source_t *child, + size_t idx) { uint32_t cx = get_cx(transition); uint32_t cy = get_cy(transition); @@ -662,7 +663,7 @@ if (transition->info.transition_stop) transition->info.transition_stop(transition->context.data); obs_source_dosignal(transition, "source_transition_stop", - "transition_stop"); + "transition_stop"); } void obs_transition_force_stop(obs_source_t *transition) @@ -671,7 +672,7 @@ } void obs_transition_video_render(obs_source_t *transition, - obs_transition_video_render_callback_t callback) + obs_transition_video_render_callback_t callback) { struct transition_state state; struct matrix4 matrices[2]; @@ -728,7 +729,7 @@ gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); callback(transition->context.data, tex[0], tex[1], t, - cx, cy); + cx, cy); gs_blend_state_pop(); } @@ -757,13 +758,13 @@ if (video_stopped) obs_source_dosignal(transition, "source_transition_video_stop", - "transition_video_stop"); + "transition_video_stop"); if (stopped) handle_stop(transition); } bool obs_transition_video_render_direct(obs_source_t *transition, - enum obs_transition_target target) + enum obs_transition_target target) { struct transition_state state; struct matrix4 matrices[2]; @@ -809,7 +810,7 @@ if (video_stopped) obs_source_dosignal(transition, "source_transition_video_stop", - "transition_video_stop"); + "transition_video_stop"); if (stopped) handle_stop(transition); @@ -817,17 +818,18 @@ } static inline float get_sample_time(obs_source_t *transition, - size_t sample_rate, size_t sample, uint64_t ts) + size_t sample_rate, size_t sample, + uint64_t ts) { - uint64_t sample_ts_offset = (uint64_t)sample * 1000000000ULL / - (uint64_t)sample_rate; + uint64_t sample_ts_offset = + (uint64_t)sample * 1000000000ULL / (uint64_t)sample_rate; uint64_t i_ts = ts + sample_ts_offset; return calc_time(transition, i_ts); } static inline void mix_child(obs_source_t *transition, float *out, float *in, - size_t count, size_t sample_rate, uint64_t ts, - obs_transition_audio_mix_callback_t mix) + size_t count, size_t sample_rate, uint64_t ts, + obs_transition_audio_mix_callback_t mix) { void *context_data = transition->context.data; @@ -838,9 +840,9 @@ } static void process_audio(obs_source_t *transition, obs_source_t *child, - struct obs_source_audio_mix *audio, uint64_t min_ts, - uint32_t mixers, size_t channels, size_t sample_rate, - obs_transition_audio_mix_callback_t mix) + struct obs_source_audio_mix *audio, uint64_t min_ts, + uint32_t mixers, size_t channels, size_t sample_rate, + obs_transition_audio_mix_callback_t mix) { bool valid = child && !child->audio_pending; struct obs_source_audio_mix child_audio; @@ -869,8 +871,8 @@ float *in = input->data[ch]; mix_child(transition, out + pos, in, - AUDIO_OUTPUT_FRAMES - pos, - sample_rate, ts, mix); + AUDIO_OUTPUT_FRAMES - pos, sample_rate, ts, + mix); } } } @@ -900,11 +902,12 @@ return false; } -bool obs_transition_audio_render(obs_source_t *transition, - uint64_t *ts_out, struct obs_source_audio_mix *audio, - uint32_t mixers, size_t channels, size_t sample_rate, - obs_transition_audio_mix_callback_t mix_a, - obs_transition_audio_mix_callback_t mix_b) +bool obs_transition_audio_render(obs_source_t *transition, uint64_t *ts_out, + struct obs_source_audio_mix *audio, + uint32_t mixers, size_t channels, + size_t sample_rate, + obs_transition_audio_mix_callback_t mix_a, + obs_transition_audio_mix_callback_t mix_b) { obs_source_t *sources[2]; struct transition_state state = {0}; @@ -935,7 +938,7 @@ copy_transition_state(transition, &state); } else if (!transition->transitioning_video && - transition->transitioning_audio) { + transition->transitioning_audio) { stopped = stop_audio(transition); } @@ -945,16 +948,16 @@ if (state.transitioning_audio) { if (state.s[0]) process_audio(transition, state.s[0], audio, - min_ts, mixers, channels, - sample_rate, mix_a); + min_ts, mixers, channels, + sample_rate, mix_a); if (state.s[1]) process_audio(transition, state.s[1], audio, - min_ts, mixers, channels, - sample_rate, mix_b); + min_ts, mixers, channels, + sample_rate, mix_b); } else if (state.s[0]) { memcpy(audio->output[0].data[0], - state.s[0]->audio_output_buf[0][0], - TOTAL_AUDIO_SIZE); + state.s[0]->audio_output_buf[0][0], + TOTAL_AUDIO_SIZE); } obs_source_release(state.s[0]); @@ -968,8 +971,8 @@ return !!min_ts; } -void obs_transition_enable_fixed(obs_source_t *transition, - bool enable, uint32_t duration) +void obs_transition_enable_fixed(obs_source_t *transition, bool enable, + uint32_t duration) { if (!transition_valid(transition, "obs_transition_enable_fixed")) return; @@ -980,12 +983,13 @@ bool obs_transition_fixed(obs_source_t *transition) { - return transition_valid(transition, "obs_transition_fixed") ? - transition->transition_use_fixed_duration : false; + return transition_valid(transition, "obs_transition_fixed") + ? transition->transition_use_fixed_duration + : false; } -static inline obs_source_t *copy_source_state(obs_source_t *tr_dest, - obs_source_t *tr_source, size_t idx) +static inline obs_source_t * +copy_source_state(obs_source_t *tr_dest, obs_source_t *tr_source, size_t idx) { obs_source_t *old_child = tr_dest->transition_sources[idx]; obs_source_t *new_child = tr_source->transition_sources[idx];
View file
obs-studio-23.2.1.tar.xz/libobs/obs-source.c -> obs-studio-24.0.0.tar.xz/libobs/obs-source.c
Changed
@@ -78,19 +78,19 @@ "void transition_start(ptr source)", "void transition_video_stop(ptr source)", "void transition_stop(ptr source)", - NULL + NULL, }; -bool obs_source_init_context(struct obs_source *source, - obs_data_t *settings, const char *name, obs_data_t *hotkey_data, - bool private) +bool obs_source_init_context(struct obs_source *source, obs_data_t *settings, + const char *name, obs_data_t *hotkey_data, + bool private) { if (!obs_context_data_init(&source->context, OBS_OBJ_TYPE_SOURCE, - settings, name, hotkey_data, private)) + settings, name, hotkey_data, private)) return false; return signal_handler_add_array(source->context.signals, - source_signals); + source_signals); } const char *obs_source_get_display_name(const char *id) @@ -101,8 +101,8 @@ static void allocate_audio_output_buffer(struct obs_source *source) { - size_t size = sizeof(float) * - AUDIO_OUTPUT_FRAMES * MAX_AUDIO_CHANNELS * MAX_AUDIO_MIXES; + size_t size = sizeof(float) * AUDIO_OUTPUT_FRAMES * MAX_AUDIO_CHANNELS * + MAX_AUDIO_MIXES; float *ptr = bzalloc(size); for (size_t mix = 0; mix < MAX_AUDIO_MIXES; mix++) { @@ -115,10 +115,20 @@ } } +static void allocate_audio_mix_buffer(struct obs_source *source) +{ + size_t size = sizeof(float) * AUDIO_OUTPUT_FRAMES * MAX_AUDIO_CHANNELS; + float *ptr = bzalloc(size); + + for (size_t i = 0; i < MAX_AUDIO_CHANNELS; i++) { + source->audio_mix_buf[i] = ptr + AUDIO_OUTPUT_FRAMES * i; + } +} + static inline bool is_async_video_source(const struct obs_source *source) { return (source->info.output_flags & OBS_SOURCE_ASYNC_VIDEO) == - OBS_SOURCE_ASYNC_VIDEO; + OBS_SOURCE_ASYNC_VIDEO; } static inline bool is_audio_source(const struct obs_source *source) @@ -134,7 +144,7 @@ extern char *find_libobs_data_file(const char *file); /* internal initialization */ -bool obs_source_init(struct obs_source *source) +static bool obs_source_init(struct obs_source *source) { pthread_mutexattr_t attr; @@ -167,6 +177,8 @@ if (is_audio_source(source) || is_composite_source(source)) allocate_audio_output_buffer(source); + if (source->info.audio_mix) + allocate_audio_mix_buffer(source); if (source->info.type == OBS_SOURCE_TYPE_TRANSITION) { if (!obs_transition_init(source)) @@ -178,12 +190,17 @@ source->control->source = source; source->audio_mixers = 0xFF; + source->private_settings = obs_data_create(); + return true; +} + +static void obs_source_init_finalize(struct obs_source *source) +{ if (is_audio_source(source)) { pthread_mutex_lock(&obs->data.audio_sources_mutex); source->next_audio_source = obs->data.first_audio_source; - source->prev_next_audio_source = - &obs->data.first_audio_source; + source->prev_next_audio_source = &obs->data.first_audio_source; if (obs->data.first_audio_source) obs->data.first_audio_source->prev_next_audio_source = &source->next_audio_source; @@ -192,50 +209,46 @@ pthread_mutex_unlock(&obs->data.audio_sources_mutex); } - source->private_settings = obs_data_create(); - - obs_context_data_insert(&source->context, - &obs->data.sources_mutex, - &obs->data.first_source); - return true; + obs_context_data_insert(&source->context, &obs->data.sources_mutex, + &obs->data.first_source); } -static bool obs_source_hotkey_mute(void *data, - obs_hotkey_pair_id id, obs_hotkey_t *key, bool pressed) +static bool obs_source_hotkey_mute(void *data, obs_hotkey_pair_id id, + obs_hotkey_t *key, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(key); struct obs_source *source = data; - if (!pressed || obs_source_muted(source)) return false; + if (!pressed || obs_source_muted(source)) + return false; obs_source_set_muted(source, true); return true; } -static bool obs_source_hotkey_unmute(void *data, - obs_hotkey_pair_id id, obs_hotkey_t *key, bool pressed) +static bool obs_source_hotkey_unmute(void *data, obs_hotkey_pair_id id, + obs_hotkey_t *key, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(key); struct obs_source *source = data; - if (!pressed || !obs_source_muted(source)) return false; + if (!pressed || !obs_source_muted(source)) + return false; obs_source_set_muted(source, false); return true; } -static void obs_source_hotkey_push_to_mute(void *data, - obs_hotkey_id id, obs_hotkey_t *key, bool pressed) +static void obs_source_hotkey_push_to_mute(void *data, obs_hotkey_id id, + obs_hotkey_t *key, bool pressed) { - struct audio_action action = { - .timestamp = os_gettime_ns(), - .type = AUDIO_ACTION_PTM, - .set = pressed - }; + struct audio_action action = {.timestamp = os_gettime_ns(), + .type = AUDIO_ACTION_PTM, + .set = pressed}; UNUSED_PARAMETER(id); UNUSED_PARAMETER(key); @@ -249,14 +262,12 @@ source->user_push_to_mute_pressed = pressed; } -static void obs_source_hotkey_push_to_talk(void *data, - obs_hotkey_id id, obs_hotkey_t *key, bool pressed) +static void obs_source_hotkey_push_to_talk(void *data, obs_hotkey_id id, + obs_hotkey_t *key, bool pressed) { - struct audio_action action = { - .timestamp = os_gettime_ns(), - .type = AUDIO_ACTION_PTT, - .set = pressed - }; + struct audio_action action = {.timestamp = os_gettime_ns(), + .type = AUDIO_ACTION_PTT, + .set = pressed}; UNUSED_PARAMETER(id); UNUSED_PARAMETER(key); @@ -274,29 +285,30 @@ { if (!(source->info.output_flags & OBS_SOURCE_AUDIO) || source->info.type != OBS_SOURCE_TYPE_INPUT) { - source->mute_unmute_key = OBS_INVALID_HOTKEY_ID; + source->mute_unmute_key = OBS_INVALID_HOTKEY_ID; source->push_to_talk_key = OBS_INVALID_HOTKEY_ID; return; } - source->mute_unmute_key = obs_hotkey_pair_register_source(source, - "libobs.mute", obs->hotkeys.mute, - "libobs.unmute", obs->hotkeys.unmute, - obs_source_hotkey_mute, obs_source_hotkey_unmute, - source, source); - - source->push_to_mute_key = obs_hotkey_register_source(source, - "libobs.push-to-mute", obs->hotkeys.push_to_mute, - obs_source_hotkey_push_to_mute, source); - - source->push_to_talk_key = obs_hotkey_register_source(source, - "libobs.push-to-talk", obs->hotkeys.push_to_talk, - obs_source_hotkey_push_to_talk, source); + source->mute_unmute_key = obs_hotkey_pair_register_source( + source, "libobs.mute", obs->hotkeys.mute, "libobs.unmute", + obs->hotkeys.unmute, obs_source_hotkey_mute, + obs_source_hotkey_unmute, source, source); + + source->push_to_mute_key = obs_hotkey_register_source( + source, "libobs.push-to-mute", obs->hotkeys.push_to_mute, + obs_source_hotkey_push_to_mute, source); + + source->push_to_talk_key = obs_hotkey_register_source( + source, "libobs.push-to-talk", obs->hotkeys.push_to_talk, + obs_source_hotkey_push_to_talk, source); } static obs_source_t *obs_source_create_internal(const char *id, - const char *name, obs_data_t *settings, - obs_data_t *hotkey_data, bool private) + const char *name, + obs_data_t *settings, + obs_data_t *hotkey_data, + bool private) { struct obs_source *source = bzalloc(sizeof(struct obs_source)); @@ -304,7 +316,7 @@ if (!info) { blog(LOG_ERROR, "Source ID '%s' not found", id); - source->info.id = bstrdup(id); + source->info.id = bstrdup(id); source->owns_info_id = true; } else { source->info = *info; @@ -314,23 +326,26 @@ * * XXX: Fix design flaws with filters */ if (info->type == OBS_SOURCE_TYPE_FILTER) - private = true; + private + = true; } - source->mute_unmute_key = OBS_INVALID_HOTKEY_PAIR_ID; + source->mute_unmute_key = OBS_INVALID_HOTKEY_PAIR_ID; source->push_to_mute_key = OBS_INVALID_HOTKEY_ID; source->push_to_talk_key = OBS_INVALID_HOTKEY_ID; if (!obs_source_init_context(source, settings, name, hotkey_data, - private)) + private)) goto fail; if (info) { - if (info->get_defaults2) - info->get_defaults2(info->type_data, - source->context.settings); - else if (info->get_defaults) + if (info->get_defaults) { info->get_defaults(source->context.settings); + } + if (info->get_defaults2) { + info->get_defaults2(info->type_data, + source->context.settings); + } } if (!obs_source_init(source)) @@ -341,14 +356,14 @@ /* allow the source to be created even if creation fails so that the * user's data doesn't become lost */ - if (info) - source->context.data = info->create(source->context.settings, - source); - if (!source->context.data) + if (info && info->create) + source->context.data = + info->create(source->context.settings, source); + if ((!info || info->create) && !source->context.data) blog(LOG_ERROR, "Failed to create source '%s'!", name); - blog(LOG_DEBUG, "%ssource '%s' (%s) created", - private ? "private " : "", name, id); + blog(LOG_DEBUG, "%ssource '%s' (%s) created", private ? "private " : "", + name, id); source->flags = source->default_flags; source->enabled = true; @@ -357,6 +372,7 @@ obs_source_dosignal(source, "source_create", NULL); } + obs_source_init_finalize(source); return source; fail: @@ -366,14 +382,14 @@ } obs_source_t *obs_source_create(const char *id, const char *name, - obs_data_t *settings, obs_data_t *hotkey_data) + obs_data_t *settings, obs_data_t *hotkey_data) { return obs_source_create_internal(id, name, settings, hotkey_data, - false); + false); } obs_source_t *obs_source_create_private(const char *id, const char *name, - obs_data_t *settings) + obs_data_t *settings) { return obs_source_create_internal(id, name, settings, NULL, true); } @@ -386,8 +402,8 @@ dstr_copy(&new_name, name); for (;;) { - obs_source_t *existing_filter = obs_source_get_filter_by_name( - dst, new_name.array); + obs_source_t *existing_filter = + obs_source_get_filter_by_name(dst, new_name.array); if (!existing_filter) break; @@ -400,9 +416,9 @@ } static void duplicate_filters(obs_source_t *dst, obs_source_t *src, - bool private) + bool private) { - DARRAY(obs_source_t*) filters; + DARRAY(obs_source_t *) filters; da_init(filters); @@ -414,12 +430,12 @@ for (size_t i = filters.num; i > 0; i--) { obs_source_t *src_filter = filters.array[i - 1]; - char *new_name = get_new_filter_name(dst, - src_filter->context.name); + char *new_name = + get_new_filter_name(dst, src_filter->context.name); bool enabled = obs_source_enabled(src_filter); - obs_source_t *dst_filter = obs_source_duplicate(src_filter, - new_name, private); + obs_source_t *dst_filter = + obs_source_duplicate(src_filter, new_name, private); obs_source_set_enabled(dst_filter, enabled); bfree(new_name); @@ -443,8 +459,8 @@ extern obs_scene_t *obs_group_from_source(const obs_source_t *source); -obs_source_t *obs_source_duplicate(obs_source_t *source, - const char *new_name, bool create_private) +obs_source_t *obs_source_duplicate(obs_source_t *source, const char *new_name, + bool create_private) { obs_source_t *new_source; obs_data_t *settings; @@ -464,9 +480,10 @@ if (!scene) return NULL; - obs_scene_t *new_scene = obs_scene_duplicate(scene, new_name, - create_private ? OBS_SCENE_DUP_PRIVATE_COPY : - OBS_SCENE_DUP_COPY); + obs_scene_t *new_scene = obs_scene_duplicate( + scene, new_name, + create_private ? OBS_SCENE_DUP_PRIVATE_COPY + : OBS_SCENE_DUP_COPY); obs_source_t *new_source = obs_scene_get_source(new_scene); return new_source; } @@ -474,9 +491,11 @@ settings = obs_data_create(); obs_data_apply(settings, source->context.settings); - new_source = create_private ? - obs_source_create_private(source->info.id, new_name, settings) : - obs_source_create(source->info.id, new_name, settings, NULL); + new_source = create_private + ? obs_source_create_private(source->info.id, + new_name, settings) + : obs_source_create(source->info.id, new_name, + settings, NULL); new_source->audio_mixers = source->audio_mixers; new_source->sync_offset = source->sync_offset; @@ -496,7 +515,8 @@ } void obs_source_frame_init(struct obs_source_frame *frame, - enum video_format format, uint32_t width, uint32_t height) + enum video_format format, uint32_t width, + uint32_t height) { struct video_frame vid_frame; @@ -505,11 +525,11 @@ video_frame_init(&vid_frame, format, width, height); frame->format = format; - frame->width = width; + frame->width = width; frame->height = height; for (size_t i = 0; i < MAX_AV_PLANES; i++) { - frame->data[i] = vid_frame.data[i]; + frame->data[i] = vid_frame.data[i]; frame->linesize[i] = vid_frame.linesize[i]; } } @@ -521,7 +541,7 @@ } static bool obs_source_filter_remove_refless(obs_source_t *source, - obs_source_t *filter); + obs_source_t *filter); void obs_source_destroy(struct obs_source *source) { @@ -551,8 +571,7 @@ obs_context_data_remove(&source->context); blog(LOG_DEBUG, "%ssource '%s' destroyed", - source->context.private ? "private " : "", - source->context.name); + source->context.private ? "private " : "", source->context.name); obs_source_dosignal(source, "source_destroy", "destroy"); @@ -575,10 +594,10 @@ gs_texrender_destroy(source->async_texrender); if (source->async_prev_texrender) gs_texrender_destroy(source->async_prev_texrender); - if (source->async_texture) - gs_texture_destroy(source->async_texture); - if (source->async_prev_texture) - gs_texture_destroy(source->async_prev_texture); + for (size_t c = 0; c < MAX_AV_PLANES; c++) { + gs_texture_destroy(source->async_textures[c]); + gs_texture_destroy(source->async_prev_textures[c]); + } if (source->filter_texrender) gs_texrender_destroy(source->filter_texrender); gs_leave_context(); @@ -589,6 +608,7 @@ circlebuf_free(&source->audio_input_buf[i]); audio_resampler_destroy(source->resampler); bfree(source->audio_output_buf[0][0]); + bfree(source->audio_mix_buf[0]); obs_source_frame_destroy(source->async_preload_frame); @@ -610,7 +630,7 @@ obs_context_data_free(&source->context); if (source->owns_info_id) - bfree((void*)source->info.id); + bfree((void *)source->info.id); bfree(source); } @@ -627,7 +647,7 @@ { if (!obs) { blog(LOG_WARNING, "Tried to release a source when the OBS " - "core is shut down!"); + "core is shut down!"); return; } @@ -688,7 +708,7 @@ } bool obs_weak_source_references_source(obs_weak_source_t *weak, - obs_source_t *source) + obs_source_t *source) { return weak && source && weak->source == source; } @@ -706,8 +726,8 @@ bool obs_source_removed(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_removed") ? - source->removed : true; + return obs_source_valid(source, "obs_source_removed") ? source->removed + : true; } static inline obs_data_t *get_defaults(const struct obs_source_info *info) @@ -736,7 +756,7 @@ { const struct obs_source_info *info = get_source_info(id); if (info && (info->get_properties || info->get_properties2)) { - obs_data_t *defaults = get_defaults(info); + obs_data_t *defaults = get_defaults(info); obs_properties_t *props; if (info->get_properties2) @@ -760,7 +780,7 @@ bool obs_source_configurable(const obs_source_t *source) { return data_valid(source, "obs_source_configurable") && - (source->info.get_properties || source->info.get_properties2); + (source->info.get_properties || source->info.get_properties2); } obs_properties_t *obs_source_properties(const obs_source_t *source) @@ -771,7 +791,7 @@ if (source->info.get_properties2) { obs_properties_t *props; props = source->info.get_properties2(source->context.data, - source->info.type_data); + source->info.type_data); obs_properties_apply_settings(props, source->context.settings); return props; @@ -787,8 +807,9 @@ uint32_t obs_source_get_output_flags(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_output_flags") ? - source->info.output_flags : 0; + return obs_source_valid(source, "obs_source_get_output_flags") + ? source->info.output_flags + : 0; } uint32_t obs_get_source_output_flags(const char *id) @@ -801,7 +822,7 @@ { if (source->context.data && source->info.update) source->info.update(source->context.data, - source->context.settings); + source->context.settings); source->defer_update = false; } @@ -818,7 +839,7 @@ source->defer_update = true; } else if (source->context.data && source->info.update) { source->info.update(source->context.data, - source->context.settings); + source->context.settings); } } @@ -831,45 +852,47 @@ } void obs_source_send_mouse_click(obs_source_t *source, - const struct obs_mouse_event *event, - int32_t type, bool mouse_up, - uint32_t click_count) + const struct obs_mouse_event *event, + int32_t type, bool mouse_up, + uint32_t click_count) { if (!obs_source_valid(source, "obs_source_send_mouse_click")) return; if (source->info.output_flags & OBS_SOURCE_INTERACTION) { if (source->info.mouse_click) { - source->info.mouse_click(source->context.data, - event, type, mouse_up, click_count); + source->info.mouse_click(source->context.data, event, + type, mouse_up, click_count); } } } void obs_source_send_mouse_move(obs_source_t *source, - const struct obs_mouse_event *event, bool mouse_leave) + const struct obs_mouse_event *event, + bool mouse_leave) { if (!obs_source_valid(source, "obs_source_send_mouse_move")) return; if (source->info.output_flags & OBS_SOURCE_INTERACTION) { if (source->info.mouse_move) { - source->info.mouse_move(source->context.data, - event, mouse_leave); + source->info.mouse_move(source->context.data, event, + mouse_leave); } } } void obs_source_send_mouse_wheel(obs_source_t *source, - const struct obs_mouse_event *event, int x_delta, int y_delta) + const struct obs_mouse_event *event, + int x_delta, int y_delta) { if (!obs_source_valid(source, "obs_source_send_mouse_wheel")) return; if (source->info.output_flags & OBS_SOURCE_INTERACTION) { if (source->info.mouse_wheel) { - source->info.mouse_wheel(source->context.data, - event, x_delta, y_delta); + source->info.mouse_wheel(source->context.data, event, + x_delta, y_delta); } } } @@ -887,7 +910,7 @@ } void obs_source_send_key_click(obs_source_t *source, - const struct obs_key_event *event, bool key_up) + const struct obs_key_event *event, bool key_up) { if (!obs_source_valid(source, "obs_source_send_key_click")) return; @@ -895,7 +918,7 @@ if (source->info.output_flags & OBS_SOURCE_INTERACTION) { if (source->info.key_click) { source->info.key_click(source->context.data, event, - key_up); + key_up); } } } @@ -929,7 +952,7 @@ } static void activate_tree(obs_source_t *parent, obs_source_t *child, - void *param) + void *param) { os_atomic_inc_long(&child->activate_refs); @@ -938,7 +961,7 @@ } static void deactivate_tree(obs_source_t *parent, obs_source_t *child, - void *param) + void *param) { os_atomic_dec_long(&child->activate_refs); @@ -990,15 +1013,15 @@ if (os_atomic_load_long(&source->activate_refs) > 0) { os_atomic_dec_long(&source->activate_refs); obs_source_enum_active_tree(source, deactivate_tree, - NULL); + NULL); } } } static inline struct obs_source_frame *get_closest_frame(obs_source_t *source, - uint64_t sys_time); + uint64_t sys_time); bool set_async_texture_size(struct obs_source *source, - const struct obs_source_frame *frame); + const struct obs_source_frame *frame); static void async_tick(obs_source_t *source) { @@ -1010,21 +1033,19 @@ deinterlace_process_last_frame(source, sys_time); } else { if (source->cur_async_frame) { - remove_async_frame(source, - source->cur_async_frame); + remove_async_frame(source, source->cur_async_frame); source->cur_async_frame = NULL; } - source->cur_async_frame = get_closest_frame(source, - sys_time); + source->cur_async_frame = get_closest_frame(source, sys_time); } source->last_sys_timestamp = sys_time; pthread_mutex_unlock(&source->async_mutex); if (source->cur_async_frame) - source->async_update_texture = set_async_texture_size(source, - source->cur_async_frame); + source->async_update_texture = + set_async_texture_size(source, source->cur_async_frame); } void obs_source_video_tick(obs_source_t *source, float seconds) @@ -1080,31 +1101,31 @@ /* unless the value is 3+ hours worth of frames, this won't overflow */ static inline uint64_t conv_frames_to_time(const size_t sample_rate, - const size_t frames) + const size_t frames) { if (!sample_rate) return 0; - + return (uint64_t)frames * 1000000000ULL / (uint64_t)sample_rate; } static inline size_t conv_time_to_frames(const size_t sample_rate, - const uint64_t duration) + const uint64_t duration) { return (size_t)(duration * (uint64_t)sample_rate / 1000000000ULL); } /* maximum buffer size */ -#define MAX_BUF_SIZE (1000 * AUDIO_OUTPUT_FRAMES * sizeof(float)) +#define MAX_BUF_SIZE (1000 * AUDIO_OUTPUT_FRAMES * sizeof(float)) /* time threshold in nanoseconds to ensure audio timing is as seamless as * possible */ #define TS_SMOOTHING_THRESHOLD 70000000ULL static inline void reset_audio_timing(obs_source_t *source, uint64_t timestamp, - uint64_t os_time) + uint64_t os_time) { - source->timing_set = true; + source->timing_set = true; source->timing_adjust = os_time - timestamp; } @@ -1113,7 +1134,7 @@ for (size_t i = 0; i < MAX_AUDIO_CHANNELS; i++) { if (source->audio_input_buf[i].size) circlebuf_pop_front(&source->audio_input_buf[i], NULL, - source->audio_input_buf[i].size); + source->audio_input_buf[i].size); } source->last_audio_input_buf_size = 0; @@ -1121,12 +1142,13 @@ source->next_audio_sys_ts_min = os_time; } -static void handle_ts_jump(obs_source_t *source, uint64_t expected, - uint64_t ts, uint64_t diff, uint64_t os_time) +static void handle_ts_jump(obs_source_t *source, uint64_t expected, uint64_t ts, + uint64_t diff, uint64_t os_time) { - blog(LOG_DEBUG, "Timestamp for source '%s' jumped by '%"PRIu64"', " - "expected value %"PRIu64", input value %"PRIu64, - source->context.name, diff, expected, ts); + blog(LOG_DEBUG, + "Timestamp for source '%s' jumped by '%" PRIu64 "', " + "expected value %" PRIu64 ", input value %" PRIu64, + source->context.name, diff, expected, ts); pthread_mutex_lock(&source->audio_buf_mutex); reset_audio_timing(source, ts, os_time); @@ -1134,7 +1156,7 @@ } static void source_signal_audio_data(obs_source_t *source, - const struct audio_data *in, bool muted) + const struct audio_data *in, bool muted) { pthread_mutex_lock(&source->audio_cb_mutex); @@ -1148,7 +1170,7 @@ static inline uint64_t uint64_diff(uint64_t ts1, uint64_t ts2) { - return (ts1 < ts2) ? (ts2 - ts1) : (ts1 - ts2); + return (ts1 < ts2) ? (ts2 - ts1) : (ts1 - ts2); } static inline size_t get_buf_placement(audio_t *audio, uint64_t offset) @@ -1158,7 +1180,7 @@ } static void source_output_audio_place(obs_source_t *source, - const struct audio_data *in) + const struct audio_data *in) { audio_t *audio = obs->audio.audio; size_t buf_placement; @@ -1168,16 +1190,16 @@ if (!source->audio_ts || in->timestamp < source->audio_ts) reset_audio_data(source, in->timestamp); - buf_placement = get_buf_placement(audio, - in->timestamp - source->audio_ts) * sizeof(float); + buf_placement = + get_buf_placement(audio, in->timestamp - source->audio_ts) * + sizeof(float); #if DEBUG_AUDIO == 1 - blog(LOG_DEBUG, "frames: %lu, size: %lu, placement: %lu, base_ts: %llu, ts: %llu", - (unsigned long)in->frames, - (unsigned long)source->audio_input_buf[0].size, - (unsigned long)buf_placement, - source->audio_ts, - in->timestamp); + blog(LOG_DEBUG, + "frames: %lu, size: %lu, placement: %lu, base_ts: %llu, ts: %llu", + (unsigned long)in->frames, + (unsigned long)source->audio_input_buf[0].size, + (unsigned long)buf_placement, source->audio_ts, in->timestamp); #endif /* do not allow the circular buffers to become too big */ @@ -1188,15 +1210,15 @@ circlebuf_place(&source->audio_input_buf[i], buf_placement, in->data[i], size); circlebuf_pop_back(&source->audio_input_buf[i], NULL, - source->audio_input_buf[i].size - - (buf_placement + size)); + source->audio_input_buf[i].size - + (buf_placement + size)); } source->last_audio_input_buf_size = 0; } static inline void source_output_audio_push_back(obs_source_t *source, - const struct audio_data *in) + const struct audio_data *in) { audio_t *audio = obs->audio.audio; size_t channels = audio_output_get_channels(audio); @@ -1207,8 +1229,8 @@ return; for (size_t i = 0; i < channels; i++) - circlebuf_push_back(&source->audio_input_buf[i], - in->data[i], size); + circlebuf_push_back(&source->audio_input_buf[i], in->data[i], + size); /* reset audio input buffer size to ensure that audio doesn't get * perpetually cut */ @@ -1218,25 +1240,25 @@ static inline bool source_muted(obs_source_t *source, uint64_t os_time) { if (source->push_to_mute_enabled && source->user_push_to_mute_pressed) - source->push_to_mute_stop_time = os_time + - source->push_to_mute_delay * 1000000; + source->push_to_mute_stop_time = + os_time + source->push_to_mute_delay * 1000000; if (source->push_to_talk_enabled && source->user_push_to_talk_pressed) - source->push_to_talk_stop_time = os_time + - source->push_to_talk_delay * 1000000; + source->push_to_talk_stop_time = + os_time + source->push_to_talk_delay * 1000000; bool push_to_mute_active = source->user_push_to_mute_pressed || - os_time < source->push_to_mute_stop_time; + os_time < source->push_to_mute_stop_time; bool push_to_talk_active = source->user_push_to_talk_pressed || - os_time < source->push_to_talk_stop_time; + os_time < source->push_to_talk_stop_time; return !source->enabled || source->user_muted || - (source->push_to_mute_enabled && push_to_mute_active) || - (source->push_to_talk_enabled && !push_to_talk_active); + (source->push_to_mute_enabled && push_to_mute_active) || + (source->push_to_talk_enabled && !push_to_talk_active); } static void source_output_audio_data(obs_source_t *source, - const struct audio_data *data) + const struct audio_data *data) { size_t sample_rate = audio_output_get_sample_rate(obs->audio.audio); struct audio_data in = *data; @@ -1263,14 +1285,17 @@ /* smooth audio if within threshold */ if (diff > MAX_TS_VAR && !using_direct_ts) handle_ts_jump(source, source->next_audio_ts_min, - in.timestamp, diff, os_time); - else if (diff < TS_SMOOTHING_THRESHOLD) + in.timestamp, diff, os_time); + else if (diff < TS_SMOOTHING_THRESHOLD) { + if (source->async_unbuffered && source->async_decoupled) + source->timing_adjust = os_time - in.timestamp; in.timestamp = source->next_audio_ts_min; + } } source->last_audio_ts = in.timestamp; - source->next_audio_ts_min = in.timestamp + - conv_frames_to_time(sample_rate, in.frames); + source->next_audio_ts_min = + in.timestamp + conv_frames_to_time(sample_rate, in.frames); in.timestamp += source->timing_adjust; @@ -1285,15 +1310,14 @@ if (diff < TS_SMOOTHING_THRESHOLD) { push_back = true; - /* This typically only happens if used with async video when + /* This typically only happens if used with async video when * audio/video start transitioning in to a timestamp jump. * Audio will typically have a timestamp jump, and then video * will have a timestamp jump. If that case is encountered, * just clear the audio data in that small window and force a * resync. This handles all cases rather than just looping. */ } else if (diff > MAX_TS_VAR) { - reset_audio_timing(source, data->timestamp, - os_time); + reset_audio_timing(source, data->timestamp, os_time); in.timestamp = data->timestamp + source->timing_adjust; } } @@ -1302,8 +1326,8 @@ in.timestamp += sync_offset; in.timestamp -= source->resample_offset; - source->next_audio_sys_ts_min = source->next_audio_ts_min + - source->timing_adjust; + source->next_audio_sys_ts_min = + source->next_audio_ts_min + source->timing_adjust; if (source->last_sync_offset != sync_offset) { if (source->last_sync_offset) @@ -1327,15 +1351,20 @@ CONVERT_NONE, CONVERT_NV12, CONVERT_420, - CONVERT_422_U, - CONVERT_422_Y, + CONVERT_420_A, + CONVERT_422, + CONVERT_422_A, + CONVERT_422_PACK, CONVERT_444, + CONVERT_444_A, + CONVERT_444_A_PACK, CONVERT_800, CONVERT_RGB_LIMITED, + CONVERT_BGR3, }; static inline enum convert_type get_convert_type(enum video_format format, - bool full_range) + bool full_range) { switch (format) { case VIDEO_FORMAT_I420: @@ -1344,12 +1373,13 @@ return CONVERT_NV12; case VIDEO_FORMAT_I444: return CONVERT_444; + case VIDEO_FORMAT_I422: + return CONVERT_422; case VIDEO_FORMAT_YVYU: case VIDEO_FORMAT_YUY2: - return CONVERT_422_Y; case VIDEO_FORMAT_UYVY: - return CONVERT_422_U; + return CONVERT_422_PACK; case VIDEO_FORMAT_Y800: return CONVERT_800; @@ -1359,157 +1389,294 @@ case VIDEO_FORMAT_BGRA: case VIDEO_FORMAT_BGRX: return full_range ? CONVERT_NONE : CONVERT_RGB_LIMITED; + + case VIDEO_FORMAT_BGR3: + return CONVERT_BGR3; + + case VIDEO_FORMAT_I40A: + return CONVERT_420_A; + + case VIDEO_FORMAT_I42A: + return CONVERT_422_A; + + case VIDEO_FORMAT_YUVA: + return CONVERT_444_A; + + case VIDEO_FORMAT_AYUV: + return CONVERT_444_A_PACK; } return CONVERT_NONE; } static inline bool set_packed422_sizes(struct obs_source *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { - source->async_convert_width = frame->width / 2; - source->async_convert_height = frame->height; - source->async_texture_format = GS_BGRA; + source->async_convert_width[0] = frame->width / 2; + source->async_convert_height[0] = frame->height; + source->async_texture_formats[0] = GS_BGRA; + source->async_channel_count = 1; + return true; +} + +static inline bool +set_packed444_alpha_sizes(struct obs_source *source, + const struct obs_source_frame *frame) +{ + source->async_convert_width[0] = frame->width; + source->async_convert_height[0] = frame->height; + source->async_texture_formats[0] = GS_BGRA; + source->async_channel_count = 1; return true; } static inline bool set_planar444_sizes(struct obs_source *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { - source->async_convert_width = frame->width; - source->async_convert_height = frame->height * 3; - source->async_texture_format = GS_R8; - source->async_plane_offset[0] = (int)(frame->data[1] - frame->data[0]); - source->async_plane_offset[1] = (int)(frame->data[2] - frame->data[0]); + source->async_convert_width[0] = frame->width; + source->async_convert_width[1] = frame->width; + source->async_convert_width[2] = frame->width; + source->async_convert_height[0] = frame->height; + source->async_convert_height[1] = frame->height; + source->async_convert_height[2] = frame->height; + source->async_texture_formats[0] = GS_R8; + source->async_texture_formats[1] = GS_R8; + source->async_texture_formats[2] = GS_R8; + source->async_channel_count = 3; + return true; +} + +static inline bool +set_planar444_alpha_sizes(struct obs_source *source, + const struct obs_source_frame *frame) +{ + source->async_convert_width[0] = frame->width; + source->async_convert_width[1] = frame->width; + source->async_convert_width[2] = frame->width; + source->async_convert_width[3] = frame->width; + source->async_convert_height[0] = frame->height; + source->async_convert_height[1] = frame->height; + source->async_convert_height[2] = frame->height; + source->async_convert_height[3] = frame->height; + source->async_texture_formats[0] = GS_R8; + source->async_texture_formats[1] = GS_R8; + source->async_texture_formats[2] = GS_R8; + source->async_texture_formats[3] = GS_R8; + source->async_channel_count = 4; return true; } static inline bool set_planar420_sizes(struct obs_source *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { - uint32_t size = frame->width * frame->height; - size += size/2; + source->async_convert_width[0] = frame->width; + source->async_convert_width[1] = frame->width / 2; + source->async_convert_width[2] = frame->width / 2; + source->async_convert_height[0] = frame->height; + source->async_convert_height[1] = frame->height / 2; + source->async_convert_height[2] = frame->height / 2; + source->async_texture_formats[0] = GS_R8; + source->async_texture_formats[1] = GS_R8; + source->async_texture_formats[2] = GS_R8; + source->async_channel_count = 3; + return true; +} - source->async_convert_width = frame->width; - source->async_convert_height = size / frame->width; - source->async_texture_format = GS_R8; - source->async_plane_offset[0] = (int)(frame->data[1] - frame->data[0]); - source->async_plane_offset[1] = (int)(frame->data[2] - frame->data[0]); +static inline bool +set_planar420_alpha_sizes(struct obs_source *source, + const struct obs_source_frame *frame) +{ + source->async_convert_width[0] = frame->width; + source->async_convert_width[1] = frame->width / 2; + source->async_convert_width[2] = frame->width / 2; + source->async_convert_width[3] = frame->width; + source->async_convert_height[0] = frame->height; + source->async_convert_height[1] = frame->height / 2; + source->async_convert_height[2] = frame->height / 2; + source->async_convert_height[3] = frame->height; + source->async_texture_formats[0] = GS_R8; + source->async_texture_formats[1] = GS_R8; + source->async_texture_formats[2] = GS_R8; + source->async_texture_formats[3] = GS_R8; + source->async_channel_count = 4; return true; } -static inline bool set_nv12_sizes(struct obs_source *source, - const struct obs_source_frame *frame) +static inline bool set_planar422_sizes(struct obs_source *source, + const struct obs_source_frame *frame) { - uint32_t size = frame->width * frame->height; - size += size/2; + source->async_convert_width[0] = frame->width; + source->async_convert_width[1] = frame->width / 2; + source->async_convert_width[2] = frame->width / 2; + source->async_convert_height[0] = frame->height; + source->async_convert_height[1] = frame->height; + source->async_convert_height[2] = frame->height; + source->async_texture_formats[0] = GS_R8; + source->async_texture_formats[1] = GS_R8; + source->async_texture_formats[2] = GS_R8; + source->async_channel_count = 3; + return true; +} - source->async_convert_width = frame->width; - source->async_convert_height = size / frame->width; - source->async_texture_format = GS_R8; - source->async_plane_offset[0] = (int)(frame->data[1] - frame->data[0]); +static inline bool +set_planar422_alpha_sizes(struct obs_source *source, + const struct obs_source_frame *frame) +{ + source->async_convert_width[0] = frame->width; + source->async_convert_width[1] = frame->width / 2; + source->async_convert_width[2] = frame->width / 2; + source->async_convert_width[3] = frame->width; + source->async_convert_height[0] = frame->height; + source->async_convert_height[1] = frame->height; + source->async_convert_height[2] = frame->height; + source->async_convert_height[3] = frame->height; + source->async_texture_formats[0] = GS_R8; + source->async_texture_formats[1] = GS_R8; + source->async_texture_formats[2] = GS_R8; + source->async_texture_formats[3] = GS_R8; + source->async_channel_count = 4; + return true; +} + +static inline bool set_nv12_sizes(struct obs_source *source, + const struct obs_source_frame *frame) +{ + source->async_convert_width[0] = frame->width; + source->async_convert_width[1] = frame->width / 2; + source->async_convert_height[0] = frame->height; + source->async_convert_height[1] = frame->height / 2; + source->async_texture_formats[0] = GS_R8; + source->async_texture_formats[1] = GS_R8G8; + source->async_channel_count = 2; return true; } static inline bool set_y800_sizes(struct obs_source *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { - source->async_convert_width = frame->width; - source->async_convert_height = frame->height; - source->async_texture_format = GS_R8; + source->async_convert_width[0] = frame->width; + source->async_convert_height[0] = frame->height; + source->async_texture_formats[0] = GS_R8; + source->async_channel_count = 1; return true; } static inline bool set_rgb_limited_sizes(struct obs_source *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { - source->async_convert_width = frame->width; - source->async_convert_height = frame->height; - source->async_texture_format = convert_video_format(frame->format); + source->async_convert_width[0] = frame->width; + source->async_convert_height[0] = frame->height; + source->async_texture_formats[0] = convert_video_format(frame->format); + source->async_channel_count = 1; + return true; +} + +static inline bool set_bgr3_sizes(struct obs_source *source, + const struct obs_source_frame *frame) +{ + source->async_convert_width[0] = frame->width * 3; + source->async_convert_height[0] = frame->height; + source->async_texture_formats[0] = GS_R8; + source->async_channel_count = 1; return true; } static inline bool init_gpu_conversion(struct obs_source *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { switch (get_convert_type(frame->format, frame->full_range)) { - case CONVERT_422_Y: - case CONVERT_422_U: - return set_packed422_sizes(source, frame); + case CONVERT_422_PACK: + return set_packed422_sizes(source, frame); - case CONVERT_420: - return set_planar420_sizes(source, frame); + case CONVERT_420: + return set_planar420_sizes(source, frame); - case CONVERT_NV12: - return set_nv12_sizes(source, frame); + case CONVERT_422: + return set_planar422_sizes(source, frame); - case CONVERT_444: - return set_planar444_sizes(source, frame); + case CONVERT_NV12: + return set_nv12_sizes(source, frame); - case CONVERT_800: - return set_y800_sizes(source, frame); + case CONVERT_444: + return set_planar444_sizes(source, frame); - case CONVERT_RGB_LIMITED: - return set_rgb_limited_sizes(source, frame); + case CONVERT_800: + return set_y800_sizes(source, frame); - case CONVERT_NONE: - assert(false && "No conversion requested"); - break; + case CONVERT_RGB_LIMITED: + return set_rgb_limited_sizes(source, frame); + + case CONVERT_BGR3: + return set_bgr3_sizes(source, frame); + case CONVERT_420_A: + return set_planar420_alpha_sizes(source, frame); + + case CONVERT_422_A: + return set_planar422_alpha_sizes(source, frame); + + case CONVERT_444_A: + return set_planar444_alpha_sizes(source, frame); + + case CONVERT_444_A_PACK: + return set_packed444_alpha_sizes(source, frame); + + case CONVERT_NONE: + assert(false && "No conversion requested"); + break; } return false; } bool set_async_texture_size(struct obs_source *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { - enum convert_type cur = get_convert_type(frame->format, - frame->full_range); + enum convert_type cur = + get_convert_type(frame->format, frame->full_range); - if (source->async_width == frame->width && - source->async_height == frame->height && - source->async_format == frame->format && + if (source->async_width == frame->width && + source->async_height == frame->height && + source->async_format == frame->format && source->async_full_range == frame->full_range) return true; - source->async_width = frame->width; - source->async_height = frame->height; - source->async_format = frame->format; + source->async_width = frame->width; + source->async_height = frame->height; + source->async_format = frame->format; source->async_full_range = frame->full_range; gs_enter_context(obs->video.graphics); - gs_texture_destroy(source->async_texture); - gs_texture_destroy(source->async_prev_texture); + for (size_t c = 0; c < MAX_AV_PLANES; c++) { + gs_texture_destroy(source->async_textures[c]); + source->async_textures[c] = NULL; + gs_texture_destroy(source->async_prev_textures[c]); + source->async_prev_textures[c] = NULL; + } + gs_texrender_destroy(source->async_texrender); gs_texrender_destroy(source->async_prev_texrender); - source->async_texture = NULL; - source->async_prev_texture = NULL; source->async_texrender = NULL; source->async_prev_texrender = NULL; - if (cur != CONVERT_NONE && init_gpu_conversion(source, frame)) { - source->async_gpu_conversion = true; - - enum gs_color_format format = CONVERT_RGB_LIMITED ? - convert_video_format(frame->format) : GS_BGRX; + const enum gs_color_format format = convert_video_format(frame->format); + const bool async_gpu_conversion = (cur != CONVERT_NONE) && + init_gpu_conversion(source, frame); + source->async_gpu_conversion = async_gpu_conversion; + if (async_gpu_conversion) { source->async_texrender = gs_texrender_create(format, GS_ZS_NONE); - source->async_texture = gs_texture_create( - source->async_convert_width, - source->async_convert_height, - source->async_texture_format, - 1, NULL, GS_DYNAMIC); - + for (int c = 0; c < source->async_channel_count; ++c) + source->async_textures[c] = gs_texture_create( + source->async_convert_width[c], + source->async_convert_height[c], + source->async_texture_formats[c], 1, NULL, + GS_DYNAMIC); } else { - enum gs_color_format format = convert_video_format( - frame->format); - source->async_gpu_conversion = false; - - source->async_texture = gs_texture_create( - frame->width, frame->height, - format, 1, NULL, GS_DYNAMIC); + source->async_textures[0] = + gs_texture_create(frame->width, frame->height, format, + 1, NULL, GS_DYNAMIC); } if (deinterlacing_enabled(source)) @@ -1517,68 +1684,90 @@ gs_leave_context(); - return !!source->async_texture; + return source->async_textures[0] != NULL; } -static void upload_raw_frame(gs_texture_t *tex, - const struct obs_source_frame *frame) +static void upload_raw_frame(gs_texture_t *tex[MAX_AV_PLANES], + const struct obs_source_frame *frame) { switch (get_convert_type(frame->format, frame->full_range)) { - case CONVERT_422_U: - case CONVERT_422_Y: - case CONVERT_800: - case CONVERT_RGB_LIMITED: - gs_texture_set_image(tex, frame->data[0], - frame->linesize[0], false); - break; - - case CONVERT_420: - case CONVERT_NV12: - case CONVERT_444: - gs_texture_set_image(tex, frame->data[0], - frame->width, false); - break; + case CONVERT_422_PACK: + case CONVERT_800: + case CONVERT_RGB_LIMITED: + case CONVERT_BGR3: + case CONVERT_420: + case CONVERT_422: + case CONVERT_NV12: + case CONVERT_444: + case CONVERT_420_A: + case CONVERT_422_A: + case CONVERT_444_A: + case CONVERT_444_A_PACK: + for (size_t c = 0; c < MAX_AV_PLANES; c++) { + if (tex[c]) + gs_texture_set_image(tex[c], frame->data[c], + frame->linesize[c], false); + } + break; - case CONVERT_NONE: - assert(false && "No conversion requested"); - break; + case CONVERT_NONE: + assert(false && "No conversion requested"); + break; } } static const char *select_conversion_technique(enum video_format format, - bool full_range) + bool full_range) { switch (format) { - case VIDEO_FORMAT_UYVY: - return "UYVY_Reverse"; + case VIDEO_FORMAT_UYVY: + return "UYVY_Reverse"; + + case VIDEO_FORMAT_YUY2: + return "YUY2_Reverse"; - case VIDEO_FORMAT_YUY2: - return "YUY2_Reverse"; + case VIDEO_FORMAT_YVYU: + return "YVYU_Reverse"; - case VIDEO_FORMAT_YVYU: - return "YVYU_Reverse"; + case VIDEO_FORMAT_I420: + return "I420_Reverse"; - case VIDEO_FORMAT_I420: - return "I420_Reverse"; - - case VIDEO_FORMAT_NV12: - return "NV12_Reverse"; - - case VIDEO_FORMAT_I444: - return "I444_Reverse"; - - case VIDEO_FORMAT_Y800: - return full_range ? "Y800_Full" : "Y800_Limited"; - - case VIDEO_FORMAT_BGRA: - case VIDEO_FORMAT_BGRX: - case VIDEO_FORMAT_RGBA: - case VIDEO_FORMAT_NONE: - if (full_range) - assert(false && "No conversion requested"); - else - return "RGB_Limited"; - break; + case VIDEO_FORMAT_NV12: + return "NV12_Reverse"; + + case VIDEO_FORMAT_I444: + return "I444_Reverse"; + + case VIDEO_FORMAT_Y800: + return full_range ? "Y800_Full" : "Y800_Limited"; + + case VIDEO_FORMAT_BGR3: + return full_range ? "BGR3_Full" : "BGR3_Limited"; + + case VIDEO_FORMAT_I422: + return "I422_Reverse"; + + case VIDEO_FORMAT_I40A: + return "I40A_Reverse"; + + case VIDEO_FORMAT_I42A: + return "I42A_Reverse"; + + case VIDEO_FORMAT_YUVA: + return "YUVA_Reverse"; + + case VIDEO_FORMAT_AYUV: + return "AYUV_Reverse"; + + case VIDEO_FORMAT_BGRA: + case VIDEO_FORMAT_BGRX: + case VIDEO_FORMAT_RGBA: + case VIDEO_FORMAT_NONE: + if (full_range) + assert(false && "No conversion requested"); + else + return "RGB_Limited"; + break; } return NULL; } @@ -1596,8 +1785,9 @@ } static bool update_async_texrender(struct obs_source *source, - const struct obs_source_frame *frame, - gs_texture_t *tex, gs_texrender_t *texrender) + const struct obs_source_frame *frame, + gs_texture_t *tex[MAX_AV_PLANES], + gs_texrender_t *texrender) { GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_CONVERT_FORMAT, "Convert Format"); @@ -1608,80 +1798,104 @@ uint32_t cx = source->async_width; uint32_t cy = source->async_height; - float convert_width = (float)source->async_convert_width; - gs_effect_t *conv = obs->video.conversion_effect; - const char *tech_name = select_conversion_technique(frame->format, - frame->full_range); + const char *tech_name = + select_conversion_technique(frame->format, frame->full_range); gs_technique_t *tech = gs_effect_get_technique(conv, tech_name); - if (!gs_texrender_begin(texrender, cx, cy)) { - GS_DEBUG_MARKER_END(); - return false; - } + const bool success = gs_texrender_begin(texrender, cx, cy); - gs_enable_blending(false); + if (success) { + gs_enable_blending(false); - gs_technique_begin(tech); - gs_technique_begin_pass(tech, 0); + gs_technique_begin(tech); + gs_technique_begin_pass(tech, 0); - gs_effect_set_texture(gs_effect_get_param_by_name(conv, "image"), tex); - set_eparam(conv, "width", (float)cx); - set_eparam(conv, "height", (float)cy); - set_eparam(conv, "width_d2", cx * 0.5f); - set_eparam(conv, "width_d2_i", 1.0f / (cx * 0.5f)); - set_eparam(conv, "input_width_i_d2", (1.0f / convert_width) * 0.5f); - - set_eparami(conv, "int_width", (int)cx); - set_eparami(conv, "int_input_width", (int)source->async_convert_width); - set_eparami(conv, "int_u_plane_offset", - (int)source->async_plane_offset[0]); - set_eparami(conv, "int_v_plane_offset", - (int)source->async_plane_offset[1]); - - gs_effect_set_val(gs_effect_get_param_by_name(conv, "color_matrix"), - frame->color_matrix, sizeof(float) * 16); - if (!frame->full_range) { - gs_eparam_t *min_param = gs_effect_get_param_by_name( + if (tex[0]) + gs_effect_set_texture( + gs_effect_get_param_by_name(conv, "image"), + tex[0]); + if (tex[1]) + gs_effect_set_texture( + gs_effect_get_param_by_name(conv, "image1"), + tex[1]); + if (tex[2]) + gs_effect_set_texture( + gs_effect_get_param_by_name(conv, "image2"), + tex[2]); + if (tex[3]) + gs_effect_set_texture( + gs_effect_get_param_by_name(conv, "image3"), + tex[3]); + set_eparam(conv, "width", (float)cx); + set_eparam(conv, "height", (float)cy); + set_eparam(conv, "width_d2", (float)cx * 0.5f); + set_eparam(conv, "height_d2", (float)cy * 0.5f); + set_eparam(conv, "width_x2_i", 0.5f / (float)cx); + + struct vec4 vec0, vec1, vec2; + vec4_set(&vec0, frame->color_matrix[0], frame->color_matrix[1], + frame->color_matrix[2], frame->color_matrix[3]); + vec4_set(&vec1, frame->color_matrix[4], frame->color_matrix[5], + frame->color_matrix[6], frame->color_matrix[7]); + vec4_set(&vec2, frame->color_matrix[8], frame->color_matrix[9], + frame->color_matrix[10], frame->color_matrix[11]); + gs_effect_set_vec4( + gs_effect_get_param_by_name(conv, "color_vec0"), &vec0); + gs_effect_set_vec4( + gs_effect_get_param_by_name(conv, "color_vec1"), &vec1); + gs_effect_set_vec4( + gs_effect_get_param_by_name(conv, "color_vec2"), &vec2); + if (!frame->full_range) { + gs_eparam_t *min_param = gs_effect_get_param_by_name( conv, "color_range_min"); - gs_effect_set_val(min_param, frame->color_range_min, - sizeof(float) * 3); - gs_eparam_t *max_param = gs_effect_get_param_by_name( + gs_effect_set_val(min_param, frame->color_range_min, + sizeof(float) * 3); + gs_eparam_t *max_param = gs_effect_get_param_by_name( conv, "color_range_max"); - gs_effect_set_val(max_param, frame->color_range_max, - sizeof(float) * 3); - } - - gs_ortho(0.f, (float)cx, 0.f, (float)cy, -100.f, 100.f); + gs_effect_set_val(max_param, frame->color_range_max, + sizeof(float) * 3); + } - gs_draw_sprite(tex, 0, cx, cy); + gs_draw(GS_TRIS, 0, 3); - gs_technique_end_pass(tech); - gs_technique_end(tech); + gs_technique_end_pass(tech); + gs_technique_end(tech); - gs_enable_blending(true); + gs_enable_blending(true); - gs_texrender_end(texrender); + gs_texrender_end(texrender); + } GS_DEBUG_MARKER_END(); - return true; + return success; } bool update_async_texture(struct obs_source *source, - const struct obs_source_frame *frame, - gs_texture_t *tex, gs_texrender_t *texrender) + const struct obs_source_frame *frame, + gs_texture_t *tex, gs_texrender_t *texrender) +{ + gs_texture_t *tex3[MAX_AV_PLANES] = {tex, NULL, NULL, NULL, + NULL, NULL, NULL, NULL}; + return update_async_textures(source, frame, tex3, texrender); +} + +bool update_async_textures(struct obs_source *source, + const struct obs_source_frame *frame, + gs_texture_t *tex[MAX_AV_PLANES], + gs_texrender_t *texrender) { enum convert_type type; - source->async_flip = frame->flip; + source->async_flip = frame->flip; if (source->async_gpu_conversion && texrender) return update_async_texrender(source, frame, tex, texrender); type = get_convert_type(frame->format, frame->full_range); if (type == CONVERT_NONE) { - gs_texture_set_image(tex, frame->data[0], frame->linesize[0], - false); + gs_texture_set_image(tex[0], frame->data[0], frame->linesize[0], + false); return true; } @@ -1689,10 +1903,10 @@ } static inline void obs_source_draw_texture(struct obs_source *source, - gs_effect_t *effect) + gs_effect_t *effect) { - gs_texture_t *tex = source->async_texture; - gs_eparam_t *param; + gs_texture_t *tex = source->async_textures[0]; + gs_eparam_t *param; if (source->async_texrender) tex = gs_texrender_get_texture(source->async_texrender); @@ -1705,9 +1919,9 @@ static void obs_source_draw_async_texture(struct obs_source *source) { - gs_effect_t *effect = gs_get_effect(); - bool def_draw = (!effect); - gs_technique_t *tech = NULL; + gs_effect_t *effect = gs_get_effect(); + bool def_draw = (!effect); + gs_technique_t *tech = NULL; if (def_draw) { effect = obs_get_base_effect(OBS_EFFECT_DEFAULT); @@ -1724,6 +1938,28 @@ } } +static void recreate_async_texture(obs_source_t *source, + enum gs_color_format format) +{ + uint32_t cx = gs_texture_get_width(source->async_textures[0]); + uint32_t cy = gs_texture_get_height(source->async_textures[0]); + gs_texture_destroy(source->async_textures[0]); + source->async_textures[0] = + gs_texture_create(cx, cy, format, 1, NULL, GS_DYNAMIC); +} + +static inline void check_to_swap_bgrx_bgra(obs_source_t *source, + struct obs_source_frame *frame) +{ + enum gs_color_format format = + gs_texture_get_color_format(source->async_textures[0]); + if (format == GS_BGRX && frame->format == VIDEO_FORMAT_BGRA) { + recreate_async_texture(source, GS_BGRA); + } else if (format == GS_BGRA && frame->format == VIDEO_FORMAT_BGRX) { + recreate_async_texture(source, GS_BGRX); + } +} + static void obs_source_update_async_video(obs_source_t *source) { if (!source->async_rendered) { @@ -1734,18 +1970,19 @@ source->async_rendered = true; if (frame) { + check_to_swap_bgrx_bgra(source, frame); + if (!source->async_decoupled || !source->async_unbuffered) { - source->timing_adjust = - obs->video.video_time - - frame->timestamp; + source->timing_adjust = obs->video.video_time - + frame->timestamp; source->timing_set = true; } if (source->async_update_texture) { - update_async_texture(source, frame, - source->async_texture, - source->async_texrender); + update_async_textures(source, frame, + source->async_textures, + source->async_texrender); source->async_update_texture = false; } @@ -1756,7 +1993,7 @@ static inline void obs_source_render_async_video(obs_source_t *source) { - if (source->async_texture && source->async_active) + if (source->async_textures[0] && source->async_active) obs_source_draw_async_texture(source); } @@ -1778,9 +2015,9 @@ void obs_source_default_render(obs_source_t *source) { - gs_effect_t *effect = obs->video.default_effect; - gs_technique_t *tech = gs_effect_get_technique(effect, "Draw"); - size_t passes, i; + gs_effect_t *effect = obs->video.default_effect; + gs_technique_t *tech = gs_effect_get_technique(effect, "Draw"); + size_t passes, i; passes = gs_technique_begin(tech); for (i = 0; i < passes; i++) { @@ -1794,17 +2031,16 @@ static inline void obs_source_main_render(obs_source_t *source) { - uint32_t flags = source->info.output_flags; - bool custom_draw = (flags & OBS_SOURCE_CUSTOM_DRAW) != 0; + uint32_t flags = source->info.output_flags; + bool custom_draw = (flags & OBS_SOURCE_CUSTOM_DRAW) != 0; bool default_effect = !source->filter_parent && - source->filters.num == 0 && - !custom_draw; + source->filters.num == 0 && !custom_draw; if (default_effect) obs_source_default_render(source); else if (source->context.data) source->info.video_render(source->context.data, - custom_draw ? NULL : gs_get_effect()); + custom_draw ? NULL : gs_get_effect()); } static bool ready_async_frame(obs_source_t *source, uint64_t sys_time); @@ -1851,8 +2087,8 @@ } GS_DEBUG_MARKER_BEGIN_FORMAT(GS_DEBUG_COLOR_SOURCE, - get_type_format(source->info.type), - obs_source_get_name(source)); + get_type_format(source->info.type), + obs_source_get_name(source)); if (source->filters.num && !source->rendering_filter) obs_source_render_filters(source); @@ -1924,9 +2160,8 @@ pthread_mutex_lock(&source->filter_mutex); - width = (source->filters.num) ? - get_base_width(source->filters.array[0]) : - get_base_width(source); + width = (source->filters.num) ? get_base_width(source->filters.array[0]) + : get_base_width(source); pthread_mutex_unlock(&source->filter_mutex); @@ -1939,9 +2174,9 @@ pthread_mutex_lock(&source->filter_mutex); - height = (source->filters.num) ? - get_base_height(source->filters.array[0]) : - get_base_height(source); + height = (source->filters.num) + ? get_base_height(source->filters.array[0]) + : get_base_height(source); pthread_mutex_unlock(&source->filter_mutex); @@ -1953,9 +2188,9 @@ if (!data_valid(source, "obs_source_get_width")) return 0; - return (source->info.type != OBS_SOURCE_TYPE_FILTER) ? - get_recurse_width(source) : - get_base_width(source); + return (source->info.type != OBS_SOURCE_TYPE_FILTER) + ? get_recurse_width(source) + : get_base_width(source); } uint32_t obs_source_get_height(obs_source_t *source) @@ -1963,9 +2198,9 @@ if (!data_valid(source, "obs_source_get_height")) return 0; - return (source->info.type != OBS_SOURCE_TYPE_FILTER) ? - get_recurse_height(source) : - get_base_height(source); + return (source->info.type != OBS_SOURCE_TYPE_FILTER) + ? get_recurse_height(source) + : get_base_height(source); } uint32_t obs_source_get_base_width(obs_source_t *source) @@ -1986,14 +2221,16 @@ obs_source_t *obs_filter_get_parent(const obs_source_t *filter) { - return obs_ptr_valid(filter, "obs_filter_get_parent") ? - filter->filter_parent : NULL; + return obs_ptr_valid(filter, "obs_filter_get_parent") + ? filter->filter_parent + : NULL; } obs_source_t *obs_filter_get_target(const obs_source_t *filter) { - return obs_ptr_valid(filter, "obs_filter_get_target") ? - filter->filter_target : NULL; + return obs_ptr_valid(filter, "obs_filter_get_target") + ? filter->filter_target + : NULL; } static bool filter_compatible(obs_source_t *source, obs_source_t *filter) @@ -2022,7 +2259,7 @@ if (da_find(source->filters, &filter, 0) != DARRAY_INVALID) { blog(LOG_WARNING, "Tried to add a filter that was already " - "present on the source"); + "present on the source"); pthread_mutex_unlock(&source->filter_mutex); return; } @@ -2035,8 +2272,8 @@ obs_source_addref(filter); filter->filter_parent = source; - filter->filter_target = !source->filters.num ? - source : source->filters.array[0]; + filter->filter_target = !source->filters.num ? source + : source->filters.array[0]; da_insert(source->filters, 0, &filter); @@ -2049,12 +2286,11 @@ signal_handler_signal(source->context.signals, "filter_add", &cd); blog(LOG_DEBUG, "- filter '%s' (%s) added to source '%s'", - filter->context.name, filter->info.id, - source->context.name); + filter->context.name, filter->info.id, source->context.name); } static bool obs_source_filter_remove_refless(obs_source_t *source, - obs_source_t *filter) + obs_source_t *filter) { struct calldata cd; uint8_t stack[128]; @@ -2069,7 +2305,7 @@ } if (idx > 0) { - obs_source_t *prev = source->filters.array[idx-1]; + obs_source_t *prev = source->filters.array[idx - 1]; prev->filter_target = filter->filter_target; } @@ -2084,12 +2320,11 @@ signal_handler_signal(source->context.signals, "filter_remove", &cd); blog(LOG_DEBUG, "- filter '%s' (%s) removed from source '%s'", - filter->context.name, filter->info.id, - source->context.name); + filter->context.name, filter->info.id, source->context.name); if (filter->info.filter_remove) filter->info.filter_remove(filter->context.data, - filter->filter_parent); + filter->filter_parent); filter->filter_parent = NULL; filter->filter_target = NULL; @@ -2108,26 +2343,26 @@ } static size_t find_next_filter(obs_source_t *source, obs_source_t *filter, - size_t cur_idx) + size_t cur_idx) { bool curAsync = (filter->info.output_flags & OBS_SOURCE_ASYNC) != 0; bool nextAsync; obs_source_t *next; - if (cur_idx == source->filters.num-1) + if (cur_idx == source->filters.num - 1) return DARRAY_INVALID; - next = source->filters.array[cur_idx+1]; + next = source->filters.array[cur_idx + 1]; nextAsync = (next->info.output_flags & OBS_SOURCE_ASYNC); if (nextAsync == curAsync) - return cur_idx+1; + return cur_idx + 1; else - return find_next_filter(source, filter, cur_idx+1); + return find_next_filter(source, filter, cur_idx + 1); } static size_t find_prev_filter(obs_source_t *source, obs_source_t *filter, - size_t cur_idx) + size_t cur_idx) { bool curAsync = (filter->info.output_flags & OBS_SOURCE_ASYNC) != 0; bool prevAsync; @@ -2136,18 +2371,18 @@ if (cur_idx == 0) return DARRAY_INVALID; - prev = source->filters.array[cur_idx-1]; + prev = source->filters.array[cur_idx - 1]; prevAsync = (prev->info.output_flags & OBS_SOURCE_ASYNC); if (prevAsync == curAsync) - return cur_idx-1; + return cur_idx - 1; else - return find_prev_filter(source, filter, cur_idx-1); + return find_prev_filter(source, filter, cur_idx - 1); } /* moves filters above/below matching filter types */ -static bool move_filter_dir(obs_source_t *source, - obs_source_t *filter, enum obs_order_movement movement) +static bool move_filter_dir(obs_source_t *source, obs_source_t *filter, + enum obs_order_movement movement) { size_t idx; @@ -2168,9 +2403,9 @@ da_move_item(source->filters, idx, prev_id); } else if (movement == OBS_ORDER_MOVE_TOP) { - if (idx == source->filters.num-1) + if (idx == source->filters.num - 1) return false; - da_move_item(source->filters, idx, source->filters.num-1); + da_move_item(source->filters, idx, source->filters.num - 1); } else if (movement == OBS_ORDER_MOVE_BOTTOM) { if (idx == 0) @@ -2180,8 +2415,10 @@ /* reorder filter targets, not the nicest way of dealing with things */ for (size_t i = 0; i < source->filters.num; i++) { - obs_source_t *next_filter = (i == source->filters.num-1) ? - source : source->filters.array[i + 1]; + obs_source_t *next_filter = + (i == source->filters.num - 1) + ? source + : source->filters.array[i + 1]; source->filters.array[i]->filter_target = next_filter; } @@ -2190,7 +2427,7 @@ } void obs_source_filter_set_order(obs_source_t *source, obs_source_t *filter, - enum obs_order_movement movement) + enum obs_order_movement movement) { bool success; @@ -2217,21 +2454,21 @@ } struct obs_source_frame *filter_async_video(obs_source_t *source, - struct obs_source_frame *in) + struct obs_source_frame *in) { size_t i; pthread_mutex_lock(&source->filter_mutex); for (i = source->filters.num; i > 0; i--) { - struct obs_source *filter = source->filters.array[i-1]; + struct obs_source *filter = source->filters.array[i - 1]; if (!filter->enabled) continue; if (filter->context.data && filter->info.filter_video) { in = filter->info.filter_video(filter->context.data, - in); + in); if (!in) break; } @@ -2243,34 +2480,36 @@ } static inline void copy_frame_data_line(struct obs_source_frame *dst, - const struct obs_source_frame *src, uint32_t plane, uint32_t y) + const struct obs_source_frame *src, + uint32_t plane, uint32_t y) { uint32_t pos_src = y * src->linesize[plane]; uint32_t pos_dst = y * dst->linesize[plane]; - uint32_t bytes = dst->linesize[plane] < src->linesize[plane] ? - dst->linesize[plane] : src->linesize[plane]; + uint32_t bytes = dst->linesize[plane] < src->linesize[plane] + ? dst->linesize[plane] + : src->linesize[plane]; memcpy(dst->data[plane] + pos_dst, src->data[plane] + pos_src, bytes); } static inline void copy_frame_data_plane(struct obs_source_frame *dst, - const struct obs_source_frame *src, - uint32_t plane, uint32_t lines) + const struct obs_source_frame *src, + uint32_t plane, uint32_t lines) { if (dst->linesize[plane] != src->linesize[plane]) for (uint32_t y = 0; y < lines; y++) copy_frame_data_line(dst, src, plane, y); else memcpy(dst->data[plane], src->data[plane], - dst->linesize[plane] * lines); + dst->linesize[plane] * lines); } static void copy_frame_data(struct obs_source_frame *dst, - const struct obs_source_frame *src) + const struct obs_source_frame *src) { - dst->flip = src->flip; - dst->full_range = src->full_range; - dst->timestamp = src->timestamp; + dst->flip = src->flip; + dst->full_range = src->full_range; + dst->timestamp = src->timestamp; memcpy(dst->color_matrix, src->color_matrix, sizeof(float) * 16); if (!dst->full_range) { size_t const size = sizeof(float) * 3; @@ -2281,16 +2520,17 @@ switch (src->format) { case VIDEO_FORMAT_I420: copy_frame_data_plane(dst, src, 0, dst->height); - copy_frame_data_plane(dst, src, 1, dst->height/2); - copy_frame_data_plane(dst, src, 2, dst->height/2); + copy_frame_data_plane(dst, src, 1, dst->height / 2); + copy_frame_data_plane(dst, src, 2, dst->height / 2); break; case VIDEO_FORMAT_NV12: copy_frame_data_plane(dst, src, 0, dst->height); - copy_frame_data_plane(dst, src, 1, dst->height/2); + copy_frame_data_plane(dst, src, 1, dst->height / 2); break; case VIDEO_FORMAT_I444: + case VIDEO_FORMAT_I422: copy_frame_data_plane(dst, src, 0, dst->height); copy_frame_data_plane(dst, src, 1, dst->height); copy_frame_data_plane(dst, src, 2, dst->height); @@ -2304,28 +2544,44 @@ case VIDEO_FORMAT_BGRA: case VIDEO_FORMAT_BGRX: case VIDEO_FORMAT_Y800: + case VIDEO_FORMAT_BGR3: + case VIDEO_FORMAT_AYUV: + copy_frame_data_plane(dst, src, 0, dst->height); + break; + + case VIDEO_FORMAT_I40A: + copy_frame_data_plane(dst, src, 0, dst->height); + copy_frame_data_plane(dst, src, 1, dst->height / 2); + copy_frame_data_plane(dst, src, 2, dst->height / 2); + copy_frame_data_plane(dst, src, 3, dst->height); + break; + + case VIDEO_FORMAT_I42A: + case VIDEO_FORMAT_YUVA: copy_frame_data_plane(dst, src, 0, dst->height); + copy_frame_data_plane(dst, src, 1, dst->height); + copy_frame_data_plane(dst, src, 2, dst->height); + copy_frame_data_plane(dst, src, 3, dst->height); break; } } void obs_source_frame_copy(struct obs_source_frame *dst, - const struct obs_source_frame *src) + const struct obs_source_frame *src) { copy_frame_data(dst, src); } static inline bool async_texture_changed(struct obs_source *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { enum convert_type prev, cur; prev = get_convert_type(source->async_cache_format, - source->async_cache_full_range); - cur = get_convert_type(frame->format, frame->full_range); + source->async_cache_full_range); + cur = get_convert_type(frame->format, frame->full_range); - return source->async_cache_width != frame->width || - source->async_cache_height != frame->height || - prev != cur; + return source->async_cache_width != frame->width || + source->async_cache_height != frame->height || prev != cur; } static inline void free_async_cache(struct obs_source *source) @@ -2358,8 +2614,8 @@ #define MAX_ASYNC_FRAMES 30 //if return value is not null then do (os_atomic_dec_long(&output->refs) == 0) && obs_source_frame_destroy(output) -static inline struct obs_source_frame *cache_video(struct obs_source *source, - const struct obs_source_frame *frame) +static inline struct obs_source_frame * +cache_video(struct obs_source *source, const struct obs_source_frame *frame) { struct obs_source_frame *new_frame = NULL; @@ -2374,16 +2630,19 @@ if (async_texture_changed(source, frame)) { free_async_cache(source); - source->async_cache_width = frame->width; - source->async_cache_height = frame->height; - source->async_cache_format = frame->format; - source->async_cache_full_range = frame->full_range; + source->async_cache_width = frame->width; + source->async_cache_height = frame->height; } + const enum video_format format = frame->format; + source->async_cache_format = format; + source->async_cache_full_range = frame->full_range; + for (size_t i = 0; i < source->async_cache.num; i++) { struct async_frame *af = &source->async_cache.array[i]; if (!af->used) { new_frame = af->frame; + new_frame->format = format; af->used = true; af->unused_count = 0; break; @@ -2394,10 +2653,9 @@ if (!new_frame) { struct async_frame new_af; - enum video_format format = frame->format; - new_frame = obs_source_frame_create(format, - frame->width, frame->height); + new_frame = obs_source_frame_create(format, frame->width, + frame->height); new_af.frame = new_frame; new_af.used = true; new_af.unused_count = 0; @@ -2415,8 +2673,9 @@ return new_frame; } -static void obs_source_output_video_internal(obs_source_t *source, - const struct obs_source_frame *frame) +static void +obs_source_output_video_internal(obs_source_t *source, + const struct obs_source_frame *frame) { if (!obs_source_valid(source, "obs_source_output_video")) return; @@ -2426,8 +2685,8 @@ return; } - struct obs_source_frame *output = !!frame ? - cache_video(source, frame) : NULL; + struct obs_source_frame *output = !!frame ? cache_video(source, frame) + : NULL; /* ------------------------------------------- */ pthread_mutex_lock(&source->async_mutex); @@ -2444,7 +2703,7 @@ } void obs_source_output_video(obs_source_t *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { if (!frame) { obs_source_output_video_internal(source, NULL); @@ -2452,15 +2711,14 @@ } struct obs_source_frame new_frame = *frame; - new_frame.full_range = format_is_yuv(frame->format) - ? new_frame.full_range - : true; + new_frame.full_range = + format_is_yuv(frame->format) ? new_frame.full_range : true; obs_source_output_video_internal(source, &new_frame); } void obs_source_output_video2(obs_source_t *source, - const struct obs_source_frame2 *frame) + const struct obs_source_frame2 *frame) { if (!frame) { obs_source_output_video_internal(source, NULL); @@ -2468,8 +2726,8 @@ } struct obs_source_frame new_frame; - enum video_range_type range = resolve_video_range(frame->format, - frame->range); + enum video_range_type range = + resolve_video_range(frame->format, frame->range); for (size_t i = 0; i < MAX_AV_PLANES; i++) { new_frame.data[i] = frame->data[i]; @@ -2484,28 +2742,29 @@ new_frame.flip = frame->flip; memcpy(&new_frame.color_matrix, &frame->color_matrix, - sizeof(frame->color_matrix)); + sizeof(frame->color_matrix)); memcpy(&new_frame.color_range_min, &frame->color_range_min, - sizeof(frame->color_range_min)); + sizeof(frame->color_range_min)); memcpy(&new_frame.color_range_max, &frame->color_range_max, - sizeof(frame->color_range_max)); + sizeof(frame->color_range_max)); obs_source_output_video_internal(source, &new_frame); } static inline bool preload_frame_changed(obs_source_t *source, - const struct obs_source_frame *in) + const struct obs_source_frame *in) { if (!source->async_preload_frame) return true; - return in->width != source->async_preload_frame->width || + return in->width != source->async_preload_frame->width || in->height != source->async_preload_frame->height || in->format != source->async_preload_frame->format; } -static void obs_source_preload_video_internal(obs_source_t *source, - const struct obs_source_frame *frame) +static void +obs_source_preload_video_internal(obs_source_t *source, + const struct obs_source_frame *frame) { if (!obs_source_valid(source, "obs_source_preload_video")) return; @@ -2517,16 +2776,13 @@ if (preload_frame_changed(source, frame)) { obs_source_frame_destroy(source->async_preload_frame); source->async_preload_frame = obs_source_frame_create( - frame->format, - frame->width, - frame->height); + frame->format, frame->width, frame->height); } copy_frame_data(source->async_preload_frame, frame); set_async_texture_size(source, source->async_preload_frame); - update_async_texture(source, source->async_preload_frame, - source->async_texture, - source->async_texrender); + update_async_textures(source, source->async_preload_frame, + source->async_textures, source->async_texrender); source->last_frame_ts = frame->timestamp; @@ -2534,7 +2790,7 @@ } void obs_source_preload_video(obs_source_t *source, - const struct obs_source_frame *frame) + const struct obs_source_frame *frame) { if (!frame) { obs_source_preload_video_internal(source, NULL); @@ -2542,15 +2798,14 @@ } struct obs_source_frame new_frame = *frame; - new_frame.full_range = format_is_yuv(frame->format) - ? new_frame.full_range - : true; + new_frame.full_range = + format_is_yuv(frame->format) ? new_frame.full_range : true; obs_source_preload_video_internal(source, &new_frame); } void obs_source_preload_video2(obs_source_t *source, - const struct obs_source_frame2 *frame) + const struct obs_source_frame2 *frame) { if (!frame) { obs_source_preload_video_internal(source, NULL); @@ -2558,8 +2813,8 @@ } struct obs_source_frame new_frame; - enum video_range_type range = resolve_video_range(frame->format, - frame->range); + enum video_range_type range = + resolve_video_range(frame->format, frame->range); for (size_t i = 0; i < MAX_AV_PLANES; i++) { new_frame.data[i] = frame->data[i]; @@ -2574,11 +2829,11 @@ new_frame.flip = frame->flip; memcpy(&new_frame.color_matrix, &frame->color_matrix, - sizeof(frame->color_matrix)); + sizeof(frame->color_matrix)); memcpy(&new_frame.color_range_min, &frame->color_range_min, - sizeof(frame->color_range_min)); + sizeof(frame->color_range_min)); memcpy(&new_frame.color_range_max, &frame->color_range_max, - sizeof(frame->color_range_max)); + sizeof(frame->color_range_max)); obs_source_preload_video_internal(source, &new_frame); } @@ -2594,26 +2849,26 @@ pthread_mutex_lock(&source->audio_buf_mutex); sys_ts = (source->monitoring_type != OBS_MONITORING_TYPE_MONITOR_ONLY) - ? os_gettime_ns() - : 0; + ? os_gettime_ns() + : 0; reset_audio_timing(source, source->last_frame_ts, sys_ts); reset_audio_data(source, sys_ts); pthread_mutex_unlock(&source->audio_buf_mutex); } -static inline struct obs_audio_data *filter_async_audio(obs_source_t *source, - struct obs_audio_data *in) +static inline struct obs_audio_data * +filter_async_audio(obs_source_t *source, struct obs_audio_data *in) { size_t i; for (i = source->filters.num; i > 0; i--) { - struct obs_source *filter = source->filters.array[i-1]; + struct obs_source *filter = source->filters.array[i - 1]; if (!filter->enabled) continue; if (filter->context.data && filter->info.filter_audio) { in = filter->info.filter_audio(filter->context.data, - in); + in); if (!in) return NULL; } @@ -2623,49 +2878,49 @@ } static inline void reset_resampler(obs_source_t *source, - const struct obs_source_audio *audio) + const struct obs_source_audio *audio) { const struct audio_output_info *obs_info; struct resample_info output_info; obs_info = audio_output_get_info(obs->audio.audio); - output_info.format = obs_info->format; - output_info.samples_per_sec = obs_info->samples_per_sec; - output_info.speakers = obs_info->speakers; + output_info.format = obs_info->format; + output_info.samples_per_sec = obs_info->samples_per_sec; + output_info.speakers = obs_info->speakers; - source->sample_info.format = audio->format; + source->sample_info.format = audio->format; source->sample_info.samples_per_sec = audio->samples_per_sec; - source->sample_info.speakers = audio->speakers; + source->sample_info.speakers = audio->speakers; audio_resampler_destroy(source->resampler); source->resampler = NULL; source->resample_offset = 0; if (source->sample_info.samples_per_sec == obs_info->samples_per_sec && - source->sample_info.format == obs_info->format && - source->sample_info.speakers == obs_info->speakers) { + source->sample_info.format == obs_info->format && + source->sample_info.speakers == obs_info->speakers) { source->audio_failed = false; return; } - source->resampler = audio_resampler_create(&output_info, - &source->sample_info); + source->resampler = + audio_resampler_create(&output_info, &source->sample_info); source->audio_failed = source->resampler == NULL; if (source->resampler == NULL) blog(LOG_ERROR, "creation of resampler failed"); } -static void copy_audio_data(obs_source_t *source, - const uint8_t *const data[], uint32_t frames, uint64_t ts) +static void copy_audio_data(obs_source_t *source, const uint8_t *const data[], + uint32_t frames, uint64_t ts) { - size_t planes = audio_output_get_planes(obs->audio.audio); + size_t planes = audio_output_get_planes(obs->audio.audio); size_t blocksize = audio_output_get_block_size(obs->audio.audio); - size_t size = (size_t)frames * blocksize; - bool resize = source->audio_storage_size < size; + size_t size = (size_t)frames * blocksize; + bool resize = source->audio_storage_size < size; - source->audio_data.frames = frames; + source->audio_data.frames = frames; source->audio_data.timestamp = ts; for (size_t i = 0; i < planes; i++) { @@ -2687,7 +2942,7 @@ { size_t channels = audio_output_get_channels(obs->audio.audio); const float channels_i = 1.0f / (float)channels; - float **data = (float**)source->audio_data.data; + float **data = (float **)source->audio_data.data; for (size_t channel = 1; channel < channels; channel++) { for (uint32_t frame = 0; frame < frames; frame++) @@ -2704,17 +2959,17 @@ } static void process_audio_balancing(struct obs_source *source, uint32_t frames, - float balance, enum obs_balance_type type) + float balance, enum obs_balance_type type) { - float **data = (float**)source->audio_data.data; + float **data = (float **)source->audio_data.data; - switch(type) { + switch (type) { case OBS_BALANCE_TYPE_SINE_LAW: for (uint32_t frame = 0; frame < frames; frame++) { data[0][frame] = data[0][frame] * - sinf((1.0f - balance) * (M_PI/2.0f)); - data[1][frame] = data[1][frame] * - sinf(balance * (M_PI/2.0f)); + sinf((1.0f - balance) * (M_PI / 2.0f)); + data[1][frame] = + data[1][frame] * sinf(balance * (M_PI / 2.0f)); } break; case OBS_BALANCE_TYPE_SQUARE_LAW: @@ -2736,27 +2991,27 @@ /* resamples/remixes new audio to the designated main audio output format */ static void process_audio(obs_source_t *source, - const struct obs_source_audio *audio) + const struct obs_source_audio *audio) { uint32_t frames = audio->frames; bool mono_output; if (source->sample_info.samples_per_sec != audio->samples_per_sec || - source->sample_info.format != audio->format || - source->sample_info.speakers != audio->speakers) + source->sample_info.format != audio->format || + source->sample_info.speakers != audio->speakers) reset_resampler(source, audio); if (source->audio_failed) return; if (source->resampler) { - uint8_t *output[MAX_AV_PLANES]; + uint8_t *output[MAX_AV_PLANES]; memset(output, 0, sizeof(output)); - audio_resampler_resample(source->resampler, - output, &frames, &source->resample_offset, - audio->data, audio->frames); + audio_resampler_resample(source->resampler, output, &frames, + &source->resample_offset, audio->data, + audio->frames); copy_audio_data(source, (const uint8_t *const *)output, frames, audio->timestamp); @@ -2770,7 +3025,7 @@ if (!mono_output && source->sample_info.speakers == SPEAKERS_STEREO && (source->balance > 0.51f || source->balance < 0.49f)) { process_audio_balancing(source, frames, source->balance, - OBS_BALANCE_TYPE_SINE_LAW); + OBS_BALANCE_TYPE_SINE_LAW); } if (!mono_output && (source->flags & OBS_SOURCE_FLAG_FORCE_MONO) != 0) @@ -2778,7 +3033,7 @@ } void obs_source_output_audio(obs_source_t *source, - const struct obs_source_audio *audio) + const struct obs_source_audio *audio) { struct obs_audio_data *output; @@ -2798,7 +3053,7 @@ for (int i = 0; i < MAX_AV_PLANES; i++) data.data[i] = output->data[i]; - data.frames = output->frames; + data.frames = output->frames; data.timestamp = output->timestamp; pthread_mutex_lock(&source->audio_mutex); @@ -2829,7 +3084,7 @@ static bool ready_async_frame(obs_source_t *source, uint64_t sys_time) { struct obs_source_frame *next_frame = source->async_frames.array[0]; - struct obs_source_frame *frame = NULL; + struct obs_source_frame *frame = NULL; uint64_t sys_offset = sys_time - source->last_sys_timestamp; uint64_t frame_time = next_frame->timestamp; uint64_t frame_offset = 0; @@ -2846,12 +3101,13 @@ } #if DEBUG_ASYNC_FRAMES - blog(LOG_DEBUG, "source->last_frame_ts: %llu, frame_time: %llu, " - "sys_offset: %llu, frame_offset: %llu, " - "number of frames: %lu", - source->last_frame_ts, frame_time, sys_offset, - frame_time - source->last_frame_ts, - (unsigned long)source->async_frames.num); + blog(LOG_DEBUG, + "source->last_frame_ts: %llu, frame_time: %llu, " + "sys_offset: %llu, frame_offset: %llu, " + "number of frames: %lu", + source->last_frame_ts, frame_time, sys_offset, + frame_time - source->last_frame_ts, + (unsigned long)source->async_frames.num); #endif /* account for timestamp invalidation */ @@ -2879,11 +3135,11 @@ da_erase(source->async_frames, 0); #if DEBUG_ASYNC_FRAMES - blog(LOG_DEBUG, "new frame, " - "source->last_frame_ts: %llu, " - "next_frame->timestamp: %llu", - source->last_frame_ts, - next_frame->timestamp); + blog(LOG_DEBUG, + "new frame, " + "source->last_frame_ts: %llu, " + "next_frame->timestamp: %llu", + source->last_frame_ts, next_frame->timestamp); #endif remove_async_frame(source, frame); @@ -2903,7 +3159,7 @@ next_frame->timestamp - frame_offset; } - frame_time = next_frame->timestamp; + frame_time = next_frame->timestamp; frame_offset = frame_time - source->last_frame_ts; } @@ -2916,7 +3172,7 @@ } static inline struct obs_source_frame *get_closest_frame(obs_source_t *source, - uint64_t sys_time) + uint64_t sys_time) { if (!source->async_frames.num) return NULL; @@ -2962,7 +3218,7 @@ } void obs_source_release_frame(obs_source_t *source, - struct obs_source_frame *frame) + struct obs_source_frame *frame) { if (!frame) return; @@ -2983,8 +3239,9 @@ const char *obs_source_get_name(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_name") ? - source->context.name : NULL; + return obs_source_valid(source, "obs_source_get_name") + ? source->context.name + : NULL; } void obs_source_set_name(obs_source_t *source, const char *name) @@ -2993,7 +3250,7 @@ return; if (!name || !*name || !source->context.name || - strcmp(name, source->context.name) != 0) { + strcmp(name, source->context.name) != 0) { struct calldata data; char *prev_name = bstrdup(source->context.name); obs_context_data_setname(&source->context, name); @@ -3004,7 +3261,7 @@ calldata_set_string(&data, "prev_name", prev_name); if (!source->context.private) signal_handler_signal(obs->signals, "source_rename", - &data); + &data); signal_handler_signal(source->context.signals, "rename", &data); calldata_free(&data); bfree(prev_name); @@ -3013,21 +3270,23 @@ enum obs_source_type obs_source_get_type(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_type") ? - source->info.type : OBS_SOURCE_TYPE_INPUT; + return obs_source_valid(source, "obs_source_get_type") + ? source->info.type + : OBS_SOURCE_TYPE_INPUT; } const char *obs_source_get_id(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_id") ? - source->info.id : NULL; + return obs_source_valid(source, "obs_source_get_id") ? source->info.id + : NULL; } static inline void render_filter_bypass(obs_source_t *target, - gs_effect_t *effect, const char *tech_name) + gs_effect_t *effect, + const char *tech_name) { - gs_technique_t *tech = gs_effect_get_technique(effect, tech_name); - size_t passes, i; + gs_technique_t *tech = gs_effect_get_technique(effect, tech_name); + size_t passes, i; passes = gs_technique_begin(tech); for (i = 0; i < passes; i++) { @@ -3039,11 +3298,12 @@ } static inline void render_filter_tex(gs_texture_t *tex, gs_effect_t *effect, - uint32_t width, uint32_t height, const char *tech_name) + uint32_t width, uint32_t height, + const char *tech_name) { - gs_technique_t *tech = gs_effect_get_technique(effect, tech_name); - gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); - size_t passes, i; + gs_technique_t *tech = gs_effect_get_technique(effect, tech_name); + gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); + size_t passes, i; gs_effect_set_texture(image, tex); @@ -3057,43 +3317,43 @@ } static inline bool can_bypass(obs_source_t *target, obs_source_t *parent, - uint32_t parent_flags, - enum obs_allow_direct_render allow_direct) + uint32_t parent_flags, + enum obs_allow_direct_render allow_direct) { return (target == parent) && - (allow_direct == OBS_ALLOW_DIRECT_RENDERING) && - ((parent_flags & OBS_SOURCE_CUSTOM_DRAW) == 0) && - ((parent_flags & OBS_SOURCE_ASYNC) == 0); + (allow_direct == OBS_ALLOW_DIRECT_RENDERING) && + ((parent_flags & OBS_SOURCE_CUSTOM_DRAW) == 0) && + ((parent_flags & OBS_SOURCE_ASYNC) == 0); } bool obs_source_process_filter_begin(obs_source_t *filter, - enum gs_color_format format, - enum obs_allow_direct_render allow_direct) + enum gs_color_format format, + enum obs_allow_direct_render allow_direct) { obs_source_t *target, *parent; - uint32_t parent_flags; - int cx, cy; + uint32_t parent_flags; + int cx, cy; if (!obs_ptr_valid(filter, "obs_source_process_filter_begin")) return false; - target = obs_filter_get_target(filter); - parent = obs_filter_get_parent(filter); + target = obs_filter_get_target(filter); + parent = obs_filter_get_parent(filter); if (!target) { blog(LOG_INFO, "filter '%s' being processed with no target!", - filter->context.name); + filter->context.name); return false; } if (!parent) { blog(LOG_INFO, "filter '%s' being processed with no parent!", - filter->context.name); + filter->context.name); return false; } parent_flags = parent->info.output_flags; - cx = get_base_width(target); - cy = get_base_height(target); + cx = get_base_width(target); + cy = get_base_height(target); filter->allow_direct = allow_direct; @@ -3111,8 +3371,8 @@ } if (!filter->filter_texrender) - filter->filter_texrender = gs_texrender_create(format, - GS_ZS_NONE); + filter->filter_texrender = + gs_texrender_create(format, GS_ZS_NONE); gs_blend_state_push(); gs_blend_function(GS_BLEND_ONE, GS_BLEND_ZERO); @@ -3138,17 +3398,19 @@ return true; } -void obs_source_process_filter_tech_end(obs_source_t *filter, gs_effect_t *effect, - uint32_t width, uint32_t height, const char *tech_name) +void obs_source_process_filter_tech_end(obs_source_t *filter, + gs_effect_t *effect, uint32_t width, + uint32_t height, const char *tech_name) { obs_source_t *target, *parent; gs_texture_t *texture; - uint32_t parent_flags; + uint32_t parent_flags; - if (!filter) return; + if (!filter) + return; - target = obs_filter_get_target(filter); - parent = obs_filter_get_parent(filter); + target = obs_filter_get_target(filter); + parent = obs_filter_get_parent(filter); if (!target || !parent) return; @@ -3161,33 +3423,20 @@ render_filter_bypass(target, effect, tech); } else { texture = gs_texrender_get_texture(filter->filter_texrender); - render_filter_tex(texture, effect, width, height, tech); + if (texture) { + render_filter_tex(texture, effect, width, height, tech); + } } } - void obs_source_process_filter_end(obs_source_t *filter, gs_effect_t *effect, - uint32_t width, uint32_t height) + uint32_t width, uint32_t height) { - obs_source_t *target, *parent; - gs_texture_t *texture; - uint32_t parent_flags; - if (!obs_ptr_valid(filter, "obs_source_process_filter_end")) return; - target = obs_filter_get_target(filter); - parent = obs_filter_get_parent(filter); - parent_flags = parent->info.output_flags; - - if (can_bypass(target, parent, parent_flags, filter->allow_direct)) { - render_filter_bypass(target, effect, "Draw"); - } else { - texture = gs_texrender_get_texture(filter->filter_texrender); - if (texture) - render_filter_tex(texture, effect, width, height, - "Draw"); - } + obs_source_process_filter_tech_end(filter, effect, width, height, + "Draw"); } void obs_source_skip_video_filter(obs_source_t *filter) @@ -3222,24 +3471,24 @@ signal_handler_t *obs_source_get_signal_handler(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_signal_handler") ? - source->context.signals : NULL; + return obs_source_valid(source, "obs_source_get_signal_handler") + ? source->context.signals + : NULL; } proc_handler_t *obs_source_get_proc_handler(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_proc_handler") ? - source->context.procs : NULL; + return obs_source_valid(source, "obs_source_get_proc_handler") + ? source->context.procs + : NULL; } void obs_source_set_volume(obs_source_t *source, float volume) { if (obs_source_valid(source, "obs_source_set_volume")) { - struct audio_action action = { - .timestamp = os_gettime_ns(), - .type = AUDIO_ACTION_VOL, - .vol = volume - }; + struct audio_action action = {.timestamp = os_gettime_ns(), + .type = AUDIO_ACTION_VOL, + .vol = volume}; struct calldata data; uint8_t stack[128]; @@ -3251,7 +3500,7 @@ signal_handler_signal(source->context.signals, "volume", &data); if (!source->context.private) signal_handler_signal(obs->signals, "source_volume", - &data); + &data); volume = (float)calldata_float(&data, "volume"); @@ -3265,8 +3514,9 @@ float obs_source_get_volume(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_volume") ? - source->user_volume : 0.0f; + return obs_source_valid(source, "obs_source_get_volume") + ? source->user_volume + : 0.0f; } void obs_source_set_sync_offset(obs_source_t *source, int64_t offset) @@ -3280,7 +3530,7 @@ calldata_set_int(&data, "offset", offset); signal_handler_signal(source->context.signals, "audio_sync", - &data); + &data); source->sync_offset = calldata_int(&data, "offset"); } @@ -3288,8 +3538,9 @@ int64_t obs_source_get_sync_offset(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_sync_offset") ? - source->sync_offset : 0; + return obs_source_valid(source, "obs_source_get_sync_offset") + ? source->sync_offset + : 0; } struct source_enum_data { @@ -3298,18 +3549,19 @@ }; static void enum_source_active_tree_callback(obs_source_t *parent, - obs_source_t *child, void *param) + obs_source_t *child, void *param) { struct source_enum_data *data = param; bool is_transition = child->info.type == OBS_SOURCE_TYPE_TRANSITION; if (is_transition) - obs_transition_enum_sources(child, - enum_source_active_tree_callback, param); + obs_transition_enum_sources( + child, enum_source_active_tree_callback, param); if (child->info.enum_active_sources) { if (child->context.data) { - child->info.enum_active_sources(child->context.data, - enum_source_active_tree_callback, data); + child->info.enum_active_sources( + child->context.data, + enum_source_active_tree_callback, data); } } @@ -3317,8 +3569,8 @@ } void obs_source_enum_active_sources(obs_source_t *source, - obs_source_enum_proc_t enum_callback, - void *param) + obs_source_enum_proc_t enum_callback, + void *param) { bool is_transition; if (!data_valid(source, "obs_source_enum_active_sources")) @@ -3334,14 +3586,14 @@ obs_transition_enum_sources(source, enum_callback, param); if (source->info.enum_active_sources) source->info.enum_active_sources(source->context.data, - enum_callback, param); + enum_callback, param); obs_source_release(source); } void obs_source_enum_active_tree(obs_source_t *source, - obs_source_enum_proc_t enum_callback, - void *param) + obs_source_enum_proc_t enum_callback, + void *param) { struct source_enum_data data = {enum_callback, param}; bool is_transition; @@ -3356,33 +3608,36 @@ obs_source_addref(source); if (source->info.type == OBS_SOURCE_TYPE_TRANSITION) - obs_transition_enum_sources(source, - enum_source_active_tree_callback, &data); + obs_transition_enum_sources( + source, enum_source_active_tree_callback, &data); if (source->info.enum_active_sources) - source->info.enum_active_sources(source->context.data, - enum_source_active_tree_callback, &data); + source->info.enum_active_sources( + source->context.data, enum_source_active_tree_callback, + &data); obs_source_release(source); } static void enum_source_full_tree_callback(obs_source_t *parent, - obs_source_t *child, void *param) + obs_source_t *child, void *param) { struct source_enum_data *data = param; bool is_transition = child->info.type == OBS_SOURCE_TYPE_TRANSITION; if (is_transition) - obs_transition_enum_sources(child, - enum_source_full_tree_callback, param); + obs_transition_enum_sources( + child, enum_source_full_tree_callback, param); if (child->info.enum_all_sources) { if (child->context.data) { - child->info.enum_active_sources(child->context.data, - enum_source_full_tree_callback, data); + child->info.enum_active_sources( + child->context.data, + enum_source_full_tree_callback, data); } } else if (child->info.enum_active_sources) { if (child->context.data) { - child->info.enum_active_sources(child->context.data, - enum_source_full_tree_callback, data); + child->info.enum_active_sources( + child->context.data, + enum_source_full_tree_callback, data); } } @@ -3390,8 +3645,8 @@ } static void obs_source_enum_full_tree(obs_source_t *source, - obs_source_enum_proc_t enum_callback, - void *param) + obs_source_enum_proc_t enum_callback, + void *param) { struct source_enum_data data = {enum_callback, param}; bool is_transition; @@ -3406,16 +3661,18 @@ obs_source_addref(source); if (source->info.type == OBS_SOURCE_TYPE_TRANSITION) - obs_transition_enum_sources(source, - enum_source_full_tree_callback, &data); + obs_transition_enum_sources( + source, enum_source_full_tree_callback, &data); if (source->info.enum_all_sources) { source->info.enum_all_sources(source->context.data, - enum_source_full_tree_callback, &data); + enum_source_full_tree_callback, + &data); } else if (source->info.enum_active_sources) { source->info.enum_active_sources(source->context.data, - enum_source_full_tree_callback, &data); + enum_source_full_tree_callback, + &data); } obs_source_release(source); @@ -3427,7 +3684,7 @@ }; static void check_descendant(obs_source_t *parent, obs_source_t *child, - void *param) + void *param) { struct descendant_info *info = param; if (child == info->target || parent == info->target) @@ -3444,7 +3701,7 @@ return false; if (parent == child) { blog(LOG_WARNING, "obs_source_add_active_child: " - "parent == child"); + "parent == child"); return false; } @@ -3484,7 +3741,7 @@ if (source->info.save) source->info.save(source->context.data, - source->context.settings); + source->context.settings); } void obs_source_load(obs_source_t *source) @@ -3493,21 +3750,23 @@ return; if (source->info.load) source->info.load(source->context.data, - source->context.settings); + source->context.settings); obs_source_dosignal(source, "source_load", "load"); } bool obs_source_active(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_active") ? - source->activate_refs != 0 : false; + return obs_source_valid(source, "obs_source_active") + ? source->activate_refs != 0 + : false; } bool obs_source_showing(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_showing") ? - source->show_refs != 0 : false; + return obs_source_valid(source, "obs_source_showing") + ? source->show_refs != 0 + : false; } static inline void signal_flags_updated(obs_source_t *source) @@ -3543,8 +3802,8 @@ uint32_t obs_source_get_flags(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_flags") ? - source->flags : 0; + return obs_source_valid(source, "obs_source_get_flags") ? source->flags + : 0; } void obs_source_set_audio_mixers(obs_source_t *source, uint32_t mixers) @@ -3582,8 +3841,8 @@ } void obs_source_draw_set_color_matrix(const struct matrix4 *color_matrix, - const struct vec3 *color_range_min, - const struct vec3 *color_range_max) + const struct vec3 *color_range_min, + const struct vec3 *color_range_max) { struct vec3 color_range_min_def; struct vec3 color_range_max_def; @@ -3598,7 +3857,7 @@ if (!effect) { blog(LOG_WARNING, "obs_source_draw_set_color_matrix: no " - "active effect!"); + "active effect!"); return; } @@ -3615,12 +3874,12 @@ range_max = gs_effect_get_param_by_name(effect, "color_range_max"); gs_effect_set_matrix4(matrix, color_matrix); - gs_effect_set_val(range_min, color_range_min, sizeof(float)*3); - gs_effect_set_val(range_max, color_range_max, sizeof(float)*3); + gs_effect_set_val(range_min, color_range_min, sizeof(float) * 3); + gs_effect_set_val(range_max, color_range_max, sizeof(float) * 3); } void obs_source_draw(gs_texture_t *texture, int x, int y, uint32_t cx, - uint32_t cy, bool flip) + uint32_t cy, bool flip) { gs_effect_t *effect = gs_get_effect(); bool change_pos = (x != 0 || y != 0); @@ -3672,9 +3931,8 @@ obs_source_deactivate(source, MAIN_VIEW); } - void obs_source_enum_filters(obs_source_t *source, - obs_source_enum_proc_t callback, void *param) + obs_source_enum_proc_t callback, void *param) { if (!obs_source_valid(source, "obs_source_enum_filters")) return; @@ -3692,7 +3950,7 @@ } obs_source_t *obs_source_get_filter_by_name(obs_source_t *source, - const char *name) + const char *name) { obs_source_t *filter = NULL; @@ -3719,8 +3977,8 @@ bool obs_source_enabled(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_enabled") ? - source->enabled : false; + return obs_source_valid(source, "obs_source_enabled") ? source->enabled + : false; } void obs_source_set_enabled(obs_source_t *source, bool enabled) @@ -3742,19 +4000,17 @@ bool obs_source_muted(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_muted") ? - source->user_muted : false; + return obs_source_valid(source, "obs_source_muted") ? source->user_muted + : false; } void obs_source_set_muted(obs_source_t *source, bool muted) { struct calldata data; uint8_t stack[128]; - struct audio_action action = { - .timestamp = os_gettime_ns(), - .type = AUDIO_ACTION_MUTE, - .set = muted - }; + struct audio_action action = {.timestamp = os_gettime_ns(), + .type = AUDIO_ACTION_MUTE, + .set = muted}; if (!obs_source_valid(source, "obs_source_set_muted")) return; @@ -3773,27 +4029,27 @@ } static void source_signal_push_to_changed(obs_source_t *source, - const char *signal, bool enabled) + const char *signal, bool enabled) { struct calldata data; uint8_t stack[128]; calldata_init_fixed(&data, stack, sizeof(stack)); - calldata_set_ptr (&data, "source", source); + calldata_set_ptr(&data, "source", source); calldata_set_bool(&data, "enabled", enabled); signal_handler_signal(source->context.signals, signal, &data); } static void source_signal_push_to_delay(obs_source_t *source, - const char *signal, uint64_t delay) + const char *signal, uint64_t delay) { struct calldata data; uint8_t stack[128]; calldata_init_fixed(&data, stack, sizeof(stack)); - calldata_set_ptr (&data, "source", source); - calldata_set_bool(&data, "delay", delay); + calldata_set_ptr(&data, "source", source); + calldata_set_bool(&data, "delay", delay); signal_handler_signal(source->context.signals, signal, &data); } @@ -3820,14 +4076,14 @@ bool changed = source->push_to_mute_enabled != enabled; if (obs_source_get_output_flags(source) & OBS_SOURCE_AUDIO && changed) blog(LOG_INFO, "source '%s' %s push-to-mute", - obs_source_get_name(source), - enabled ? "enabled" : "disabled"); + obs_source_get_name(source), + enabled ? "enabled" : "disabled"); source->push_to_mute_enabled = enabled; if (changed) source_signal_push_to_changed(source, "push_to_mute_changed", - enabled); + enabled); pthread_mutex_unlock(&source->audio_mutex); } @@ -3878,14 +4134,14 @@ bool changed = source->push_to_talk_enabled != enabled; if (obs_source_get_output_flags(source) & OBS_SOURCE_AUDIO && changed) blog(LOG_INFO, "source '%s' %s push-to-talk", - obs_source_get_name(source), - enabled ? "enabled" : "disabled"); + obs_source_get_name(source), + enabled ? "enabled" : "disabled"); source->push_to_talk_enabled = enabled; if (changed) source_signal_push_to_changed(source, "push_to_talk_changed", - enabled); + enabled); pthread_mutex_unlock(&source->audio_mutex); } @@ -3917,27 +4173,28 @@ void *obs_source_get_type_data(obs_source_t *source) { return obs_source_valid(source, "obs_source_get_type_data") - ? source->info.type_data : NULL; + ? source->info.type_data + : NULL; } static float get_source_volume(obs_source_t *source, uint64_t os_time) { if (source->push_to_mute_enabled && source->push_to_mute_pressed) - source->push_to_mute_stop_time = os_time + - source->push_to_mute_delay * 1000000; + source->push_to_mute_stop_time = + os_time + source->push_to_mute_delay * 1000000; if (source->push_to_talk_enabled && source->push_to_talk_pressed) - source->push_to_talk_stop_time = os_time + - source->push_to_talk_delay * 1000000; + source->push_to_talk_stop_time = + os_time + source->push_to_talk_delay * 1000000; bool push_to_mute_active = source->push_to_mute_pressed || - os_time < source->push_to_mute_stop_time; + os_time < source->push_to_mute_stop_time; bool push_to_talk_active = source->push_to_talk_pressed || - os_time < source->push_to_talk_stop_time; + os_time < source->push_to_talk_stop_time; bool muted = !source->enabled || source->muted || - (source->push_to_mute_enabled && push_to_mute_active) || - (source->push_to_talk_enabled && !push_to_talk_active); + (source->push_to_mute_enabled && push_to_mute_active) || + (source->push_to_talk_enabled && !push_to_talk_active); if (muted || close_float(source->volume, 0.0f, 0.0001f)) return 0.0f; @@ -3948,7 +4205,7 @@ } static inline void multiply_output_audio(obs_source_t *source, size_t mix, - size_t channels, float vol) + size_t channels, float vol) { register float *out = source->audio_output_buf[mix][0]; register float *end = out + AUDIO_OUTPUT_FRAMES * channels; @@ -3958,7 +4215,7 @@ } static inline void multiply_vol_data(obs_source_t *source, size_t mix, - size_t channels, float *vol_data) + size_t channels, float *vol_data) { for (size_t ch = 0; ch < channels; ch++) { register float *out = source->audio_output_buf[mix][ch]; @@ -3971,22 +4228,26 @@ } static inline void apply_audio_action(obs_source_t *source, - const struct audio_action *action) + const struct audio_action *action) { switch (action->type) { case AUDIO_ACTION_VOL: - source->volume = action->vol; break; + source->volume = action->vol; + break; case AUDIO_ACTION_MUTE: - source->muted = action->set; break; + source->muted = action->set; + break; case AUDIO_ACTION_PTT: - source->push_to_talk_pressed = action->set; break; + source->push_to_talk_pressed = action->set; + break; case AUDIO_ACTION_PTM: - source->push_to_mute_pressed = action->set; break; + source->push_to_mute_pressed = action->set; + break; } } static void apply_audio_actions(obs_source_t *source, size_t channels, - size_t sample_rate) + size_t sample_rate) { float *vol_data = malloc(sizeof(float) * AUDIO_OUTPUT_FRAMES); float cur_vol = get_source_volume(source, source->audio_ts); @@ -4002,8 +4263,8 @@ if (timestamp < source->audio_ts) timestamp = source->audio_ts; - new_frame_num = conv_time_to_frames(sample_rate, - timestamp - source->audio_ts); + new_frame_num = conv_time_to_frames( + sample_rate, timestamp - source->audio_ts); if (new_frame_num >= AUDIO_OUTPUT_FRAMES) break; @@ -4034,7 +4295,7 @@ } static void apply_audio_volume(obs_source_t *source, uint32_t mixers, - size_t channels, size_t sample_rate) + size_t channels, size_t sample_rate) { struct audio_action action; bool actions_pending; @@ -4049,8 +4310,8 @@ pthread_mutex_unlock(&source->audio_actions_mutex); if (actions_pending) { - uint64_t duration = conv_frames_to_time(sample_rate, - AUDIO_OUTPUT_FRAMES); + uint64_t duration = + conv_frames_to_time(sample_rate, AUDIO_OUTPUT_FRAMES); if (action.timestamp < (source->audio_ts + duration)) { apply_audio_actions(source, channels, sample_rate); @@ -4064,8 +4325,8 @@ if (vol == 0.0f || mixers == 0) { memset(source->audio_output_buf[0][0], 0, - AUDIO_OUTPUT_FRAMES * sizeof(float) * - MAX_AUDIO_CHANNELS * MAX_AUDIO_MIXES); + AUDIO_OUTPUT_FRAMES * sizeof(float) * + MAX_AUDIO_CHANNELS * MAX_AUDIO_MIXES); return; } @@ -4078,7 +4339,7 @@ } static void custom_audio_render(obs_source_t *source, uint32_t mixers, - size_t channels, size_t sample_rate) + size_t channels, size_t sample_rate) { struct obs_source_audio_mix audio_data; bool success; @@ -4092,13 +4353,13 @@ if ((source->audio_mixers & mixers & (1 << mix)) != 0) { memset(source->audio_output_buf[mix][0], 0, - sizeof(float) * AUDIO_OUTPUT_FRAMES * - channels); + sizeof(float) * AUDIO_OUTPUT_FRAMES * channels); } } success = source->info.audio_render(source->context.data, &ts, - &audio_data, mixers, channels, sample_rate); + &audio_data, mixers, channels, + sample_rate); source->audio_ts = success ? ts : 0; source->audio_pending = !success; @@ -4113,18 +4374,52 @@ if ((source->audio_mixers & mix_bit) == 0) { memset(source->audio_output_buf[mix][0], 0, - sizeof(float) * AUDIO_OUTPUT_FRAMES * - channels); + sizeof(float) * AUDIO_OUTPUT_FRAMES * channels); } } apply_audio_volume(source, mixers, channels, sample_rate); } +static void audio_submix(obs_source_t *source, size_t channels, + size_t sample_rate) +{ + struct audio_output_data audio_data; + struct obs_source_audio audio = {0}; + bool success; + uint64_t ts; + + for (size_t ch = 0; ch < channels; ch++) { + audio_data.data[ch] = source->audio_mix_buf[ch]; + } + + memset(source->audio_mix_buf[0], 0, + sizeof(float) * AUDIO_OUTPUT_FRAMES * channels); + + success = source->info.audio_mix(source->context.data, &ts, &audio_data, + channels, sample_rate); + + if (!success) + return; + + for (size_t i = 0; i < channels; i++) + audio.data[i] = (const uint8_t *)audio_data.data[i]; + + audio.samples_per_sec = (uint32_t)sample_rate; + audio.frames = AUDIO_OUTPUT_FRAMES; + audio.format = AUDIO_FORMAT_FLOAT_PLANAR; + audio.speakers = (enum speaker_layout)channels; + audio.timestamp = ts; + + obs_source_output_audio(source, &audio); +} + static inline void process_audio_source_tick(obs_source_t *source, - uint32_t mixers, size_t channels, size_t sample_rate, - size_t size) + uint32_t mixers, size_t channels, + size_t sample_rate, size_t size) { + bool audio_submix = !!(source->info.output_flags & OBS_SOURCE_SUBMIX); + pthread_mutex_lock(&source->audio_buf_mutex); if (source->audio_input_buf[0].size < size) { @@ -4135,36 +4430,47 @@ for (size_t ch = 0; ch < channels; ch++) circlebuf_peek_front(&source->audio_input_buf[ch], - source->audio_output_buf[0][ch], - size); + source->audio_output_buf[0][ch], size); pthread_mutex_unlock(&source->audio_buf_mutex); for (size_t mix = 1; mix < MAX_AUDIO_MIXES; mix++) { uint32_t mix_and_val = (1 << mix); + if (audio_submix) { + if (mix > 1) + break; + + mixers = 1; + mix_and_val = 1; + } + if ((source->audio_mixers & mix_and_val) == 0 || (mixers & mix_and_val) == 0) { - memset(source->audio_output_buf[mix][0], - 0, size * channels); + memset(source->audio_output_buf[mix][0], 0, + size * channels); continue; } for (size_t ch = 0; ch < channels; ch++) memcpy(source->audio_output_buf[mix][ch], - source->audio_output_buf[0][ch], size); + source->audio_output_buf[0][ch], size); + } + + if (audio_submix) { + source->audio_pending = false; + return; } if ((source->audio_mixers & 1) == 0 || (mixers & 1) == 0) - memset(source->audio_output_buf[0][0], 0, - size * channels); + memset(source->audio_output_buf[0][0], 0, size * channels); apply_audio_volume(source, mixers, channels, sample_rate); source->audio_pending = false; } void obs_source_audio_render(obs_source_t *source, uint32_t mixers, - size_t channels, size_t sample_rate, size_t size) + size_t channels, size_t sample_rate, size_t size) { if (!source->audio_output_buf[0][0]) { source->audio_pending = true; @@ -4176,6 +4482,10 @@ return; } + if (source->info.audio_mix) { + audio_submix(source, channels, sample_rate); + } + if (!source->audio_ts) { source->audio_pending = true; return; @@ -4189,18 +4499,20 @@ if (!obs_source_valid(source, "obs_source_audio_pending")) return true; - return (is_composite_source(source) || is_audio_source(source)) ? - source->audio_pending : true; + return (is_composite_source(source) || is_audio_source(source)) + ? source->audio_pending + : true; } uint64_t obs_source_get_audio_timestamp(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_audio_timestamp") ? - source->audio_ts : 0; + return obs_source_valid(source, "obs_source_get_audio_timestamp") + ? source->audio_ts + : 0; } void obs_source_get_audio_mix(const obs_source_t *source, - struct obs_source_audio_mix *audio) + struct obs_source_audio_mix *audio) { if (!obs_source_valid(source, "obs_source_get_audio_mix")) return; @@ -4216,7 +4528,8 @@ } void obs_source_add_audio_capture_callback(obs_source_t *source, - obs_source_audio_capture_t callback, void *param) + obs_source_audio_capture_t callback, + void *param) { struct audio_cb_info info = {callback, param}; @@ -4228,12 +4541,13 @@ pthread_mutex_unlock(&source->audio_cb_mutex); } -void obs_source_remove_audio_capture_callback(obs_source_t *source, - obs_source_audio_capture_t callback, void *param) +void obs_source_remove_audio_capture_callback( + obs_source_t *source, obs_source_audio_capture_t callback, void *param) { struct audio_cb_info info = {callback, param}; - if (!obs_source_valid(source, "obs_source_remove_audio_capture_callback")) + if (!obs_source_valid(source, + "obs_source_remove_audio_capture_callback")) return; pthread_mutex_lock(&source->audio_cb_mutex); @@ -4242,7 +4556,7 @@ } void obs_source_set_monitoring_type(obs_source_t *source, - enum obs_monitoring_type type) + enum obs_monitoring_type type) { bool was_on; bool now_on; @@ -4267,11 +4581,12 @@ source->monitoring_type = type; } -enum obs_monitoring_type obs_source_get_monitoring_type( - const obs_source_t *source) +enum obs_monitoring_type +obs_source_get_monitoring_type(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_monitoring_type") ? - source->monitoring_type : OBS_MONITORING_TYPE_NONE; + return obs_source_valid(source, "obs_source_get_monitoring_type") + ? source->monitoring_type + : OBS_MONITORING_TYPE_NONE; } void obs_source_set_async_unbuffered(obs_source_t *source, bool unbuffered) @@ -4284,8 +4599,9 @@ bool obs_source_async_unbuffered(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_async_unbuffered") ? - source->async_unbuffered : false; + return obs_source_valid(source, "obs_source_async_unbuffered") + ? source->async_unbuffered + : false; } obs_data_t *obs_source_get_private_settings(obs_source_t *source) @@ -4313,8 +4629,9 @@ bool obs_source_async_decoupled(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_async_decoupled") ? - source->async_decoupled : false; + return obs_source_valid(source, "obs_source_async_decoupled") + ? source->async_decoupled + : false; } /* hidden/undocumented export to allow source type redefinition for scripts */ @@ -4348,6 +4665,7 @@ float obs_source_get_balance_value(const obs_source_t *source) { - return obs_source_valid(source, "obs_source_get_balance_value") ? - source->balance : 0.5f; + return obs_source_valid(source, "obs_source_get_balance_value") + ? source->balance + : 0.5f; }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-source.h -> obs-studio-24.0.0.tar.xz/libobs/obs-source.h
Changed
@@ -30,7 +30,6 @@ extern "C" { #endif - enum obs_source_type { OBS_SOURCE_TYPE_INPUT, OBS_SOURCE_TYPE_FILTER, @@ -57,7 +56,7 @@ * Unless SOURCE_ASYNC_VIDEO is specified, the source must include the * video_render callback in the source definition structure. */ -#define OBS_SOURCE_VIDEO (1<<0) +#define OBS_SOURCE_VIDEO (1 << 0) /** * Source has audio. @@ -66,10 +65,10 @@ * be automatically converted and uploaded. If used with SOURCE_ASYNC_VIDEO, * audio will automatically be synced up to the video output. */ -#define OBS_SOURCE_AUDIO (1<<1) +#define OBS_SOURCE_AUDIO (1 << 1) /** Async video flag (use OBS_SOURCE_ASYNC_VIDEO) */ -#define OBS_SOURCE_ASYNC (1<<2) +#define OBS_SOURCE_ASYNC (1 << 2) /** * Source passes raw video data via RAM. @@ -82,7 +81,7 @@ * obs_source_getframe to get the current frame data, and * obs_source_releaseframe to release the data when complete. */ -#define OBS_SOURCE_ASYNC_VIDEO (OBS_SOURCE_ASYNC | OBS_SOURCE_VIDEO) +#define OBS_SOURCE_ASYNC_VIDEO (OBS_SOURCE_ASYNC | OBS_SOURCE_VIDEO) /** * Source uses custom drawing, rather than a default effect. @@ -90,7 +89,7 @@ * If this flag is specified, the video_render callback will pass a NULL * effect, and effect-based filters will not use direct rendering. */ -#define OBS_SOURCE_CUSTOM_DRAW (1<<3) +#define OBS_SOURCE_CUSTOM_DRAW (1 << 3) /** * Source supports interaction. @@ -98,7 +97,7 @@ * When this is used, the source will receive interaction events * if they provide the necessary callbacks in the source definition structure. */ -#define OBS_SOURCE_INTERACTION (1<<5) +#define OBS_SOURCE_INTERACTION (1 << 5) /** * Source composites sub-sources @@ -109,7 +108,7 @@ * * This capability flag is always set for transitions. */ -#define OBS_SOURCE_COMPOSITE (1<<6) +#define OBS_SOURCE_COMPOSITE (1 << 6) /** * Source should not be fully duplicated @@ -118,12 +117,12 @@ * and should prefer to duplicate via holding references rather than full * duplication. */ -#define OBS_SOURCE_DO_NOT_DUPLICATE (1<<7) +#define OBS_SOURCE_DO_NOT_DUPLICATE (1 << 7) /** * Source is deprecated and should not be used */ -#define OBS_SOURCE_DEPRECATED (1<<8) +#define OBS_SOURCE_DEPRECATED (1 << 8) /** * Source cannot have its audio monitored @@ -133,17 +132,26 @@ * * This is used primarily with desktop audio capture sources. */ -#define OBS_SOURCE_DO_NOT_SELF_MONITOR (1<<9) +#define OBS_SOURCE_DO_NOT_SELF_MONITOR (1 << 9) /** * Source type is currently disabled and should not be shown to the user */ -#define OBS_SOURCE_CAP_DISABLED (1<<10) +#define OBS_SOURCE_CAP_DISABLED (1 << 10) + +/** + * Source should enable monitoring by default. Monitoring should be set by the + * frontend if this flag is set. + */ +#define OBS_SOURCE_MONITOR_BY_DEFAULT (1 << 11) + +/** Used internally for audio submixing */ +#define OBS_SOURCE_SUBMIX (1 << 12) /** @} */ typedef void (*obs_source_enum_proc_t)(obs_source_t *parent, - obs_source_t *child, void *param); + obs_source_t *child, void *param); struct obs_source_audio_mix { struct audio_output_data output[MAX_AUDIO_MIXES]; @@ -293,8 +301,8 @@ * @return New video frame data. This can defer video data to * be drawn later if time is needed for processing */ - struct obs_source_frame *(*filter_video)(void *data, - struct obs_source_frame *frame); + struct obs_source_frame *(*filter_video)( + void *data, struct obs_source_frame *frame); /** * Called to filter raw audio data. @@ -311,7 +319,7 @@ * until the filter is removed/destroyed. */ struct obs_audio_data *(*filter_audio)(void *data, - struct obs_audio_data *audio); + struct obs_audio_data *audio); /** * Called to enumerate all active sources being used within this @@ -323,8 +331,8 @@ * @param param User data to pass to callback */ void (*enum_active_sources)(void *data, - obs_source_enum_proc_t enum_callback, - void *param); + obs_source_enum_proc_t enum_callback, + void *param); /** * Called when saving a source. This is a separate function because @@ -357,9 +365,8 @@ * @param mouse_up Mouse event type (true if mouse-up) * @param click_count Mouse click count (1 for single click, etc.) */ - void (*mouse_click)(void *data, - const struct obs_mouse_event *event, - int32_t type, bool mouse_up, uint32_t click_count); + void (*mouse_click)(void *data, const struct obs_mouse_event *event, + int32_t type, bool mouse_up, uint32_t click_count); /** * Called when interacting with a source and a mouse-move occurs. * @@ -367,8 +374,8 @@ * @param event Mouse event properties * @param mouse_leave Mouse leave state (true if mouse left source) */ - void (*mouse_move)(void *data, - const struct obs_mouse_event *event, bool mouse_leave); + void (*mouse_move)(void *data, const struct obs_mouse_event *event, + bool mouse_leave); /** * Called when interacting with a source and a mouse-wheel occurs. @@ -378,9 +385,8 @@ * @param x_delta Movement delta in the horizontal direction * @param y_delta Movement delta in the vertical direction */ - void (*mouse_wheel)(void *data, - const struct obs_mouse_event *event, int x_delta, - int y_delta); + void (*mouse_wheel)(void *data, const struct obs_mouse_event *event, + int x_delta, int y_delta); /** * Called when interacting with a source and gain focus/lost focus event * occurs. @@ -399,7 +405,7 @@ * @param focus Key event type (true if mouse-up) */ void (*key_click)(void *data, const struct obs_key_event *event, - bool key_up); + bool key_up); /** * Called when the filter is removed from a source @@ -420,8 +426,9 @@ void (*free_type_data)(void *type_data); bool (*audio_render)(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio_output, - uint32_t mixers, size_t channels, size_t sample_rate); + struct obs_source_audio_mix *audio_output, + uint32_t mixers, size_t channels, + size_t sample_rate); /** * Called to enumerate all active and inactive sources being used @@ -435,14 +442,17 @@ * @param param User data to pass to callback */ void (*enum_all_sources)(void *data, - obs_source_enum_proc_t enum_callback, - void *param); + obs_source_enum_proc_t enum_callback, + void *param); void (*transition_start)(void *data); void (*transition_stop)(void *data); /** * Gets the default settings for this source + * + * If get_defaults is also defined both will be called, and the first + * call will be to get_defaults, then to get_defaults2. * * @param type_data The type_data variable of this structure * @param[out] settings Data to assign default settings to @@ -457,10 +467,14 @@ * @return The properties data */ obs_properties_t *(*get_properties2)(void *data, void *type_data); + + bool (*audio_mix)(void *data, uint64_t *ts_out, + struct audio_output_data *audio_output, + size_t channels, size_t sample_rate); }; EXPORT void obs_register_source_s(const struct obs_source_info *info, - size_t size); + size_t size); /** * Registers a source definition to the current obs context. This should be
View file
obs-studio-23.2.1.tar.xz/libobs/obs-ui.h -> obs-studio-24.0.0.tar.xz/libobs/obs-ui.h
Changed
@@ -119,8 +119,8 @@ /* ------------------------------------------------------------------------- */ -#define OBS_UI_SUCCESS 0 -#define OBS_UI_CANCEL -1 +#define OBS_UI_SUCCESS 0 +#define OBS_UI_CANCEL -1 #define OBS_UI_NOTFOUND -2 /** @@ -137,7 +137,7 @@ * OBS_UI_NOTFOUND if the UI callback was not found */ EXPORT int obs_exec_ui(const char *id, const char *task, const char *target, - void *data, void *ui_data); + void *data, void *ui_data); /** * Requests modeless UI to be created. Returns immediately. @@ -151,9 +151,8 @@ * @return Pointer/handle to the target-specific modeless object, or * NULL if not found or failed. */ -EXPORT void *obs_create_ui(const char *id, const char *task, - const char *target, void *data, void *ui_data); - +EXPORT void *obs_create_ui(const char *id, const char *task, const char *target, + void *data, void *ui_data); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/obs-video-gpu-encode.c -> obs-studio-24.0.0.tar.xz/libobs/obs-video-gpu-encode.c
Changed
@@ -86,6 +86,9 @@ } } + if (video_pause_check(&encoder->pause, timestamp)) + continue; + if (!encoder->start_ts) encoder->start_ts = timestamp; @@ -95,11 +98,11 @@ next_key++; success = encoder->info.encode_texture( - encoder->context.data, tf.handle, - encoder->cur_pts, lock_key, &next_key, - &pkt, &received); + encoder->context.data, tf.handle, + encoder->cur_pts, lock_key, &next_key, &pkt, + &received); send_off_encoder_packet(encoder, success, received, - &pkt); + &pkt); lock_key = next_key; @@ -114,14 +117,13 @@ if (--tf.count) { tf.timestamp += interval; - circlebuf_push_front(&video->gpu_encoder_queue, - &tf, sizeof(tf)); + circlebuf_push_front(&video->gpu_encoder_queue, &tf, + sizeof(tf)); video_output_inc_texture_skipped_frames(video->video); } else { - circlebuf_push_back( - &video->gpu_encoder_avail_queue, - &tf, sizeof(tf)); + circlebuf_push_back(&video->gpu_encoder_avail_queue, + &tf, sizeof(tf)); } pthread_mutex_unlock(&video->gpu_encoder_mutex); @@ -152,10 +154,9 @@ gs_texture_t *tex; gs_texture_t *tex_uv; - gs_texture_create_nv12( - &tex, &tex_uv, - ovi->output_width, ovi->output_height, - GS_RENDER_TARGET | GS_SHARED_KM_TEX); + gs_texture_create_nv12(&tex, &tex_uv, ovi->output_width, + ovi->output_height, + GS_RENDER_TARGET | GS_SHARED_KM_TEX); if (!tex) { return false; } @@ -163,21 +164,19 @@ uint32_t handle = gs_texture_get_shared_handle(tex); struct obs_tex_frame frame = { - .tex = tex, - .tex_uv = tex_uv, - .handle = handle - }; + .tex = tex, .tex_uv = tex_uv, .handle = handle}; circlebuf_push_back(&video->gpu_encoder_avail_queue, &frame, - sizeof(frame)); + sizeof(frame)); } if (os_sem_init(&video->gpu_encode_semaphore, 0) != 0) return false; - if (os_event_init(&video->gpu_encode_inactive, OS_EVENT_TYPE_MANUAL) != 0) + if (os_event_init(&video->gpu_encode_inactive, OS_EVENT_TYPE_MANUAL) != + 0) return false; - if (pthread_create(&video->gpu_encode_thread, NULL, - gpu_encode_thread, NULL) != 0) + if (pthread_create(&video->gpu_encode_thread, NULL, gpu_encode_thread, + NULL) != 0) return false; os_event_signal(video->gpu_encode_inactive); @@ -211,15 +210,15 @@ video->gpu_encode_inactive = NULL; } -#define free_circlebuf(x) \ - do { \ - while (x.size) { \ - struct obs_tex_frame frame; \ +#define free_circlebuf(x) \ + do { \ + while (x.size) { \ + struct obs_tex_frame frame; \ circlebuf_pop_front(&x, &frame, sizeof(frame)); \ - gs_texture_destroy(frame.tex); \ - gs_texture_destroy(frame.tex_uv); \ - } \ - circlebuf_free(&x); \ + gs_texture_destroy(frame.tex); \ + gs_texture_destroy(frame.tex_uv); \ + } \ + circlebuf_free(&x); \ } while (false) free_circlebuf(video->gpu_encoder_queue);
View file
obs-studio-23.2.1.tar.xz/libobs/obs-video.c -> obs-studio-24.0.0.tar.xz/libobs/obs-video.c
Changed
@@ -27,13 +27,13 @@ static uint64_t tick_sources(uint64_t cur_time, uint64_t last_time) { struct obs_core_data *data = &obs->data; - struct obs_source *source; - uint64_t delta_time; - float seconds; + struct obs_source *source; + uint64_t delta_time; + float seconds; if (!last_time) last_time = cur_time - - video_output_get_frame_time(obs->video.video); + video_output_get_frame_time(obs->video.video); delta_time = cur_time - last_time; seconds = (float)((double)delta_time / 1000000000.0); @@ -59,7 +59,7 @@ source = data->first_source; while (source) { struct obs_source *cur_source = obs_source_get_ref(source); - source = (struct obs_source*)source->context.next; + source = (struct obs_source *)source->context.next; if (cur_source) { obs_source_video_tick(cur_source, seconds); @@ -109,24 +109,25 @@ static inline void unmap_last_surface(struct obs_core_video *video) { - if (video->mapped_surface) { - gs_stagesurface_unmap(video->mapped_surface); - video->mapped_surface = NULL; + for (int c = 0; c < NUM_CHANNELS; ++c) { + if (video->mapped_surfaces[c]) { + gs_stagesurface_unmap(video->mapped_surfaces[c]); + video->mapped_surfaces[c] = NULL; + } } } static const char *render_main_texture_name = "render_main_texture"; -static inline void render_main_texture(struct obs_core_video *video, - int cur_texture) +static inline void render_main_texture(struct obs_core_video *video) { profile_start(render_main_texture_name); GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_MAIN_TEXTURE, - render_main_texture_name); + render_main_texture_name); struct vec4 clear_color; vec4_set(&clear_color, 0.0f, 0.0f, 0.0f, 0.0f); - gs_set_render_target(video->render_textures[cur_texture], NULL); + gs_set_render_target(video->render_texture, NULL); gs_clear(GS_CLEAR_COLOR, &clear_color, 1.0f, 0); set_render_size(video->base_width, video->base_height); @@ -137,34 +138,38 @@ struct draw_callback *callback; callback = obs->data.draw_callbacks.array + (i - 1); - callback->draw(callback->param, - video->base_width, video->base_height); + callback->draw(callback->param, video->base_width, + video->base_height); } pthread_mutex_unlock(&obs->data.draw_callbacks_mutex); obs_view_render(&obs->data.main_view); - video->textures_rendered[cur_texture] = true; + video->texture_rendered = true; GS_DEBUG_MARKER_END(); profile_end(render_main_texture_name); } -static inline gs_effect_t *get_scale_effect_internal( - struct obs_core_video *video) +static inline gs_effect_t * +get_scale_effect_internal(struct obs_core_video *video) { /* if the dimension is under half the size of the original image, * bicubic/lanczos can't sample enough pixels to create an accurate * image, so use the bilinear low resolution effect instead */ - if (video->output_width < (video->base_width / 2) && + if (video->output_width < (video->base_width / 2) && video->output_height < (video->base_height / 2)) { return video->bilinear_lowres_effect; } switch (video->scale_type) { - case OBS_SCALE_BILINEAR: return video->default_effect; - case OBS_SCALE_LANCZOS: return video->lanczos_effect; + case OBS_SCALE_BILINEAR: + return video->default_effect; + case OBS_SCALE_LANCZOS: + return video->lanczos_effect; + case OBS_SCALE_AREA: + return video->area_effect; case OBS_SCALE_BICUBIC: default:; } @@ -173,16 +178,16 @@ } static inline bool resolution_close(struct obs_core_video *video, - uint32_t width, uint32_t height) + uint32_t width, uint32_t height) { - long width_cmp = (long)video->base_width - (long)width; + long width_cmp = (long)video->base_width - (long)width; long height_cmp = (long)video->base_height - (long)height; return labs(width_cmp) <= 16 && labs(height_cmp) <= 16; } static inline gs_effect_t *get_scale_effect(struct obs_core_video *video, - uint32_t width, uint32_t height) + uint32_t width, uint32_t height) { if (resolution_close(video, width, height)) { return video->default_effect; @@ -191,55 +196,61 @@ * or bilinear by default */ gs_effect_t *effect = get_scale_effect_internal(video); if (!effect) - effect = !!video->bicubic_effect ? - video->bicubic_effect : - video->default_effect; + effect = !!video->bicubic_effect + ? video->bicubic_effect + : video->default_effect; return effect; } } static const char *render_output_texture_name = "render_output_texture"; -static inline void render_output_texture(struct obs_core_video *video, - int cur_texture, int prev_texture) +static inline gs_texture_t *render_output_texture(struct obs_core_video *video) { - profile_start(render_output_texture_name); - - gs_texture_t *texture = video->render_textures[prev_texture]; - gs_texture_t *target = video->output_textures[cur_texture]; - uint32_t width = gs_texture_get_width(target); - uint32_t height = gs_texture_get_height(target); - struct vec2 base_i; + gs_texture_t *texture = video->render_texture; + gs_texture_t *target = video->output_texture; + uint32_t width = gs_texture_get_width(target); + uint32_t height = gs_texture_get_height(target); - vec2_set(&base_i, - 1.0f / (float)video->base_width, - 1.0f / (float)video->base_height); - - gs_effect_t *effect = get_scale_effect(video, width, height); + gs_effect_t *effect = get_scale_effect(video, width, height); gs_technique_t *tech; if (video->ovi.output_format == VIDEO_FORMAT_RGBA) { tech = gs_effect_get_technique(effect, "DrawAlphaDivide"); } else { - tech = gs_effect_get_technique(effect, "DrawMatrix"); + if ((effect == video->default_effect) && + (width == video->base_width) && + (height == video->base_height)) + return texture; + + tech = gs_effect_get_technique(effect, "Draw"); } - gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); - gs_eparam_t *matrix = gs_effect_get_param_by_name(effect, - "color_matrix"); - gs_eparam_t *bres_i = gs_effect_get_param_by_name(effect, - "base_dimension_i"); - size_t passes, i; + profile_start(render_output_texture_name); - if (!video->textures_rendered[prev_texture]) - goto end; + gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); + gs_eparam_t *bres = + gs_effect_get_param_by_name(effect, "base_dimension"); + gs_eparam_t *bres_i = + gs_effect_get_param_by_name(effect, "base_dimension_i"); + size_t passes, i; gs_set_render_target(target, NULL); set_render_size(width, height); - if (bres_i) + if (bres) { + struct vec2 base; + vec2_set(&base, (float)video->base_width, + (float)video->base_height); + gs_effect_set_vec2(bres, &base); + } + + if (bres_i) { + struct vec2 base_i; + vec2_set(&base_i, 1.0f / (float)video->base_width, + 1.0f / (float)video->base_height); gs_effect_set_vec2(bres_i, &base_i); + } - gs_effect_set_val(matrix, video->color_matrix, sizeof(float) * 16); gs_effect_set_texture(image, texture); gs_enable_blending(false); @@ -252,165 +263,132 @@ gs_technique_end(tech); gs_enable_blending(true); - video->textures_output[cur_texture] = true; - -end: profile_end(render_output_texture_name); -} -static inline void set_eparam(gs_effect_t *effect, const char *name, float val) -{ - gs_eparam_t *param = gs_effect_get_param_by_name(effect, name); - gs_effect_set_float(param, val); + return target; } -static const char *render_convert_texture_name = "render_convert_texture"; -static void render_convert_texture(struct obs_core_video *video, - int cur_texture, int prev_texture) +static void render_convert_plane(gs_effect_t *effect, gs_texture_t *target, + const char *tech_name) { - profile_start(render_convert_texture_name); - - gs_texture_t *texture = video->output_textures[prev_texture]; - gs_texture_t *target = video->convert_textures[cur_texture]; - float fwidth = (float)video->output_width; - float fheight = (float)video->output_height; - size_t passes, i; - - gs_effect_t *effect = video->conversion_effect; - gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); - gs_technique_t *tech = gs_effect_get_technique(effect, - video->conversion_tech); - - if (!video->textures_output[prev_texture]) - goto end; + gs_technique_t *tech = gs_effect_get_technique(effect, tech_name); - set_eparam(effect, "u_plane_offset", (float)video->plane_offsets[1]); - set_eparam(effect, "v_plane_offset", (float)video->plane_offsets[2]); - set_eparam(effect, "width", fwidth); - set_eparam(effect, "height", fheight); - set_eparam(effect, "width_i", 1.0f / fwidth); - set_eparam(effect, "height_i", 1.0f / fheight); - set_eparam(effect, "width_d2", fwidth * 0.5f); - set_eparam(effect, "height_d2", fheight * 0.5f); - set_eparam(effect, "width_d2_i", 1.0f / (fwidth * 0.5f)); - set_eparam(effect, "height_d2_i", 1.0f / (fheight * 0.5f)); - set_eparam(effect, "input_height", (float)video->conversion_height); - - gs_effect_set_texture(image, texture); + const uint32_t width = gs_texture_get_width(target); + const uint32_t height = gs_texture_get_height(target); gs_set_render_target(target, NULL); - set_render_size(video->output_width, video->conversion_height); + set_render_size(width, height); - gs_enable_blending(false); - passes = gs_technique_begin(tech); - for (i = 0; i < passes; i++) { + size_t passes = gs_technique_begin(tech); + for (size_t i = 0; i < passes; i++) { gs_technique_begin_pass(tech, i); - gs_draw_sprite(texture, 0, video->output_width, - video->conversion_height); + gs_draw(GS_TRIS, 0, 3); gs_technique_end_pass(tech); } gs_technique_end(tech); - gs_enable_blending(true); - - video->textures_converted[cur_texture] = true; - -end: - profile_end(render_convert_texture_name); } -static void render_nv12(struct obs_core_video *video, gs_texture_t *target, - int cur_texture, int prev_texture, const char *tech_name, - uint32_t width, uint32_t height) +static const char *render_convert_texture_name = "render_convert_texture"; +static void render_convert_texture(struct obs_core_video *video, + gs_texture_t *texture) { - gs_texture_t *texture = video->output_textures[prev_texture]; - - gs_effect_t *effect = video->conversion_effect; - gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); - gs_technique_t *tech = gs_effect_get_technique(effect, tech_name); - size_t passes, i; + profile_start(render_convert_texture_name); - gs_effect_set_texture(image, texture); - - gs_set_render_target(target, NULL); - set_render_size(width, height); + gs_effect_t *effect = video->conversion_effect; + gs_eparam_t *color_vec0 = + gs_effect_get_param_by_name(effect, "color_vec0"); + gs_eparam_t *color_vec1 = + gs_effect_get_param_by_name(effect, "color_vec1"); + gs_eparam_t *color_vec2 = + gs_effect_get_param_by_name(effect, "color_vec2"); + gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); + gs_eparam_t *width_i = gs_effect_get_param_by_name(effect, "width_i"); + + struct vec4 vec0, vec1, vec2; + vec4_set(&vec0, video->color_matrix[4], video->color_matrix[5], + video->color_matrix[6], video->color_matrix[7]); + vec4_set(&vec1, video->color_matrix[0], video->color_matrix[1], + video->color_matrix[2], video->color_matrix[3]); + vec4_set(&vec2, video->color_matrix[8], video->color_matrix[9], + video->color_matrix[10], video->color_matrix[11]); gs_enable_blending(false); - passes = gs_technique_begin(tech); - for (i = 0; i < passes; i++) { - gs_technique_begin_pass(tech, i); - gs_draw_sprite(texture, 0, width, height); - gs_technique_end_pass(tech); - } - gs_technique_end(tech); - gs_enable_blending(true); - - UNUSED_PARAMETER(cur_texture); -} - -static const char *render_convert_nv12_name = "render_convert_texture_nv12"; -static void render_convert_texture_nv12(struct obs_core_video *video, - int cur_texture, int prev_texture) -{ - profile_start(render_convert_nv12_name); - if (!video->textures_output[prev_texture]) - goto end; + if (video->convert_textures[0]) { + gs_effect_set_texture(image, texture); + gs_effect_set_vec4(color_vec0, &vec0); + render_convert_plane(effect, video->convert_textures[0], + video->conversion_techs[0]); + + if (video->convert_textures[1]) { + gs_effect_set_texture(image, texture); + gs_effect_set_vec4(color_vec1, &vec1); + if (!video->convert_textures[2]) + gs_effect_set_vec4(color_vec2, &vec2); + gs_effect_set_float(width_i, video->conversion_width_i); + render_convert_plane(effect, video->convert_textures[1], + video->conversion_techs[1]); + + if (video->convert_textures[2]) { + gs_effect_set_texture(image, texture); + gs_effect_set_vec4(color_vec2, &vec2); + gs_effect_set_float(width_i, + video->conversion_width_i); + render_convert_plane( + effect, video->convert_textures[2], + video->conversion_techs[2]); + } + } + } - render_nv12(video, video->convert_textures[cur_texture], - cur_texture, prev_texture, "NV12_Y", - video->output_width, video->output_height); - render_nv12(video, video->convert_uv_textures[cur_texture], - cur_texture, prev_texture, "NV12_UV", - video->output_width / 2, video->output_height / 2); + gs_enable_blending(true); - video->textures_converted[cur_texture] = true; + video->texture_converted = true; -end: - profile_end(render_convert_nv12_name); + profile_end(render_convert_texture_name); } static const char *stage_output_texture_name = "stage_output_texture"; static inline void stage_output_texture(struct obs_core_video *video, - int cur_texture, int prev_texture) + int cur_texture) { profile_start(stage_output_texture_name); - gs_texture_t *texture; - bool texture_ready; - gs_stagesurf_t *copy = video->copy_surfaces[cur_texture]; - - if (video->gpu_conversion) { - texture = video->convert_textures[prev_texture]; - texture_ready = video->textures_converted[prev_texture]; - } else { - texture = video->output_textures[prev_texture]; - texture_ready = video->textures_output[prev_texture]; - } - unmap_last_surface(video); - if (!texture_ready) - goto end; - - gs_stage_texture(copy, texture); + if (!video->gpu_conversion) { + gs_stagesurf_t *copy = video->copy_surfaces[cur_texture][0]; + if (copy) + gs_stage_texture(copy, video->output_texture); + + video->textures_copied[cur_texture] = true; + } else if (video->texture_converted) { + for (int i = 0; i < NUM_CHANNELS; i++) { + gs_stagesurf_t *copy = + video->copy_surfaces[cur_texture][i]; + if (copy) + gs_stage_texture(copy, + video->convert_textures[i]); + } - video->textures_copied[cur_texture] = true; + video->textures_copied[cur_texture] = true; + } -end: profile_end(stage_output_texture_name); } #ifdef _WIN32 static inline bool queue_frame(struct obs_core_video *video, bool raw_active, - struct obs_vframe_info *vframe_info, int prev_texture) + struct obs_vframe_info *vframe_info) { - bool duplicate = !video->gpu_encoder_avail_queue.size || + bool duplicate = + !video->gpu_encoder_avail_queue.size || (video->gpu_encoder_queue.size && vframe_info->count > 1); if (duplicate) { struct obs_tex_frame *tf = circlebuf_data( - &video->gpu_encoder_queue, - video->gpu_encoder_queue.size - sizeof(*tf)); + &video->gpu_encoder_queue, + video->gpu_encoder_queue.size - sizeof(*tf)); /* texture-based encoding is stopping */ if (!tf) { @@ -435,13 +413,13 @@ * reason. otherwise, it goes to the 'duplicate' case above, which * will ensure better performance. */ if (raw_active || vframe_info->count > 1) { - gs_copy_texture(tf.tex, video->convert_textures[prev_texture]); + gs_copy_texture(tf.tex, video->convert_textures[0]); } else { - gs_texture_t *tex = video->convert_textures[prev_texture]; - gs_texture_t *tex_uv = video->convert_uv_textures[prev_texture]; + gs_texture_t *tex = video->convert_textures[0]; + gs_texture_t *tex_uv = video->convert_textures[1]; - video->convert_textures[prev_texture] = tf.tex; - video->convert_uv_textures[prev_texture] = tf.tex_uv; + video->convert_textures[0] = tf.tex; + video->convert_textures[1] = tf.tex_uv; tf.tex = tex; tf.tex_uv = tex_uv; @@ -463,28 +441,28 @@ extern void full_stop(struct obs_encoder *encoder); static inline void encode_gpu(struct obs_core_video *video, bool raw_active, - struct obs_vframe_info *vframe_info, int prev_texture) + struct obs_vframe_info *vframe_info) { - while (queue_frame(video, raw_active, vframe_info, prev_texture)); + while (queue_frame(video, raw_active, vframe_info)) + ; } static const char *output_gpu_encoders_name = "output_gpu_encoders"; -static void output_gpu_encoders(struct obs_core_video *video, bool raw_active, - int prev_texture) +static void output_gpu_encoders(struct obs_core_video *video, bool raw_active) { profile_start(output_gpu_encoders_name); - if (!video->textures_converted[prev_texture]) + if (!video->texture_converted) goto end; if (!video->vframe_info_buffer_gpu.size) goto end; struct obs_vframe_info vframe_info; circlebuf_pop_front(&video->vframe_info_buffer_gpu, &vframe_info, - sizeof(vframe_info)); + sizeof(vframe_info)); pthread_mutex_lock(&video->gpu_encoder_mutex); - encode_gpu(video, raw_active, &vframe_info, prev_texture); + encode_gpu(video, raw_active, &vframe_info); pthread_mutex_unlock(&video->gpu_encoder_mutex); end: @@ -492,45 +470,36 @@ } #endif -static inline void render_video(struct obs_core_video *video, - bool raw_active, const bool gpu_active, - int cur_texture, int prev_texture) +static inline void render_video(struct obs_core_video *video, bool raw_active, + const bool gpu_active, int cur_texture) { gs_begin_scene(); gs_enable_depth_test(false); gs_set_cull_mode(GS_NEITHER); - render_main_texture(video, cur_texture); + render_main_texture(video); if (raw_active || gpu_active) { - render_output_texture(video, cur_texture, prev_texture); + gs_texture_t *texture = render_output_texture(video); #ifdef _WIN32 - if (gpu_active) { + if (gpu_active) gs_flush(); - } #endif - } - if (raw_active || gpu_active) { - if (video->gpu_conversion) { - if (video->using_nv12_tex) - render_convert_texture_nv12(video, - cur_texture, prev_texture); - else - render_convert_texture(video, - cur_texture, prev_texture); - } + if (video->gpu_conversion) + render_convert_texture(video, texture); #ifdef _WIN32 if (gpu_active) { gs_flush(); - output_gpu_encoders(video, raw_active, prev_texture); + output_gpu_encoders(video, raw_active); } #endif + if (raw_active) - stage_output_texture(video, cur_texture, prev_texture); + stage_output_texture(video, cur_texture); } gs_set_render_target(NULL, NULL); @@ -540,149 +509,158 @@ } static inline bool download_frame(struct obs_core_video *video, - int prev_texture, struct video_data *frame) + int prev_texture, struct video_data *frame) { - gs_stagesurf_t *surface = video->copy_surfaces[prev_texture]; - if (!video->textures_copied[prev_texture]) return false; - if (!gs_stagesurface_map(surface, &frame->data[0], &frame->linesize[0])) - return false; + for (int channel = 0; channel < NUM_CHANNELS; ++channel) { + gs_stagesurf_t *surface = + video->copy_surfaces[prev_texture][channel]; + if (surface) { + if (!gs_stagesurface_map(surface, &frame->data[channel], + &frame->linesize[channel])) + return false; - video->mapped_surface = surface; + video->mapped_surfaces[channel] = surface; + } + } return true; } -static inline uint32_t calc_linesize(uint32_t pos, uint32_t linesize) +static const uint8_t *set_gpu_converted_plane(uint32_t width, uint32_t height, + uint32_t linesize_input, + uint32_t linesize_output, + const uint8_t *in, uint8_t *out) { - uint32_t size = pos % linesize; - return size ? size : linesize; -} - -static void copy_dealign( - uint8_t *dst, uint32_t dst_pos, uint32_t dst_linesize, - const uint8_t *src, uint32_t src_pos, uint32_t src_linesize, - uint32_t remaining) -{ - while (remaining) { - uint32_t src_remainder = src_pos % src_linesize; - uint32_t dst_offset = dst_linesize - src_remainder; - uint32_t src_offset = src_linesize - src_remainder; - - if (remaining < dst_offset) { - memcpy(dst + dst_pos, src + src_pos, remaining); - src_pos += remaining; - dst_pos += remaining; - remaining = 0; - } else { - memcpy(dst + dst_pos, src + src_pos, dst_offset); - src_pos += src_offset; - dst_pos += dst_offset; - remaining -= dst_offset; + if ((width == linesize_input) && (width == linesize_output)) { + size_t total = width * height; + memcpy(out, in, total); + in += total; + } else { + for (size_t y = 0; y < height; y++) { + memcpy(out, in, width); + out += linesize_output; + in += linesize_input; } } -} -static inline uint32_t make_aligned_linesize_offset(uint32_t offset, - uint32_t dst_linesize, uint32_t src_linesize) -{ - uint32_t remainder = offset % dst_linesize; - return (offset / dst_linesize) * src_linesize + remainder; -} - -static void fix_gpu_converted_alignment(struct obs_core_video *video, - struct video_frame *output, const struct video_data *input) -{ - uint32_t src_linesize = input->linesize[0]; - uint32_t dst_linesize = output->linesize[0] * 4; - uint32_t src_pos = 0; - - for (size_t i = 0; i < 3; i++) { - if (video->plane_linewidth[i] == 0) - break; - - src_pos = make_aligned_linesize_offset(video->plane_offsets[i], - dst_linesize, src_linesize); - - copy_dealign(output->data[i], 0, dst_linesize, - input->data[0], src_pos, src_linesize, - video->plane_sizes[i]); - } + return in; } static void set_gpu_converted_data(struct obs_core_video *video, - struct video_frame *output, const struct video_data *input, - const struct video_output_info *info) -{ - if (input->linesize[0] == video->output_width*4) { - struct video_frame frame; - - for (size_t i = 0; i < 3; i++) { - if (video->plane_linewidth[i] == 0) - break; + struct video_frame *output, + const struct video_data *input, + const struct video_output_info *info) +{ + if (video->using_nv12_tex) { + const uint32_t width = info->width; + const uint32_t height = info->height; + + const uint8_t *const in_uv = set_gpu_converted_plane( + width, height, input->linesize[0], output->linesize[0], + input->data[0], output->data[0]); + + const uint32_t height_d2 = height / 2; + set_gpu_converted_plane(width, height_d2, input->linesize[0], + output->linesize[1], in_uv, + output->data[1]); + } else { + switch (info->format) { + case VIDEO_FORMAT_I420: { + const uint32_t width = info->width; + const uint32_t height = info->height; + + set_gpu_converted_plane(width, height, + input->linesize[0], + output->linesize[0], + input->data[0], + output->data[0]); + + const uint32_t width_d2 = width / 2; + const uint32_t height_d2 = height / 2; + + set_gpu_converted_plane(width_d2, height_d2, + input->linesize[1], + output->linesize[1], + input->data[1], + output->data[1]); + + set_gpu_converted_plane(width_d2, height_d2, + input->linesize[2], + output->linesize[2], + input->data[2], + output->data[2]); - frame.linesize[i] = video->plane_linewidth[i]; - frame.data[i] = - input->data[0] + video->plane_offsets[i]; + break; } + case VIDEO_FORMAT_NV12: { + const uint32_t width = info->width; + const uint32_t height = info->height; + + set_gpu_converted_plane(width, height, + input->linesize[0], + output->linesize[0], + input->data[0], + output->data[0]); + + const uint32_t height_d2 = height / 2; + set_gpu_converted_plane(width, height_d2, + input->linesize[1], + output->linesize[1], + input->data[1], + output->data[1]); - video_frame_copy(output, &frame, info->format, info->height); - - } else if (video->using_nv12_tex) { - size_t width = info->width; - size_t height = info->height; - size_t height_d2 = height / 2; - uint8_t *out_y = output->data[0]; - uint8_t *out_uv = output->data[1]; - uint8_t *in = input->data[0]; - - for (size_t y = 0; y < height; y++) { - memcpy(out_y, in, width); - out_y += output->linesize[0]; - in += input->linesize[0]; - } - for (size_t y = 0; y < height_d2; y++) { - memcpy(out_uv, in, width); - out_uv += output->linesize[0]; - in += input->linesize[0]; + break; } + case VIDEO_FORMAT_I444: { + const uint32_t width = info->width; + const uint32_t height = info->height; + + set_gpu_converted_plane(width, height, + input->linesize[0], + output->linesize[0], + input->data[0], + output->data[0]); + + set_gpu_converted_plane(width, height, + input->linesize[1], + output->linesize[1], + input->data[1], + output->data[1]); + + set_gpu_converted_plane(width, height, + input->linesize[2], + output->linesize[2], + input->data[2], + output->data[2]); - } else { - fix_gpu_converted_alignment(video, output, input); - } -} - -static void convert_frame( - struct video_frame *output, const struct video_data *input, - const struct video_output_info *info) -{ - if (info->format == VIDEO_FORMAT_I420) { - compress_uyvx_to_i420( - input->data[0], input->linesize[0], - 0, info->height, - output->data, output->linesize); - - } else if (info->format == VIDEO_FORMAT_NV12) { - compress_uyvx_to_nv12( - input->data[0], input->linesize[0], - 0, info->height, - output->data, output->linesize); - - } else if (info->format == VIDEO_FORMAT_I444) { - convert_uyvx_to_i444( - input->data[0], input->linesize[0], - 0, info->height, - output->data, output->linesize); + break; + } - } else { - blog(LOG_ERROR, "convert_frame: unsupported texture format"); + case VIDEO_FORMAT_NONE: + case VIDEO_FORMAT_YVYU: + case VIDEO_FORMAT_YUY2: + case VIDEO_FORMAT_UYVY: + case VIDEO_FORMAT_RGBA: + case VIDEO_FORMAT_BGRA: + case VIDEO_FORMAT_BGRX: + case VIDEO_FORMAT_Y800: + case VIDEO_FORMAT_BGR3: + case VIDEO_FORMAT_I422: + case VIDEO_FORMAT_I40A: + case VIDEO_FORMAT_I42A: + case VIDEO_FORMAT_YUVA: + case VIDEO_FORMAT_AYUV: + /* unimplemented */ + ; + } } } -static inline void copy_rgbx_frame( - struct video_frame *output, const struct video_data *input, - const struct video_output_info *info) +static inline void copy_rgbx_frame(struct video_frame *output, + const struct video_data *input, + const struct video_output_info *info) { uint8_t *in_ptr = input->data[0]; uint8_t *out_ptr = output->data[0]; @@ -700,7 +678,7 @@ } static inline void output_video_data(struct obs_core_video *video, - struct video_data *input_frame, int count) + struct video_data *input_frame, int count) { const struct video_output_info *info; struct video_frame output_frame; @@ -709,14 +687,11 @@ info = video_output_get_info(video->video); locked = video_output_lock_frame(video->video, &output_frame, count, - input_frame->timestamp); + input_frame->timestamp); if (locked) { if (video->gpu_conversion) { set_gpu_converted_data(video, &output_frame, - input_frame, info); - - } else if (format_is_yuv(info->format)) { - convert_frame(&output_frame, input_frame, info); + input_frame, info); } else { copy_rgbx_frame(&output_frame, input_frame, info); } @@ -725,9 +700,9 @@ } } -static inline void video_sleep(struct obs_core_video *video, - bool raw_active, const bool gpu_active, - uint64_t *p_time, uint64_t interval_ns) +static inline void video_sleep(struct obs_core_video *video, bool raw_active, + const bool gpu_active, uint64_t *p_time, + uint64_t interval_ns) { struct obs_vframe_info vframe_info; uint64_t cur_time = *p_time; @@ -750,10 +725,10 @@ if (raw_active) circlebuf_push_back(&video->vframe_info_buffer, &vframe_info, - sizeof(vframe_info)); + sizeof(vframe_info)); if (gpu_active) circlebuf_push_back(&video->vframe_info_buffer_gpu, - &vframe_info, sizeof(vframe_info)); + &vframe_info, sizeof(vframe_info)); } static const char *output_frame_gs_context_name = "gs_context(video->graphics)"; @@ -764,8 +739,9 @@ static inline void output_frame(bool raw_active, const bool gpu_active) { struct obs_core_video *video = &obs->video; - int cur_texture = video->cur_texture; - int prev_texture = cur_texture == 0 ? NUM_TEXTURES-1 : cur_texture-1; + int cur_texture = video->cur_texture; + int prev_texture = cur_texture == 0 ? NUM_TEXTURES - 1 + : cur_texture - 1; struct video_data frame; bool frame_ready = 0; @@ -776,8 +752,8 @@ profile_start(output_frame_render_video_name); GS_DEBUG_MARKER_BEGIN(GS_DEBUG_COLOR_RENDER_VIDEO, - output_frame_render_video_name); - render_video(video, raw_active, gpu_active, cur_texture, prev_texture); + output_frame_render_video_name); + render_video(video, raw_active, gpu_active, cur_texture); GS_DEBUG_MARKER_END(); profile_end(output_frame_render_video_name); @@ -797,7 +773,7 @@ if (raw_active && frame_ready) { struct obs_vframe_info vframe_info; circlebuf_pop_front(&video->vframe_info_buffer, &vframe_info, - sizeof(vframe_info)); + sizeof(vframe_info)); frame.timestamp = vframe_info.timestamp; profile_start(output_frame_output_video_data_name); @@ -814,9 +790,8 @@ static void clear_base_frame_data(void) { struct obs_core_video *video = &obs->video; - memset(video->textures_rendered, 0, sizeof(video->textures_rendered)); - memset(video->textures_output, 0, sizeof(video->textures_output)); - memset(video->textures_converted, 0, sizeof(video->textures_converted)); + video->texture_rendered = false; + video->texture_converted = false; circlebuf_free(&video->vframe_info_buffer); video->cur_texture = 0; } @@ -853,12 +828,13 @@ bool was_active = false; obs->video.video_time = os_gettime_ns(); + obs->video.video_frame_interval_ns = interval; os_set_thread_name("libobs: graphics thread"); - const char *video_thread_name = - profile_store_name(obs_get_profiler_name_store(), - "obs_graphics_thread(%g"NBSP"ms)", interval / 1000000.); + const char *video_thread_name = profile_store_name( + obs_get_profiler_name_store(), + "obs_graphics_thread(%g" NBSP "ms)", interval / 1000000.); profile_register_root(video_thread_name, interval); srand((unsigned int)time(NULL)); @@ -909,17 +885,19 @@ profile_reenable_thread(); video_sleep(&obs->video, raw_active, gpu_active, - &obs->video.video_time, interval); + &obs->video.video_time, interval); frame_time_total_ns += frame_time_ns; fps_total_ns += (obs->video.video_time - last_time); fps_total_frames++; if (fps_total_ns >= 1000000000ULL) { - obs->video.video_fps = (double)fps_total_frames / + obs->video.video_fps = + (double)fps_total_frames / ((double)fps_total_ns / 1000000000.0); obs->video.video_avg_frame_time_ns = - frame_time_total_ns / (uint64_t)fps_total_frames; + frame_time_total_ns / + (uint64_t)fps_total_frames; frame_time_total_ns = 0; fps_total_ns = 0;
View file
obs-studio-23.2.1.tar.xz/libobs/obs-view.c -> obs-studio-24.0.0.tar.xz/libobs/obs-view.c
Changed
@@ -20,7 +20,8 @@ bool obs_view_init(struct obs_view *view) { - if (!view) return false; + if (!view) + return false; pthread_mutex_init_value(&view->channels_mutex); @@ -46,7 +47,8 @@ void obs_view_free(struct obs_view *view) { - if (!view) return; + if (!view) + return; for (size_t i = 0; i < MAX_CHANNELS; i++) { struct obs_source *source = view->channels[i]; @@ -73,8 +75,10 @@ obs_source_t *source; assert(channel < MAX_CHANNELS); - if (!view) return NULL; - if (channel >= MAX_CHANNELS) return NULL; + if (!view) + return NULL; + if (channel >= MAX_CHANNELS) + return NULL; pthread_mutex_lock(&view->channels_mutex); @@ -88,14 +92,16 @@ } void obs_view_set_source(obs_view_t *view, uint32_t channel, - obs_source_t *source) + obs_source_t *source) { struct obs_source *prev_source; assert(channel < MAX_CHANNELS); - if (!view) return; - if (channel >= MAX_CHANNELS) return; + if (!view) + return; + if (channel >= MAX_CHANNELS) + return; pthread_mutex_lock(&view->channels_mutex); @@ -117,7 +123,8 @@ void obs_view_render(obs_view_t *view) { - if (!view) return; + if (!view) + return; pthread_mutex_lock(&view->channels_mutex);
View file
obs-studio-23.2.1.tar.xz/libobs/obs-win-crash-handler.c -> obs-studio-24.0.0.tar.xz/libobs/obs-win-crash-handler.c
Changed
@@ -27,81 +27,83 @@ #include "util/platform.h" #include "util/windows/win-version.h" -typedef BOOL (WINAPI *ENUMERATELOADEDMODULES64)(HANDLE process, - PENUMLOADED_MODULES_CALLBACK64 enum_loaded_modules_callback, - PVOID user_context); -typedef DWORD (WINAPI *SYMSETOPTIONS)(DWORD sym_options); -typedef BOOL (WINAPI *SYMINITIALIZE)(HANDLE process, PCTSTR user_search_path, - BOOL invade_process); -typedef BOOL (WINAPI *SYMCLEANUP)(HANDLE process); -typedef BOOL (WINAPI *STACKWALK64)(DWORD machine_type, HANDLE process, - HANDLE thread, LPSTACKFRAME64 stack_frame, - PVOID context_record, - PREAD_PROCESS_MEMORY_ROUTINE64 read_memory_routine, - PFUNCTION_TABLE_ACCESS_ROUTINE64 function_table_access_routine, - PGET_MODULE_BASE_ROUTINE64 get_module_base_routine, - PTRANSLATE_ADDRESS_ROUTINE64 translate_address); -typedef BOOL (WINAPI *SYMREFRESHMODULELIST)(HANDLE process); - -typedef PVOID (WINAPI *SYMFUNCTIONTABLEACCESS64)(HANDLE process, - DWORD64 addr_base); -typedef DWORD64 (WINAPI *SYMGETMODULEBASE64)(HANDLE process, DWORD64 addr); -typedef BOOL (WINAPI *SYMFROMADDR)(HANDLE process, DWORD64 address, - PDWORD64 displacement, PSYMBOL_INFOW symbol); -typedef BOOL (WINAPI *SYMGETMODULEINFO64)(HANDLE process, DWORD64 addr, - PIMAGEHLP_MODULE64 module_info); - -typedef DWORD64 (WINAPI *SYMLOADMODULE64)(HANDLE process, HANDLE file, - PSTR image_name, PSTR module_name, DWORD64 base_of_dll, - DWORD size_of_dll); - -typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE process, DWORD process_id, - HANDLE file, MINIDUMP_TYPE dump_type, - PMINIDUMP_EXCEPTION_INFORMATION exception_param, - PMINIDUMP_USER_STREAM_INFORMATION user_stream_param, - PMINIDUMP_CALLBACK_INFORMATION callback_param); - -typedef HINSTANCE (WINAPI *SHELLEXECUTEA)(HWND hwnd, LPCTSTR operation, - LPCTSTR file, LPCTSTR parameters, LPCTSTR directory, - INT show_flags); +typedef BOOL(WINAPI *ENUMERATELOADEDMODULES64)( + HANDLE process, + PENUMLOADED_MODULES_CALLBACK64 enum_loaded_modules_callback, + PVOID user_context); +typedef DWORD(WINAPI *SYMSETOPTIONS)(DWORD sym_options); +typedef BOOL(WINAPI *SYMINITIALIZE)(HANDLE process, PCTSTR user_search_path, + BOOL invade_process); +typedef BOOL(WINAPI *SYMCLEANUP)(HANDLE process); +typedef BOOL(WINAPI *STACKWALK64)( + DWORD machine_type, HANDLE process, HANDLE thread, + LPSTACKFRAME64 stack_frame, PVOID context_record, + PREAD_PROCESS_MEMORY_ROUTINE64 read_memory_routine, + PFUNCTION_TABLE_ACCESS_ROUTINE64 function_table_access_routine, + PGET_MODULE_BASE_ROUTINE64 get_module_base_routine, + PTRANSLATE_ADDRESS_ROUTINE64 translate_address); +typedef BOOL(WINAPI *SYMREFRESHMODULELIST)(HANDLE process); + +typedef PVOID(WINAPI *SYMFUNCTIONTABLEACCESS64)(HANDLE process, + DWORD64 addr_base); +typedef DWORD64(WINAPI *SYMGETMODULEBASE64)(HANDLE process, DWORD64 addr); +typedef BOOL(WINAPI *SYMFROMADDR)(HANDLE process, DWORD64 address, + PDWORD64 displacement, PSYMBOL_INFOW symbol); +typedef BOOL(WINAPI *SYMGETMODULEINFO64)(HANDLE process, DWORD64 addr, + PIMAGEHLP_MODULE64 module_info); + +typedef DWORD64(WINAPI *SYMLOADMODULE64)(HANDLE process, HANDLE file, + PSTR image_name, PSTR module_name, + DWORD64 base_of_dll, + DWORD size_of_dll); + +typedef BOOL(WINAPI *MINIDUMPWRITEDUMP)( + HANDLE process, DWORD process_id, HANDLE file, MINIDUMP_TYPE dump_type, + PMINIDUMP_EXCEPTION_INFORMATION exception_param, + PMINIDUMP_USER_STREAM_INFORMATION user_stream_param, + PMINIDUMP_CALLBACK_INFORMATION callback_param); + +typedef HINSTANCE(WINAPI *SHELLEXECUTEA)(HWND hwnd, LPCTSTR operation, + LPCTSTR file, LPCTSTR parameters, + LPCTSTR directory, INT show_flags); struct stack_trace { - CONTEXT context; - DWORD64 instruction_ptr; - STACKFRAME64 frame; - DWORD image_type; + CONTEXT context; + DWORD64 instruction_ptr; + STACKFRAME64 frame; + DWORD image_type; }; struct exception_handler_data { - SYMINITIALIZE sym_initialize; - SYMCLEANUP sym_cleanup; - SYMSETOPTIONS sym_set_options; - SYMFUNCTIONTABLEACCESS64 sym_function_table_access64; - SYMGETMODULEBASE64 sym_get_module_base64; - SYMFROMADDR sym_from_addr; - SYMGETMODULEINFO64 sym_get_module_info64; - SYMREFRESHMODULELIST sym_refresh_module_list; - STACKWALK64 stack_walk64; - ENUMERATELOADEDMODULES64 enumerate_loaded_modules64; - MINIDUMPWRITEDUMP minidump_write_dump; - - HMODULE dbghelp; - SYMBOL_INFOW *sym_info; - PEXCEPTION_POINTERS exception; - struct win_version_info win_version; - SYSTEMTIME time_info; - HANDLE process; - - struct stack_trace main_trace; - - struct dstr str; - struct dstr cpu_info; - struct dstr module_name; - struct dstr module_list; + SYMINITIALIZE sym_initialize; + SYMCLEANUP sym_cleanup; + SYMSETOPTIONS sym_set_options; + SYMFUNCTIONTABLEACCESS64 sym_function_table_access64; + SYMGETMODULEBASE64 sym_get_module_base64; + SYMFROMADDR sym_from_addr; + SYMGETMODULEINFO64 sym_get_module_info64; + SYMREFRESHMODULELIST sym_refresh_module_list; + STACKWALK64 stack_walk64; + ENUMERATELOADEDMODULES64 enumerate_loaded_modules64; + MINIDUMPWRITEDUMP minidump_write_dump; + + HMODULE dbghelp; + SYMBOL_INFOW *sym_info; + PEXCEPTION_POINTERS exception; + struct win_version_info win_version; + SYSTEMTIME time_info; + HANDLE process; + + struct stack_trace main_trace; + + struct dstr str; + struct dstr cpu_info; + struct dstr module_name; + struct dstr module_list; }; -static inline void exception_handler_data_free( - struct exception_handler_data *data) +static inline void +exception_handler_data_free(struct exception_handler_data *data) { LocalFree(data->sym_info); dstr_free(&data->str); @@ -113,14 +115,14 @@ static inline void *get_proc(HMODULE module, const char *func) { - return (void*)GetProcAddress(module, func); + return (void *)GetProcAddress(module, func); } -#define GET_DBGHELP_IMPORT(target, str) \ - do { \ +#define GET_DBGHELP_IMPORT(target, str) \ + do { \ data->target = get_proc(data->dbghelp, str); \ - if (!data->target) \ - return false; \ + if (!data->target) \ + return false; \ } while (false) static inline bool get_dbghelp_imports(struct exception_handler_data *data) @@ -133,14 +135,14 @@ GET_DBGHELP_IMPORT(sym_cleanup, "SymCleanup"); GET_DBGHELP_IMPORT(sym_set_options, "SymSetOptions"); GET_DBGHELP_IMPORT(sym_function_table_access64, - "SymFunctionTableAccess64"); + "SymFunctionTableAccess64"); GET_DBGHELP_IMPORT(sym_get_module_base64, "SymGetModuleBase64"); GET_DBGHELP_IMPORT(sym_from_addr, "SymFromAddrW"); GET_DBGHELP_IMPORT(sym_get_module_info64, "SymGetModuleInfo64"); GET_DBGHELP_IMPORT(sym_refresh_module_list, "SymRefreshModuleList"); GET_DBGHELP_IMPORT(stack_walk64, "StackWalk64"); GET_DBGHELP_IMPORT(enumerate_loaded_modules64, - "EnumerateLoadedModulesW64"); + "EnumerateLoadedModulesW64"); GET_DBGHELP_IMPORT(minidump_write_dump, "MiniDumpWriteDump"); return true; @@ -171,10 +173,8 @@ static inline void init_sym_info(struct exception_handler_data *data) { - data->sym_set_options( - SYMOPT_UNDNAME | - SYMOPT_FAIL_CRITICAL_ERRORS | - SYMOPT_LOAD_ANYTHING); + data->sym_set_options(SYMOPT_UNDNAME | SYMOPT_FAIL_CRITICAL_ERRORS | + SYMOPT_LOAD_ANYTHING); if (!sym_initialize_called) data->sym_initialize(data->process, NULL, true); @@ -205,7 +205,7 @@ DWORD size = 1024; status = RegQueryValueExW(key, L"ProcessorNameString", NULL, - NULL, (LPBYTE)str, &size); + NULL, (LPBYTE)str, &size); if (status == ERROR_SUCCESS) dstr_from_wcs(&data->cpu_info, str); else @@ -216,35 +216,34 @@ } static BOOL CALLBACK enum_all_modules(PCTSTR module_name, DWORD64 module_base, - ULONG module_size, struct exception_handler_data *data) + ULONG module_size, + struct exception_handler_data *data) { char name_utf8[MAX_PATH]; os_wcs_to_utf8(module_name, 0, name_utf8, MAX_PATH); if (data->main_trace.instruction_ptr >= module_base && - data->main_trace.instruction_ptr < module_base + module_size) { + data->main_trace.instruction_ptr < module_base + module_size) { dstr_copy(&data->module_name, name_utf8); strlwr(data->module_name.array); } #ifdef _WIN64 - dstr_catf(&data->module_list, "%016"PRIX64"-%016"PRIX64" %s\r\n", - module_base, module_base + module_size, - name_utf8); + dstr_catf(&data->module_list, "%016" PRIX64 "-%016" PRIX64 " %s\r\n", + module_base, module_base + module_size, name_utf8); #else - dstr_catf(&data->module_list, "%08"PRIX64"-%08"PRIX64" %s\r\n", - module_base, module_base + module_size, - name_utf8); + dstr_catf(&data->module_list, "%08" PRIX64 "-%08" PRIX64 " %s\r\n", + module_base, module_base + module_size, name_utf8); #endif return true; } static inline void init_module_info(struct exception_handler_data *data) { - data->enumerate_loaded_modules64(data->process, - (PENUMLOADED_MODULES_CALLBACK64)enum_all_modules, - data); + data->enumerate_loaded_modules64( + data->process, (PENUMLOADED_MODULES_CALLBACK64)enum_all_modules, + data); } static inline void write_header(struct exception_handler_data *data) @@ -256,27 +255,24 @@ strftime(date_time, sizeof(date_time), "%Y-%m-%d, %X", &ts); const char *obs_bitness; - if (sizeof(void*) == 8) + if (sizeof(void *) == 8) obs_bitness = "64"; else obs_bitness = "32"; - dstr_catf(&data->str, "Unhandled exception: %x\r\n" - "Date/Time: %s\r\n" - "Fault address: %"PRIX64" (%s)\r\n" - "libobs version: "OBS_VERSION" (%s-bit)\r\n" - "Windows version: %d.%d build %d (revision: %d; " - "%s-bit)\r\n" - "CPU: %s\r\n\r\n", - data->exception->ExceptionRecord->ExceptionCode, - date_time, - data->main_trace.instruction_ptr, - data->module_name.array, - obs_bitness, - data->win_version.major, data->win_version.minor, - data->win_version.build, data->win_version.revis, - is_64_bit_windows() ? "64" : "32", - data->cpu_info.array); + dstr_catf(&data->str, + "Unhandled exception: %x\r\n" + "Date/Time: %s\r\n" + "Fault address: %" PRIX64 " (%s)\r\n" + "libobs version: " OBS_VERSION " (%s-bit)\r\n" + "Windows version: %d.%d build %d (revision: %d; " + "%s-bit)\r\n" + "CPU: %s\r\n\r\n", + data->exception->ExceptionRecord->ExceptionCode, date_time, + data->main_trace.instruction_ptr, data->module_name.array, + obs_bitness, data->win_version.major, data->win_version.minor, + data->win_version.build, data->win_version.revis, + is_64_bit_windows() ? "64" : "32", data->cpu_info.array); } struct module_info { @@ -285,10 +281,10 @@ }; static BOOL CALLBACK enum_module(PCTSTR module_name, DWORD64 module_base, - ULONG module_size, struct module_info *info) + ULONG module_size, struct module_info *info) { if (info->addr >= module_base && - info->addr < module_base + module_size) { + info->addr < module_base + module_size) { os_wcs_to_utf8(module_name, 0, info->name_utf8, MAX_PATH); strlwr(info->name_utf8); @@ -299,24 +295,26 @@ } static inline void get_module_name(struct exception_handler_data *data, - struct module_info *info) + struct module_info *info) { - data->enumerate_loaded_modules64(data->process, - (PENUMLOADED_MODULES_CALLBACK64)enum_module, info); + data->enumerate_loaded_modules64( + data->process, (PENUMLOADED_MODULES_CALLBACK64)enum_module, + info); } static inline bool walk_stack(struct exception_handler_data *data, - HANDLE thread, struct stack_trace *trace) + HANDLE thread, struct stack_trace *trace) { struct module_info module_info = {0}; DWORD64 func_offset; char sym_name[256]; char *p; - bool success = data->stack_walk64(trace->image_type, - data->process, thread, &trace->frame, &trace->context, - NULL, data->sym_function_table_access64, - data->sym_get_module_base64, NULL); + bool success = data->stack_walk64(trace->image_type, data->process, + thread, &trace->frame, + &trace->context, NULL, + data->sym_function_table_access64, + data->sym_get_module_base64, NULL); if (!success) return false; @@ -332,24 +330,24 @@ } success = !!data->sym_from_addr(data->process, - trace->frame.AddrPC.Offset, &func_offset, - data->sym_info); + trace->frame.AddrPC.Offset, + &func_offset, data->sym_info); if (success) os_wcs_to_utf8(data->sym_info->Name, 0, sym_name, 256); #ifdef _WIN64 -#define SUCCESS_FORMAT \ +#define SUCCESS_FORMAT \ "%016I64X %016I64X %016I64X %016I64X " \ "%016I64X %016I64X %s!%s+0x%I64x\r\n" -#define FAIL_FORMAT \ +#define FAIL_FORMAT \ "%016I64X %016I64X %016I64X %016I64X " \ "%016I64X %016I64X %s!0x%I64x\r\n" #else -#define SUCCESS_FORMAT \ +#define SUCCESS_FORMAT \ "%08.8I64X %08.8I64X %08.8I64X %08.8I64X " \ "%08.8I64X %08.8I64X %s!%s+0x%I64x\r\n" -#define FAIL_FORMAT \ +#define FAIL_FORMAT \ "%08.8I64X %08.8I64X %08.8I64X %08.8I64X " \ "%08.8I64X %08.8I64X %s!0x%I64x\r\n" @@ -363,39 +361,34 @@ if (success && (data->sym_info->Flags & SYMFLAG_EXPORT) == 0) { dstr_catf(&data->str, SUCCESS_FORMAT, - trace->frame.AddrStack.Offset, - trace->frame.AddrPC.Offset, - trace->frame.Params[0], - trace->frame.Params[1], - trace->frame.Params[2], - trace->frame.Params[3], - p, sym_name, func_offset); + trace->frame.AddrStack.Offset, + trace->frame.AddrPC.Offset, trace->frame.Params[0], + trace->frame.Params[1], trace->frame.Params[2], + trace->frame.Params[3], p, sym_name, func_offset); } else { dstr_catf(&data->str, FAIL_FORMAT, - trace->frame.AddrStack.Offset, - trace->frame.AddrPC.Offset, - trace->frame.Params[0], - trace->frame.Params[1], - trace->frame.Params[2], - trace->frame.Params[3], - p, trace->frame.AddrPC.Offset); + trace->frame.AddrStack.Offset, + trace->frame.AddrPC.Offset, trace->frame.Params[0], + trace->frame.Params[1], trace->frame.Params[2], + trace->frame.Params[3], p, + trace->frame.AddrPC.Offset); } return true; } #ifdef _WIN64 -#define TRACE_TOP \ +#define TRACE_TOP \ "Stack EIP Arg0 " \ "Arg1 Arg2 Arg3 Address\r\n" #else -#define TRACE_TOP \ +#define TRACE_TOP \ "Stack EIP Arg0 " \ "Arg1 Arg2 Arg3 Address\r\n" #endif static inline void write_thread_trace(struct exception_handler_data *data, - THREADENTRY32 *entry, bool first_thread) + THREADENTRY32 *entry, bool first_thread) { bool crash_thread = entry->th32ThreadID == GetCurrentThreadId(); struct stack_trace trace = {0}; @@ -416,13 +409,13 @@ GetThreadContext(thread, &trace.context); init_instruction_data(&trace); - dstr_catf(&data->str, "\r\nThread %lX%s\r\n"TRACE_TOP, - entry->th32ThreadID, - crash_thread ? " (Crashed)" : ""); + dstr_catf(&data->str, "\r\nThread %lX%s\r\n" TRACE_TOP, + entry->th32ThreadID, crash_thread ? " (Crashed)" : ""); ptrace = crash_thread ? &data->main_trace : &trace; - while (walk_stack(data, thread, ptrace)); + while (walk_stack(data, thread, ptrace)) + ; CloseHandle(thread); } @@ -431,7 +424,7 @@ { THREADENTRY32 entry = {0}; HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, - GetCurrentProcessId()); + GetCurrentProcessId()); bool success; if (snapshot == INVALID_HANDLE_VALUE) @@ -468,7 +461,7 @@ /* ------------------------------------------------------------------------- */ static inline void handle_exception(struct exception_handler_data *data, - PEXCEPTION_POINTERS exception) + PEXCEPTION_POINTERS exception) { if (!get_dbghelp_imports(data)) return;
View file
obs-studio-23.2.1.tar.xz/libobs/obs-windows.c -> obs-studio-24.0.0.tar.xz/libobs/obs-windows.c
Changed
@@ -44,13 +44,11 @@ "../../obs-plugins/" BIT_STRING, }; -static const char *module_data[] = { - "data/%module%", - "../../data/obs-plugins/%module%" -}; +static const char *module_data[] = {"data/%module%", + "../../data/obs-plugins/%module%"}; static const int module_patterns_size = - sizeof(module_bin)/sizeof(module_bin[0]); + sizeof(module_bin) / sizeof(module_bin[0]); void add_default_module_paths(void) { @@ -76,23 +74,23 @@ static void log_processor_info(void) { - HKEY key; + HKEY key; wchar_t data[1024]; - char *str = NULL; - DWORD size, speed; + char *str = NULL; + DWORD size, speed; LSTATUS status; memset(data, 0, sizeof(data)); - status = RegOpenKeyW(HKEY_LOCAL_MACHINE, - L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", - &key); + status = RegOpenKeyW( + HKEY_LOCAL_MACHINE, + L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", &key); if (status != ERROR_SUCCESS) return; size = sizeof(data); status = RegQueryValueExW(key, L"ProcessorNameString", NULL, NULL, - (LPBYTE)data, &size); + (LPBYTE)data, &size); if (status == ERROR_SUCCESS) { os_wcs_to_utf8_ptr(data, 0, &str); blog(LOG_INFO, "CPU Name: %s", str); @@ -101,7 +99,7 @@ size = sizeof(speed); status = RegQueryValueExW(key, L"~MHz", NULL, NULL, (LPBYTE)&speed, - &size); + &size); if (status == ERROR_SUCCESS) blog(LOG_INFO, "CPU Speed: %ldMHz", speed); @@ -111,7 +109,7 @@ static void log_processor_cores(void) { blog(LOG_INFO, "Physical Cores: %d, Logical Cores: %d", - os_get_physical_cores(), os_get_logical_cores()); + os_get_physical_cores(), os_get_logical_cores()); } static void log_available_memory(void) @@ -128,9 +126,8 @@ #endif blog(LOG_INFO, "Physical Memory: %luMB Total, %luMB Free%s", - (DWORD)(ms.ullTotalPhys / 1048576), - (DWORD)(ms.ullAvailPhys / 1048576), - note); + (DWORD)(ms.ullTotalPhys / 1048576), + (DWORD)(ms.ullAvailPhys / 1048576), note); } static void log_windows_version(void) @@ -142,8 +139,7 @@ const char *windows_bitness = b64 ? "64" : "32"; blog(LOG_INFO, "Windows Version: %d.%d Build %d (revision: %d; %s-bit)", - ver.major, ver.minor, ver.build, ver.revis, - windows_bitness); + ver.major, ver.minor, ver.build, ver.revis, windows_bitness); } static void log_admin_status(void) @@ -153,8 +149,9 @@ BOOL success; success = AllocateAndInitializeSid(&auth, 2, - SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, &admin_group); + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, + 0, 0, &admin_group); if (success) { if (!CheckTokenMembership(NULL, admin_group, &success)) success = false; @@ -162,17 +159,19 @@ } blog(LOG_INFO, "Running as administrator: %s", - success ? "true" : "false"); + success ? "true" : "false"); } -typedef HRESULT (WINAPI *dwm_is_composition_enabled_t)(BOOL*); +typedef HRESULT(WINAPI *dwm_is_composition_enabled_t)(BOOL *); static void log_aero(void) { dwm_is_composition_enabled_t composition_enabled = NULL; - const char *aeroMessage = win_ver >= 0x602 ? - " (Aero is always on for windows 8 and above)" : ""; + const char *aeroMessage = + win_ver >= 0x602 + ? " (Aero is always on for windows 8 and above)" + : ""; HMODULE dwm = LoadLibraryW(L"dwmapi"); BOOL bComposition = true; @@ -181,21 +180,22 @@ return; } - composition_enabled = (dwm_is_composition_enabled_t)GetProcAddress(dwm, - "DwmIsCompositionEnabled"); + composition_enabled = (dwm_is_composition_enabled_t)GetProcAddress( + dwm, "DwmIsCompositionEnabled"); if (!composition_enabled) { + FreeLibrary(dwm); return; } composition_enabled(&bComposition); blog(LOG_INFO, "Aero is %s%s", bComposition ? "Enabled" : "Disabled", - aeroMessage); + aeroMessage); } #define WIN10_GAME_BAR_REG_KEY \ - L"Software\\Microsoft\\Windows\\CurrentVersion\\GameDVR" + L"Software\\Microsoft\\Windows\\CurrentVersion\\GameDVR" #define WIN10_GAME_DVR_POLICY_REG_KEY \ - L"SOFTWARE\\Policies\\Microsoft\\Windows\\GameDVR" + L"SOFTWARE\\Policies\\Microsoft\\Windows\\GameDVR" #define WIN10_GAME_DVR_REG_KEY L"System\\GameConfigStore" #define WIN10_GAME_MODE_REG_KEY L"Software\\Microsoft\\GameBar" @@ -211,45 +211,44 @@ struct reg_dword game_mode_enabled; get_reg_dword(HKEY_CURRENT_USER, WIN10_GAME_BAR_REG_KEY, - L"AppCaptureEnabled", &game_bar_enabled); + L"AppCaptureEnabled", &game_bar_enabled); get_reg_dword(HKEY_CURRENT_USER, WIN10_GAME_DVR_POLICY_REG_KEY, - L"AllowGameDVR", &game_dvr_allowed); + L"AllowGameDVR", &game_dvr_allowed); get_reg_dword(HKEY_CURRENT_USER, WIN10_GAME_DVR_REG_KEY, - L"GameDVR_Enabled", &game_dvr_enabled); + L"GameDVR_Enabled", &game_dvr_enabled); get_reg_dword(HKEY_CURRENT_USER, WIN10_GAME_BAR_REG_KEY, - L"HistoricalCaptureEnabled", &game_dvr_bg_recording); + L"HistoricalCaptureEnabled", &game_dvr_bg_recording); get_reg_dword(HKEY_CURRENT_USER, WIN10_GAME_MODE_REG_KEY, - L"AllowAutoGameMode", &game_mode_enabled); + L"AllowAutoGameMode", &game_mode_enabled); if (game_mode_enabled.status != ERROR_SUCCESS) { get_reg_dword(HKEY_CURRENT_USER, WIN10_GAME_MODE_REG_KEY, - L"AutoGameModeEnabled", &game_mode_enabled); + L"AutoGameModeEnabled", &game_mode_enabled); } blog(LOG_INFO, "Windows 10 Gaming Features:"); if (game_bar_enabled.status == ERROR_SUCCESS) { blog(LOG_INFO, "\tGame Bar: %s", - (bool)game_bar_enabled.return_value ? "On" : "Off"); + (bool)game_bar_enabled.return_value ? "On" : "Off"); } if (game_dvr_allowed.status == ERROR_SUCCESS) { blog(LOG_INFO, "\tGame DVR Allowed: %s", - (bool)game_dvr_allowed.return_value ? "Yes" : "No"); + (bool)game_dvr_allowed.return_value ? "Yes" : "No"); } if (game_dvr_enabled.status == ERROR_SUCCESS) { blog(LOG_INFO, "\tGame DVR: %s", - (bool)game_dvr_enabled.return_value ? "On" : "Off"); + (bool)game_dvr_enabled.return_value ? "On" : "Off"); } if (game_dvr_bg_recording.status == ERROR_SUCCESS) { blog(LOG_INFO, "\tGame DVR Background Recording: %s", - (bool)game_dvr_bg_recording.return_value ? "On" : - "Off"); + (bool)game_dvr_bg_recording.return_value ? "On" : "Off"); } if (game_mode_enabled.status == ERROR_SUCCESS) { blog(LOG_INFO, "\tGame Mode: %s", - (bool)game_mode_enabled.return_value ? "On" : "Off"); + (bool)game_mode_enabled.return_value ? "On" : "Off"); } } @@ -318,8 +317,7 @@ } blog(LOG_INFO, "\t%S: %s (%s)", name, - get_str_for_state(prod_state), - get_str_for_type(type)); + get_str_for_state(prod_state), get_str_for_type(type)); SysFreeString(name); prod->lpVtbl->Release(prod); @@ -350,27 +348,27 @@ blog(LOG_INFO, "Sec. Software Status:"); hr = CoCreateInstance(prod_list_clsid, NULL, - CLSCTX_INPROC_SERVER, prod_list_iid, - &prod_list); + CLSCTX_INPROC_SERVER, prod_list_iid, + &prod_list); if (!FAILED(hr)) { - log_security_products_by_type(prod_list, - WSC_SECURITY_PROVIDER_ANTIVIRUS); + log_security_products_by_type( + prod_list, WSC_SECURITY_PROVIDER_ANTIVIRUS); } hr = CoCreateInstance(prod_list_clsid, NULL, - CLSCTX_INPROC_SERVER, prod_list_iid, - &prod_list); + CLSCTX_INPROC_SERVER, prod_list_iid, + &prod_list); if (!FAILED(hr)) { - log_security_products_by_type(prod_list, - WSC_SECURITY_PROVIDER_FIREWALL); + log_security_products_by_type( + prod_list, WSC_SECURITY_PROVIDER_FIREWALL); } hr = CoCreateInstance(prod_list_clsid, NULL, - CLSCTX_INPROC_SERVER, prod_list_iid, - &prod_list); + CLSCTX_INPROC_SERVER, prod_list_iid, + &prod_list); if (!FAILED(hr)) { - log_security_products_by_type(prod_list, - WSC_SECURITY_PROVIDER_ANTISPYWARE); + log_security_products_by_type( + prod_list, WSC_SECURITY_PROVIDER_ANTISPYWARE); } } @@ -394,7 +392,6 @@ log_security_products(); } - struct obs_hotkeys_platform { int vk_codes[OBS_KEY_LAST_VALUE]; }; @@ -402,137 +399,260 @@ static int get_virtual_key(obs_key_t key) { switch (key) { - case OBS_KEY_RETURN: return VK_RETURN; - case OBS_KEY_ESCAPE: return VK_ESCAPE; - case OBS_KEY_TAB: return VK_TAB; - case OBS_KEY_BACKTAB: return VK_OEM_BACKTAB; - case OBS_KEY_BACKSPACE: return VK_BACK; - case OBS_KEY_INSERT: return VK_INSERT; - case OBS_KEY_DELETE: return VK_DELETE; - case OBS_KEY_PAUSE: return VK_PAUSE; - case OBS_KEY_PRINT: return VK_SNAPSHOT; - case OBS_KEY_CLEAR: return VK_CLEAR; - case OBS_KEY_HOME: return VK_HOME; - case OBS_KEY_END: return VK_END; - case OBS_KEY_LEFT: return VK_LEFT; - case OBS_KEY_UP: return VK_UP; - case OBS_KEY_RIGHT: return VK_RIGHT; - case OBS_KEY_DOWN: return VK_DOWN; - case OBS_KEY_PAGEUP: return VK_PRIOR; - case OBS_KEY_PAGEDOWN: return VK_NEXT; - - case OBS_KEY_SHIFT: return VK_SHIFT; - case OBS_KEY_CONTROL: return VK_CONTROL; - case OBS_KEY_ALT: return VK_MENU; - case OBS_KEY_CAPSLOCK: return VK_CAPITAL; - case OBS_KEY_NUMLOCK: return VK_NUMLOCK; - case OBS_KEY_SCROLLLOCK: return VK_SCROLL; - - case OBS_KEY_F1: return VK_F1; - case OBS_KEY_F2: return VK_F2; - case OBS_KEY_F3: return VK_F3; - case OBS_KEY_F4: return VK_F4; - case OBS_KEY_F5: return VK_F5; - case OBS_KEY_F6: return VK_F6; - case OBS_KEY_F7: return VK_F7; - case OBS_KEY_F8: return VK_F8; - case OBS_KEY_F9: return VK_F9; - case OBS_KEY_F10: return VK_F10; - case OBS_KEY_F11: return VK_F11; - case OBS_KEY_F12: return VK_F12; - case OBS_KEY_F13: return VK_F13; - case OBS_KEY_F14: return VK_F14; - case OBS_KEY_F15: return VK_F15; - case OBS_KEY_F16: return VK_F16; - case OBS_KEY_F17: return VK_F17; - case OBS_KEY_F18: return VK_F18; - case OBS_KEY_F19: return VK_F19; - case OBS_KEY_F20: return VK_F20; - case OBS_KEY_F21: return VK_F21; - case OBS_KEY_F22: return VK_F22; - case OBS_KEY_F23: return VK_F23; - case OBS_KEY_F24: return VK_F24; - - case OBS_KEY_SPACE: return VK_SPACE; - - case OBS_KEY_APOSTROPHE: return VK_OEM_7; - case OBS_KEY_PLUS: return VK_OEM_PLUS; - case OBS_KEY_COMMA: return VK_OEM_COMMA; - case OBS_KEY_MINUS: return VK_OEM_MINUS; - case OBS_KEY_PERIOD: return VK_OEM_PERIOD; - case OBS_KEY_SLASH: return VK_OEM_2; - case OBS_KEY_0: return '0'; - case OBS_KEY_1: return '1'; - case OBS_KEY_2: return '2'; - case OBS_KEY_3: return '3'; - case OBS_KEY_4: return '4'; - case OBS_KEY_5: return '5'; - case OBS_KEY_6: return '6'; - case OBS_KEY_7: return '7'; - case OBS_KEY_8: return '8'; - case OBS_KEY_9: return '9'; - case OBS_KEY_NUMASTERISK: return VK_MULTIPLY; - case OBS_KEY_NUMPLUS: return VK_ADD; - case OBS_KEY_NUMMINUS: return VK_SUBTRACT; - case OBS_KEY_NUMPERIOD: return VK_DECIMAL; - case OBS_KEY_NUMSLASH: return VK_DIVIDE; - case OBS_KEY_NUM0: return VK_NUMPAD0; - case OBS_KEY_NUM1: return VK_NUMPAD1; - case OBS_KEY_NUM2: return VK_NUMPAD2; - case OBS_KEY_NUM3: return VK_NUMPAD3; - case OBS_KEY_NUM4: return VK_NUMPAD4; - case OBS_KEY_NUM5: return VK_NUMPAD5; - case OBS_KEY_NUM6: return VK_NUMPAD6; - case OBS_KEY_NUM7: return VK_NUMPAD7; - case OBS_KEY_NUM8: return VK_NUMPAD8; - case OBS_KEY_NUM9: return VK_NUMPAD9; - case OBS_KEY_SEMICOLON: return VK_OEM_1; - case OBS_KEY_A: return 'A'; - case OBS_KEY_B: return 'B'; - case OBS_KEY_C: return 'C'; - case OBS_KEY_D: return 'D'; - case OBS_KEY_E: return 'E'; - case OBS_KEY_F: return 'F'; - case OBS_KEY_G: return 'G'; - case OBS_KEY_H: return 'H'; - case OBS_KEY_I: return 'I'; - case OBS_KEY_J: return 'J'; - case OBS_KEY_K: return 'K'; - case OBS_KEY_L: return 'L'; - case OBS_KEY_M: return 'M'; - case OBS_KEY_N: return 'N'; - case OBS_KEY_O: return 'O'; - case OBS_KEY_P: return 'P'; - case OBS_KEY_Q: return 'Q'; - case OBS_KEY_R: return 'R'; - case OBS_KEY_S: return 'S'; - case OBS_KEY_T: return 'T'; - case OBS_KEY_U: return 'U'; - case OBS_KEY_V: return 'V'; - case OBS_KEY_W: return 'W'; - case OBS_KEY_X: return 'X'; - case OBS_KEY_Y: return 'Y'; - case OBS_KEY_Z: return 'Z'; - case OBS_KEY_BRACKETLEFT: return VK_OEM_4; - case OBS_KEY_BACKSLASH: return VK_OEM_5; - case OBS_KEY_BRACKETRIGHT: return VK_OEM_6; - case OBS_KEY_ASCIITILDE: return VK_OEM_3; - - case OBS_KEY_HENKAN: return VK_CONVERT; - case OBS_KEY_MUHENKAN: return VK_NONCONVERT; - case OBS_KEY_KANJI: return VK_KANJI; - case OBS_KEY_TOUROKU: return VK_OEM_FJ_TOUROKU; - case OBS_KEY_MASSYO: return VK_OEM_FJ_MASSHOU; - - case OBS_KEY_HANGUL: return VK_HANGUL; - - case OBS_KEY_BACKSLASH_RT102: return VK_OEM_102; - - case OBS_KEY_MOUSE1: return VK_LBUTTON; - case OBS_KEY_MOUSE2: return VK_RBUTTON; - case OBS_KEY_MOUSE3: return VK_MBUTTON; - case OBS_KEY_MOUSE4: return VK_XBUTTON1; - case OBS_KEY_MOUSE5: return VK_XBUTTON2; + case OBS_KEY_RETURN: + return VK_RETURN; + case OBS_KEY_ESCAPE: + return VK_ESCAPE; + case OBS_KEY_TAB: + return VK_TAB; + case OBS_KEY_BACKTAB: + return VK_OEM_BACKTAB; + case OBS_KEY_BACKSPACE: + return VK_BACK; + case OBS_KEY_INSERT: + return VK_INSERT; + case OBS_KEY_DELETE: + return VK_DELETE; + case OBS_KEY_PAUSE: + return VK_PAUSE; + case OBS_KEY_PRINT: + return VK_SNAPSHOT; + case OBS_KEY_CLEAR: + return VK_CLEAR; + case OBS_KEY_HOME: + return VK_HOME; + case OBS_KEY_END: + return VK_END; + case OBS_KEY_LEFT: + return VK_LEFT; + case OBS_KEY_UP: + return VK_UP; + case OBS_KEY_RIGHT: + return VK_RIGHT; + case OBS_KEY_DOWN: + return VK_DOWN; + case OBS_KEY_PAGEUP: + return VK_PRIOR; + case OBS_KEY_PAGEDOWN: + return VK_NEXT; + + case OBS_KEY_SHIFT: + return VK_SHIFT; + case OBS_KEY_CONTROL: + return VK_CONTROL; + case OBS_KEY_ALT: + return VK_MENU; + case OBS_KEY_CAPSLOCK: + return VK_CAPITAL; + case OBS_KEY_NUMLOCK: + return VK_NUMLOCK; + case OBS_KEY_SCROLLLOCK: + return VK_SCROLL; + + case OBS_KEY_F1: + return VK_F1; + case OBS_KEY_F2: + return VK_F2; + case OBS_KEY_F3: + return VK_F3; + case OBS_KEY_F4: + return VK_F4; + case OBS_KEY_F5: + return VK_F5; + case OBS_KEY_F6: + return VK_F6; + case OBS_KEY_F7: + return VK_F7; + case OBS_KEY_F8: + return VK_F8; + case OBS_KEY_F9: + return VK_F9; + case OBS_KEY_F10: + return VK_F10; + case OBS_KEY_F11: + return VK_F11; + case OBS_KEY_F12: + return VK_F12; + case OBS_KEY_F13: + return VK_F13; + case OBS_KEY_F14: + return VK_F14; + case OBS_KEY_F15: + return VK_F15; + case OBS_KEY_F16: + return VK_F16; + case OBS_KEY_F17: + return VK_F17; + case OBS_KEY_F18: + return VK_F18; + case OBS_KEY_F19: + return VK_F19; + case OBS_KEY_F20: + return VK_F20; + case OBS_KEY_F21: + return VK_F21; + case OBS_KEY_F22: + return VK_F22; + case OBS_KEY_F23: + return VK_F23; + case OBS_KEY_F24: + return VK_F24; + + case OBS_KEY_SPACE: + return VK_SPACE; + + case OBS_KEY_APOSTROPHE: + return VK_OEM_7; + case OBS_KEY_PLUS: + return VK_OEM_PLUS; + case OBS_KEY_COMMA: + return VK_OEM_COMMA; + case OBS_KEY_MINUS: + return VK_OEM_MINUS; + case OBS_KEY_PERIOD: + return VK_OEM_PERIOD; + case OBS_KEY_SLASH: + return VK_OEM_2; + case OBS_KEY_0: + return '0'; + case OBS_KEY_1: + return '1'; + case OBS_KEY_2: + return '2'; + case OBS_KEY_3: + return '3'; + case OBS_KEY_4: + return '4'; + case OBS_KEY_5: + return '5'; + case OBS_KEY_6: + return '6'; + case OBS_KEY_7: + return '7'; + case OBS_KEY_8: + return '8'; + case OBS_KEY_9: + return '9'; + case OBS_KEY_NUMASTERISK: + return VK_MULTIPLY; + case OBS_KEY_NUMPLUS: + return VK_ADD; + case OBS_KEY_NUMMINUS: + return VK_SUBTRACT; + case OBS_KEY_NUMPERIOD: + return VK_DECIMAL; + case OBS_KEY_NUMSLASH: + return VK_DIVIDE; + case OBS_KEY_NUM0: + return VK_NUMPAD0; + case OBS_KEY_NUM1: + return VK_NUMPAD1; + case OBS_KEY_NUM2: + return VK_NUMPAD2; + case OBS_KEY_NUM3: + return VK_NUMPAD3; + case OBS_KEY_NUM4: + return VK_NUMPAD4; + case OBS_KEY_NUM5: + return VK_NUMPAD5; + case OBS_KEY_NUM6: + return VK_NUMPAD6; + case OBS_KEY_NUM7: + return VK_NUMPAD7; + case OBS_KEY_NUM8: + return VK_NUMPAD8; + case OBS_KEY_NUM9: + return VK_NUMPAD9; + case OBS_KEY_SEMICOLON: + return VK_OEM_1; + case OBS_KEY_A: + return 'A'; + case OBS_KEY_B: + return 'B'; + case OBS_KEY_C: + return 'C'; + case OBS_KEY_D: + return 'D'; + case OBS_KEY_E: + return 'E'; + case OBS_KEY_F: + return 'F'; + case OBS_KEY_G: + return 'G'; + case OBS_KEY_H: + return 'H'; + case OBS_KEY_I: + return 'I'; + case OBS_KEY_J: + return 'J'; + case OBS_KEY_K: + return 'K'; + case OBS_KEY_L: + return 'L'; + case OBS_KEY_M: + return 'M'; + case OBS_KEY_N: + return 'N'; + case OBS_KEY_O: + return 'O'; + case OBS_KEY_P: + return 'P'; + case OBS_KEY_Q: + return 'Q'; + case OBS_KEY_R: + return 'R'; + case OBS_KEY_S: + return 'S'; + case OBS_KEY_T: + return 'T'; + case OBS_KEY_U: + return 'U'; + case OBS_KEY_V: + return 'V'; + case OBS_KEY_W: + return 'W'; + case OBS_KEY_X: + return 'X'; + case OBS_KEY_Y: + return 'Y'; + case OBS_KEY_Z: + return 'Z'; + case OBS_KEY_BRACKETLEFT: + return VK_OEM_4; + case OBS_KEY_BACKSLASH: + return VK_OEM_5; + case OBS_KEY_BRACKETRIGHT: + return VK_OEM_6; + case OBS_KEY_ASCIITILDE: + return VK_OEM_3; + + case OBS_KEY_HENKAN: + return VK_CONVERT; + case OBS_KEY_MUHENKAN: + return VK_NONCONVERT; + case OBS_KEY_KANJI: + return VK_KANJI; + case OBS_KEY_TOUROKU: + return VK_OEM_FJ_TOUROKU; + case OBS_KEY_MASSYO: + return VK_OEM_FJ_MASSHOU; + + case OBS_KEY_HANGUL: + return VK_HANGUL; + + case OBS_KEY_BACKSLASH_RT102: + return VK_OEM_102; + + case OBS_KEY_MOUSE1: + return VK_LBUTTON; + case OBS_KEY_MOUSE2: + return VK_RBUTTON; + case OBS_KEY_MOUSE3: + return VK_MBUTTON; + case OBS_KEY_MOUSE4: + return VK_XBUTTON1; + case OBS_KEY_MOUSE5: + return VK_XBUTTON2; /* TODO: Implement keys for non-US keyboards */ default:; @@ -565,7 +685,7 @@ } bool obs_hotkeys_platform_is_pressed(obs_hotkeys_platform_t *context, - obs_key_t key) + obs_key_t key) { if (key == OBS_KEY_META) { return vk_down(VK_LWIN) || vk_down(VK_RWIN); @@ -589,11 +709,11 @@ dstr_copy(str, obs->hotkeys.translations[key]); } else { dstr_printf(str, "Mouse %d", - (int)(key - OBS_KEY_MOUSE1 + 1)); + (int)(key - OBS_KEY_MOUSE1 + 1)); } return; - - } if (key == OBS_KEY_PAUSE) { + } + if (key == OBS_KEY_PAUSE) { dstr_copy(str, obs_get_hotkey_translation(key, "Pause")); return; @@ -665,7 +785,7 @@ } void obs_key_combination_to_str(obs_key_combination_t combination, - struct dstr *str) + struct dstr *str) { if ((combination.modifiers & INTERACT_CONTROL_KEY) != 0) { add_combo_key(OBS_KEY_CONTROL, str); @@ -688,14 +808,14 @@ void reset_win32_symbol_paths(void) { - static BOOL (WINAPI *sym_initialize_w)(HANDLE, const wchar_t*, BOOL); - static BOOL (WINAPI *sym_set_search_path_w)(HANDLE, const wchar_t*); + static BOOL(WINAPI * sym_initialize_w)(HANDLE, const wchar_t *, BOOL); + static BOOL(WINAPI * sym_set_search_path_w)(HANDLE, const wchar_t *); static bool funcs_initialized = false; static bool initialize_success = false; struct obs_module *module = obs->first_module; struct dstr path_str = {0}; - DARRAY(char*) paths; + DARRAY(char *) paths; wchar_t *path_str_w = NULL; char *abspath; @@ -709,13 +829,17 @@ if (!mod) return; - sym_initialize_w = (void*)GetProcAddress(mod, "SymInitializeW"); - sym_set_search_path_w = (void*)GetProcAddress(mod, - "SymSetSearchPathW"); - if (!sym_initialize_w || !sym_set_search_path_w) + sym_initialize_w = + (void *)GetProcAddress(mod, "SymInitializeW"); + sym_set_search_path_w = + (void *)GetProcAddress(mod, "SymSetSearchPathW"); + if (!sym_initialize_w || !sym_set_search_path_w) { + FreeLibrary(mod); return; + } initialize_success = true; + // Leaks 'mod' once. } if (!initialize_success) @@ -775,11 +899,11 @@ if (path_str_w) { if (!sym_initialize_called) { sym_initialize_w(GetCurrentProcess(), - path_str_w, false); + path_str_w, false); sym_initialize_called = true; } else { sym_set_search_path_w(GetCurrentProcess(), - path_str_w); + path_str_w); } bfree(path_str_w);
View file
obs-studio-23.2.1.tar.xz/libobs/obs.c -> obs-studio-24.0.0.tar.xz/libobs/obs.c
Changed
@@ -29,131 +29,48 @@ extern char *find_libobs_data_file(const char *file); static inline void make_video_info(struct video_output_info *vi, - struct obs_video_info *ovi) + struct obs_video_info *ovi) { - vi->name = "video"; - vi->format = ovi->output_format; + vi->name = "video"; + vi->format = ovi->output_format; vi->fps_num = ovi->fps_num; vi->fps_den = ovi->fps_den; - vi->width = ovi->output_width; - vi->height = ovi->output_height; - vi->range = ovi->range; + vi->width = ovi->output_width; + vi->height = ovi->output_height; + vi->range = ovi->range; vi->colorspace = ovi->colorspace; vi->cache_size = 6; } -#define PIXEL_SIZE 4 - -#define GET_ALIGN(val, align) \ - (((val) + (align-1)) & ~(align-1)) - -static inline void set_420p_sizes(const struct obs_video_info *ovi) -{ - struct obs_core_video *video = &obs->video; - uint32_t chroma_pixels; - uint32_t total_bytes; - - chroma_pixels = (ovi->output_width * ovi->output_height / 4); - chroma_pixels = GET_ALIGN(chroma_pixels, PIXEL_SIZE); - - video->plane_offsets[0] = 0; - video->plane_offsets[1] = ovi->output_width * ovi->output_height; - video->plane_offsets[2] = video->plane_offsets[1] + chroma_pixels; - - video->plane_linewidth[0] = ovi->output_width; - video->plane_linewidth[1] = ovi->output_width/2; - video->plane_linewidth[2] = ovi->output_width/2; - - video->plane_sizes[0] = video->plane_offsets[1]; - video->plane_sizes[1] = video->plane_sizes[0]/4; - video->plane_sizes[2] = video->plane_sizes[1]; - - total_bytes = video->plane_offsets[2] + chroma_pixels; - - video->conversion_height = - (total_bytes/PIXEL_SIZE + ovi->output_width-1) / - ovi->output_width; - - video->conversion_height = GET_ALIGN(video->conversion_height, 2); - video->conversion_tech = "Planar420"; -} - -static inline void set_nv12_sizes(const struct obs_video_info *ovi) -{ - struct obs_core_video *video = &obs->video; - uint32_t chroma_pixels; - uint32_t total_bytes; - - chroma_pixels = (ovi->output_width * ovi->output_height / 2); - chroma_pixels = GET_ALIGN(chroma_pixels, PIXEL_SIZE); - - video->plane_offsets[0] = 0; - video->plane_offsets[1] = ovi->output_width * ovi->output_height; - - video->plane_linewidth[0] = ovi->output_width; - video->plane_linewidth[1] = ovi->output_width; - - video->plane_sizes[0] = video->plane_offsets[1]; - video->plane_sizes[1] = video->plane_sizes[0]/2; - - total_bytes = video->plane_offsets[1] + chroma_pixels; - - video->conversion_height = - (total_bytes/PIXEL_SIZE + ovi->output_width-1) / - ovi->output_width; - - video->conversion_height = GET_ALIGN(video->conversion_height, 2); - video->conversion_tech = "NV12"; -} - -static inline void set_444p_sizes(const struct obs_video_info *ovi) +static inline void calc_gpu_conversion_sizes(const struct obs_video_info *ovi) { struct obs_core_video *video = &obs->video; - uint32_t chroma_pixels; - uint32_t total_bytes; - - chroma_pixels = (ovi->output_width * ovi->output_height); - chroma_pixels = GET_ALIGN(chroma_pixels, PIXEL_SIZE); - - video->plane_offsets[0] = 0; - video->plane_offsets[1] = chroma_pixels; - video->plane_offsets[2] = chroma_pixels + chroma_pixels; - - video->plane_linewidth[0] = ovi->output_width; - video->plane_linewidth[1] = ovi->output_width; - video->plane_linewidth[2] = ovi->output_width; - - video->plane_sizes[0] = chroma_pixels; - video->plane_sizes[1] = chroma_pixels; - video->plane_sizes[2] = chroma_pixels; - total_bytes = video->plane_offsets[2] + chroma_pixels; - - video->conversion_height = - (total_bytes/PIXEL_SIZE + ovi->output_width-1) / - ovi->output_width; - - video->conversion_height = GET_ALIGN(video->conversion_height, 2); - video->conversion_tech = "Planar444"; -} - -static inline void calc_gpu_conversion_sizes(const struct obs_video_info *ovi) -{ - obs->video.conversion_height = 0; - memset(obs->video.plane_offsets, 0, sizeof(obs->video.plane_offsets)); - memset(obs->video.plane_sizes, 0, sizeof(obs->video.plane_sizes)); - memset(obs->video.plane_linewidth, 0, - sizeof(obs->video.plane_linewidth)); + video->conversion_needed = false; + video->conversion_techs[0] = NULL; + video->conversion_techs[1] = NULL; + video->conversion_techs[2] = NULL; + video->conversion_width_i = 0.f; switch ((uint32_t)ovi->output_format) { case VIDEO_FORMAT_I420: - set_420p_sizes(ovi); + video->conversion_needed = true; + video->conversion_techs[0] = "Planar_Y"; + video->conversion_techs[1] = "Planar_U_Left"; + video->conversion_techs[2] = "Planar_V_Left"; + video->conversion_width_i = 1.f / (float)ovi->output_width; break; case VIDEO_FORMAT_NV12: - set_nv12_sizes(ovi); + video->conversion_needed = true; + video->conversion_techs[0] = "NV12_Y"; + video->conversion_techs[1] = "NV12_UV"; + video->conversion_width_i = 1.f / (float)ovi->output_width; break; case VIDEO_FORMAT_I444: - set_444p_sizes(ovi); + video->conversion_needed = true; + video->conversion_techs[0] = "Planar_Y"; + video->conversion_techs[1] = "Planar_U"; + video->conversion_techs[2] = "Planar_V"; break; } } @@ -165,11 +82,12 @@ calc_gpu_conversion_sizes(ovi); video->using_nv12_tex = ovi->output_format == VIDEO_FORMAT_NV12 - ? gs_nv12_available() : false; + ? gs_nv12_available() + : false; - if (!video->conversion_height) { + if (!video->conversion_needed) { blog(LOG_INFO, "GPU conversion not available for format: %u", - (unsigned int)ovi->output_format); + (unsigned int)ovi->output_format); video->gpu_conversion = false; video->using_nv12_tex = false; blog(LOG_INFO, "NV12 texture support not available"); @@ -181,28 +99,97 @@ else blog(LOG_INFO, "NV12 texture support not available"); - for (size_t i = 0; i < NUM_TEXTURES; i++) { #ifdef _WIN32 - if (video->using_nv12_tex) { - gs_texture_create_nv12( - &video->convert_textures[i], - &video->convert_uv_textures[i], - ovi->output_width, ovi->output_height, - GS_RENDER_TARGET | GS_SHARED_KM_TEX); - if (!video->convert_uv_textures[i]) - return false; - } else { + if (video->using_nv12_tex) { + gs_texture_create_nv12(&video->convert_textures[0], + &video->convert_textures[1], + ovi->output_width, ovi->output_height, + GS_RENDER_TARGET | GS_SHARED_KM_TEX); + } else { #endif - video->convert_textures[i] = gs_texture_create( - ovi->output_width, - video->conversion_height, - GS_RGBA, 1, NULL, GS_RENDER_TARGET); -#ifdef _WIN32 + video->convert_textures[0] = + gs_texture_create(ovi->output_width, ovi->output_height, + GS_R8, 1, NULL, GS_RENDER_TARGET); + + const struct video_output_info *info = + video_output_get_info(video->video); + switch (info->format) { + case VIDEO_FORMAT_I420: + video->convert_textures[1] = gs_texture_create( + ovi->output_width / 2, ovi->output_height / 2, + GS_R8, 1, NULL, GS_RENDER_TARGET); + video->convert_textures[2] = gs_texture_create( + ovi->output_width / 2, ovi->output_height / 2, + GS_R8, 1, NULL, GS_RENDER_TARGET); + if (!video->convert_textures[2]) + return false; + break; + case VIDEO_FORMAT_NV12: + video->convert_textures[1] = gs_texture_create( + ovi->output_width / 2, ovi->output_height / 2, + GS_R8G8, 1, NULL, GS_RENDER_TARGET); + break; + case VIDEO_FORMAT_I444: + video->convert_textures[1] = gs_texture_create( + ovi->output_width, ovi->output_height, GS_R8, 1, + NULL, GS_RENDER_TARGET); + video->convert_textures[2] = gs_texture_create( + ovi->output_width, ovi->output_height, GS_R8, 1, + NULL, GS_RENDER_TARGET); + if (!video->convert_textures[2]) + return false; + break; } +#ifdef _WIN32 + } #endif - if (!video->convert_textures[i]) + if (!video->convert_textures[0]) + return false; + if (!video->convert_textures[1]) + return false; + + return true; +} + +static bool obs_init_gpu_copy_surfaces(struct obs_video_info *ovi, size_t i) +{ + struct obs_core_video *video = &obs->video; + + video->copy_surfaces[i][0] = gs_stagesurface_create( + ovi->output_width, ovi->output_height, GS_R8); + if (!video->copy_surfaces[i][0]) + return false; + + const struct video_output_info *info = + video_output_get_info(video->video); + switch (info->format) { + case VIDEO_FORMAT_I420: + video->copy_surfaces[i][1] = gs_stagesurface_create( + ovi->output_width / 2, ovi->output_height / 2, GS_R8); + if (!video->copy_surfaces[i][1]) + return false; + video->copy_surfaces[i][2] = gs_stagesurface_create( + ovi->output_width / 2, ovi->output_height / 2, GS_R8); + if (!video->copy_surfaces[i][2]) + return false; + break; + case VIDEO_FORMAT_NV12: + video->copy_surfaces[i][1] = gs_stagesurface_create( + ovi->output_width / 2, ovi->output_height / 2, GS_R8G8); + if (!video->copy_surfaces[i][1]) return false; + break; + case VIDEO_FORMAT_I444: + video->copy_surfaces[i][1] = gs_stagesurface_create( + ovi->output_width, ovi->output_height, GS_R8); + if (!video->copy_surfaces[i][1]) + return false; + video->copy_surfaces[i][2] = gs_stagesurface_create( + ovi->output_width, ovi->output_height, GS_R8); + if (!video->copy_surfaces[i][2]) + return false; + break; } return true; @@ -211,43 +198,47 @@ static bool obs_init_textures(struct obs_video_info *ovi) { struct obs_core_video *video = &obs->video; - uint32_t output_height = video->gpu_conversion ? - video->conversion_height : ovi->output_height; - size_t i; - for (i = 0; i < NUM_TEXTURES; i++) { + for (size_t i = 0; i < NUM_TEXTURES; i++) { #ifdef _WIN32 if (video->using_nv12_tex) { - video->copy_surfaces[i] = gs_stagesurface_create_nv12( - ovi->output_width, ovi->output_height); - if (!video->copy_surfaces[i]) + video->copy_surfaces[i][0] = + gs_stagesurface_create_nv12(ovi->output_width, + ovi->output_height); + if (!video->copy_surfaces[i][0]) return false; } else { #endif - video->copy_surfaces[i] = gs_stagesurface_create( - ovi->output_width, output_height, - GS_RGBA); - if (!video->copy_surfaces[i]) - return false; + if (video->gpu_conversion) { + if (!obs_init_gpu_copy_surfaces(ovi, i)) + return false; + } else { + video->copy_surfaces[i][0] = + gs_stagesurface_create( + ovi->output_width, + ovi->output_height, GS_RGBA); + if (!video->copy_surfaces[i][0]) + return false; + } #ifdef _WIN32 } #endif + } - video->render_textures[i] = gs_texture_create( - ovi->base_width, ovi->base_height, - GS_RGBA, 1, NULL, GS_RENDER_TARGET); + video->render_texture = gs_texture_create(ovi->base_width, + ovi->base_height, GS_RGBA, 1, + NULL, GS_RENDER_TARGET); - if (!video->render_textures[i]) - return false; + if (!video->render_texture) + return false; - video->output_textures[i] = gs_texture_create( - ovi->output_width, ovi->output_height, - GS_RGBA, 1, NULL, GS_RENDER_TARGET); + video->output_texture = gs_texture_create(ovi->output_width, + ovi->output_height, GS_RGBA, + 1, NULL, GS_RENDER_TARGET); - if (!video->output_textures[i]) - return false; - } + if (!video->output_texture) + return false; return true; } @@ -266,14 +257,14 @@ static int obs_init_graphics(struct obs_video_info *ovi) { struct obs_core_video *video = &obs->video; - uint8_t transparent_tex_data[2*2*4] = {0}; + uint8_t transparent_tex_data[2 * 2 * 4] = {0}; const uint8_t *transparent_tex = transparent_tex_data; struct gs_sampler_info point_sampler = {0}; bool success = true; int errorcode; - errorcode = gs_create(&video->graphics, ovi->graphics_module, - ovi->adapter); + errorcode = + gs_create(&video->graphics, ovi->graphics_module, ovi->adapter); if (errorcode != GS_SUCCESS) { switch (errorcode) { case GS_ERROR_MODULE_NOT_FOUND: @@ -288,67 +279,59 @@ gs_enter_context(video->graphics); char *filename = obs_find_data_file("default.effect"); - video->default_effect = gs_effect_create_from_file(filename, - NULL); + video->default_effect = gs_effect_create_from_file(filename, NULL); bfree(filename); if (gs_get_device_type() == GS_DEVICE_OPENGL) { filename = obs_find_data_file("default_rect.effect"); - video->default_rect_effect = gs_effect_create_from_file( - filename, NULL); + video->default_rect_effect = + gs_effect_create_from_file(filename, NULL); bfree(filename); } filename = obs_find_data_file("opaque.effect"); - video->opaque_effect = gs_effect_create_from_file(filename, - NULL); + video->opaque_effect = gs_effect_create_from_file(filename, NULL); bfree(filename); filename = obs_find_data_file("solid.effect"); - video->solid_effect = gs_effect_create_from_file(filename, - NULL); + video->solid_effect = gs_effect_create_from_file(filename, NULL); bfree(filename); filename = obs_find_data_file("repeat.effect"); - video->repeat_effect = gs_effect_create_from_file(filename, - NULL); + video->repeat_effect = gs_effect_create_from_file(filename, NULL); bfree(filename); filename = obs_find_data_file("format_conversion.effect"); - video->conversion_effect = gs_effect_create_from_file(filename, - NULL); + video->conversion_effect = gs_effect_create_from_file(filename, NULL); bfree(filename); filename = obs_find_data_file("bicubic_scale.effect"); - video->bicubic_effect = gs_effect_create_from_file(filename, - NULL); + video->bicubic_effect = gs_effect_create_from_file(filename, NULL); bfree(filename); filename = obs_find_data_file("lanczos_scale.effect"); - video->lanczos_effect = gs_effect_create_from_file(filename, - NULL); + video->lanczos_effect = gs_effect_create_from_file(filename, NULL); bfree(filename); filename = obs_find_data_file("area.effect"); - video->area_effect = gs_effect_create_from_file(filename, - NULL); + video->area_effect = gs_effect_create_from_file(filename, NULL); bfree(filename); filename = obs_find_data_file("bilinear_lowres_scale.effect"); - video->bilinear_lowres_effect = gs_effect_create_from_file(filename, - NULL); + video->bilinear_lowres_effect = + gs_effect_create_from_file(filename, NULL); bfree(filename); filename = obs_find_data_file("premultiplied_alpha.effect"); - video->premultiplied_alpha_effect = gs_effect_create_from_file(filename, - NULL); + video->premultiplied_alpha_effect = + gs_effect_create_from_file(filename, NULL); bfree(filename); point_sampler.max_anisotropy = 1; video->point_sampler = gs_samplerstate_create(&point_sampler); - obs->video.transparent_texture = gs_texture_create(2, 2, GS_RGBA, 1, - &transparent_tex, 0); + obs->video.transparent_texture = + gs_texture_create(2, 2, GS_RGBA, 1, &transparent_tex, 0); if (!video->default_effect) success = false; @@ -374,14 +357,14 @@ } static inline void set_video_matrix(struct obs_core_video *video, - struct obs_video_info *ovi) + struct obs_video_info *ovi) { struct matrix4 mat; struct vec4 r_row; if (format_is_yuv(ovi->output_format)) { video_format_get_parameters(ovi->colorspace, ovi->range, - (float*)&mat, NULL, NULL); + (float *)&mat, NULL, NULL); matrix4_inv(&mat, &mat); /* swap R and G */ @@ -403,12 +386,12 @@ int errorcode; make_video_info(&vi, ovi); - video->base_width = ovi->base_width; - video->base_height = ovi->base_height; - video->output_width = ovi->output_width; - video->output_height = ovi->output_height; + video->base_width = ovi->base_width; + video->base_height = ovi->base_height; + video->output_width = ovi->output_width; + video->output_height = ovi->output_height; video->gpu_conversion = ovi->gpu_conversion; - video->scale_type = ovi->scale_type; + video->scale_type = ovi->scale_type; set_video_matrix(video, ovi); @@ -441,7 +424,7 @@ return OBS_VIDEO_FAIL; errorcode = pthread_create(&video->video_thread, NULL, - obs_graphics_thread, obs); + obs_graphics_thread, obs); if (errorcode != 0) return OBS_VIDEO_FAIL; @@ -462,7 +445,6 @@ video->thread_initialized = false; } } - } static void obs_free_video(void) @@ -478,38 +460,58 @@ gs_enter_context(video->graphics); - if (video->mapped_surface) { - gs_stagesurface_unmap(video->mapped_surface); - video->mapped_surface = NULL; + for (size_t c = 0; c < NUM_CHANNELS; c++) { + if (video->mapped_surfaces[c]) { + gs_stagesurface_unmap( + video->mapped_surfaces[c]); + video->mapped_surfaces[c] = NULL; + } } for (size_t i = 0; i < NUM_TEXTURES; i++) { - gs_stagesurface_destroy(video->copy_surfaces[i]); - gs_texture_destroy(video->render_textures[i]); - gs_texture_destroy(video->convert_textures[i]); - gs_texture_destroy(video->convert_uv_textures[i]); - gs_texture_destroy(video->output_textures[i]); - - video->copy_surfaces[i] = NULL; - video->render_textures[i] = NULL; - video->convert_textures[i] = NULL; - video->convert_uv_textures[i] = NULL; - video->output_textures[i] = NULL; + for (size_t c = 0; c < NUM_CHANNELS; c++) { + if (video->copy_surfaces[i][c]) { + gs_stagesurface_destroy( + video->copy_surfaces[i][c]); + video->copy_surfaces[i][c] = NULL; + } + } + } + + gs_texture_destroy(video->render_texture); + + for (size_t c = 0; c < NUM_CHANNELS; c++) { + if (video->convert_textures[c]) { + gs_texture_destroy(video->convert_textures[c]); + video->convert_textures[c] = NULL; + } } + for (size_t i = 0; i < NUM_TEXTURES; i++) { + for (size_t c = 0; c < NUM_CHANNELS; c++) { + if (video->copy_surfaces[i][c]) { + gs_stagesurface_destroy( + video->copy_surfaces[i][c]); + video->copy_surfaces[i][c] = NULL; + } + } + } + + gs_texture_destroy(video->output_texture); + video->render_texture = NULL; + video->output_texture = NULL; + gs_leave_context(); circlebuf_free(&video->vframe_info_buffer); circlebuf_free(&video->vframe_info_buffer_gpu); - memset(&video->textures_rendered, 0, - sizeof(video->textures_rendered)); - memset(&video->textures_output, 0, - sizeof(video->textures_output)); - memset(&video->textures_copied, 0, - sizeof(video->textures_copied)); - memset(&video->textures_converted, 0, - sizeof(video->textures_converted)); + video->texture_rendered = false; + ; + memset(video->textures_copied, 0, + sizeof(video->textures_copied)); + video->texture_converted = false; + ; pthread_mutex_destroy(&video->gpu_encoder_mutex); pthread_mutex_init_value(&video->gpu_encoder_mutex); @@ -566,7 +568,7 @@ if (pthread_mutex_init(&audio->monitoring_mutex, &attr) != 0) return false; - audio->user_volume = 1.0f; + audio->user_volume = 1.0f; audio->monitoring_device_name = bstrdup("Default"); audio->monitoring_device_id = bstrdup("default"); @@ -641,7 +643,8 @@ void obs_main_view_free(struct obs_view *view) { - if (!view) return; + if (!view) + return; for (size_t i = 0; i < MAX_CHANNELS; i++) obs_source_release(view->channels[i]); @@ -650,16 +653,16 @@ pthread_mutex_destroy(&view->channels_mutex); } -#define FREE_OBS_LINKED_LIST(type) \ - do { \ - int unfreed = 0; \ - while (data->first_ ## type ) { \ - obs_ ## type ## _destroy(data->first_ ## type ); \ - unfreed++; \ - } \ - if (unfreed) \ +#define FREE_OBS_LINKED_LIST(type) \ + do { \ + int unfreed = 0; \ + while (data->first_##type) { \ + obs_##type##_destroy(data->first_##type); \ + unfreed++; \ + } \ + if (unfreed) \ blog(LOG_INFO, "\t%d " #type "(s) were remaining", \ - unfreed); \ + unfreed); \ } while (false) static void obs_free_data(void) @@ -703,7 +706,7 @@ "void source_rename(ptr source, string new_name, string prev_name)", "void source_volume(ptr source, in out float volume)", "void source_volume_level(ptr source, float level, float magnitude, " - "float peak)", + "float peak)", "void source_transition_start(ptr source)", "void source_transition_video_stop(ptr source)", "void source_transition_stop(ptr source)", @@ -716,7 +719,7 @@ "void hotkey_unregister(ptr hotkey)", "void hotkey_bindings_changed(ptr hotkey)", - NULL + NULL, }; static inline bool obs_init_handlers(void) @@ -725,7 +728,7 @@ if (!obs->signals) return false; - obs->procs = proc_handler_create(); + obs->procs = proc_handler_create(); if (!obs->procs) return false; @@ -763,8 +766,8 @@ if (os_event_init(&hotkeys->stop_event, OS_EVENT_TYPE_MANUAL) != 0) goto fail; - if (pthread_create(&hotkeys->hotkey_thread, NULL, - obs_hotkey_thread, NULL)) + if (pthread_create(&hotkeys->hotkey_thread, NULL, obs_hotkey_thread, + NULL)) goto fail; hotkeys->hotkey_thread_initialized = true; @@ -811,10 +814,24 @@ extern const struct obs_source_info scene_info; extern const struct obs_source_info group_info; +static const char *submix_name(void *unused) +{ + UNUSED_PARAMETER(unused); + return "Audio line (internal use only)"; +} + +const struct obs_source_info audio_line_info = { + .id = "audio_line", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_AUDIO | OBS_SOURCE_CAP_DISABLED | + OBS_SOURCE_SUBMIX, + .get_name = submix_name, +}; + extern void log_system_info(void); static bool obs_init(const char *locale, const char *module_config_path, - profiler_name_store_t *store) + profiler_name_store_t *store) { obs = bzalloc(sizeof(struct obs_core)); @@ -842,6 +859,7 @@ obs->locale = bstrdup(locale); obs_register_source(&scene_info); obs_register_source(&group_info); + obs_register_source(&audio_line_info); add_default_module_paths(); return true; } @@ -897,7 +915,7 @@ static const char *obs_startup_name = "obs_startup"; bool obs_startup(const char *locale, const char *module_config_path, - profiler_name_store_t *store) + profiler_name_store_t *store) { bool success; @@ -921,7 +939,7 @@ } static struct obs_cmdline_args cmdline_args = {0, NULL}; -void obs_set_cmdline_args(int argc, const char * const *argv) +void obs_set_cmdline_args(int argc, const char *const *argv) { char *data; size_t len; @@ -939,7 +957,7 @@ len += strlen(argv[i]) + 1; cmdline_args.argv = bmalloc(sizeof(char *) * (argc + 1) + len); - data = (char *) cmdline_args.argv + sizeof(char *) * (argc + 1); + data = (char *)cmdline_args.argv + sizeof(char *) * (argc + 1); for (i = 0; i < argc; i++) { cmdline_args.argv[i] = data; @@ -964,14 +982,14 @@ if (!obs) return; -#define FREE_REGISTERED_TYPES(structure, list) \ - do { \ - for (size_t i = 0; i < list.num; i++) { \ - struct structure *item = &list.array[i]; \ - if (item->type_data && item->free_type_data) \ +#define FREE_REGISTERED_TYPES(structure, list) \ + do { \ + for (size_t i = 0; i < list.num; i++) { \ + struct structure *item = &list.array[i]; \ + if (item->type_data && item->free_type_data) \ item->free_type_data(item->type_data); \ - } \ - da_free(list); \ + } \ + da_free(list); \ } while (false) FREE_REGISTERED_TYPES(obs_source_info, obs->source_types); @@ -1012,7 +1030,7 @@ core->first_module = NULL; for (size_t i = 0; i < core->module_paths.num; i++) - free_module_path(core->module_paths.array+i); + free_module_path(core->module_paths.array + i); da_free(core->module_paths); if (core->name_store_owned) @@ -1073,19 +1091,20 @@ static inline bool size_valid(uint32_t width, uint32_t height) { return (width >= OBS_SIZE_MIN && height >= OBS_SIZE_MIN && - width <= OBS_SIZE_MAX && height <= OBS_SIZE_MAX); + width <= OBS_SIZE_MAX && height <= OBS_SIZE_MAX); } int obs_reset_video(struct obs_video_info *ovi) { - if (!obs) return OBS_VIDEO_FAIL; + if (!obs) + return OBS_VIDEO_FAIL; /* don't allow changing of video settings if active. */ if (obs->video.video && obs_video_active()) return OBS_VIDEO_CURRENTLY_ACTIVE; if (!size_valid(ovi->output_width, ovi->output_height) || - !size_valid(ovi->base_width, ovi->base_height)) + !size_valid(ovi->base_width, ovi->base_height)) return OBS_VIDEO_INVALID_PARAM; struct obs_core_video *video = &obs->video; @@ -1094,7 +1113,7 @@ obs_free_video(); /* align to multiple-of-two and SSE alignment sizes */ - ovi->output_width &= 0xFFFFFFFC; + ovi->output_width &= 0xFFFFFFFC; ovi->output_height &= 0xFFFFFFFE; if (!video->graphics) { @@ -1129,25 +1148,22 @@ bool yuv = format_is_yuv(ovi->output_format); const char *yuv_format = get_video_colorspace_name(ovi->colorspace); - const char *yuv_range = get_video_range_name(ovi->output_format, - ovi->range); + const char *yuv_range = + get_video_range_name(ovi->output_format, ovi->range); blog(LOG_INFO, "---------------------------------"); - blog(LOG_INFO, "video settings reset:\n" - "\tbase resolution: %dx%d\n" - "\toutput resolution: %dx%d\n" - "\tdownscale filter: %s\n" - "\tfps: %d/%d\n" - "\tformat: %s\n" - "\tYUV mode: %s%s%s", - ovi->base_width, ovi->base_height, - ovi->output_width, ovi->output_height, - scale_type_name, - ovi->fps_num, ovi->fps_den, - get_video_format_name(ovi->output_format), - yuv ? yuv_format : "None", - yuv ? "/" : "", - yuv ? yuv_range : ""); + blog(LOG_INFO, + "video settings reset:\n" + "\tbase resolution: %dx%d\n" + "\toutput resolution: %dx%d\n" + "\tdownscale filter: %s\n" + "\tfps: %d/%d\n" + "\tformat: %s\n" + "\tYUV mode: %s%s%s", + ovi->base_width, ovi->base_height, ovi->output_width, + ovi->output_height, scale_type_name, ovi->fps_num, ovi->fps_den, + get_video_format_name(ovi->output_format), + yuv ? yuv_format : "None", yuv ? "/" : "", yuv ? yuv_range : ""); return obs_init_video(ovi); } @@ -1156,7 +1172,8 @@ { struct audio_output_info ai; - if (!obs) return false; + if (!obs) + return false; /* don't allow changing of audio settings if active. */ if (obs->audio.audio && audio_output_active(obs->audio.audio)) @@ -1173,11 +1190,11 @@ ai.input_callback = audio_callback; blog(LOG_INFO, "---------------------------------"); - blog(LOG_INFO, "audio settings reset:\n" - "\tsamples per sec: %d\n" - "\tspeakers: %d", - (int)ai.samples_per_sec, - (int)ai.speakers); + blog(LOG_INFO, + "audio settings reset:\n" + "\tsamples per sec: %d\n" + "\tspeakers: %d", + (int)ai.samples_per_sec, (int)ai.speakers); return obs_init_audio(&ai); } @@ -1210,7 +1227,8 @@ bool obs_enum_source_types(size_t idx, const char **id) { - if (!obs) return false; + if (!obs) + return false; if (idx >= obs->source_types.num) return false; @@ -1220,7 +1238,8 @@ bool obs_enum_input_types(size_t idx, const char **id) { - if (!obs) return false; + if (!obs) + return false; if (idx >= obs->input_types.num) return false; @@ -1230,7 +1249,8 @@ bool obs_enum_filter_types(size_t idx, const char **id) { - if (!obs) return false; + if (!obs) + return false; if (idx >= obs->filter_types.num) return false; @@ -1240,7 +1260,8 @@ bool obs_enum_transition_types(size_t idx, const char **id) { - if (!obs) return false; + if (!obs) + return false; if (idx >= obs->transition_types.num) return false; @@ -1250,7 +1271,8 @@ bool obs_enum_output_types(size_t idx, const char **id) { - if (!obs) return false; + if (!obs) + return false; if (idx >= obs->output_types.num) return false; @@ -1260,7 +1282,8 @@ bool obs_enum_encoder_types(size_t idx, const char **id) { - if (!obs) return false; + if (!obs) + return false; if (idx >= obs->encoder_types.num) return false; @@ -1270,7 +1293,8 @@ bool obs_enum_service_types(size_t idx, const char **id) { - if (!obs) return false; + if (!obs) + return false; if (idx >= obs->service_types.num) return false; @@ -1301,14 +1325,15 @@ } /* TODO: optimize this later so it's not just O(N) string lookups */ -static inline struct obs_modal_ui *get_modal_ui_callback(const char *id, - const char *task, const char *target) +static inline struct obs_modal_ui * +get_modal_ui_callback(const char *id, const char *task, const char *target) { for (size_t i = 0; i < obs->modal_ui_callbacks.num; i++) { - struct obs_modal_ui *callback = obs->modal_ui_callbacks.array+i; + struct obs_modal_ui *callback = + obs->modal_ui_callbacks.array + i; - if (strcmp(callback->id, id) == 0 && - strcmp(callback->task, task) == 0 && + if (strcmp(callback->id, id) == 0 && + strcmp(callback->task, task) == 0 && strcmp(callback->target, target) == 0) return callback; } @@ -1316,15 +1341,15 @@ return NULL; } -static inline struct obs_modeless_ui *get_modeless_ui_callback(const char *id, - const char *task, const char *target) +static inline struct obs_modeless_ui * +get_modeless_ui_callback(const char *id, const char *task, const char *target) { for (size_t i = 0; i < obs->modeless_ui_callbacks.num; i++) { struct obs_modeless_ui *callback; - callback = obs->modeless_ui_callbacks.array+i; + callback = obs->modeless_ui_callbacks.array + i; - if (strcmp(callback->id, id) == 0 && - strcmp(callback->task, task) == 0 && + if (strcmp(callback->id, id) == 0 && + strcmp(callback->task, task) == 0 && strcmp(callback->target, target) == 0) return callback; } @@ -1338,7 +1363,8 @@ struct obs_modal_ui *callback; int errorcode = OBS_UI_NOTFOUND; - if (!obs) return errorcode; + if (!obs) + return errorcode; callback = get_modal_ui_callback(name, task, target); if (callback) { @@ -1350,11 +1376,12 @@ } void *obs_create_ui(const char *name, const char *task, const char *target, - void *data, void *ui_data) + void *data, void *ui_data) { struct obs_modeless_ui *callback; - if (!obs) return NULL; + if (!obs) + return NULL; callback = get_modeless_ui_callback(name, task, target); return callback ? callback->create(data, ui_data) : NULL; @@ -1362,7 +1389,8 @@ obs_source_t *obs_get_output_source(uint32_t channel) { - if (!obs) return NULL; + if (!obs) + return NULL; return obs_view_get_source(&obs->data.main_view, channel); } @@ -1370,8 +1398,10 @@ { assert(channel < MAX_CHANNELS); - if (!obs) return; - if (channel >= MAX_CHANNELS) return; + if (!obs) + return; + if (channel >= MAX_CHANNELS) + return; struct obs_source *prev_source; struct obs_view *view = &obs->data.main_view; @@ -1403,25 +1433,26 @@ } } -void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t*), void *param) +void obs_enum_sources(bool (*enum_proc)(void *, obs_source_t *), void *param) { obs_source_t *source; - if (!obs) return; + if (!obs) + return; pthread_mutex_lock(&obs->data.sources_mutex); source = obs->data.first_source; while (source) { obs_source_t *next_source = - (obs_source_t*)source->context.next; + (obs_source_t *)source->context.next; if (source->info.id == group_info.id && !enum_proc(param, source)) { break; } else if (source->info.type == OBS_SOURCE_TYPE_INPUT && - !source->context.private && - !enum_proc(param, source)) { + !source->context.private && + !enum_proc(param, source)) { break; } @@ -1431,22 +1462,22 @@ pthread_mutex_unlock(&obs->data.sources_mutex); } -void obs_enum_scenes(bool (*enum_proc)(void*, obs_source_t*), void *param) +void obs_enum_scenes(bool (*enum_proc)(void *, obs_source_t *), void *param) { obs_source_t *source; - if (!obs) return; + if (!obs) + return; pthread_mutex_lock(&obs->data.sources_mutex); source = obs->data.first_source; while (source) { obs_source_t *next_source = - (obs_source_t*)source->context.next; + (obs_source_t *)source->context.next; if (source->info.type == OBS_SOURCE_TYPE_SCENE && - !source->context.private && - !enum_proc(param, source)) { + !source->context.private && !enum_proc(param, source)) { break; } @@ -1457,10 +1488,10 @@ } static inline void obs_enum(void *pstart, pthread_mutex_t *mutex, void *proc, - void *param) + void *param) { struct obs_context_data **start = pstart, *context; - bool (*enum_proc)(void*, void*) = proc; + bool (*enum_proc)(void *, void *) = proc; assert(start); assert(mutex); @@ -1479,29 +1510,33 @@ pthread_mutex_unlock(mutex); } -void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t*), void *param) +void obs_enum_outputs(bool (*enum_proc)(void *, obs_output_t *), void *param) { - if (!obs) return; - obs_enum(&obs->data.first_output, &obs->data.outputs_mutex, - enum_proc, param); + if (!obs) + return; + obs_enum(&obs->data.first_output, &obs->data.outputs_mutex, enum_proc, + param); } -void obs_enum_encoders(bool (*enum_proc)(void*, obs_encoder_t*), void *param) +void obs_enum_encoders(bool (*enum_proc)(void *, obs_encoder_t *), void *param) { - if (!obs) return; - obs_enum(&obs->data.first_encoder, &obs->data.encoders_mutex, - enum_proc, param); + if (!obs) + return; + obs_enum(&obs->data.first_encoder, &obs->data.encoders_mutex, enum_proc, + param); } -void obs_enum_services(bool (*enum_proc)(void*, obs_service_t*), void *param) +void obs_enum_services(bool (*enum_proc)(void *, obs_service_t *), void *param) { - if (!obs) return; - obs_enum(&obs->data.first_service, &obs->data.services_mutex, - enum_proc, param); + if (!obs) + return; + obs_enum(&obs->data.first_service, &obs->data.services_mutex, enum_proc, + param); } static inline void *get_context_by_name(void *vfirst, const char *name, - pthread_mutex_t *mutex, void *(*addref)(void*)) + pthread_mutex_t *mutex, + void *(*addref)(void *)) { struct obs_context_data **first = vfirst; struct obs_context_data *context; @@ -1548,35 +1583,44 @@ obs_source_t *obs_get_source_by_name(const char *name) { - if (!obs) return NULL; + if (!obs) + return NULL; return get_context_by_name(&obs->data.first_source, name, - &obs->data.sources_mutex, obs_source_addref_safe_); + &obs->data.sources_mutex, + obs_source_addref_safe_); } obs_output_t *obs_get_output_by_name(const char *name) { - if (!obs) return NULL; + if (!obs) + return NULL; return get_context_by_name(&obs->data.first_output, name, - &obs->data.outputs_mutex, obs_output_addref_safe_); + &obs->data.outputs_mutex, + obs_output_addref_safe_); } obs_encoder_t *obs_get_encoder_by_name(const char *name) { - if (!obs) return NULL; + if (!obs) + return NULL; return get_context_by_name(&obs->data.first_encoder, name, - &obs->data.encoders_mutex, obs_encoder_addref_safe_); + &obs->data.encoders_mutex, + obs_encoder_addref_safe_); } obs_service_t *obs_get_service_by_name(const char *name) { - if (!obs) return NULL; + if (!obs) + return NULL; return get_context_by_name(&obs->data.first_service, name, - &obs->data.services_mutex, obs_service_addref_safe_); + &obs->data.services_mutex, + obs_service_addref_safe_); } gs_effect_t *obs_get_base_effect(enum obs_base_effect effect) { - if (!obs) return NULL; + if (!obs) + return NULL; switch (effect) { case OBS_EFFECT_DEFAULT: @@ -1607,52 +1651,56 @@ /* DEPRECATED */ gs_effect_t *obs_get_default_rect_effect(void) { - if (!obs) return NULL; + if (!obs) + return NULL; return obs->video.default_rect_effect; } signal_handler_t *obs_get_signal_handler(void) { - if (!obs) return NULL; + if (!obs) + return NULL; return obs->signals; } proc_handler_t *obs_get_proc_handler(void) { - if (!obs) return NULL; + if (!obs) + return NULL; return obs->procs; } void obs_render_main_view(void) { - if (!obs) return; + if (!obs) + return; obs_view_render(&obs->data.main_view); } -void obs_render_main_texture(void) +static void obs_render_main_texture_internal(enum gs_blend_type src_c, + enum gs_blend_type dest_c, + enum gs_blend_type src_a, + enum gs_blend_type dest_a) { - struct obs_core_video *video = &obs->video; + struct obs_core_video *video; gs_texture_t *tex; gs_effect_t *effect; gs_eparam_t *param; - int last_tex; - if (!obs) return; - - last_tex = video->cur_texture == 0 - ? NUM_TEXTURES - 1 - : video->cur_texture - 1; + if (!obs) + return; - if (!video->textures_rendered[last_tex]) + video = &obs->video; + if (!video->texture_rendered) return; - tex = video->render_textures[last_tex]; + tex = video->render_texture; effect = obs_get_base_effect(OBS_EFFECT_DEFAULT); param = gs_effect_get_param_by_name(effect, "image"); gs_effect_set_texture(param, tex); gs_blend_state_push(); - gs_blend_function(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); + gs_blend_function_separate(src_c, dest_c, src_a, dest_a); while (gs_effect_loop(effect, "Draw")) gs_draw_sprite(tex, 0, 0, 0); @@ -1660,28 +1708,38 @@ gs_blend_state_pop(); } -gs_texture_t *obs_get_main_texture(void) +void obs_render_main_texture(void) { - struct obs_core_video *video = &obs->video; - int last_tex; + obs_render_main_texture_internal(GS_BLEND_ONE, GS_BLEND_INVSRCALPHA, + GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); +} - if (!obs) return NULL; +void obs_render_main_texture_src_color_only(void) +{ + obs_render_main_texture_internal(GS_BLEND_ONE, GS_BLEND_ZERO, + GS_BLEND_ONE, GS_BLEND_INVSRCALPHA); +} - last_tex = video->cur_texture == 0 - ? NUM_TEXTURES - 1 - : video->cur_texture - 1; +gs_texture_t *obs_get_main_texture(void) +{ + struct obs_core_video *video; - if (!video->textures_rendered[last_tex]) + if (!obs) + return NULL; + + video = &obs->video; + if (!video->texture_rendered) return NULL; - return video->render_textures[last_tex]; + return video->render_texture; } void obs_set_master_volume(float volume) { struct calldata data = {0}; - if (!obs) return; + if (!obs) + return; calldata_set_float(&data, "volume", volume); signal_handler_signal(obs->signals, "master_volume", &data); @@ -1700,23 +1758,28 @@ { obs_data_array_t *filters = obs_data_get_array(source_data, "filters"); obs_source_t *source; - const char *name = obs_data_get_string(source_data, "name"); - const char *id = obs_data_get_string(source_data, "id"); - obs_data_t *settings = obs_data_get_obj(source_data, "settings"); - obs_data_t *hotkeys = obs_data_get_obj(source_data, "hotkeys"); - double volume; - double balance; - int64_t sync; - uint32_t flags; - uint32_t mixers; - int di_order; - int di_mode; - int monitoring_type; + const char *name = obs_data_get_string(source_data, "name"); + const char *id = obs_data_get_string(source_data, "id"); + obs_data_t *settings = obs_data_get_obj(source_data, "settings"); + obs_data_t *hotkeys = obs_data_get_obj(source_data, "hotkeys"); + double volume; + double balance; + int64_t sync; + uint32_t prev_ver; + uint32_t caps; + uint32_t flags; + uint32_t mixers; + int di_order; + int di_mode; + int monitoring_type; source = obs_source_create(id, name, settings, hotkeys); obs_data_release(hotkeys); + prev_ver = (uint32_t)obs_data_get_int(source_data, "prev_ver"); + caps = obs_source_get_output_flags(source); + obs_data_set_default_double(source_data, "volume", 1.0); volume = obs_data_get_double(source_data, "volume"); obs_source_set_volume(source, (float)volume); @@ -1728,7 +1791,7 @@ sync = obs_data_get_int(source_data, "sync"); obs_source_set_sync_offset(source, sync); - obs_data_set_default_int(source_data, "mixers", 0xF); + obs_data_set_default_int(source_data, "mixers", 0x3F); mixers = (uint32_t)obs_data_get_int(source_data, "mixers"); obs_source_set_audio_mixers(source, mixers); @@ -1738,38 +1801,48 @@ obs_data_set_default_bool(source_data, "enabled", true); obs_source_set_enabled(source, - obs_data_get_bool(source_data, "enabled")); + obs_data_get_bool(source_data, "enabled")); obs_data_set_default_bool(source_data, "muted", false); obs_source_set_muted(source, obs_data_get_bool(source_data, "muted")); obs_data_set_default_bool(source_data, "push-to-mute", false); - obs_source_enable_push_to_mute(source, - obs_data_get_bool(source_data, "push-to-mute")); + obs_source_enable_push_to_mute( + source, obs_data_get_bool(source_data, "push-to-mute")); obs_data_set_default_int(source_data, "push-to-mute-delay", 0); - obs_source_set_push_to_mute_delay(source, - obs_data_get_int(source_data, "push-to-mute-delay")); + obs_source_set_push_to_mute_delay( + source, obs_data_get_int(source_data, "push-to-mute-delay")); obs_data_set_default_bool(source_data, "push-to-talk", false); - obs_source_enable_push_to_talk(source, - obs_data_get_bool(source_data, "push-to-talk")); + obs_source_enable_push_to_talk( + source, obs_data_get_bool(source_data, "push-to-talk")); obs_data_set_default_int(source_data, "push-to-talk-delay", 0); - obs_source_set_push_to_talk_delay(source, - obs_data_get_int(source_data, "push-to-talk-delay")); + obs_source_set_push_to_talk_delay( + source, obs_data_get_int(source_data, "push-to-talk-delay")); di_mode = (int)obs_data_get_int(source_data, "deinterlace_mode"); obs_source_set_deinterlace_mode(source, - (enum obs_deinterlace_mode)di_mode); + (enum obs_deinterlace_mode)di_mode); - di_order = (int)obs_data_get_int(source_data, "deinterlace_field_order"); - obs_source_set_deinterlace_field_order(source, - (enum obs_deinterlace_field_order)di_order); + di_order = + (int)obs_data_get_int(source_data, "deinterlace_field_order"); + obs_source_set_deinterlace_field_order( + source, (enum obs_deinterlace_field_order)di_order); monitoring_type = (int)obs_data_get_int(source_data, "monitoring_type"); - obs_source_set_monitoring_type(source, - (enum obs_monitoring_type)monitoring_type); + if (prev_ver < MAKE_SEMANTIC_VERSION(23, 2, 2)) { + if ((caps & OBS_SOURCE_MONITOR_BY_DEFAULT) != 0) { + /* updates older sources to enable monitoring + * automatically if they added monitoring by default in + * version 24 */ + monitoring_type = OBS_MONITORING_TYPE_MONITOR_ONLY; + obs_source_set_audio_mixers(source, 0x3F); + } + } + obs_source_set_monitoring_type( + source, (enum obs_monitoring_type)monitoring_type); obs_data_release(source->private_settings); source->private_settings = @@ -1784,8 +1857,8 @@ obs_data_t *filter_data = obs_data_array_item(filters, i); - obs_source_t *filter = obs_load_source_type( - filter_data); + obs_source_t *filter = + obs_load_source_type(filter_data); if (filter) { obs_source_filter_add(source, filter); obs_source_release(filter); @@ -1808,12 +1881,13 @@ } void obs_load_sources(obs_data_array_t *array, obs_load_source_cb cb, - void *private_data) + void *private_data) { - if (!obs) return; + if (!obs) + return; struct obs_core_data *data = &obs->data; - DARRAY(obs_source_t*) sources; + DARRAY(obs_source_t *) sources; size_t count; size_t i; @@ -1825,8 +1899,8 @@ pthread_mutex_lock(&data->sources_mutex); for (i = 0; i < count; i++) { - obs_data_t *source_data = obs_data_array_item(array, i); - obs_source_t *source = obs_load_source(source_data); + obs_data_t *source_data = obs_data_array_item(array, i); + obs_source_t *source = obs_load_source(source_data); da_push_back(sources, &source); @@ -1864,26 +1938,25 @@ { obs_data_array_t *filters = obs_data_array_create(); obs_data_t *source_data = obs_data_create(); - obs_data_t *settings = obs_source_get_settings(source); + obs_data_t *settings = obs_source_get_settings(source); obs_data_t *hotkey_data = source->context.hotkey_data; obs_data_t *hotkeys; - float volume = obs_source_get_volume(source); - float balance = obs_source_get_balance_value(source); - uint32_t mixers = obs_source_get_audio_mixers(source); - int64_t sync = obs_source_get_sync_offset(source); - uint32_t flags = obs_source_get_flags(source); - const char *name = obs_source_get_name(source); - const char *id = obs_source_get_id(source); - bool enabled = obs_source_enabled(source); - bool muted = obs_source_muted(source); - bool push_to_mute= obs_source_push_to_mute_enabled(source); - uint64_t ptm_delay = obs_source_get_push_to_mute_delay(source); - bool push_to_talk= obs_source_push_to_talk_enabled(source); - uint64_t ptt_delay = obs_source_get_push_to_talk_delay(source); - int m_type = (int)obs_source_get_monitoring_type(source); - int di_mode = (int)obs_source_get_deinterlace_mode(source); - int di_order = - (int)obs_source_get_deinterlace_field_order(source); + float volume = obs_source_get_volume(source); + float balance = obs_source_get_balance_value(source); + uint32_t mixers = obs_source_get_audio_mixers(source); + int64_t sync = obs_source_get_sync_offset(source); + uint32_t flags = obs_source_get_flags(source); + const char *name = obs_source_get_name(source); + const char *id = obs_source_get_id(source); + bool enabled = obs_source_enabled(source); + bool muted = obs_source_muted(source); + bool push_to_mute = obs_source_push_to_mute_enabled(source); + uint64_t ptm_delay = obs_source_get_push_to_mute_delay(source); + bool push_to_talk = obs_source_push_to_talk_enabled(source); + uint64_t ptt_delay = obs_source_get_push_to_talk_delay(source); + int m_type = (int)obs_source_get_monitoring_type(source); + int di_mode = (int)obs_source_get_deinterlace_mode(source); + int di_order = (int)obs_source_get_deinterlace_field_order(source); obs_source_save(source); hotkeys = obs_hotkeys_save_source(source); @@ -1894,27 +1967,29 @@ hotkey_data = hotkeys; } - obs_data_set_string(source_data, "name", name); - obs_data_set_string(source_data, "id", id); - obs_data_set_obj (source_data, "settings", settings); - obs_data_set_int (source_data, "mixers", mixers); - obs_data_set_int (source_data, "sync", sync); - obs_data_set_int (source_data, "flags", flags); - obs_data_set_double(source_data, "volume", volume); - obs_data_set_double(source_data, "balance", balance); - obs_data_set_bool (source_data, "enabled", enabled); - obs_data_set_bool (source_data, "muted", muted); - obs_data_set_bool (source_data, "push-to-mute", push_to_mute); - obs_data_set_int (source_data, "push-to-mute-delay", ptm_delay); - obs_data_set_bool (source_data, "push-to-talk", push_to_talk); - obs_data_set_int (source_data, "push-to-talk-delay", ptt_delay); - obs_data_set_obj (source_data, "hotkeys", hotkey_data); - obs_data_set_int (source_data, "deinterlace_mode", di_mode); - obs_data_set_int (source_data, "deinterlace_field_order", di_order); - obs_data_set_int (source_data, "monitoring_type", m_type); + obs_data_set_int(source_data, "prev_ver", LIBOBS_API_VER); + + obs_data_set_string(source_data, "name", name); + obs_data_set_string(source_data, "id", id); + obs_data_set_obj(source_data, "settings", settings); + obs_data_set_int(source_data, "mixers", mixers); + obs_data_set_int(source_data, "sync", sync); + obs_data_set_int(source_data, "flags", flags); + obs_data_set_double(source_data, "volume", volume); + obs_data_set_double(source_data, "balance", balance); + obs_data_set_bool(source_data, "enabled", enabled); + obs_data_set_bool(source_data, "muted", muted); + obs_data_set_bool(source_data, "push-to-mute", push_to_mute); + obs_data_set_int(source_data, "push-to-mute-delay", ptm_delay); + obs_data_set_bool(source_data, "push-to-talk", push_to_talk); + obs_data_set_int(source_data, "push-to-talk-delay", ptt_delay); + obs_data_set_obj(source_data, "hotkeys", hotkey_data); + obs_data_set_int(source_data, "deinterlace_mode", di_mode); + obs_data_set_int(source_data, "deinterlace_field_order", di_order); + obs_data_set_int(source_data, "monitoring_type", m_type); obs_data_set_obj(source_data, "private_settings", - source->private_settings); + source->private_settings); if (source->info.type == OBS_SOURCE_TYPE_TRANSITION) obs_transition_save(source, source_data); @@ -1941,9 +2016,10 @@ } obs_data_array_t *obs_save_sources_filtered(obs_save_source_filter_cb cb, - void *data_) + void *data_) { - if (!obs) return NULL; + if (!obs) + return NULL; struct obs_core_data *data = &obs->data; obs_data_array_t *array; @@ -1957,14 +2033,14 @@ while (source) { if ((source->info.type != OBS_SOURCE_TYPE_FILTER) != 0 && - !source->context.private && cb(data_, source)) { + !source->context.private && cb(data_, source)) { obs_data_t *source_data = obs_save_source(source); obs_data_array_push_back(array, source_data); obs_data_release(source_data); } - source = (obs_source_t*)source->context.next; + source = (obs_source_t *)source->context.next; } pthread_mutex_unlock(&data->sources_mutex); @@ -1993,7 +2069,7 @@ if (!name || !*name) { struct dstr unnamed = {0}; dstr_printf(&unnamed, "__unnamed%04lld", - obs->data.unnamed_index++); + obs->data.unnamed_index++); return unnamed.array; } else { @@ -2001,13 +2077,12 @@ } } -static inline bool obs_context_data_init_wrap( - struct obs_context_data *context, - enum obs_obj_type type, - obs_data_t *settings, - const char *name, - obs_data_t *hotkey_data, - bool private) +static inline bool obs_context_data_init_wrap(struct obs_context_data *context, + enum obs_obj_type type, + obs_data_t *settings, + const char *name, + obs_data_t *hotkey_data, + bool private) { assert(context); memset(context, 0, sizeof(*context)); @@ -2026,22 +2101,19 @@ if (!context->procs) return false; - context->name = dup_name(name, private); - context->settings = obs_data_newref(settings); + context->name = dup_name(name, private); + context->settings = obs_data_newref(settings); context->hotkey_data = obs_data_newref(hotkey_data); return true; } -bool obs_context_data_init( - struct obs_context_data *context, - enum obs_obj_type type, - obs_data_t *settings, - const char *name, - obs_data_t *hotkey_data, - bool private) +bool obs_context_data_init(struct obs_context_data *context, + enum obs_obj_type type, obs_data_t *settings, + const char *name, obs_data_t *hotkey_data, + bool private) { if (obs_context_data_init_wrap(context, type, settings, name, - hotkey_data, private)) { + hotkey_data, private)) { return true; } else { obs_context_data_free(context); @@ -2067,7 +2139,7 @@ } void obs_context_data_insert(struct obs_context_data *context, - pthread_mutex_t *mutex, void *pfirst) + pthread_mutex_t *mutex, void *pfirst) { struct obs_context_data **first = pfirst; @@ -2078,9 +2150,9 @@ context->mutex = mutex; pthread_mutex_lock(mutex); - context->prev_next = first; - context->next = *first; - *first = context; + context->prev_next = first; + context->next = *first; + *first = context; if (context->next) context->next->prev_next = &context->next; pthread_mutex_unlock(mutex); @@ -2101,7 +2173,7 @@ } void obs_context_data_setname(struct obs_context_data *context, - const char *name) + const char *name) { pthread_mutex_lock(&context->rename_cache_mutex); @@ -2135,6 +2207,11 @@ return obs ? obs->video.video_avg_frame_time_ns : 0; } +uint64_t obs_get_frame_interval_ns(void) +{ + return obs ? obs->video.video_frame_interval_ns : 0; +} + enum obs_obj_type obs_obj_get_type(void *obj) { struct obs_context_data *context = obj; @@ -2148,10 +2225,14 @@ return NULL; switch (context->type) { - case OBS_OBJ_TYPE_SOURCE: return ((obs_source_t*)obj)->info.id; - case OBS_OBJ_TYPE_OUTPUT: return ((obs_output_t*)obj)->info.id; - case OBS_OBJ_TYPE_ENCODER: return ((obs_encoder_t*)obj)->info.id; - case OBS_OBJ_TYPE_SERVICE: return ((obs_service_t*)obj)->info.id; + case OBS_OBJ_TYPE_SOURCE: + return ((obs_source_t *)obj)->info.id; + case OBS_OBJ_TYPE_OUTPUT: + return ((obs_output_t *)obj)->info.id; + case OBS_OBJ_TYPE_ENCODER: + return ((obs_encoder_t *)obj)->info.id; + case OBS_OBJ_TYPE_SERVICE: + return ((obs_service_t *)obj)->info.id; default:; } @@ -2220,9 +2301,8 @@ *id = obs->audio.monitoring_device_id; } -void obs_add_tick_callback( - void (*tick)(void *param, float seconds), - void *param) +void obs_add_tick_callback(void (*tick)(void *param, float seconds), + void *param) { if (!obs) return; @@ -2234,9 +2314,8 @@ pthread_mutex_unlock(&obs->data.draw_callbacks_mutex); } -void obs_remove_tick_callback( - void (*tick)(void *param, float seconds), - void *param) +void obs_remove_tick_callback(void (*tick)(void *param, float seconds), + void *param) { if (!obs) return; @@ -2248,9 +2327,9 @@ pthread_mutex_unlock(&obs->data.draw_callbacks_mutex); } -void obs_add_main_render_callback( - void (*draw)(void *param, uint32_t cx, uint32_t cy), - void *param) +void obs_add_main_render_callback(void (*draw)(void *param, uint32_t cx, + uint32_t cy), + void *param) { if (!obs) return; @@ -2262,9 +2341,9 @@ pthread_mutex_unlock(&obs->data.draw_callbacks_mutex); } -void obs_remove_main_render_callback( - void (*draw)(void *param, uint32_t cx, uint32_t cy), - void *param) +void obs_remove_main_render_callback(void (*draw)(void *param, uint32_t cx, + uint32_t cy), + void *param) { if (!obs) return; @@ -2287,8 +2366,8 @@ } void start_raw_video(video_t *v, const struct video_scale_info *conversion, - void (*callback)(void *param, struct video_data *frame), - void *param) + void (*callback)(void *param, struct video_data *frame), + void *param) { struct obs_core_video *video = &obs->video; os_atomic_inc_long(&video->raw_active); @@ -2296,18 +2375,18 @@ } void stop_raw_video(video_t *v, - void (*callback)(void *param, struct video_data *frame), - void *param) + void (*callback)(void *param, struct video_data *frame), + void *param) { struct obs_core_video *video = &obs->video; os_atomic_dec_long(&video->raw_active); video_output_disconnect(v, callback, param); } -void obs_add_raw_video_callback( - const struct video_scale_info *conversion, - void (*callback)(void *param, struct video_data *frame), - void *param) +void obs_add_raw_video_callback(const struct video_scale_info *conversion, + void (*callback)(void *param, + struct video_data *frame), + void *param) { struct obs_core_video *video = &obs->video; if (!obs) @@ -2315,9 +2394,9 @@ start_raw_video(video->video, conversion, callback, param); } -void obs_remove_raw_video_callback( - void (*callback)(void *param, struct video_data *frame), - void *param) +void obs_remove_raw_video_callback(void (*callback)(void *param, + struct video_data *frame), + void *param) { struct obs_core_video *video = &obs->video; if (!obs)
View file
obs-studio-23.2.1.tar.xz/libobs/obs.h -> obs-studio-24.0.0.tar.xz/libobs/obs.h
Changed
@@ -51,20 +51,20 @@ struct obs_fader; struct obs_volmeter; -typedef struct obs_display obs_display_t; -typedef struct obs_view obs_view_t; -typedef struct obs_source obs_source_t; -typedef struct obs_scene obs_scene_t; +typedef struct obs_display obs_display_t; +typedef struct obs_view obs_view_t; +typedef struct obs_source obs_source_t; +typedef struct obs_scene obs_scene_t; typedef struct obs_scene_item obs_sceneitem_t; -typedef struct obs_output obs_output_t; -typedef struct obs_encoder obs_encoder_t; -typedef struct obs_service obs_service_t; -typedef struct obs_module obs_module_t; -typedef struct obs_fader obs_fader_t; -typedef struct obs_volmeter obs_volmeter_t; - -typedef struct obs_weak_source obs_weak_source_t; -typedef struct obs_weak_output obs_weak_output_t; +typedef struct obs_output obs_output_t; +typedef struct obs_encoder obs_encoder_t; +typedef struct obs_service obs_service_t; +typedef struct obs_module obs_module_t; +typedef struct obs_fader obs_fader_t; +typedef struct obs_volmeter obs_volmeter_t; + +typedef struct obs_weak_source obs_weak_source_t; +typedef struct obs_weak_output obs_weak_output_t; typedef struct obs_weak_encoder obs_weak_encoder_t; typedef struct obs_weak_service obs_weak_service_t; @@ -98,7 +98,7 @@ OBS_ORDER_MOVE_UP, OBS_ORDER_MOVE_DOWN, OBS_ORDER_MOVE_TOP, - OBS_ORDER_MOVE_BOTTOM + OBS_ORDER_MOVE_BOTTOM, }; /** @@ -136,14 +136,14 @@ }; struct obs_transform_info { - struct vec2 pos; - float rot; - struct vec2 scale; - uint32_t alignment; + struct vec2 pos; + float rot; + struct vec2 scale; + uint32_t alignment; enum obs_bounds_type bounds_type; - uint32_t bounds_alignment; - struct vec2 bounds; + uint32_t bounds_alignment; + struct vec2 bounds; }; /** @@ -154,36 +154,36 @@ /** * Graphics module to use (usually "libobs-opengl" or "libobs-d3d11") */ - const char *graphics_module; + const char *graphics_module; #endif - uint32_t fps_num; /**< Output FPS numerator */ - uint32_t fps_den; /**< Output FPS denominator */ + uint32_t fps_num; /**< Output FPS numerator */ + uint32_t fps_den; /**< Output FPS denominator */ - uint32_t base_width; /**< Base compositing width */ - uint32_t base_height; /**< Base compositing height */ + uint32_t base_width; /**< Base compositing width */ + uint32_t base_height; /**< Base compositing height */ - uint32_t output_width; /**< Output width */ - uint32_t output_height; /**< Output height */ - enum video_format output_format; /**< Output format */ + uint32_t output_width; /**< Output width */ + uint32_t output_height; /**< Output height */ + enum video_format output_format; /**< Output format */ /** Video adapter index to use (NOTE: avoid for optimus laptops) */ - uint32_t adapter; + uint32_t adapter; /** Use shaders to convert to different color formats */ - bool gpu_conversion; + bool gpu_conversion; - enum video_colorspace colorspace; /**< YUV type (if YUV) */ - enum video_range_type range; /**< YUV range (if YUV) */ + enum video_colorspace colorspace; /**< YUV type (if YUV) */ + enum video_range_type range; /**< YUV range (if YUV) */ - enum obs_scale_type scale_type; /**< How to scale if scaling */ + enum obs_scale_type scale_type; /**< How to scale if scaling */ }; /** * Audio initialization structure */ struct obs_audio_info { - uint32_t samples_per_sec; + uint32_t samples_per_sec; enum speaker_layout speakers; }; @@ -192,9 +192,9 @@ * audio data */ struct obs_audio_data { - uint8_t *data[MAX_AV_PLANES]; - uint32_t frames; - uint64_t timestamp; + uint8_t *data[MAX_AV_PLANES]; + uint32_t frames; + uint64_t timestamp; }; /** @@ -202,14 +202,14 @@ * source audio. Audio is automatically resampled and remixed as necessary. */ struct obs_source_audio { - const uint8_t *data[MAX_AV_PLANES]; - uint32_t frames; + const uint8_t *data[MAX_AV_PLANES]; + uint32_t frames; enum speaker_layout speakers; - enum audio_format format; - uint32_t samples_per_sec; + enum audio_format format; + uint32_t samples_per_sec; - uint64_t timestamp; + uint64_t timestamp; }; /** @@ -226,37 +226,37 @@ * instead if partial range support is desired for non-YUV video formats. */ struct obs_source_frame { - uint8_t *data[MAX_AV_PLANES]; - uint32_t linesize[MAX_AV_PLANES]; - uint32_t width; - uint32_t height; - uint64_t timestamp; - - enum video_format format; - float color_matrix[16]; - bool full_range; - float color_range_min[3]; - float color_range_max[3]; - bool flip; + uint8_t *data[MAX_AV_PLANES]; + uint32_t linesize[MAX_AV_PLANES]; + uint32_t width; + uint32_t height; + uint64_t timestamp; + + enum video_format format; + float color_matrix[16]; + bool full_range; + float color_range_min[3]; + float color_range_max[3]; + bool flip; /* used internally by libobs */ - volatile long refs; - bool prev_frame; + volatile long refs; + bool prev_frame; }; struct obs_source_frame2 { - uint8_t *data[MAX_AV_PLANES]; - uint32_t linesize[MAX_AV_PLANES]; - uint32_t width; - uint32_t height; - uint64_t timestamp; + uint8_t *data[MAX_AV_PLANES]; + uint32_t linesize[MAX_AV_PLANES]; + uint32_t width; + uint32_t height; + uint64_t timestamp; - enum video_format format; + enum video_format format; enum video_range_type range; - float color_matrix[16]; - float color_range_min[3]; - float color_range_max[3]; - bool flip; + float color_matrix[16]; + float color_range_min[3]; + float color_range_max[3]; + bool flip; }; /** Access to the argc/argv used to start OBS. What you see is what you get. */ @@ -293,7 +293,6 @@ */ EXPORT bool obs_remove_data_path(const char *path); - /** * Initializes OBS * @@ -303,7 +302,7 @@ * @param store The profiler name store for OBS to use or NULL */ EXPORT bool obs_startup(const char *locale, const char *module_config_path, - profiler_name_store_t *store); + profiler_name_store_t *store); /** Releases all data associated with OBS and terminates the OBS context */ EXPORT void obs_shutdown(void); @@ -325,7 +324,7 @@ * @param argv An array of command line arguments, copied from main() and ends * with NULL. */ -EXPORT void obs_set_cmdline_args(int argc, const char * const *argv); +EXPORT void obs_set_cmdline_args(int argc, const char *const *argv); /** * Get the argc/argv used to start OBS @@ -412,7 +411,7 @@ * MODULE_INCOMPATIBLE_VER if incompatible version */ EXPORT int obs_open_module(obs_module_t **module, const char *path, - const char *data_path); + const char *data_path); /** * Initializes the module, which calls its obs_module_load export. If the @@ -466,7 +465,7 @@ }; typedef void (*obs_find_module_callback_t)(void *param, - const struct obs_module_info *info); + const struct obs_module_info *info); /** Finds all modules within the search paths added by obs_add_module_path. */ EXPORT void obs_find_modules(obs_find_module_callback_t callback, void *param); @@ -479,7 +478,8 @@ /** Helper function for using default module locale */ EXPORT lookup_t *obs_module_load_locale(obs_module_t *module, - const char *default_locale, const char *locale); + const char *default_locale, + const char *locale); /** * Returns the location of a plugin module data file. @@ -576,24 +576,24 @@ * Use obs_source_get_ref or obs_source_get_weak_source if you want to retain * a reference after obs_enum_sources finishes */ -EXPORT void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t*), - void *param); +EXPORT void obs_enum_sources(bool (*enum_proc)(void *, obs_source_t *), + void *param); /** Enumerates scenes */ -EXPORT void obs_enum_scenes(bool (*enum_proc)(void*, obs_source_t*), - void *param); +EXPORT void obs_enum_scenes(bool (*enum_proc)(void *, obs_source_t *), + void *param); /** Enumerates outputs */ -EXPORT void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t*), - void *param); +EXPORT void obs_enum_outputs(bool (*enum_proc)(void *, obs_output_t *), + void *param); /** Enumerates encoders */ -EXPORT void obs_enum_encoders(bool (*enum_proc)(void*, obs_encoder_t*), - void *param); +EXPORT void obs_enum_encoders(bool (*enum_proc)(void *, obs_encoder_t *), + void *param); /** Enumerates encoders */ -EXPORT void obs_enum_services(bool (*enum_proc)(void*, obs_service_t*), - void *param); +EXPORT void obs_enum_services(bool (*enum_proc)(void *, obs_service_t *), + void *param); /** * Gets a source by its name. @@ -613,16 +613,16 @@ EXPORT obs_service_t *obs_get_service_by_name(const char *name); enum obs_base_effect { - OBS_EFFECT_DEFAULT, /**< RGB/YUV */ - OBS_EFFECT_DEFAULT_RECT, /**< RGB/YUV (using texture_rect) */ - OBS_EFFECT_OPAQUE, /**< RGB/YUV (alpha set to 1.0) */ - OBS_EFFECT_SOLID, /**< RGB/YUV (solid color only) */ - OBS_EFFECT_BICUBIC, /**< Bicubic downscale */ - OBS_EFFECT_LANCZOS, /**< Lanczos downscale */ - OBS_EFFECT_BILINEAR_LOWRES, /**< Bilinear low resolution downscale */ - OBS_EFFECT_PREMULTIPLIED_ALPHA,/**< Premultiplied alpha */ - OBS_EFFECT_REPEAT, /**< RGB/YUV (repeating) */ - OBS_EFFECT_AREA, /**< Area rescale */ + OBS_EFFECT_DEFAULT, /**< RGB/YUV */ + OBS_EFFECT_DEFAULT_RECT, /**< RGB/YUV (using texture_rect) */ + OBS_EFFECT_OPAQUE, /**< RGB/YUV (alpha set to 1.0) */ + OBS_EFFECT_SOLID, /**< RGB/YUV (solid color only) */ + OBS_EFFECT_BICUBIC, /**< Bicubic downscale */ + OBS_EFFECT_LANCZOS, /**< Lanczos downscale */ + OBS_EFFECT_BILINEAR_LOWRES, /**< Bilinear low resolution downscale */ + OBS_EFFECT_PREMULTIPLIED_ALPHA, /**< Premultiplied alpha */ + OBS_EFFECT_REPEAT, /**< RGB/YUV (repeating) */ + OBS_EFFECT_AREA, /**< Area rescale */ }; /** Returns a commonly used base effect */ @@ -649,6 +649,9 @@ /** Renders the last main output texture */ EXPORT void obs_render_main_texture(void); +/** Renders the last main output texture ignoring background color */ +EXPORT void obs_render_main_texture_src_color_only(void); + /** Returns the last main output texture. This can return NULL if the texture * is unavailable. */ EXPORT gs_texture_t *obs_get_main_texture(void); @@ -675,21 +678,21 @@ /** Loads sources from a data array */ EXPORT void obs_load_sources(obs_data_array_t *array, obs_load_source_cb cb, - void *private_data); + void *private_data); /** Saves sources to a data array */ EXPORT obs_data_array_t *obs_save_sources(void); typedef bool (*obs_save_source_filter_cb)(void *data, obs_source_t *source); EXPORT obs_data_array_t *obs_save_sources_filtered(obs_save_source_filter_cb cb, - void *data); + void *data); enum obs_obj_type { OBS_OBJ_TYPE_INVALID, OBS_OBJ_TYPE_SOURCE, OBS_OBJ_TYPE_OUTPUT, OBS_OBJ_TYPE_ENCODER, - OBS_OBJ_TYPE_SERVICE + OBS_OBJ_TYPE_SERVICE, }; EXPORT enum obs_obj_type obs_obj_get_type(void *obj); @@ -698,40 +701,36 @@ EXPORT void *obs_obj_get_data(void *obj); typedef bool (*obs_enum_audio_device_cb)(void *data, const char *name, - const char *id); + const char *id); EXPORT void obs_enum_audio_monitoring_devices(obs_enum_audio_device_cb cb, - void *data); + void *data); EXPORT bool obs_set_audio_monitoring_device(const char *name, const char *id); EXPORT void obs_get_audio_monitoring_device(const char **name, const char **id); -EXPORT void obs_add_tick_callback( - void (*tick)(void *param, float seconds), - void *param); -EXPORT void obs_remove_tick_callback( - void (*tick)(void *param, float seconds), - void *param); +EXPORT void obs_add_tick_callback(void (*tick)(void *param, float seconds), + void *param); +EXPORT void obs_remove_tick_callback(void (*tick)(void *param, float seconds), + void *param); -EXPORT void obs_add_main_render_callback( - void (*draw)(void *param, uint32_t cx, uint32_t cy), - void *param); +EXPORT void obs_add_main_render_callback(void (*draw)(void *param, uint32_t cx, + uint32_t cy), + void *param); EXPORT void obs_remove_main_render_callback( - void (*draw)(void *param, uint32_t cx, uint32_t cy), - void *param); + void (*draw)(void *param, uint32_t cx, uint32_t cy), void *param); EXPORT void obs_add_raw_video_callback( - const struct video_scale_info *conversion, - void (*callback)(void *param, struct video_data *frame), - void *param); + const struct video_scale_info *conversion, + void (*callback)(void *param, struct video_data *frame), void *param); EXPORT void obs_remove_raw_video_callback( - void (*callback)(void *param, struct video_data *frame), - void *param); + void (*callback)(void *param, struct video_data *frame), void *param); EXPORT uint64_t obs_get_video_frame_time(void); EXPORT double obs_get_active_fps(void); EXPORT uint64_t obs_get_average_frame_time_ns(void); +EXPORT uint64_t obs_get_frame_interval_ns(void); EXPORT uint32_t obs_get_total_frames(void); EXPORT uint32_t obs_get_lagged_frames(void); @@ -742,7 +741,6 @@ EXPORT void obs_set_private_data(obs_data_t *settings); EXPORT obs_data_t *obs_get_private_data(void); - /* ------------------------------------------------------------------------- */ /* View context */ @@ -759,16 +757,14 @@ /** Sets the source to be used for this view context. */ EXPORT void obs_view_set_source(obs_view_t *view, uint32_t channel, - obs_source_t *source); + obs_source_t *source); /** Gets the source currently in use for this view context */ -EXPORT obs_source_t *obs_view_get_source(obs_view_t *view, - uint32_t channel); +EXPORT obs_source_t *obs_view_get_source(obs_view_t *view, uint32_t channel); /** Renders the sources of this view context */ EXPORT void obs_view_render(obs_view_t *view); - /* ------------------------------------------------------------------------- */ /* Display context */ @@ -779,16 +775,16 @@ * @param graphics_data The swap chain initialization data. * @return The new display context, or NULL if failed. */ -EXPORT obs_display_t *obs_display_create( - const struct gs_init_data *graphics_data, - uint32_t backround_color); +EXPORT obs_display_t * +obs_display_create(const struct gs_init_data *graphics_data, + uint32_t backround_color); /** Destroys a display context */ EXPORT void obs_display_destroy(obs_display_t *display); /** Changes the size of this display */ EXPORT void obs_display_resize(obs_display_t *display, uint32_t cx, - uint32_t cy); + uint32_t cy); /** * Adds a draw callback for this display context @@ -799,23 +795,23 @@ * @param param The user data to be associated with this draw callback. */ EXPORT void obs_display_add_draw_callback(obs_display_t *display, - void (*draw)(void *param, uint32_t cx, uint32_t cy), - void *param); + void (*draw)(void *param, uint32_t cx, + uint32_t cy), + void *param); /** Removes a draw callback for this display context */ -EXPORT void obs_display_remove_draw_callback(obs_display_t *display, - void (*draw)(void *param, uint32_t cx, uint32_t cy), - void *param); +EXPORT void obs_display_remove_draw_callback( + obs_display_t *display, + void (*draw)(void *param, uint32_t cx, uint32_t cy), void *param); EXPORT void obs_display_set_enabled(obs_display_t *display, bool enable); EXPORT bool obs_display_enabled(obs_display_t *display); EXPORT void obs_display_set_background_color(obs_display_t *display, - uint32_t color); - -EXPORT void obs_display_size(obs_display_t *display, - uint32_t *width, uint32_t *height); + uint32_t color); +EXPORT void obs_display_size(obs_display_t *display, uint32_t *width, + uint32_t *height); /* ------------------------------------------------------------------------- */ /* Sources */ @@ -830,15 +826,17 @@ * or modifying video/audio. Use obs_source_release to release it. */ EXPORT obs_source_t *obs_source_create(const char *id, const char *name, - obs_data_t *settings, obs_data_t *hotkey_data); + obs_data_t *settings, + obs_data_t *hotkey_data); -EXPORT obs_source_t *obs_source_create_private(const char *id, - const char *name, obs_data_t *settings); +EXPORT obs_source_t *obs_source_create_private(const char *id, const char *name, + obs_data_t *settings); /* if source has OBS_SOURCE_DO_NOT_DUPLICATE output flag set, only returns a * reference */ EXPORT obs_source_t *obs_source_duplicate(obs_source_t *source, - const char *desired_name, bool create_private); + const char *desired_name, + bool create_private); /** * Adds/releases a reference to a source. When the last reference is * released, the source is destroyed. @@ -854,7 +852,7 @@ EXPORT obs_source_t *obs_weak_source_get_source(obs_weak_source_t *weak); EXPORT bool obs_weak_source_references_source(obs_weak_source_t *weak, - obs_source_t *source); + obs_source_t *source); /** Notifies all references that the source should be released */ EXPORT void obs_source_remove(obs_source_t *source); @@ -919,11 +917,12 @@ /** Removes a filter from the source */ EXPORT void obs_source_filter_remove(obs_source_t *source, - obs_source_t *filter); + obs_source_t *filter); /** Modifies the order of a specific filter */ EXPORT void obs_source_filter_set_order(obs_source_t *source, - obs_source_t *filter, enum obs_order_movement movement); + obs_source_t *filter, + enum obs_order_movement movement); /** Gets the settings string for a source */ EXPORT obs_data_t *obs_source_get_settings(const obs_source_t *source); @@ -941,8 +940,8 @@ EXPORT const char *obs_source_get_id(const obs_source_t *source); /** Returns the signal handler for a source */ -EXPORT signal_handler_t *obs_source_get_signal_handler( - const obs_source_t *source); +EXPORT signal_handler_t * +obs_source_get_signal_handler(const obs_source_t *source); /** Returns the procedure handler for a source */ EXPORT proc_handler_t *obs_source_get_proc_handler(const obs_source_t *source); @@ -970,13 +969,13 @@ /** Enumerates active child sources used by this source */ EXPORT void obs_source_enum_active_sources(obs_source_t *source, - obs_source_enum_proc_t enum_callback, - void *param); + obs_source_enum_proc_t enum_callback, + void *param); /** Enumerates the entire active child source tree used by this source */ EXPORT void obs_source_enum_active_tree(obs_source_t *source, - obs_source_enum_proc_t enum_callback, - void *param); + obs_source_enum_proc_t enum_callback, + void *param); /** Returns true if active, false if not */ EXPORT bool obs_source_active(const obs_source_t *source); @@ -987,9 +986,9 @@ EXPORT bool obs_source_showing(const obs_source_t *source); /** Unused flag */ -#define OBS_SOURCE_FLAG_UNUSED_1 (1<<0) +#define OBS_SOURCE_FLAG_UNUSED_1 (1 << 0) /** Specifies to force audio to mono */ -#define OBS_SOURCE_FLAG_FORCE_MONO (1<<1) +#define OBS_SOURCE_FLAG_FORCE_MONO (1 << 1) /** * Sets source flags. Note that these are different from the main output @@ -1049,11 +1048,12 @@ /** Enumerates filters assigned to the source */ EXPORT void obs_source_enum_filters(obs_source_t *source, - obs_source_enum_proc_t callback, void *param); + obs_source_enum_proc_t callback, + void *param); /** Gets a filter of a source by its display name. */ EXPORT obs_source_t *obs_source_get_filter_by_name(obs_source_t *source, - const char *name); + const char *name); EXPORT void obs_source_copy_filters(obs_source_t *dst, obs_source_t *src); @@ -1068,22 +1068,23 @@ EXPORT uint64_t obs_source_get_push_to_mute_delay(obs_source_t *source); EXPORT void obs_source_set_push_to_mute_delay(obs_source_t *source, - uint64_t delay); + uint64_t delay); EXPORT bool obs_source_push_to_talk_enabled(obs_source_t *source); EXPORT void obs_source_enable_push_to_talk(obs_source_t *source, bool enabled); EXPORT uint64_t obs_source_get_push_to_talk_delay(obs_source_t *source); EXPORT void obs_source_set_push_to_talk_delay(obs_source_t *source, - uint64_t delay); + uint64_t delay); typedef void (*obs_source_audio_capture_t)(void *param, obs_source_t *source, - const struct audio_data *audio_data, bool muted); + const struct audio_data *audio_data, + bool muted); -EXPORT void obs_source_add_audio_capture_callback(obs_source_t *source, - obs_source_audio_capture_t callback, void *param); -EXPORT void obs_source_remove_audio_capture_callback(obs_source_t *source, - obs_source_audio_capture_t callback, void *param); +EXPORT void obs_source_add_audio_capture_callback( + obs_source_t *source, obs_source_audio_capture_t callback, void *param); +EXPORT void obs_source_remove_audio_capture_callback( + obs_source_t *source, obs_source_audio_capture_t callback, void *param); enum obs_deinterlace_mode { OBS_DEINTERLACE_MODE_DISABLE, @@ -1094,33 +1095,33 @@ OBS_DEINTERLACE_MODE_LINEAR, OBS_DEINTERLACE_MODE_LINEAR_2X, OBS_DEINTERLACE_MODE_YADIF, - OBS_DEINTERLACE_MODE_YADIF_2X + OBS_DEINTERLACE_MODE_YADIF_2X, }; enum obs_deinterlace_field_order { OBS_DEINTERLACE_FIELD_ORDER_TOP, - OBS_DEINTERLACE_FIELD_ORDER_BOTTOM + OBS_DEINTERLACE_FIELD_ORDER_BOTTOM, }; EXPORT void obs_source_set_deinterlace_mode(obs_source_t *source, - enum obs_deinterlace_mode mode); -EXPORT enum obs_deinterlace_mode obs_source_get_deinterlace_mode( - const obs_source_t *source); -EXPORT void obs_source_set_deinterlace_field_order(obs_source_t *source, - enum obs_deinterlace_field_order field_order); -EXPORT enum obs_deinterlace_field_order obs_source_get_deinterlace_field_order( - const obs_source_t *source); + enum obs_deinterlace_mode mode); +EXPORT enum obs_deinterlace_mode +obs_source_get_deinterlace_mode(const obs_source_t *source); +EXPORT void obs_source_set_deinterlace_field_order( + obs_source_t *source, enum obs_deinterlace_field_order field_order); +EXPORT enum obs_deinterlace_field_order +obs_source_get_deinterlace_field_order(const obs_source_t *source); enum obs_monitoring_type { OBS_MONITORING_TYPE_NONE, OBS_MONITORING_TYPE_MONITOR_ONLY, - OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT + OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT, }; EXPORT void obs_source_set_monitoring_type(obs_source_t *source, - enum obs_monitoring_type type); -EXPORT enum obs_monitoring_type obs_source_get_monitoring_type( - const obs_source_t *source); + enum obs_monitoring_type type); +EXPORT enum obs_monitoring_type +obs_source_get_monitoring_type(const obs_source_t *source); /** Gets private front-end settings data. This data is saved/loaded * automatically. Returns an incremented reference. */ @@ -1143,10 +1144,10 @@ * 'color_range_max' effect variable. If NULL, * {1.0f, 1.0f, 1.0f} is used. */ -EXPORT void obs_source_draw_set_color_matrix( - const struct matrix4 *color_matrix, - const struct vec3 *color_range_min, - const struct vec3 *color_range_max); +EXPORT void +obs_source_draw_set_color_matrix(const struct matrix4 *color_matrix, + const struct vec3 *color_range_min, + const struct vec3 *color_range_max); /** * Helper function to draw sprites for a source (synchronous video). @@ -1159,8 +1160,8 @@ * @param cy Height of the sprite. If 0, uses the texture height. * @param flip Specifies whether to flip the image vertically. */ -EXPORT void obs_source_draw(gs_texture_t *image, int x, int y, - uint32_t cx, uint32_t cy, bool flip); +EXPORT void obs_source_draw(gs_texture_t *image, int x, int y, uint32_t cx, + uint32_t cy, bool flip); /** * Outputs asynchronous video data. Set to NULL to deactivate the texture @@ -1170,9 +1171,9 @@ * desired for non-YUV video formats. */ EXPORT void obs_source_output_video(obs_source_t *source, - const struct obs_source_frame *frame); + const struct obs_source_frame *frame); EXPORT void obs_source_output_video2(obs_source_t *source, - const struct obs_source_frame2 *frame); + const struct obs_source_frame2 *frame); /** * Preloads asynchronous video data to allow instantaneous playback @@ -1182,16 +1183,16 @@ * desired for non-YUV video formats. */ EXPORT void obs_source_preload_video(obs_source_t *source, - const struct obs_source_frame *frame); + const struct obs_source_frame *frame); EXPORT void obs_source_preload_video2(obs_source_t *source, - const struct obs_source_frame2 *frame); + const struct obs_source_frame2 *frame); /** Shows any preloaded video data */ EXPORT void obs_source_show_preloaded_video(obs_source_t *source); /** Outputs audio data (always asynchronous) */ EXPORT void obs_source_output_audio(obs_source_t *source, - const struct obs_source_audio *audio); + const struct obs_source_audio *audio); /** Signal an update to any currently used properties via 'update_properties' */ EXPORT void obs_source_update_properties(obs_source_t *source); @@ -1201,7 +1202,7 @@ /** Releases the current async video frame */ EXPORT void obs_source_release_frame(obs_source_t *source, - struct obs_source_frame *frame); + struct obs_source_frame *frame); /** * Default RGB filter handler for generic effect filters. Processes the @@ -1214,9 +1215,10 @@ * Returns true if filtering should continue, false if the filter is bypassed * for whatever reason. */ -EXPORT bool obs_source_process_filter_begin(obs_source_t *filter, - enum gs_color_format format, - enum obs_allow_direct_render allow_direct); +EXPORT bool +obs_source_process_filter_begin(obs_source_t *filter, + enum gs_color_format format, + enum obs_allow_direct_render allow_direct); /** * Draws the filter. @@ -1226,7 +1228,8 @@ * filter. */ EXPORT void obs_source_process_filter_end(obs_source_t *filter, - gs_effect_t *effect, uint32_t width, uint32_t height); + gs_effect_t *effect, uint32_t width, + uint32_t height); /** * Draws the filter with a specific technique. @@ -1236,8 +1239,9 @@ * filter. */ EXPORT void obs_source_process_filter_tech_end(obs_source_t *filter, - gs_effect_t *effect, uint32_t width, uint32_t height, - const char *tech_name); + gs_effect_t *effect, + uint32_t width, uint32_t height, + const char *tech_name); /** Skips the filter if the filter is invalid and cannot be rendered */ EXPORT void obs_source_skip_video_filter(obs_source_t *filter); @@ -1250,7 +1254,7 @@ * @returns true if source can be added, false if it causes recursion */ EXPORT bool obs_source_add_active_child(obs_source_t *parent, - obs_source_t *child); + obs_source_t *child); /** * Removes an active child source. Must be called by parent sources on child @@ -1258,28 +1262,31 @@ * is properly deactivated if the parent is no longer active. */ EXPORT void obs_source_remove_active_child(obs_source_t *parent, - obs_source_t *child); + obs_source_t *child); /** Sends a mouse down/up event to a source */ EXPORT void obs_source_send_mouse_click(obs_source_t *source, - const struct obs_mouse_event *event, - int32_t type, bool mouse_up, - uint32_t click_count); + const struct obs_mouse_event *event, + int32_t type, bool mouse_up, + uint32_t click_count); /** Sends a mouse move event to a source. */ EXPORT void obs_source_send_mouse_move(obs_source_t *source, - const struct obs_mouse_event *event, bool mouse_leave); + const struct obs_mouse_event *event, + bool mouse_leave); /** Sends a mouse wheel event to a source */ EXPORT void obs_source_send_mouse_wheel(obs_source_t *source, - const struct obs_mouse_event *event, int x_delta, int y_delta); + const struct obs_mouse_event *event, + int x_delta, int y_delta); /** Sends a got-focus or lost-focus event to a source */ EXPORT void obs_source_send_focus(obs_source_t *source, bool focus); /** Sends a key up/down event to a source */ EXPORT void obs_source_send_key_click(obs_source_t *source, - const struct obs_key_event *event, bool key_up); + const struct obs_key_event *event, + bool key_up); /** Sets the default source flags. */ EXPORT void obs_source_set_default_flags(obs_source_t *source, uint32_t flags); @@ -1293,10 +1300,10 @@ EXPORT bool obs_source_audio_pending(const obs_source_t *source); EXPORT uint64_t obs_source_get_audio_timestamp(const obs_source_t *source); EXPORT void obs_source_get_audio_mix(const obs_source_t *source, - struct obs_source_audio_mix *audio); + struct obs_source_audio_mix *audio); EXPORT void obs_source_set_async_unbuffered(obs_source_t *source, - bool unbuffered); + bool unbuffered); EXPORT bool obs_source_async_unbuffered(const obs_source_t *source); /** Used to decouple audio from video so that audio doesn't attempt to sync up @@ -1309,11 +1316,12 @@ /* Transition-specific functions */ enum obs_transition_target { OBS_TRANSITION_SOURCE_A, - OBS_TRANSITION_SOURCE_B + OBS_TRANSITION_SOURCE_B, }; -EXPORT obs_source_t *obs_transition_get_source(obs_source_t *transition, - enum obs_transition_target target); +EXPORT obs_source_t * +obs_transition_get_source(obs_source_t *transition, + enum obs_transition_target target); EXPORT void obs_transition_clear(obs_source_t *transition); EXPORT obs_source_t *obs_transition_get_active_source(obs_source_t *transition); @@ -1323,8 +1331,8 @@ }; EXPORT bool obs_transition_start(obs_source_t *transition, - enum obs_transition_mode mode, uint32_t duration_ms, - obs_source_t *dest); + enum obs_transition_mode mode, + uint32_t duration_ms, obs_source_t *dest); EXPORT void obs_transition_set(obs_source_t *transition, obs_source_t *source); @@ -1335,18 +1343,18 @@ }; EXPORT void obs_transition_set_scale_type(obs_source_t *transition, - enum obs_transition_scale_type type); -EXPORT enum obs_transition_scale_type obs_transition_get_scale_type( - const obs_source_t *transition); + enum obs_transition_scale_type type); +EXPORT enum obs_transition_scale_type +obs_transition_get_scale_type(const obs_source_t *transition); EXPORT void obs_transition_set_alignment(obs_source_t *transition, - uint32_t alignment); + uint32_t alignment); EXPORT uint32_t obs_transition_get_alignment(const obs_source_t *transition); -EXPORT void obs_transition_set_size(obs_source_t *transition, - uint32_t cx, uint32_t cy); +EXPORT void obs_transition_set_size(obs_source_t *transition, uint32_t cx, + uint32_t cy); EXPORT void obs_transition_get_size(const obs_source_t *transition, - uint32_t *cx, uint32_t *cy); + uint32_t *cx, uint32_t *cy); /* function used by transitions */ @@ -1355,39 +1363,43 @@ * are of fixed duration and linearly interpolated */ EXPORT void obs_transition_enable_fixed(obs_source_t *transition, bool enable, - uint32_t duration_ms); + uint32_t duration_ms); EXPORT bool obs_transition_fixed(obs_source_t *transition); typedef void (*obs_transition_video_render_callback_t)(void *data, - gs_texture_t *a, gs_texture_t *b, float t, - uint32_t cx, uint32_t cy); + gs_texture_t *a, + gs_texture_t *b, float t, + uint32_t cx, + uint32_t cy); typedef float (*obs_transition_audio_mix_callback_t)(void *data, float t); EXPORT float obs_transition_get_time(obs_source_t *transition); EXPORT void obs_transition_force_stop(obs_source_t *transition); -EXPORT void obs_transition_video_render(obs_source_t *transition, - obs_transition_video_render_callback_t callback); +EXPORT void +obs_transition_video_render(obs_source_t *transition, + obs_transition_video_render_callback_t callback); /** Directly renders its sub-source instead of to texture. Returns false if no * longer transitioning */ -EXPORT bool obs_transition_video_render_direct(obs_source_t *transition, - enum obs_transition_target target); +EXPORT bool +obs_transition_video_render_direct(obs_source_t *transition, + enum obs_transition_target target); -EXPORT bool obs_transition_audio_render(obs_source_t *transition, - uint64_t *ts_out, struct obs_source_audio_mix *audio, - uint32_t mixers, size_t channels, size_t sample_rate, - obs_transition_audio_mix_callback_t mix_a_callback, - obs_transition_audio_mix_callback_t mix_b_callback); +EXPORT bool +obs_transition_audio_render(obs_source_t *transition, uint64_t *ts_out, + struct obs_source_audio_mix *audio, uint32_t mixers, + size_t channels, size_t sample_rate, + obs_transition_audio_mix_callback_t mix_a_callback, + obs_transition_audio_mix_callback_t mix_b_callback); /* swaps transition sources and textures as an optimization and to reduce * memory usage when switching between transitions */ EXPORT void obs_transition_swap_begin(obs_source_t *tr_dest, - obs_source_t *tr_source); + obs_source_t *tr_source); EXPORT void obs_transition_swap_end(obs_source_t *tr_dest, - obs_source_t *tr_source); - + obs_source_t *tr_source); /* ------------------------------------------------------------------------- */ /* Scenes */ @@ -1406,17 +1418,17 @@ OBS_SCENE_DUP_REFS, /**< Source refs only */ OBS_SCENE_DUP_COPY, /**< Fully duplicate */ OBS_SCENE_DUP_PRIVATE_REFS, /**< Source refs only (as private) */ - OBS_SCENE_DUP_PRIVATE_COPY /**< Fully duplicate (as private) */ + OBS_SCENE_DUP_PRIVATE_COPY, /**< Fully duplicate (as private) */ }; /** * Duplicates a scene. */ EXPORT obs_scene_t *obs_scene_duplicate(obs_scene_t *scene, const char *name, - enum obs_scene_duplicate_type type); + enum obs_scene_duplicate_type type); -EXPORT void obs_scene_addref(obs_scene_t *scene); -EXPORT void obs_scene_release(obs_scene_t *scene); +EXPORT void obs_scene_addref(obs_scene_t *scene); +EXPORT void obs_scene_release(obs_scene_t *scene); /** Gets the scene's source context */ EXPORT obs_source_t *obs_scene_get_source(const obs_scene_t *scene); @@ -1426,34 +1438,38 @@ /** Determines whether a source is within a scene */ EXPORT obs_sceneitem_t *obs_scene_find_source(obs_scene_t *scene, - const char *name); + const char *name); EXPORT obs_sceneitem_t *obs_scene_find_sceneitem_by_id(obs_scene_t *scene, - int64_t id); + int64_t id); /** Enumerates sources within a scene */ EXPORT void obs_scene_enum_items(obs_scene_t *scene, - bool (*callback)(obs_scene_t*, obs_sceneitem_t*, void*), - void *param); + bool (*callback)(obs_scene_t *, + obs_sceneitem_t *, void *), + void *param); EXPORT bool obs_scene_reorder_items(obs_scene_t *scene, - obs_sceneitem_t * const *item_order, size_t item_order_size); + obs_sceneitem_t *const *item_order, + size_t item_order_size); struct obs_sceneitem_order_info { obs_sceneitem_t *group; obs_sceneitem_t *item; }; -EXPORT bool obs_scene_reorder_items2(obs_scene_t *scene, - struct obs_sceneitem_order_info *item_order, - size_t item_order_size); +EXPORT bool +obs_scene_reorder_items2(obs_scene_t *scene, + struct obs_sceneitem_order_info *item_order, + size_t item_order_size); /** Adds/creates a new scene item for a source */ EXPORT obs_sceneitem_t *obs_scene_add(obs_scene_t *scene, obs_source_t *source); typedef void (*obs_scene_atomic_update_func)(void *, obs_scene_t *scene); EXPORT void obs_scene_atomic_update(obs_scene_t *scene, - obs_scene_atomic_update_func func, void *data); + obs_scene_atomic_update_func func, + void *data); EXPORT void obs_sceneitem_addref(obs_sceneitem_t *item); EXPORT void obs_sceneitem_release(obs_sceneitem_t *item); @@ -1475,49 +1491,50 @@ EXPORT bool obs_sceneitem_set_locked(obs_sceneitem_t *item, bool lock); /* Functions for getting/setting specific orientation of a scene item */ -EXPORT void obs_sceneitem_set_pos(obs_sceneitem_t *item, const struct vec2 *pos); +EXPORT void obs_sceneitem_set_pos(obs_sceneitem_t *item, + const struct vec2 *pos); EXPORT void obs_sceneitem_set_rot(obs_sceneitem_t *item, float rot_deg); EXPORT void obs_sceneitem_set_scale(obs_sceneitem_t *item, - const struct vec2 *scale); + const struct vec2 *scale); EXPORT void obs_sceneitem_set_alignment(obs_sceneitem_t *item, - uint32_t alignment); + uint32_t alignment); EXPORT void obs_sceneitem_set_order(obs_sceneitem_t *item, - enum obs_order_movement movement); + enum obs_order_movement movement); EXPORT void obs_sceneitem_set_order_position(obs_sceneitem_t *item, - int position); + int position); EXPORT void obs_sceneitem_set_bounds_type(obs_sceneitem_t *item, - enum obs_bounds_type type); + enum obs_bounds_type type); EXPORT void obs_sceneitem_set_bounds_alignment(obs_sceneitem_t *item, - uint32_t alignment); + uint32_t alignment); EXPORT void obs_sceneitem_set_bounds(obs_sceneitem_t *item, - const struct vec2 *bounds); + const struct vec2 *bounds); EXPORT int64_t obs_sceneitem_get_id(const obs_sceneitem_t *item); -EXPORT void obs_sceneitem_get_pos(const obs_sceneitem_t *item, - struct vec2 *pos); +EXPORT void obs_sceneitem_get_pos(const obs_sceneitem_t *item, + struct vec2 *pos); EXPORT float obs_sceneitem_get_rot(const obs_sceneitem_t *item); -EXPORT void obs_sceneitem_get_scale(const obs_sceneitem_t *item, - struct vec2 *scale); +EXPORT void obs_sceneitem_get_scale(const obs_sceneitem_t *item, + struct vec2 *scale); EXPORT uint32_t obs_sceneitem_get_alignment(const obs_sceneitem_t *item); -EXPORT enum obs_bounds_type obs_sceneitem_get_bounds_type( - const obs_sceneitem_t *item); +EXPORT enum obs_bounds_type +obs_sceneitem_get_bounds_type(const obs_sceneitem_t *item); EXPORT uint32_t obs_sceneitem_get_bounds_alignment(const obs_sceneitem_t *item); EXPORT void obs_sceneitem_get_bounds(const obs_sceneitem_t *item, - struct vec2 *bounds); + struct vec2 *bounds); EXPORT void obs_sceneitem_get_info(const obs_sceneitem_t *item, - struct obs_transform_info *info); + struct obs_transform_info *info); EXPORT void obs_sceneitem_set_info(obs_sceneitem_t *item, - const struct obs_transform_info *info); + const struct obs_transform_info *info); EXPORT void obs_sceneitem_get_draw_transform(const obs_sceneitem_t *item, - struct matrix4 *transform); + struct matrix4 *transform); EXPORT void obs_sceneitem_get_box_transform(const obs_sceneitem_t *item, - struct matrix4 *transform); + struct matrix4 *transform); EXPORT void obs_sceneitem_get_box_scale(const obs_sceneitem_t *item, - struct vec2 *scale); + struct vec2 *scale); EXPORT bool obs_sceneitem_visible(const obs_sceneitem_t *item); EXPORT bool obs_sceneitem_set_visible(obs_sceneitem_t *item, bool visible); @@ -1530,14 +1547,14 @@ }; EXPORT void obs_sceneitem_set_crop(obs_sceneitem_t *item, - const struct obs_sceneitem_crop *crop); + const struct obs_sceneitem_crop *crop); EXPORT void obs_sceneitem_get_crop(const obs_sceneitem_t *item, - struct obs_sceneitem_crop *crop); + struct obs_sceneitem_crop *crop); EXPORT void obs_sceneitem_set_scale_filter(obs_sceneitem_t *item, - enum obs_scale_type filter); -EXPORT enum obs_scale_type obs_sceneitem_get_scale_filter( - obs_sceneitem_t *item); + enum obs_scale_type filter); +EXPORT enum obs_scale_type +obs_sceneitem_get_scale_filter(obs_sceneitem_t *item); EXPORT void obs_sceneitem_force_update_transform(obs_sceneitem_t *item); @@ -1549,39 +1566,41 @@ EXPORT obs_data_t *obs_sceneitem_get_private_settings(obs_sceneitem_t *item); EXPORT obs_sceneitem_t *obs_scene_add_group(obs_scene_t *scene, - const char *name); + const char *name); EXPORT obs_sceneitem_t *obs_scene_insert_group(obs_scene_t *scene, - const char *name, obs_sceneitem_t **items, size_t count); + const char *name, + obs_sceneitem_t **items, + size_t count); EXPORT obs_sceneitem_t *obs_scene_get_group(obs_scene_t *scene, - const char *name); + const char *name); EXPORT bool obs_sceneitem_is_group(obs_sceneitem_t *item); -EXPORT obs_scene_t *obs_sceneitem_group_get_scene( - const obs_sceneitem_t *group); +EXPORT obs_scene_t *obs_sceneitem_group_get_scene(const obs_sceneitem_t *group); EXPORT void obs_sceneitem_group_ungroup(obs_sceneitem_t *group); EXPORT void obs_sceneitem_group_add_item(obs_sceneitem_t *group, - obs_sceneitem_t *item); + obs_sceneitem_t *item); EXPORT void obs_sceneitem_group_remove_item(obs_sceneitem_t *group, - obs_sceneitem_t *item); + obs_sceneitem_t *item); EXPORT obs_sceneitem_t *obs_sceneitem_get_group(obs_scene_t *scene, - obs_sceneitem_t *item); + obs_sceneitem_t *item); EXPORT bool obs_source_is_group(const obs_source_t *source); EXPORT bool obs_scene_is_group(const obs_scene_t *scene); EXPORT void obs_sceneitem_group_enum_items(obs_sceneitem_t *group, - bool (*callback)(obs_scene_t*, obs_sceneitem_t*, void*), - void *param); + bool (*callback)(obs_scene_t *, + obs_sceneitem_t *, + void *), + void *param); EXPORT void obs_sceneitem_defer_group_resize_begin(obs_sceneitem_t *item); EXPORT void obs_sceneitem_defer_group_resize_end(obs_sceneitem_t *item); - /* ------------------------------------------------------------------------- */ /* Outputs */ @@ -1594,7 +1613,8 @@ * directshow, or other custom outputs. */ EXPORT obs_output_t *obs_output_create(const char *id, const char *name, - obs_data_t *settings, obs_data_t *hotkey_data); + obs_data_t *settings, + obs_data_t *hotkey_data); /** * Adds/releases a reference to an output. When the last reference is @@ -1611,7 +1631,7 @@ EXPORT obs_output_t *obs_weak_output_get_output(obs_weak_output_t *weak); EXPORT bool obs_weak_output_references_output(obs_weak_output_t *weak, - obs_output_t *output); + obs_output_t *output); EXPORT const char *obs_output_get_name(const obs_output_t *output); @@ -1626,7 +1646,7 @@ * this option will consume extra memory to continually increase delay while * waiting to reconnect. */ -#define OBS_OUTPUT_DELAY_PRESERVE (1<<0) +#define OBS_OUTPUT_DELAY_PRESERVE (1 << 0) /** * Sets the current output delay, in seconds (if the output supports delay). @@ -1636,7 +1656,7 @@ * activated. */ EXPORT void obs_output_set_delay(obs_output_t *output, uint32_t delay_sec, - uint32_t flags); + uint32_t flags); /** Gets the currently set delay value, in seconds. */ EXPORT uint32_t obs_output_get_delay(const obs_output_t *output); @@ -1675,14 +1695,17 @@ EXPORT bool obs_output_can_pause(const obs_output_t *output); /** Pauses the output (if the functionality is allowed by the output */ -EXPORT void obs_output_pause(obs_output_t *output); +EXPORT bool obs_output_pause(obs_output_t *output, bool pause); + +/** Returns whether output is paused */ +EXPORT bool obs_output_paused(const obs_output_t *output); /* Gets the current output settings string */ EXPORT obs_data_t *obs_output_get_settings(const obs_output_t *output); /** Returns the signal handler for an output */ -EXPORT signal_handler_t *obs_output_get_signal_handler( - const obs_output_t *output); +EXPORT signal_handler_t * +obs_output_get_signal_handler(const obs_output_t *output); /** Returns the procedure handler for an output */ EXPORT proc_handler_t *obs_output_get_proc_handler(const obs_output_t *output); @@ -1691,8 +1714,8 @@ * Sets the current audio/video media contexts associated with this output, * required for non-encoded outputs. Can be null. */ -EXPORT void obs_output_set_media(obs_output_t *output, - video_t *video, audio_t *audio); +EXPORT void obs_output_set_media(obs_output_t *output, video_t *video, + audio_t *audio); /** Returns the video media context associated with this output */ EXPORT video_t *obs_output_video(const obs_output_t *output); @@ -1717,7 +1740,7 @@ * required for encoded outputs */ EXPORT void obs_output_set_video_encoder(obs_output_t *output, - obs_encoder_t *encoder); + obs_encoder_t *encoder); /** * Sets the current audio encoder associated with this output, @@ -1728,7 +1751,7 @@ * otherwise the parameter is ignored. */ EXPORT void obs_output_set_audio_encoder(obs_output_t *output, - obs_encoder_t *encoder, size_t idx); + obs_encoder_t *encoder, size_t idx); /** Returns the current video encoder associated with this output */ EXPORT obs_encoder_t *obs_output_get_video_encoder(const obs_output_t *output); @@ -1741,11 +1764,11 @@ * ignored. */ EXPORT obs_encoder_t *obs_output_get_audio_encoder(const obs_output_t *output, - size_t idx); + size_t idx); /** Sets the current service associated with this output. */ EXPORT void obs_output_set_service(obs_output_t *output, - obs_service_t *service); + obs_service_t *service); /** Gets the current service associated with this output. */ EXPORT obs_service_t *obs_output_get_service(const obs_output_t *output); @@ -1754,7 +1777,7 @@ * Sets the reconnect settings. Set retry_count to 0 to disable reconnecting. */ EXPORT void obs_output_set_reconnect_settings(obs_output_t *output, - int retry_count, int retry_sec); + int retry_count, int retry_sec); EXPORT uint64_t obs_output_get_total_bytes(const obs_output_t *output); EXPORT int obs_output_get_frames_dropped(const obs_output_t *output); @@ -1769,7 +1792,7 @@ * then this function will trigger a warning and do nothing. */ EXPORT void obs_output_set_preferred_size(obs_output_t *output, uint32_t width, - uint32_t height); + uint32_t height); /** For video outputs, returns the width of the encoded image */ EXPORT uint32_t obs_output_get_width(const obs_output_t *output); @@ -1781,9 +1804,10 @@ #if BUILD_CAPTIONS EXPORT void obs_output_output_caption_text1(obs_output_t *output, - const char *text); + const char *text); EXPORT void obs_output_output_caption_text2(obs_output_t *output, - const char *text, double display_duration); + const char *text, + double display_duration); #endif EXPORT float obs_output_get_congestion(obs_output_t *output); @@ -1793,13 +1817,13 @@ /** Pass a string of the last output error, for UI use */ EXPORT void obs_output_set_last_error(obs_output_t *output, - const char *message); + const char *message); EXPORT const char *obs_output_get_last_error(obs_output_t *output); -EXPORT const char *obs_output_get_supported_video_codecs( - const obs_output_t *output); -EXPORT const char *obs_output_get_supported_audio_codecs( - const obs_output_t *output); +EXPORT const char * +obs_output_get_supported_video_codecs(const obs_output_t *output); +EXPORT const char * +obs_output_get_supported_audio_codecs(const obs_output_t *output); /* ------------------------------------------------------------------------- */ /* Functions used by outputs */ @@ -1807,20 +1831,22 @@ EXPORT void *obs_output_get_type_data(obs_output_t *output); /** Optionally sets the video conversion info. Used only for raw output */ -EXPORT void obs_output_set_video_conversion(obs_output_t *output, - const struct video_scale_info *conversion); +EXPORT void +obs_output_set_video_conversion(obs_output_t *output, + const struct video_scale_info *conversion); /** Optionally sets the audio conversion info. Used only for raw output */ -EXPORT void obs_output_set_audio_conversion(obs_output_t *output, - const struct audio_convert_info *conversion); +EXPORT void +obs_output_set_audio_conversion(obs_output_t *output, + const struct audio_convert_info *conversion); /** Returns whether data capture can begin with the specified flags */ EXPORT bool obs_output_can_begin_data_capture(const obs_output_t *output, - uint32_t flags); + uint32_t flags); /** Initializes encoders (if any) */ EXPORT bool obs_output_initialize_encoders(obs_output_t *output, - uint32_t flags); + uint32_t flags); /** * Begins data capture from media/encoders. @@ -1847,6 +1873,7 @@ */ EXPORT void obs_output_signal_stop(obs_output_t *output, int code); +EXPORT uint64_t obs_output_get_pause_offset(obs_output_t *output); /* ------------------------------------------------------------------------- */ /* Encoders */ @@ -1862,7 +1889,8 @@ * @return The video encoder context, or NULL if failed or not found. */ EXPORT obs_encoder_t *obs_video_encoder_create(const char *id, const char *name, - obs_data_t *settings, obs_data_t *hotkey_data); + obs_data_t *settings, + obs_data_t *hotkey_data); /** * Creates an audio encoder context @@ -1874,8 +1902,9 @@ * @return The video encoder context, or NULL if failed or not found. */ EXPORT obs_encoder_t *obs_audio_encoder_create(const char *id, const char *name, - obs_data_t *settings, size_t mixer_idx, - obs_data_t *hotkey_data); + obs_data_t *settings, + size_t mixer_idx, + obs_data_t *hotkey_data); /** * Adds/releases a reference to an encoder. When the last reference is @@ -1892,7 +1921,7 @@ EXPORT obs_encoder_t *obs_weak_encoder_get_encoder(obs_weak_encoder_t *weak); EXPORT bool obs_weak_encoder_references_encoder(obs_weak_encoder_t *weak, - obs_encoder_t *encoder); + obs_encoder_t *encoder); EXPORT void obs_encoder_set_name(obs_encoder_t *encoder, const char *name); EXPORT const char *obs_encoder_get_name(const obs_encoder_t *encoder); @@ -1915,7 +1944,7 @@ * a warning, and do nothing. */ EXPORT void obs_encoder_set_scaled_size(obs_encoder_t *encoder, uint32_t width, - uint32_t height); + uint32_t height); /** For video encoders, returns the width of the encoded image */ EXPORT uint32_t obs_encoder_get_width(const obs_encoder_t *encoder); @@ -1935,9 +1964,9 @@ * functionality of converting only when absolutely necessary. */ EXPORT void obs_encoder_set_preferred_video_format(obs_encoder_t *encoder, - enum video_format format); -EXPORT enum video_format obs_encoder_get_preferred_video_format( - const obs_encoder_t *encoder); + enum video_format format); +EXPORT enum video_format +obs_encoder_get_preferred_video_format(const obs_encoder_t *encoder); /** Gets the default settings for an encoder type */ EXPORT obs_data_t *obs_encoder_defaults(const char *id); @@ -1960,7 +1989,7 @@ /** Gets extra data (headers) associated with this context */ EXPORT bool obs_encoder_get_extra_data(const obs_encoder_t *encoder, - uint8_t **extra_data, size_t *size); + uint8_t **extra_data, size_t *size); /** Returns the current settings for this encoder */ EXPORT obs_data_t *obs_encoder_get_settings(const obs_encoder_t *encoder); @@ -1997,19 +2026,21 @@ /** Duplicates an encoder packet */ DEPRECATED EXPORT void obs_duplicate_encoder_packet(struct encoder_packet *dst, - const struct encoder_packet *src); + const struct encoder_packet *src); DEPRECATED EXPORT void obs_free_encoder_packet(struct encoder_packet *packet); #endif EXPORT void obs_encoder_packet_ref(struct encoder_packet *dst, - struct encoder_packet *src); + struct encoder_packet *src); EXPORT void obs_encoder_packet_release(struct encoder_packet *packet); EXPORT void *obs_encoder_create_rerouted(obs_encoder_t *encoder, - const char *reroute_id); + const char *reroute_id); +/** Returns whether encoder is paused */ +EXPORT bool obs_encoder_paused(const obs_encoder_t *output); /* ------------------------------------------------------------------------- */ /* Stream Services */ @@ -2017,10 +2048,12 @@ EXPORT const char *obs_service_get_display_name(const char *id); EXPORT obs_service_t *obs_service_create(const char *id, const char *name, - obs_data_t *settings, obs_data_t *hotkey_data); + obs_data_t *settings, + obs_data_t *hotkey_data); EXPORT obs_service_t *obs_service_create_private(const char *id, - const char *name, obs_data_t *settings); + const char *name, + obs_data_t *settings); /** * Adds/releases a reference to a service. When the last reference is @@ -2037,7 +2070,7 @@ EXPORT obs_service_t *obs_weak_service_get_service(obs_weak_service_t *weak); EXPORT bool obs_weak_service_references_service(obs_weak_service_t *weak, - obs_service_t *service); + obs_service_t *service); EXPORT const char *obs_service_get_name(const obs_service_t *service); @@ -2080,9 +2113,10 @@ * @param video_encoder_settings Video encoder settings. Optional. * @param audio_encoder_settings Audio encoder settings. Optional. */ -EXPORT void obs_service_apply_encoder_settings(obs_service_t *service, - obs_data_t *video_encoder_settings, - obs_data_t *audio_encoder_settings); +EXPORT void +obs_service_apply_encoder_settings(obs_service_t *service, + obs_data_t *video_encoder_settings, + obs_data_t *audio_encoder_settings); EXPORT void *obs_service_get_type_data(obs_service_t *service); @@ -2092,11 +2126,11 @@ * date. */ EXPORT const char *obs_service_get_output_type(const obs_service_t *service); - /* ------------------------------------------------------------------------- */ /* Source frame allocation functions */ EXPORT void obs_source_frame_init(struct obs_source_frame *frame, - enum video_format format, uint32_t width, uint32_t height); + enum video_format format, uint32_t width, + uint32_t height); static inline void obs_source_frame_free(struct obs_source_frame *frame) { @@ -2106,12 +2140,13 @@ } } -static inline struct obs_source_frame *obs_source_frame_create( - enum video_format format, uint32_t width, uint32_t height) +static inline struct obs_source_frame * +obs_source_frame_create(enum video_format format, uint32_t width, + uint32_t height) { struct obs_source_frame *frame; - frame = (struct obs_source_frame*)bzalloc(sizeof(*frame)); + frame = (struct obs_source_frame *)bzalloc(sizeof(*frame)); obs_source_frame_init(frame, format, width, height); return frame; } @@ -2125,7 +2160,7 @@ } EXPORT void obs_source_frame_copy(struct obs_source_frame *dst, - const struct obs_source_frame *src); + const struct obs_source_frame *src); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/obs.hpp -> obs-studio-24.0.0.tar.xz/libobs/obs.hpp
Changed
@@ -23,33 +23,31 @@ /* RAII wrappers */ -template<typename T, void addref(T), void release(T)> -class OBSRef; - -using OBSSource = OBSRef<obs_source_t*, obs_source_addref, obs_source_release>; -using OBSScene = OBSRef<obs_scene_t*, obs_scene_addref, obs_scene_release>; -using OBSSceneItem = OBSRef<obs_sceneitem_t*, obs_sceneitem_addref, - obs_sceneitem_release>; -using OBSData = OBSRef<obs_data_t*, obs_data_addref, obs_data_release>; -using OBSDataArray = OBSRef<obs_data_array_t*, obs_data_array_addref, - obs_data_array_release>; -using OBSOutput = OBSRef<obs_output_t*, obs_output_addref, obs_output_release>; -using OBSEncoder = OBSRef<obs_encoder_t*, obs_encoder_addref, - obs_encoder_release>; -using OBSService = OBSRef<obs_service_t*, obs_service_addref, - obs_service_release>; - -using OBSWeakSource = OBSRef<obs_weak_source_t*, obs_weak_source_addref, - obs_weak_source_release>; -using OBSWeakOutput = OBSRef<obs_weak_output_t*, obs_weak_output_addref, - obs_weak_output_release>; -using OBSWeakEncoder = OBSRef<obs_weak_encoder_t*, obs_weak_encoder_addref, - obs_weak_encoder_release>; -using OBSWeakService = OBSRef<obs_weak_service_t*, obs_weak_service_addref, - obs_weak_service_release>; - -template<typename T, void addref(T), void release(T)> -class OBSRef { +template<typename T, void addref(T), void release(T)> class OBSRef; + +using OBSSource = OBSRef<obs_source_t *, obs_source_addref, obs_source_release>; +using OBSScene = OBSRef<obs_scene_t *, obs_scene_addref, obs_scene_release>; +using OBSSceneItem = + OBSRef<obs_sceneitem_t *, obs_sceneitem_addref, obs_sceneitem_release>; +using OBSData = OBSRef<obs_data_t *, obs_data_addref, obs_data_release>; +using OBSDataArray = OBSRef<obs_data_array_t *, obs_data_array_addref, + obs_data_array_release>; +using OBSOutput = OBSRef<obs_output_t *, obs_output_addref, obs_output_release>; +using OBSEncoder = + OBSRef<obs_encoder_t *, obs_encoder_addref, obs_encoder_release>; +using OBSService = + OBSRef<obs_service_t *, obs_service_addref, obs_service_release>; + +using OBSWeakSource = OBSRef<obs_weak_source_t *, obs_weak_source_addref, + obs_weak_source_release>; +using OBSWeakOutput = OBSRef<obs_weak_output_t *, obs_weak_output_addref, + obs_weak_output_release>; +using OBSWeakEncoder = OBSRef<obs_weak_encoder_t *, obs_weak_encoder_addref, + obs_weak_encoder_release>; +using OBSWeakService = OBSRef<obs_weak_service_t *, obs_weak_service_addref, + obs_weak_service_release>; + +template<typename T, void addref(T), void release(T)> class OBSRef { T val; inline OBSRef &Replace(T valIn) @@ -60,19 +58,20 @@ return *this; } - struct TakeOwnership {}; - inline OBSRef(T val, TakeOwnership) : val(val) {} + struct TakeOwnership { + }; + inline OBSRef(T val, TakeOwnership) : val(val) {} public: - inline OBSRef() : val(nullptr) {} - inline OBSRef(T val_) : val(val_) {addref(val);} - inline OBSRef(const OBSRef &ref) : val(ref.val) {addref(val);} - inline OBSRef(OBSRef &&ref) : val(ref.val) {ref.val = nullptr;} + inline OBSRef() : val(nullptr) {} + inline OBSRef(T val_) : val(val_) { addref(val); } + inline OBSRef(const OBSRef &ref) : val(ref.val) { addref(val); } + inline OBSRef(OBSRef &&ref) : val(ref.val) { ref.val = nullptr; } - inline ~OBSRef() {release(val);} + inline ~OBSRef() { release(val); } - inline OBSRef &operator=(T valIn) {return Replace(valIn);} - inline OBSRef &operator=(const OBSRef &ref) {return Replace(ref.val);} + inline OBSRef &operator=(T valIn) { return Replace(valIn); } + inline OBSRef &operator=(const OBSRef &ref) { return Replace(ref.val); } inline OBSRef &operator=(OBSRef &&ref) { @@ -85,10 +84,10 @@ return *this; } - inline operator T() const {return val;} + inline operator T() const { return val; } - inline bool operator==(T p) const {return val == p;} - inline bool operator!=(T p) const {return val != p;} + inline bool operator==(T p) const { return val == p; } + inline bool operator!=(T p) const { return val != p; } friend OBSSource OBSGetStrongRef(obs_weak_source_t *weak); friend OBSWeakSource OBSGetWeakRef(obs_source_t *source); @@ -154,12 +153,12 @@ T obj; public: - inline OBSObj() : obj(nullptr) {} + inline OBSObj() : obj(nullptr) {} inline OBSObj(T obj_) : obj(obj_) {} - inline OBSObj(const OBSObj&) = delete; + inline OBSObj(const OBSObj &) = delete; inline OBSObj(OBSObj &&other) : obj(other.obj) { other.obj = nullptr; } - inline ~OBSObj() {destroy(obj);} + inline ~OBSObj() { destroy(obj); } inline OBSObj &operator=(T obj_) { @@ -168,48 +167,47 @@ obj = obj_; return *this; } - inline OBSObj &operator=(const OBSObj&) = delete; + inline OBSObj &operator=(const OBSObj &) = delete; inline OBSObj &operator=(OBSObj &&other) { if (obj) destroy(obj); - obj = other.obj; + obj = other.obj; other.obj = nullptr; return *this; } - inline operator T() const {return obj;} + inline operator T() const { return obj; } - inline bool operator==(T p) const {return obj == p;} - inline bool operator!=(T p) const {return obj != p;} + inline bool operator==(T p) const { return obj == p; } + inline bool operator!=(T p) const { return obj != p; } }; -using OBSDisplay = OBSObj<obs_display_t*, obs_display_destroy>; -using OBSView = OBSObj<obs_view_t*, obs_view_destroy>; +using OBSDisplay = OBSObj<obs_display_t *, obs_display_destroy>; +using OBSView = OBSObj<obs_view_t *, obs_view_destroy>; /* signal handler connection */ class OBSSignal { - signal_handler_t *handler; - const char *signal; + signal_handler_t *handler; + const char *signal; signal_callback_t callback; - void *param; + void *param; public: inline OBSSignal() - : handler (nullptr), - signal (nullptr), - callback (nullptr), - param (nullptr) - {} - - inline OBSSignal(signal_handler_t *handler_, - const char *signal_, - signal_callback_t callback_, - void *param_) - : handler (handler_), - signal (signal_), - callback (callback_), - param (param_) + : handler(nullptr), + signal(nullptr), + callback(nullptr), + param(nullptr) + { + } + + inline OBSSignal(signal_handler_t *handler_, const char *signal_, + signal_callback_t callback_, void *param_) + : handler(handler_), + signal(signal_), + callback(callback_), + param(param_) { signal_handler_connect_ref(handler, signal, callback, param); } @@ -217,39 +215,37 @@ inline void Disconnect() { signal_handler_disconnect(handler, signal, callback, param); - handler = nullptr; - signal = nullptr; + handler = nullptr; + signal = nullptr; callback = nullptr; - param = nullptr; + param = nullptr; } - inline ~OBSSignal() {Disconnect();} + inline ~OBSSignal() { Disconnect(); } - inline void Connect(signal_handler_t *handler_, - const char *signal_, - signal_callback_t callback_, - void *param_) + inline void Connect(signal_handler_t *handler_, const char *signal_, + signal_callback_t callback_, void *param_) { Disconnect(); - handler = handler_; - signal = signal_; + handler = handler_; + signal = signal_; callback = callback_; - param = param_; + param = param_; signal_handler_connect_ref(handler, signal, callback, param); } - OBSSignal(const OBSSignal&) = delete; + OBSSignal(const OBSSignal &) = delete; OBSSignal(OBSSignal &&other) - : handler (other.handler), - signal (other.signal), + : handler(other.handler), + signal(other.signal), callback(other.callback), - param (other.param) + param(other.param) { - other.handler = nullptr; - other.signal = nullptr; + other.handler = nullptr; + other.signal = nullptr; other.callback = nullptr; - other.param = nullptr; + other.param = nullptr; } OBSSignal &operator=(const OBSSignal &) = delete; @@ -257,15 +253,15 @@ { Disconnect(); - handler = other.handler; - signal = other.signal; + handler = other.handler; + signal = other.signal; callback = other.callback; - param = other.param; + param = other.param; - other.handler = nullptr; - other.signal = nullptr; + other.handler = nullptr; + other.signal = nullptr; other.callback = nullptr; - other.param = nullptr; + other.param = nullptr; return *this; } @@ -275,14 +271,11 @@ public: inline OBSContext() {} inline OBSContext(const char *locale, - const char *module_config_path=nullptr, - profiler_name_store *store=nullptr) + const char *module_config_path = nullptr, + profiler_name_store *store = nullptr) { obs_startup(locale, module_config_path, store); } - inline ~OBSContext() - { - obs_shutdown(); - } + inline ~OBSContext() { obs_shutdown(); } };
View file
obs-studio-23.2.1.tar.xz/libobs/util/AlignedNew.hpp -> obs-studio-24.0.0.tar.xz/libobs/util/AlignedNew.hpp
Changed
@@ -18,22 +18,22 @@ #include "bmem.h" -inline void* operator new(size_t size) +inline void *operator new(size_t size) { return bmalloc(size); } -inline void operator delete(void* data) +inline void operator delete(void *data) { bfree(data); } -inline void* operator new[](size_t size) +inline void *operator new[](size_t size) { return bmalloc(size); } -inline void operator delete[](void* data) +inline void operator delete[](void *data) { bfree(data); }
View file
obs-studio-23.2.1.tar.xz/libobs/util/apple/cfstring-utils.h -> obs-studio-24.0.0.tar.xz/libobs/util/apple/cfstring-utils.h
Changed
@@ -9,8 +9,8 @@ EXPORT char *cfstr_copy_cstr(CFStringRef cfstr, CFStringEncoding cfstr_enc); -EXPORT bool cfstr_copy_dstr(CFStringRef cfstr, CFStringEncoding cfstr_enc, - struct dstr *str); +EXPORT bool cfstr_copy_dstr(CFStringRef cfstr, CFStringEncoding cfstr_enc, + struct dstr *str); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/util/array-serializer.c -> obs-studio-24.0.0.tar.xz/libobs/util/array-serializer.c
Changed
@@ -31,12 +31,12 @@ } void array_output_serializer_init(struct serializer *s, - struct array_output_data *data) + struct array_output_data *data) { memset(s, 0, sizeof(struct serializer)); memset(data, 0, sizeof(struct array_output_data)); - s->data = data; - s->write = array_output_write; + s->data = data; + s->write = array_output_write; s->get_pos = array_output_get_pos; }
View file
obs-studio-23.2.1.tar.xz/libobs/util/array-serializer.h -> obs-studio-24.0.0.tar.xz/libobs/util/array-serializer.h
Changed
@@ -24,5 +24,5 @@ }; EXPORT void array_output_serializer_init(struct serializer *s, - struct array_output_data *data); + struct array_output_data *data); EXPORT void array_output_serializer_free(struct array_output_data *data);
View file
obs-studio-23.2.1.tar.xz/libobs/util/base.c -> obs-studio-24.0.0.tar.xz/libobs/util/base.c
Changed
@@ -26,12 +26,12 @@ static int log_output_level = LOG_INFO; #endif -static int crashing = 0; -static void *log_param = NULL; +static int crashing = 0; +static void *log_param = NULL; static void *crash_param = NULL; -static void def_log_handler(int log_level, const char *format, - va_list args, void *param) +static void def_log_handler(int log_level, const char *format, va_list args, + void *param) { char out[4096]; vsnprintf(out, sizeof(out), format, args); @@ -69,7 +69,7 @@ #endif NORETURN static void def_crash_handler(const char *format, va_list args, - void *param) + void *param) { vfprintf(stderr, format, args); exit(0); @@ -93,15 +93,14 @@ if (!handler) handler = def_log_handler; - log_param = param; + log_param = param; log_handler = handler; } -void base_set_crash_handler( - void (*handler)(const char *, va_list, void *), - void *param) +void base_set_crash_handler(void (*handler)(const char *, va_list, void *), + void *param) { - crash_param = param; + crash_param = param; crash_handler = handler; }
View file
obs-studio-23.2.1.tar.xz/libobs/util/base.h -> obs-studio-24.0.0.tar.xz/libobs/util/base.h
Changed
@@ -43,7 +43,7 @@ * Use in creation functions and core subsystem functions. Places that * should definitely not fail. */ - LOG_ERROR = 100, + LOG_ERROR = 100, /** * Use if a problem occurs that doesn't affect the program and is @@ -57,12 +57,12 @@ /** * Informative message to be displayed in the log. */ - LOG_INFO = 300, + LOG_INFO = 300, /** * Debug message to be used mostly by developers. */ - LOG_DEBUG = 400 + LOG_DEBUG = 400 }; typedef void (*log_handler_t)(int lvl, const char *msg, va_list args, void *p); @@ -70,9 +70,9 @@ EXPORT void base_get_log_handler(log_handler_t *handler, void **param); EXPORT void base_set_log_handler(log_handler_t handler, void *param); -EXPORT void base_set_crash_handler( - void (*handler)(const char *, va_list, void *), - void *param); +EXPORT void base_set_crash_handler(void (*handler)(const char *, va_list, + void *), + void *param); EXPORT void blogva(int log_level, const char *format, va_list args);
View file
obs-studio-23.2.1.tar.xz/libobs/util/bmem.c -> obs-studio-24.0.0.tar.xz/libobs/util/bmem.c
Changed
@@ -43,10 +43,10 @@ void *ptr = NULL; long diff; - ptr = malloc(size + ALIGNMENT); + ptr = malloc(size + ALIGNMENT); if (ptr) { diff = ((~(long)ptr) & (ALIGNMENT - 1)) + 1; - ptr = (char *)ptr + diff; + ptr = (char *)ptr + diff; ((char *)ptr)[-1] = (char)diff; } @@ -66,7 +66,7 @@ if (!ptr) return a_malloc(size); diff = ((char *)ptr)[-1]; - ptr = realloc((char*)ptr - diff, size + diff); + ptr = realloc((char *)ptr - diff, size + diff); if (ptr) ptr = (char *)ptr + diff; return ptr; @@ -81,7 +81,7 @@ _aligned_free(ptr); #elif ALIGNMENT_HACK if (ptr) - free((char *)ptr - ((char*)ptr)[-1]); + free((char *)ptr - ((char *)ptr)[-1]); #else free(ptr); #endif @@ -103,7 +103,7 @@ if (!ptr) { os_breakpoint(); bcrash("Out of memory while trying to allocate %lu bytes", - (unsigned long)size); + (unsigned long)size); } os_atomic_inc_long(&num_allocs); @@ -121,7 +121,7 @@ if (!ptr) { os_breakpoint(); bcrash("Out of memory while trying to allocate %lu bytes", - (unsigned long)size); + (unsigned long)size); } return ptr;
View file
obs-studio-23.2.1.tar.xz/libobs/util/bmem.h -> obs-studio-24.0.0.tar.xz/libobs/util/bmem.h
Changed
@@ -57,7 +57,7 @@ if (!str) return NULL; - dup = (char*)bmemdup(str, n+1); + dup = (char *)bmemdup(str, n + 1); dup[n] = 0; return dup; @@ -69,7 +69,7 @@ if (!str) return NULL; - dup = (wchar_t*)bmemdup(str, (n+1) * sizeof(wchar_t)); + dup = (wchar_t *)bmemdup(str, (n + 1) * sizeof(wchar_t)); dup[n] = 0; return dup;
View file
obs-studio-23.2.1.tar.xz/libobs/util/c99defs.h -> obs-studio-24.0.0.tar.xz/libobs/util/c99defs.h
Changed
@@ -27,7 +27,7 @@ #define DEPRECATED __declspec(deprecated) #define FORCE_INLINE __forceinline #else -#define DEPRECATED __attribute__ ((deprecated)) +#define DEPRECATED __attribute__((deprecated)) #define FORCE_INLINE inline __attribute__((always_inline)) #endif
View file
obs-studio-23.2.1.tar.xz/libobs/util/cf-lexer.c -> obs-studio-24.0.0.tar.xz/libobs/util/cf-lexer.c
Changed
@@ -20,38 +20,62 @@ #include "cf-lexer.h" static inline void cf_convert_from_escape_literal(char **p_dst, - const char **p_src) + const char **p_src) { char *dst = *p_dst; const char *src = *p_src; switch (*(src++)) { - case '\'': *(dst++) = '\''; break; - case '\"': *(dst++) = '\"'; break; - case '\?': *(dst++) = '\?'; break; - case '\\': *(dst++) = '\\'; break; - case '0': *(dst++) = '\0'; break; - case 'a': *(dst++) = '\a'; break; - case 'b': *(dst++) = '\b'; break; - case 'f': *(dst++) = '\f'; break; - case 'n': *(dst++) = '\n'; break; - case 'r': *(dst++) = '\r'; break; - case 't': *(dst++) = '\t'; break; - case 'v': *(dst++) = '\v'; break; - - /* hex */ - case 'X': - case 'x': - *(dst++) = (char)strtoul(src, NULL, 16); - src += 2; - break; - - /* oct */ - default: - if (isdigit(*src)) { - *(dst++) = (char)strtoul(src, NULL, 8); - src += 3; - } + case '\'': + *(dst++) = '\''; + break; + case '\"': + *(dst++) = '\"'; + break; + case '\?': + *(dst++) = '\?'; + break; + case '\\': + *(dst++) = '\\'; + break; + case '0': + *(dst++) = '\0'; + break; + case 'a': + *(dst++) = '\a'; + break; + case 'b': + *(dst++) = '\b'; + break; + case 'f': + *(dst++) = '\f'; + break; + case 'n': + *(dst++) = '\n'; + break; + case 'r': + *(dst++) = '\r'; + break; + case 't': + *(dst++) = '\t'; + break; + case 'v': + *(dst++) = '\v'; + break; + + /* hex */ + case 'X': + case 'x': + *(dst++) = (char)strtoul(src, NULL, 16); + src += 2; + break; + + /* oct */ + default: + if (isdigit(*src)) { + *(dst++) = (char)strtoul(src, NULL, 8); + src += 3; + } /* case 'u': case 'U': */ @@ -71,7 +95,7 @@ if (count < 2) return NULL; - if (literal[0] != literal[count-1]) + if (literal[0] != literal[count - 1]) return NULL; if (literal[0] != '\"' && literal[0] != '\'') return NULL; @@ -95,7 +119,7 @@ } static bool cf_is_token_break(struct base_token *start_token, - const struct base_token *token) + const struct base_token *token) { switch (start_token->type) { case BASETOKEN_ALPHA: @@ -105,9 +129,9 @@ break; case BASETOKEN_DIGIT: - if (token->type == BASETOKEN_WHITESPACE - || (token->type == BASETOKEN_OTHER - && *token->text.array != '.')) + if (token->type == BASETOKEN_WHITESPACE || + (token->type == BASETOKEN_OTHER && + *token->text.array != '.')) return true; break; @@ -141,7 +165,7 @@ static inline void cf_pass_any_splices(const char **parray) { while (cf_is_splice(*parray)) - *parray += 1 + newline_size((*parray)+1); + *parray += 1 + newline_size((*parray) + 1); } static inline bool cf_is_comment(const char *array) @@ -157,7 +181,7 @@ } static bool cf_lexer_process_comment(struct cf_lexer *lex, - struct cf_token *out_token) + struct cf_token *out_token) { const char *offset; @@ -200,7 +224,7 @@ } static inline void cf_lexer_write_strref(struct cf_lexer *lex, - const struct strref *ref) + const struct strref *ref) { strncpy(lex->write_offset, ref->array, ref->len); lex->write_offset[ref->len] = 0; @@ -214,14 +238,14 @@ size_t i; for (i = lex->tokens.num; i > 0; i--) { - struct cf_token *token = lex->tokens.array+(i-1); + struct cf_token *token = lex->tokens.array + (i - 1); if (is_space_or_tab(*token->str.array)) continue; if (!found_include_import) { if (strref_cmp(&token->str, "include") != 0 && - strref_cmp(&token->str, "import") != 0) + strref_cmp(&token->str, "import") != 0) break; found_include_import = true; @@ -242,8 +266,8 @@ } static void cf_lexer_getstrtoken(struct cf_lexer *lex, - struct cf_token *out_token, char delimiter, - bool allow_escaped_delimiters) + struct cf_token *out_token, char delimiter, + bool allow_escaped_delimiters) { const char *offset = lex->base_lexer.offset; bool escaped = false; @@ -280,7 +304,7 @@ } static bool cf_lexer_process_string(struct cf_lexer *lex, - struct cf_token *out_token) + struct cf_token *out_token) { char ch = *out_token->unmerged_str.array; @@ -290,15 +314,16 @@ } else if (ch == '"' || ch == '\'') { cf_lexer_getstrtoken(lex, out_token, ch, - !cf_lexer_is_include(lex)); + !cf_lexer_is_include(lex)); return true; } return false; } -static inline enum cf_token_type cf_get_token_type(const struct cf_token *token, - const struct base_token *start_token) +static inline enum cf_token_type +cf_get_token_type(const struct cf_token *token, + const struct base_token *start_token) { switch (start_token->type) { case BASETOKEN_ALPHA: @@ -338,13 +363,13 @@ /* ignore escaped newlines to merge spliced lines */ if (cf_is_splice(token.text.array)) { lex->base_lexer.offset += - newline_size(token.text.array+1); + newline_size(token.text.array + 1); continue; } if (!wrote_data) { out_token->unmerged_str.array = token.text.array; - out_token->str.array = lex->write_offset; + out_token->str.array = lex->write_offset; /* if comment then output a space */ if (cf_lexer_process_comment(lex, out_token)) @@ -368,8 +393,8 @@ } if (wrote_data) { - out_token->unmerged_str.len = (size_t)(lex->base_lexer.offset - - out_token->unmerged_str.array); + out_token->unmerged_str.len = (size_t)( + lex->base_lexer.offset - out_token->unmerged_str.array); out_token->type = cf_get_token_type(out_token, &start_token); } @@ -381,9 +406,9 @@ lexer_init(&lex->base_lexer); da_init(lex->tokens); - lex->file = NULL; - lex->reformatted = NULL; - lex->write_offset = NULL; + lex->file = NULL; + lex->reformatted = NULL; + lex->write_offset = NULL; lex->unexpected_eof = false; } @@ -394,9 +419,9 @@ lexer_free(&lex->base_lexer); da_free(lex->tokens); - lex->file = NULL; - lex->reformatted = NULL; - lex->write_offset = NULL; + lex->file = NULL; + lex->reformatted = NULL; + lex->write_offset = NULL; lex->unexpected_eof = false; } @@ -420,8 +445,7 @@ lex->write_offset = lex->reformatted; while (cf_lexer_nexttoken(lex, &token)) { - if (last_token && - is_space_or_tab(*last_token->str.array) && + if (last_token && is_space_or_tab(*last_token->str.array) && is_space_or_tab(*token.str.array)) { cf_token_add(last_token, &token); continue; @@ -476,20 +500,19 @@ { size_t i; for (i = 0; i < params->params.num; i++) - macro_param_free(params->params.array+i); + macro_param_free(params->params.array + i); da_free(params->params); } -static inline struct macro_param *get_macro_param( - const struct macro_params *params, - const struct strref *name) +static inline struct macro_param * +get_macro_param(const struct macro_params *params, const struct strref *name) { size_t i; if (!params) return NULL; for (i = 0; i < params->params.num; i++) { - struct macro_param *param = params->params.array+i; + struct macro_param *param = params->params.array + i; if (strref_cmp_strref(¶m->name.str, name) == 0) return param; } @@ -499,10 +522,10 @@ /* ------------------------------------------------------------------------- */ -static bool cf_preprocessor(struct cf_preprocessor *pp, - bool if_block, struct cf_token **p_cur_token); -static void cf_preprocess_tokens(struct cf_preprocessor *pp, - bool if_block, struct cf_token **p_cur_token); +static bool cf_preprocessor(struct cf_preprocessor *pp, bool if_block, + struct cf_token **p_cur_token); +static void cf_preprocess_tokens(struct cf_preprocessor *pp, bool if_block, + struct cf_token **p_cur_token); static inline bool go_to_newline(struct cf_token **p_cur_token) { @@ -524,7 +547,7 @@ cur_token++; /* if preprocessor, stop at newline */ - while (cur_token->type == CFTOKEN_SPACETAB && + while (cur_token->type == CFTOKEN_SPACETAB && (preprocessor || cur_token->type == CFTOKEN_NEWLINE)) cur_token++; @@ -533,79 +556,82 @@ } static inline void cf_gettokenoffset(struct cf_preprocessor *pp, - const struct cf_token *token, uint32_t *row, uint32_t *col) + const struct cf_token *token, + uint32_t *row, uint32_t *col) { - lexer_getstroffset(&pp->lex->base_lexer, - token->unmerged_str.array, row, col); + lexer_getstroffset(&pp->lex->base_lexer, token->unmerged_str.array, row, + col); } static void cf_addew(struct cf_preprocessor *pp, const struct cf_token *token, - const char *message, int error_level, - const char *val1, const char *val2, const char *val3) + const char *message, int error_level, const char *val1, + const char *val2, const char *val3) { uint32_t row, col; cf_gettokenoffset(pp, token, &row, &col); if (!val1 && !val2 && !val3) { - error_data_add(pp->ed, token->lex->file, row, col, - message, error_level); + error_data_add(pp->ed, token->lex->file, row, col, message, + error_level); } else { struct dstr formatted; dstr_init(&formatted); dstr_safe_printf(&formatted, message, val1, val2, val3, NULL); error_data_add(pp->ed, token->lex->file, row, col, - formatted.array, error_level); + formatted.array, error_level); dstr_free(&formatted); } } static inline void cf_adderror(struct cf_preprocessor *pp, - const struct cf_token *token, const char *error, - const char *val1, const char *val2, const char *val3) + const struct cf_token *token, const char *error, + const char *val1, const char *val2, + const char *val3) { cf_addew(pp, token, error, LEX_ERROR, val1, val2, val3); } static inline void cf_addwarning(struct cf_preprocessor *pp, - const struct cf_token *token, const char *warning, - const char *val1, const char *val2, const char *val3) + const struct cf_token *token, + const char *warning, const char *val1, + const char *val2, const char *val3) { cf_addew(pp, token, warning, LEX_WARNING, val1, val2, val3); } static inline void cf_adderror_expecting(struct cf_preprocessor *pp, - const struct cf_token *token, const char *expecting) + const struct cf_token *token, + const char *expecting) { - cf_adderror(pp, token, "Expected $1", expecting, - NULL, NULL); + cf_adderror(pp, token, "Expected $1", expecting, NULL, NULL); } static inline void cf_adderror_expected_newline(struct cf_preprocessor *pp, - const struct cf_token *token) + const struct cf_token *token) { cf_adderror(pp, token, - "Unexpected token after preprocessor, expected " - "newline", - NULL, NULL, NULL); + "Unexpected token after preprocessor, expected " + "newline", + NULL, NULL, NULL); } -static inline void cf_adderror_unexpected_endif_eof(struct cf_preprocessor *pp, - const struct cf_token *token) +static inline void +cf_adderror_unexpected_endif_eof(struct cf_preprocessor *pp, + const struct cf_token *token) { - cf_adderror(pp, token, "Unexpected end of file before #endif", - NULL, NULL, NULL); + cf_adderror(pp, token, "Unexpected end of file before #endif", NULL, + NULL, NULL); } static inline void cf_adderror_unexpected_eof(struct cf_preprocessor *pp, - const struct cf_token *token) + const struct cf_token *token) { - cf_adderror(pp, token, "Unexpected end of file", - NULL, NULL, NULL); + cf_adderror(pp, token, "Unexpected end of file", NULL, NULL, NULL); } static inline void insert_path(struct cf_preprocessor *pp, - struct dstr *str_file) + struct dstr *str_file) { const char *file; const char *slash; @@ -623,7 +649,7 @@ } static void cf_include_file(struct cf_preprocessor *pp, - const struct cf_token *file_token) + const struct cf_token *file_token) { struct cf_lexer new_lex; struct dstr str_file; @@ -634,12 +660,12 @@ dstr_init(&str_file); dstr_copy_strref(&str_file, &file_token->str); - dstr_mid(&str_file, &str_file, 1, str_file.len-2); + dstr_mid(&str_file, &str_file, 1, str_file.len - 2); insert_path(pp, &str_file); /* if dependency already exists, run preprocessor on it */ for (i = 0; i < pp->dependencies.num; i++) { - struct cf_lexer *dep = pp->dependencies.array+i; + struct cf_lexer *dep = pp->dependencies.array + i; if (strcmp(dep->file, str_file.array) == 0) { tokens = cf_lexer_get_tokens(dep); @@ -651,7 +677,7 @@ file = os_fopen(str_file.array, "rb"); if (!file) { cf_adderror(pp, file_token, "Could not open file '$1'", - file_token->str.array, NULL, NULL); + file_token->str.array, NULL, NULL); goto exit; } @@ -672,18 +698,18 @@ static inline bool is_sys_include(struct strref *ref) { - return ref->len >= 2 && - ref->array[0] == '<' && ref->array[ref->len-1] == '>'; + return ref->len >= 2 && ref->array[0] == '<' && + ref->array[ref->len - 1] == '>'; } static inline bool is_loc_include(struct strref *ref) { - return ref->len >= 2 && - ref->array[0] == '"' && ref->array[ref->len-1] == '"'; + return ref->len >= 2 && ref->array[0] == '"' && + ref->array[ref->len - 1] == '"'; } static void cf_preprocess_include(struct cf_preprocessor *pp, - struct cf_token **p_cur_token) + struct cf_token **p_cur_token) { struct cf_token *cur_token = *p_cur_token; @@ -706,8 +732,8 @@ if (!pp->ignore_state) cf_include_file(pp, cur_token); } else { - cf_adderror(pp, cur_token, "Invalid or incomplete string", - NULL, NULL, NULL); + cf_adderror(pp, cur_token, "Invalid or incomplete string", NULL, + NULL, NULL); go_to_newline(&cur_token); goto exit; } @@ -719,7 +745,8 @@ } static bool cf_preprocess_macro_params(struct cf_preprocessor *pp, - struct cf_def *def, struct cf_token **p_cur_token) + struct cf_def *def, + struct cf_token **p_cur_token) { struct cf_token *cur_token = *p_cur_token; bool success = false; @@ -736,9 +763,9 @@ cf_def_addparam(def, cur_token); next_token(&cur_token, true); - if (cur_token->type != CFTOKEN_OTHER - || (*cur_token->str.array != ',' - && *cur_token->str.array != ')')) { + if (cur_token->type != CFTOKEN_OTHER || + (*cur_token->str.array != ',' && + *cur_token->str.array != ')')) { cf_adderror_expecting(pp, cur_token, "',' or ')'"); go_to_newline(&cur_token); @@ -758,13 +785,13 @@ #define INVALID_INDEX ((size_t)-1) static inline size_t cf_preprocess_get_def_idx(struct cf_preprocessor *pp, - const struct strref *def_name) + const struct strref *def_name) { struct cf_def *array = pp->defines.array; size_t i; for (i = 0; i < pp->defines.num; i++) { - struct cf_def *cur_def = array+i; + struct cf_def *cur_def = array + i; if (strref_cmp_strref(&cur_def->name.str, def_name) == 0) return i; @@ -773,23 +800,24 @@ return INVALID_INDEX; } -static inline struct cf_def *cf_preprocess_get_def(struct cf_preprocessor *pp, - const struct strref *def_name) +static inline struct cf_def * +cf_preprocess_get_def(struct cf_preprocessor *pp, const struct strref *def_name) { size_t idx = cf_preprocess_get_def_idx(pp, def_name); if (idx == INVALID_INDEX) return NULL; - return pp->defines.array+idx; + return pp->defines.array + idx; } static char space_filler[2] = " "; static inline void append_space(struct cf_preprocessor *pp, - struct darray *tokens, const struct cf_token *base) + struct darray *tokens, + const struct cf_token *base) { struct cf_token token; - + strref_set(&token.str, space_filler, 1); token.type = CFTOKEN_SPACETAB; if (base) { @@ -811,7 +839,7 @@ } static void cf_preprocess_define(struct cf_preprocessor *pp, - struct cf_token **p_cur_token) + struct cf_token **p_cur_token) { struct cf_token *cur_token = *p_cur_token; struct cf_def def; @@ -860,18 +888,18 @@ } static inline void cf_preprocess_remove_def_strref(struct cf_preprocessor *pp, - const struct strref *ref) + const struct strref *ref) { size_t def_idx = cf_preprocess_get_def_idx(pp, ref); if (def_idx != INVALID_INDEX) { struct cf_def *array = pp->defines.array; - cf_def_free(array+def_idx); + cf_def_free(array + def_idx); da_erase(pp->defines, def_idx); } } static void cf_preprocess_undef(struct cf_preprocessor *pp, - struct cf_token **p_cur_token) + struct cf_token **p_cur_token) { struct cf_token *cur_token = *p_cur_token; @@ -896,7 +924,8 @@ /* Processes an #ifdef/#ifndef/#if/#else/#elif sub block recursively */ static inline bool cf_preprocess_subblock(struct cf_preprocessor *pp, - bool ignore, struct cf_token **p_cur_token) + bool ignore, + struct cf_token **p_cur_token) { bool eof; @@ -905,7 +934,7 @@ if (!pp->ignore_state) { pp->ignore_state = ignore; - cf_preprocess_tokens(pp, true, p_cur_token); + cf_preprocess_tokens(pp, true, p_cur_token); pp->ignore_state = false; } else { cf_preprocess_tokens(pp, true, p_cur_token); @@ -917,8 +946,8 @@ return !eof; } -static void cf_preprocess_ifdef(struct cf_preprocessor *pp, - bool ifnot, struct cf_token **p_cur_token) +static void cf_preprocess_ifdef(struct cf_preprocessor *pp, bool ifnot, + struct cf_token **p_cur_token) { struct cf_token *cur_token = *p_cur_token; struct cf_def *def; @@ -940,7 +969,7 @@ if (strref_cmp(&cur_token->str, "else") == 0) { if (!cf_preprocess_subblock(pp, is_true, &cur_token)) goto exit; - /*} else if (strref_cmp(&cur_token->str, "elif") == 0) {*/ + /*} else if (strref_cmp(&cur_token->str, "elif") == 0) {*/ } cur_token++; @@ -949,8 +978,8 @@ *p_cur_token = cur_token; } -static bool cf_preprocessor(struct cf_preprocessor *pp, - bool if_block, struct cf_token **p_cur_token) +static bool cf_preprocessor(struct cf_preprocessor *pp, bool if_block, + struct cf_token **p_cur_token) { struct cf_token *cur_token = *p_cur_token; @@ -969,17 +998,18 @@ } else if (strref_cmp(&cur_token->str, "ifndef") == 0) { cf_preprocess_ifdef(pp, true, p_cur_token); - /*} else if (strref_cmp(&cur_token->str, "if") == 0) { + /*} else if (strref_cmp(&cur_token->str, "if") == 0) { TODO;*/ } else if (strref_cmp(&cur_token->str, "else") == 0 || - /*strref_cmp(&cur_token->str, "elif") == 0 ||*/ - strref_cmp(&cur_token->str, "endif") == 0) { + /*strref_cmp(&cur_token->str, "elif") == 0 ||*/ + strref_cmp(&cur_token->str, "endif") == 0) { if (!if_block) { struct dstr name; dstr_init_copy_strref(&name, &cur_token->str); - cf_adderror(pp, cur_token,"#$1 outside of " - "#if/#ifdef/#ifndef block", - name.array, NULL, NULL); + cf_adderror(pp, cur_token, + "#$1 outside of " + "#if/#ifdef/#ifndef block", + name.array, NULL, NULL); dstr_free(&name); (*p_cur_token)++; @@ -989,7 +1019,7 @@ return false; } else if (cur_token->type != CFTOKEN_NEWLINE && - cur_token->type != CFTOKEN_NONE) { + cur_token->type != CFTOKEN_NONE) { /* * TODO: language-specific preprocessor stuff should be sent to * handler of some sort @@ -1001,10 +1031,10 @@ } static void cf_preprocess_addtoken(struct cf_preprocessor *pp, - struct darray *dst, /* struct cf_token */ - struct cf_token **p_cur_token, - const struct cf_token *base, - const struct macro_params *params); + struct darray *dst, /* struct cf_token */ + struct cf_token **p_cur_token, + const struct cf_token *base, + const struct macro_params *params); /* * collects tokens for a macro parameter @@ -1013,10 +1043,10 @@ * within a macro parameter is preserved, example MACRO(func(1, 2), 3), do not * let it stop on the comma at "1," */ -static void cf_preprocess_save_macro_param(struct cf_preprocessor *pp, - struct cf_token **p_cur_token, struct macro_param *param, - const struct cf_token *base, - const struct macro_params *cur_params) +static void cf_preprocess_save_macro_param( + struct cf_preprocessor *pp, struct cf_token **p_cur_token, + struct macro_param *param, const struct cf_token *base, + const struct macro_params *cur_params) { struct cf_token *cur_token = *p_cur_token; int brace_count = 0; @@ -1037,7 +1067,7 @@ } cf_preprocess_addtoken(pp, ¶m->tokens.da, &cur_token, base, - cur_params); + cur_params); } if (cur_token->type == CFTOKEN_NONE) @@ -1064,11 +1094,10 @@ } /* collects parameter tokens of a used macro and stores them for the unwrap */ -static void cf_preprocess_save_macro_params(struct cf_preprocessor *pp, - struct cf_token **p_cur_token, const struct cf_def *def, - const struct cf_token *base, - const struct macro_params *cur_params, - struct macro_params *dst) +static void cf_preprocess_save_macro_params( + struct cf_preprocessor *pp, struct cf_token **p_cur_token, + const struct cf_def *def, const struct cf_token *base, + const struct macro_params *cur_params, struct macro_params *dst) { struct cf_token *cur_token = *p_cur_token; size_t count = 0; @@ -1086,10 +1115,10 @@ count++; cf_preprocess_save_macro_param(pp, &cur_token, ¶m, base, - cur_params); - if (cur_token->type != CFTOKEN_OTHER - || (*cur_token->str.array != ',' - && *cur_token->str.array != ')')) { + cur_params); + if (cur_token->type != CFTOKEN_OTHER || + (*cur_token->str.array != ',' && + *cur_token->str.array != ')')) { macro_param_free(¶m); cf_adderror_expecting(pp, cur_token, "',' or ')'"); @@ -1107,7 +1136,7 @@ if (count <= def->params.num) { cf_token_copy(¶m.name, - cf_def_getparam(def, count-1)); + cf_def_getparam(def, count - 1)); da_push_back(dst->params, ¶m); } else { macro_param_free(¶m); @@ -1116,18 +1145,17 @@ if (count != def->params.num) cf_adderror(pp, cur_token, - "Mismatching number of macro parameters", - NULL, NULL, NULL); + "Mismatching number of macro parameters", NULL, + NULL, NULL); exit: *p_cur_token = cur_token; } -static inline void cf_preprocess_unwrap_param(struct cf_preprocessor *pp, - struct darray *dst, /* struct cf_token */ - struct cf_token **p_cur_token, - const struct cf_token *base, - const struct macro_param *param) +static inline void cf_preprocess_unwrap_param( + struct cf_preprocessor *pp, struct darray *dst, /* struct cf_token */ + struct cf_token **p_cur_token, const struct cf_token *base, + const struct macro_param *param) { struct cf_token *cur_token = *p_cur_token; struct cf_token *cur_param_token = param->tokens.array; @@ -1139,12 +1167,10 @@ *p_cur_token = cur_token; } -static inline void cf_preprocess_unwrap_define(struct cf_preprocessor *pp, - struct darray *dst, /* struct cf_token */ - struct cf_token **p_cur_token, - const struct cf_token *base, - const struct cf_def *def, - const struct macro_params *cur_params) +static inline void cf_preprocess_unwrap_define( + struct cf_preprocessor *pp, struct darray *dst, /* struct cf_token */ + struct cf_token **p_cur_token, const struct cf_token *base, + const struct cf_def *def, const struct macro_params *cur_params) { struct cf_token *cur_token = *p_cur_token; struct macro_params new_params; @@ -1154,11 +1180,11 @@ if (def->macro) cf_preprocess_save_macro_params(pp, &cur_token, def, base, - cur_params, &new_params); + cur_params, &new_params); while (cur_def_token->type != CFTOKEN_NONE) cf_preprocess_addtoken(pp, dst, &cur_def_token, base, - &new_params); + &new_params); macro_params_free(&new_params); @@ -1167,10 +1193,10 @@ } static void cf_preprocess_addtoken(struct cf_preprocessor *pp, - struct darray *dst, /* struct cf_token */ - struct cf_token **p_cur_token, - const struct cf_token *base, - const struct macro_params *params) + struct darray *dst, /* struct cf_token */ + struct cf_token **p_cur_token, + const struct cf_token *base, + const struct macro_params *params) { struct cf_token *cur_token = *p_cur_token; @@ -1187,14 +1213,14 @@ param = get_macro_param(params, &cur_token->str); if (param) { cf_preprocess_unwrap_param(pp, dst, &cur_token, base, - param); + param); goto exit; } def = cf_preprocess_get_def(pp, &cur_token->str); if (def) { cf_preprocess_unwrap_define(pp, dst, &cur_token, base, - def, params); + def, params); goto exit; } } @@ -1208,16 +1234,16 @@ *p_cur_token = cur_token; } -static void cf_preprocess_tokens(struct cf_preprocessor *pp, - bool if_block, struct cf_token **p_cur_token) +static void cf_preprocess_tokens(struct cf_preprocessor *pp, bool if_block, + struct cf_token **p_cur_token) { bool newline = true; bool preprocessor_line = if_block; struct cf_token *cur_token = *p_cur_token; while (cur_token->type != CFTOKEN_NONE) { - if(cur_token->type != CFTOKEN_SPACETAB && - cur_token->type != CFTOKEN_NEWLINE) { + if (cur_token->type != CFTOKEN_SPACETAB && + cur_token->type != CFTOKEN_NEWLINE) { if (preprocessor_line) { cf_adderror_expected_newline(pp, cur_token); if (!go_to_newline(&cur_token)) @@ -1244,7 +1270,7 @@ } cf_preprocess_addtoken(pp, &pp->tokens.da, &cur_token, NULL, - NULL); + NULL); } *p_cur_token = cur_token; @@ -1268,12 +1294,12 @@ struct cf_def *defs = pp->defines.array; size_t i; - for (i = 0; i <pp->defines.num; i++) - cf_def_free(defs+i); + for (i = 0; i < pp->defines.num; i++) + cf_def_free(defs + i); for (i = 0; i < pp->sys_include_dirs.num; i++) bfree(sys_include_dirs[i]); for (i = 0; i < pp->dependencies.num; i++) - cf_lexer_free(dependencies+i); + cf_lexer_free(dependencies + i); da_free(pp->defines); da_free(pp->sys_include_dirs); @@ -1286,7 +1312,7 @@ } bool cf_preprocess(struct cf_preprocessor *pp, struct cf_lexer *lex, - struct error_data *ed) + struct error_data *ed) { struct cf_token *token = cf_lexer_get_tokens(lex); if (!token) @@ -1308,10 +1334,10 @@ struct dstr name; dstr_init_copy_strref(&name, &def->name.str); cf_addwarning(pp, &def->name, "Token $1 already defined", - name.array, NULL, NULL); + name.array, NULL, NULL); cf_addwarning(pp, &existing->name, - "Previous definition of $1 is here", - name.array, NULL, NULL); + "Previous definition of $1 is here", name.array, + NULL, NULL); cf_def_free(existing); memcpy(existing, def, sizeof(struct cf_def)); @@ -1321,10 +1347,10 @@ } void cf_preprocessor_remove_def(struct cf_preprocessor *pp, - const char *def_name) + const char *def_name) { struct strref ref; ref.array = def_name; - ref.len = strlen(def_name); + ref.len = strlen(def_name); cf_preprocess_remove_def_strref(pp, &ref); }
View file
obs-studio-23.2.1.tar.xz/libobs/util/cf-lexer.h -> obs-studio-24.0.0.tar.xz/libobs/util/cf-lexer.h
Changed
@@ -57,13 +57,13 @@ } static inline void cf_token_copy(struct cf_token *dst, - const struct cf_token *src) + const struct cf_token *src) { memcpy(dst, src, sizeof(struct cf_token)); } static inline void cf_token_add(struct cf_token *dst, - const struct cf_token *add) + const struct cf_token *add) { strref_add(&dst->str, &add->str); strref_add(&dst->unmerged_str, &add->unmerged_str); @@ -99,7 +99,7 @@ } EXPORT bool cf_lexer_lex(struct cf_lexer *lex, const char *str, - const char *file); + const char *file); /* ------------------------------------------------------------------------- */ /* c-family preprocessor definition */ @@ -130,9 +130,9 @@ } static inline struct cf_token *cf_def_getparam(const struct cf_def *cfd, - size_t idx) + size_t idx) { - return cfd->params.array+idx; + return cfd->params.array + idx; } static inline void cf_def_free(struct cf_def *cfd) @@ -170,8 +170,8 @@ struct cf_preprocessor { struct cf_lexer *lex; struct error_data *ed; - DARRAY(struct cf_def) defines; - DARRAY(char*) sys_include_dirs; + DARRAY(struct cf_def) defines; + DARRAY(char *) sys_include_dirs; DARRAY(struct cf_lexer) dependencies; DARRAY(struct cf_token) tokens; bool ignore_state; @@ -181,22 +181,23 @@ EXPORT void cf_preprocessor_free(struct cf_preprocessor *pp); EXPORT bool cf_preprocess(struct cf_preprocessor *pp, struct cf_lexer *lex, - struct error_data *ed); + struct error_data *ed); -static inline void cf_preprocessor_add_sys_include_dir( - struct cf_preprocessor *pp, const char *include_dir) +static inline void +cf_preprocessor_add_sys_include_dir(struct cf_preprocessor *pp, + const char *include_dir) { if (include_dir) da_push_back(pp->sys_include_dirs, bstrdup(include_dir)); } EXPORT void cf_preprocessor_add_def(struct cf_preprocessor *pp, - struct cf_def *def); + struct cf_def *def); EXPORT void cf_preprocessor_remove_def(struct cf_preprocessor *pp, - const char *def_name); + const char *def_name); -static inline struct cf_token *cf_preprocessor_get_tokens( - struct cf_preprocessor *pp) +static inline struct cf_token * +cf_preprocessor_get_tokens(struct cf_preprocessor *pp) { return pp->tokens.array; }
View file
obs-studio-23.2.1.tar.xz/libobs/util/cf-parser.c -> obs-studio-24.0.0.tar.xz/libobs/util/cf-parser.c
Changed
@@ -17,23 +17,22 @@ #include "cf-parser.h" void cf_adderror(struct cf_parser *p, const char *error, int level, - const char *val1, const char *val2, const char *val3) + const char *val1, const char *val2, const char *val3) { uint32_t row, col; lexer_getstroffset(&p->cur_token->lex->base_lexer, - p->cur_token->unmerged_str.array, - &row, &col); + p->cur_token->unmerged_str.array, &row, &col); if (!val1 && !val2 && !val3) { - error_data_add(&p->error_list, p->cur_token->lex->file, - row, col, error, level); + error_data_add(&p->error_list, p->cur_token->lex->file, row, + col, error, level); } else { struct dstr formatted; dstr_init(&formatted); dstr_safe_printf(&formatted, error, val1, val2, val3, NULL); - error_data_add(&p->error_list, p->cur_token->lex->file, - row, col, formatted.array, level); + error_data_add(&p->error_list, p->cur_token->lex->file, row, + col, formatted.array, level); dstr_free(&formatted); } @@ -53,7 +52,7 @@ break; continue; - } else if(*p->cur_token->str.array == out) { + } else if (*p->cur_token->str.array == out) { p->cur_token++; return true; }
View file
obs-studio-23.2.1.tar.xz/libobs/util/cf-parser.h -> obs-studio-24.0.0.tar.xz/libobs/util/cf-parser.h
Changed
@@ -30,19 +30,19 @@ extern "C" { #endif -#define PARSE_SUCCESS 0 -#define PARSE_CONTINUE -1 -#define PARSE_BREAK -2 +#define PARSE_SUCCESS 0 +#define PARSE_CONTINUE -1 +#define PARSE_BREAK -2 #define PARSE_UNEXPECTED_CONTINUE -3 -#define PARSE_UNEXPECTED_BREAK -4 -#define PARSE_EOF -5 +#define PARSE_UNEXPECTED_BREAK -4 +#define PARSE_EOF -5 struct cf_parser { - struct cf_lexer lex; + struct cf_lexer lex; struct cf_preprocessor pp; - struct error_data error_list; + struct error_data error_list; - struct cf_token *cur_token; + struct cf_token *cur_token; }; static inline void cf_parser_init(struct cf_parser *parser) @@ -63,8 +63,8 @@ parser->cur_token = NULL; } -static inline bool cf_parser_parse(struct cf_parser *parser, - const char *str, const char *file) +static inline bool cf_parser_parse(struct cf_parser *parser, const char *str, + const char *file) { if (!cf_lexer_lex(&parser->lex, str, file)) return false; @@ -76,26 +76,23 @@ return true; } -EXPORT void cf_adderror(struct cf_parser *parser, const char *error, - int level, const char *val1, const char *val2, - const char *val3); +EXPORT void cf_adderror(struct cf_parser *parser, const char *error, int level, + const char *val1, const char *val2, const char *val3); static inline void cf_adderror_expecting(struct cf_parser *p, - const char *expected) + const char *expected) { cf_adderror(p, "Expected '$1'", LEX_ERROR, expected, NULL, NULL); } static inline void cf_adderror_unexpected_eof(struct cf_parser *p) { - cf_adderror(p, "Unexpected EOF", LEX_ERROR, - NULL, NULL, NULL); + cf_adderror(p, "Unexpected EOF", LEX_ERROR, NULL, NULL, NULL); } static inline void cf_adderror_syntax_error(struct cf_parser *p) { - cf_adderror(p, "Syntax error", LEX_ERROR, - NULL, NULL, NULL); + cf_adderror(p, "Syntax error", LEX_ERROR, NULL, NULL, NULL); } static inline bool cf_next_token(struct cf_parser *p) @@ -124,8 +121,8 @@ EXPORT bool cf_pass_pair(struct cf_parser *p, char in, char out); -static inline bool cf_go_to_token(struct cf_parser *p, - const char *str1, const char *str2) +static inline bool cf_go_to_token(struct cf_parser *p, const char *str1, + const char *str2) { while (cf_next_token(p)) { if (strref_cmp(&p->cur_token->str, str1) == 0) { @@ -141,8 +138,8 @@ return false; } -static inline bool cf_go_to_valid_token(struct cf_parser *p, - const char *str1, const char *str2) +static inline bool cf_go_to_valid_token(struct cf_parser *p, const char *str1, + const char *str2) { if (!cf_go_to_token(p, str1, str2)) { cf_adderror_unexpected_eof(p); @@ -153,17 +150,16 @@ } static inline bool cf_go_to_token_type(struct cf_parser *p, - enum cf_token_type type) + enum cf_token_type type) { - while (p->cur_token->type != CFTOKEN_NONE && - p->cur_token->type != type) + while (p->cur_token->type != CFTOKEN_NONE && p->cur_token->type != type) p->cur_token++; return p->cur_token->type != CFTOKEN_NONE; } -static inline int cf_token_should_be(struct cf_parser *p, - const char *str, const char *goto1, const char *goto2) +static inline int cf_token_should_be(struct cf_parser *p, const char *str, + const char *goto1, const char *goto2) { if (strref_cmp(&p->cur_token->str, str) == 0) return PARSE_SUCCESS; @@ -177,8 +173,8 @@ return PARSE_CONTINUE; } -static inline int cf_next_token_should_be(struct cf_parser *p, - const char *str, const char *goto1, const char *goto2) +static inline int cf_next_token_should_be(struct cf_parser *p, const char *str, + const char *goto1, const char *goto2) { if (!cf_next_token(p)) { cf_adderror_unexpected_eof(p); @@ -208,7 +204,7 @@ } static inline bool cf_peek_valid_token(struct cf_parser *p, - struct cf_token *peek) + struct cf_token *peek) { bool success = cf_peek_token(p, peek); if (!success) @@ -221,9 +217,9 @@ return strref_cmp(&p->cur_token->str, val) == 0; } -static inline int cf_token_is_type(struct cf_parser *p, - enum cf_token_type type, const char *type_expected, - const char *goto_token) +static inline int cf_token_is_type(struct cf_parser *p, enum cf_token_type type, + const char *type_expected, + const char *goto_token) { if (p->cur_token->type != type) { cf_adderror_expecting(p, type_expected); @@ -242,8 +238,8 @@ *dst = bstrdup_n(p->cur_token->str.array, p->cur_token->str.len); } -static inline int cf_get_name(struct cf_parser *p, char **dst, - const char *name, const char *goto_token) +static inline int cf_get_name(struct cf_parser *p, char **dst, const char *name, + const char *goto_token) { int errcode; @@ -256,7 +252,7 @@ } static inline int cf_next_name(struct cf_parser *p, char **dst, - const char *name, const char *goto_token) + const char *name, const char *goto_token) { if (!cf_next_valid_token(p)) return PARSE_EOF; @@ -274,7 +270,7 @@ } static inline int cf_get_name_ref(struct cf_parser *p, struct strref *dst, - const char *name, const char *goto_token) + const char *name, const char *goto_token) { int errcode; @@ -287,7 +283,7 @@ } static inline int cf_next_name_ref(struct cf_parser *p, struct strref *dst, - const char *name, const char *goto_token) + const char *name, const char *goto_token) { if (!cf_next_valid_token(p)) return PARSE_EOF;
View file
obs-studio-23.2.1.tar.xz/libobs/util/circlebuf.h -> obs-studio-24.0.0.tar.xz/libobs/util/circlebuf.h
Changed
@@ -30,7 +30,7 @@ /* Dynamic circular buffer */ struct circlebuf { - void *data; + void *data; size_t size; size_t start_pos; @@ -50,7 +50,7 @@ } static inline void circlebuf_reorder_data(struct circlebuf *cb, - size_t new_capacity) + size_t new_capacity) { size_t difference; uint8_t *data; @@ -59,8 +59,8 @@ return; difference = new_capacity - cb->capacity; - data = (uint8_t*)cb->data + cb->start_pos; - memmove(data+difference, data, cb->capacity - cb->start_pos); + data = (uint8_t *)cb->data + cb->start_pos; + memmove(data + difference, data, cb->capacity - cb->start_pos); cb->start_pos += difference; } @@ -70,7 +70,7 @@ if (cb->size <= cb->capacity) return; - new_capacity = cb->capacity*2; + new_capacity = cb->capacity * 2; if (cb->size > new_capacity) new_capacity = cb->size; @@ -105,12 +105,12 @@ size_t loop_size = add_size - back_size; if (back_size) - memset((uint8_t*)cb->data + cb->end_pos, 0, back_size); + memset((uint8_t *)cb->data + cb->end_pos, 0, back_size); memset(cb->data, 0, loop_size); new_end_pos -= cb->capacity; } else { - memset((uint8_t*)cb->data + cb->end_pos, 0, add_size); + memset((uint8_t *)cb->data + cb->end_pos, 0, add_size); } cb->end_pos = new_end_pos; @@ -118,7 +118,7 @@ /** Overwrites data at a specific point in the buffer (relative). */ static inline void circlebuf_place(struct circlebuf *cb, size_t position, - const void *data, size_t size) + const void *data, size_t size) { size_t end_point = position + size; size_t data_end_pos; @@ -136,15 +136,15 @@ size_t loop_size = size - back_size; if (back_size) - memcpy((uint8_t*)cb->data + position, data, loop_size); - memcpy(cb->data, (uint8_t*)data + loop_size, back_size); + memcpy((uint8_t *)cb->data + position, data, loop_size); + memcpy(cb->data, (uint8_t *)data + loop_size, back_size); } else { - memcpy((uint8_t*)cb->data + position, data, size); + memcpy((uint8_t *)cb->data + position, data, size); } } static inline void circlebuf_push_back(struct circlebuf *cb, const void *data, - size_t size) + size_t size) { size_t new_end_pos = cb->end_pos + size; @@ -156,20 +156,20 @@ size_t loop_size = size - back_size; if (back_size) - memcpy((uint8_t*)cb->data + cb->end_pos, data, - back_size); - memcpy(cb->data, (uint8_t*)data + back_size, loop_size); + memcpy((uint8_t *)cb->data + cb->end_pos, data, + back_size); + memcpy(cb->data, (uint8_t *)data + back_size, loop_size); new_end_pos -= cb->capacity; } else { - memcpy((uint8_t*)cb->data + cb->end_pos, data, size); + memcpy((uint8_t *)cb->data + cb->end_pos, data, size); } cb->end_pos = new_end_pos; } static inline void circlebuf_push_front(struct circlebuf *cb, const void *data, - size_t size) + size_t size) { cb->size += size; circlebuf_ensure_capacity(cb); @@ -178,14 +178,14 @@ size_t back_size = size - cb->start_pos; if (cb->start_pos) - memcpy(cb->data, (uint8_t*)data + back_size, - cb->start_pos); + memcpy(cb->data, (uint8_t *)data + back_size, + cb->start_pos); cb->start_pos = cb->capacity - back_size; - memcpy((uint8_t*)cb->data + cb->start_pos, data, back_size); + memcpy((uint8_t *)cb->data + cb->start_pos, data, back_size); } else { cb->start_pos -= size; - memcpy((uint8_t*)cb->data + cb->start_pos, data, size); + memcpy((uint8_t *)cb->data + cb->start_pos, data, size); } } @@ -201,12 +201,12 @@ size_t loop_size = size - back_size; if (back_size) - memset((uint8_t*)cb->data + cb->end_pos, 0, back_size); + memset((uint8_t *)cb->data + cb->end_pos, 0, back_size); memset(cb->data, 0, loop_size); new_end_pos -= cb->capacity; } else { - memset((uint8_t*)cb->data + cb->end_pos, 0, size); + memset((uint8_t *)cb->data + cb->end_pos, 0, size); } cb->end_pos = new_end_pos; @@ -224,15 +224,15 @@ memset(cb->data, 0, cb->start_pos); cb->start_pos = cb->capacity - back_size; - memset((uint8_t*)cb->data + cb->start_pos, 0, back_size); + memset((uint8_t *)cb->data + cb->start_pos, 0, back_size); } else { cb->start_pos -= size; - memset((uint8_t*)cb->data + cb->start_pos, 0, size); + memset((uint8_t *)cb->data + cb->start_pos, 0, size); } } static inline void circlebuf_peek_front(struct circlebuf *cb, void *data, - size_t size) + size_t size) { assert(size <= cb->size); @@ -240,18 +240,18 @@ size_t start_size = cb->capacity - cb->start_pos; if (start_size < size) { - memcpy(data, (uint8_t*)cb->data + cb->start_pos, - start_size); - memcpy((uint8_t*)data + start_size, cb->data, - size - start_size); + memcpy(data, (uint8_t *)cb->data + cb->start_pos, + start_size); + memcpy((uint8_t *)data + start_size, cb->data, + size - start_size); } else { - memcpy(data, (uint8_t*)cb->data + cb->start_pos, size); + memcpy(data, (uint8_t *)cb->data + cb->start_pos, size); } } } static inline void circlebuf_peek_back(struct circlebuf *cb, void *data, - size_t size) + size_t size) { assert(size <= cb->size); @@ -262,19 +262,19 @@ size_t front_size = size - back_size; size_t new_end_pos = cb->capacity - front_size; - memcpy((uint8_t*)data + (size - back_size), cb->data, - back_size); - memcpy(data, (uint8_t*)cb->data + new_end_pos, - front_size); + memcpy((uint8_t *)data + (size - back_size), cb->data, + back_size); + memcpy(data, (uint8_t *)cb->data + new_end_pos, + front_size); } else { - memcpy(data, (uint8_t*)cb->data + cb->end_pos - size, - size); + memcpy(data, (uint8_t *)cb->data + cb->end_pos - size, + size); } } } static inline void circlebuf_pop_front(struct circlebuf *cb, void *data, - size_t size) + size_t size) { circlebuf_peek_front(cb, data, size); @@ -290,7 +290,7 @@ } static inline void circlebuf_pop_back(struct circlebuf *cb, void *data, - size_t size) + size_t size) { circlebuf_peek_back(cb, data, size); @@ -308,7 +308,7 @@ static inline void *circlebuf_data(struct circlebuf *cb, size_t idx) { - uint8_t *ptr = (uint8_t*)cb->data; + uint8_t *ptr = (uint8_t *)cb->data; size_t offset = cb->start_pos + idx; if (idx >= cb->size)
View file
obs-studio-23.2.1.tar.xz/libobs/util/config-file.c -> obs-studio-24.0.0.tar.xz/libobs/util/config-file.c
Changed
@@ -48,7 +48,7 @@ size_t i; for (i = 0; i < section->items.num; i++) - config_item_free(items+i); + config_item_free(items + i); darray_free(§ion->items); bfree(section->name); @@ -100,13 +100,12 @@ ref->len--; } - while (ref->len && is_whitespace(ref->array[ref->len-1])) + while (ref->len && is_whitespace(ref->array[ref->len - 1])) ref->len--; } } -static bool config_parse_string(struct lexer *lex, struct strref *ref, - char end) +static bool config_parse_string(struct lexer *lex, struct strref *ref, char end) { bool success = end != 0; struct base_token token; @@ -149,7 +148,7 @@ } else if (next == 'r') { cur = '\r'; read++; - } else if (next =='n') { + } else if (next == 'n') { cur = '\n'; read++; } @@ -164,7 +163,7 @@ } static void config_add_item(struct darray *items, struct strref *name, - struct strref *value) + struct strref *value) { struct config_item item; struct dstr item_value; @@ -172,13 +171,13 @@ unescape(&item_value); - item.name = bstrdup_n(name->array, name->len); + item.name = bstrdup_n(name->array, name->len); item.value = item_value.array; darray_push_back(sizeof(struct config_item), items, &item); } static void config_parse_section(struct config_section *section, - struct lexer *lex) + struct lexer *lex) { struct base_token token; @@ -193,8 +192,9 @@ if (token.type == BASETOKEN_OTHER) { if (*token.text.array == '#') { do { - if (!lexer_getbasetoken(lex, &token, - PARSE_WHITESPACE)) + if (!lexer_getbasetoken( + lex, &token, + PARSE_WHITESPACE)) return; } while (!is_newline(*token.text.array)); @@ -214,10 +214,10 @@ if (strref_is_empty(&value)) { struct config_item item; - item.name = bstrdup_n(name.array, name.len); + item.name = bstrdup_n(name.array, name.len); item.value = bzalloc(1); darray_push_back(sizeof(struct config_item), - §ion->items, &item); + §ion->items, &item); } else { config_add_item(§ion->items, &name, &value); } @@ -255,15 +255,14 @@ return; section = darray_push_back_new(sizeof(struct config_section), - sections); - section->name = bstrdup_n(section_name.array, - section_name.len); + sections); + section->name = bstrdup_n(section_name.array, section_name.len); config_parse_section(section, lex); } } static int config_parse_file(struct darray *sections, const char *file, - bool always_open) + bool always_open) { char *file_data; struct lexer lex; @@ -379,10 +378,10 @@ for (i = 0; i < config->sections.num; i++) { struct config_section *section = darray_item( - sizeof(struct config_section), - &config->sections, i); + sizeof(struct config_section), &config->sections, i); - if (i) dstr_cat(&str, "\n"); + if (i) + dstr_cat(&str, "\n"); dstr_cat(&str, "["); dstr_cat(&str, section->name); @@ -390,8 +389,7 @@ for (j = 0; j < section->items.num; j++) { struct config_item *item = darray_item( - sizeof(struct config_item), - §ion->items, j); + sizeof(struct config_item), §ion->items, j); dstr_copy(&tmp, item->value ? item->value : ""); dstr_replace(&tmp, "\\", "\\\\"); @@ -426,7 +424,7 @@ } int config_save_safe(config_t *config, const char *temp_ext, - const char *backup_ext) + const char *backup_ext) { struct dstr temp_file = {0}; struct dstr backup_file = {0}; @@ -435,7 +433,7 @@ if (!temp_ext || !*temp_ext) { blog(LOG_ERROR, "config_save_safe: invalid " - "temporary extension specified"); + "temporary extension specified"); return CONFIG_ERROR; } @@ -451,8 +449,10 @@ config->file = file; if (ret != CONFIG_SUCCESS) { - blog(LOG_ERROR, "config_save_safe: failed to " - "write to %s", temp_file.array); + blog(LOG_ERROR, + "config_save_safe: failed to " + "write to %s", + temp_file.array); goto cleanup; } @@ -478,15 +478,16 @@ struct config_section *defaults, *sections; size_t i; - if (!config) return; + if (!config) + return; defaults = config->defaults.array; sections = config->sections.array; for (i = 0; i < config->defaults.num; i++) - config_section_free(defaults+i); + config_section_free(defaults + i); for (i = 0; i < config->sections.num; i++) - config_section_free(sections+i); + config_section_free(sections + i); darray_free(&config->defaults); darray_free(&config->sections); @@ -511,7 +512,7 @@ goto unlock; section = darray_item(sizeof(struct config_section), &config->sections, - idx); + idx); name = section->name; unlock: @@ -520,19 +521,20 @@ } static const struct config_item *config_find_item(const struct darray *sections, - const char *section, const char *name) + const char *section, + const char *name) { size_t i, j; for (i = 0; i < sections->num; i++) { - const struct config_section *sec = darray_item( - sizeof(struct config_section), sections, i); + const struct config_section *sec = + darray_item(sizeof(struct config_section), sections, i); if (astrcmpi(sec->name, section) == 0) { for (j = 0; j < sec->items.num; j++) { - struct config_item *item = darray_item( - sizeof(struct config_item), - &sec->items, j); + struct config_item *item = + darray_item(sizeof(struct config_item), + &sec->items, j); if (astrcmpi(item->name, name) == 0) return item; @@ -544,7 +546,7 @@ } static void config_set_item(config_t *config, struct darray *sections, - const char *section, const char *name, char *value) + const char *section, const char *name, char *value) { struct config_section *sec = NULL; struct config_section *array = sections->array; @@ -554,12 +556,12 @@ pthread_mutex_lock(&config->mutex); for (i = 0; i < sections->num; i++) { - struct config_section *cur_sec = array+i; + struct config_section *cur_sec = array + i; struct config_item *items = cur_sec->items.array; if (astrcmpi(cur_sec->name, section) == 0) { for (j = 0; j < cur_sec->items.num; j++) { - item = items+j; + item = items + j; if (astrcmpi(item->name, name) == 0) { bfree(item->value); @@ -575,20 +577,20 @@ if (!sec) { sec = darray_push_back_new(sizeof(struct config_section), - sections); + sections); sec->name = bstrdup(section); } item = darray_push_back_new(sizeof(struct config_item), &sec->items); - item->name = bstrdup(name); + item->name = bstrdup(name); item->value = value; unlock: pthread_mutex_unlock(&config->mutex); } -void config_set_string(config_t *config, const char *section, - const char *name, const char *value) +void config_set_string(config_t *config, const char *section, const char *name, + const char *value) { if (!value) value = ""; @@ -596,33 +598,33 @@ bstrdup(value)); } -void config_set_int(config_t *config, const char *section, - const char *name, int64_t value) +void config_set_int(config_t *config, const char *section, const char *name, + int64_t value) { struct dstr str; dstr_init(&str); - dstr_printf(&str, "%"PRId64, value); + dstr_printf(&str, "%" PRId64, value); config_set_item(config, &config->sections, section, name, str.array); } -void config_set_uint(config_t *config, const char *section, - const char *name, uint64_t value) +void config_set_uint(config_t *config, const char *section, const char *name, + uint64_t value) { struct dstr str; dstr_init(&str); - dstr_printf(&str, "%"PRIu64, value); + dstr_printf(&str, "%" PRIu64, value); config_set_item(config, &config->sections, section, name, str.array); } -void config_set_bool(config_t *config, const char *section, - const char *name, bool value) +void config_set_bool(config_t *config, const char *section, const char *name, + bool value) { char *str = bstrdup(value ? "true" : "false"); config_set_item(config, &config->sections, section, name, str); } -void config_set_double(config_t *config, const char *section, - const char *name, double value) +void config_set_double(config_t *config, const char *section, const char *name, + double value) { char *str = bzalloc(64); os_dtostr(value, str, 64); @@ -630,7 +632,7 @@ } void config_set_default_string(config_t *config, const char *section, - const char *name, const char *value) + const char *name, const char *value) { if (!value) value = ""; @@ -639,32 +641,32 @@ } void config_set_default_int(config_t *config, const char *section, - const char *name, int64_t value) + const char *name, int64_t value) { struct dstr str; dstr_init(&str); - dstr_printf(&str, "%"PRId64, value); + dstr_printf(&str, "%" PRId64, value); config_set_item(config, &config->defaults, section, name, str.array); } void config_set_default_uint(config_t *config, const char *section, - const char *name, uint64_t value) + const char *name, uint64_t value) { struct dstr str; dstr_init(&str); - dstr_printf(&str, "%"PRIu64, value); + dstr_printf(&str, "%" PRIu64, value); config_set_item(config, &config->defaults, section, name, str.array); } void config_set_default_bool(config_t *config, const char *section, - const char *name, bool value) + const char *name, bool value) { char *str = bstrdup(value ? "true" : "false"); config_set_item(config, &config->defaults, section, name, str); } void config_set_default_double(config_t *config, const char *section, - const char *name, double value) + const char *name, double value) { struct dstr str; dstr_init(&str); @@ -673,7 +675,7 @@ } const char *config_get_string(config_t *config, const char *section, - const char *name) + const char *name) { const struct config_item *item; const char *value = NULL; @@ -712,8 +714,7 @@ return strtoull(str, NULL, 10); } -int64_t config_get_int(config_t *config, const char *section, - const char *name) +int64_t config_get_int(config_t *config, const char *section, const char *name) { const char *value = config_get_string(config, section, name); if (value) @@ -723,7 +724,7 @@ } uint64_t config_get_uint(config_t *config, const char *section, - const char *name) + const char *name) { const char *value = config_get_string(config, section, name); if (value) @@ -732,19 +733,17 @@ return 0; } -bool config_get_bool(config_t *config, const char *section, - const char *name) +bool config_get_bool(config_t *config, const char *section, const char *name) { const char *value = config_get_string(config, section, name); if (value) - return astrcmpi(value, "true") == 0 || - !!str_to_uint64(value); + return astrcmpi(value, "true") == 0 || !!str_to_uint64(value); return false; } double config_get_double(config_t *config, const char *section, - const char *name) + const char *name) { const char *value = config_get_string(config, section, name); if (value) @@ -754,7 +753,7 @@ } bool config_remove_value(config_t *config, const char *section, - const char *name) + const char *name) { struct darray *sections = &config->sections; bool success = false; @@ -762,21 +761,20 @@ pthread_mutex_lock(&config->mutex); for (size_t i = 0; i < sections->num; i++) { - struct config_section *sec = darray_item( - sizeof(struct config_section), sections, i); + struct config_section *sec = + darray_item(sizeof(struct config_section), sections, i); if (astrcmpi(sec->name, section) != 0) continue; for (size_t j = 0; j < sec->items.num; j++) { struct config_item *item = darray_item( - sizeof(struct config_item), - &sec->items, j); + sizeof(struct config_item), &sec->items, j); if (astrcmpi(item->name, name) == 0) { config_item_free(item); darray_erase(sizeof(struct config_item), - &sec->items, j); + &sec->items, j); success = true; goto unlock; } @@ -788,8 +786,8 @@ return success; } -const char *config_get_default_string(config_t *config, - const char *section, const char *name) +const char *config_get_default_string(config_t *config, const char *section, + const char *name) { const struct config_item *item; const char *value = NULL; @@ -805,7 +803,7 @@ } int64_t config_get_default_int(config_t *config, const char *section, - const char *name) + const char *name) { const char *value = config_get_default_string(config, section, name); if (value) @@ -815,7 +813,7 @@ } uint64_t config_get_default_uint(config_t *config, const char *section, - const char *name) + const char *name) { const char *value = config_get_default_string(config, section, name); if (value) @@ -825,18 +823,17 @@ } bool config_get_default_bool(config_t *config, const char *section, - const char *name) + const char *name) { const char *value = config_get_default_string(config, section, name); if (value) - return astrcmpi(value, "true") == 0 || - !!str_to_uint64(value); + return astrcmpi(value, "true") == 0 || !!str_to_uint64(value); return false; } double config_get_default_double(config_t *config, const char *section, - const char *name) + const char *name) { const char *value = config_get_default_string(config, section, name); if (value) @@ -846,7 +843,7 @@ } bool config_has_user_value(config_t *config, const char *section, - const char *name) + const char *name) { bool success; pthread_mutex_lock(&config->mutex); @@ -856,7 +853,7 @@ } bool config_has_default_value(config_t *config, const char *section, - const char *name) + const char *name) { bool success; pthread_mutex_lock(&config->mutex); @@ -864,4 +861,3 @@ pthread_mutex_unlock(&config->mutex); return success; } -
View file
obs-studio-23.2.1.tar.xz/libobs/util/config-file.h -> obs-studio-24.0.0.tar.xz/libobs/util/config-file.h
Changed
@@ -32,9 +32,9 @@ struct config_data; typedef struct config_data config_t; -#define CONFIG_SUCCESS 0 +#define CONFIG_SUCCESS 0 #define CONFIG_FILENOTFOUND -1 -#define CONFIG_ERROR -2 +#define CONFIG_ERROR -2 enum config_open_type { CONFIG_OPEN_EXISTING, @@ -43,40 +43,40 @@ EXPORT config_t *config_create(const char *file); EXPORT int config_open(config_t **config, const char *file, - enum config_open_type open_type); + enum config_open_type open_type); EXPORT int config_open_string(config_t **config, const char *str); EXPORT int config_save(config_t *config); EXPORT int config_save_safe(config_t *config, const char *temp_ext, - const char *backup_ext); + const char *backup_ext); EXPORT void config_close(config_t *config); EXPORT size_t config_num_sections(config_t *config); EXPORT const char *config_get_section(config_t *config, size_t idx); EXPORT void config_set_string(config_t *config, const char *section, - const char *name, const char *value); + const char *name, const char *value); EXPORT void config_set_int(config_t *config, const char *section, - const char *name, int64_t value); + const char *name, int64_t value); EXPORT void config_set_uint(config_t *config, const char *section, - const char *name, uint64_t value); + const char *name, uint64_t value); EXPORT void config_set_bool(config_t *config, const char *section, - const char *name, bool value); + const char *name, bool value); EXPORT void config_set_double(config_t *config, const char *section, - const char *name, double value); + const char *name, double value); -EXPORT const char *config_get_string(config_t *config, - const char *section, const char *name); +EXPORT const char *config_get_string(config_t *config, const char *section, + const char *name); EXPORT int64_t config_get_int(config_t *config, const char *section, - const char *name); + const char *name); EXPORT uint64_t config_get_uint(config_t *config, const char *section, - const char *name); + const char *name); EXPORT bool config_get_bool(config_t *config, const char *section, - const char *name); + const char *name); EXPORT double config_get_double(config_t *config, const char *section, - const char *name); + const char *name); EXPORT bool config_remove_value(config_t *config, const char *section, - const char *name); + const char *name); /* * DEFAULT VALUES @@ -95,33 +95,34 @@ EXPORT int config_open_defaults(config_t *config, const char *file); EXPORT void config_set_default_string(config_t *config, const char *section, - const char *name, const char *value); + const char *name, const char *value); EXPORT void config_set_default_int(config_t *config, const char *section, - const char *name, int64_t value); + const char *name, int64_t value); EXPORT void config_set_default_uint(config_t *config, const char *section, - const char *name, uint64_t value); + const char *name, uint64_t value); EXPORT void config_set_default_bool(config_t *config, const char *section, - const char *name, bool value); + const char *name, bool value); EXPORT void config_set_default_double(config_t *config, const char *section, - const char *name, double value); + const char *name, double value); /* These functions allow you to get the current default values rather than get * the actual values. Probably almost never really needed */ EXPORT const char *config_get_default_string(config_t *config, - const char *section, const char *name); -EXPORT int64_t config_get_default_int(config_t *config, - const char *section, const char *name); -EXPORT uint64_t config_get_default_uint(config_t *config, - const char *section, const char *name); -EXPORT bool config_get_default_bool(config_t *config, - const char *section, const char *name); -EXPORT double config_get_default_double(config_t *config, - const char *section, const char *name); - -EXPORT bool config_has_user_value(config_t *config, - const char *section, const char *name); -EXPORT bool config_has_default_value(config_t *config, - const char *section, const char *name); + const char *section, + const char *name); +EXPORT int64_t config_get_default_int(config_t *config, const char *section, + const char *name); +EXPORT uint64_t config_get_default_uint(config_t *config, const char *section, + const char *name); +EXPORT bool config_get_default_bool(config_t *config, const char *section, + const char *name); +EXPORT double config_get_default_double(config_t *config, const char *section, + const char *name); + +EXPORT bool config_has_user_value(config_t *config, const char *section, + const char *name); +EXPORT bool config_has_default_value(config_t *config, const char *section, + const char *name); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/util/crc32.c -> obs-studio-24.0.0.tar.xz/libobs/util/crc32.c
Changed
@@ -21,16 +21,16 @@ static uint32_t crc32_tab[] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, - 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, - 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, @@ -62,8 +62,7 @@ 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d}; uint32_t calc_crc32(uint32_t crc, const void *buf, size_t size) {
View file
obs-studio-23.2.1.tar.xz/libobs/util/darray.h -> obs-studio-24.0.0.tar.xz/libobs/util/darray.h
Changed
@@ -46,50 +46,50 @@ static inline void darray_init(struct darray *dst) { - dst->array = NULL; - dst->num = 0; + dst->array = NULL; + dst->num = 0; dst->capacity = 0; } static inline void darray_free(struct darray *dst) { bfree(dst->array); - dst->array = NULL; - dst->num = 0; + dst->array = NULL; + dst->num = 0; dst->capacity = 0; } static inline size_t darray_alloc_size(const size_t element_size, - const struct darray *da) + const struct darray *da) { - return element_size*da->num; + return element_size * da->num; } static inline void *darray_item(const size_t element_size, - const struct darray *da, size_t idx) + const struct darray *da, size_t idx) { - return (void*)(((uint8_t*)da->array) + element_size*idx); + return (void *)(((uint8_t *)da->array) + element_size * idx); } static inline void *darray_end(const size_t element_size, - const struct darray *da) + const struct darray *da) { if (!da->num) return NULL; - return darray_item(element_size, da, da->num-1); + return darray_item(element_size, da, da->num - 1); } -static inline void darray_reserve(const size_t element_size, - struct darray *dst, const size_t capacity) +static inline void darray_reserve(const size_t element_size, struct darray *dst, + const size_t capacity) { void *ptr; if (capacity == 0 || capacity <= dst->num) return; - ptr = bmalloc(element_size*capacity); + ptr = bmalloc(element_size * capacity); if (dst->num) - memcpy(ptr, dst->array, element_size*dst->num); + memcpy(ptr, dst->array, element_size * dst->num); if (dst->array) bfree(dst->array); dst->array = ptr; @@ -97,27 +97,28 @@ } static inline void darray_ensure_capacity(const size_t element_size, - struct darray *dst, const size_t new_size) + struct darray *dst, + const size_t new_size) { size_t new_cap; void *ptr; if (new_size <= dst->capacity) return; - new_cap = (!dst->capacity) ? new_size : dst->capacity*2; + new_cap = (!dst->capacity) ? new_size : dst->capacity * 2; if (new_size > new_cap) new_cap = new_size; - ptr = bmalloc(element_size*new_cap); + ptr = bmalloc(element_size * new_cap); if (dst->capacity) - memcpy(ptr, dst->array, element_size*dst->capacity); + memcpy(ptr, dst->array, element_size * dst->capacity); if (dst->array) bfree(dst->array); dst->array = ptr; dst->capacity = new_cap; } -static inline void darray_resize(const size_t element_size, - struct darray *dst, const size_t size) +static inline void darray_resize(const size_t element_size, struct darray *dst, + const size_t size) { int b_clear; size_t old_num; @@ -137,38 +138,40 @@ if (b_clear) memset(darray_item(element_size, dst, old_num), 0, - element_size * (dst->num-old_num)); + element_size * (dst->num - old_num)); } static inline void darray_copy(const size_t element_size, struct darray *dst, - const struct darray *da) + const struct darray *da) { if (da->num == 0) { darray_free(dst); } else { darray_resize(element_size, dst, da->num); - memcpy(dst->array, da->array, element_size*da->num); + memcpy(dst->array, da->array, element_size * da->num); } } static inline void darray_copy_array(const size_t element_size, - struct darray *dst, const void *array, const size_t num) + struct darray *dst, const void *array, + const size_t num) { darray_resize(element_size, dst, num); - memcpy(dst->array, array, element_size*dst->num); + memcpy(dst->array, array, element_size * dst->num); } static inline void darray_move(struct darray *dst, struct darray *src) { darray_free(dst); memcpy(dst, src, sizeof(struct darray)); - src->array = NULL; + src->array = NULL; src->capacity = 0; - src->num = 0; + src->num = 0; } static inline size_t darray_find(const size_t element_size, - const struct darray *da, const void *item, const size_t idx) + const struct darray *da, const void *item, + const size_t idx) { size_t i; @@ -184,16 +187,16 @@ } static inline size_t darray_push_back(const size_t element_size, - struct darray *dst, const void *item) + struct darray *dst, const void *item) { darray_ensure_capacity(element_size, dst, ++dst->num); memcpy(darray_end(element_size, dst), item, element_size); - return dst->num-1; + return dst->num - 1; } static inline void *darray_push_back_new(const size_t element_size, - struct darray *dst) + struct darray *dst) { void *last; @@ -205,7 +208,8 @@ } static inline size_t darray_push_back_array(const size_t element_size, - struct darray *dst, const void *array, const size_t num) + struct darray *dst, + const void *array, const size_t num) { size_t old_num; if (!dst) @@ -214,21 +218,22 @@ return dst->num; old_num = dst->num; - darray_resize(element_size, dst, dst->num+num); + darray_resize(element_size, dst, dst->num + num); memcpy(darray_item(element_size, dst, old_num), array, - element_size*num); + element_size * num); return old_num; } static inline size_t darray_push_back_darray(const size_t element_size, - struct darray *dst, const struct darray *da) + struct darray *dst, + const struct darray *da) { return darray_push_back_array(element_size, dst, da->array, da->num); } static inline void darray_insert(const size_t element_size, struct darray *dst, - const size_t idx, const void *item) + const size_t idx, const void *item) { void *new_item; size_t move_count; @@ -245,13 +250,13 @@ new_item = darray_item(element_size, dst, idx); - memmove(darray_item(element_size, dst, idx+1), new_item, - move_count*element_size); + memmove(darray_item(element_size, dst, idx + 1), new_item, + move_count * element_size); memcpy(new_item, item, element_size); } static inline void *darray_insert_new(const size_t element_size, - struct darray *dst, const size_t idx) + struct darray *dst, const size_t idx) { void *item; size_t move_count; @@ -264,16 +269,16 @@ move_count = dst->num - idx; darray_ensure_capacity(element_size, dst, ++dst->num); - memmove(darray_item(element_size, dst, idx+1), item, - move_count*element_size); + memmove(darray_item(element_size, dst, idx + 1), item, + move_count * element_size); memset(item, 0, element_size); return item; } static inline void darray_insert_array(const size_t element_size, - struct darray *dst, const size_t idx, - const void *array, const size_t num) + struct darray *dst, const size_t idx, + const void *array, const size_t num) { size_t old_num; @@ -282,22 +287,23 @@ assert(idx < dst->num); old_num = dst->num; - darray_resize(element_size, dst, dst->num+num); + darray_resize(element_size, dst, dst->num + num); - memmove(darray_item(element_size, dst, idx+num), - darray_item(element_size, dst, idx), - element_size*(old_num-idx)); - memcpy(darray_item(element_size, dst, idx), array, element_size*num); + memmove(darray_item(element_size, dst, idx + num), + darray_item(element_size, dst, idx), + element_size * (old_num - idx)); + memcpy(darray_item(element_size, dst, idx), array, element_size * num); } static inline void darray_insert_darray(const size_t element_size, - struct darray *dst, const size_t idx, const struct darray *da) + struct darray *dst, const size_t idx, + const struct darray *da) { darray_insert_array(element_size, dst, idx, da->array, da->num); } static inline void darray_erase(const size_t element_size, struct darray *dst, - const size_t idx) + const size_t idx) { assert(idx < dst->num); @@ -305,12 +311,12 @@ return; memmove(darray_item(element_size, dst, idx), - darray_item(element_size, dst, idx+1), - element_size*(dst->num-idx)); + darray_item(element_size, dst, idx + 1), + element_size * (dst->num - idx)); } static inline void darray_erase_item(const size_t element_size, - struct darray *dst, const void *item) + struct darray *dst, const void *item) { size_t idx = darray_find(element_size, dst, item, 0); if (idx != DARRAY_INVALID) @@ -318,7 +324,8 @@ } static inline void darray_erase_range(const size_t element_size, - struct darray *dst, const size_t start, const size_t end) + struct darray *dst, const size_t start, + const size_t end) { size_t count, move_count; @@ -326,7 +333,7 @@ assert(end <= dst->num); assert(end > start); - count = end-start; + count = end - start; if (count == 1) { darray_erase(element_size, dst, start); return; @@ -338,30 +345,31 @@ move_count = dst->num - end; if (move_count) memmove(darray_item(element_size, dst, start), - darray_item(element_size, dst, end), - move_count * element_size); + darray_item(element_size, dst, end), + move_count * element_size); dst->num -= count; } static inline void darray_pop_back(const size_t element_size, - struct darray *dst) + struct darray *dst) { assert(dst->num != 0); if (dst->num) - darray_erase(element_size, dst, dst->num-1); + darray_erase(element_size, dst, dst->num - 1); } static inline void darray_join(const size_t element_size, struct darray *dst, - struct darray *da) + struct darray *da) { darray_push_back_darray(element_size, dst, da); darray_free(da); } static inline void darray_split(const size_t element_size, struct darray *dst1, - struct darray *dst2, const struct darray *da, const size_t idx) + struct darray *dst2, const struct darray *da, + const size_t idx) { struct darray temp; @@ -377,43 +385,44 @@ if (da->num) { if (idx) darray_copy_array(element_size, dst1, temp.array, - temp.num); - if (idx < temp.num-1) + temp.num); + if (idx < temp.num - 1) darray_copy_array(element_size, dst2, - darray_item(element_size, &temp, idx), - temp.num-idx); + darray_item(element_size, &temp, idx), + temp.num - idx); } darray_free(&temp); } static inline void darray_move_item(const size_t element_size, - struct darray *dst, const size_t from, const size_t to) + struct darray *dst, const size_t from, + const size_t to) { void *temp, *p_from, *p_to; if (from == to) return; - temp = malloc(element_size); + temp = malloc(element_size); p_from = darray_item(element_size, dst, from); - p_to = darray_item(element_size, dst, to); + p_to = darray_item(element_size, dst, to); memcpy(temp, p_from, element_size); if (to < from) - memmove(darray_item(element_size, dst, to+1), p_to, - element_size*(from-to)); + memmove(darray_item(element_size, dst, to + 1), p_to, + element_size * (from - to)); else - memmove(p_from, darray_item(element_size, dst, from+1), - element_size*(to-from)); + memmove(p_from, darray_item(element_size, dst, from + 1), + element_size * (to - from)); memcpy(p_to, temp, element_size); free(temp); } -static inline void darray_swap(const size_t element_size, - struct darray *dst, const size_t a, const size_t b) +static inline void darray_swap(const size_t element_size, struct darray *dst, + const size_t a, const size_t b) { void *temp, *a_ptr, *b_ptr; @@ -423,13 +432,13 @@ if (a == b) return; - temp = malloc(element_size); + temp = malloc(element_size); a_ptr = darray_item(element_size, dst, a); b_ptr = darray_item(element_size, dst, b); - memcpy(temp, a_ptr, element_size); + memcpy(temp, a_ptr, element_size); memcpy(a_ptr, b_ptr, element_size); - memcpy(b_ptr, temp, element_size); + memcpy(b_ptr, temp, element_size); free(temp); } @@ -457,7 +466,7 @@ #define da_free(v) darray_free(&v.da) -#define da_alloc_size(v) (sizeof(*v.array)*v.num) +#define da_alloc_size(v) (sizeof(*v.array) * v.num) #define da_end(v) darray_end(sizeof(*v.array), &v.da) @@ -466,16 +475,14 @@ #define da_resize(v, size) darray_resize(sizeof(*v.array), &v.da, size) -#define da_copy(dst, src) \ - darray_copy(sizeof(*dst.array), &dst.da, &src.da) +#define da_copy(dst, src) darray_copy(sizeof(*dst.array), &dst.da, &src.da) #define da_copy_array(dst, src_array, n) \ darray_copy_array(sizeof(*dst.array), &dst.da, src_array, n) #define da_move(dst, src) darray_move(&dst.da, &src.da) -#define da_find(v, item, idx) \ - darray_find(sizeof(*v.array), &v.da, item, idx) +#define da_find(v, item, idx) darray_find(sizeof(*v.array), &v.da, item, idx) #define da_push_back(v, item) darray_push_back(sizeof(*v.array), &v.da, item) @@ -490,19 +497,15 @@ #define da_insert(v, idx, item) \ darray_insert(sizeof(*v.array), &v.da, idx, item) -#define da_insert_new(v, idx) \ - darray_insert_new(sizeof(*v.array), &v.da, idx) +#define da_insert_new(v, idx) darray_insert_new(sizeof(*v.array), &v.da, idx) #define da_insert_array(dst, idx, src_array, n) \ - darray_insert_array(sizeof(*dst.array), &dst.da, idx, \ - src_array, n) + darray_insert_array(sizeof(*dst.array), &dst.da, idx, src_array, n) #define da_insert_da(dst, idx, src) \ - darray_insert_darray(sizeof(*dst.array), &dst.da, idx, \ - &src.da) + darray_insert_darray(sizeof(*dst.array), &dst.da, idx, &src.da) -#define da_erase(dst, idx) \ - darray_erase(sizeof(*dst.array), &dst.da, idx) +#define da_erase(dst, idx) darray_erase(sizeof(*dst.array), &dst.da, idx) #define da_erase_item(dst, item) \ darray_erase_item(sizeof(*dst.array), &dst.da, item) @@ -510,21 +513,17 @@ #define da_erase_range(dst, from, to) \ darray_erase_range(sizeof(*dst.array), &dst.da, from, to) -#define da_pop_back(dst) \ - darray_pop_back(sizeof(*dst.array), &dst.da); +#define da_pop_back(dst) darray_pop_back(sizeof(*dst.array), &dst.da); -#define da_join(dst, src) \ - darray_join(sizeof(*dst.array), &dst.da, &src.da) +#define da_join(dst, src) darray_join(sizeof(*dst.array), &dst.da, &src.da) #define da_split(dst1, dst2, src, idx) \ - darray_split(sizeof(*src.array), &dst1.da, &dst2.da, \ - &src.da, idx) + darray_split(sizeof(*src.array), &dst1.da, &dst2.da, &src.da, idx) #define da_move_item(v, from, to) \ darray_move_item(sizeof(*v.array), &v.da, from, to) -#define da_swap(v, idx1, idx2) \ - darray_swap(sizeof(*v.array), &v.da, idx1, idx2) +#define da_swap(v, idx1, idx2) darray_swap(sizeof(*v.array), &v.da, idx1, idx2) #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/util/dstr.c -> obs-studio-24.0.0.tar.xz/libobs/util/dstr.c
Changed
@@ -174,7 +174,7 @@ do { if (astrcmpi_n(str, find, len) == 0) - return (char*)str; + return (char *)str; } while (*str++); return NULL; @@ -191,7 +191,7 @@ do { if (wstrcmpi_n(str, find, len) == 0) - return (wchar_t*)str; + return (wchar_t *)str; } while (*str++); return NULL; @@ -205,7 +205,7 @@ char *strdepad(char *str) { char *temp; - size_t len; + size_t len; if (!str) return str; @@ -223,7 +223,7 @@ memmove(str, temp, len + 1); if (len) { - temp = str + (len-1); + temp = str + (len - 1); while (is_padding(*temp)) *(temp--) = 0; } @@ -234,7 +234,7 @@ wchar_t *wcsdepad(wchar_t *str) { wchar_t *temp; - size_t len; + size_t len; if (!str) return str; @@ -249,10 +249,10 @@ len = wcslen(str); if (temp != str) - memmove(str, temp, (len+1) * sizeof(wchar_t)); + memmove(str, temp, (len + 1) * sizeof(wchar_t)); if (len) { - temp = str + (len-1); + temp = str + (len - 1); while (*temp == ' ' || *temp == '\t') *(temp--) = 0; } @@ -264,9 +264,9 @@ { const char *cur_str = str; const char *next_str; - char * out = NULL; - size_t count = 0; - size_t total_size = 0; + char *out = NULL; + size_t count = 0; + size_t total_size = 0; if (str) { char **table; @@ -295,16 +295,16 @@ /* ------------------ */ - cur_pos = (count + 1) * sizeof(char *); + cur_pos = (count + 1) * sizeof(char *); total_size += cur_pos; - out = bmalloc(total_size); - offset = out + cur_pos; - table = (char **)out; + out = bmalloc(total_size); + offset = out + cur_pos; + table = (char **)out; /* ------------------ */ next_str = strchr(str, split_ch); - cur_str = str; + cur_str = str; while (next_str) { size_t size = next_str - cur_str; @@ -328,7 +328,7 @@ table[cur_idx] = NULL; } - return (char**)out; + return (char **)out; } void strlist_free(char **strlist) @@ -379,7 +379,7 @@ return; dst->array = bmemdup(array, len + 1); - dst->len = len; + dst->len = len; dst->capacity = len + 1; dst->array[len] = 0; @@ -397,7 +397,7 @@ newlen = size_min(len, str->len); dst->array = bmemdup(str->array, newlen + 1); - dst->len = newlen; + dst->len = newlen; dst->capacity = newlen + 1; dst->array[newlen] = 0; @@ -412,7 +412,7 @@ new_len = dst->len + str->len; dstr_ensure_capacity(dst, new_len + 1); - memcpy(dst->array+dst->len, str->array, str->len + 1); + memcpy(dst->array + dst->len, str->array, str->len + 1); dst->len = new_len; } @@ -430,7 +430,7 @@ new_len = dst->len + len; dstr_ensure_capacity(dst, new_len + 1); - memcpy(dst->array+dst->len, array, len); + memcpy(dst->array + dst->len, array, len); dst->len = new_len; dst->array[new_len] = 0; @@ -446,7 +446,7 @@ new_len = dst->len + in_len; dstr_ensure_capacity(dst, new_len + 1); - memcpy(dst->array+dst->len, str->array, in_len); + memcpy(dst->array + dst->len, str->array, in_len); dst->len = new_len; dst->array[new_len] = 0; @@ -467,14 +467,14 @@ dstr_ensure_capacity(dst, new_len + 1); - memmove(dst->array+idx+len, dst->array+idx, dst->len - idx + 1); - memcpy(dst->array+idx, array, len); + memmove(dst->array + idx + len, dst->array + idx, dst->len - idx + 1); + memcpy(dst->array + idx, array, len); dst->len = new_len; } void dstr_insert_dstr(struct dstr *dst, const size_t idx, - const struct dstr *str) + const struct dstr *str) { size_t new_len; if (!str->len) @@ -486,10 +486,11 @@ new_len = dst->len + str->len; - dstr_ensure_capacity(dst, (new_len+1)); + dstr_ensure_capacity(dst, (new_len + 1)); - memmove(dst->array+idx+str->len, dst->array+idx, dst->len - idx + 1); - memcpy(dst->array+idx, str->array, str->len); + memmove(dst->array + idx + str->len, dst->array + idx, + dst->len - idx + 1); + memcpy(dst->array + idx, str->array, str->len); dst->len = new_len; } @@ -501,8 +502,8 @@ return; } - dstr_ensure_capacity(dst, (++dst->len+1)); - memmove(dst->array+idx+1, dst->array+idx, dst->len - idx + 1); + dstr_ensure_capacity(dst, (++dst->len + 1)); + memmove(dst->array + idx + 1, dst->array + idx, dst->len - idx + 1); dst->array[idx] = ch; } @@ -516,13 +517,13 @@ return; } - end = idx+count; + end = idx + count; if (end == dst->len) dst->array[idx] = 0; else - memmove(dst->array+idx, dst->array+end, dst->len - end + 1); + memmove(dst->array + idx, dst->array + end, dst->len - end + 1); - dst->len -= count; + dst->len -= count; } void dstr_printf(struct dstr *dst, const char *format, ...) @@ -549,7 +550,8 @@ int len = vsnprintf(NULL, 0, format, args_cp); va_end(args_cp); - if (len < 0) len = 4095; + if (len < 0) + len = 4095; dstr_ensure_capacity(dst, ((size_t)len) + 1); len = vsnprintf(dst->array, ((size_t)len) + 1, format, args); @@ -570,8 +572,9 @@ int len = vsnprintf(NULL, 0, format, args_cp); va_end(args_cp); - if (len < 0) len = 4095; - + if (len < 0) + len = 4095; + dstr_ensure_capacity(dst, dst->len + ((size_t)len) + 1); len = vsnprintf(dst->array + dst->len, ((size_t)len) + 1, format, args); @@ -583,9 +586,8 @@ dst->len += len < 0 ? strlen(dst->array + dst->len) : (size_t)len; } -void dstr_safe_printf(struct dstr *dst, const char *format, - const char *val1, const char *val2, const char *val3, - const char *val4) +void dstr_safe_printf(struct dstr *dst, const char *format, const char *val1, + const char *val2, const char *val3, const char *val4) { dstr_copy(dst, format); if (val1) @@ -598,8 +600,7 @@ dstr_replace(dst, "$4", val4); } -void dstr_replace(struct dstr *str, const char *find, - const char *replace) +void dstr_replace(struct dstr *str, const char *find, const char *replace) { size_t find_len, replace_len; char *temp; @@ -610,7 +611,7 @@ if (!replace) replace = ""; - find_len = strlen(find); + find_len = strlen(find); replace_len = strlen(replace); temp = str->array; @@ -618,11 +619,11 @@ unsigned long count = 0; while ((temp = strstr(temp, find)) != NULL) { - char *end = temp+find_len; + char *end = temp + find_len; size_t end_len = strlen(end); if (end_len) { - memmove(temp+replace_len, end, end_len + 1); + memmove(temp + replace_len, end, end_len + 1); if (replace_len) memcpy(temp, replace, replace_len); } else { @@ -634,7 +635,7 @@ } if (count) - str->len += (replace_len-find_len) * count; + str->len += (replace_len - find_len) * count; } else if (replace_len > find_len) { unsigned long count = 0; @@ -647,16 +648,16 @@ if (!count) return; - str->len += (replace_len-find_len) * count; + str->len += (replace_len - find_len) * count; dstr_ensure_capacity(str, str->len + 1); temp = str->array; while ((temp = strstr(temp, find)) != NULL) { - char *end = temp+find_len; + char *end = temp + find_len; size_t end_len = strlen(end); if (end_len) { - memmove(temp+replace_len, end, end_len + 1); + memmove(temp + replace_len, end, end_len + 1); memcpy(temp, replace, replace_len); } else { strcpy(temp, replace); @@ -692,12 +693,12 @@ } void dstr_mid(struct dstr *dst, const struct dstr *str, const size_t start, - const size_t count) + const size_t count) { struct dstr temp; dstr_init(&temp); dstr_copy_dstr(&temp, str); - dstr_ncopy(dst, temp.array+start, count); + dstr_ncopy(dst, temp.array + start, count); dstr_free(&temp); } @@ -705,7 +706,7 @@ { struct dstr temp; dstr_init(&temp); - dstr_ncopy(&temp, str->array+pos, str->len-pos); + dstr_ncopy(&temp, str->array + pos, str->len - pos); dstr_copy_dstr(dst, &temp); dstr_free(&temp); } @@ -736,7 +737,7 @@ if (len) { dstr_resize(dst, len); - wchar_to_utf8(wstr, 0, dst->array, len+1, 0); + wchar_to_utf8(wstr, 0, dst->array, len + 1, 0); } else { dstr_free(dst); }
View file
obs-studio-23.2.1.tar.xz/libobs/util/dstr.h -> obs-studio-24.0.0.tar.xz/libobs/util/dstr.h
Changed
@@ -66,7 +66,7 @@ static inline void dstr_init_move_array(struct dstr *dst, char *str); static inline void dstr_init_copy(struct dstr *dst, const char *src); static inline void dstr_init_copy_dstr(struct dstr *dst, - const struct dstr *src); + const struct dstr *src); EXPORT void dstr_init_copy_strref(struct dstr *dst, const struct strref *src); static inline void dstr_free(struct dstr *dst); @@ -79,10 +79,9 @@ static inline void dstr_copy_dstr(struct dstr *dst, const struct dstr *src); EXPORT void dstr_copy_strref(struct dstr *dst, const struct strref *src); -EXPORT void dstr_ncopy(struct dstr *dst, const char *array, - const size_t len); +EXPORT void dstr_ncopy(struct dstr *dst, const char *array, const size_t len); EXPORT void dstr_ncopy_dstr(struct dstr *dst, const struct dstr *src, - const size_t len); + const size_t len); static inline void dstr_resize(struct dstr *dst, const size_t num); static inline void dstr_reserve(struct dstr *dst, const size_t num); @@ -97,14 +96,12 @@ EXPORT void dstr_ncat(struct dstr *dst, const char *array, const size_t len); EXPORT void dstr_ncat_dstr(struct dstr *dst, const struct dstr *str, - const size_t len); + const size_t len); -EXPORT void dstr_insert(struct dstr *dst, const size_t idx, - const char *array); +EXPORT void dstr_insert(struct dstr *dst, const size_t idx, const char *array); EXPORT void dstr_insert_dstr(struct dstr *dst, const size_t idx, - const struct dstr *str); -EXPORT void dstr_insert_ch(struct dstr *dst, const size_t idx, - const char ch); + const struct dstr *str); +EXPORT void dstr_insert_ch(struct dstr *dst, const size_t idx, const char ch); EXPORT void dstr_remove(struct dstr *dst, const size_t idx, const size_t count); @@ -117,32 +114,30 @@ EXPORT void dstr_vcatf(struct dstr *dst, const char *format, va_list args); EXPORT void dstr_safe_printf(struct dstr *dst, const char *format, - const char *val1, const char *val2, const char *val3, - const char *val4); + const char *val1, const char *val2, + const char *val3, const char *val4); -static inline const char *dstr_find_i(const struct dstr *str, - const char *find); -static inline const char *dstr_find(const struct dstr *str, - const char *find); +static inline const char *dstr_find_i(const struct dstr *str, const char *find); +static inline const char *dstr_find(const struct dstr *str, const char *find); EXPORT void dstr_replace(struct dstr *str, const char *find, - const char *replace); + const char *replace); static inline int dstr_cmp(const struct dstr *str1, const char *str2); static inline int dstr_cmpi(const struct dstr *str1, const char *str2); static inline int dstr_ncmp(const struct dstr *str1, const char *str2, - const size_t n); + const size_t n); static inline int dstr_ncmpi(const struct dstr *str1, const char *str2, - const size_t n); + const size_t n); EXPORT void dstr_depad(struct dstr *dst); EXPORT void dstr_left(struct dstr *dst, const struct dstr *str, - const size_t pos); + const size_t pos); EXPORT void dstr_mid(struct dstr *dst, const struct dstr *str, - const size_t start, const size_t count); + const size_t start, const size_t count); EXPORT void dstr_right(struct dstr *dst, const struct dstr *str, - const size_t pos); + const size_t pos); static inline char dstr_end(const struct dstr *str); @@ -160,15 +155,15 @@ static inline void dstr_init(struct dstr *dst) { - dst->array = NULL; - dst->len = 0; + dst->array = NULL; + dst->len = 0; dst->capacity = 0; } static inline void dstr_init_move_array(struct dstr *dst, char *str) { - dst->array = str; - dst->len = (!str) ? 0 : strlen(str); + dst->array = str; + dst->len = (!str) ? 0 : strlen(str); dst->capacity = dst->len + 1; } @@ -193,8 +188,8 @@ static inline void dstr_free(struct dstr *dst) { bfree(dst->array); - dst->array = NULL; - dst->len = 0; + dst->array = NULL; + dst->len = 0; dst->capacity = 0; } @@ -202,14 +197,14 @@ { size_t i; for (i = 0; i < count; i++) - dstr_free(array+i); + dstr_free(array + i); } static inline void dstr_move_array(struct dstr *dst, char *str) { dstr_free(dst); - dst->array = str; - dst->len = (!str) ? 0 : strlen(str); + dst->array = str; + dst->len = (!str) ? 0 : strlen(str); dst->capacity = dst->len + 1; } @@ -225,10 +220,10 @@ if (new_size <= dst->capacity) return; - new_cap = (!dst->capacity) ? new_size : dst->capacity*2; + new_cap = (!dst->capacity) ? new_size : dst->capacity * 2; if (new_size > new_cap) new_cap = new_size; - dst->array = (char*)brealloc(dst->array, new_cap); + dst->array = (char *)brealloc(dst->array, new_cap); dst->capacity = new_cap; } @@ -249,7 +244,7 @@ if (capacity == 0 || capacity <= dst->len) return; - dst->array = (char*)brealloc(dst->array, capacity); + dst->array = (char *)brealloc(dst->array, capacity); dst->capacity = capacity; } @@ -288,8 +283,8 @@ static inline void dstr_cat_ch(struct dstr *dst, char ch) { dstr_ensure_capacity(dst, ++dst->len + 1); - dst->array[dst->len-1] = ch; - dst->array[dst->len] = 0; + dst->array[dst->len - 1] = ch; + dst->array[dst->len] = 0; } static inline const char *dstr_find_i(const struct dstr *str, const char *find) @@ -313,13 +308,13 @@ } static inline int dstr_ncmp(const struct dstr *str1, const char *str2, - const size_t n) + const size_t n) { return astrcmp_n(str1->array, str2, n); } static inline int dstr_ncmpi(const struct dstr *str1, const char *str2, - const size_t n) + const size_t n) { return astrcmpi_n(str1->array, str2, n); }
View file
obs-studio-23.2.1.tar.xz/libobs/util/dstr.hpp -> obs-studio-24.0.0.tar.xz/libobs/util/dstr.hpp
Changed
@@ -21,15 +21,12 @@ class DStr { dstr str; - DStr(DStr const&) = delete; - DStr &operator=(DStr const&) = delete; + DStr(DStr const &) = delete; + DStr &operator=(DStr const &) = delete; public: - inline DStr() {dstr_init(&str);} - inline DStr(DStr &&other) : DStr() - { - dstr_move(&str, &other.str); - } + inline DStr() { dstr_init(&str); } + inline DStr(DStr &&other) : DStr() { dstr_move(&str, &other.str); } inline DStr &operator=(DStr &&other) { @@ -37,13 +34,13 @@ return *this; } - inline ~DStr() {dstr_free(&str);} + inline ~DStr() { dstr_free(&str); } - inline operator dstr*() {return &str;} - inline operator const dstr*() const {return &str;} + inline operator dstr *() { return &str; } + inline operator const dstr *() const { return &str; } - inline operator char*() {return str.array;} - inline operator const char*() const {return str.array;} + inline operator char *() { return str.array; } + inline operator const char *() const { return str.array; } - inline dstr *operator->() {return &str;} + inline dstr *operator->() { return &str; } };
View file
obs-studio-23.2.1.tar.xz/libobs/util/file-serializer.c -> obs-studio-24.0.0.tar.xz/libobs/util/file-serializer.c
Changed
@@ -24,14 +24,20 @@ } static int64_t file_input_seek(void *file, int64_t offset, - enum serialize_seek_type seek_type) + enum serialize_seek_type seek_type) { int origin = SEEK_SET; switch (seek_type) { - case SERIALIZE_SEEK_START: origin = SEEK_SET; break; - case SERIALIZE_SEEK_CURRENT: origin = SEEK_CUR; break; - case SERIALIZE_SEEK_END: origin = SEEK_END; break; + case SERIALIZE_SEEK_START: + origin = SEEK_SET; + break; + case SERIALIZE_SEEK_CURRENT: + origin = SEEK_CUR; + break; + case SERIALIZE_SEEK_END: + origin = SEEK_END; + break; } if (os_fseeki64(file, offset, origin) == -1) @@ -79,15 +85,21 @@ } static int64_t file_output_seek(void *sdata, int64_t offset, - enum serialize_seek_type seek_type) + enum serialize_seek_type seek_type) { struct file_output_data *out = sdata; int origin = SEEK_SET; switch (seek_type) { - case SERIALIZE_SEEK_START: origin = SEEK_SET; break; - case SERIALIZE_SEEK_CURRENT: origin = SEEK_CUR; break; - case SERIALIZE_SEEK_END: origin = SEEK_END; break; + case SERIALIZE_SEEK_START: + origin = SEEK_SET; + break; + case SERIALIZE_SEEK_CURRENT: + origin = SEEK_CUR; + break; + case SERIALIZE_SEEK_END: + origin = SEEK_END; + break; } if (os_fseeki64(out->file, offset, origin) == -1) @@ -121,8 +133,8 @@ return true; } -bool file_output_serializer_init_safe(struct serializer *s, - const char *path, const char *temp_ext) +bool file_output_serializer_init_safe(struct serializer *s, const char *path, + const char *temp_ext) { struct dstr temp_name = {0}; struct file_output_data *out;
View file
obs-studio-23.2.1.tar.xz/libobs/util/file-serializer.h -> obs-studio-24.0.0.tar.xz/libobs/util/file-serializer.h
Changed
@@ -23,5 +23,6 @@ EXPORT bool file_output_serializer_init(struct serializer *s, const char *path); EXPORT bool file_output_serializer_init_safe(struct serializer *s, - const char *path, const char *temp_ext); + const char *path, + const char *temp_ext); EXPORT void file_output_serializer_free(struct serializer *s);
View file
obs-studio-23.2.1.tar.xz/libobs/util/lexer.c -> obs-studio-24.0.0.tar.xz/libobs/util/lexer.c
Changed
@@ -32,7 +32,7 @@ char ch1, ch2; ch1 = (i < str1->len) ? str1->array[i] : 0; - ch2 = *str2; + ch2 = *str2; if (ch1 < ch2) return -1; @@ -56,7 +56,7 @@ char ch1, ch2; ch1 = (i < str1->len) ? (char)toupper(str1->array[i]) : 0; - ch2 = (char)toupper(*str2); + ch2 = (char)toupper(*str2); if (ch1 < ch2) return -1; @@ -80,7 +80,7 @@ char ch1, ch2; ch1 = (i < str1->len) ? str1->array[i] : 0; - ch2 = (i < str2->len) ? str2->array[i] : 0; + ch2 = (i < str2->len) ? str2->array[i] : 0; if (ch1 < ch2) return -1; @@ -139,7 +139,7 @@ return false; found_num = true; - } while(*++str && --n); + } while (*++str && --n); return found_num; } @@ -183,26 +183,26 @@ } else { found_num = true; } - } while(*++str && --n); + } while (*++str && --n); return found_num; } /* ------------------------------------------------------------------------- */ -void error_data_add(struct error_data *data, const char *file, - uint32_t row, uint32_t column, const char *msg, int level) +void error_data_add(struct error_data *data, const char *file, uint32_t row, + uint32_t column, const char *msg, int level) { struct error_item item; if (!data) return; - item.file = file; - item.row = row; + item.file = file; + item.row = row; item.column = column; - item.level = level; - item.error = bstrdup(msg); + item.level = level; + item.error = bstrdup(msg); da_push_back(data->errors, &item); } @@ -215,9 +215,9 @@ dstr_init(&str); for (i = 0; i < ed->errors.num; i++) { - struct error_item *item = items+i; + struct error_item *item = items + i; dstr_catf(&str, "%s (%u, %u): %s\n", item->file, item->row, - item->column, item->error); + item->column, item->error); } return str.array; @@ -238,7 +238,7 @@ } bool lexer_getbasetoken(struct lexer *lex, struct base_token *token, - enum ignore_whitespace iws) + enum ignore_whitespace iws) { const char *offset = lex->offset; const char *token_start = NULL; @@ -254,10 +254,10 @@ if (type == BASETOKEN_NONE) { if (new_type == BASETOKEN_WHITESPACE && - ignore_whitespace) + ignore_whitespace) continue; - token_start = offset-1; + token_start = offset - 1; type = new_type; if (type != BASETOKEN_DIGIT && @@ -277,7 +277,7 @@ lex->offset = offset; if (token_start && offset > token_start) { - strref_set(&token->text, token_start, offset-token_start); + strref_set(&token->text, token_start, offset - token_start); token->type = type; return true; } @@ -285,8 +285,8 @@ return false; } -void lexer_getstroffset(const struct lexer *lex, const char *str, - uint32_t *row, uint32_t *col) +void lexer_getstroffset(const struct lexer *lex, const char *str, uint32_t *row, + uint32_t *col) { uint32_t cur_col = 1, cur_row = 1; const char *text = lex->text; @@ -296,7 +296,7 @@ while (text < str) { if (is_newline(*text)) { - text += newline_size(text)-1; + text += newline_size(text) - 1; cur_col = 1; cur_row++; } else {
View file
obs-studio-23.2.1.tar.xz/libobs/util/lexer.h -> obs-studio-24.0.0.tar.xz/libobs/util/lexer.h
Changed
@@ -35,19 +35,19 @@ static inline void strref_clear(struct strref *dst) { dst->array = NULL; - dst->len = 0; + dst->len = 0; } static inline void strref_set(struct strref *dst, const char *array, size_t len) { dst->array = array; - dst->len = len; + dst->len = len; } static inline void strref_copy(struct strref *dst, const struct strref *src) { dst->array = src->array; - dst->len = src->len; + dst->len = src->len; } static inline void strref_add(struct strref *dst, const struct strref *t) @@ -66,9 +66,9 @@ EXPORT int strref_cmp(const struct strref *str1, const char *str2); EXPORT int strref_cmpi(const struct strref *str1, const char *str2); EXPORT int strref_cmp_strref(const struct strref *str1, - const struct strref *str2); + const struct strref *str2); EXPORT int strref_cmpi_strref(const struct strref *str1, - const struct strref *str2); + const struct strref *str2); /* ------------------------------------------------------------------------- */ @@ -102,8 +102,7 @@ static inline bool is_newline_pair(char ch1, char ch2) { - return (ch1 == '\r' && ch2 == '\n') || - (ch1 == '\n' && ch2 == '\r'); + return (ch1 == '\r' && ch2 == '\n') || (ch1 == '\n' && ch2 == '\r'); } static inline int newline_size(const char *array) @@ -146,14 +145,14 @@ } static inline void base_token_copy(struct base_token *dst, - struct base_token *src) + struct base_token *src) { memcpy(dst, src, sizeof(struct base_token)); } /* ------------------------------------------------------------------------- */ -#define LEX_ERROR 0 +#define LEX_ERROR 0 #define LEX_WARNING 1 struct error_item { @@ -178,7 +177,7 @@ { size_t i; for (i = 0; i < num; i++) - error_item_free(array+i); + error_item_free(array + i); } /* ------------------------------------------------------------------------- */ @@ -199,18 +198,18 @@ } static inline const struct error_item *error_data_item(struct error_data *ed, - size_t idx) + size_t idx) { - return ed->errors.array+idx; + return ed->errors.array + idx; } EXPORT char *error_data_buildstring(struct error_data *ed); EXPORT void error_data_add(struct error_data *ed, const char *file, - uint32_t row, uint32_t column, const char *msg, int level); + uint32_t row, uint32_t column, const char *msg, + int level); -static inline size_t error_data_type_count(struct error_data *ed, - int type) +static inline size_t error_data_type_count(struct error_data *ed, int type) { size_t count = 0, i; for (i = 0; i < ed->errors.num; i++) { @@ -252,14 +251,14 @@ static inline void lexer_start(struct lexer *lex, const char *text) { lexer_free(lex); - lex->text = bstrdup(text); + lex->text = bstrdup(text); lex->offset = lex->text; } static inline void lexer_start_move(struct lexer *lex, char *text) { lexer_free(lex); - lex->text = text; + lex->text = text; lex->offset = lex->text; } @@ -268,16 +267,13 @@ lex->offset = lex->text; } -enum ignore_whitespace { - PARSE_WHITESPACE, - IGNORE_WHITESPACE -}; +enum ignore_whitespace { PARSE_WHITESPACE, IGNORE_WHITESPACE }; EXPORT bool lexer_getbasetoken(struct lexer *lex, struct base_token *t, - enum ignore_whitespace iws); + enum ignore_whitespace iws); EXPORT void lexer_getstroffset(const struct lexer *lex, const char *str, - uint32_t *row, uint32_t *col); + uint32_t *row, uint32_t *col); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/util/pipe-posix.c -> obs-studio-24.0.0.tar.xz/libobs/util/pipe-posix.c
Changed
@@ -26,7 +26,7 @@ }; os_process_pipe_t *os_process_pipe_create(const char *cmd_line, - const char *type) + const char *type) { struct os_process_pipe pipe = {0}; struct os_process_pipe *out; @@ -38,7 +38,7 @@ pipe.file = popen(cmd_line, type); pipe.read_pipe = *type == 'r'; - if (pipe.file == (FILE*)-1 || pipe.file == NULL) { + if (pipe.file == (FILE *)-1 || pipe.file == NULL) { return NULL; } @@ -73,7 +73,8 @@ return fread(data, 1, len, pp->file); } -size_t os_process_pipe_read_err(os_process_pipe_t *pp, uint8_t *data, size_t len) +size_t os_process_pipe_read_err(os_process_pipe_t *pp, uint8_t *data, + size_t len) { /* XXX: unsupported on posix */ UNUSED_PARAMETER(pp); @@ -83,7 +84,7 @@ } size_t os_process_pipe_write(os_process_pipe_t *pp, const uint8_t *data, - size_t len) + size_t len) { if (!pp) { return 0;
View file
obs-studio-23.2.1.tar.xz/libobs/util/pipe-windows.c -> obs-studio-24.0.0.tar.xz/libobs/util/pipe-windows.c
Changed
@@ -43,7 +43,8 @@ } static inline bool create_process(const char *cmd_line, HANDLE stdin_handle, - HANDLE stdout_handle, HANDLE stderr_handle, HANDLE *process) + HANDLE stdout_handle, HANDLE stderr_handle, + HANDLE *process) { PROCESS_INFORMATION pi = {0}; wchar_t *cmd_line_w = NULL; @@ -59,7 +60,8 @@ os_utf8_to_wcs_ptr(cmd_line, 0, &cmd_line_w); if (cmd_line_w) { success = !!CreateProcessW(NULL, cmd_line_w, NULL, NULL, true, - CREATE_NO_WINDOW, NULL, NULL, &si, &pi); + CREATE_NO_WINDOW, NULL, NULL, &si, + &pi); if (success) { *process = pi.hProcess; @@ -73,7 +75,7 @@ } os_process_pipe_t *os_process_pipe_create(const char *cmd_line, - const char *type) + const char *type) { os_process_pipe_t *pp = NULL; bool read_pipe; @@ -100,7 +102,7 @@ read_pipe = *type == 'r'; success = !!SetHandleInformation(read_pipe ? input : output, - HANDLE_FLAG_INHERIT, false); + HANDLE_FLAG_INHERIT, false); if (!success) { goto error; } @@ -111,7 +113,8 @@ } success = create_process(cmd_line, read_pipe ? NULL : input, - read_pipe ? output : NULL, err_output, &process); + read_pipe ? output : NULL, err_output, + &process); if (!success) { goto error; } @@ -174,7 +177,8 @@ return 0; } -size_t os_process_pipe_read_err(os_process_pipe_t *pp, uint8_t *data, size_t len) +size_t os_process_pipe_read_err(os_process_pipe_t *pp, uint8_t *data, + size_t len) { DWORD bytes_read; bool success; @@ -183,18 +187,18 @@ return 0; } - success = !!ReadFile(pp->handle_err, data, (DWORD)len, &bytes_read, NULL); + success = + !!ReadFile(pp->handle_err, data, (DWORD)len, &bytes_read, NULL); if (success && bytes_read) { return bytes_read; - } - else + } else bytes_read = GetLastError(); return 0; } size_t os_process_pipe_write(os_process_pipe_t *pp, const uint8_t *data, - size_t len) + size_t len) { DWORD bytes_written; bool success; @@ -206,8 +210,8 @@ return 0; } - success = !!WriteFile(pp->handle, data, (DWORD)len, &bytes_written, - NULL); + success = + !!WriteFile(pp->handle, data, (DWORD)len, &bytes_written, NULL); if (success && bytes_written) { return bytes_written; }
View file
obs-studio-23.2.1.tar.xz/libobs/util/pipe.h -> obs-studio-24.0.0.tar.xz/libobs/util/pipe.h
Changed
@@ -22,12 +22,12 @@ typedef struct os_process_pipe os_process_pipe_t; EXPORT os_process_pipe_t *os_process_pipe_create(const char *cmd_line, - const char *type); + const char *type); EXPORT int os_process_pipe_destroy(os_process_pipe_t *pp); EXPORT size_t os_process_pipe_read(os_process_pipe_t *pp, uint8_t *data, - size_t len); + size_t len); EXPORT size_t os_process_pipe_read_err(os_process_pipe_t *pp, uint8_t *data, - size_t len); + size_t len); EXPORT size_t os_process_pipe_write(os_process_pipe_t *pp, const uint8_t *data, - size_t len); + size_t len);
View file
obs-studio-23.2.1.tar.xz/libobs/util/platform-cocoa.m -> obs-studio-24.0.0.tar.xz/libobs/util/platform-cocoa.m
Changed
@@ -54,7 +54,8 @@ static uint64_t ns_time_full() { static double factor = 0.; - if (factor == 0.) factor = ns_time_compute_factor(); + if (factor == 0.) + factor = ns_time_compute_factor(); return (uint64_t)(mach_absolute_time() * factor); } @@ -72,18 +73,19 @@ uint64_t os_gettime_ns(void) { static time_func f = NULL; - if (!f) f = ns_time_select_func(); + if (!f) + f = ns_time_select_func(); return f(); } /* gets the location [domain mask]/Library/Application Support/[name] */ static int os_get_path_internal(char *dst, size_t size, const char *name, - NSSearchPathDomainMask domainMask) + NSSearchPathDomainMask domainMask) { NSArray *paths = NSSearchPathForDirectoriesInDomains( - NSApplicationSupportDirectory, domainMask, YES); + NSApplicationSupportDirectory, domainMask, YES); - if([paths count] == 0) + if ([paths count] == 0) bcrash("Could not get home directory (platform-cocoa)"); NSString *application_support = paths[0]; @@ -96,12 +98,12 @@ } static char *os_get_path_ptr_internal(const char *name, - NSSearchPathDomainMask domainMask) + NSSearchPathDomainMask domainMask) { NSArray *paths = NSSearchPathForDirectoriesInDomains( - NSApplicationSupportDirectory, domainMask, YES); + NSApplicationSupportDirectory, domainMask, YES); - if([paths count] == 0) + if ([paths count] == 0) bcrash("Could not get home directory (platform-cocoa)"); NSString *application_support = paths[0]; @@ -109,7 +111,7 @@ NSUInteger len = [application_support lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; - char *path_ptr = bmalloc(len+1); + char *path_ptr = bmalloc(len + 1); path_ptr[len] = 0; @@ -174,47 +176,47 @@ struct os_cpu_usage_info { int64_t last_cpu_time; int64_t last_sys_time; - int core_count; + int core_count; }; static inline void add_time_value(time_value_t *dst, time_value_t *a, - time_value_t *b) + time_value_t *b) { dst->microseconds = a->microseconds + b->microseconds; - dst->seconds = a->seconds + b->seconds; + dst->seconds = a->seconds + b->seconds; if (dst->microseconds >= 1000000) { - dst->seconds += dst->microseconds / 1000000; + dst->seconds += dst->microseconds / 1000000; dst->microseconds %= 1000000; } } static bool get_time_info(int64_t *cpu_time, int64_t *sys_time) { - mach_port_t task = mach_task_self(); + mach_port_t task = mach_task_self(); struct task_thread_times_info thread_data; - struct task_basic_info_64 task_data; - mach_msg_type_number_t count; - kern_return_t kern_ret; - time_value_t cur_time; + struct task_basic_info_64 task_data; + mach_msg_type_number_t count; + kern_return_t kern_ret; + time_value_t cur_time; *cpu_time = 0; *sys_time = 0; count = TASK_THREAD_TIMES_INFO_COUNT; kern_ret = task_info(task, TASK_THREAD_TIMES_INFO, - (task_info_t)&thread_data, &count); + (task_info_t)&thread_data, &count); if (kern_ret != KERN_SUCCESS) return false; count = TASK_BASIC_INFO_64_COUNT; - kern_ret = task_info(task, TASK_BASIC_INFO_64, - (task_info_t)&task_data, &count); + kern_ret = task_info(task, TASK_BASIC_INFO_64, (task_info_t)&task_data, + &count); if (kern_ret != KERN_SUCCESS) return false; add_time_value(&cur_time, &thread_data.user_time, - &thread_data.system_time); + &thread_data.system_time); add_time_value(&cur_time, &cur_time, &task_data.user_time); add_time_value(&cur_time, &cur_time, &task_data.system_time); @@ -238,7 +240,7 @@ double os_cpu_usage_info_query(os_cpu_usage_info_t *info) { - int64_t sys_time, cpu_time; + int64_t sys_time, cpu_time; int64_t sys_time_delta, cpu_time_delta; if (!info || !get_time_info(&cpu_time, &sys_time)) @@ -254,7 +256,7 @@ info->last_cpu_time = cpu_time; return (double)sys_time_delta * 100.0 / (double)cpu_time_delta / - (double)info->core_count; + (double)info->core_count; } void os_cpu_usage_info_destroy(os_cpu_usage_info_t *info) @@ -272,7 +274,7 @@ return nil; //taken from http://stackoverflow.com/a/20100906 - id activity = [pi beginActivityWithOptions:0x00FFFFFF + id activity = [pi beginActivityWithOptions:0x00FFFFFF reason:@(reason)]; return CFBridgingRetain(activity); @@ -302,11 +304,11 @@ { struct os_inhibit_info *info = bzalloc(sizeof(*info)); if (!reason) - info->reason = CFStringCreateWithCString(kCFAllocatorDefault, - reason, kCFStringEncodingUTF8); + info->reason = CFStringCreateWithCString( + kCFAllocatorDefault, reason, kCFStringEncodingUTF8); else - info->reason = CFStringCreateCopy(kCFAllocatorDefault, - CFSTR("")); + info->reason = + CFStringCreateCopy(kCFAllocatorDefault, CFSTR("")); return info; } @@ -321,12 +323,11 @@ return false; if (active) { - IOPMAssertionDeclareUserActivity(info->reason, - kIOPMUserActiveLocal, &info->user_id); + IOPMAssertionDeclareUserActivity( + info->reason, kIOPMUserActiveLocal, &info->user_id); success = IOPMAssertionCreateWithName( - kIOPMAssertionTypeNoDisplaySleep, - kIOPMAssertionLevelOn, info->reason, - &info->sleep_id); + kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, + info->reason, &info->sleep_id); if (success != kIOReturnSuccess) { blog(LOG_WARNING, "Failed to disable sleep"); @@ -361,16 +362,16 @@ core_count_initialized = true; size_t size; - int ret; + int ret; size = sizeof(physical_cores); - ret = sysctlbyname("machdep.cpu.core_count", &physical_cores, - &size, NULL, 0); + ret = sysctlbyname("machdep.cpu.core_count", &physical_cores, &size, + NULL, 0); if (ret != 0) return; - ret = sysctlbyname("machdep.cpu.thread_count", &logical_cores, - &size, NULL, 0); + ret = sysctlbyname("machdep.cpu.thread_count", &logical_cores, &size, + NULL, 0); } int os_get_physical_cores(void) @@ -390,8 +391,8 @@ static inline bool os_get_sys_memory_usage_internal(vm_statistics_t vmstat) { mach_msg_type_number_t out_count = HOST_VM_INFO_COUNT; - if (host_statistics(mach_host_self(), HOST_VM_INFO, - (host_info_t)vmstat, &out_count) != KERN_SUCCESS) + if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)vmstat, + &out_count) != KERN_SUCCESS) return false; return true; } @@ -409,8 +410,8 @@ typedef task_basic_info_data_t mach_task_basic_info_data_t; #endif -static inline bool os_get_proc_memory_usage_internal( - mach_task_basic_info_data_t *taskinfo) +static inline bool +os_get_proc_memory_usage_internal(mach_task_basic_info_data_t *taskinfo) { #ifdef MACH_TASK_BASIC_INFO const task_flavor_t flavor = MACH_TASK_BASIC_INFO; @@ -419,8 +420,8 @@ const task_flavor_t flavor = TASK_BASIC_INFO; mach_msg_type_number_t out_count = TASK_BASIC_INFO_COUNT; #endif - if (task_info(mach_task_self(), flavor, - (task_info_t)taskinfo, &out_count) != KERN_SUCCESS) + if (task_info(mach_task_self(), flavor, (task_info_t)taskinfo, + &out_count) != KERN_SUCCESS) return false; return true; } @@ -432,7 +433,7 @@ return false; usage->resident_size = taskinfo.resident_size; - usage->virtual_size = taskinfo.virtual_size; + usage->virtual_size = taskinfo.virtual_size; return true; } @@ -461,8 +462,8 @@ return NULL; // Try the quick way to obtain the buffer - const char *tmp_buffer = CFStringGetCStringPtr(cfstring, - cfstring_encoding); + const char *tmp_buffer = + CFStringGetCStringPtr(cfstring, cfstring_encoding); if (tmp_buffer != NULL) return bstrdup(tmp_buffer); @@ -486,8 +487,8 @@ } // Copy CFString in requested encoding to buffer - Boolean success = - CFStringGetCString(cfstring, buffer, max_size, cfstring_encoding); + Boolean success = CFStringGetCString(cfstring, buffer, max_size, + cfstring_encoding); if (!success) { bfree(buffer); @@ -500,15 +501,15 @@ * Returns true on success or false on failure. * In case of failure, the dstr capacity but not size is changed. */ -bool cfstr_copy_dstr(CFStringRef cfstring, - CFStringEncoding cfstring_encoding, struct dstr *str) +bool cfstr_copy_dstr(CFStringRef cfstring, CFStringEncoding cfstring_encoding, + struct dstr *str) { if (!cfstring) return false; // Try the quick way to obtain the buffer - const char *tmp_buffer = CFStringGetCStringPtr(cfstring, - cfstring_encoding); + const char *tmp_buffer = + CFStringGetCStringPtr(cfstring, cfstring_encoding); if (tmp_buffer != NULL) { dstr_copy(str, tmp_buffer); @@ -530,8 +531,8 @@ dstr_ensure_capacity(str, max_size); // Copy CFString in requested encoding to dstr buffer - Boolean success = CFStringGetCString( - cfstring, str->array, max_size, cfstring_encoding); + Boolean success = CFStringGetCString(cfstring, str->array, max_size, + cfstring_encoding); if (success) dstr_resize(str, max_size);
View file
obs-studio-23.2.1.tar.xz/libobs/util/platform-nix-dbus.c -> obs-studio-24.0.0.tar.xz/libobs/util/platform-nix-dbus.c
Changed
@@ -35,26 +35,30 @@ }; static const struct service_info services[] = { - [FREEDESKTOP_SS] = { - .name = "org.freedesktop.ScreenSaver", - .path = "/ScreenSaver", - .uninhibit = "UnInhibit", - }, - [FREEDESKTOP_PM] = { - .name = "org.freedesktop.PowerManagement.Inhibit", - .path = "/org/freedesktop/PowerManagement", - .uninhibit = "UnInhibit", - }, - [MATE_SM] = { - .name = "org.mate.SessionManager", - .path = "/org/mate/SessionManager", - .uninhibit = "Uninhibit", - }, - [GNOME_SM] = { - .name = "org.gnome.SessionManager", - .path = "/org/gnome/SessionManager", - .uninhibit = "Uninhibit", - }, + [FREEDESKTOP_SS] = + { + .name = "org.freedesktop.ScreenSaver", + .path = "/ScreenSaver", + .uninhibit = "UnInhibit", + }, + [FREEDESKTOP_PM] = + { + .name = "org.freedesktop.PowerManagement.Inhibit", + .path = "/org/freedesktop/PowerManagement", + .uninhibit = "UnInhibit", + }, + [MATE_SM] = + { + .name = "org.mate.SessionManager", + .path = "/org/mate/SessionManager", + .uninhibit = "Uninhibit", + }, + [GNOME_SM] = + { + .name = "org.gnome.SessionManager", + .path = "/org/gnome/SessionManager", + .uninhibit = "Uninhibit", + }, }; static const size_t num_services = @@ -92,7 +96,7 @@ info->c = dbus_bus_get_private(DBUS_BUS_SESSION, &err); if (!info->c) { blog(LOG_ERROR, "Could not create dbus connection: %s", - err.message); + err.message); bfree(info); return NULL; } @@ -105,7 +109,7 @@ if (dbus_bus_name_has_owner(info->c, service->name, NULL)) { blog(LOG_DEBUG, "Found dbus service: %s", - service->name); + service->name); info->service = service; info->type = (enum service_type)i; return info; @@ -117,7 +121,7 @@ } void dbus_inhibit_sleep(struct dbus_sleep_info *info, const char *reason, - bool active) + bool active) { DBusMessage *reply; const char *method; @@ -132,8 +136,9 @@ if (reply) { success = dbus_message_get_args(reply, NULL, - DBUS_TYPE_UINT32, &info->id, - DBUS_TYPE_INVALID); + DBUS_TYPE_UINT32, + &info->id, + DBUS_TYPE_INVALID); if (!success) info->id = 0; dbus_message_unref(reply); @@ -146,7 +151,8 @@ method = active ? "Inhibit" : info->service->uninhibit; reply = dbus_message_new_method_call(info->service->name, - info->service->path, info->service->name, method); + info->service->path, + info->service->name, method); if (reply == NULL) { blog(LOG_ERROR, "dbus_message_new_method_call failed"); return; @@ -162,31 +168,28 @@ switch (info->type) { case MATE_SM: case GNOME_SM: - success = dbus_message_append_args(reply, - DBUS_TYPE_STRING, &program, - DBUS_TYPE_UINT32, &xid, - DBUS_TYPE_STRING, &reason, - DBUS_TYPE_UINT32, &flags, - DBUS_TYPE_INVALID); + success = dbus_message_append_args( + reply, DBUS_TYPE_STRING, &program, + DBUS_TYPE_UINT32, &xid, DBUS_TYPE_STRING, + &reason, DBUS_TYPE_UINT32, &flags, + DBUS_TYPE_INVALID); break; default: - success = dbus_message_append_args(reply, - DBUS_TYPE_STRING, &program, - DBUS_TYPE_STRING, &reason, - DBUS_TYPE_INVALID); + success = dbus_message_append_args( + reply, DBUS_TYPE_STRING, &program, + DBUS_TYPE_STRING, &reason, DBUS_TYPE_INVALID); } if (success) { - success = dbus_connection_send_with_reply(info->c, - reply, &info->pending, -1); + success = dbus_connection_send_with_reply( + info->c, reply, &info->pending, -1); if (!success) info->pending = NULL; } } else { assert(info->id != 0); - success = dbus_message_append_args(reply, - DBUS_TYPE_UINT32, &info->id, - DBUS_TYPE_INVALID); + success = dbus_message_append_args( + reply, DBUS_TYPE_UINT32, &info->id, DBUS_TYPE_INVALID); if (success) success = dbus_connection_send(info->c, reply, NULL); if (!success)
View file
obs-studio-23.2.1.tar.xz/libobs/util/platform-nix.c -> obs-studio-24.0.0.tar.xz/libobs/util/platform-nix.c
Changed
@@ -73,8 +73,8 @@ void *res = dlopen(dylib_name.array, RTLD_LAZY); #endif if (!res) - blog(LOG_ERROR, "os_dlopen(%s->%s): %s\n", - path, dylib_name.array, dlerror()); + blog(LOG_ERROR, "os_dlopen(%s->%s): %s\n", path, + dylib_name.array, dlerror()); dstr_free(&dylib_name); return res; @@ -101,20 +101,20 @@ os_cpu_usage_info_t *os_cpu_usage_info_start(void) { struct os_cpu_usage_info *info = bmalloc(sizeof(*info)); - struct tms time_sample; + struct tms time_sample; - info->last_cpu_time = times(&time_sample); - info->last_sys_time = time_sample.tms_stime; + info->last_cpu_time = times(&time_sample); + info->last_sys_time = time_sample.tms_stime; info->last_user_time = time_sample.tms_utime; - info->core_count = sysconf(_SC_NPROCESSORS_ONLN); + info->core_count = sysconf(_SC_NPROCESSORS_ONLN); return info; } double os_cpu_usage_info_query(os_cpu_usage_info_t *info) { struct tms time_sample; - clock_t cur_cpu_time; - double percent; + clock_t cur_cpu_time; + double percent; if (!info) return 0.0; @@ -126,12 +126,12 @@ return 0.0; percent = (double)(time_sample.tms_stime - info->last_sys_time + - (time_sample.tms_utime - info->last_user_time)); + (time_sample.tms_utime - info->last_user_time)); percent /= (double)(cur_cpu_time - info->last_cpu_time); percent /= (double)info->core_count; - info->last_cpu_time = cur_cpu_time; - info->last_sys_time = time_sample.tms_stime; + info->last_cpu_time = cur_cpu_time; + info->last_sys_time = time_sample.tms_stime; info->last_user_time = time_sample.tms_utime; return percent * 100.0; @@ -156,8 +156,8 @@ struct timespec req, remain; memset(&req, 0, sizeof(req)); memset(&remain, 0, sizeof(remain)); - req.tv_sec = time_target/1000000000; - req.tv_nsec = time_target%1000000000; + req.tv_sec = time_target / 1000000000; + req.tv_nsec = time_target % 1000000000; while (nanosleep(&req, &remain)) { req = remain; @@ -169,7 +169,7 @@ void os_sleep_ms(uint32_t duration) { - usleep(duration*1000); + usleep(duration * 1000); } #if !defined(__APPLE__) @@ -178,7 +178,7 @@ { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return ((uint64_t) ts.tv_sec * 1000000000ULL + (uint64_t) ts.tv_nsec); + return ((uint64_t)ts.tv_sec * 1000000000ULL + (uint64_t)ts.tv_nsec); } /* should return $HOME/.[name], or when using XDG, @@ -263,7 +263,8 @@ char *os_get_program_data_path_ptr(const char *name) { - size_t len = snprintf(NULL, 0, "/usr/local/share/%s", !!name ? name : ""); + size_t len = + snprintf(NULL, 0, "/usr/local/share/%s", !!name ? name : ""); char *str = bmalloc(len + 1); snprintf(str, len + 1, "/usr/local/share/%s", !!name ? name : ""); str[len] = 0; @@ -332,23 +333,23 @@ } struct os_dir { - const char *path; - DIR *dir; - struct dirent *cur_dirent; + const char *path; + DIR *dir; + struct dirent *cur_dirent; struct os_dirent out; }; os_dir_t *os_opendir(const char *path) { struct os_dir *dir; - DIR *dir_val; + DIR *dir_val; dir_val = opendir(path); if (!dir_val) return NULL; dir = bzalloc(sizeof(struct os_dir)); - dir->dir = dir_val; + dir->dir = dir_val; dir->path = path; return dir; } @@ -367,7 +368,8 @@ { struct dstr file_path = {0}; - if (!dir) return NULL; + if (!dir) + return NULL; dir->cur_dirent = readdir(dir->dir); if (!dir->cur_dirent) @@ -442,7 +444,7 @@ void os_globfree(os_glob_t *pglob) { if (pglob) { - struct posix_glob_info *pgi = (struct posix_glob_info*)pglob; + struct posix_glob_info *pgi = (struct posix_glob_info *)pglob; globfree(&pgi->gl); bfree(pgi->base.gl_pathv); @@ -544,7 +546,7 @@ extern struct dbus_sleep_info *dbus_sleep_info_create(void); extern void dbus_inhibit_sleep(struct dbus_sleep_info *dbus, const char *sleep, - bool active); + bool active); extern void dbus_sleep_info_destroy(struct dbus_sleep_info *dbus); #endif @@ -575,8 +577,8 @@ posix_spawnattr_setsigmask(&info->attr, &set); sigaddset(&set, SIGPIPE); posix_spawnattr_setsigdefault(&info->attr, &set); - posix_spawnattr_setflags(&info->attr, - POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK); + posix_spawnattr_setflags(&info->attr, POSIX_SPAWN_SETSIGDEF | + POSIX_SPAWN_SETSIGMASK); info->reason = bstrdup(reason); return info; @@ -586,14 +588,15 @@ static void reset_screensaver(os_inhibit_t *info) { - char *argv[3] = {(char*)"xdg-screensaver", (char*)"reset", NULL}; + char *argv[3] = {(char *)"xdg-screensaver", (char *)"reset", NULL}; pid_t pid; - int err = posix_spawnp(&pid, "xdg-screensaver", NULL, &info->attr, - argv, environ); + int err = posix_spawnp(&pid, "xdg-screensaver", NULL, &info->attr, argv, + environ); if (err == 0) { int status; - while (waitpid(pid, &status, 0) == -1); + while (waitpid(pid, &status, 0) == -1) + ; } else { blog(LOG_WARNING, "Failed to create xdg-screensaver: %d", err); } @@ -628,10 +631,10 @@ if (active) { ret = pthread_create(&info->screensaver_thread, NULL, - &screensaver_thread, info); + &screensaver_thread, info); if (ret < 0) { blog(LOG_ERROR, "Failed to create screensaver " - "inhibitor thread"); + "inhibitor thread"); return false; } } else { @@ -714,8 +717,8 @@ continue; if (dstr_is_empty(&proc_phys_ids) || - (!dstr_is_empty(&proc_phys_ids) && - !dstr_find(&proc_phys_ids, proc_phys_id.array))) { + (!dstr_is_empty(&proc_phys_ids) && + !dstr_find(&proc_phys_ids, proc_phys_id.array))) { dstr_cat_dstr(&proc_phys_ids, &proc_phys_id); dstr_cat(&proc_phys_ids, " "); core_count += atoi(start); @@ -774,7 +777,7 @@ len = strcspn(core_count, " "); dstr_ncopy(&proc_cores, core_count, len); - FreeBSD_cores_cleanup: +FreeBSD_cores_cleanup: if (!dstr_is_empty(&proc_packages)) packages = atoi(proc_packages.array); if (!dstr_is_empty(&proc_cores)) @@ -814,8 +817,8 @@ { uint64_t mem_free = 0; size_t length = sizeof(mem_free); - if (sysctlbyname("vm.stats.vm.v_free_count", &mem_free, &length, - NULL, 0) < 0) + if (sysctlbyname("vm.stats.vm.v_free_count", &mem_free, &length, NULL, + 0) < 0) return 0; return mem_free; } @@ -824,8 +827,8 @@ { int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()}; size_t length = sizeof(*kinfo); - if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), kinfo, &length, - NULL, 0) < 0) + if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), kinfo, &length, NULL, 0) < + 0) return false; return true; } @@ -837,8 +840,8 @@ return false; usage->resident_size = - (uint64_t)kinfo.ki_rssize * sysconf(_SC_PAGESIZE); - usage->virtual_size = (uint64_t)kinfo.ki_size; + (uint64_t)kinfo.ki_rssize * sysconf(_SC_PAGESIZE); + usage->virtual_size = (uint64_t)kinfo.ki_size; return true; } @@ -858,10 +861,12 @@ return (uint64_t)kinfo.ki_size; } #else -uint64_t os_get_sys_free_size(void) {return 0;} - -typedef struct +uint64_t os_get_sys_free_size(void) { + return 0; +} + +typedef struct { unsigned long virtual_size; unsigned long resident_size; unsigned long share_pages; @@ -879,14 +884,9 @@ if (!f) return false; - if (fscanf(f, "%lu %lu %lu %lu %lu %lu %lu", - &statm->virtual_size, - &statm->resident_size, - &statm->share_pages, - &statm->text, - &statm->library, - &statm->data, - &statm->dirty_pages) != 7) { + if (fscanf(f, "%lu %lu %lu %lu %lu %lu %lu", &statm->virtual_size, + &statm->resident_size, &statm->share_pages, &statm->text, + &statm->library, &statm->data, &statm->dirty_pages) != 7) { fclose(f); return false; } @@ -902,7 +902,7 @@ return false; usage->resident_size = statm.resident_size; - usage->virtual_size = statm.virtual_size; + usage->virtual_size = statm.virtual_size; return true; }
View file
obs-studio-23.2.1.tar.xz/libobs/util/platform-windows.c -> obs-studio-24.0.0.tar.xz/libobs/util/platform-windows.c
Changed
@@ -101,20 +101,19 @@ char *message = NULL; FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS | - FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, error, - MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), - (LPSTR)&message, 0, NULL); + FORMAT_MESSAGE_IGNORE_INSERTS | + FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, error, + MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), + (LPSTR)&message, 0, NULL); - blog(LOG_INFO, "LoadLibrary failed for '%s': %s (%lu)", - path, message, error); + blog(LOG_INFO, "LoadLibrary failed for '%s': %s (%lu)", path, + message, error); if (message) LocalFree(message); } - return h_library; } @@ -122,7 +121,7 @@ { void *handle; - handle = (void*)GetProcAddress(module, func); + handle = (void *)GetProcAddress(module, func); return handle; } @@ -133,7 +132,7 @@ } union time_data { - FILETIME ft; + FILETIME ft; unsigned long long val; }; @@ -145,8 +144,8 @@ os_cpu_usage_info_t *os_cpu_usage_info_start(void) { struct os_cpu_usage_info *info = bzalloc(sizeof(*info)); - SYSTEM_INFO si; - FILETIME dummy; + SYSTEM_INFO si; + FILETIME dummy; GetSystemInfo(&si); GetSystemTimeAsFileTime(&info->last_time.ft); @@ -160,23 +159,23 @@ double os_cpu_usage_info_query(os_cpu_usage_info_t *info) { union time_data cur_time, cur_sys_time, cur_user_time; - FILETIME dummy; - double percent; + FILETIME dummy; + double percent; if (!info) return 0.0; GetSystemTimeAsFileTime(&cur_time.ft); - GetProcessTimes(GetCurrentProcess(), &dummy, &dummy, - &cur_sys_time.ft, &cur_user_time.ft); + GetProcessTimes(GetCurrentProcess(), &dummy, &dummy, &cur_sys_time.ft, + &cur_user_time.ft); percent = (double)(cur_sys_time.val - info->last_sys_time.val + - (cur_user_time.val - info->last_user_time.val)); + (cur_user_time.val - info->last_user_time.val)); percent /= (double)(cur_time.val - info->last_time.val); percent /= (double)info->core_count; - info->last_time.val = cur_time.val; - info->last_sys_time.val = cur_sys_time.val; + info->last_time.val = cur_time.val; + info->last_sys_time.val = cur_sys_time.val; info->last_user_time.val = cur_user_time.val; return percent * 100.0; @@ -196,9 +195,9 @@ if (t >= time_target) return false; - milliseconds = (uint32_t)((time_target - t)/1000000); + milliseconds = (uint32_t)((time_target - t) / 1000000); if (milliseconds > 1) - Sleep(milliseconds-1); + Sleep(milliseconds - 1); for (;;) { t = os_gettime_ns(); @@ -237,12 +236,11 @@ /* returns [folder]\[name] on windows */ static int os_get_path_internal(char *dst, size_t size, const char *name, - int folder) + int folder) { wchar_t path_utf16[MAX_PATH]; - SHGetFolderPathW(NULL, folder, NULL, SHGFP_TYPE_CURRENT, - path_utf16); + SHGetFolderPathW(NULL, folder, NULL, SHGFP_TYPE_CURRENT, path_utf16); if (os_wcs_to_utf8(path_utf16, 0, dst, size) != 0) { if (!name || !*name) { @@ -265,8 +263,7 @@ wchar_t path_utf16[MAX_PATH]; struct dstr path; - SHGetFolderPathW(NULL, folder, NULL, SHGFP_TYPE_CURRENT, - path_utf16); + SHGetFolderPathW(NULL, folder, NULL, SHGFP_TYPE_CURRENT, path_utf16); os_wcs_to_utf8_ptr(path_utf16, 0, &ptr); dstr_init_move_array(&path, ptr); @@ -369,19 +366,19 @@ } struct os_dir { - HANDLE handle; - WIN32_FIND_DATA wfd; - bool first; + HANDLE handle; + WIN32_FIND_DATA wfd; + bool first; struct os_dirent out; }; os_dir_t *os_opendir(const char *path) { - struct dstr path_str = {0}; - struct os_dir *dir = NULL; + struct dstr path_str = {0}; + struct os_dir *dir = NULL; WIN32_FIND_DATA wfd; - HANDLE handle; - wchar_t *w_path; + HANDLE handle; + wchar_t *w_path; dstr_copy(&path_str, path); dstr_cat(&path_str, "/*.*"); @@ -389,10 +386,10 @@ if (os_utf8_to_wcs_ptr(path_str.array, path_str.len, &w_path) > 0) { handle = FindFirstFileW(w_path, &wfd); if (handle != INVALID_HANDLE_VALUE) { - dir = bzalloc(sizeof(struct os_dir)); + dir = bzalloc(sizeof(struct os_dir)); dir->handle = handle; - dir->first = true; - dir->wfd = wfd; + dir->first = true; + dir->wfd = wfd; } bfree(w_path); @@ -421,7 +418,7 @@ } os_wcs_to_utf8(dir->wfd.cFileName, 0, dir->out.d_name, - sizeof(dir->out.d_name)); + sizeof(dir->out.d_name)); dir->out.directory = is_dir(&dir->wfd); @@ -438,15 +435,15 @@ int64_t os_get_free_space(const char *path) { - ULARGE_INTEGER remainingSpace; - char abs_path[512]; - wchar_t w_abs_path[512]; + ULARGE_INTEGER remainingSpace; + char abs_path[512]; + wchar_t w_abs_path[512]; if (os_get_abs_path(path, abs_path, 512) > 0) { if (os_utf8_to_wcs(abs_path, 0, w_abs_path, 512) > 0) { - BOOL success = GetDiskFreeSpaceExW(w_abs_path, - (PULARGE_INTEGER)&remainingSpace, - NULL, NULL); + BOOL success = GetDiskFreeSpaceExW( + w_abs_path, (PULARGE_INTEGER)&remainingSpace, + NULL, NULL); if (success) return (int64_t)remainingSpace.QuadPart; } @@ -456,7 +453,7 @@ } static void make_globent(struct os_globent *ent, WIN32_FIND_DATA *wfd, - const char *pattern) + const char *pattern) { struct dstr name = {0}; struct dstr path = {0}; @@ -480,10 +477,10 @@ int os_glob(const char *pattern, int flags, os_glob_t **pglob) { DARRAY(struct os_globent) files; - HANDLE handle; - WIN32_FIND_DATA wfd; - int ret = -1; - wchar_t *w_path; + HANDLE handle; + WIN32_FIND_DATA wfd; + int ret = -1; + wchar_t *w_path; da_init(files); @@ -567,8 +564,8 @@ bfree(path_utf16); if (!success) - return (GetLastError() == ERROR_ALREADY_EXISTS) ? - MKDIR_EXISTS : MKDIR_ERROR; + return (GetLastError() == ERROR_ALREADY_EXISTS) ? MKDIR_EXISTS + : MKDIR_ERROR; return MKDIR_SUCCESS; } @@ -587,7 +584,9 @@ } code = MoveFileExW(old_path_utf16, new_path_utf16, - MOVEFILE_REPLACE_EXISTING) ? 0 : -1; + MOVEFILE_REPLACE_EXISTING) + ? 0 + : -1; error: bfree(old_path_utf16); @@ -615,7 +614,8 @@ code = 0; } else if (GetLastError() == ERROR_FILE_NOT_FOUND) { code = MoveFileExW(wfrom, wtarget, MOVEFILE_REPLACE_EXISTING) - ? 0 : -1; + ? 0 + : -1; } fail: @@ -726,19 +726,12 @@ return ret; } -typedef DWORD (WINAPI *get_file_version_info_size_w_t)( - LPCWSTR module, - LPDWORD unused); -typedef BOOL (WINAPI *get_file_version_info_w_t)( - LPCWSTR module, - DWORD unused, - DWORD len, - LPVOID data); -typedef BOOL (WINAPI *ver_query_value_w_t)( - LPVOID data, - LPCWSTR subblock, - LPVOID *buf, - PUINT sizeout); +typedef DWORD(WINAPI *get_file_version_info_size_w_t)(LPCWSTR module, + LPDWORD unused); +typedef BOOL(WINAPI *get_file_version_info_w_t)(LPCWSTR module, DWORD unused, + DWORD len, LPVOID data); +typedef BOOL(WINAPI *ver_query_value_w_t)(LPVOID data, LPCWSTR subblock, + LPVOID *buf, PUINT sizeout); static get_file_version_info_size_w_t get_file_version_info_size = NULL; static get_file_version_info_w_t get_file_version_info = NULL; @@ -761,15 +754,15 @@ } } - get_file_version_info_size = (get_file_version_info_size_w_t) - GetProcAddress(ver, "GetFileVersionInfoSizeW"); - get_file_version_info = (get_file_version_info_w_t) - GetProcAddress(ver, "GetFileVersionInfoW"); - ver_query_value = (ver_query_value_w_t) - GetProcAddress(ver, "VerQueryValueW"); + get_file_version_info_size = + (get_file_version_info_size_w_t)GetProcAddress( + ver, "GetFileVersionInfoSizeW"); + get_file_version_info = (get_file_version_info_w_t)GetProcAddress( + ver, "GetFileVersionInfoW"); + ver_query_value = + (ver_query_value_w_t)GetProcAddress(ver, "VerQueryValueW"); - if (!get_file_version_info_size || - !get_file_version_info || + if (!get_file_version_info_size || !get_file_version_info || !ver_query_value) { blog(LOG_ERROR, "Failed to load windows version " "functions"); @@ -809,9 +802,10 @@ return false; } - success = ver_query_value(data, L"\\", (LPVOID*)&info, &len); + success = ver_query_value(data, L"\\", (LPVOID *)&info, &len); if (!success || !info || !len) { - blog(LOG_ERROR, "Failed to get %s version info value", utf8_lib); + blog(LOG_ERROR, "Failed to get %s version info value", + utf8_lib); bfree(data); return false; } @@ -836,7 +830,7 @@ } void get_reg_dword(HKEY hkey, LPCWSTR sub_key, LPCWSTR value_name, - struct reg_dword *info) + struct reg_dword *info) { struct reg_dword reg = {0}; HKEY key; @@ -854,7 +848,7 @@ reg.size = sizeof(reg.return_value); reg.status = RegQueryValueExW(key, value_name, NULL, NULL, - (LPBYTE)®.return_value, ®.size); + (LPBYTE)®.return_value, ®.size); RegCloseKey(key); @@ -876,22 +870,24 @@ got_version = true; if (ver.major == 10) { - HKEY key; - DWORD size, win10_revision; + HKEY key; + DWORD size, win10_revision; LSTATUS status; - status = RegOpenKeyW(HKEY_LOCAL_MACHINE, - WINVER_REG_KEY, &key); + status = RegOpenKeyW(HKEY_LOCAL_MACHINE, WINVER_REG_KEY, + &key); if (status != ERROR_SUCCESS) return; size = sizeof(win10_revision); status = RegQueryValueExW(key, L"UBR", NULL, NULL, - (LPBYTE)&win10_revision, &size); + (LPBYTE)&win10_revision, + &size); if (status == ERROR_SUCCESS) - ver.revis = (int)win10_revision > ver.revis ? - (int)win10_revision : ver.revis; + ver.revis = (int)win10_revision > ver.revis + ? (int)win10_revision + : ver.revis; RegCloseKey(key); } @@ -923,11 +919,9 @@ return false; if (active) { - SetThreadExecutionState( - ES_CONTINUOUS | - ES_SYSTEM_REQUIRED | - ES_AWAYMODE_REQUIRED | - ES_DISPLAY_REQUIRED); + SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | + ES_AWAYMODE_REQUIRED | + ES_DISPLAY_REQUIRED); } else { SetThreadExecutionState(ES_CONTINUOUS); } @@ -951,13 +945,13 @@ DWORD num_logical_cores(ULONG_PTR mask) { - DWORD left_shift = sizeof(ULONG_PTR) * 8 - 1; - DWORD bit_set_count = 0; - ULONG_PTR bit_test = (ULONG_PTR)1 << left_shift; + DWORD left_shift = sizeof(ULONG_PTR) * 8 - 1; + DWORD bit_set_count = 0; + ULONG_PTR bit_test = (ULONG_PTR)1 << left_shift; for (DWORD i = 0; i <= left_shift; ++i) { bit_set_count += ((mask & bit_test) ? 1 : 0); - bit_test /= 2; + bit_test /= 2; } return bit_set_count; @@ -1031,7 +1025,8 @@ return msex.ullAvailPhys; } -static inline bool os_get_proc_memory_usage_internal(PROCESS_MEMORY_COUNTERS *pmc) +static inline bool +os_get_proc_memory_usage_internal(PROCESS_MEMORY_COUNTERS *pmc) { if (!GetProcessMemoryInfo(GetCurrentProcess(), pmc, sizeof(*pmc))) return false; @@ -1045,7 +1040,7 @@ return false; usage->resident_size = pmc.WorkingSetSize; - usage->virtual_size = pmc.PagefileUsage; + usage->virtual_size = pmc.PagefileUsage; return true; }
View file
obs-studio-23.2.1.tar.xz/libobs/util/platform.c -> obs-studio-24.0.0.tar.xz/libobs/util/platform.c
Changed
@@ -145,7 +145,7 @@ *pstr = NULL; if (size > 0) { - char *mbstr = bmalloc(size+1); + char *mbstr = bmalloc(size + 1); fseek(file, 0, SEEK_SET); size = fread(mbstr, 1, size, file); @@ -192,7 +192,7 @@ if (size == 0) return 0; - utf8str = bmalloc(size+1); + utf8str = bmalloc(size + 1); fseek(file, offset, SEEK_SET); size = fread(utf8str, 1, size, file); @@ -256,7 +256,7 @@ } bool os_quick_write_utf8_file(const char *path, const char *str, size_t len, - bool marker) + bool marker) { FILE *f = os_fopen(path, "wb"); if (!f) @@ -282,8 +282,8 @@ } bool os_quick_write_utf8_file_safe(const char *path, const char *str, - size_t len, bool marker, const char *temp_ext, - const char *backup_ext) + size_t len, bool marker, + const char *temp_ext, const char *backup_ext) { struct dstr backup_path = {0}; struct dstr temp_path = {0}; @@ -291,7 +291,7 @@ if (!temp_ext || !*temp_ext) { blog(LOG_ERROR, "os_quick_write_utf8_file_safe: invalid " - "temporary extension specified"); + "temporary extension specified"); return false; } @@ -301,8 +301,10 @@ dstr_cat(&temp_path, temp_ext); if (!os_quick_write_utf8_file(temp_path.array, str, len, marker)) { - blog(LOG_ERROR, "os_quick_write_utf8_file_safe: failed to " - "write to %s", temp_path.array); + blog(LOG_ERROR, + "os_quick_write_utf8_file_safe: failed to " + "write to %s", + temp_path.array); goto cleanup; } @@ -324,7 +326,7 @@ int64_t os_get_file_size(const char *path) { - FILE* f = os_fopen(path, "rb"); + FILE *f = os_fopen(path, "rb"); if (!f) return -1; @@ -357,7 +359,7 @@ } size_t os_utf8_to_wcs(const char *str, size_t len, wchar_t *dst, - size_t dst_size) + size_t dst_size) { size_t in_len; size_t out_len; @@ -373,8 +375,8 @@ return 0; if (out_len) - out_len = utf8_to_wchar(str, in_len, - dst, out_len + 1, 0); + out_len = + utf8_to_wchar(str, in_len, dst, out_len + 1, 0); dst[out_len] = 0; } @@ -405,7 +407,7 @@ } size_t os_wcs_to_utf8(const wchar_t *str, size_t len, char *dst, - size_t dst_size) + size_t dst_size) { size_t in_len; size_t out_len; @@ -421,8 +423,8 @@ return 0; if (out_len) - out_len = wchar_to_utf8(str, in_len, - dst, out_len + 1, 0); + out_len = + wchar_to_utf8(str, in_len, dst, out_len + 1, 0); dst[out_len] = 0; } @@ -484,12 +486,12 @@ size_t os_utf8_to_mbs_ptr(const char *str, size_t len, char **pstr) { - char *dst = NULL; - size_t out_len = 0; + char *dst = NULL; + size_t out_len = 0; if (str) { wchar_t *wstr = NULL; - size_t wlen = os_utf8_to_wcs_ptr(str, len, &wstr); + size_t wlen = os_utf8_to_wcs_ptr(str, len, &wstr); out_len = os_wcs_to_mbs_ptr(wstr, wlen, &dst); bfree(wstr); } @@ -500,12 +502,12 @@ size_t os_mbs_to_utf8_ptr(const char *str, size_t len, char **pstr) { - char *dst = NULL; - size_t out_len = 0; + char *dst = NULL; + size_t out_len = 0; if (str) { wchar_t *wstr = NULL; - size_t wlen = os_mbs_to_wcs_ptr(str, len, &wstr); + size_t wlen = os_mbs_to_wcs_ptr(str, len, &wstr); out_len = os_wcs_to_utf8_ptr(wstr, wlen, &dst); bfree(wstr); } @@ -522,13 +524,13 @@ char *pos; point = localeconv()->decimal_point; - if(*point == '.') { + if (*point == '.') { /* No conversion needed */ return; } pos = strchr(str, '.'); - if(pos) + if (pos) *pos = *point; } @@ -538,13 +540,13 @@ char *pos; point = localeconv()->decimal_point; - if(*point == '.') { + if (*point == '.') { /* No conversion needed */ return; } pos = strchr(buffer, *point); - if(pos) + if (pos) *pos = '.'; } @@ -563,19 +565,19 @@ size_t length; ret = snprintf(dst, size, "%.17g", value); - if(ret < 0) + if (ret < 0) return -1; length = (size_t)ret; - if(length >= size) + if (length >= size) return -1; from_locale(dst); /* Make sure there's a dot or 'e' in the output. Otherwise a real is converted to an integer when decoding */ - if(strchr(dst, '.') == NULL && strchr(dst, 'e') == NULL) { - if(length + 3 >= size) { + if (strchr(dst, '.') == NULL && strchr(dst, 'e') == NULL) { + if (length + 3 >= size) { /* No space to append ".0" */ return -1; } @@ -588,17 +590,17 @@ /* Remove leading '+' from positive exponent. Also remove leading zeros from exponents (added by some printf() implementations) */ start = strchr(dst, 'e'); - if(start) { + if (start) { start++; end = start + 1; - if(*start == '-') + if (*start == '-') start++; - while(*end == '0') + while (*end == '0') end++; - if(end != start) { + if (end != start) { memmove(start, end, length - (size_t)(end - dst)); length -= (size_t)(end - start); } @@ -677,7 +679,7 @@ } static void replace_text(struct dstr *str, size_t pos, size_t len, - const char *new_text) + const char *new_text) { struct dstr front = {0}; struct dstr back = {0}; @@ -701,7 +703,7 @@ } char *os_generate_formatted_filename(const char *extension, bool space, - const char *format) + const char *format) { time_t now = time(0); struct tm *cur_time; @@ -709,30 +711,13 @@ const size_t spec_count = 23; static const char *spec[][2] = { - {"%CCYY", "%Y"}, - {"%YY", "%y"}, - {"%MM", "%m"}, - {"%DD", "%d"}, - {"%hh", "%H"}, - {"%mm", "%M"}, - {"%ss", "%S"}, - {"%%", "%%"}, - - {"%a", ""}, - {"%A", ""}, - {"%b", ""}, - {"%B", ""}, - {"%d", ""}, - {"%H", ""}, - {"%I", ""}, - {"%m", ""}, - {"%M", ""}, - {"%p", ""}, - {"%S", ""}, - {"%y", ""}, - {"%Y", ""}, - {"%z", ""}, - {"%Z", ""}, + {"%CCYY", "%Y"}, {"%YY", "%y"}, {"%MM", "%m"}, {"%DD", "%d"}, + {"%hh", "%H"}, {"%mm", "%M"}, {"%ss", "%S"}, {"%%", "%%"}, + + {"%a", ""}, {"%A", ""}, {"%b", ""}, {"%B", ""}, + {"%d", ""}, {"%H", ""}, {"%I", ""}, {"%m", ""}, + {"%M", ""}, {"%p", ""}, {"%S", ""}, {"%y", ""}, + {"%Y", ""}, {"%z", ""}, {"%Z", ""}, }; char convert[128] = {0}; @@ -751,11 +736,10 @@ if (astrcmp_n(cmp, spec[i][0], len) == 0) { if (strlen(spec[i][1])) strftime(convert, sizeof(convert), - spec[i][1], cur_time); + spec[i][1], cur_time); else strftime(convert, sizeof(convert), - spec[i][0], cur_time); - + spec[i][0], cur_time); dstr_copy(&c, convert); if (c.len && valid_string(c.array))
View file
obs-studio-23.2.1.tar.xz/libobs/util/platform.h -> obs-studio-24.0.0.tar.xz/libobs/util/platform.h
Changed
@@ -49,25 +49,26 @@ /* functions purely for convenience */ EXPORT char *os_quick_read_utf8_file(const char *path); EXPORT bool os_quick_write_utf8_file(const char *path, const char *str, - size_t len, bool marker); + size_t len, bool marker); EXPORT bool os_quick_write_utf8_file_safe(const char *path, const char *str, - size_t len, bool marker, const char *temp_ext, - const char *backup_ext); + size_t len, bool marker, + const char *temp_ext, + const char *backup_ext); EXPORT char *os_quick_read_mbs_file(const char *path); EXPORT bool os_quick_write_mbs_file(const char *path, const char *str, - size_t len); + size_t len); EXPORT int64_t os_get_file_size(const char *path); EXPORT int64_t os_get_free_space(const char *path); EXPORT size_t os_mbs_to_wcs(const char *str, size_t str_len, wchar_t *dst, - size_t dst_size); + size_t dst_size); EXPORT size_t os_utf8_to_wcs(const char *str, size_t len, wchar_t *dst, - size_t dst_size); + size_t dst_size); EXPORT size_t os_wcs_to_mbs(const wchar_t *str, size_t len, char *dst, - size_t dst_size); + size_t dst_size); EXPORT size_t os_wcs_to_utf8(const wchar_t *str, size_t len, char *dst, - size_t dst_size); + size_t dst_size); EXPORT size_t os_mbs_to_wcs_ptr(const char *str, size_t len, wchar_t **pstr); EXPORT size_t os_utf8_to_wcs_ptr(const char *str, size_t len, wchar_t **pstr); @@ -88,12 +89,12 @@ typedef struct os_cpu_usage_info os_cpu_usage_info_t; EXPORT os_cpu_usage_info_t *os_cpu_usage_info_start(void); -EXPORT double os_cpu_usage_info_query(os_cpu_usage_info_t *info); -EXPORT void os_cpu_usage_info_destroy(os_cpu_usage_info_t *info); +EXPORT double os_cpu_usage_info_query(os_cpu_usage_info_t *info); +EXPORT void os_cpu_usage_info_destroy(os_cpu_usage_info_t *info); typedef const void os_performance_token_t; EXPORT os_performance_token_t *os_request_high_performance(const char *reason); -EXPORT void os_end_high_performance(os_performance_token_t *); +EXPORT void os_end_high_performance(os_performance_token_t *); /** * Sleeps to a specific time (in nanoseconds). Doesn't have to be super @@ -138,7 +139,7 @@ }; struct os_glob_info { - size_t gl_pathc; + size_t gl_pathc; struct os_globent *gl_pathv; }; @@ -157,19 +158,19 @@ EXPORT uint64_t os_get_free_disk_space(const char *dir); -#define MKDIR_EXISTS 1 -#define MKDIR_SUCCESS 0 -#define MKDIR_ERROR -1 +#define MKDIR_EXISTS 1 +#define MKDIR_SUCCESS 0 +#define MKDIR_ERROR -1 EXPORT int os_mkdir(const char *path); EXPORT int os_mkdirs(const char *path); EXPORT int os_rename(const char *old_path, const char *new_path); EXPORT int os_copyfile(const char *file_in, const char *file_out); EXPORT int os_safe_replace(const char *target_path, const char *from_path, - const char *backup_path); + const char *backup_path); EXPORT char *os_generate_formatted_filename(const char *extension, bool space, - const char *format); + const char *format); struct os_inhibit_info; typedef struct os_inhibit_info os_inhibit_t; @@ -202,6 +203,7 @@ #endif #endif +/* clang-format off */ #ifdef __APPLE__ # define ARCH_BITS 64 #else @@ -219,6 +221,7 @@ # endif # endif #endif +/* clang-format on */ #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/util/profiler.c -> obs-studio-24.0.0.tar.xz/libobs/util/profiler.c
Changed
@@ -93,16 +93,16 @@ static inline void update_max_probes(profile_times_table *map, size_t val) { - map->max_probe_count = map->max_probe_count < val ? - val : map->max_probe_count; + map->max_probe_count = + map->max_probe_count < val ? val : map->max_probe_count; } static void migrate_old_entries(profile_times_table *map, bool limit_items); -static void grow_hashmap(profile_times_table *map, - uint64_t usec, uint64_t count); +static void grow_hashmap(profile_times_table *map, uint64_t usec, + uint64_t count); static void add_hashmap_entry(profile_times_table *map, uint64_t usec, - uint64_t count) + uint64_t count) { size_t probes = 1; @@ -127,14 +127,14 @@ if (entry->probes >= probes) continue; - if (map->occupied/(double)map->size > 0.7) { + if (map->occupied / (double)map->size > 0.7) { grow_hashmap(map, usec, count); return; } - size_t old_probes = entry->probes; - uint64_t old_count = entry->entry.count; - uint64_t old_usec = entry->entry.time_delta; + size_t old_probes = entry->probes; + uint64_t old_count = entry->entry.count; + uint64_t old_usec = entry->entry.time_delta; entry->probes = probes; entry->entry.count = count; @@ -143,8 +143,8 @@ update_max_probes(map, probes); probes = old_probes; - count = old_count; - usec = old_usec; + count = old_count; + usec = old_usec; start = usec % map->size; } @@ -182,24 +182,24 @@ continue; add_hashmap_entry(map, entry->entry.time_delta, - entry->entry.count); + entry->entry.count); map->old_occupied -= 1; } } -static void grow_hashmap(profile_times_table *map, - uint64_t usec, uint64_t count) +static void grow_hashmap(profile_times_table *map, uint64_t usec, + uint64_t count) { migrate_old_entries(map, false); - size_t old_size = map->size; + size_t old_size = map->size; size_t old_occupied = map->occupied; profile_times_table_entry *entries = map->entries; init_hashmap(map, (old_size * 2 < 16) ? 16 : (old_size * 2)); map->old_occupied = old_occupied; - map->old_entries = entries; + map->old_entries = entries; add_hashmap_entry(map, usec, count); } @@ -229,7 +229,7 @@ } static void merge_call(profile_entry *entry, profile_call *call, - profile_call *prev_call) + profile_call *prev_call) { const size_t num = call->children.num; for (size_t i = 0; i < num; i++) { @@ -240,7 +240,7 @@ if (entry->expected_time_between_calls != 0 && prev_call) { migrate_old_entries(&entry->times_between_calls, true); uint64_t usec = diff_ns_to_usec(prev_call->start_time, - call->start_time); + call->start_time); add_hashmap_entry(&entry->times_between_calls, usec, 1); } @@ -250,7 +250,7 @@ #ifdef TRACK_OVERHEAD migrate_old_entries(&entry->overhead, true); - usec = diff_ns_to_usec(call->overhead_start, call->start_time); + usec = diff_ns_to_usec(call->overhead_start, call->start_time); usec += diff_ns_to_usec(call->end_time, call->overhead_end); add_hashmap_entry(&entry->overhead, usec, 1); #endif @@ -324,7 +324,7 @@ } void profile_register_root(const char *name, - uint64_t expected_time_between_calls) + uint64_t expected_time_between_calls) { if (!lock_root()) return; @@ -349,8 +349,8 @@ profile_root_entry *r_entry = get_root_entry(context->name); - mutex = r_entry->mutex; - entry = r_entry->entry; + mutex = r_entry->mutex; + entry = r_entry->entry; prev_call = r_entry->prev_call; r_entry->prev_call = context; @@ -408,12 +408,13 @@ call->name = name; if (call->name != name) { - blog(LOG_ERROR, "Called profile end with mismatching name: " - "start(\"%s\"[%p]) <-> end(\"%s\"[%p])", - call->name, call->name, name, name); + blog(LOG_ERROR, + "Called profile end with mismatching name: " + "start(\"%s\"[%p]) <-> end(\"%s\"[%p])", + call->name, call->name, name, name); profile_call *parent = call->parent; - while (parent && parent->parent && parent->name != name) + while (parent && parent->parent && parent->name != name) parent = parent->parent; if (!parent || parent->name != name) @@ -440,14 +441,14 @@ static int profiler_time_entry_compare(const void *first, const void *second) { - int64_t diff = ((profiler_time_entry*)second)->time_delta - - ((profiler_time_entry*)first)->time_delta; + int64_t diff = ((profiler_time_entry *)second)->time_delta - + ((profiler_time_entry *)first)->time_delta; return diff < 0 ? -1 : (diff > 0 ? 1 : 0); } static uint64_t copy_map_to_array(profile_times_table *map, - profiler_time_entries_t *entry_buffer, - uint64_t *min_, uint64_t *max_) + profiler_time_entries_t *entry_buffer, + uint64_t *min_, uint64_t *max_) { migrate_old_entries(map, false); @@ -480,16 +481,18 @@ } typedef void (*profile_entry_print_func)(profiler_snapshot_entry_t *entry, - struct dstr *indent_buffer, struct dstr *output_buffer, - unsigned indent, uint64_t active, uint64_t parent_calls); + struct dstr *indent_buffer, + struct dstr *output_buffer, + unsigned indent, uint64_t active, + uint64_t parent_calls); /* UTF-8 characters */ #define VPIPE_RIGHT " \xe2\x94\xa3" -#define VPIPE " \xe2\x94\x83" -#define DOWN_RIGHT " \xe2\x94\x97" +#define VPIPE " \xe2\x94\x83" +#define DOWN_RIGHT " \xe2\x94\x97" static void make_indent_string(struct dstr *indent_buffer, unsigned indent, - uint64_t active) + uint64_t active) { indent_buffer->len = 0; @@ -505,15 +508,15 @@ fragment = last ? VPIPE_RIGHT : VPIPE; else fragment = last ? DOWN_RIGHT : " "; - + dstr_cat(indent_buffer, fragment); } } static void gather_stats(uint64_t expected_time_between_calls, - profiler_time_entries_t *entries, - uint64_t calls, uint64_t *percentile99, uint64_t *median, - double *percent_within_bounds) + profiler_time_entries_t *entries, uint64_t calls, + uint64_t *percentile99, uint64_t *median, + double *percent_within_bounds) { if (!entries->num) { *percentile99 = 0; @@ -559,8 +562,9 @@ #define G_MS "g\xC2\xA0ms" static void profile_print_entry(profiler_snapshot_entry_t *entry, - struct dstr *indent_buffer, struct dstr *output_buffer, - unsigned indent, uint64_t active, uint64_t parent_calls) + struct dstr *indent_buffer, + struct dstr *output_buffer, unsigned indent, + uint64_t active, uint64_t parent_calls) { uint64_t calls = entry->overall_count; uint64_t min_ = entry->min_time; @@ -568,28 +572,26 @@ uint64_t percentile99 = 0; uint64_t median = 0; double percent_within_bounds = 0.; - gather_stats(entry->expected_time_between_calls, - &entry->times, calls, - &percentile99, &median, &percent_within_bounds); + gather_stats(entry->expected_time_between_calls, &entry->times, calls, + &percentile99, &median, &percent_within_bounds); make_indent_string(indent_buffer, indent, active); if (min_ == max_) { - dstr_printf(output_buffer, "%s%s: %"G_MS, - indent_buffer->array, entry->name, - min_ / 1000.); + dstr_printf(output_buffer, "%s%s: %" G_MS, indent_buffer->array, + entry->name, min_ / 1000.); } else { - dstr_printf(output_buffer, "%s%s: min=%"G_MS", median=%"G_MS", " - "max=%"G_MS", 99th percentile=%"G_MS, - indent_buffer->array, entry->name, - min_ / 1000., median / 1000., max_ / 1000., - percentile99 / 1000.); + dstr_printf(output_buffer, + "%s%s: min=%" G_MS ", median=%" G_MS ", " + "max=%" G_MS ", 99th percentile=%" G_MS, + indent_buffer->array, entry->name, min_ / 1000., + median / 1000., max_ / 1000., percentile99 / 1000.); if (entry->expected_time_between_calls) { double expected_ms = entry->expected_time_between_calls / 1000.; - dstr_catf(output_buffer, ", %g%% below %"G_MS, - percent_within_bounds, expected_ms); + dstr_catf(output_buffer, ", %g%% below %" G_MS, + percent_within_bounds, expected_ms); } } @@ -597,7 +599,7 @@ double calls_per_parent = (double)calls / parent_calls; if (lround(calls_per_parent * 10) != 10) dstr_catf(output_buffer, ", %g calls per parent call", - calls_per_parent); + calls_per_parent); } blog(LOG_INFO, "%s", output_buffer->array); @@ -606,16 +608,16 @@ for (size_t i = 0; i < entry->children.num; i++) { if ((i + 1) == entry->children.num) active &= (1 << indent) - 1; - profile_print_entry(&entry->children.array[i], - indent_buffer, output_buffer, - indent + 1, active, calls); + profile_print_entry(&entry->children.array[i], indent_buffer, + output_buffer, indent + 1, active, calls); } } static void gather_stats_between(profiler_time_entries_t *entries, - uint64_t calls, uint64_t lower_bound, uint64_t upper_bound, - uint64_t min_, uint64_t max_, uint64_t *median, - double *percent, double *lower, double *higher) + uint64_t calls, uint64_t lower_bound, + uint64_t upper_bound, uint64_t min_, + uint64_t max_, uint64_t *median, + double *percent, double *lower, double *higher) { *median = 0; *percent = 0.; @@ -679,8 +681,10 @@ } static void profile_print_entry_expected(profiler_snapshot_entry_t *entry, - struct dstr *indent_buffer, struct dstr *output_buffer, - unsigned indent, uint64_t active, uint64_t parent_calls) + struct dstr *indent_buffer, + struct dstr *output_buffer, + unsigned indent, uint64_t active, + uint64_t parent_calls) { UNUSED_PARAMETER(parent_calls); @@ -696,33 +700,31 @@ double lower = 0.; double higher = 0.; gather_stats_between(&entry->times_between_calls, - entry->overall_between_calls_count, - (uint64_t)(expected_time * 0.98), - (uint64_t)(expected_time * 1.02 + 0.5), - min_, max_, - &median, &percent, &lower, &higher); + entry->overall_between_calls_count, + (uint64_t)(expected_time * 0.98), + (uint64_t)(expected_time * 1.02 + 0.5), min_, max_, + &median, &percent, &lower, &higher); make_indent_string(indent_buffer, indent, active); - blog(LOG_INFO, "%s%s: min=%"G_MS", median=%"G_MS", max=%"G_MS", %g%% " - "within ±2%% of %"G_MS" (%g%% lower, %g%% higher)", - indent_buffer->array, entry->name, - min_ / 1000., median / 1000., max_ / 1000., percent, - expected_time / 1000., - lower, higher); + blog(LOG_INFO, + "%s%s: min=%" G_MS ", median=%" G_MS ", max=%" G_MS ", %g%% " + "within ±2%% of %" G_MS " (%g%% lower, %g%% higher)", + indent_buffer->array, entry->name, min_ / 1000., median / 1000., + max_ / 1000., percent, expected_time / 1000., lower, higher); active |= (uint64_t)1 << indent; for (size_t i = 0; i < entry->children.num; i++) { if ((i + 1) == entry->children.num) active &= (1 << indent) - 1; profile_print_entry_expected(&entry->children.array[i], - indent_buffer, output_buffer, - indent + 1, active, 0); + indent_buffer, output_buffer, + indent + 1, active, 0); } } void profile_print_func(const char *intro, profile_entry_print_func print, - profiler_snapshot_t *snap) + profiler_snapshot_t *snap) { struct dstr indent_buffer = {0}; struct dstr output_buffer = {0}; @@ -733,8 +735,8 @@ blog(LOG_INFO, "%s", intro); for (size_t i = 0; i < snap->roots.num; i++) { - print(&snap->roots.array[i], - &indent_buffer, &output_buffer, 0, 0, 0); + print(&snap->roots.array[i], &indent_buffer, &output_buffer, 0, + 0, 0); } blog(LOG_INFO, "================================================="); @@ -748,13 +750,13 @@ void profiler_print(profiler_snapshot_t *snap) { profile_print_func("== Profiler Results =============================", - profile_print_entry, snap); + profile_print_entry, snap); } void profiler_print_time_between_calls(profiler_snapshot_t *snap) { profile_print_func("== Profiler Time Between Calls ==================", - profile_print_entry_expected, snap); + profile_print_entry_expected, snap); } static void free_call_children(profile_call *call) @@ -825,19 +827,18 @@ da_free(old_root_entries); } - /* ------------------------------------------------------------------------- */ /* Profiler name storage */ struct profiler_name_store { pthread_mutex_t mutex; - DARRAY(char*) names; + DARRAY(char *) names; }; profiler_name_store_t *profiler_name_store_create(void) { profiler_name_store_t *store = bzalloc(sizeof(profiler_name_store_t)); - + if (pthread_mutex_init(&store->mutex, NULL)) goto error; @@ -860,8 +861,8 @@ bfree(store); } -const char *profile_store_name(profiler_name_store_t *store, - const char *format, ...) +const char *profile_store_name(profiler_name_store_t *store, const char *format, + ...) { va_list args; va_start(args, format); @@ -881,44 +882,41 @@ return result; } - /* ------------------------------------------------------------------------- */ /* Profiler data access */ static void add_entry_to_snapshot(profile_entry *entry, - profiler_snapshot_entry_t *s_entry) + profiler_snapshot_entry_t *s_entry) { s_entry->name = entry->name; - s_entry->overall_count = copy_map_to_array(&entry->times, - &s_entry->times, - &s_entry->min_time, &s_entry->max_time); + s_entry->overall_count = + copy_map_to_array(&entry->times, &s_entry->times, + &s_entry->min_time, &s_entry->max_time); - if ((s_entry->expected_time_between_calls = - entry->expected_time_between_calls)) + if ((s_entry->expected_time_between_calls = + entry->expected_time_between_calls)) s_entry->overall_between_calls_count = copy_map_to_array(&entry->times_between_calls, - &s_entry->times_between_calls, - &s_entry->min_time_between_calls, - &s_entry->max_time_between_calls); + &s_entry->times_between_calls, + &s_entry->min_time_between_calls, + &s_entry->max_time_between_calls); da_reserve(s_entry->children, entry->children.num); for (size_t i = 0; i < entry->children.num; i++) add_entry_to_snapshot(&entry->children.array[i], - da_push_back_new(s_entry->children)); + da_push_back_new(s_entry->children)); } static void sort_snapshot_entry(profiler_snapshot_entry_t *entry) { - qsort(entry->times.array, entry->times.num, - sizeof(profiler_time_entry), - profiler_time_entry_compare); + qsort(entry->times.array, entry->times.num, sizeof(profiler_time_entry), + profiler_time_entry_compare); if (entry->expected_time_between_calls) qsort(entry->times_between_calls.array, - entry->times_between_calls.num, - sizeof(profiler_time_entry), - profiler_time_entry_compare); + entry->times_between_calls.num, + sizeof(profiler_time_entry), profiler_time_entry_compare); for (size_t i = 0; i < entry->children.num; i++) sort_snapshot_entry(&entry->children.array[i]); @@ -933,7 +931,7 @@ for (size_t i = 0; i < root_entries.num; i++) { pthread_mutex_lock(root_entries.array[i].mutex); add_entry_to_snapshot(root_entries.array[i].entry, - da_push_back_new(snap->roots)); + da_push_back_new(snap->roots)); pthread_mutex_unlock(root_entries.array[i].mutex); } pthread_mutex_unlock(&root_mutex); @@ -968,48 +966,50 @@ typedef void (*dump_csv_func)(void *data, struct dstr *buffer); static void entry_dump_csv(struct dstr *buffer, - const profiler_snapshot_entry_t *parent, - const profiler_snapshot_entry_t *entry, - dump_csv_func func, void *data) + const profiler_snapshot_entry_t *parent, + const profiler_snapshot_entry_t *entry, + dump_csv_func func, void *data) { const char *parent_name = parent ? parent->name : NULL; for (size_t i = 0; i < entry->times.num; i++) { - dstr_printf(buffer, "%p,%p,%p,%p,%s,0," - "%"PRIu64",%"PRIu64"\n", entry, - parent, entry->name, parent_name, entry->name, - entry->times.array[i].time_delta, - entry->times.array[i].count); + dstr_printf(buffer, + "%p,%p,%p,%p,%s,0," + "%" PRIu64 ",%" PRIu64 "\n", + entry, parent, entry->name, parent_name, + entry->name, entry->times.array[i].time_delta, + entry->times.array[i].count); func(data, buffer); } for (size_t i = 0; i < entry->times_between_calls.num; i++) { - dstr_printf(buffer,"%p,%p,%p,%p,%s," - "%"PRIu64",%"PRIu64",%"PRIu64"\n", entry, - parent, entry->name, parent_name, entry->name, - entry->expected_time_between_calls, - entry->times_between_calls.array[i].time_delta, - entry->times_between_calls.array[i].count); + dstr_printf(buffer, + "%p,%p,%p,%p,%s," + "%" PRIu64 ",%" PRIu64 ",%" PRIu64 "\n", + entry, parent, entry->name, parent_name, + entry->name, entry->expected_time_between_calls, + entry->times_between_calls.array[i].time_delta, + entry->times_between_calls.array[i].count); func(data, buffer); } for (size_t i = 0; i < entry->children.num; i++) - entry_dump_csv(buffer, entry, &entry->children.array[i], - func, data); + entry_dump_csv(buffer, entry, &entry->children.array[i], func, + data); } static void profiler_snapshot_dump(const profiler_snapshot_t *snap, - dump_csv_func func, void *data) + dump_csv_func func, void *data) { struct dstr buffer = {0}; dstr_init_copy(&buffer, "id,parent_id,name_id,parent_name_id,name," - "time_between_calls,time_delta_µs,count\n"); + "time_between_calls,time_delta_µs,count\n"); func(data, &buffer); for (size_t i = 0; i < snap->roots.num; i++) - entry_dump_csv(&buffer, NULL, - &snap->roots.array[i], func, data); + entry_dump_csv(&buffer, NULL, &snap->roots.array[i], func, + data); dstr_free(&buffer); } @@ -1020,7 +1020,7 @@ } bool profiler_snapshot_dump_csv(const profiler_snapshot_t *snap, - const char *filename) + const char *filename) { FILE *f = os_fopen(filename, "wb+"); if (!f) @@ -1038,7 +1038,7 @@ } bool profiler_snapshot_dump_csv_gz(const profiler_snapshot_t *snap, - const char *filename) + const char *filename) { gzFile gz; #ifdef _WIN32 @@ -1068,7 +1068,8 @@ } void profiler_snapshot_enumerate_roots(profiler_snapshot_t *snap, - profiler_entry_enum_func func, void *context) + profiler_entry_enum_func func, + void *context) { if (!snap) return; @@ -1079,7 +1080,7 @@ } void profiler_snapshot_filter_roots(profiler_snapshot_t *snap, - profiler_name_filter_func func, void *data) + profiler_name_filter_func func, void *data) { for (size_t i = 0; i < snap->roots.num;) { bool remove = false; @@ -1104,7 +1105,8 @@ } void profiler_snapshot_enumerate_children(profiler_snapshot_entry_t *entry, - profiler_entry_enum_func func, void *context) + profiler_entry_enum_func func, + void *context) { if (!entry) return; @@ -1119,14 +1121,13 @@ return entry ? entry->name : NULL; } -profiler_time_entries_t *profiler_snapshot_entry_times( - profiler_snapshot_entry_t *entry) +profiler_time_entries_t * +profiler_snapshot_entry_times(profiler_snapshot_entry_t *entry) { return entry ? &entry->times : NULL; } -uint64_t profiler_snapshot_entry_overall_count( - profiler_snapshot_entry_t *entry) +uint64_t profiler_snapshot_entry_overall_count(profiler_snapshot_entry_t *entry) { return entry ? entry->overall_count : 0; } @@ -1141,32 +1142,32 @@ return entry ? entry->max_time : 0; } -profiler_time_entries_t *profiler_snapshot_entry_times_between_calls( - profiler_snapshot_entry_t *entry) +profiler_time_entries_t * +profiler_snapshot_entry_times_between_calls(profiler_snapshot_entry_t *entry) { return entry ? &entry->times_between_calls : NULL; } uint64_t profiler_snapshot_entry_expected_time_between_calls( - profiler_snapshot_entry_t *entry) + profiler_snapshot_entry_t *entry) { return entry ? entry->expected_time_between_calls : 0; } -uint64_t profiler_snapshot_entry_min_time_between_calls( - profiler_snapshot_entry_t *entry) +uint64_t +profiler_snapshot_entry_min_time_between_calls(profiler_snapshot_entry_t *entry) { return entry ? entry->min_time_between_calls : 0; } -uint64_t profiler_snapshot_entry_max_time_between_calls( - profiler_snapshot_entry_t *entry) +uint64_t +profiler_snapshot_entry_max_time_between_calls(profiler_snapshot_entry_t *entry) { return entry ? entry->max_time_between_calls : 0; } uint64_t profiler_snapshot_entry_overall_between_calls_count( - profiler_snapshot_entry_t *entry) + profiler_snapshot_entry_t *entry) { return entry ? entry->overall_between_calls_count : 0; }
View file
obs-studio-23.2.1.tar.xz/libobs/util/profiler.h -> obs-studio-24.0.0.tar.xz/libobs/util/profiler.h
Changed
@@ -15,7 +15,7 @@ /* Profiling */ EXPORT void profile_register_root(const char *name, - uint64_t expected_time_between_calls); + uint64_t expected_time_between_calls); EXPORT void profile_start(const char *name); EXPORT void profile_end(const char *name); @@ -49,7 +49,7 @@ PRINTFATTR(2, 3) EXPORT const char *profile_store_name(profiler_name_store_t *store, - const char *format, ...); + const char *format, ...); #undef PRINTFATTR @@ -64,52 +64,55 @@ typedef DARRAY(profiler_time_entry_t) profiler_time_entries_t; typedef bool (*profiler_entry_enum_func)(void *context, - profiler_snapshot_entry_t *entry); + profiler_snapshot_entry_t *entry); EXPORT profiler_snapshot_t *profile_snapshot_create(void); EXPORT void profile_snapshot_free(profiler_snapshot_t *snap); EXPORT bool profiler_snapshot_dump_csv(const profiler_snapshot_t *snap, - const char *filename); + const char *filename); EXPORT bool profiler_snapshot_dump_csv_gz(const profiler_snapshot_t *snap, - const char *filename); + const char *filename); EXPORT size_t profiler_snapshot_num_roots(profiler_snapshot_t *snap); EXPORT void profiler_snapshot_enumerate_roots(profiler_snapshot_t *snap, - profiler_entry_enum_func func, void *context); + profiler_entry_enum_func func, + void *context); typedef bool (*profiler_name_filter_func)(void *data, const char *name, - bool *remove); + bool *remove); EXPORT void profiler_snapshot_filter_roots(profiler_snapshot_t *snap, - profiler_name_filter_func func, void *data); + profiler_name_filter_func func, + void *data); EXPORT size_t profiler_snapshot_num_children(profiler_snapshot_entry_t *entry); -EXPORT void profiler_snapshot_enumerate_children( - profiler_snapshot_entry_t *entry, - profiler_entry_enum_func func, void *context); - -EXPORT const char *profiler_snapshot_entry_name( - profiler_snapshot_entry_t *entry); - -EXPORT profiler_time_entries_t *profiler_snapshot_entry_times( - profiler_snapshot_entry_t *entry); -EXPORT uint64_t profiler_snapshot_entry_min_time( - profiler_snapshot_entry_t *entry); -EXPORT uint64_t profiler_snapshot_entry_max_time( - profiler_snapshot_entry_t *entry); -EXPORT uint64_t profiler_snapshot_entry_overall_count( - profiler_snapshot_entry_t *entry); - -EXPORT profiler_time_entries_t *profiler_snapshot_entry_times_between_calls( - profiler_snapshot_entry_t *entry); +EXPORT void +profiler_snapshot_enumerate_children(profiler_snapshot_entry_t *entry, + profiler_entry_enum_func func, + void *context); + +EXPORT const char * +profiler_snapshot_entry_name(profiler_snapshot_entry_t *entry); + +EXPORT profiler_time_entries_t * +profiler_snapshot_entry_times(profiler_snapshot_entry_t *entry); +EXPORT uint64_t +profiler_snapshot_entry_min_time(profiler_snapshot_entry_t *entry); +EXPORT uint64_t +profiler_snapshot_entry_max_time(profiler_snapshot_entry_t *entry); +EXPORT uint64_t +profiler_snapshot_entry_overall_count(profiler_snapshot_entry_t *entry); + +EXPORT profiler_time_entries_t * +profiler_snapshot_entry_times_between_calls(profiler_snapshot_entry_t *entry); EXPORT uint64_t profiler_snapshot_entry_expected_time_between_calls( - profiler_snapshot_entry_t *entry); + profiler_snapshot_entry_t *entry); EXPORT uint64_t profiler_snapshot_entry_min_time_between_calls( - profiler_snapshot_entry_t *entry); + profiler_snapshot_entry_t *entry); EXPORT uint64_t profiler_snapshot_entry_max_time_between_calls( - profiler_snapshot_entry_t *entry); + profiler_snapshot_entry_t *entry); EXPORT uint64_t profiler_snapshot_entry_overall_between_calls_count( - profiler_snapshot_entry_t *entry); + profiler_snapshot_entry_t *entry); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/util/profiler.hpp -> obs-studio-24.0.0.tar.xz/libobs/util/profiler.hpp
Changed
@@ -6,18 +6,13 @@ const char *name; bool enabled = true; - ScopeProfiler(const char *name) - : name(name) - { - profile_start(name); - } + ScopeProfiler(const char *name) : name(name) { profile_start(name); } ~ScopeProfiler() { Stop(); } ScopeProfiler(const ScopeProfiler &) = delete; ScopeProfiler(ScopeProfiler &&other) - : name(other.name), - enabled(other.enabled) + : name(other.name), enabled(other.enabled) { other.enabled = false; } @@ -37,7 +32,7 @@ #ifndef NO_PROFILER_MACROS -#define ScopeProfiler_NameConcatImpl(x, y) x ## y +#define ScopeProfiler_NameConcatImpl(x, y) x##y #define ScopeProfiler_NameConcat(x, y) ScopeProfiler_NameConcatImpl(x, y) #ifdef __COUNTER__ @@ -46,7 +41,7 @@ #define ScopeProfiler_Name(x) ScopeProfiler_NameConcat(x, __LINE__) #endif -#define ProfileScope(x) ScopeProfiler \ - ScopeProfiler_Name(SCOPE_PROFILE){x} +#define ProfileScope(x) \ + ScopeProfiler ScopeProfiler_Name(SCOPE_PROFILE) { x } #endif
View file
obs-studio-23.2.1.tar.xz/libobs/util/serializer.h -> obs-studio-24.0.0.tar.xz/libobs/util/serializer.h
Changed
@@ -34,26 +34,26 @@ }; struct serializer { - void *data; + void *data; - size_t (*read)(void *, void *, size_t); - size_t (*write)(void *, const void *, size_t); - int64_t (*seek)(void *, int64_t, enum serialize_seek_type); - int64_t (*get_pos)(void *); + size_t (*read)(void *, void *, size_t); + size_t (*write)(void *, const void *, size_t); + int64_t (*seek)(void *, int64_t, enum serialize_seek_type); + int64_t (*get_pos)(void *); }; static inline size_t s_read(struct serializer *s, void *data, size_t size) { if (s && s->read && data && size) - return s->read(s->data, (void*)data, size); + return s->read(s->data, (void *)data, size); return 0; } static inline size_t s_write(struct serializer *s, const void *data, - size_t size) + size_t size) { if (s && s->write && data && size) - return s->write(s->data, (void*)data, size); + return s->write(s->data, (void *)data, size); return 0; } @@ -70,7 +70,7 @@ } static inline int64_t serializer_seek(struct serializer *s, int64_t offset, - enum serialize_seek_type seek_type) + enum serialize_seek_type seek_type) { if (s && s->seek) return s->seek(s->data, offset, seek_type); @@ -99,7 +99,7 @@ static inline void s_wl24(struct serializer *s, uint32_t u24) { - s_w8 (s, (uint8_t)u24); + s_w8(s, (uint8_t)u24); s_wl16(s, (uint16_t)(u24 >> 8)); } @@ -117,12 +117,12 @@ static inline void s_wlf(struct serializer *s, float f) { - s_wl32(s, *(uint32_t*)&f); + s_wl32(s, *(uint32_t *)&f); } static inline void s_wld(struct serializer *s, double d) { - s_wl64(s, *(uint64_t*)&d); + s_wl64(s, *(uint64_t *)&d); } static inline void s_wb16(struct serializer *s, uint16_t u16) @@ -134,7 +134,7 @@ static inline void s_wb24(struct serializer *s, uint32_t u24) { s_wb16(s, (uint16_t)(u24 >> 8)); - s_w8 (s, (uint8_t)u24); + s_w8(s, (uint8_t)u24); } static inline void s_wb32(struct serializer *s, uint32_t u32) @@ -151,12 +151,12 @@ static inline void s_wbf(struct serializer *s, float f) { - s_wb32(s, *(uint32_t*)&f); + s_wb32(s, *(uint32_t *)&f); } static inline void s_wbd(struct serializer *s, double d) { - s_wb64(s, *(uint64_t*)&d); + s_wb64(s, *(uint64_t *)&d); } #ifdef __cplusplus
View file
obs-studio-23.2.1.tar.xz/libobs/util/text-lookup.c -> obs-studio-24.0.0.tar.xz/libobs/util/text-lookup.c
Changed
@@ -81,7 +81,7 @@ } static struct text_node *text_node_byname(struct text_node *node, - const char *name) + const char *name) { struct text_node *subnode = node->first_subnode; @@ -102,8 +102,8 @@ struct text_node *top; }; -static void lookup_createsubnode(const char *lookup_val, - struct text_leaf *leaf, struct text_node *node) +static void lookup_createsubnode(const char *lookup_val, struct text_leaf *leaf, + struct text_node *node) { struct text_node *new = bzalloc(sizeof(struct text_node)); new->leaf = leaf; @@ -114,11 +114,11 @@ } static void lookup_splitnode(const char *lookup_val, size_t len, - struct text_leaf *leaf, struct text_node *node) + struct text_leaf *leaf, struct text_node *node) { struct text_node *split = bzalloc(sizeof(struct text_node)); - dstr_copy(&split->str, node->str.array+len); + dstr_copy(&split->str, node->str.array + len); split->leaf = node->leaf; split->first_subnode = node->first_subnode; node->first_subnode = split; @@ -127,21 +127,21 @@ if (lookup_val[len] != 0) { node->leaf = NULL; - lookup_createsubnode(lookup_val+len, leaf, node); + lookup_createsubnode(lookup_val + len, leaf, node); } else { node->leaf = leaf; } } static inline void lookup_replaceleaf(struct text_node *node, - struct text_leaf *leaf) + struct text_leaf *leaf) { text_leaf_destroy(node->leaf); node->leaf = leaf; } static void lookup_addstring(const char *lookup_val, struct text_leaf *leaf, - struct text_node *node) + struct text_node *node) { struct text_node *child; @@ -157,7 +157,7 @@ for (len = 0; len < child->str.len; len++) { char val1 = child->str.array[len], - val2 = lookup_val[len]; + val2 = lookup_val[len]; if (val1 >= 'A' && val1 <= 'Z') val1 += 0x20; @@ -169,7 +169,7 @@ } if (len == child->str.len) { - lookup_addstring(lookup_val+len, leaf, child); + lookup_addstring(lookup_val + len, leaf, child); return; } else { lookup_splitnode(lookup_val, len, leaf, child); @@ -182,7 +182,7 @@ static void lookup_getstringtoken(struct lexer *lex, struct strref *token) { const char *temp = lex->offset; - bool was_backslash = false; + bool was_backslash = false; while (*temp != 0 && *temp != '\n') { if (!was_backslash) { @@ -205,7 +205,7 @@ token->array++; token->len--; - if (*(temp-1) == '"') + if (*(temp - 1) == '"') token->len--; } @@ -225,7 +225,7 @@ if (!str->array) { /* comments are designated with a #, and end at LF */ if (ch == '#') { - while(ch != '\n' && ch != 0) + while (ch != '\n' && ch != 0) ch = *(++lex->offset); } else if (temp.type == BASETOKEN_WHITESPACE) { strref_copy(str, &temp.text); @@ -280,9 +280,9 @@ static char *convert_string(const char *str, size_t len) { struct dstr out; - out.array = bstrdup_n(str, len); - out.capacity = len+1; - out.len = len; + out.array = bstrdup_n(str, len); + out.capacity = len + 1; + out.len = len; dstr_replace(&out, "\\n", "\n"); dstr_replace(&out, "\\t", "\t"); @@ -293,7 +293,7 @@ } static void lookup_addfiledata(struct text_lookup *lookup, - const char *file_data) + const char *file_data) { struct lexer lex; struct strref name, value; @@ -309,7 +309,7 @@ if (*name.array == '\n') continue; -getval: + getval: if (!lookup_gettoken(&lex, &value)) break; if (*value.array == '\n') @@ -320,8 +320,8 @@ } leaf = bmalloc(sizeof(struct text_leaf)); - leaf->lookup = bstrdup_n(name.array, name.len); - leaf->value = convert_string(value.array, value.len); + leaf->lookup = bstrdup_n(name.array, name.len); + leaf->value = convert_string(value.array, value.len); lookup_addstring(leaf->lookup, leaf, lookup->top); @@ -332,8 +332,8 @@ lexer_free(&lex); } -static inline bool lookup_getstring(const char *lookup_val, - const char **out, struct text_node *node) +static inline bool lookup_getstring(const char *lookup_val, const char **out, + struct text_node *node) { struct text_node *child; char ch; @@ -409,7 +409,7 @@ } bool text_lookup_getstr(lookup_t *lookup, const char *lookup_val, - const char **out) + const char **out) { if (lookup) return lookup_getstring(lookup_val, out, lookup->top);
View file
obs-studio-23.2.1.tar.xz/libobs/util/text-lookup.h -> obs-studio-24.0.0.tar.xz/libobs/util/text-lookup.h
Changed
@@ -39,7 +39,7 @@ EXPORT bool text_lookup_add(lookup_t *lookup, const char *path); EXPORT void text_lookup_destroy(lookup_t *lookup); EXPORT bool text_lookup_getstr(lookup_t *lookup, const char *lookup_val, - const char **out); + const char **out); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/util/threading-posix.c -> obs-studio-24.0.0.tar.xz/libobs/util/threading-posix.c
Changed
@@ -35,9 +35,9 @@ struct os_event_data { pthread_mutex_t mutex; - pthread_cond_t cond; - volatile bool signalled; - bool manual; + pthread_cond_t cond; + volatile bool signalled; + bool manual; }; int os_event_init(os_event_t **event, enum os_event_type type) @@ -89,11 +89,10 @@ return code; } -static inline void add_ms_to_ts(struct timespec *ts, - unsigned long milliseconds) +static inline void add_ms_to_ts(struct timespec *ts, unsigned long milliseconds) { - ts->tv_sec += milliseconds/1000; - ts->tv_nsec += (milliseconds%1000)*1000000; + ts->tv_sec += milliseconds / 1000; + ts->tv_nsec += (milliseconds % 1000) * 1000000; if (ts->tv_nsec > 1000000000) { ts->tv_sec += 1; ts->tv_nsec -= 1000000000; @@ -109,7 +108,7 @@ #if defined(__APPLE__) || defined(__MINGW32__) struct timeval tv; gettimeofday(&tv, NULL); - ts.tv_sec = tv.tv_sec; + ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000; #else clock_gettime(CLOCK_REALTIME, &ts); @@ -166,13 +165,13 @@ struct os_sem_data { semaphore_t sem; - task_t task; + task_t task; }; -int os_sem_init(os_sem_t **sem, int value) +int os_sem_init(os_sem_t **sem, int value) { semaphore_t new_sem; - task_t task = mach_task_self(); + task_t task = mach_task_self(); if (semaphore_create(task, &new_sem, 0, value) != KERN_SUCCESS) return -1; @@ -181,7 +180,7 @@ if (!*sem) return -2; - (*sem)->sem = new_sem; + (*sem)->sem = new_sem; (*sem)->task = task; return 0; } @@ -194,15 +193,17 @@ } } -int os_sem_post(os_sem_t *sem) +int os_sem_post(os_sem_t *sem) { - if (!sem) return -1; + if (!sem) + return -1; return (semaphore_signal(sem->sem) == KERN_SUCCESS) ? 0 : -1; } -int os_sem_wait(os_sem_t *sem) +int os_sem_wait(os_sem_t *sem) { - if (!sem) return -1; + if (!sem) + return -1; return (semaphore_wait(sem->sem) == KERN_SUCCESS) ? 0 : -1; } @@ -212,7 +213,7 @@ sem_t sem; }; -int os_sem_init(os_sem_t **sem, int value) +int os_sem_init(os_sem_t **sem, int value) { sem_t new_sem; int ret = sem_init(&new_sem, 0, value); @@ -232,15 +233,17 @@ } } -int os_sem_post(os_sem_t *sem) +int os_sem_post(os_sem_t *sem) { - if (!sem) return -1; + if (!sem) + return -1; return sem_post(&sem->sem); } -int os_sem_wait(os_sem_t *sem) +int os_sem_wait(os_sem_t *sem) { - if (!sem) return -1; + if (!sem) + return -1; return sem_wait(&sem->sem); }
View file
obs-studio-23.2.1.tar.xz/libobs/util/threading-posix.h -> obs-studio-24.0.0.tar.xz/libobs/util/threading-posix.h
Changed
@@ -36,8 +36,8 @@ return __atomic_load_n(ptr, __ATOMIC_SEQ_CST); } -static inline bool os_atomic_compare_swap_long(volatile long *val, - long old_val, long new_val) +static inline bool os_atomic_compare_swap_long(volatile long *val, long old_val, + long new_val) { return __sync_bool_compare_and_swap(val, old_val, new_val); }
View file
obs-studio-23.2.1.tar.xz/libobs/util/threading-windows.c -> obs-studio-24.0.0.tar.xz/libobs/util/threading-windows.c
Changed
@@ -30,7 +30,7 @@ #define __try #endif #ifndef __except -#define __except(x) if (0) +#define __except (x) if (0) #endif #endif #endif @@ -43,7 +43,7 @@ if (!handle) return -1; - *event = (os_event_t*)handle; + *event = (os_event_t *)handle; return 0; } @@ -118,13 +118,13 @@ ResetEvent((HANDLE)event); } -int os_sem_init(os_sem_t **sem, int value) +int os_sem_init(os_sem_t **sem, int value) { HANDLE handle = CreateSemaphore(NULL, (LONG)value, 0x7FFFFFFF, NULL); if (!handle) return -1; - *sem = (os_sem_t*)handle; + *sem = (os_sem_t *)handle; return 0; } @@ -134,24 +134,26 @@ CloseHandle((HANDLE)sem); } -int os_sem_post(os_sem_t *sem) +int os_sem_post(os_sem_t *sem) { - if (!sem) return -1; + if (!sem) + return -1; return ReleaseSemaphore((HANDLE)sem, 1, NULL) ? 0 : -1; } -int os_sem_wait(os_sem_t *sem) +int os_sem_wait(os_sem_t *sem) { DWORD ret; - if (!sem) return -1; + if (!sem) + return -1; ret = WaitForSingleObject((HANDLE)sem, INFINITE); return (ret == WAIT_OBJECT_0) ? 0 : -1; } #define VC_EXCEPTION 0x406D1388 -#pragma pack(push,8) +#pragma pack(push, 8) struct vs_threadname_info { DWORD type; /* 0x1000 */ const char *name; @@ -175,16 +177,18 @@ info.flags = 0; #ifdef NO_SEH_MINGW - __try1(EXCEPTION_EXECUTE_HANDLER) { + __try1(EXCEPTION_EXECUTE_HANDLER) + { #else __try { #endif RaiseException(VC_EXCEPTION, 0, THREADNAME_INFO_SIZE, - (ULONG_PTR*)&info); + (ULONG_PTR *)&info); #ifdef NO_SEH_MINGW - } __except1 { + } + __except1{ #else - } __except(EXCEPTION_EXECUTE_HANDLER) { + } __except (EXCEPTION_EXECUTE_HANDLER) { #endif } #endif
View file
obs-studio-23.2.1.tar.xz/libobs/util/threading-windows.h -> obs-studio-24.0.0.tar.xz/libobs/util/threading-windows.h
Changed
@@ -30,26 +30,26 @@ static inline long os_atomic_set_long(volatile long *ptr, long val) { - return (long)_InterlockedExchange((volatile long*)ptr, (long)val); + return (long)_InterlockedExchange((volatile long *)ptr, (long)val); } static inline long os_atomic_load_long(const volatile long *ptr) { - return (long)_InterlockedOr((volatile long*)ptr, 0); + return (long)_InterlockedOr((volatile long *)ptr, 0); } -static inline bool os_atomic_compare_swap_long(volatile long *val, - long old_val, long new_val) +static inline bool os_atomic_compare_swap_long(volatile long *val, long old_val, + long new_val) { return _InterlockedCompareExchange(val, new_val, old_val) == old_val; } static inline bool os_atomic_set_bool(volatile bool *ptr, bool val) { - return !!_InterlockedExchange8((volatile char*)ptr, (char)val); + return !!_InterlockedExchange8((volatile char *)ptr, (char)val); } static inline bool os_atomic_load_bool(const volatile bool *ptr) { - return !!_InterlockedOr8((volatile char*)ptr, 0); + return !!_InterlockedOr8((volatile char *)ptr, 0); }
View file
obs-studio-23.2.1.tar.xz/libobs/util/threading.h -> obs-studio-24.0.0.tar.xz/libobs/util/threading.h
Changed
@@ -55,26 +55,26 @@ enum os_event_type { OS_EVENT_TYPE_AUTO, - OS_EVENT_TYPE_MANUAL + OS_EVENT_TYPE_MANUAL, }; struct os_event_data; struct os_sem_data; typedef struct os_event_data os_event_t; -typedef struct os_sem_data os_sem_t; +typedef struct os_sem_data os_sem_t; -EXPORT int os_event_init(os_event_t **event, enum os_event_type type); +EXPORT int os_event_init(os_event_t **event, enum os_event_type type); EXPORT void os_event_destroy(os_event_t *event); -EXPORT int os_event_wait(os_event_t *event); -EXPORT int os_event_timedwait(os_event_t *event, unsigned long milliseconds); -EXPORT int os_event_try(os_event_t *event); -EXPORT int os_event_signal(os_event_t *event); +EXPORT int os_event_wait(os_event_t *event); +EXPORT int os_event_timedwait(os_event_t *event, unsigned long milliseconds); +EXPORT int os_event_try(os_event_t *event); +EXPORT int os_event_signal(os_event_t *event); EXPORT void os_event_reset(os_event_t *event); -EXPORT int os_sem_init(os_sem_t **sem, int value); +EXPORT int os_sem_init(os_sem_t **sem, int value); EXPORT void os_sem_destroy(os_sem_t *sem); -EXPORT int os_sem_post(os_sem_t *sem); -EXPORT int os_sem_wait(os_sem_t *sem); +EXPORT int os_sem_post(os_sem_t *sem); +EXPORT int os_sem_wait(os_sem_t *sem); EXPORT void os_set_thread_name(const char *name); @@ -84,7 +84,6 @@ #define THREAD_LOCAL __thread #endif - #ifdef __cplusplus } #endif
View file
obs-studio-23.2.1.tar.xz/libobs/util/utf8.c -> obs-studio-24.0.0.tar.xz/libobs/util/utf8.c
Changed
@@ -24,12 +24,12 @@ static inline bool has_utf8_bom(const char *in_char) { - uint8_t *in = (uint8_t*)in_char; + uint8_t *in = (uint8_t *)in_char; return (in && in[0] == 0xef && in[1] == 0xbb && in[2] == 0xbf); } size_t utf8_to_wchar(const char *in, size_t insize, wchar_t *out, - size_t outsize, int flags) + size_t outsize, int flags) { int i_insize = (int)insize; int ret; @@ -52,7 +52,7 @@ } size_t wchar_to_utf8(const wchar_t *in, size_t insize, char *out, - size_t outsize, int flags) + size_t outsize, int flags) { int i_insize = (int)insize; int ret; @@ -61,7 +61,7 @@ i_insize = (int)wcslen(in); ret = WideCharToMultiByte(CP_UTF8, 0, in, i_insize, out, (int)outsize, - NULL, NULL); + NULL, NULL); UNUSED_PARAMETER(flags); return (ret > 0) ? (size_t)ret : 0; @@ -69,14 +69,14 @@ #else -#define _NXT 0x80 -#define _SEQ2 0xc0 -#define _SEQ3 0xe0 -#define _SEQ4 0xf0 -#define _SEQ5 0xf8 -#define _SEQ6 0xfc +#define _NXT 0x80 +#define _SEQ2 0xc0 +#define _SEQ3 0xe0 +#define _SEQ4 0xf0 +#define _SEQ5 0xf8 +#define _SEQ6 0xfc -#define _BOM 0xfeff +#define _BOM 0xfeff static int wchar_forbidden(wchar_t sym); static int utf8_forbidden(unsigned char octet); @@ -131,7 +131,7 @@ * function. */ size_t utf8_to_wchar(const char *in, size_t insize, wchar_t *out, - size_t outsize, int flags) + size_t outsize, int flags) { unsigned char *p, *lim; wchar_t *wlim, high; @@ -142,21 +142,20 @@ total = 0; p = (unsigned char *)in; - lim = (insize != 0) ? (p + insize) : (unsigned char*)-1; + lim = (insize != 0) ? (p + insize) : (unsigned char *)-1; wlim = out + outsize; for (; p < lim; p += n) { if (!*p) break; - if (utf8_forbidden(*p) != 0 && - (flags & UTF8_IGNORE_ERROR) == 0) + if (utf8_forbidden(*p) != 0 && (flags & UTF8_IGNORE_ERROR) == 0) return 0; /* * Get number of bytes for one wide character. */ - n = 1; /* default: 1 byte. Used when skipping bytes. */ + n = 1; /* default: 1 byte. Used when skipping bytes. */ if ((*p & 0x80) == 0) high = (wchar_t)*p; else if ((*p & 0xe0) == _SEQ2) { @@ -185,7 +184,7 @@ if ((flags & UTF8_IGNORE_ERROR) == 0) return 0; n = 1; - continue; /* skip */ + continue; /* skip */ } /* @@ -201,7 +200,7 @@ if ((flags & UTF8_IGNORE_ERROR) == 0) return 0; n = 1; - continue; /* skip */ + continue; /* skip */ } } @@ -211,19 +210,19 @@ continue; if (out >= wlim) - return 0; /* no space left */ + return 0; /* no space left */ *out = 0; n_bits = 0; for (i = 1; i < n; i++) { *out |= (wchar_t)(p[n - i] & 0x3f) << n_bits; - n_bits += 6; /* 6 low bits in every byte */ + n_bits += 6; /* 6 low bits in every byte */ } *out |= high << n_bits; if (wchar_forbidden(*out) != 0) { if ((flags & UTF8_IGNORE_ERROR) == 0) - return 0; /* forbidden character */ + return 0; /* forbidden character */ else { total--; out--; @@ -261,7 +260,7 @@ * as regular symbols. */ size_t wchar_to_utf8(const wchar_t *in, size_t insize, char *out, - size_t outsize, int flags) + size_t outsize, int flags) { wchar_t *w, *wlim, ch = 0; unsigned char *p, *lim, *oc; @@ -271,7 +270,7 @@ return 0; w = (wchar_t *)in; - wlim = (insize != 0) ? (w + insize) : (wchar_t*)-1; + wlim = (insize != 0) ? (w + insize) : (wchar_t *)-1; p = (unsigned char *)out; lim = p + outsize; total = 0; @@ -313,7 +312,7 @@ continue; if ((size_t)(lim - p) <= n - 1) - return 0; /* no space left */ + return 0; /* no space left */ ch = *w; oc = (unsigned char *)&ch; @@ -337,7 +336,7 @@ p[3] = _NXT | (oc[0] & 0x3f); p[2] = _NXT | (oc[0] >> 6) | ((oc[1] & 0x0f) << 2); p[1] = _NXT | ((oc[1] & 0xf0) >> 4) | - ((oc[2] & 0x03) << 4); + ((oc[2] & 0x03) << 4); p[0] = _SEQ4 | ((oc[2] & 0x1f) >> 2); break; @@ -345,7 +344,7 @@ p[4] = _NXT | (oc[0] & 0x3f); p[3] = _NXT | (oc[0] >> 6) | ((oc[1] & 0x0f) << 2); p[2] = _NXT | ((oc[1] & 0xf0) >> 4) | - ((oc[2] & 0x03) << 4); + ((oc[2] & 0x03) << 4); p[1] = _NXT | (oc[2] >> 2); p[0] = _SEQ5 | (oc[3] & 0x03); break;
View file
obs-studio-23.2.1.tar.xz/libobs/util/utf8.h -> obs-studio-24.0.0.tar.xz/libobs/util/utf8.h
Changed
@@ -25,12 +25,12 @@ #endif #define UTF8_IGNORE_ERROR 0x01 -#define UTF8_SKIP_BOM 0x02 +#define UTF8_SKIP_BOM 0x02 size_t utf8_to_wchar(const char *in, size_t insize, wchar_t *out, - size_t outsize, int flags); + size_t outsize, int flags); size_t wchar_to_utf8(const wchar_t *in, size_t insize, char *out, - size_t outsize, int flags); + size_t outsize, int flags); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/libobs/util/util.hpp -> obs-studio-24.0.0.tar.xz/libobs/util/util.hpp
Changed
@@ -30,31 +30,41 @@ template<typename T> class BPtr { T *ptr; - BPtr(BPtr const&) = delete; + BPtr(BPtr const &) = delete; - BPtr &operator=(BPtr const&) = delete; + BPtr &operator=(BPtr const &) = delete; public: - inline BPtr(T *p=nullptr) : ptr(p) {} - inline BPtr(BPtr &&other) : ptr(other.ptr) {other.ptr = nullptr;} - inline ~BPtr() {bfree(ptr);} + inline BPtr(T *p = nullptr) : ptr(p) {} + inline BPtr(BPtr &&other) : ptr(other.ptr) { other.ptr = nullptr; } + inline ~BPtr() { bfree(ptr); } - inline T *operator=(T *p) {bfree(ptr); ptr = p; return p;} - inline operator T*() {return ptr;} - inline T **operator&() {bfree(ptr); ptr = nullptr; return &ptr;} + inline T *operator=(T *p) + { + bfree(ptr); + ptr = p; + return p; + } + inline operator T *() { return ptr; } + inline T **operator&() + { + bfree(ptr); + ptr = nullptr; + return &ptr; + } - inline bool operator!() {return ptr == NULL;} - inline bool operator==(T p) {return ptr == p;} - inline bool operator!=(T p) {return ptr != p;} + inline bool operator!() { return ptr == NULL; } + inline bool operator==(T p) { return ptr == p; } + inline bool operator!=(T p) { return ptr != p; } - inline T *Get() const {return ptr;} + inline T *Get() const { return ptr; } }; class ConfigFile { config_t *config; - ConfigFile(ConfigFile const&) = delete; - ConfigFile &operator=(ConfigFile const&) = delete; + ConfigFile(ConfigFile const &) = delete; + ConfigFile &operator=(ConfigFile const &) = delete; public: inline ConfigFile() : config(NULL) {} @@ -62,10 +72,7 @@ { other.config = nullptr; } - inline ~ConfigFile() - { - config_close(config); - } + inline ~ConfigFile() { config_close(config); } inline bool Create(const char *file) { @@ -87,13 +94,10 @@ return config_open(&config, file, openType); } - inline int Save() - { - return config_save(config); - } + inline int Save() { return config_save(config); } inline int SaveSafe(const char *temp_ext, - const char *backup_ext = nullptr) + const char *backup_ext = nullptr) { return config_save_safe(config, temp_ext, backup_ext); } @@ -104,32 +108,32 @@ config = NULL; } - inline operator config_t*() const {return config;} + inline operator config_t *() const { return config; } }; class TextLookup { lookup_t *lookup; - TextLookup(TextLookup const&) = delete; + TextLookup(TextLookup const &) = delete; - TextLookup &operator=(TextLookup const&) = delete; + TextLookup &operator=(TextLookup const &) = delete; public: - inline TextLookup(lookup_t *lookup=nullptr) : lookup(lookup) {} + inline TextLookup(lookup_t *lookup = nullptr) : lookup(lookup) {} inline TextLookup(TextLookup &&other) : lookup(other.lookup) { other.lookup = nullptr; } - inline ~TextLookup() {text_lookup_destroy(lookup);} + inline ~TextLookup() { text_lookup_destroy(lookup); } - inline TextLookup& operator=(lookup_t *val) + inline TextLookup &operator=(lookup_t *val) { text_lookup_destroy(lookup); lookup = val; return *this; } - inline operator lookup_t*() const {return lookup;} + inline operator lookup_t *() const { return lookup; } inline const char *GetString(const char *lookupVal) const {
View file
obs-studio-23.2.1.tar.xz/libobs/util/vc/vc_inttypes.h -> obs-studio-24.0.0.tar.xz/libobs/util/vc/vc_inttypes.h
Changed
@@ -45,201 +45,202 @@ // 7.8 Format conversion of integer types typedef struct { - intmax_t quot; - intmax_t rem; + intmax_t quot; + intmax_t rem; } imaxdiv_t; // 7.8.1 Macros for format specifiers -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 +#if !defined(__cplusplus) || \ + defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 // The fprintf macros for signed integers are: -#define PRId8 "d" -#define PRIi8 "i" -#define PRIdLEAST8 "d" -#define PRIiLEAST8 "i" -#define PRIdFAST8 "d" -#define PRIiFAST8 "i" - -#define PRId16 "hd" -#define PRIi16 "hi" -#define PRIdLEAST16 "hd" -#define PRIiLEAST16 "hi" -#define PRIdFAST16 "hd" -#define PRIiFAST16 "hi" - -#define PRId32 "I32d" -#define PRIi32 "I32i" -#define PRIdLEAST32 "I32d" -#define PRIiLEAST32 "I32i" -#define PRIdFAST32 "I32d" -#define PRIiFAST32 "I32i" - -#define PRId64 "I64d" -#define PRIi64 "I64i" -#define PRIdLEAST64 "I64d" -#define PRIiLEAST64 "I64i" -#define PRIdFAST64 "I64d" -#define PRIiFAST64 "I64i" - -#define PRIdMAX "I64d" -#define PRIiMAX "I64i" - -#define PRIdPTR "Id" -#define PRIiPTR "Ii" +#define PRId8 "d" +#define PRIi8 "i" +#define PRIdLEAST8 "d" +#define PRIiLEAST8 "i" +#define PRIdFAST8 "d" +#define PRIiFAST8 "i" + +#define PRId16 "hd" +#define PRIi16 "hi" +#define PRIdLEAST16 "hd" +#define PRIiLEAST16 "hi" +#define PRIdFAST16 "hd" +#define PRIiFAST16 "hi" + +#define PRId32 "I32d" +#define PRIi32 "I32i" +#define PRIdLEAST32 "I32d" +#define PRIiLEAST32 "I32i" +#define PRIdFAST32 "I32d" +#define PRIiFAST32 "I32i" + +#define PRId64 "I64d" +#define PRIi64 "I64i" +#define PRIdLEAST64 "I64d" +#define PRIiLEAST64 "I64i" +#define PRIdFAST64 "I64d" +#define PRIiFAST64 "I64i" + +#define PRIdMAX "I64d" +#define PRIiMAX "I64i" + +#define PRIdPTR "Id" +#define PRIiPTR "Ii" // The fprintf macros for unsigned integers are: -#define PRIo8 "o" -#define PRIu8 "u" -#define PRIx8 "x" -#define PRIX8 "X" -#define PRIoLEAST8 "o" -#define PRIuLEAST8 "u" -#define PRIxLEAST8 "x" -#define PRIXLEAST8 "X" -#define PRIoFAST8 "o" -#define PRIuFAST8 "u" -#define PRIxFAST8 "x" -#define PRIXFAST8 "X" - -#define PRIo16 "ho" -#define PRIu16 "hu" -#define PRIx16 "hx" -#define PRIX16 "hX" -#define PRIoLEAST16 "ho" -#define PRIuLEAST16 "hu" -#define PRIxLEAST16 "hx" -#define PRIXLEAST16 "hX" -#define PRIoFAST16 "ho" -#define PRIuFAST16 "hu" -#define PRIxFAST16 "hx" -#define PRIXFAST16 "hX" - -#define PRIo32 "I32o" -#define PRIu32 "I32u" -#define PRIx32 "I32x" -#define PRIX32 "I32X" -#define PRIoLEAST32 "I32o" -#define PRIuLEAST32 "I32u" -#define PRIxLEAST32 "I32x" -#define PRIXLEAST32 "I32X" -#define PRIoFAST32 "I32o" -#define PRIuFAST32 "I32u" -#define PRIxFAST32 "I32x" -#define PRIXFAST32 "I32X" - -#define PRIo64 "I64o" -#define PRIu64 "I64u" -#define PRIx64 "I64x" -#define PRIX64 "I64X" -#define PRIoLEAST64 "I64o" -#define PRIuLEAST64 "I64u" -#define PRIxLEAST64 "I64x" -#define PRIXLEAST64 "I64X" -#define PRIoFAST64 "I64o" -#define PRIuFAST64 "I64u" -#define PRIxFAST64 "I64x" -#define PRIXFAST64 "I64X" - -#define PRIoMAX "I64o" -#define PRIuMAX "I64u" -#define PRIxMAX "I64x" -#define PRIXMAX "I64X" - -#define PRIoPTR "Io" -#define PRIuPTR "Iu" -#define PRIxPTR "Ix" -#define PRIXPTR "IX" +#define PRIo8 "o" +#define PRIu8 "u" +#define PRIx8 "x" +#define PRIX8 "X" +#define PRIoLEAST8 "o" +#define PRIuLEAST8 "u" +#define PRIxLEAST8 "x" +#define PRIXLEAST8 "X" +#define PRIoFAST8 "o" +#define PRIuFAST8 "u" +#define PRIxFAST8 "x" +#define PRIXFAST8 "X" + +#define PRIo16 "ho" +#define PRIu16 "hu" +#define PRIx16 "hx" +#define PRIX16 "hX" +#define PRIoLEAST16 "ho" +#define PRIuLEAST16 "hu" +#define PRIxLEAST16 "hx" +#define PRIXLEAST16 "hX" +#define PRIoFAST16 "ho" +#define PRIuFAST16 "hu" +#define PRIxFAST16 "hx" +#define PRIXFAST16 "hX" + +#define PRIo32 "I32o" +#define PRIu32 "I32u" +#define PRIx32 "I32x" +#define PRIX32 "I32X" +#define PRIoLEAST32 "I32o" +#define PRIuLEAST32 "I32u" +#define PRIxLEAST32 "I32x" +#define PRIXLEAST32 "I32X" +#define PRIoFAST32 "I32o" +#define PRIuFAST32 "I32u" +#define PRIxFAST32 "I32x" +#define PRIXFAST32 "I32X" + +#define PRIo64 "I64o" +#define PRIu64 "I64u" +#define PRIx64 "I64x" +#define PRIX64 "I64X" +#define PRIoLEAST64 "I64o" +#define PRIuLEAST64 "I64u" +#define PRIxLEAST64 "I64x" +#define PRIXLEAST64 "I64X" +#define PRIoFAST64 "I64o" +#define PRIuFAST64 "I64u" +#define PRIxFAST64 "I64x" +#define PRIXFAST64 "I64X" + +#define PRIoMAX "I64o" +#define PRIuMAX "I64u" +#define PRIxMAX "I64x" +#define PRIXMAX "I64X" + +#define PRIoPTR "Io" +#define PRIuPTR "Iu" +#define PRIxPTR "Ix" +#define PRIXPTR "IX" // The fscanf macros for signed integers are: -#define SCNd16 "hd" -#define SCNi16 "hi" -#define SCNdLEAST16 "hd" -#define SCNiLEAST16 "hi" -#define SCNdFAST16 "hd" -#define SCNiFAST16 "hi" - -#define SCNd32 "ld" -#define SCNi32 "li" -#define SCNdLEAST32 "ld" -#define SCNiLEAST32 "li" -#define SCNdFAST32 "ld" -#define SCNiFAST32 "li" - -#define SCNd64 "I64d" -#define SCNi64 "I64i" -#define SCNdLEAST64 "I64d" -#define SCNiLEAST64 "I64i" -#define SCNdFAST64 "I64d" -#define SCNiFAST64 "I64i" - -#define SCNdMAX "I64d" -#define SCNiMAX "I64i" +#define SCNd16 "hd" +#define SCNi16 "hi" +#define SCNdLEAST16 "hd" +#define SCNiLEAST16 "hi" +#define SCNdFAST16 "hd" +#define SCNiFAST16 "hi" + +#define SCNd32 "ld" +#define SCNi32 "li" +#define SCNdLEAST32 "ld" +#define SCNiLEAST32 "li" +#define SCNdFAST32 "ld" +#define SCNiFAST32 "li" + +#define SCNd64 "I64d" +#define SCNi64 "I64i" +#define SCNdLEAST64 "I64d" +#define SCNiLEAST64 "I64i" +#define SCNdFAST64 "I64d" +#define SCNiFAST64 "I64i" + +#define SCNdMAX "I64d" +#define SCNiMAX "I64i" #ifdef _WIN64 // [ -# define SCNdPTR "I64d" -# define SCNiPTR "I64i" -#else // _WIN64 ][ -# define SCNdPTR "ld" -# define SCNiPTR "li" -#endif // _WIN64 ] +#define SCNdPTR "I64d" +#define SCNiPTR "I64i" +#else // _WIN64 ][ +#define SCNdPTR "ld" +#define SCNiPTR "li" +#endif // _WIN64 ] // The fscanf macros for unsigned integers are: -#define SCNo16 "ho" -#define SCNu16 "hu" -#define SCNx16 "hx" -#define SCNX16 "hX" -#define SCNoLEAST16 "ho" -#define SCNuLEAST16 "hu" -#define SCNxLEAST16 "hx" -#define SCNXLEAST16 "hX" -#define SCNoFAST16 "ho" -#define SCNuFAST16 "hu" -#define SCNxFAST16 "hx" -#define SCNXFAST16 "hX" - -#define SCNo32 "lo" -#define SCNu32 "lu" -#define SCNx32 "lx" -#define SCNX32 "lX" -#define SCNoLEAST32 "lo" -#define SCNuLEAST32 "lu" -#define SCNxLEAST32 "lx" -#define SCNXLEAST32 "lX" -#define SCNoFAST32 "lo" -#define SCNuFAST32 "lu" -#define SCNxFAST32 "lx" -#define SCNXFAST32 "lX" - -#define SCNo64 "I64o" -#define SCNu64 "I64u" -#define SCNx64 "I64x" -#define SCNX64 "I64X" -#define SCNoLEAST64 "I64o" -#define SCNuLEAST64 "I64u" -#define SCNxLEAST64 "I64x" -#define SCNXLEAST64 "I64X" -#define SCNoFAST64 "I64o" -#define SCNuFAST64 "I64u" -#define SCNxFAST64 "I64x" -#define SCNXFAST64 "I64X" - -#define SCNoMAX "I64o" -#define SCNuMAX "I64u" -#define SCNxMAX "I64x" -#define SCNXMAX "I64X" +#define SCNo16 "ho" +#define SCNu16 "hu" +#define SCNx16 "hx" +#define SCNX16 "hX" +#define SCNoLEAST16 "ho" +#define SCNuLEAST16 "hu" +#define SCNxLEAST16 "hx" +#define SCNXLEAST16 "hX" +#define SCNoFAST16 "ho" +#define SCNuFAST16 "hu" +#define SCNxFAST16 "hx" +#define SCNXFAST16 "hX" + +#define SCNo32 "lo" +#define SCNu32 "lu" +#define SCNx32 "lx" +#define SCNX32 "lX" +#define SCNoLEAST32 "lo" +#define SCNuLEAST32 "lu" +#define SCNxLEAST32 "lx" +#define SCNXLEAST32 "lX" +#define SCNoFAST32 "lo" +#define SCNuFAST32 "lu" +#define SCNxFAST32 "lx" +#define SCNXFAST32 "lX" + +#define SCNo64 "I64o" +#define SCNu64 "I64u" +#define SCNx64 "I64x" +#define SCNX64 "I64X" +#define SCNoLEAST64 "I64o" +#define SCNuLEAST64 "I64u" +#define SCNxLEAST64 "I64x" +#define SCNXLEAST64 "I64X" +#define SCNoFAST64 "I64o" +#define SCNuFAST64 "I64u" +#define SCNxFAST64 "I64x" +#define SCNXFAST64 "I64X" + +#define SCNoMAX "I64o" +#define SCNuMAX "I64u" +#define SCNxMAX "I64x" +#define SCNXMAX "I64X" #ifdef _WIN64 // [ -# define SCNoPTR "I64o" -# define SCNuPTR "I64u" -# define SCNxPTR "I64x" -# define SCNXPTR "I64X" -#else // _WIN64 ][ -# define SCNoPTR "lo" -# define SCNuPTR "lu" -# define SCNxPTR "lx" -# define SCNXPTR "lX" -#endif // _WIN64 ] +#define SCNoPTR "I64o" +#define SCNuPTR "I64u" +#define SCNxPTR "I64x" +#define SCNXPTR "I64X" +#else // _WIN64 ][ +#define SCNoPTR "lo" +#define SCNuPTR "lu" +#define SCNxPTR "lx" +#define SCNXPTR "lX" +#endif // _WIN64 ] #endif // __STDC_FORMAT_MACROS ] @@ -254,23 +255,23 @@ // in %MSVC.NET%\crt\src\div.c #ifdef STATIC_IMAXDIV // [ static -#else // STATIC_IMAXDIV ][ +#else // STATIC_IMAXDIV ][ _inline #endif // STATIC_IMAXDIV ] -imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) + imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) { - imaxdiv_t result; + imaxdiv_t result; - result.quot = numer / denom; - result.rem = numer % denom; + result.quot = numer / denom; + result.rem = numer % denom; - if (numer < 0 && result.rem > 0) { - // did division wrong; must fix up - ++result.quot; - result.rem -= denom; - } + if (numer < 0 && result.rem > 0) { + // did division wrong; must fix up + ++result.quot; + result.rem -= denom; + } - return result; + return result; } // 7.8.2.3 The strtoimax and strtoumax functions @@ -281,5 +282,4 @@ #define wcstoimax _wcstoi64 #define wcstoumax _wcstoui64 - #endif // _MSC_INTTYPES_H_ ]
View file
obs-studio-23.2.1.tar.xz/libobs/util/vc/vc_stdbool.h -> obs-studio-24.0.0.tar.xz/libobs/util/vc/vc_stdbool.h
Changed
@@ -1,7 +1,7 @@ #pragma once #if !defined(__cplusplus) -typedef int8_t _Bool; +typedef int8_t _Bool; #define bool _Bool #define true 1 #define false 0
View file
obs-studio-23.2.1.tar.xz/libobs/util/vc/vc_stdint.h -> obs-studio-24.0.0.tar.xz/libobs/util/vc/vc_stdint.h
Changed
@@ -24,23 +24,23 @@ /* 7.18.1.1 Exact-width integer types */ typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned uint32_t; -typedef __int64 int64_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned uint32_t; +typedef __int64 int64_t; typedef unsigned __int64 uint64_t; /* 7.18.1.2 Minimum-width integer types */ typedef signed char int_least8_t; -typedef unsigned char uint_least8_t; -typedef short int_least16_t; -typedef unsigned short uint_least16_t; -typedef int int_least32_t; -typedef unsigned uint_least32_t; -typedef __int64 int_least64_t; -typedef unsigned __int64 uint_least64_t; +typedef unsigned char uint_least8_t; +typedef short int_least16_t; +typedef unsigned short uint_least16_t; +typedef int int_least32_t; +typedef unsigned uint_least32_t; +typedef __int64 int_least64_t; +typedef unsigned __int64 uint_least64_t; /* 7.18.1.3 Fastest minimum-width integer types * Not actually guaranteed to be fastest for all purposes @@ -48,38 +48,38 @@ */ typedef char int_fast8_t; typedef unsigned char uint_fast8_t; -typedef short int_fast16_t; -typedef unsigned short uint_fast16_t; -typedef int int_fast32_t; -typedef unsigned int uint_fast32_t; -typedef __int64 int_fast64_t; -typedef unsigned __int64 uint_fast64_t; +typedef short int_fast16_t; +typedef unsigned short uint_fast16_t; +typedef int int_fast32_t; +typedef unsigned int uint_fast32_t; +typedef __int64 int_fast64_t; +typedef unsigned __int64 uint_fast64_t; /* 7.18.1.4 Integer types capable of holding object pointers */ /*typedef int intptr_t; typedef unsigned uintptr_t;*/ /* 7.18.1.5 Greatest-width integer types */ -typedef __int64 intmax_t; -typedef unsigned __int64 uintmax_t; +typedef __int64 intmax_t; +typedef unsigned __int64 uintmax_t; /* 7.18.2 Limits of specified-width integer types */ -#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) /* 7.18.2.1 Limits of exact-width integer types */ #define INT8_MIN (-128) #define INT16_MIN (-32768) #define INT32_MIN (-2147483647 - 1) -#define INT64_MIN (-9223372036854775807LL - 1) +#define INT64_MIN (-9223372036854775807LL - 1) #define INT8_MAX 127 #define INT16_MAX 32767 #define INT32_MAX 2147483647 #define INT64_MAX 9223372036854775807LL -#define UINT8_MAX 0xff /* 255U */ -#define UINT16_MAX 0xffff /* 65535U */ -#define UINT32_MAX 0xffffffff /* 4294967295U */ +#define UINT8_MAX 0xff /* 255U */ +#define UINT16_MAX 0xffff /* 65535U */ +#define UINT32_MAX 0xffffffff /* 4294967295U */ #define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ /* 7.18.2.2 Limits of minimum-width integer types */ @@ -152,7 +152,7 @@ #endif #if 0 -#ifndef WCHAR_MIN /* also in wchar.h */ +#ifndef WCHAR_MIN /* also in wchar.h */ #define WCHAR_MIN 0 #define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ #endif @@ -166,9 +166,8 @@ #endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ - /* 7.18.4 Macros for integer constants */ -#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS) +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) /* 7.18.4.1 Macros for minimum-width integer constants @@ -185,20 +184,20 @@ The trick used here is from Clive D W Feather. */ -#define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val)) -#define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val)) -#define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val)) -#define INT64_C(val) (INT_LEAST64_MAX-INT_LEAST64_MAX+(val)) +#define INT8_C(val) (INT_LEAST8_MAX - INT_LEAST8_MAX + (val)) +#define INT16_C(val) (INT_LEAST16_MAX - INT_LEAST16_MAX + (val)) +#define INT32_C(val) (INT_LEAST32_MAX - INT_LEAST32_MAX + (val)) +#define INT64_C(val) (INT_LEAST64_MAX - INT_LEAST64_MAX + (val)) -#define UINT8_C(val) (UINT_LEAST8_MAX-UINT_LEAST8_MAX+(val)) -#define UINT16_C(val) (UINT_LEAST16_MAX-UINT_LEAST16_MAX+(val)) -#define UINT32_C(val) (UINT_LEAST32_MAX-UINT_LEAST32_MAX+(val)) -#define UINT64_C(val) (UINT_LEAST64_MAX-UINT_LEAST64_MAX+(val)) +#define UINT8_C(val) (UINT_LEAST8_MAX - UINT_LEAST8_MAX + (val)) +#define UINT16_C(val) (UINT_LEAST16_MAX - UINT_LEAST16_MAX + (val)) +#define UINT32_C(val) (UINT_LEAST32_MAX - UINT_LEAST32_MAX + (val)) +#define UINT64_C(val) (UINT_LEAST64_MAX - UINT_LEAST64_MAX + (val)) /* 7.18.4.2 Macros for greatest-width integer constants */ -#define INTMAX_C(val) (INTMAX_MAX-INTMAX_MAX+(val)) -#define UINTMAX_C(val) (UINTMAX_MAX-UINTMAX_MAX+(val)) +#define INTMAX_C(val) (INTMAX_MAX - INTMAX_MAX + (val)) +#define UINTMAX_C(val) (UINTMAX_MAX - UINTMAX_MAX + (val)) -#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ +#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ #endif
View file
obs-studio-23.2.1.tar.xz/libobs/util/windows/CoTaskMemPtr.hpp -> obs-studio-24.0.0.tar.xz/libobs/util/windows/CoTaskMemPtr.hpp
Changed
@@ -19,25 +19,29 @@ template<typename T> class CoTaskMemPtr { T *ptr; - inline void Clear() {if (ptr) CoTaskMemFree(ptr);} + inline void Clear() + { + if (ptr) + CoTaskMemFree(ptr); + } public: - inline CoTaskMemPtr() : ptr(NULL) {} + inline CoTaskMemPtr() : ptr(NULL) {} inline CoTaskMemPtr(T *ptr_) : ptr(ptr_) {} - inline ~CoTaskMemPtr() {Clear();} + inline ~CoTaskMemPtr() { Clear(); } - inline operator T*() const {return ptr;} - inline T *operator->() const {return ptr;} + inline operator T *() const { return ptr; } + inline T *operator->() const { return ptr; } - inline const T *Get() const {return ptr;} + inline const T *Get() const { return ptr; } - inline CoTaskMemPtr& operator=(T* val) + inline CoTaskMemPtr &operator=(T *val) { Clear(); ptr = val; } - inline T** operator&() + inline T **operator&() { Clear(); ptr = NULL;
View file
obs-studio-23.2.1.tar.xz/libobs/util/windows/ComPtr.hpp -> obs-studio-24.0.0.tar.xz/libobs/util/windows/ComPtr.hpp
Changed
@@ -33,18 +33,28 @@ inline void Replace(T *p) { if (ptr != p) { - if (p) p->AddRef(); - if (ptr) ptr->Release(); + if (p) + p->AddRef(); + if (ptr) + ptr->Release(); ptr = p; } } public: - inline ComPtr() : ptr(nullptr) {} - inline ComPtr(T *p) : ptr(p) {if (ptr) ptr->AddRef();} - inline ComPtr(const ComPtr<T> &c) : ptr(c.ptr) {if (ptr) ptr->AddRef();} - inline ComPtr(ComPtr<T> &&c) : ptr(c.ptr) {c.ptr = nullptr;} - inline ~ComPtr() {Kill();} + inline ComPtr() : ptr(nullptr) {} + inline ComPtr(T *p) : ptr(p) + { + if (ptr) + ptr->AddRef(); + } + inline ComPtr(const ComPtr<T> &c) : ptr(c.ptr) + { + if (ptr) + ptr->AddRef(); + } + inline ComPtr(ComPtr<T> &&c) : ptr(c.ptr) { c.ptr = nullptr; } + inline ~ComPtr() { Kill(); } inline void Clear() { @@ -87,7 +97,8 @@ inline void CopyTo(T **out) { if (out) { - if (ptr) ptr->AddRef(); + if (ptr) + ptr->AddRef(); *out = ptr; } } @@ -96,26 +107,35 @@ { ULONG ref; - if (!ptr) return 0; + if (!ptr) + return 0; ref = ptr->Release(); ptr = nullptr; return ref; } - inline T **Assign() {Clear(); return &ptr;} - inline void Set(T *p) {Kill(); ptr = p;} + inline T **Assign() + { + Clear(); + return &ptr; + } + inline void Set(T *p) + { + Kill(); + ptr = p; + } - inline T *Get() const {return ptr;} + inline T *Get() const { return ptr; } - inline T **operator&() {return Assign();} + inline T **operator&() { return Assign(); } - inline operator T*() const {return ptr;} - inline T *operator->() const {return ptr;} + inline operator T *() const { return ptr; } + inline T *operator->() const { return ptr; } - inline bool operator==(T *p) const {return ptr == p;} - inline bool operator!=(T *p) const {return ptr != p;} + inline bool operator==(T *p) const { return ptr == p; } + inline bool operator!=(T *p) const { return ptr != p; } - inline bool operator!() const {return !ptr;} + inline bool operator!() const { return !ptr; } }; #ifdef _WIN32 @@ -126,13 +146,13 @@ inline ComQIPtr(IUnknown *unk) { this->ptr = nullptr; - unk->QueryInterface(__uuidof(T), (void**)&this->ptr); + unk->QueryInterface(__uuidof(T), (void **)&this->ptr); } inline ComPtr<T> &operator=(IUnknown *unk) { ComPtr<T>::Clear(); - unk->QueryInterface(__uuidof(T), (void**)&this->ptr); + unk->QueryInterface(__uuidof(T), (void **)&this->ptr); return *this; } };
View file
obs-studio-23.2.1.tar.xz/libobs/util/windows/HRError.hpp -> obs-studio-24.0.0.tar.xz/libobs/util/windows/HRError.hpp
Changed
@@ -20,8 +20,5 @@ const char *str; HRESULT hr; - inline HRError(const char *str, HRESULT hr) - : str(str), hr (hr) - { - } + inline HRError(const char *str, HRESULT hr) : str(str), hr(hr) {} };
View file
obs-studio-23.2.1.tar.xz/libobs/util/windows/WinHandle.hpp -> obs-studio-24.0.0.tar.xz/libobs/util/windows/WinHandle.hpp
Changed
@@ -26,13 +26,13 @@ } public: - inline WinHandle() {} + inline WinHandle() {} inline WinHandle(HANDLE handle_) : handle(handle_) {} - inline ~WinHandle() {Clear();} + inline ~WinHandle() { Clear(); } - inline operator HANDLE() const {return handle;} + inline operator HANDLE() const { return handle; } - inline WinHandle& operator=(HANDLE handle_) + inline WinHandle &operator=(HANDLE handle_) { if (handle_ != handle) { Clear(); @@ -42,10 +42,7 @@ return *this; } - inline HANDLE* operator&() - { - return &handle; - } + inline HANDLE *operator&() { return &handle; } inline bool Valid() const {
View file
obs-studio-23.2.1.tar.xz/libobs/util/windows/win-registry.h -> obs-studio-24.0.0.tar.xz/libobs/util/windows/win-registry.h
Changed
@@ -26,12 +26,12 @@ struct reg_dword { LSTATUS status; - DWORD size; - DWORD return_value; + DWORD size; + DWORD return_value; }; EXPORT void get_reg_dword(HKEY hkey, LPCWSTR sub_key, LPCWSTR value_name, - struct reg_dword *info); + struct reg_dword *info); #ifdef __cplusplus }
View file
obs-studio-23.2.1.tar.xz/plugins/coreaudio-encoder/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/coreaudio-encoder/data/locale/de-DE.ini
Changed
@@ -1,6 +1,6 @@ CoreAudioAAC="CoreAudio AAC Kodierer" Bitrate="Bitrate" -AllowHEAAC="Erlaube HE-AAC" +AllowHEAAC="Erlaube HE‐AAC" OutputSamplerate="Ausgabeabtastrate" UseInputSampleRate="Verwenden Sie Eingabe (OBS) Abtastrate (kann nicht unterstützte Bitraten auflisten)"
View file
obs-studio-23.2.1.tar.xz/plugins/coreaudio-encoder/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/coreaudio-encoder/data/locale/gl-ES.ini
Changed
@@ -1,4 +1,6 @@ -CoreAudioAAC="Codificador CoreAudio AAC" -Bitrate="Velocidade de bits" +CoreAudioAAC="Codificador AAC de CoreAudio" +Bitrate="Taxa de bits" AllowHEAAC="Permitir HE-AAC" +OutputSamplerate="Taxa de mostra de saída" +UseInputSampleRate="Utilizar a taxa de mostra de entrada do OBS (pode listar as taxas de bits que non son compatíbeis)"
View file
obs-studio-24.0.0.tar.xz/plugins/coreaudio-encoder/data/locale/sl-SI.ini
Added
@@ -0,0 +1,6 @@ +CoreAudioAAC="Kodirnik AAC CoreAudio" +Bitrate="Bitna hitrost" +AllowHEAAC="Omogoči HE-AAC" +OutputSamplerate="Izhodna hitrost vzorčenja" +UseInputSampleRate="Uporabo vhodno hitrost vzorčenja (OBS) (lahko so prikazane nepodprte bitne hitrosti)" +
View file
obs-studio-23.2.1.tar.xz/plugins/coreaudio-encoder/encoder.cpp -> obs-studio-24.0.0.tar.xz/plugins/coreaudio-encoder/encoder.cpp
Changed
@@ -15,19 +15,18 @@ #define CA_LOG(level, format, ...) \ blog(level, "[CoreAudio encoder]: " format, ##__VA_ARGS__) -#define CA_LOG_ENCODER(format_name, encoder, level, format, ...) \ - blog(level, "[CoreAudio %s: '%s']: " format, \ - format_name, obs_encoder_get_name(encoder), \ - ##__VA_ARGS__) -#define CA_BLOG(level, format, ...) \ +#define CA_LOG_ENCODER(format_name, encoder, level, format, ...) \ + blog(level, "[CoreAudio %s: '%s']: " format, format_name, \ + obs_encoder_get_name(encoder), ##__VA_ARGS__) +#define CA_BLOG(level, format, ...) \ CA_LOG_ENCODER(ca->format_name, ca->encoder, level, format, \ - ##__VA_ARGS__) -#define CA_CO_LOG(level, format, ...) \ - do { \ - if (ca) \ + ##__VA_ARGS__) +#define CA_CO_LOG(level, format, ...) \ + do { \ + if (ca) \ CA_BLOG(level, format, ##__VA_ARGS__); \ - else \ - CA_LOG(level, format, ##__VA_ARGS__); \ + else \ + CA_LOG(level, format, ##__VA_ARGS__); \ } while (false) #ifdef _WIN32 @@ -91,32 +90,32 @@ }; struct ca_encoder { - obs_encoder_t *encoder = nullptr; - const char *format_name = nullptr; - UInt32 format_id = 0; + obs_encoder_t *encoder = nullptr; + const char *format_name = nullptr; + UInt32 format_id = 0; const initializer_list<UInt32> *allowed_formats = nullptr; AudioConverterRef converter = nullptr; - size_t output_buffer_size = 0; - vector<uint8_t> output_buffer; + size_t output_buffer_size = 0; + vector<uint8_t> output_buffer; - size_t out_frames_per_packet = 0; + size_t out_frames_per_packet = 0; - size_t in_packets = 0; - size_t in_frame_size = 0; - size_t in_bytes_required = 0; + size_t in_packets = 0; + size_t in_frame_size = 0; + size_t in_bytes_required = 0; - vector<uint8_t> input_buffer; - vector<uint8_t> encode_buffer; + vector<uint8_t> input_buffer; + vector<uint8_t> encode_buffer; - uint64_t total_samples = 0; - uint64_t samples_per_second = 0; + uint64_t total_samples = 0; + uint64_t samples_per_second = 0; - vector<uint8_t> extra_data; + vector<uint8_t> extra_data; - size_t channels = 0; + size_t channels = 0; ~ca_encoder() { @@ -131,16 +130,14 @@ namespace std { #ifndef _WIN32 -template <> -struct default_delete<remove_pointer<CFErrorRef>::type> { +template<> struct default_delete<remove_pointer<CFErrorRef>::type> { void operator()(remove_pointer<CFErrorRef>::type *err) { CFRelease(err); } }; -template <> -struct default_delete<remove_pointer<CFStringRef>::type> { +template<> struct default_delete<remove_pointer<CFStringRef>::type> { void operator()(remove_pointer<CFStringRef>::type *str) { CFRelease(str); @@ -148,8 +145,7 @@ }; #endif -template <> -struct default_delete<remove_pointer<AudioConverterRef>::type> { +template<> struct default_delete<remove_pointer<AudioConverterRef>::type> { void operator()(AudioConverterRef converter) { AudioConverterDispose(converter); @@ -158,15 +154,16 @@ } -template <typename T> +template<typename T> using cf_ptr = unique_ptr<typename remove_pointer<T>::type>; #ifndef _MSC_VER __attribute__((__format__(__printf__, 3, 4))) #endif -static void log_to_dstr(DStr &str, ca_encoder *ca, const char *fmt, ...) +static void +log_to_dstr(DStr &str, ca_encoder *ca, const char *fmt, ...) { - dstr prev_str = *static_cast<dstr*>(str); + dstr prev_str = *static_cast<dstr *>(str); va_list args; va_start(args, fmt); @@ -184,12 +181,15 @@ array[4095] = 0; if (!prev_str.array && !prev_str.len) - CA_CO_LOG(LOG_ERROR, "Could not allocate buffer for logging:" - "\n'%s'", array); + CA_CO_LOG(LOG_ERROR, + "Could not allocate buffer for logging:" + "\n'%s'", + array); else - CA_CO_LOG(LOG_ERROR, "Could not allocate buffer for logging:" - "\n'%s'\nPrevious log entries:\n%s", - array, prev_str.array); + CA_CO_LOG(LOG_ERROR, + "Could not allocate buffer for logging:" + "\n'%s'\nPrevious log entries:\n%s", + array, prev_str.array); bfree(prev_str.array); } @@ -208,13 +208,12 @@ } #define CA_CO_DLOG_(level, format) \ - CA_CO_LOG(level, format "%s%s", \ - log->array ? ":\n" : "", flush_log(log)) -#define CA_CO_DLOG(level, format, ...) \ + CA_CO_LOG(level, format "%s%s", log->array ? ":\n" : "", flush_log(log)) +#define CA_CO_DLOG(level, format, ...) \ CA_CO_LOG(level, format "%s%s", ##__VA_ARGS__, \ - log->array ? ":\n" : "", flush_log(log)) + log->array ? ":\n" : "", flush_log(log)) -static const char *aac_get_name(void*) +static const char *aac_get_name(void *) { return obs_module_text("CoreAudioAAC"); } @@ -222,28 +221,31 @@ static const char *code_to_str(OSStatus code) { switch (code) { -#define HANDLE_CODE(c) case c: return #c - HANDLE_CODE(kAudio_UnimplementedError); - HANDLE_CODE(kAudio_FileNotFoundError); - HANDLE_CODE(kAudio_FilePermissionError); - HANDLE_CODE(kAudio_TooManyFilesOpenError); - HANDLE_CODE(kAudio_BadFilePathError); - HANDLE_CODE(kAudio_ParamError); - HANDLE_CODE(kAudio_MemFullError); - - HANDLE_CODE(kAudioConverterErr_FormatNotSupported); - HANDLE_CODE(kAudioConverterErr_OperationNotSupported); - HANDLE_CODE(kAudioConverterErr_PropertyNotSupported); - HANDLE_CODE(kAudioConverterErr_InvalidInputSize); - HANDLE_CODE(kAudioConverterErr_InvalidOutputSize); - HANDLE_CODE(kAudioConverterErr_UnspecifiedError); - HANDLE_CODE(kAudioConverterErr_BadPropertySizeError); - HANDLE_CODE(kAudioConverterErr_RequiresPacketDescriptionsError); - HANDLE_CODE(kAudioConverterErr_InputSampleRateOutOfRange); - HANDLE_CODE(kAudioConverterErr_OutputSampleRateOutOfRange); +#define HANDLE_CODE(c) \ + case c: \ + return #c + HANDLE_CODE(kAudio_UnimplementedError); + HANDLE_CODE(kAudio_FileNotFoundError); + HANDLE_CODE(kAudio_FilePermissionError); + HANDLE_CODE(kAudio_TooManyFilesOpenError); + HANDLE_CODE(kAudio_BadFilePathError); + HANDLE_CODE(kAudio_ParamError); + HANDLE_CODE(kAudio_MemFullError); + + HANDLE_CODE(kAudioConverterErr_FormatNotSupported); + HANDLE_CODE(kAudioConverterErr_OperationNotSupported); + HANDLE_CODE(kAudioConverterErr_PropertyNotSupported); + HANDLE_CODE(kAudioConverterErr_InvalidInputSize); + HANDLE_CODE(kAudioConverterErr_InvalidOutputSize); + HANDLE_CODE(kAudioConverterErr_UnspecifiedError); + HANDLE_CODE(kAudioConverterErr_BadPropertySizeError); + HANDLE_CODE(kAudioConverterErr_RequiresPacketDescriptionsError); + HANDLE_CODE(kAudioConverterErr_InputSampleRateOutOfRange); + HANDLE_CODE(kAudioConverterErr_OutputSampleRateOutOfRange); #undef HANDLE_CODE - default: break; + default: + break; } return NULL; @@ -254,8 +256,8 @@ DStr result; #ifndef _WIN32 - cf_ptr<CFErrorRef> err{CFErrorCreate(kCFAllocatorDefault, - kCFErrorDomainOSStatus, code, NULL)}; + cf_ptr<CFErrorRef> err{CFErrorCreate( + kCFAllocatorDefault, kCFErrorDomainOSStatus, code, NULL)}; cf_ptr<CFStringRef> str{CFErrorCopyDescription(err.get())}; if (cfstr_copy_dstr(str.get(), kCFStringEncodingUTF8, result)) @@ -263,16 +265,14 @@ #endif const char *code_str = code_to_str(code); - dstr_printf(result, "%s%s%d%s", - code_str ? code_str : "", - code_str ? " (" : "", - static_cast<int>(code), - code_str ? ")" : ""); + dstr_printf(result, "%s%s%d%s", code_str ? code_str : "", + code_str ? " (" : "", static_cast<int>(code), + code_str ? ")" : ""); return result; } static void log_osstatus(int log_level, ca_encoder *ca, const char *context, - OSStatus code) + OSStatus code) { DStr str = osstatus_to_dstr(code); if (ca) @@ -283,42 +283,44 @@ static const char *format_id_to_str(UInt32 format_id) { -#define FORMAT_TO_STR(x) case x: return #x +#define FORMAT_TO_STR(x) \ + case x: \ + return #x switch (format_id) { - FORMAT_TO_STR(kAudioFormatLinearPCM); - FORMAT_TO_STR(kAudioFormatAC3); - FORMAT_TO_STR(kAudioFormat60958AC3); - FORMAT_TO_STR(kAudioFormatAppleIMA4); - FORMAT_TO_STR(kAudioFormatMPEG4AAC); - FORMAT_TO_STR(kAudioFormatMPEG4CELP); - FORMAT_TO_STR(kAudioFormatMPEG4HVXC); - FORMAT_TO_STR(kAudioFormatMPEG4TwinVQ); - FORMAT_TO_STR(kAudioFormatMACE3); - FORMAT_TO_STR(kAudioFormatMACE6); - FORMAT_TO_STR(kAudioFormatULaw); - FORMAT_TO_STR(kAudioFormatALaw); - FORMAT_TO_STR(kAudioFormatQDesign); - FORMAT_TO_STR(kAudioFormatQDesign2); - FORMAT_TO_STR(kAudioFormatQUALCOMM); - FORMAT_TO_STR(kAudioFormatMPEGLayer1); - FORMAT_TO_STR(kAudioFormatMPEGLayer2); - FORMAT_TO_STR(kAudioFormatMPEGLayer3); - FORMAT_TO_STR(kAudioFormatTimeCode); - FORMAT_TO_STR(kAudioFormatMIDIStream); - FORMAT_TO_STR(kAudioFormatParameterValueStream); - FORMAT_TO_STR(kAudioFormatAppleLossless); - FORMAT_TO_STR(kAudioFormatMPEG4AAC_HE); - FORMAT_TO_STR(kAudioFormatMPEG4AAC_LD); - FORMAT_TO_STR(kAudioFormatMPEG4AAC_ELD); - FORMAT_TO_STR(kAudioFormatMPEG4AAC_ELD_SBR); - FORMAT_TO_STR(kAudioFormatMPEG4AAC_HE_V2); - FORMAT_TO_STR(kAudioFormatMPEG4AAC_Spatial); - FORMAT_TO_STR(kAudioFormatAMR); - FORMAT_TO_STR(kAudioFormatAudible); - FORMAT_TO_STR(kAudioFormatiLBC); - FORMAT_TO_STR(kAudioFormatDVIIntelIMA); - FORMAT_TO_STR(kAudioFormatMicrosoftGSM); - FORMAT_TO_STR(kAudioFormatAES3); + FORMAT_TO_STR(kAudioFormatLinearPCM); + FORMAT_TO_STR(kAudioFormatAC3); + FORMAT_TO_STR(kAudioFormat60958AC3); + FORMAT_TO_STR(kAudioFormatAppleIMA4); + FORMAT_TO_STR(kAudioFormatMPEG4AAC); + FORMAT_TO_STR(kAudioFormatMPEG4CELP); + FORMAT_TO_STR(kAudioFormatMPEG4HVXC); + FORMAT_TO_STR(kAudioFormatMPEG4TwinVQ); + FORMAT_TO_STR(kAudioFormatMACE3); + FORMAT_TO_STR(kAudioFormatMACE6); + FORMAT_TO_STR(kAudioFormatULaw); + FORMAT_TO_STR(kAudioFormatALaw); + FORMAT_TO_STR(kAudioFormatQDesign); + FORMAT_TO_STR(kAudioFormatQDesign2); + FORMAT_TO_STR(kAudioFormatQUALCOMM); + FORMAT_TO_STR(kAudioFormatMPEGLayer1); + FORMAT_TO_STR(kAudioFormatMPEGLayer2); + FORMAT_TO_STR(kAudioFormatMPEGLayer3); + FORMAT_TO_STR(kAudioFormatTimeCode); + FORMAT_TO_STR(kAudioFormatMIDIStream); + FORMAT_TO_STR(kAudioFormatParameterValueStream); + FORMAT_TO_STR(kAudioFormatAppleLossless); + FORMAT_TO_STR(kAudioFormatMPEG4AAC_HE); + FORMAT_TO_STR(kAudioFormatMPEG4AAC_LD); + FORMAT_TO_STR(kAudioFormatMPEG4AAC_ELD); + FORMAT_TO_STR(kAudioFormatMPEG4AAC_ELD_SBR); + FORMAT_TO_STR(kAudioFormatMPEG4AAC_HE_V2); + FORMAT_TO_STR(kAudioFormatMPEG4AAC_Spatial); + FORMAT_TO_STR(kAudioFormatAMR); + FORMAT_TO_STR(kAudioFormatAudible); + FORMAT_TO_STR(kAudioFormatiLBC); + FORMAT_TO_STR(kAudioFormatDVIIntelIMA); + FORMAT_TO_STR(kAudioFormatMicrosoftGSM); + FORMAT_TO_STR(kAudioFormatAES3); } #undef FORMAT_TO_STR @@ -327,23 +329,25 @@ static void aac_destroy(void *data) { - ca_encoder *ca = static_cast<ca_encoder*>(data); + ca_encoder *ca = static_cast<ca_encoder *>(data); delete ca; } -template <typename Func> +template<typename Func> static bool query_converter_property_raw(DStr &log, ca_encoder *ca, - AudioFormatPropertyID property, - const char *get_property_info, const char *get_property, - AudioConverterRef converter, Func &&func) + AudioFormatPropertyID property, + const char *get_property_info, + const char *get_property, + AudioConverterRef converter, + Func &&func) { UInt32 size = 0; OSStatus code = AudioConverterGetPropertyInfo(converter, property, - &size, nullptr); + &size, nullptr); if (code) { log_to_dstr(log, ca, "%s: %s\n", get_property_info, - osstatus_to_dstr(code)->array); + osstatus_to_dstr(code)->array); return false; } @@ -353,57 +357,56 @@ } vector<uint8_t> buffer; - + try { buffer.resize(size); } catch (...) { log_to_dstr(log, ca, "Failed to allocate %u bytes for %s\n", - static_cast<uint32_t>(size), get_property); + static_cast<uint32_t>(size), get_property); return false; } code = AudioConverterGetProperty(converter, property, &size, - buffer.data()); + buffer.data()); if (code) { log_to_dstr(log, ca, "%s: %s\n", get_property, - osstatus_to_dstr(code)->array); + osstatus_to_dstr(code)->array); return false; } - func(size, static_cast<void*>(buffer.data())); + func(size, static_cast<void *>(buffer.data())); return true; } -#define EXPAND_CONVERTER_NAMES(x) x, \ - "AudioConverterGetPropertyInfo(" #x ")", \ - "AudioConverterGetProperty(" #x ")" +#define EXPAND_CONVERTER_NAMES(x) \ + x, "AudioConverterGetPropertyInfo(" #x ")", \ + "AudioConverterGetProperty(" #x ")" -template <typename Func> +template<typename Func> static bool enumerate_bitrates(DStr &log, ca_encoder *ca, - AudioConverterRef converter, Func &&func) + AudioConverterRef converter, Func &&func) { - auto helper = [&](UInt32 size, void *data) - { - auto range = static_cast<AudioValueRange*>(data); + auto helper = [&](UInt32 size, void *data) { + auto range = static_cast<AudioValueRange *>(data); size_t num_ranges = size / sizeof(AudioValueRange); for (size_t i = 0; i < num_ranges; i++) func(static_cast<UInt32>(range[i].mMinimum), - static_cast<UInt32>(range[i].mMaximum)); + static_cast<UInt32>(range[i].mMaximum)); }; - return query_converter_property_raw(log, ca, EXPAND_CONVERTER_NAMES( - kAudioConverterApplicableEncodeBitRates), - converter, helper); + return query_converter_property_raw( + log, ca, + EXPAND_CONVERTER_NAMES(kAudioConverterApplicableEncodeBitRates), + converter, helper); } static bool bitrate_valid(DStr &log, ca_encoder *ca, - AudioConverterRef converter, UInt32 bitrate) + AudioConverterRef converter, UInt32 bitrate) { bool valid = false; - auto helper = [&](UInt32 min_, UInt32 max_) - { + auto helper = [&](UInt32 min_, UInt32 max_) { if (min_ == bitrate || max_ == bitrate) valid = true; }; @@ -414,47 +417,47 @@ } static bool create_encoder(DStr &log, ca_encoder *ca, - AudioStreamBasicDescription *in, - AudioStreamBasicDescription *out, - UInt32 format_id, UInt32 bitrate, UInt32 samplerate, - UInt32 rate_control) + AudioStreamBasicDescription *in, + AudioStreamBasicDescription *out, UInt32 format_id, + UInt32 bitrate, UInt32 samplerate, + UInt32 rate_control) { -#define STATUS_CHECK(c) \ - code = c; \ - if (code) { \ - log_to_dstr(log, ca, #c " returned %s", \ - osstatus_to_dstr(code)->array); \ - return false; \ +#define STATUS_CHECK(c) \ + code = c; \ + if (code) { \ + log_to_dstr(log, ca, #c " returned %s", \ + osstatus_to_dstr(code)->array); \ + return false; \ } - Float64 srate = samplerate ? - (Float64)samplerate : - (Float64)ca->samples_per_second; + Float64 srate = samplerate ? (Float64)samplerate + : (Float64)ca->samples_per_second; auto out_ = asbd_builder() - .sample_rate(srate) - .channels_per_frame((UInt32)ca->channels) - .format_id(format_id) - .asbd; + .sample_rate(srate) + .channels_per_frame((UInt32)ca->channels) + .format_id(format_id) + .asbd; UInt32 size = sizeof(*out); OSStatus code; - STATUS_CHECK(AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, - 0, NULL, &size, &out_)); + STATUS_CHECK(AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, + NULL, &size, &out_)); *out = out_; STATUS_CHECK(AudioConverterNew(in, out, &ca->converter)) - STATUS_CHECK(AudioConverterSetProperty(ca->converter, - kAudioCodecPropertyBitRateControlMode, - sizeof(rate_control), &rate_control)); + STATUS_CHECK(AudioConverterSetProperty( + ca->converter, kAudioCodecPropertyBitRateControlMode, + sizeof(rate_control), &rate_control)); if (!bitrate_valid(log, ca, ca->converter, bitrate)) { - log_to_dstr(log, ca, "Encoder does not support bitrate %u " - "for format %s (0x%x)\n", - (uint32_t)bitrate, format_id_to_str(format_id), - (uint32_t)format_id); + log_to_dstr(log, ca, + "Encoder does not support bitrate %u " + "for format %s (0x%x)\n", + (uint32_t)bitrate, format_id_to_str(format_id), + (uint32_t)format_id); return false; } @@ -476,17 +479,17 @@ static void *aac_create(obs_data_t *settings, obs_encoder_t *encoder) { -#define STATUS_CHECK(c) \ - code = c; \ - if (code) { \ +#define STATUS_CHECK(c) \ + code = c; \ + if (code) { \ log_osstatus(LOG_ERROR, ca.get(), #c, code); \ - return nullptr; \ + return nullptr; \ } UInt32 bitrate = (UInt32)obs_data_get_int(settings, "bitrate") * 1000; if (!bitrate) { CA_LOG_ENCODER("AAC", encoder, LOG_ERROR, - "Invalid bitrate specified"); + "Invalid bitrate specified"); return NULL; } @@ -494,7 +497,7 @@ if (is_audio_planar(format)) { CA_LOG_ENCODER("AAC", encoder, LOG_ERROR, - "Got non-interleaved audio format %d", format); + "Got non-interleaved audio format %d", format); return NULL; } @@ -504,7 +507,7 @@ ca.reset(new ca_encoder()); } catch (...) { CA_LOG_ENCODER("AAC", encoder, LOG_ERROR, - "Could not allocate encoder"); + "Could not allocate encoder"); return nullptr; } @@ -517,22 +520,21 @@ ca->channels = audio_output_get_channels(audio); ca->samples_per_second = audio_output_get_sample_rate(audio); - size_t bytes_per_frame = get_audio_size(format, aoi->speakers, 1); + size_t bytes_per_frame = get_audio_size(format, aoi->speakers, 1); size_t bits_per_channel = get_audio_bytes_per_channel(format) * 8; auto in = asbd_builder() - .sample_rate((Float64)ca->samples_per_second) - .channels_per_frame((UInt32)ca->channels) - .bytes_per_frame((UInt32)bytes_per_frame) - .frames_per_packet(1) - .bytes_per_packet((UInt32)(1 * bytes_per_frame)) - .bits_per_channel((UInt32)bits_per_channel) - .format_id(kAudioFormatLinearPCM) - .format_flags(kAudioFormatFlagsNativeEndian | - kAudioFormatFlagIsPacked | - kAudioFormatFlagIsFloat | - 0) - .asbd; + .sample_rate((Float64)ca->samples_per_second) + .channels_per_frame((UInt32)ca->channels) + .bytes_per_frame((UInt32)bytes_per_frame) + .frames_per_packet(1) + .bytes_per_packet((UInt32)(1 * bytes_per_frame)) + .bits_per_channel((UInt32)bits_per_channel) + .format_id(kAudioFormatLinearPCM) + .format_flags(kAudioFormatFlagsNativeEndian | + kAudioFormatFlagIsPacked | + kAudioFormatFlagIsFloat | 0) + .asbd; AudioStreamBasicDescription out; @@ -552,11 +554,10 @@ bool encoder_created = false; for (UInt32 format_id : *ca->allowed_formats) { log_to_dstr(log, ca.get(), "Trying format %s (0x%x)\n", - format_id_to_str(format_id), - (uint32_t)format_id); + format_id_to_str(format_id), (uint32_t)format_id); if (!create_encoder(log, ca.get(), &in, &out, format_id, - bitrate, samplerate, rate_control)) + bitrate, samplerate, rate_control)) continue; encoder_created = true; @@ -564,9 +565,10 @@ } if (!encoder_created) { - CA_CO_DLOG(LOG_ERROR, "Could not create encoder for " - "selected format%s", - ca->allowed_formats->size() == 1 ? "" : "s"); + CA_CO_DLOG(LOG_ERROR, + "Could not create encoder for " + "selected format%s", + ca->allowed_formats->size() == 1 ? "" : "s"); return nullptr; } @@ -575,23 +577,23 @@ OSStatus code; UInt32 converter_quality = kAudioConverterQuality_Max; - STATUS_CHECK(AudioConverterSetProperty(ca->converter, - kAudioConverterCodecQuality, - sizeof(converter_quality), &converter_quality)); + STATUS_CHECK(AudioConverterSetProperty( + ca->converter, kAudioConverterCodecQuality, + sizeof(converter_quality), &converter_quality)); STATUS_CHECK(AudioConverterSetProperty(ca->converter, - kAudioConverterEncodeBitRate, - sizeof(bitrate), &bitrate)); + kAudioConverterEncodeBitRate, + sizeof(bitrate), &bitrate)); UInt32 size = sizeof(in); - STATUS_CHECK(AudioConverterGetProperty(ca->converter, - kAudioConverterCurrentInputStreamDescription, - &size, &in)); + STATUS_CHECK(AudioConverterGetProperty( + ca->converter, kAudioConverterCurrentInputStreamDescription, + &size, &in)); size = sizeof(out); - STATUS_CHECK(AudioConverterGetProperty(ca->converter, - kAudioConverterCurrentOutputStreamDescription, - &size, &out)); + STATUS_CHECK(AudioConverterGetProperty( + ca->converter, kAudioConverterCurrentOutputStreamDescription, + &size, &out)); /* * Fix channel map differences between CoreAudio AAC, FFmpeg, Wav @@ -600,30 +602,30 @@ if (ca->channels == 3) { SInt32 channelMap3[3] = {2, 0, 1}; AudioConverterSetProperty(ca->converter, - kAudioConverterChannelMap, - sizeof(channelMap3), channelMap3); + kAudioConverterChannelMap, + sizeof(channelMap3), channelMap3); } else if (ca->channels == 5) { SInt32 channelMap5[5] = {2, 0, 1, 3, 4}; AudioConverterSetProperty(ca->converter, - kAudioConverterChannelMap, - sizeof(channelMap5), channelMap5); + kAudioConverterChannelMap, + sizeof(channelMap5), channelMap5); } else if (ca->channels == 6) { SInt32 channelMap6[6] = {2, 0, 1, 4, 5, 3}; AudioConverterSetProperty(ca->converter, - kAudioConverterChannelMap, - sizeof(channelMap6), channelMap6); + kAudioConverterChannelMap, + sizeof(channelMap6), channelMap6); } else if (ca->channels == 8) { SInt32 channelMap8[8] = {2, 0, 1, 6, 7, 4, 5, 3}; AudioConverterSetProperty(ca->converter, - kAudioConverterChannelMap, - sizeof(channelMap8), channelMap8); + kAudioConverterChannelMap, + sizeof(channelMap8), channelMap8); } - ca->in_frame_size = in.mBytesPerFrame; - ca->in_packets = out.mFramesPerPacket / in.mFramesPerPacket; + ca->in_frame_size = in.mBytesPerFrame; + ca->in_packets = out.mFramesPerPacket / in.mFramesPerPacket; ca->in_bytes_required = ca->in_packets * ca->in_frame_size; ca->out_frames_per_packet = out.mFramesPerPacket; @@ -633,14 +635,15 @@ if (out.mBytesPerPacket == 0) { UInt32 max_packet_size = 0; size = sizeof(max_packet_size); - - code = AudioConverterGetProperty(ca->converter, - kAudioConverterPropertyMaximumOutputPacketSize, - &size, &max_packet_size); + + code = AudioConverterGetProperty( + ca->converter, + kAudioConverterPropertyMaximumOutputPacketSize, &size, + &max_packet_size); if (code) { log_osstatus(LOG_WARNING, ca.get(), - "AudioConverterGetProperty(PacketSz)", - code); + "AudioConverterGetProperty(PacketSz)", + code); ca->output_buffer_size = 32768; } else { ca->output_buffer_size = max_packet_size; @@ -655,33 +658,37 @@ } const char *format_name = - out.mFormatID == kAudioFormatMPEG4AAC_HE_V2 ? "HE-AAC v2" : - out.mFormatID == kAudioFormatMPEG4AAC_HE ? "HE-AAC" : "AAC"; - CA_BLOG(LOG_INFO, "settings:\n" - "\tmode: %s\n" - "\tbitrate: %u\n" - "\tsample rate: %llu\n" - "\tcbr: %s\n" - "\toutput buffer: %lu", - format_name, (unsigned int)bitrate / 1000, - ca->samples_per_second, - rate_control == kAudioCodecBitRateControlMode_Constant ? - "on" : "off", - (unsigned long)ca->output_buffer_size); + out.mFormatID == kAudioFormatMPEG4AAC_HE_V2 + ? "HE-AAC v2" + : out.mFormatID == kAudioFormatMPEG4AAC_HE ? "HE-AAC" + : "AAC"; + CA_BLOG(LOG_INFO, + "settings:\n" + "\tmode: %s\n" + "\tbitrate: %u\n" + "\tsample rate: %llu\n" + "\tcbr: %s\n" + "\toutput buffer: %lu", + format_name, (unsigned int)bitrate / 1000, + ca->samples_per_second, + rate_control == kAudioCodecBitRateControlMode_Constant ? "on" + : "off", + (unsigned long)ca->output_buffer_size); return ca.release(); #undef STATUS_CHECK } -static OSStatus complex_input_data_proc(AudioConverterRef inAudioConverter, - UInt32 *ioNumberDataPackets, AudioBufferList *ioData, - AudioStreamPacketDescription **outDataPacketDescription, - void *inUserData) +static OSStatus +complex_input_data_proc(AudioConverterRef inAudioConverter, + UInt32 *ioNumberDataPackets, AudioBufferList *ioData, + AudioStreamPacketDescription **outDataPacketDescription, + void *inUserData) { UNUSED_PARAMETER(inAudioConverter); UNUSED_PARAMETER(outDataPacketDescription); - ca_encoder *ca = static_cast<ca_encoder*>(inUserData); + ca_encoder *ca = static_cast<ca_encoder *>(inUserData); if (ca->input_buffer.size() < ca->in_bytes_required) { *ioNumberDataPackets = 0; @@ -690,7 +697,7 @@ } auto start = begin(ca->input_buffer); - auto stop = begin(ca->input_buffer) + ca->in_bytes_required; + auto stop = begin(ca->input_buffer) + ca->in_bytes_required; ca->encode_buffer.assign(start, stop); ca->input_buffer.erase(start, stop); @@ -709,35 +716,35 @@ // disable warning that recommends if ((foo = bar > 0) == false) over // if (!(foo = bar > 0)) #pragma warning(push) -#pragma warning(disable: 4706) +#pragma warning(disable : 4706) #endif static bool aac_encode(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, bool *received_packet) { - ca_encoder *ca = static_cast<ca_encoder*>(data); + ca_encoder *ca = static_cast<ca_encoder *>(data); - ca->input_buffer.insert(end(ca->input_buffer), - frame->data[0], frame->data[0] + frame->linesize[0]); + ca->input_buffer.insert(end(ca->input_buffer), frame->data[0], + frame->data[0] + frame->linesize[0]); if (ca->input_buffer.size() < ca->in_bytes_required) return true; UInt32 packets = 1; - AudioBufferList buffer_list = { 0 }; + AudioBufferList buffer_list = {0}; buffer_list.mNumberBuffers = 1; buffer_list.mBuffers[0].mNumberChannels = (UInt32)ca->channels; buffer_list.mBuffers[0].mDataByteSize = (UInt32)ca->output_buffer_size; buffer_list.mBuffers[0].mData = ca->output_buffer.data(); - AudioStreamPacketDescription out_desc = { 0 }; + AudioStreamPacketDescription out_desc = {0}; - OSStatus code = AudioConverterFillComplexBuffer(ca->converter, - complex_input_data_proc, ca, &packets, - &buffer_list, &out_desc); + OSStatus code = AudioConverterFillComplexBuffer( + ca->converter, complex_input_data_proc, ca, &packets, + &buffer_list, &out_desc); if (code && code != 1) { log_osstatus(LOG_ERROR, ca, "AudioConverterFillComplexBuffer", - code); + code); return false; } @@ -750,8 +757,8 @@ packet->timebase_den = (uint32_t)ca->samples_per_second; packet->type = OBS_ENCODER_AUDIO; packet->size = out_desc.mDataByteSize; - packet->data = - (uint8_t*)buffer_list.mBuffers[0].mData + out_desc.mStartOffset; + packet->data = (uint8_t *)buffer_list.mBuffers[0].mData + + out_desc.mStartOffset; ca->total_samples += ca->in_bytes_required / ca->in_frame_size; @@ -770,22 +777,21 @@ static size_t aac_frame_size(void *data) { - ca_encoder *ca = static_cast<ca_encoder*>(data); + ca_encoder *ca = static_cast<ca_encoder *>(data); return ca->out_frames_per_packet; } /* The following code was extracted from encca_aac.c in HandBrake's libhb */ -#define MP4ESDescrTag 0x03 -#define MP4DecConfigDescrTag 0x04 -#define MP4DecSpecificDescrTag 0x05 +#define MP4ESDescrTag 0x03 +#define MP4DecConfigDescrTag 0x04 +#define MP4DecSpecificDescrTag 0x05 // based off of mov_mp4_read_descr_len from mov.c in ffmpeg's libavformat static int read_descr_len(uint8_t **buffer) { int len = 0; int count = 4; - while (count--) - { + while (count--) { int c = *(*buffer)++; len = (len << 7) | (c & 0x7f); if (!(c & 0x80)) @@ -802,8 +808,8 @@ } // based off of mov_read_esds from mov.c in ffmpeg's libavformat -static void read_esds_desc_ext(uint8_t* desc_ext, vector<uint8_t> &buffer, - bool version_flags) +static void read_esds_desc_ext(uint8_t *desc_ext, vector<uint8_t> &buffer, + bool version_flags) { uint8_t *esds = desc_ext; int tag, len; @@ -812,9 +818,9 @@ esds += 4; // version + flags read_descr(&esds, &tag); - esds += 2; // ID + esds += 2; // ID if (tag == MP4ESDescrTag) - esds++; // priority + esds++; // priority read_descr(&esds, &tag); if (tag == MP4DecConfigDescrTag) { @@ -840,13 +846,13 @@ UInt32 size = 0; OSStatus code; - code = AudioConverterGetPropertyInfo(ca->converter, - kAudioConverterCompressionMagicCookie, - &size, NULL); + code = AudioConverterGetPropertyInfo( + ca->converter, kAudioConverterCompressionMagicCookie, &size, + NULL); if (code) { log_osstatus(LOG_ERROR, ca, - "AudioConverterGetPropertyInfo(magic_cookie)", - code); + "AudioConverterGetPropertyInfo(magic_cookie)", + code); return; } @@ -856,7 +862,7 @@ } vector<uint8_t> extra_data; - + try { extra_data.resize(size); } catch (...) { @@ -865,12 +871,11 @@ } code = AudioConverterGetProperty(ca->converter, - kAudioConverterCompressionMagicCookie, - &size, extra_data.data()); + kAudioConverterCompressionMagicCookie, + &size, extra_data.data()); if (code) { log_osstatus(LOG_ERROR, ca, - "AudioConverterGetProperty(magic_cookie)", - code); + "AudioConverterGetProperty(magic_cookie)", code); return; } @@ -884,7 +889,7 @@ static bool aac_extra_data(void *data, uint8_t **extra_data, size_t *size) { - ca_encoder *ca = static_cast<ca_encoder*>(data); + ca_encoder *ca = static_cast<ca_encoder *>(data); if (!ca->extra_data.size()) query_extra_data(ca); @@ -898,7 +903,8 @@ } static asbd_builder fill_common_asbd_fields(asbd_builder builder, - bool in=false, UInt32 channels=2) + bool in = false, + UInt32 channels = 2) { UInt32 bytes_per_frame = sizeof(float) * channels; UInt32 bits_per_channel = bytes_per_frame / channels * 8; @@ -906,8 +912,7 @@ builder.channels_per_frame(channels); if (in) { - builder - .bytes_per_frame(bytes_per_frame) + builder.bytes_per_frame(bytes_per_frame) .frames_per_packet(1) .bytes_per_packet(1 * bytes_per_frame) .bits_per_channel(bits_per_channel); @@ -922,9 +927,8 @@ .sample_rate(44100) .format_id(kAudioFormatLinearPCM) .format_flags(kAudioFormatFlagsNativeEndian | - kAudioFormatFlagIsPacked | - kAudioFormatFlagIsFloat | - 0) + kAudioFormatFlagIsPacked | + kAudioFormatFlagIsFloat | 0) .asbd; } @@ -934,23 +938,23 @@ .sample_rate(44100); } -static cf_ptr<AudioConverterRef> get_converter(DStr &log, ca_encoder *ca, - AudioStreamBasicDescription out, - AudioStreamBasicDescription in = get_default_in_asbd()) +static cf_ptr<AudioConverterRef> +get_converter(DStr &log, ca_encoder *ca, AudioStreamBasicDescription out, + AudioStreamBasicDescription in = get_default_in_asbd()) { UInt32 size = sizeof(out); OSStatus code; -#define STATUS_CHECK(x) \ - code = x; \ - if (code) { \ - log_to_dstr(log, ca, "%s: %s\n", #x, \ - osstatus_to_dstr(code)->array); \ - return nullptr; \ +#define STATUS_CHECK(x) \ + code = x; \ + if (code) { \ + log_to_dstr(log, ca, "%s: %s\n", #x, \ + osstatus_to_dstr(code)->array); \ + return nullptr; \ } - STATUS_CHECK(AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, - 0, NULL, &size, &out)); + STATUS_CHECK(AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, + NULL, &size, &out)); AudioConverterRef converter; STATUS_CHECK(AudioConverterNew(&in, &out, &converter)); @@ -960,50 +964,47 @@ } static bool find_best_match(DStr &log, ca_encoder *ca, UInt32 bitrate, - UInt32 &best_match) + UInt32 &best_match) { UInt32 actual_bitrate = bitrate * 1000; bool found_match = false; - auto handle_bitrate = [&](UInt32 candidate) - { + auto handle_bitrate = [&](UInt32 candidate) { if (abs(static_cast<intmax_t>(actual_bitrate - candidate)) < abs(static_cast<intmax_t>(actual_bitrate - best_match))) { log_to_dstr(log, ca, "Found new best match %u\n", - static_cast<uint32_t>(candidate)); + static_cast<uint32_t>(candidate)); found_match = true; best_match = candidate; } }; - auto helper = [&](UInt32 min_, UInt32 max_) - { + auto helper = [&](UInt32 min_, UInt32 max_) { handle_bitrate(min_); if (min_ == max_) return; log_to_dstr(log, ca, "Got actual bit rate range: %u<->%u\n", - static_cast<uint32_t>(min_), - static_cast<uint32_t>(max_)); + static_cast<uint32_t>(min_), + static_cast<uint32_t>(max_)); handle_bitrate(max_); }; for (UInt32 format_id : aac_formats) { log_to_dstr(log, ca, "Trying %s (0x%x)\n", - format_id_to_str(format_id), format_id); + format_id_to_str(format_id), format_id); auto out = get_default_out_asbd_builder(2) - .format_id(format_id) - .asbd; + .format_id(format_id) + .asbd; auto converter = get_converter(log, ca, out); if (converter) - enumerate_bitrates(log, ca, converter.get(), - helper); + enumerate_bitrates(log, ca, converter.get(), helper); else log_to_dstr(log, ca, "Could not get converter\n"); } @@ -1019,32 +1020,34 @@ static once_flag once; - call_once(once, [&]() - { + call_once(once, [&]() { DStr log; ca_encoder *ca = nullptr; if (!find_best_match(log, ca, bitrate, match)) { - CA_CO_DLOG(LOG_ERROR, "No matching bitrates found for " - "target bitrate %u", - static_cast<uint32_t>(bitrate)); + CA_CO_DLOG(LOG_ERROR, + "No matching bitrates found for " + "target bitrate %u", + static_cast<uint32_t>(bitrate)); match = bitrate; return; } if (match != bitrate) { - CA_CO_DLOG(LOG_INFO, "Default bitrate (%u) isn't " - "supported, returning %u as closest match", - static_cast<uint32_t>(bitrate), - static_cast<uint32_t>(match)); + CA_CO_DLOG(LOG_INFO, + "Default bitrate (%u) isn't " + "supported, returning %u as closest match", + static_cast<uint32_t>(bitrate), + static_cast<uint32_t>(match)); return; } if (log->len) - CA_CO_DLOG(LOG_DEBUG, "Default bitrate matching log " - "for bitrate %u", - static_cast<uint32_t>(bitrate)); + CA_CO_DLOG(LOG_DEBUG, + "Default bitrate matching log " + "for bitrate %u", + static_cast<uint32_t>(bitrate)); }); return match; @@ -1054,22 +1057,22 @@ { obs_data_set_default_int(settings, "samplerate", 0); //match input obs_data_set_default_int(settings, "bitrate", - find_matching_bitrate(128)); + find_matching_bitrate(128)); obs_data_set_default_bool(settings, "allow he-aac", true); } -template <typename Func> -static bool query_property_raw(DStr &log, ca_encoder *ca, - AudioFormatPropertyID property, - const char *get_property_info, const char *get_property, - AudioStreamBasicDescription &desc, Func &&func) +template<typename Func> +static bool +query_property_raw(DStr &log, ca_encoder *ca, AudioFormatPropertyID property, + const char *get_property_info, const char *get_property, + AudioStreamBasicDescription &desc, Func &&func) { UInt32 size = 0; - OSStatus code = AudioFormatGetPropertyInfo(property, - sizeof(AudioStreamBasicDescription), &desc, &size); + OSStatus code = AudioFormatGetPropertyInfo( + property, sizeof(AudioStreamBasicDescription), &desc, &size); if (code) { log_to_dstr(log, ca, "%s: %s\n", get_property_info, - osstatus_to_dstr(code)->array); + osstatus_to_dstr(code)->array); return false; } @@ -1079,48 +1082,50 @@ } vector<uint8_t> buffer; - + try { buffer.resize(size); } catch (...) { log_to_dstr(log, ca, "Failed to allocate %u bytes for %s\n", - static_cast<uint32_t>(size), get_property); + static_cast<uint32_t>(size), get_property); return false; } code = AudioFormatGetProperty(property, - sizeof(AudioStreamBasicDescription), &desc, &size, - buffer.data()); + sizeof(AudioStreamBasicDescription), + &desc, &size, buffer.data()); if (code) { log_to_dstr(log, ca, "%s: %s\n", get_property, - osstatus_to_dstr(code)->array); + osstatus_to_dstr(code)->array); return false; } - func(size, static_cast<void*>(buffer.data())); + func(size, static_cast<void *>(buffer.data())); return true; } -#define EXPAND_PROPERTY_NAMES(x) x, \ - "AudioFormatGetPropertyInfo(" #x ")", \ - "AudioFormatGetProperty(" #x ")" +#define EXPAND_PROPERTY_NAMES(x) \ + x, "AudioFormatGetPropertyInfo(" #x ")", \ + "AudioFormatGetProperty(" #x ")" -template <typename Func> +template<typename Func> static bool enumerate_samplerates(DStr &log, ca_encoder *ca, - AudioStreamBasicDescription &desc, Func &&func) + AudioStreamBasicDescription &desc, + Func &&func) { - auto helper = [&](UInt32 size, void *data) - { - auto range = static_cast<AudioValueRange*>(data); + auto helper = [&](UInt32 size, void *data) { + auto range = static_cast<AudioValueRange *>(data); size_t num_ranges = size / sizeof(AudioValueRange); for (size_t i = 0; i < num_ranges; i++) func(range[i]); }; - return query_property_raw(log, ca, EXPAND_PROPERTY_NAMES( + return query_property_raw( + log, ca, + EXPAND_PROPERTY_NAMES( kAudioFormatProperty_AvailableEncodeSampleRates), - desc, helper); + desc, helper); } #if 0 @@ -1149,21 +1154,19 @@ { vector<UInt32> samplerates; - auto handle_samplerate = [&](UInt32 rate) - { + auto handle_samplerate = [&](UInt32 rate) { if (find(begin(samplerates), end(samplerates), rate) == - end(samplerates)) { + end(samplerates)) { log_to_dstr(log, ca, "Adding sample rate %u\n", - static_cast<uint32_t>(rate)); + static_cast<uint32_t>(rate)); samplerates.push_back(rate); } else { log_to_dstr(log, ca, "Sample rate %u already added\n", - static_cast<uint32_t>(rate)); + static_cast<uint32_t>(rate)); } }; - auto helper = [&](const AudioValueRange &range) - { + auto helper = [&](const AudioValueRange &range) { auto min_ = static_cast<UInt32>(range.mMinimum); auto max_ = static_cast<UInt32>(range.mMaximum); @@ -1173,20 +1176,18 @@ return; log_to_dstr(log, ca, "Got actual sample rate range: %u<->%u\n", - static_cast<uint32_t>(min_), - static_cast<uint32_t>(max_)); + static_cast<uint32_t>(min_), + static_cast<uint32_t>(max_)); handle_samplerate(max_); }; for (UInt32 format : (ca ? *ca->allowed_formats : aac_formats)) { log_to_dstr(log, ca, "Trying %s (0x%x)\n", - format_id_to_str(format), - static_cast<uint32_t>(format)); + format_id_to_str(format), + static_cast<uint32_t>(format)); - auto asbd = asbd_builder() - .format_id(format) - .asbd; + auto asbd = asbd_builder().format_id(format).asbd; enumerate_samplerates(log, ca, asbd, helper); } @@ -1196,8 +1197,8 @@ static void add_samplerates(obs_property_t *prop, ca_encoder *ca) { - obs_property_list_add_int(prop, - obs_module_text("UseInputSampleRate"), 0); + obs_property_list_add_int(prop, obs_module_text("UseInputSampleRate"), + 0); DStr log; @@ -1223,7 +1224,7 @@ #define NBSP "\xC2\xA0" static vector<UInt32> get_bitrates(DStr &log, ca_encoder *ca, - Float64 samplerate) + Float64 samplerate) { vector<UInt32> bitrates; struct obs_audio_info aoi; @@ -1232,43 +1233,40 @@ obs_get_audio_info(&aoi); channels = get_audio_channels(aoi.speakers); - auto handle_bitrate = [&](UInt32 bitrate) - { + auto handle_bitrate = [&](UInt32 bitrate) { if (find(begin(bitrates), end(bitrates), bitrate) == - end(bitrates)) { + end(bitrates)) { log_to_dstr(log, ca, "Adding bitrate %u\n", - static_cast<uint32_t>(bitrate)); + static_cast<uint32_t>(bitrate)); bitrates.push_back(bitrate); } else { log_to_dstr(log, ca, "Bitrate %u already added\n", - static_cast<uint32_t>(bitrate)); + static_cast<uint32_t>(bitrate)); } }; - auto helper = [&](UInt32 min_, UInt32 max_) - { + auto helper = [&](UInt32 min_, UInt32 max_) { handle_bitrate(min_); if (min_ == max_) return; log_to_dstr(log, ca, "Got actual bitrate range: %u<->%u\n", - static_cast<uint32_t>(min_), - static_cast<uint32_t>(max_)); + static_cast<uint32_t>(min_), + static_cast<uint32_t>(max_)); handle_bitrate(max_); }; for (UInt32 format_id : (ca ? *ca->allowed_formats : aac_formats)) { log_to_dstr(log, ca, "Trying %s (0x%x) at %g" NBSP "hz\n", - format_id_to_str(format_id), - static_cast<uint32_t>(format_id), - samplerate); + format_id_to_str(format_id), + static_cast<uint32_t>(format_id), samplerate); auto out = get_default_out_asbd_builder(channels) - .format_id(format_id) - .sample_rate(samplerate) - .asbd; + .format_id(format_id) + .sample_rate(samplerate) + .asbd; auto converter = get_converter(log, ca, out); @@ -1280,7 +1278,8 @@ } static void add_bitrates(obs_property_t *prop, ca_encoder *ca, - Float64 samplerate=44100., UInt32 *selected=nullptr) + Float64 samplerate = 44100., + UInt32 *selected = nullptr) { obs_property_list_clear(prop); @@ -1299,7 +1298,7 @@ bool selected_in_range = true; if (selected) { selected_in_range = find(begin(bitrates), end(bitrates), - *selected * 1000) != end(bitrates); + *selected * 1000) != end(bitrates); if (!selected_in_range) bitrates.push_back(*selected * 1000); @@ -1311,7 +1310,7 @@ for (UInt32 bitrate : bitrates) { dstr_printf(buffer, "%u", (uint32_t)bitrate / 1000); size_t idx = obs_property_list_add_int(prop, buffer->array, - bitrate / 1000); + bitrate / 1000); if (selected_in_range || bitrate / 1000 != *selected) continue; @@ -1321,7 +1320,7 @@ } static bool samplerate_updated(obs_properties_t *props, obs_property_t *prop, - obs_data_t *settings) + obs_data_t *settings) { auto samplerate = static_cast<UInt32>(obs_data_get_int(settings, "samplerate")); @@ -1331,7 +1330,7 @@ prop = obs_properties_get(props, "bitrate"); if (prop) { auto bitrate = static_cast<UInt32>( - obs_data_get_int(settings, "bitrate")); + obs_data_get_int(settings, "bitrate")); add_bitrates(prop, nullptr, samplerate, &bitrate); @@ -1343,23 +1342,23 @@ static obs_properties_t *aac_properties(void *data) { - ca_encoder *ca = static_cast<ca_encoder*>(data); + ca_encoder *ca = static_cast<ca_encoder *>(data); obs_properties_t *props = obs_properties_create(); - obs_property_t *p = obs_properties_add_list(props, "samplerate", - obs_module_text("OutputSamplerate"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *p = obs_properties_add_list( + props, "samplerate", obs_module_text("OutputSamplerate"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); add_samplerates(p, ca); obs_property_set_modified_callback(p, samplerate_updated); p = obs_properties_add_list(props, "bitrate", - obs_module_text("Bitrate"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_module_text("Bitrate"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); add_bitrates(p, ca); obs_properties_add_bool(props, "allow he-aac", - obs_module_text("AllowHEAAC")); + obs_module_text("AllowHEAAC")); return props; } @@ -1376,14 +1375,15 @@ #ifdef _WIN32 if (!load_core_audio()) { CA_LOG(LOG_WARNING, "CoreAudio AAC encoder not installed on " - "the system or couldn't be loaded"); + "the system or couldn't be loaded"); return true; } CA_LOG(LOG_INFO, "Adding CoreAudio AAC encoder"); #endif - struct obs_encoder_info aac_info{}; + struct obs_encoder_info aac_info { + }; aac_info.id = "CoreAudio_AAC"; aac_info.type = OBS_ENCODER_AUDIO; aac_info.codec = "AAC";
View file
obs-studio-23.2.1.tar.xz/plugins/coreaudio-encoder/windows-imports.h -> obs-studio-24.0.0.tar.xz/plugins/coreaudio-encoder/windows-imports.h
Changed
@@ -5,18 +5,17 @@ #include <util/dstr.h> -typedef unsigned long UInt32; -typedef signed long SInt32; -typedef signed long long SInt64; -typedef double Float64; +typedef unsigned long UInt32; +typedef signed long SInt32; +typedef signed long long SInt64; +typedef double Float64; -typedef SInt32 OSStatus; -typedef unsigned char Boolean; +typedef SInt32 OSStatus; +typedef unsigned char Boolean; typedef UInt32 AudioFormatPropertyID; -enum { - kVariableLengthArray = 1 +enum { kVariableLengthArray = 1, }; struct OpaqueAudioConverter; @@ -30,344 +29,305 @@ typedef struct AudioValueRange AudioValueRange; struct AudioBuffer { - UInt32 mNumberChannels; - UInt32 mDataByteSize; - void* mData; + UInt32 mNumberChannels; + UInt32 mDataByteSize; + void *mData; }; typedef struct AudioBuffer AudioBuffer; struct AudioBufferList { - UInt32 mNumberBuffers; + UInt32 mNumberBuffers; AudioBuffer mBuffers[kVariableLengthArray]; }; typedef struct AudioBufferList AudioBufferList; struct AudioStreamBasicDescription { Float64 mSampleRate; - UInt32 mFormatID; - UInt32 mFormatFlags; - UInt32 mBytesPerPacket; - UInt32 mFramesPerPacket; - UInt32 mBytesPerFrame; - UInt32 mChannelsPerFrame; - UInt32 mBitsPerChannel; - UInt32 mReserved; + UInt32 mFormatID; + UInt32 mFormatFlags; + UInt32 mBytesPerPacket; + UInt32 mFramesPerPacket; + UInt32 mBytesPerFrame; + UInt32 mChannelsPerFrame; + UInt32 mBitsPerChannel; + UInt32 mReserved; }; typedef struct AudioStreamBasicDescription AudioStreamBasicDescription; struct AudioStreamPacketDescription { - SInt64 mStartOffset; - UInt32 mVariableFramesInPacket; - UInt32 mDataByteSize; + SInt64 mStartOffset; + UInt32 mVariableFramesInPacket; + UInt32 mDataByteSize; }; typedef struct AudioStreamPacketDescription AudioStreamPacketDescription; -typedef OSStatus (*AudioConverterComplexInputDataProc) ( - AudioConverterRef inAudioConverter, - UInt32 *ioNumberDataPackets, - AudioBufferList *ioData, - AudioStreamPacketDescription **outDataPacketDescription, - void *inUserData -); - -enum { - kAudioCodecPropertyNameCFString = 'lnam', - kAudioCodecPropertyManufacturerCFString = 'lmak', - kAudioCodecPropertyFormatCFString = 'lfor', - //kAudioCodecPropertyHasVariablePacketByteSizes = 'vpk?', - kAudioCodecPropertySupportedInputFormats = 'ifm#', - kAudioCodecPropertySupportedOutputFormats = 'ofm#', - kAudioCodecPropertyAvailableInputSampleRates = 'aisr', - kAudioCodecPropertyAvailableOutputSampleRates = 'aosr', - kAudioCodecPropertyAvailableBitRateRange = 'abrt', - kAudioCodecPropertyMinimumNumberInputPackets = 'mnip', - kAudioCodecPropertyMinimumNumberOutputPackets = 'mnop', - kAudioCodecPropertyAvailableNumberChannels = 'cmnc', - kAudioCodecPropertyDoesSampleRateConversion = 'lmrc', - kAudioCodecPropertyAvailableInputChannelLayoutTags = 'aicl', - kAudioCodecPropertyAvailableOutputChannelLayoutTags = 'aocl', - kAudioCodecPropertyInputFormatsForOutputFormat = 'if4o', - kAudioCodecPropertyOutputFormatsForInputFormat = 'of4i', - kAudioCodecPropertyFormatInfo = 'acfi', +typedef OSStatus (*AudioConverterComplexInputDataProc)( + AudioConverterRef inAudioConverter, UInt32 *ioNumberDataPackets, + AudioBufferList *ioData, + AudioStreamPacketDescription **outDataPacketDescription, + void *inUserData); + +enum { kAudioCodecPropertyNameCFString = 'lnam', + kAudioCodecPropertyManufacturerCFString = 'lmak', + kAudioCodecPropertyFormatCFString = 'lfor', + //kAudioCodecPropertyHasVariablePacketByteSizes = 'vpk?', + kAudioCodecPropertySupportedInputFormats = 'ifm#', + kAudioCodecPropertySupportedOutputFormats = 'ofm#', + kAudioCodecPropertyAvailableInputSampleRates = 'aisr', + kAudioCodecPropertyAvailableOutputSampleRates = 'aosr', + kAudioCodecPropertyAvailableBitRateRange = 'abrt', + kAudioCodecPropertyMinimumNumberInputPackets = 'mnip', + kAudioCodecPropertyMinimumNumberOutputPackets = 'mnop', + kAudioCodecPropertyAvailableNumberChannels = 'cmnc', + kAudioCodecPropertyDoesSampleRateConversion = 'lmrc', + kAudioCodecPropertyAvailableInputChannelLayoutTags = 'aicl', + kAudioCodecPropertyAvailableOutputChannelLayoutTags = 'aocl', + kAudioCodecPropertyInputFormatsForOutputFormat = 'if4o', + kAudioCodecPropertyOutputFormatsForInputFormat = 'of4i', + kAudioCodecPropertyFormatInfo = 'acfi', }; -enum { - kAudioCodecPropertyInputBufferSize = 'tbuf', - kAudioCodecPropertyPacketFrameSize = 'pakf', - kAudioCodecPropertyMaximumPacketByteSize = 'pakb', - kAudioCodecPropertyCurrentInputFormat = 'ifmt', - kAudioCodecPropertyCurrentOutputFormat = 'ofmt', - kAudioCodecPropertyMagicCookie = 'kuki', - kAudioCodecPropertyUsedInputBufferSize = 'ubuf', - kAudioCodecPropertyIsInitialized = 'init', - kAudioCodecPropertyCurrentTargetBitRate = 'brat', - kAudioCodecPropertyCurrentInputSampleRate = 'cisr', - kAudioCodecPropertyCurrentOutputSampleRate = 'cosr', - kAudioCodecPropertyQualitySetting = 'srcq', - kAudioCodecPropertyApplicableBitRateRange = 'brta', - kAudioCodecPropertyApplicableInputSampleRates = 'isra', - kAudioCodecPropertyApplicableOutputSampleRates = 'osra', - kAudioCodecPropertyPaddedZeros = 'pad0', - kAudioCodecPropertyPrimeMethod = 'prmm', - kAudioCodecPropertyPrimeInfo = 'prim', - kAudioCodecPropertyCurrentInputChannelLayout = 'icl ', - kAudioCodecPropertyCurrentOutputChannelLayout = 'ocl ', - kAudioCodecPropertySettings = 'acs ', - kAudioCodecPropertyFormatList = 'acfl', - kAudioCodecPropertyBitRateControlMode = 'acbf', - kAudioCodecPropertySoundQualityForVBR = 'vbrq', - kAudioCodecPropertyMinimumDelayMode = 'mdel' +enum { kAudioCodecPropertyInputBufferSize = 'tbuf', + kAudioCodecPropertyPacketFrameSize = 'pakf', + kAudioCodecPropertyMaximumPacketByteSize = 'pakb', + kAudioCodecPropertyCurrentInputFormat = 'ifmt', + kAudioCodecPropertyCurrentOutputFormat = 'ofmt', + kAudioCodecPropertyMagicCookie = 'kuki', + kAudioCodecPropertyUsedInputBufferSize = 'ubuf', + kAudioCodecPropertyIsInitialized = 'init', + kAudioCodecPropertyCurrentTargetBitRate = 'brat', + kAudioCodecPropertyCurrentInputSampleRate = 'cisr', + kAudioCodecPropertyCurrentOutputSampleRate = 'cosr', + kAudioCodecPropertyQualitySetting = 'srcq', + kAudioCodecPropertyApplicableBitRateRange = 'brta', + kAudioCodecPropertyApplicableInputSampleRates = 'isra', + kAudioCodecPropertyApplicableOutputSampleRates = 'osra', + kAudioCodecPropertyPaddedZeros = 'pad0', + kAudioCodecPropertyPrimeMethod = 'prmm', + kAudioCodecPropertyPrimeInfo = 'prim', + kAudioCodecPropertyCurrentInputChannelLayout = 'icl ', + kAudioCodecPropertyCurrentOutputChannelLayout = 'ocl ', + kAudioCodecPropertySettings = 'acs ', + kAudioCodecPropertyFormatList = 'acfl', + kAudioCodecPropertyBitRateControlMode = 'acbf', + kAudioCodecPropertySoundQualityForVBR = 'vbrq', + kAudioCodecPropertyMinimumDelayMode = 'mdel' }; + +enum { kAudioCodecBitRateControlMode_Constant = 0, + kAudioCodecBitRateControlMode_LongTermAverage = 1, + kAudioCodecBitRateControlMode_VariableConstrained = 2, + kAudioCodecBitRateControlMode_Variable = 3, }; -enum { - kAudioCodecBitRateControlMode_Constant = 0, - kAudioCodecBitRateControlMode_LongTermAverage = 1, - kAudioCodecBitRateControlMode_VariableConstrained = 2, - kAudioCodecBitRateControlMode_Variable = 3, +enum { kAudioFormatLinearPCM = 'lpcm', + kAudioFormatAC3 = 'ac-3', + kAudioFormat60958AC3 = 'cac3', + kAudioFormatAppleIMA4 = 'ima4', + kAudioFormatMPEG4AAC = 'aac ', + kAudioFormatMPEG4CELP = 'celp', + kAudioFormatMPEG4HVXC = 'hvxc', + kAudioFormatMPEG4TwinVQ = 'twvq', + kAudioFormatMACE3 = 'MAC3', + kAudioFormatMACE6 = 'MAC6', + kAudioFormatULaw = 'ulaw', + kAudioFormatALaw = 'alaw', + kAudioFormatQDesign = 'QDMC', + kAudioFormatQDesign2 = 'QDM2', + kAudioFormatQUALCOMM = 'Qclp', + kAudioFormatMPEGLayer1 = '.mp1', + kAudioFormatMPEGLayer2 = '.mp2', + kAudioFormatMPEGLayer3 = '.mp3', + kAudioFormatTimeCode = 'time', + kAudioFormatMIDIStream = 'midi', + kAudioFormatParameterValueStream = 'apvs', + kAudioFormatAppleLossless = 'alac', + kAudioFormatMPEG4AAC_HE = 'aach', + kAudioFormatMPEG4AAC_LD = 'aacl', + kAudioFormatMPEG4AAC_ELD = 'aace', + kAudioFormatMPEG4AAC_ELD_SBR = 'aacf', + kAudioFormatMPEG4AAC_ELD_V2 = 'aacg', + kAudioFormatMPEG4AAC_HE_V2 = 'aacp', + kAudioFormatMPEG4AAC_Spatial = 'aacs', + kAudioFormatAMR = 'samr', + kAudioFormatAudible = 'AUDB', + kAudioFormatiLBC = 'ilbc', + kAudioFormatDVIIntelIMA = 0x6D730011, + kAudioFormatMicrosoftGSM = 0x6D730031, + kAudioFormatAES3 = 'aes3', }; -enum { - kAudioFormatLinearPCM = 'lpcm', - kAudioFormatAC3 = 'ac-3', - kAudioFormat60958AC3 = 'cac3', - kAudioFormatAppleIMA4 = 'ima4', - kAudioFormatMPEG4AAC = 'aac ', - kAudioFormatMPEG4CELP = 'celp', - kAudioFormatMPEG4HVXC = 'hvxc', - kAudioFormatMPEG4TwinVQ = 'twvq', - kAudioFormatMACE3 = 'MAC3', - kAudioFormatMACE6 = 'MAC6', - kAudioFormatULaw = 'ulaw', - kAudioFormatALaw = 'alaw', - kAudioFormatQDesign = 'QDMC', - kAudioFormatQDesign2 = 'QDM2', - kAudioFormatQUALCOMM = 'Qclp', - kAudioFormatMPEGLayer1 = '.mp1', - kAudioFormatMPEGLayer2 = '.mp2', - kAudioFormatMPEGLayer3 = '.mp3', - kAudioFormatTimeCode = 'time', - kAudioFormatMIDIStream = 'midi', - kAudioFormatParameterValueStream = 'apvs', - kAudioFormatAppleLossless = 'alac', - kAudioFormatMPEG4AAC_HE = 'aach', - kAudioFormatMPEG4AAC_LD = 'aacl', - kAudioFormatMPEG4AAC_ELD = 'aace', - kAudioFormatMPEG4AAC_ELD_SBR = 'aacf', - kAudioFormatMPEG4AAC_ELD_V2 = 'aacg', - kAudioFormatMPEG4AAC_HE_V2 = 'aacp', - kAudioFormatMPEG4AAC_Spatial = 'aacs', - kAudioFormatAMR = 'samr', - kAudioFormatAudible = 'AUDB', - kAudioFormatiLBC = 'ilbc', - kAudioFormatDVIIntelIMA = 0x6D730011, - kAudioFormatMicrosoftGSM = 0x6D730031, - kAudioFormatAES3 = 'aes3' +enum { kAudioFormatFlagIsFloat = (1L << 0), + kAudioFormatFlagIsBigEndian = (1L << 1), + kAudioFormatFlagIsSignedInteger = (1L << 2), + kAudioFormatFlagIsPacked = (1L << 3), + kAudioFormatFlagIsAlignedHigh = (1L << 4), + kAudioFormatFlagIsNonInterleaved = (1L << 5), + kAudioFormatFlagIsNonMixable = (1L << 6), + kAudioFormatFlagsAreAllClear = (1L << 31), + + kLinearPCMFormatFlagIsFloat = kAudioFormatFlagIsFloat, + kLinearPCMFormatFlagIsBigEndian = kAudioFormatFlagIsBigEndian, + kLinearPCMFormatFlagIsSignedInteger = kAudioFormatFlagIsSignedInteger, + kLinearPCMFormatFlagIsPacked = kAudioFormatFlagIsPacked, + kLinearPCMFormatFlagIsAlignedHigh = kAudioFormatFlagIsAlignedHigh, + kLinearPCMFormatFlagIsNonInterleaved = kAudioFormatFlagIsNonInterleaved, + kLinearPCMFormatFlagIsNonMixable = kAudioFormatFlagIsNonMixable, + kLinearPCMFormatFlagsAreAllClear = kAudioFormatFlagsAreAllClear, + + kAppleLosslessFormatFlag_16BitSourceData = 1, + kAppleLosslessFormatFlag_20BitSourceData = 2, + kAppleLosslessFormatFlag_24BitSourceData = 3, + kAppleLosslessFormatFlag_32BitSourceData = 4, }; -enum { - kAudioFormatFlagIsFloat = (1L << 0), - kAudioFormatFlagIsBigEndian = (1L << 1), - kAudioFormatFlagIsSignedInteger = (1L << 2), - kAudioFormatFlagIsPacked = (1L << 3), - kAudioFormatFlagIsAlignedHigh = (1L << 4), - kAudioFormatFlagIsNonInterleaved = (1L << 5), - kAudioFormatFlagIsNonMixable = (1L << 6), - kAudioFormatFlagsAreAllClear = (1L << 31), - - kLinearPCMFormatFlagIsFloat = - kAudioFormatFlagIsFloat, - kLinearPCMFormatFlagIsBigEndian = - kAudioFormatFlagIsBigEndian, - kLinearPCMFormatFlagIsSignedInteger = - kAudioFormatFlagIsSignedInteger, - kLinearPCMFormatFlagIsPacked = - kAudioFormatFlagIsPacked, - kLinearPCMFormatFlagIsAlignedHigh = - kAudioFormatFlagIsAlignedHigh, - kLinearPCMFormatFlagIsNonInterleaved = - kAudioFormatFlagIsNonInterleaved, - kLinearPCMFormatFlagIsNonMixable = - kAudioFormatFlagIsNonMixable, - kLinearPCMFormatFlagsAreAllClear = - kAudioFormatFlagsAreAllClear, - - kAppleLosslessFormatFlag_16BitSourceData = 1, - kAppleLosslessFormatFlag_20BitSourceData = 2, - kAppleLosslessFormatFlag_24BitSourceData = 3, - kAppleLosslessFormatFlag_32BitSourceData = 4 -}; - -enum { - kAudioFormatFlagsNativeEndian = 0, -}; +enum { kAudioFormatFlagsNativeEndian = 0 }; enum { // AudioStreamBasicDescription structure properties - kAudioFormatProperty_FormatInfo = 'fmti', - kAudioFormatProperty_FormatName = 'fnam', - kAudioFormatProperty_EncodeFormatIDs = 'acof', - kAudioFormatProperty_DecodeFormatIDs = 'acif', - kAudioFormatProperty_FormatList = 'flst', - kAudioFormatProperty_ASBDFromESDS = 'essd', - kAudioFormatProperty_ChannelLayoutFromESDS = 'escl', - kAudioFormatProperty_OutputFormatList = 'ofls', - kAudioFormatProperty_Encoders = 'aven', - kAudioFormatProperty_Decoders = 'avde', - kAudioFormatProperty_FormatIsVBR = 'fvbr', - kAudioFormatProperty_FormatIsExternallyFramed = 'fexf', - kAudioFormatProperty_AvailableEncodeBitRates = 'aebr', - kAudioFormatProperty_AvailableEncodeSampleRates = 'aesr', + kAudioFormatProperty_FormatInfo = 'fmti', + kAudioFormatProperty_FormatName = 'fnam', + kAudioFormatProperty_EncodeFormatIDs = 'acof', + kAudioFormatProperty_DecodeFormatIDs = 'acif', + kAudioFormatProperty_FormatList = 'flst', + kAudioFormatProperty_ASBDFromESDS = 'essd', + kAudioFormatProperty_ChannelLayoutFromESDS = 'escl', + kAudioFormatProperty_OutputFormatList = 'ofls', + kAudioFormatProperty_Encoders = 'aven', + kAudioFormatProperty_Decoders = 'avde', + kAudioFormatProperty_FormatIsVBR = 'fvbr', + kAudioFormatProperty_FormatIsExternallyFramed = 'fexf', + kAudioFormatProperty_AvailableEncodeBitRates = 'aebr', + kAudioFormatProperty_AvailableEncodeSampleRates = 'aesr', kAudioFormatProperty_AvailableEncodeChannelLayoutTags = 'aecl', - kAudioFormatProperty_AvailableEncodeNumberChannels = 'avnc', - kAudioFormatProperty_ASBDFromMPEGPacket = 'admp', + kAudioFormatProperty_AvailableEncodeNumberChannels = 'avnc', + kAudioFormatProperty_ASBDFromMPEGPacket = 'admp', // // AudioChannelLayout structure properties - kAudioFormatProperty_BitmapForLayoutTag = 'bmtg', - kAudioFormatProperty_MatrixMixMap = 'mmap', - kAudioFormatProperty_ChannelMap = 'chmp', - kAudioFormatProperty_NumberOfChannelsForLayout = 'nchm', - kAudioFormatProperty_ValidateChannelLayout = 'vacl', - kAudioFormatProperty_ChannelLayoutForTag = 'cmpl', - kAudioFormatProperty_TagForChannelLayout = 'cmpt', - kAudioFormatProperty_ChannelLayoutName = 'lonm', - kAudioFormatProperty_ChannelLayoutSimpleName = 'lsnm', - kAudioFormatProperty_ChannelLayoutForBitmap = 'cmpb', - kAudioFormatProperty_ChannelName = 'cnam', - kAudioFormatProperty_ChannelShortName = 'csnm', - kAudioFormatProperty_TagsForNumberOfChannels = 'tagc', - kAudioFormatProperty_PanningMatrix = 'panm', - kAudioFormatProperty_BalanceFade = 'balf', + kAudioFormatProperty_BitmapForLayoutTag = 'bmtg', + kAudioFormatProperty_MatrixMixMap = 'mmap', + kAudioFormatProperty_ChannelMap = 'chmp', + kAudioFormatProperty_NumberOfChannelsForLayout = 'nchm', + kAudioFormatProperty_ValidateChannelLayout = 'vacl', + kAudioFormatProperty_ChannelLayoutForTag = 'cmpl', + kAudioFormatProperty_TagForChannelLayout = 'cmpt', + kAudioFormatProperty_ChannelLayoutName = 'lonm', + kAudioFormatProperty_ChannelLayoutSimpleName = 'lsnm', + kAudioFormatProperty_ChannelLayoutForBitmap = 'cmpb', + kAudioFormatProperty_ChannelName = 'cnam', + kAudioFormatProperty_ChannelShortName = 'csnm', + kAudioFormatProperty_TagsForNumberOfChannels = 'tagc', + kAudioFormatProperty_PanningMatrix = 'panm', + kAudioFormatProperty_BalanceFade = 'balf', // // ID3 tag (MP3 metadata) properties - kAudioFormatProperty_ID3TagSize = 'id3s', - kAudioFormatProperty_ID3TagToDictionary = 'id3d' + kAudioFormatProperty_ID3TagSize = 'id3s', + kAudioFormatProperty_ID3TagToDictionary = 'id3d', }; -enum { - kAudioConverterPropertyMinimumInputBufferSize = 'mibs', - kAudioConverterPropertyMinimumOutputBufferSize = 'mobs', - kAudioConverterPropertyMaximumInputBufferSize = 'xibs', - kAudioConverterPropertyMaximumInputPacketSize = 'xips', - kAudioConverterPropertyMaximumOutputPacketSize = 'xops', - kAudioConverterPropertyCalculateInputBufferSize = 'cibs', - kAudioConverterPropertyCalculateOutputBufferSize = 'cobs', - kAudioConverterPropertyInputCodecParameters = 'icdp', - kAudioConverterPropertyOutputCodecParameters = 'ocdp', - kAudioConverterSampleRateConverterAlgorithm = 'srci', - kAudioConverterSampleRateConverterComplexity = 'srca', - kAudioConverterSampleRateConverterQuality = 'srcq', - kAudioConverterSampleRateConverterInitialPhase = 'srcp', - kAudioConverterCodecQuality = 'cdqu', - kAudioConverterPrimeMethod = 'prmm', - kAudioConverterPrimeInfo = 'prim', - kAudioConverterChannelMap = 'chmp', - kAudioConverterDecompressionMagicCookie = 'dmgc', - kAudioConverterCompressionMagicCookie = 'cmgc', - kAudioConverterEncodeBitRate = 'brat', - kAudioConverterEncodeAdjustableSampleRate = 'ajsr', - kAudioConverterInputChannelLayout = 'icl ', - kAudioConverterOutputChannelLayout = 'ocl ', - kAudioConverterApplicableEncodeBitRates = 'aebr', - kAudioConverterAvailableEncodeBitRates = 'vebr', - kAudioConverterApplicableEncodeSampleRates = 'aesr', - kAudioConverterAvailableEncodeSampleRates = 'vesr', - kAudioConverterAvailableEncodeChannelLayoutTags = 'aecl', - kAudioConverterCurrentOutputStreamDescription = 'acod', - kAudioConverterCurrentInputStreamDescription = 'acid', - kAudioConverterPropertySettings = 'acps', - kAudioConverterPropertyBitDepthHint = 'acbd', - kAudioConverterPropertyFormatList = 'flst', +enum { kAudioConverterPropertyMinimumInputBufferSize = 'mibs', + kAudioConverterPropertyMinimumOutputBufferSize = 'mobs', + kAudioConverterPropertyMaximumInputBufferSize = 'xibs', + kAudioConverterPropertyMaximumInputPacketSize = 'xips', + kAudioConverterPropertyMaximumOutputPacketSize = 'xops', + kAudioConverterPropertyCalculateInputBufferSize = 'cibs', + kAudioConverterPropertyCalculateOutputBufferSize = 'cobs', + kAudioConverterPropertyInputCodecParameters = 'icdp', + kAudioConverterPropertyOutputCodecParameters = 'ocdp', + kAudioConverterSampleRateConverterAlgorithm = 'srci', + kAudioConverterSampleRateConverterComplexity = 'srca', + kAudioConverterSampleRateConverterQuality = 'srcq', + kAudioConverterSampleRateConverterInitialPhase = 'srcp', + kAudioConverterCodecQuality = 'cdqu', + kAudioConverterPrimeMethod = 'prmm', + kAudioConverterPrimeInfo = 'prim', + kAudioConverterChannelMap = 'chmp', + kAudioConverterDecompressionMagicCookie = 'dmgc', + kAudioConverterCompressionMagicCookie = 'cmgc', + kAudioConverterEncodeBitRate = 'brat', + kAudioConverterEncodeAdjustableSampleRate = 'ajsr', + kAudioConverterInputChannelLayout = 'icl ', + kAudioConverterOutputChannelLayout = 'ocl ', + kAudioConverterApplicableEncodeBitRates = 'aebr', + kAudioConverterAvailableEncodeBitRates = 'vebr', + kAudioConverterApplicableEncodeSampleRates = 'aesr', + kAudioConverterAvailableEncodeSampleRates = 'vesr', + kAudioConverterAvailableEncodeChannelLayoutTags = 'aecl', + kAudioConverterCurrentOutputStreamDescription = 'acod', + kAudioConverterCurrentInputStreamDescription = 'acid', + kAudioConverterPropertySettings = 'acps', + kAudioConverterPropertyBitDepthHint = 'acbd', + kAudioConverterPropertyFormatList = 'flst', }; -enum { - kAudioConverterQuality_Max = 0x7F, - kAudioConverterQuality_High = 0x60, - kAudioConverterQuality_Medium = 0x40, - kAudioConverterQuality_Low = 0x20, - kAudioConverterQuality_Min = 0 +enum { kAudioConverterQuality_Max = 0x7F, + kAudioConverterQuality_High = 0x60, + kAudioConverterQuality_Medium = 0x40, + kAudioConverterQuality_Low = 0x20, + kAudioConverterQuality_Min = 0, }; -enum { - kAudio_UnimplementedError = -4, - kAudio_FileNotFoundError = -43, - kAudio_FilePermissionError = -54, - kAudio_TooManyFilesOpenError = -42, - kAudio_BadFilePathError = '!pth', // 0x21707468, 561017960 - kAudio_ParamError = -50, - kAudio_MemFullError = -108, - - kAudioConverterErr_FormatNotSupported = 'fmt?', - kAudioConverterErr_OperationNotSupported = 0x6F703F3F, - // 'op??', integer used because of trigraph - kAudioConverterErr_PropertyNotSupported = 'prop', - kAudioConverterErr_InvalidInputSize = 'insz', - kAudioConverterErr_InvalidOutputSize = 'otsz', - // e.g. byte size is not a multiple of the frame size - kAudioConverterErr_UnspecifiedError = 'what', - kAudioConverterErr_BadPropertySizeError = '!siz', - kAudioConverterErr_RequiresPacketDescriptionsError = '!pkd', - kAudioConverterErr_InputSampleRateOutOfRange = '!isr', - kAudioConverterErr_OutputSampleRateOutOfRange = '!osr' +enum { kAudio_UnimplementedError = -4, + kAudio_FileNotFoundError = -43, + kAudio_FilePermissionError = -54, + kAudio_TooManyFilesOpenError = -42, + kAudio_BadFilePathError = '!pth', // 0x21707468, 561017960 + kAudio_ParamError = -50, + kAudio_MemFullError = -108, + + kAudioConverterErr_FormatNotSupported = 'fmt?', + kAudioConverterErr_OperationNotSupported = 0x6F703F3F, + // 'op??', integer used because of trigraph + kAudioConverterErr_PropertyNotSupported = 'prop', + kAudioConverterErr_InvalidInputSize = 'insz', + kAudioConverterErr_InvalidOutputSize = 'otsz', + // e.g. byte size is not a multiple of the frame size + kAudioConverterErr_UnspecifiedError = 'what', + kAudioConverterErr_BadPropertySizeError = '!siz', + kAudioConverterErr_RequiresPacketDescriptionsError = '!pkd', + kAudioConverterErr_InputSampleRateOutOfRange = '!isr', + kAudioConverterErr_OutputSampleRateOutOfRange = '!osr', }; -typedef OSStatus (*AudioConverterNew_t) ( +typedef OSStatus (*AudioConverterNew_t)( const AudioStreamBasicDescription *inSourceFormat, const AudioStreamBasicDescription *inDestinationFormat, - AudioConverterRef *outAudioConverter -); - -typedef OSStatus (*AudioConverterDispose_t) ( - AudioConverterRef inAudioConverter -); - -typedef OSStatus (*AudioConverterReset_t) ( - AudioConverterRef inAudioConverter -); - -typedef OSStatus (*AudioConverterGetProperty_t) ( - AudioConverterRef inAudioConverter, - AudioConverterPropertyID inPropertyID, - UInt32 *ioPropertyDataSize, - void *outPropertyData -); - -typedef OSStatus (*AudioConverterGetPropertyInfo_t) ( - AudioConverterRef inAudioConverter, - AudioConverterPropertyID inPropertyID, - UInt32 *outSize, - Boolean *outWritable -); - -typedef OSStatus (*AudioConverterSetProperty_t) ( - AudioConverterRef inAudioConverter, - AudioConverterPropertyID inPropertyID, - UInt32 inPropertyDataSize, - const void *inPropertyData -); - -typedef OSStatus (*AudioConverterFillComplexBuffer_t) ( - AudioConverterRef inAudioConverter, + AudioConverterRef *outAudioConverter); + +typedef OSStatus (*AudioConverterDispose_t)(AudioConverterRef inAudioConverter); + +typedef OSStatus (*AudioConverterReset_t)(AudioConverterRef inAudioConverter); + +typedef OSStatus (*AudioConverterGetProperty_t)( + AudioConverterRef inAudioConverter, + AudioConverterPropertyID inPropertyID, UInt32 *ioPropertyDataSize, + void *outPropertyData); + +typedef OSStatus (*AudioConverterGetPropertyInfo_t)( + AudioConverterRef inAudioConverter, + AudioConverterPropertyID inPropertyID, UInt32 *outSize, + Boolean *outWritable); + +typedef OSStatus (*AudioConverterSetProperty_t)( + AudioConverterRef inAudioConverter, + AudioConverterPropertyID inPropertyID, UInt32 inPropertyDataSize, + const void *inPropertyData); + +typedef OSStatus (*AudioConverterFillComplexBuffer_t)( + AudioConverterRef inAudioConverter, AudioConverterComplexInputDataProc inInputDataProc, - void *inInputDataProcUserData, - UInt32 *ioOutputDataPacketSize, - AudioBufferList *outOutputData, - AudioStreamPacketDescription *outPacketDescription -); - -typedef OSStatus (*AudioFormatGetProperty_t) ( - AudioFormatPropertyID inPropertyID, - UInt32 inSpecifierSize, - const void *inSpecifier, - UInt32 *ioPropertyDataSize, - void *outPropertyData -); - -typedef OSStatus (*AudioFormatGetPropertyInfo_t) ( - AudioFormatPropertyID inPropertyID, - UInt32 inSpecifierSize, - const void *inSpecifier, - UInt32 *outPropertyDataSize -); + void *inInputDataProcUserData, UInt32 *ioOutputDataPacketSize, + AudioBufferList *outOutputData, + AudioStreamPacketDescription *outPacketDescription); + +typedef OSStatus (*AudioFormatGetProperty_t)(AudioFormatPropertyID inPropertyID, + UInt32 inSpecifierSize, + const void *inSpecifier, + UInt32 *ioPropertyDataSize, + void *outPropertyData); + +typedef OSStatus (*AudioFormatGetPropertyInfo_t)( + AudioFormatPropertyID inPropertyID, UInt32 inSpecifierSize, + const void *inSpecifier, UInt32 *outPropertyDataSize); static AudioConverterNew_t AudioConverterNew = NULL; static AudioConverterDispose_t AudioConverterDispose = NULL; @@ -383,9 +343,10 @@ static void release_lib(void) { -#define RELEASE_LIB(x) if (x) { \ +#define RELEASE_LIB(x) \ + if (x) { \ FreeLibrary(x); \ - x = NULL; \ + x = NULL; \ } RELEASE_LIB(audio_toolbox); @@ -396,12 +357,12 @@ { PWSTR common_path; if (SHGetKnownFolderPath(FOLDERID_ProgramFilesCommon, 0, NULL, - &common_path) != S_OK) { + &common_path) != S_OK) { CA_LOG(LOG_WARNING, "Could not retrieve common files path"); return false; } - struct dstr path = { 0 }; + struct dstr path = {0}; dstr_printf(&path, "%S\\Apple\\Apple Application Support", common_path); CoTaskMemFree(common_path); @@ -411,8 +372,9 @@ SetDllDirectory(w_path); bfree(w_path); -#define LOAD_LIB(x, n) x = LoadLibrary(TEXT(n)); \ - if (!x) \ +#define LOAD_LIB(x, n) \ + x = LoadLibrary(TEXT(n)); \ + if (!x) \ CA_LOG(LOG_DEBUG, "Failed loading library '" n "'"); LOAD_LIB(audio_toolbox, "CoreAudioToolbox.dll"); @@ -444,19 +406,20 @@ #ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable: 4706) +#pragma warning(disable : 4706) #endif static bool load_core_audio(void) { if (!load_lib()) return false; -#define LOAD_SYM_FROM_LIB(sym, lib, dll) \ - if (!(sym = (sym ## _t)GetProcAddress(lib, #sym))) { \ - DWORD err = GetLastError(); \ - CA_LOG(LOG_ERROR, "Couldn't load " #sym " from " \ - dll ": %lu (0x%lx)", err, err); \ - goto unload_everything; \ +#define LOAD_SYM_FROM_LIB(sym, lib, dll) \ + if (!(sym = (sym##_t)GetProcAddress(lib, #sym))) { \ + DWORD err = GetLastError(); \ + CA_LOG(LOG_ERROR, \ + "Couldn't load " #sym " from " dll ": %lu (0x%lx)", \ + err, err); \ + goto unload_everything; \ } #define LOAD_SYM(sym) \
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/DecklinkBase.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/DecklinkBase.cpp
Changed
@@ -1,7 +1,7 @@ #include "DecklinkBase.h" DecklinkBase::DecklinkBase(DeckLinkDeviceDiscovery *discovery_) - : discovery(discovery_) + : discovery(discovery_) { } @@ -10,11 +10,9 @@ return instance ? instance->GetDevice() : nullptr; } -bool DecklinkBase::Activate(DeckLinkDevice*, long long) +bool DecklinkBase::Activate(DeckLinkDevice *, long long) { return false; } -void DecklinkBase::Deactivate() -{ -} +void DecklinkBase::Deactivate() {}
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/DecklinkBase.h -> obs-studio-24.0.0.tar.xz/plugins/decklink/DecklinkBase.h
Changed
@@ -16,14 +16,14 @@ protected: DecklinkBase(DeckLinkDeviceDiscovery *discovery_); - ComPtr<DeckLinkDeviceInstance> instance; - DeckLinkDeviceDiscovery *discovery; - std::recursive_mutex deviceMutex; - volatile long activateRefs = 0; - BMDPixelFormat pixelFormat = bmdFormat8BitYUV; - video_colorspace colorSpace = VIDEO_CS_DEFAULT; - video_range_type colorRange = VIDEO_RANGE_DEFAULT; - speaker_layout channelFormat = SPEAKERS_STEREO; + ComPtr<DeckLinkDeviceInstance> instance; + DeckLinkDeviceDiscovery *discovery; + std::recursive_mutex deviceMutex; + volatile long activateRefs = 0; + BMDPixelFormat pixelFormat = bmdFormat8BitYUV; + video_colorspace colorSpace = VIDEO_CS_DEFAULT; + video_range_type colorRange = VIDEO_RANGE_DEFAULT; + speaker_layout channelFormat = SPEAKERS_STEREO; public: virtual bool Activate(DeckLinkDevice *device, long long modeId);
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/DecklinkInput.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/DecklinkInput.cpp
Changed
@@ -2,9 +2,9 @@ #include <util/threading.h> -DeckLinkInput::DeckLinkInput(obs_source_t *source, DeckLinkDeviceDiscovery *discovery_) - : DecklinkBase(discovery_), - source(source) +DeckLinkInput::DeckLinkInput(obs_source_t *source, + DeckLinkDeviceDiscovery *discovery_) + : DecklinkBase(discovery_), source(source) { discovery->AddCallback(DeckLinkInput::DevicesChanged, this); } @@ -15,9 +15,10 @@ Deactivate(); } -void DeckLinkInput::DevicesChanged(void *param, DeckLinkDevice *device, bool added) +void DeckLinkInput::DevicesChanged(void *param, DeckLinkDevice *device, + bool added) { - DeckLinkInput *decklink = reinterpret_cast<DeckLinkInput*>(param); + DeckLinkInput *decklink = reinterpret_cast<DeckLinkInput *>(param); std::lock_guard<std::recursive_mutex> lock(decklink->deviceMutex); obs_source_update_properties(decklink->source); @@ -31,15 +32,18 @@ settings = obs_source_get_settings(decklink->source); hash = obs_data_get_string(settings, "device_hash"); - videoConnection = (BMDVideoConnection) obs_data_get_int(settings, "video_connection"); - audioConnection = (BMDAudioConnection) obs_data_get_int(settings, "audio_connection"); + videoConnection = (BMDVideoConnection)obs_data_get_int( + settings, "video_connection"); + audioConnection = (BMDAudioConnection)obs_data_get_int( + settings, "audio_connection"); mode = obs_data_get_int(settings, "mode_id"); obs_data_release(settings); if (device->GetHash().compare(hash) == 0) { if (!decklink->activateRefs) return; - if (decklink->Activate(device, mode, videoConnection, audioConnection)) + if (decklink->Activate(device, mode, videoConnection, + audioConnection)) os_atomic_dec_long(&decklink->activateRefs); } @@ -52,8 +56,8 @@ } bool DeckLinkInput::Activate(DeckLinkDevice *device, long long modeId, - BMDVideoConnection bmdVideoConnection, - BMDAudioConnection bmdAudioConnection) + BMDVideoConnection bmdVideoConnection, + BMDAudioConnection bmdAudioConnection) { std::lock_guard<std::recursive_mutex> lock(deviceMutex); DeckLinkDevice *curDevice = GetDevice(); @@ -85,7 +89,8 @@ return false; if (GetDevice() == nullptr) { - LOG(LOG_ERROR, "Tried to activate an input with nullptr device."); + LOG(LOG_ERROR, + "Tried to activate an input with nullptr device."); return false; } @@ -95,7 +100,8 @@ return false; } - if (!instance->StartCapture(mode, bmdVideoConnection, bmdAudioConnection)) { + if (!instance->StartCapture(mode, bmdVideoConnection, + bmdAudioConnection)) { instance = nullptr; return false; } @@ -133,10 +139,9 @@ obs_data_t *settings = obs_source_get_settings(source); - obs_data_set_string(settings, "device_hash", - device->GetHash().c_str()); + obs_data_set_string(settings, "device_hash", device->GetHash().c_str()); obs_data_set_string(settings, "device_name", - device->GetDisplayName().c_str()); + device->GetDisplayName().c_str()); obs_data_set_int(settings, "mode_id", instance->GetActiveModeId()); obs_data_set_string(settings, "mode_name", mode->GetName().c_str());
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/DecklinkInput.hpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/DecklinkInput.hpp
Changed
@@ -4,12 +4,12 @@ class DeckLinkInput : public DecklinkBase { protected: - bool isCapturing = false; - obs_source_t *source; + bool isCapturing = false; + obs_source_t *source; void SaveSettings(); static void DevicesChanged(void *param, DeckLinkDevice *device, - bool added); + bool added); public: DeckLinkInput(obs_source_t *source, DeckLinkDeviceDiscovery *discovery); @@ -18,30 +18,30 @@ long long GetActiveModeId(void) const; obs_source_t *GetSource(void) const; - inline BMDPixelFormat GetPixelFormat() const {return pixelFormat;} + inline BMDPixelFormat GetPixelFormat() const { return pixelFormat; } inline void SetPixelFormat(BMDPixelFormat format) { pixelFormat = format; } - inline video_colorspace GetColorSpace() const {return colorSpace;} + inline video_colorspace GetColorSpace() const { return colorSpace; } inline void SetColorSpace(video_colorspace format) { colorSpace = format; } - inline video_range_type GetColorRange() const {return colorRange;} + inline video_range_type GetColorRange() const { return colorRange; } inline void SetColorRange(video_range_type format) { colorRange = format; } - inline speaker_layout GetChannelFormat() const {return channelFormat;} + inline speaker_layout GetChannelFormat() const { return channelFormat; } inline void SetChannelFormat(speaker_layout format) { channelFormat = format; } bool Activate(DeckLinkDevice *device, long long modeId, - BMDVideoConnection bmdVideoConnection, - BMDAudioConnection bmdAudioConnection); + BMDVideoConnection bmdVideoConnection, + BMDAudioConnection bmdAudioConnection); void Deactivate(); bool Capturing();
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/DecklinkOutput.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/DecklinkOutput.cpp
Changed
@@ -2,9 +2,9 @@ #include <util/threading.h> -DeckLinkOutput::DeckLinkOutput(obs_output_t *output, DeckLinkDeviceDiscovery *discovery_) - : DecklinkBase(discovery_), - output(output) +DeckLinkOutput::DeckLinkOutput(obs_output_t *output, + DeckLinkDeviceDiscovery *discovery_) + : DecklinkBase(discovery_), output(output) { discovery->AddCallback(DeckLinkOutput::DevicesChanged, this); } @@ -17,7 +17,7 @@ void DeckLinkOutput::DevicesChanged(void *param, DeckLinkDevice *device, bool) { - auto *decklink = reinterpret_cast<DeckLinkOutput*>(param); + auto *decklink = reinterpret_cast<DeckLinkOutput *>(param); std::lock_guard<std::recursive_mutex> lock(decklink->deviceMutex); blog(LOG_DEBUG, "%s", device->GetHash().c_str()); @@ -35,10 +35,10 @@ return false; if (instance->GetActiveModeId() == modeId && - instance->GetActivePixelFormat() == pixelFormat && - instance->GetActiveColorSpace() == colorSpace && - instance->GetActiveColorRange() == colorRange && - instance->GetActiveChannelFormat() == channelFormat) + instance->GetActivePixelFormat() == pixelFormat && + instance->GetActiveColorSpace() == colorSpace && + instance->GetActiveColorRange() == colorRange && + instance->GetActiveChannelFormat() == channelFormat) return false; } @@ -57,7 +57,6 @@ return false; } - if (!instance->StartOutput(mode)) { instance = nullptr; return false;
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/DecklinkOutput.hpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/DecklinkOutput.hpp
Changed
@@ -10,7 +10,8 @@ int width; int height; - static void DevicesChanged(void *param, DeckLinkDevice *device, bool added); + static void DevicesChanged(void *param, DeckLinkDevice *device, + bool added); public: const char *deviceHash; @@ -21,7 +22,8 @@ size_t audio_size; int keyerMode; - DeckLinkOutput(obs_output_t *output, DeckLinkDeviceDiscovery *discovery); + DeckLinkOutput(obs_output_t *output, + DeckLinkDeviceDiscovery *discovery); virtual ~DeckLinkOutput(void); obs_output_t *GetOutput(void) const; bool Activate(DeckLinkDevice *device, long long modeId) override;
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/audio-repack.c -> obs-studio-24.0.0.tar.xz/plugins/decklink/audio-repack.c
Changed
@@ -2,15 +2,14 @@ #include <emmintrin.h> -int check_buffer(struct audio_repack *repack, - uint32_t frame_count) +int check_buffer(struct audio_repack *repack, uint32_t frame_count) { - const uint32_t new_size = frame_count * repack->base_dst_size - + repack->extra_dst_size; + const uint32_t new_size = + frame_count * repack->base_dst_size + repack->extra_dst_size; if (repack->packet_size < new_size) { - repack->packet_buffer = brealloc( - repack->packet_buffer, new_size); + repack->packet_buffer = + brealloc(repack->packet_buffer, new_size); if (!repack->packet_buffer) return -1; @@ -30,8 +29,8 @@ * | FL | FR | LFE | */ -int repack_squash(struct audio_repack *repack, - const uint8_t *bsrc, uint32_t frame_count) +int repack_squash(struct audio_repack *repack, const uint8_t *bsrc, + uint32_t frame_count) { if (check_buffer(repack, frame_count) < 0) return -1; @@ -55,8 +54,8 @@ return 0; } -int repack_squash_swap(struct audio_repack *repack, - const uint8_t *bsrc, uint32_t frame_count) +int repack_squash_swap(struct audio_repack *repack, const uint8_t *bsrc, + uint32_t frame_count) { if (check_buffer(repack, frame_count) < 0) return -1; @@ -66,7 +65,8 @@ uint16_t *dst = (uint16_t *)repack->packet_buffer; while (src != esrc) { __m128i target = _mm_load_si128(src++); - __m128i buf = _mm_shufflelo_epi16(target, _MM_SHUFFLE(2, 3, 1, 0)); + __m128i buf = + _mm_shufflelo_epi16(target, _MM_SHUFFLE(2, 3, 1, 0)); _mm_storeu_si128((__m128i *)dst, buf); dst += 8 - squash; } @@ -74,20 +74,20 @@ } int audio_repack_init(struct audio_repack *repack, - audio_repack_mode_t repack_mode, uint8_t sample_bit) + audio_repack_mode_t repack_mode, uint8_t sample_bit) { memset(repack, 0, sizeof(*repack)); if (sample_bit != 16) return -1; - int _audio_repack_ch[8] = { 3, 4, 5, 6, 5, 6, 8, 8 }; + int _audio_repack_ch[8] = {3, 4, 5, 6, 5, 6, 8, 8}; repack->base_src_size = 8 * (16 / 8); repack->base_dst_size = _audio_repack_ch[repack_mode] * (16 / 8); repack->extra_dst_size = 8 - _audio_repack_ch[repack_mode]; repack->repack_func = &repack_squash; if (repack_mode == repack_mode_8to5ch_swap || - repack_mode == repack_mode_8to6ch_swap || - repack_mode == repack_mode_8ch_swap) + repack_mode == repack_mode_8to6ch_swap || + repack_mode == repack_mode_8ch_swap) repack->repack_func = &repack_squash_swap; return 0;
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/audio-repack.h -> obs-studio-24.0.0.tar.xz/plugins/decklink/audio-repack.h
Changed
@@ -11,22 +11,22 @@ struct audio_repack; -typedef int (*audio_repack_func_t)(struct audio_repack *, - const uint8_t *, uint32_t); +typedef int (*audio_repack_func_t)(struct audio_repack *, const uint8_t *, + uint32_t); struct audio_repack { - uint8_t *packet_buffer; - uint32_t packet_size; + uint8_t *packet_buffer; + uint32_t packet_size; - uint32_t base_src_size; - uint32_t base_dst_size; - uint32_t extra_dst_size; + uint32_t base_src_size; + uint32_t base_dst_size; + uint32_t extra_dst_size; audio_repack_func_t repack_func; }; enum _audio_repack_mode { - repack_mode_8to3ch=0, + repack_mode_8to3ch = 0, repack_mode_8to4ch, repack_mode_8to5ch, repack_mode_8to6ch, @@ -39,7 +39,8 @@ typedef enum _audio_repack_mode audio_repack_mode_t; extern int audio_repack_init(struct audio_repack *repack, - audio_repack_mode_t repack_mode, uint8_t sample_bit); + audio_repack_mode_t repack_mode, + uint8_t sample_bit); extern void audio_repack_free(struct audio_repack *repack); #ifdef __cplusplus
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/audio-repack.hpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/audio-repack.hpp
Changed
@@ -10,16 +10,13 @@ { audio_repack_init(&arepack, repack_mode, 16); } - inline ~AudioRepacker() - { - audio_repack_free(&arepack); - } + inline ~AudioRepacker() { audio_repack_free(&arepack); } inline int repack(const uint8_t *src, uint32_t frame_size) { return (*arepack.repack_func)(&arepack, src, frame_size); } - inline operator struct audio_repack*() {return &arepack;} - inline struct audio_repack *operator->() {return &arepack;} + inline operator struct audio_repack *() { return &arepack; } + inline struct audio_repack *operator->() { return &arepack; } };
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/const.h -> obs-studio-24.0.0.tar.xz/plugins/decklink/const.h
Changed
@@ -1,41 +1,41 @@ -#define DEVICE_HASH "device_hash" -#define DEVICE_NAME "device_name" -#define VIDEO_CONNECTION "video_connection" -#define AUDIO_CONNECTION "audio_connection" -#define MODE_ID "mode_id" -#define MODE_NAME "mode_name" -#define CHANNEL_FORMAT "channel_format" -#define PIXEL_FORMAT "pixel_format" -#define COLOR_SPACE "color_space" -#define COLOR_RANGE "color_range" -#define BUFFERING "buffering" -#define DEACTIVATE_WNS "deactivate_when_not_showing" -#define AUTO_START "auto_start" -#define KEYER "keyer" -#define SWAP "swap" +#define DEVICE_HASH "device_hash" +#define DEVICE_NAME "device_name" +#define VIDEO_CONNECTION "video_connection" +#define AUDIO_CONNECTION "audio_connection" +#define MODE_ID "mode_id" +#define MODE_NAME "mode_name" +#define CHANNEL_FORMAT "channel_format" +#define PIXEL_FORMAT "pixel_format" +#define COLOR_SPACE "color_space" +#define COLOR_RANGE "color_range" +#define BUFFERING "buffering" +#define DEACTIVATE_WNS "deactivate_when_not_showing" +#define AUTO_START "auto_start" +#define KEYER "keyer" +#define SWAP "swap" -#define TEXT_DEVICE obs_module_text("Device") -#define TEXT_VIDEO_CONNECTION obs_module_text("VideoConnection") -#define TEXT_AUDIO_CONNECTION obs_module_text("AudioConnection") -#define TEXT_MODE obs_module_text("Mode") -#define TEXT_PIXEL_FORMAT obs_module_text("PixelFormat") -#define TEXT_COLOR_SPACE obs_module_text("ColorSpace") -#define TEXT_COLOR_SPACE_DEFAULT obs_module_text("ColorSpace.Default") -#define TEXT_COLOR_RANGE obs_module_text("ColorRange") -#define TEXT_COLOR_RANGE_DEFAULT obs_module_text("ColorRange.Default") -#define TEXT_COLOR_RANGE_PARTIAL obs_module_text("ColorRange.Partial") -#define TEXT_COLOR_RANGE_FULL obs_module_text("ColorRange.Full") -#define TEXT_CHANNEL_FORMAT obs_module_text("ChannelFormat") -#define TEXT_CHANNEL_FORMAT_NONE obs_module_text("ChannelFormat.None") -#define TEXT_CHANNEL_FORMAT_2_0CH obs_module_text("ChannelFormat.2_0ch") -#define TEXT_CHANNEL_FORMAT_2_1CH obs_module_text("ChannelFormat.2_1ch") -#define TEXT_CHANNEL_FORMAT_4_0CH obs_module_text("ChannelFormat.4_0ch") -#define TEXT_CHANNEL_FORMAT_4_1CH obs_module_text("ChannelFormat.4_1ch") -#define TEXT_CHANNEL_FORMAT_5_1CH obs_module_text("ChannelFormat.5_1ch") -#define TEXT_CHANNEL_FORMAT_7_1CH obs_module_text("ChannelFormat.7_1ch") -#define TEXT_BUFFERING obs_module_text("Buffering") -#define TEXT_DWNS obs_module_text("DeactivateWhenNotShowing") -#define TEXT_AUTO_START obs_module_text("AutoStart") -#define TEXT_ENABLE_KEYER obs_module_text("Keyer") -#define TEXT_SWAP obs_module_text("SwapFC-LFE") -#define TEXT_SWAP_TOOLTIP obs_module_text("SwapFC-LFE.Tooltip") +#define TEXT_DEVICE obs_module_text("Device") +#define TEXT_VIDEO_CONNECTION obs_module_text("VideoConnection") +#define TEXT_AUDIO_CONNECTION obs_module_text("AudioConnection") +#define TEXT_MODE obs_module_text("Mode") +#define TEXT_PIXEL_FORMAT obs_module_text("PixelFormat") +#define TEXT_COLOR_SPACE obs_module_text("ColorSpace") +#define TEXT_COLOR_SPACE_DEFAULT obs_module_text("ColorSpace.Default") +#define TEXT_COLOR_RANGE obs_module_text("ColorRange") +#define TEXT_COLOR_RANGE_DEFAULT obs_module_text("ColorRange.Default") +#define TEXT_COLOR_RANGE_PARTIAL obs_module_text("ColorRange.Partial") +#define TEXT_COLOR_RANGE_FULL obs_module_text("ColorRange.Full") +#define TEXT_CHANNEL_FORMAT obs_module_text("ChannelFormat") +#define TEXT_CHANNEL_FORMAT_NONE obs_module_text("ChannelFormat.None") +#define TEXT_CHANNEL_FORMAT_2_0CH obs_module_text("ChannelFormat.2_0ch") +#define TEXT_CHANNEL_FORMAT_2_1CH obs_module_text("ChannelFormat.2_1ch") +#define TEXT_CHANNEL_FORMAT_4_0CH obs_module_text("ChannelFormat.4_0ch") +#define TEXT_CHANNEL_FORMAT_4_1CH obs_module_text("ChannelFormat.4_1ch") +#define TEXT_CHANNEL_FORMAT_5_1CH obs_module_text("ChannelFormat.5_1ch") +#define TEXT_CHANNEL_FORMAT_7_1CH obs_module_text("ChannelFormat.7_1ch") +#define TEXT_BUFFERING obs_module_text("Buffering") +#define TEXT_DWNS obs_module_text("DeactivateWhenNotShowing") +#define TEXT_AUTO_START obs_module_text("AutoStart") +#define TEXT_ENABLE_KEYER obs_module_text("Keyer") +#define TEXT_SWAP obs_module_text("SwapFC-LFE") +#define TEXT_SWAP_TOOLTIP obs_module_text("SwapFC-LFE.Tooltip")
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/data/locale/ar-SA.ini -> obs-studio-24.0.0.tar.xz/plugins/decklink/data/locale/ar-SA.ini
Changed
@@ -17,4 +17,6 @@ ChannelFormat.7_1ch="7.1ch" DeactivateWhenNotShowing="التعطيل عندما لا يكون ظاهراً" AutoStart="البدء تلقائياً مع التشغيل" +VideoConnection="مدخل الفيديو" +AudioConnection="مدخل الصوت"
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/decklink/data/locale/de-DE.ini
Changed
@@ -1,4 +1,4 @@ -BlackmagicDevice="Blackmagic-Gerät" +BlackmagicDevice="Blackmagic‐Gerät" Device="Gerät" Mode="Modus" Buffering="Puffern benutzen" @@ -11,16 +11,16 @@ ColorRange.Full="Voll" ChannelFormat="Kanal" ChannelFormat.None="Keins" -ChannelFormat.2_0ch="2 Kanal" -ChannelFormat.2_1ch="2.1 Kanal" -ChannelFormat.4_0ch="4 Kanal" -ChannelFormat.4_1ch="4.1 Kanal" -ChannelFormat.5_1ch="5.1 Kanal" -ChannelFormat.7_1ch="7.1 Kanal" +ChannelFormat.2_0ch="2‐Kanal" +ChannelFormat.2_1ch="2.1‐Kanal" +ChannelFormat.4_0ch="4‐Kanal" +ChannelFormat.4_1ch="4.1‐Kanal" +ChannelFormat.5_1ch="5.1‐Kanal" +ChannelFormat.7_1ch="7.1‐Kanal" DeactivateWhenNotShowing="Deaktivieren, wenn die Quelle nicht angezeigt wird" AutoStart="Automatisch beim Öffnen starten" SwapFC-LFE="FC und LFE tauschen" -SwapFC-LFE.Tooltip="Vorderen Front-Center-Kanal und LFE-Kanal tauschen" +SwapFC-LFE.Tooltip="Vorderen Front‐Center‐Kanal und LFE‐Kanal tauschen" VideoConnection="Videoverbindung" AudioConnection="Audioverbindung"
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/decklink/data/locale/gl-ES.ini
Changed
@@ -1,5 +1,26 @@ BlackmagicDevice="Dispositivo Blackmagic" Device="Dispositivo" Mode="Modo" -Buffering="Utilizar o almacenamento no búfer" +Buffering="Utilizar o almacenamento na memoria temporal" +PixelFormat="Formato do píxel" +ColorSpace="Espazo de cor" +ColorSpace.Default="Predeterminado" +ColorRange="Gama de cores" +ColorRange.Default="Predeterminado" +ColorRange.Partial="Parcial" +ColorRange.Full="Total" +ChannelFormat="Canle" +ChannelFormat.None="Ningún" +ChannelFormat.2_0ch="2ch" +ChannelFormat.2_1ch="2.1ch" +ChannelFormat.4_0ch="4ch" +ChannelFormat.4_1ch="4.1ch" +ChannelFormat.5_1ch="5.1ch" +ChannelFormat.7_1ch="7.1ch" +DeactivateWhenNotShowing="Desactivado cando non se amose" +AutoStart="Comezar no inicio" +SwapFC-LFE="Intercambiar FC e LFE" +SwapFC-LFE.Tooltip="Intercambiar a canle central frontal e a canle LFE" +VideoConnection="Conexión de vídeo" +AudioConnection="Conexión de son"
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/decklink/data/locale/ro-RO.ini
Changed
@@ -2,7 +2,13 @@ Device="Dispozitiv" Mode="Mod" Buffering="Folosește zona tampon" -PixelFormat="Formatul pixelilor" +PixelFormat="Format pentru pixeli" +ColorSpace="Spațiu de culori" ColorSpace.Default="Implicit" +ColorRange="Gamă de culori" ColorRange.Default="Implicit" +ColorRange.Partial="Parțială" +ColorRange.Full="Completă" +VideoConnection="Conexiune video" +AudioConnection="Conexiune audio"
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/decklink/data/locale/sl-SI.ini
Changed
@@ -2,4 +2,25 @@ Device="Naprava" Mode="Način" Buffering="Uporabi medpomnilnik" +PixelFormat="Oblika sl. točk" +ColorSpace="Barvni prostor" +ColorSpace.Default="Privzeto" +ColorRange="Barvni razpon" +ColorRange.Default="Privzeto" +ColorRange.Partial="Delno" +ColorRange.Full="Polno" +ChannelFormat="Kanal" +ChannelFormat.None="Brez" +ChannelFormat.2_0ch="2 kan." +ChannelFormat.2_1ch="2.1 kan." +ChannelFormat.4_0ch="4 kan." +ChannelFormat.4_1ch="4.1 kan." +ChannelFormat.5_1ch="5.1 kan." +ChannelFormat.7_1ch="7.1 kan." +DeactivateWhenNotShowing="Onemogoči, ko ni prikazano" +AutoStart="Samodejno zaženi ob zagonu" +SwapFC-LFE="Zamenjaj SS in nizke tone" +SwapFC-LFE.Tooltip="Zamenjaj sprednji sredinski kanal in kanal z nizkimi toni" +VideoConnection="Slikovna povezava" +AudioConnection="Zvočna povezava"
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/data/locale/uk-UA.ini -> obs-studio-24.0.0.tar.xz/plugins/decklink/data/locale/uk-UA.ini
Changed
@@ -3,7 +3,9 @@ Mode="Режим" Buffering="Увімкнути буферизацію" PixelFormat="Формат пікселів" +ColorSpace="Колірний простір" ColorSpace.Default="За замовчуванням" +ColorRange="Колірний діапазон" ColorRange.Default="За замовчуванням" ColorRange.Partial="Частковий" ColorRange.Full="Повний"
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-device-discovery.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-device-discovery.cpp
Changed
@@ -54,8 +54,8 @@ return ret; } -HRESULT STDMETHODCALLTYPE DeckLinkDeviceDiscovery::DeckLinkDeviceArrived( - IDeckLink *device) +HRESULT STDMETHODCALLTYPE +DeckLinkDeviceDiscovery::DeckLinkDeviceArrived(IDeckLink *device) { DeckLinkDevice *newDev = new DeckLinkDevice(device); if (!newDev->Init()) { @@ -73,8 +73,8 @@ return S_OK; } -HRESULT STDMETHODCALLTYPE DeckLinkDeviceDiscovery::DeckLinkDeviceRemoved( - IDeckLink *device) +HRESULT STDMETHODCALLTYPE +DeckLinkDeviceDiscovery::DeckLinkDeviceRemoved(IDeckLink *device) { std::lock_guard<std::recursive_mutex> lock(deviceMutex); @@ -98,7 +98,7 @@ } HRESULT STDMETHODCALLTYPE DeckLinkDeviceDiscovery::QueryInterface(REFIID iid, - LPVOID *ppv) + LPVOID *ppv) { HRESULT result = E_NOINTERFACE; @@ -110,7 +110,7 @@ AddRef(); result = S_OK; } else if (memcmp(&iid, &IID_IDeckLinkDeviceNotificationCallback, - sizeof(REFIID)) == 0) { + sizeof(REFIID)) == 0) { *ppv = (IDeckLinkDeviceNotificationCallback *)this; AddRef(); result = S_OK;
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-device-discovery.hpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-device-discovery.hpp
Changed
@@ -9,7 +9,7 @@ class DeckLinkDevice; typedef void (*DeviceChangeCallback)(void *param, DeckLinkDevice *device, - bool added); + bool added); struct DeviceChangeInfo { DeviceChangeCallback callback; @@ -19,11 +19,11 @@ class DeckLinkDeviceDiscovery : public IDeckLinkDeviceNotificationCallback { protected: ComPtr<IDeckLinkDiscovery> discovery; - long refCount = 1; - bool initialized = false; + long refCount = 1; + bool initialized = false; std::recursive_mutex deviceMutex; - std::vector<DeckLinkDevice*> devices; + std::vector<DeckLinkDevice *> devices; std::vector<DeviceChangeInfo> callbacks; public: @@ -44,8 +44,7 @@ info.param = param; for (DeviceChangeInfo &curCB : callbacks) { - if (curCB.callback == callback && - curCB.param == param) + if (curCB.callback == callback && curCB.param == param) return; } @@ -60,7 +59,7 @@ DeviceChangeInfo &curCB = callbacks[i]; if (curCB.callback == callback && - curCB.param == param) { + curCB.param == param) { callbacks.erase(callbacks.begin() + i); return; } @@ -69,9 +68,9 @@ DeckLinkDevice *FindByHash(const char *hash); - inline void Lock() {deviceMutex.lock();} - inline void Unlock() {deviceMutex.unlock();} - inline const std::vector<DeckLinkDevice*> &GetDevices() const + inline void Lock() { deviceMutex.lock(); } + inline void Unlock() { deviceMutex.unlock(); } + inline const std::vector<DeckLinkDevice *> &GetDevices() const { return devices; }
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-device-instance.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-device-instance.cpp
Changed
@@ -13,7 +13,8 @@ static inline enum video_format ConvertPixelFormat(BMDPixelFormat format) { switch (format) { - case bmdFormat8BitBGRA: return VIDEO_FORMAT_BGRX; + case bmdFormat8BitBGRA: + return VIDEO_FORMAT_BGRX; default: case bmdFormat8BitYUV:; @@ -38,7 +39,8 @@ } } -static inline audio_repack_mode_t ConvertRepackFormat(speaker_layout format, bool swap) +static inline audio_repack_mode_t ConvertRepackFormat(speaker_layout format, + bool swap) { switch (format) { case SPEAKERS_2POINT1: @@ -46,11 +48,11 @@ case SPEAKERS_4POINT0: return repack_mode_8to4ch; case SPEAKERS_4POINT1: - return swap? repack_mode_8to5ch_swap:repack_mode_8to5ch; + return swap ? repack_mode_8to5ch_swap : repack_mode_8to5ch; case SPEAKERS_5POINT1: return swap ? repack_mode_8to6ch_swap : repack_mode_8to6ch; case SPEAKERS_7POINT1: - return swap ? repack_mode_8ch_swap: repack_mode_8ch; + return swap ? repack_mode_8ch_swap : repack_mode_8ch; default: assert(false && "No repack requested"); return (audio_repack_mode_t)-1; @@ -58,21 +60,18 @@ } DeckLinkDeviceInstance::DeckLinkDeviceInstance(DecklinkBase *decklink_, - DeckLinkDevice *device_) : - currentFrame(), currentPacket(), decklink(decklink_), device(device_) + DeckLinkDevice *device_) + : currentFrame(), currentPacket(), decklink(decklink_), device(device_) { currentPacket.samples_per_sec = 48000; - currentPacket.speakers = SPEAKERS_STEREO; - currentPacket.format = AUDIO_FORMAT_16BIT; + currentPacket.speakers = SPEAKERS_STEREO; + currentPacket.format = AUDIO_FORMAT_16BIT; } -DeckLinkDeviceInstance::~DeckLinkDeviceInstance() -{ -} +DeckLinkDeviceInstance::~DeckLinkDeviceInstance() {} void DeckLinkDeviceInstance::HandleAudioPacket( - IDeckLinkAudioInputPacket *audioPacket, - const uint64_t timestamp) + IDeckLinkAudioInputPacket *audioPacket, const uint64_t timestamp) { if (audioPacket == nullptr) return; @@ -83,11 +82,12 @@ return; } - const uint32_t frameCount = (uint32_t)audioPacket->GetSampleFrameCount(); - currentPacket.frames = frameCount; - currentPacket.timestamp = timestamp; + const uint32_t frameCount = + (uint32_t)audioPacket->GetSampleFrameCount(); + currentPacket.frames = frameCount; + currentPacket.timestamp = timestamp; - if (decklink && !static_cast<DeckLinkInput*>(decklink)->buffering) { + if (decklink && !static_cast<DeckLinkInput *>(decklink)->buffering) { currentPacket.timestamp = os_gettime_ns(); currentPacket.timestamp -= (uint64_t)frameCount * 1000000000ULL / @@ -99,8 +99,9 @@ if (channelFormat != SPEAKERS_UNKNOWN && channelFormat != SPEAKERS_MONO && channelFormat != SPEAKERS_STEREO && - (channelFormat != SPEAKERS_7POINT1 || static_cast<DeckLinkInput*>(decklink)->swap) - && maxdevicechannel >= 8) { + (channelFormat != SPEAKERS_7POINT1 || + static_cast<DeckLinkInput *>(decklink)->swap) && + maxdevicechannel >= 8) { if (audioRepacker->repack((uint8_t *)bytes, frameCount) < 0) { LOG(LOG_ERROR, "Failed to convert audio packet data"); @@ -112,13 +113,15 @@ } nextAudioTS = timestamp + - ((uint64_t)frameCount * 1000000000ULL / 48000ULL) + 1; + ((uint64_t)frameCount * 1000000000ULL / 48000ULL) + 1; - obs_source_output_audio(static_cast<DeckLinkInput*>(decklink)->GetSource(), ¤tPacket); + obs_source_output_audio( + static_cast<DeckLinkInput *>(decklink)->GetSource(), + ¤tPacket); } void DeckLinkDeviceInstance::HandleVideoFrame( - IDeckLinkVideoInputFrame *videoFrame, const uint64_t timestamp) + IDeckLinkVideoInputFrame *videoFrame, const uint64_t timestamp) { if (videoFrame == nullptr) return; @@ -129,13 +132,15 @@ return; } - currentFrame.data[0] = (uint8_t *)bytes; + currentFrame.data[0] = (uint8_t *)bytes; currentFrame.linesize[0] = (uint32_t)videoFrame->GetRowBytes(); - currentFrame.width = (uint32_t)videoFrame->GetWidth(); - currentFrame.height = (uint32_t)videoFrame->GetHeight(); - currentFrame.timestamp = timestamp; + currentFrame.width = (uint32_t)videoFrame->GetWidth(); + currentFrame.height = (uint32_t)videoFrame->GetHeight(); + currentFrame.timestamp = timestamp; - obs_source_output_video2(static_cast<DeckLinkInput*>(decklink)->GetSource(), ¤tFrame); + obs_source_output_video2( + static_cast<DeckLinkInput *>(decklink)->GetSource(), + ¤tFrame); } void DeckLinkDeviceInstance::FinalizeStream() @@ -145,8 +150,7 @@ if (channelFormat != SPEAKERS_UNKNOWN) input->DisableAudioInput(); - if (audioRepacker != nullptr) - { + if (audioRepacker != nullptr) { delete audioRepacker; audioRepacker = nullptr; } @@ -163,7 +167,7 @@ currentFrame.format = ConvertPixelFormat(pixelFormat); - colorSpace = static_cast<DeckLinkInput*>(decklink)->GetColorSpace(); + colorSpace = static_cast<DeckLinkInput *>(decklink)->GetColorSpace(); if (colorSpace == VIDEO_CS_DEFAULT) { const BMDDisplayModeFlags flags = mode_->GetDisplayModeFlags(); if (flags & bmdDisplayModeColorspaceRec709) @@ -176,24 +180,25 @@ activeColorSpace = colorSpace; } - colorRange = static_cast<DeckLinkInput*>(decklink)->GetColorRange(); + colorRange = static_cast<DeckLinkInput *>(decklink)->GetColorRange(); currentFrame.range = colorRange; video_format_get_parameters(activeColorSpace, colorRange, - currentFrame.color_matrix, currentFrame.color_range_min, - currentFrame.color_range_max); + currentFrame.color_matrix, + currentFrame.color_range_min, + currentFrame.color_range_max); #ifdef LOG_SETUP_VIDEO_FORMAT LOG(LOG_INFO, "Setup video format: %s, %s, %s", - pixelFormat == bmdFormat8BitYUV ? "YUV" : "RGB", - activeColorSpace == VIDEO_CS_709 ? "BT.709" : "BT.601", - colorRange == VIDEO_RANGE_FULL ? "full" : "limited"); + pixelFormat == bmdFormat8BitYUV ? "YUV" : "RGB", + activeColorSpace == VIDEO_CS_709 ? "BT.709" : "BT.601", + colorRange == VIDEO_RANGE_FULL ? "full" : "limited"); #endif } bool DeckLinkDeviceInstance::StartCapture(DeckLinkDeviceMode *mode_, - BMDVideoConnection bmdVideoConnection, - BMDAudioConnection bmdAudioConnection) + BMDVideoConnection bmdVideoConnection, + BMDAudioConnection bmdAudioConnection) { if (mode != nullptr) return false; @@ -205,33 +210,33 @@ if (!device->GetInput(&input)) return false; - IDeckLinkConfiguration *deckLinkConfiguration = NULL; HRESULT result = input->QueryInterface(IID_IDeckLinkConfiguration, - (void**)&deckLinkConfiguration); - if (result != S_OK) - { + (void **)&deckLinkConfiguration); + if (result != S_OK) { LOG(LOG_ERROR, - "Could not obtain the IDeckLinkConfiguration interface: %08x\n", - result); + "Could not obtain the IDeckLinkConfiguration interface: %08x\n", + result); } else { if (bmdVideoConnection > 0) { result = deckLinkConfiguration->SetInt( - bmdDeckLinkConfigVideoInputConnection, bmdVideoConnection); + bmdDeckLinkConfigVideoInputConnection, + bmdVideoConnection); if (result != S_OK) { LOG(LOG_ERROR, - "Couldn't set input video port to %d\n\n", - bmdVideoConnection); + "Couldn't set input video port to %d\n\n", + bmdVideoConnection); } } if (bmdAudioConnection > 0) { result = deckLinkConfiguration->SetInt( - bmdDeckLinkConfigAudioInputConnection, bmdAudioConnection); + bmdDeckLinkConfigAudioInputConnection, + bmdAudioConnection); if (result != S_OK) { LOG(LOG_ERROR, - "Couldn't set input audio port to %d\n\n", - bmdVideoConnection); + "Couldn't set input audio port to %d\n\n", + bmdVideoConnection); } } } @@ -248,12 +253,13 @@ flags = bmdVideoInputEnableFormatDetection; } else { displayMode = mode_->GetDisplayMode(); - pixelFormat = static_cast<DeckLinkInput*>(decklink)->GetPixelFormat(); + pixelFormat = + static_cast<DeckLinkInput *>(decklink)->GetPixelFormat(); flags = bmdVideoInputFlagDefault; } - const HRESULT videoResult = input->EnableVideoInput(displayMode, - pixelFormat, flags); + const HRESULT videoResult = + input->EnableVideoInput(displayMode, pixelFormat, flags); if (videoResult != S_OK) { LOG(LOG_ERROR, "Failed to enable video input"); return false; @@ -261,28 +267,30 @@ SetupVideoFormat(mode_); - channelFormat = static_cast<DeckLinkInput*>(decklink)->GetChannelFormat(); + channelFormat = + static_cast<DeckLinkInput *>(decklink)->GetChannelFormat(); currentPacket.speakers = channelFormat; - swap = static_cast<DeckLinkInput*>(decklink)->swap; + swap = static_cast<DeckLinkInput *>(decklink)->swap; int maxdevicechannel = device->GetMaxChannel(); if (channelFormat != SPEAKERS_UNKNOWN) { const int channel = ConvertChannelFormat(channelFormat); const HRESULT audioResult = input->EnableAudioInput( - bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, - channel); + bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, + channel); if (audioResult != S_OK) - LOG(LOG_WARNING, "Failed to enable audio input; continuing..."); + LOG(LOG_WARNING, + "Failed to enable audio input; continuing..."); if (channelFormat != SPEAKERS_UNKNOWN && channelFormat != SPEAKERS_MONO && channelFormat != SPEAKERS_STEREO && - (channelFormat != SPEAKERS_7POINT1 || swap) - && maxdevicechannel >= 8) { + (channelFormat != SPEAKERS_7POINT1 || swap) && + maxdevicechannel >= 8) { - const audio_repack_mode_t repack_mode = ConvertRepackFormat - (channelFormat, swap); + const audio_repack_mode_t repack_mode = + ConvertRepackFormat(channelFormat, swap); audioRepacker = new AudioRepacker(repack_mode); } } @@ -310,7 +318,7 @@ return false; LOG(LOG_INFO, "Stopping capture of '%s'...", - GetDevice()->GetDisplayName().c_str()); + GetDevice()->GetDisplayName().c_str()); input->StopStreams(); FinalizeStream(); @@ -331,18 +339,15 @@ return false; const HRESULT videoResult = output->EnableVideoOutput( - mode_->GetDisplayMode(), - bmdVideoOutputFlagDefault); + mode_->GetDisplayMode(), bmdVideoOutputFlagDefault); if (videoResult != S_OK) { LOG(LOG_ERROR, "Failed to enable video output"); return false; } const HRESULT audioResult = output->EnableAudioOutput( - bmdAudioSampleRate48kHz, - bmdAudioSampleType16bitInteger, - 2, - bmdAudioOutputStreamTimestamped); + bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, 2, + bmdAudioOutputStreamTimestamped); if (audioResult != S_OK) { LOG(LOG_ERROR, "Failed to enable audio output"); return false; @@ -362,7 +367,7 @@ } } - auto decklinkOutput = dynamic_cast<DeckLinkOutput*>(decklink); + auto decklinkOutput = dynamic_cast<DeckLinkOutput *>(decklink); if (decklinkOutput == nullptr) return false; @@ -378,13 +383,11 @@ HRESULT result; result = output->CreateVideoFrame(decklinkOutput->GetWidth(), - decklinkOutput->GetHeight(), - rowBytes, - pixelFormat, - bmdFrameFlagDefault, - &decklinkOutputFrame); + decklinkOutput->GetHeight(), rowBytes, + pixelFormat, bmdFrameFlagDefault, + &decklinkOutputFrame); if (result != S_OK) { - blog(LOG_ERROR ,"failed to make frame 0x%X", result); + blog(LOG_ERROR, "failed to make frame 0x%X", result); return false; } @@ -397,7 +400,7 @@ return false; LOG(LOG_INFO, "Stopping output of '%s'...", - GetDevice()->GetDisplayName().c_str()); + GetDevice()->GetDisplayName().c_str()); output->DisableVideoOutput(); output->DisableAudioOutput(); @@ -412,12 +415,12 @@ void DeckLinkDeviceInstance::DisplayVideoFrame(video_data *frame) { - auto decklinkOutput = dynamic_cast<DeckLinkOutput*>(decklink); + auto decklinkOutput = dynamic_cast<DeckLinkOutput *>(decklink); if (decklinkOutput == nullptr) return; uint8_t *destData; - decklinkOutputFrame->GetBytes((void**)&destData); + decklinkOutputFrame->GetBytes((void **)&destData); uint8_t *outData = frame->data[0]; @@ -426,8 +429,8 @@ rowBytes = decklinkOutput->GetWidth() * 4; } - std::copy(outData, outData + (decklinkOutput->GetHeight() * - rowBytes), destData); + std::copy(outData, outData + (decklinkOutput->GetHeight() * rowBytes), + destData); output->DisplayVideoFrameSync(decklinkOutputFrame); } @@ -435,16 +438,15 @@ void DeckLinkDeviceInstance::WriteAudio(audio_data *frames) { uint32_t sampleFramesWritten; - output->WriteAudioSamplesSync(frames->data[0], - frames->frames, - &sampleFramesWritten); + output->WriteAudioSamplesSync(frames->data[0], frames->frames, + &sampleFramesWritten); } #define TIME_BASE 1000000000 HRESULT STDMETHODCALLTYPE DeckLinkDeviceInstance::VideoInputFrameArrived( - IDeckLinkVideoInputFrame *videoFrame, - IDeckLinkAudioInputPacket *audioPacket) + IDeckLinkVideoInputFrame *videoFrame, + IDeckLinkAudioInputPacket *audioPacket) { BMDTimeValue videoTS = 0; BMDTimeValue videoDur = 0; @@ -481,9 +483,8 @@ } HRESULT STDMETHODCALLTYPE DeckLinkDeviceInstance::VideoInputFormatChanged( - BMDVideoInputFormatChangedEvents events, - IDeckLinkDisplayMode *newMode, - BMDDetectedVideoInputFormatFlags detectedSignalFlags) + BMDVideoInputFormatChangedEvents events, IDeckLinkDisplayMode *newMode, + BMDDetectedVideoInputFormatFlags detectedSignalFlags) { input->PauseStreams(); @@ -506,8 +507,8 @@ } } - const HRESULT videoResult = input->EnableVideoInput(displayMode, - pixelFormat, bmdVideoInputEnableFormatDetection); + const HRESULT videoResult = input->EnableVideoInput( + displayMode, pixelFormat, bmdVideoInputEnableFormatDetection); if (videoResult != S_OK) { LOG(LOG_ERROR, "Failed to enable video input"); input->StopStreams(); @@ -530,7 +531,7 @@ } HRESULT STDMETHODCALLTYPE DeckLinkDeviceInstance::QueryInterface(REFIID iid, - LPVOID *ppv) + LPVOID *ppv) { HRESULT result = E_NOINTERFACE; @@ -542,7 +543,7 @@ AddRef(); result = S_OK; } else if (memcmp(&iid, &IID_IDeckLinkNotificationCallback, - sizeof(REFIID)) == 0) { + sizeof(REFIID)) == 0) { *ppv = (IDeckLinkNotificationCallback *)this; AddRef(); result = S_OK;
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-device-instance.hpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-device-instance.hpp
Changed
@@ -1,6 +1,7 @@ #pragma once -#define LOG(level, message, ...) blog(level, "%s: " message, "decklink", ##__VA_ARGS__) +#define LOG(level, message, ...) \ + blog(level, "%s: " message, "decklink", ##__VA_ARGS__) #include <obs-module.h> #include "decklink-device.hpp" @@ -13,25 +14,25 @@ protected: struct obs_source_frame2 currentFrame; struct obs_source_audio currentPacket; - DecklinkBase *decklink = nullptr; - DeckLinkDevice *device = nullptr; - DeckLinkDeviceMode *mode = nullptr; - BMDVideoConnection videoConnection; - BMDAudioConnection audioConnection; - BMDDisplayMode displayMode = bmdModeNTSC; - BMDPixelFormat pixelFormat = bmdFormat8BitYUV; - video_colorspace colorSpace = VIDEO_CS_DEFAULT; - video_colorspace activeColorSpace = VIDEO_CS_DEFAULT; - video_range_type colorRange = VIDEO_RANGE_DEFAULT; - ComPtr<IDeckLinkInput> input; + DecklinkBase *decklink = nullptr; + DeckLinkDevice *device = nullptr; + DeckLinkDeviceMode *mode = nullptr; + BMDVideoConnection videoConnection; + BMDAudioConnection audioConnection; + BMDDisplayMode displayMode = bmdModeNTSC; + BMDPixelFormat pixelFormat = bmdFormat8BitYUV; + video_colorspace colorSpace = VIDEO_CS_DEFAULT; + video_colorspace activeColorSpace = VIDEO_CS_DEFAULT; + video_range_type colorRange = VIDEO_RANGE_DEFAULT; + ComPtr<IDeckLinkInput> input; ComPtr<IDeckLinkOutput> output; - volatile long refCount = 1; - int64_t audioOffset = 0; - uint64_t nextAudioTS = 0; - uint64_t lastVideoTS = 0; - AudioRepacker *audioRepacker = nullptr; - speaker_layout channelFormat = SPEAKERS_STEREO; - bool swap; + volatile long refCount = 1; + int64_t audioOffset = 0; + uint64_t nextAudioTS = 0; + uint64_t lastVideoTS = 0; + AudioRepacker *audioRepacker = nullptr; + speaker_layout channelFormat = SPEAKERS_STEREO; + bool swap; IDeckLinkMutableVideoFrame *decklinkOutputFrame = nullptr; @@ -39,45 +40,63 @@ void SetupVideoFormat(DeckLinkDeviceMode *mode_); void HandleAudioPacket(IDeckLinkAudioInputPacket *audioPacket, - const uint64_t timestamp); + const uint64_t timestamp); void HandleVideoFrame(IDeckLinkVideoInputFrame *videoFrame, - const uint64_t timestamp); + const uint64_t timestamp); public: DeckLinkDeviceInstance(DecklinkBase *decklink, DeckLinkDevice *device); virtual ~DeckLinkDeviceInstance(); - inline DeckLinkDevice *GetDevice() const {return device;} + inline DeckLinkDevice *GetDevice() const { return device; } inline long long GetActiveModeId() const { return mode ? mode->GetId() : 0; } - inline BMDPixelFormat GetActivePixelFormat() const {return pixelFormat;} - inline video_colorspace GetActiveColorSpace() const {return colorSpace;} - inline video_range_type GetActiveColorRange() const {return colorRange;} - inline speaker_layout GetActiveChannelFormat() const {return channelFormat;} - inline bool GetActiveSwapState() const {return swap;} - inline BMDVideoConnection GetVideoConnection() const {return videoConnection;} - inline BMDAudioConnection GetAudioConnection() const {return audioConnection;} + inline BMDPixelFormat GetActivePixelFormat() const + { + return pixelFormat; + } + inline video_colorspace GetActiveColorSpace() const + { + return colorSpace; + } + inline video_range_type GetActiveColorRange() const + { + return colorRange; + } + inline speaker_layout GetActiveChannelFormat() const + { + return channelFormat; + } + inline bool GetActiveSwapState() const { return swap; } + inline BMDVideoConnection GetVideoConnection() const + { + return videoConnection; + } + inline BMDAudioConnection GetAudioConnection() const + { + return audioConnection; + } - inline DeckLinkDeviceMode *GetMode() const {return mode;} + inline DeckLinkDeviceMode *GetMode() const { return mode; } bool StartCapture(DeckLinkDeviceMode *mode, - BMDVideoConnection bmdVideoConnection, - BMDAudioConnection bmdAudioConnection); + BMDVideoConnection bmdVideoConnection, + BMDAudioConnection bmdAudioConnection); bool StopCapture(void); bool StartOutput(DeckLinkDeviceMode *mode_); bool StopOutput(void); - HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( - IDeckLinkVideoInputFrame *videoFrame, - IDeckLinkAudioInputPacket *audioPacket); + HRESULT STDMETHODCALLTYPE + VideoInputFrameArrived(IDeckLinkVideoInputFrame *videoFrame, + IDeckLinkAudioInputPacket *audioPacket); HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( - BMDVideoInputFormatChangedEvents events, - IDeckLinkDisplayMode *newMode, - BMDDetectedVideoInputFormatFlags detectedSignalFlags); + BMDVideoInputFormatChangedEvents events, + IDeckLinkDisplayMode *newMode, + BMDDetectedVideoInputFormatFlags detectedSignalFlags); ULONG STDMETHODCALLTYPE AddRef(void); HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv);
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-device-mode.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-device-mode.cpp
Changed
@@ -1,7 +1,7 @@ #include "decklink-device-mode.hpp" -DeckLinkDeviceMode::DeckLinkDeviceMode(IDeckLinkDisplayMode *mode, - long long id) : id(id), mode(mode) +DeckLinkDeviceMode::DeckLinkDeviceMode(IDeckLinkDisplayMode *mode, long long id) + : id(id), mode(mode) { if (mode == nullptr) return; @@ -13,8 +13,8 @@ DeckLinkStringToStdString(decklinkStringName, name); } -DeckLinkDeviceMode::DeckLinkDeviceMode(const std::string& name, long long id) : - id(id), mode(nullptr), name(name) +DeckLinkDeviceMode::DeckLinkDeviceMode(const std::string &name, long long id) + : id(id), mode(nullptr), name(name) { } @@ -61,7 +61,7 @@ return id; } -const std::string& DeckLinkDeviceMode::GetName(void) const +const std::string &DeckLinkDeviceMode::GetName(void) const { return name; }
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-device-mode.hpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-device-mode.hpp
Changed
@@ -4,23 +4,23 @@ #include <string> -#define MODE_ID_AUTO -1 +#define MODE_ID_AUTO -1 class DeckLinkDeviceMode { protected: - long long id; + long long id; IDeckLinkDisplayMode *mode; - std::string name; + std::string name; public: DeckLinkDeviceMode(IDeckLinkDisplayMode *mode, long long id); - DeckLinkDeviceMode(const std::string& name, long long id); + DeckLinkDeviceMode(const std::string &name, long long id); virtual ~DeckLinkDeviceMode(void); BMDDisplayMode GetDisplayMode(void) const; BMDDisplayModeFlags GetDisplayModeFlags(void) const; long long GetId(void) const; - const std::string& GetName(void) const; + const std::string &GetName(void) const; void SetMode(IDeckLinkDisplayMode *mode);
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-device.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-device.cpp
Changed
@@ -4,9 +4,7 @@ #include <util/threading.h> -DeckLinkDevice::DeckLinkDevice(IDeckLink *device_) : device(device_) -{ -} +DeckLinkDevice::DeckLinkDevice(IDeckLink *device_) : device(device_) {} DeckLinkDevice::~DeckLinkDevice(void) { @@ -34,15 +32,15 @@ { ComPtr<IDeckLinkAttributes> attributes; const HRESULT result = device->QueryInterface(IID_IDeckLinkAttributes, - (void **)&attributes); + (void **)&attributes); if (result == S_OK) { decklink_bool_t detectable = false; if (attributes->GetFlag(BMDDeckLinkSupportsInputFormatDetection, - &detectable) == S_OK && !!detectable) { - DeckLinkDeviceMode *mode = new DeckLinkDeviceMode( - "Auto", - MODE_ID_AUTO); + &detectable) == S_OK && + !!detectable) { + DeckLinkDeviceMode *mode = + new DeckLinkDeviceMode("Auto", MODE_ID_AUTO); inputModes.push_back(mode); inputModeIdMap[MODE_ID_AUTO] = mode; } @@ -50,7 +48,8 @@ // Find input modes ComPtr<IDeckLinkInput> input; - if (device->QueryInterface(IID_IDeckLinkInput, (void **) &input) == S_OK) { + if (device->QueryInterface(IID_IDeckLinkInput, (void **)&input) == + S_OK) { IDeckLinkDisplayModeIterator *modeIterator; if (input->GetDisplayModeIterator(&modeIterator) == S_OK) { IDeckLinkDisplayMode *displayMode; @@ -61,7 +60,8 @@ continue; DeckLinkDeviceMode *mode = - new DeckLinkDeviceMode(displayMode, modeId); + new DeckLinkDeviceMode(displayMode, + modeId); inputModes.push_back(mode); inputModeIdMap[modeId] = mode; displayMode->Release(); @@ -74,19 +74,20 @@ // Get supported video connections attributes->GetInt(BMDDeckLinkVideoInputConnections, - &supportedVideoInputConnections); + &supportedVideoInputConnections); attributes->GetInt(BMDDeckLinkVideoOutputConnections, - &supportedVideoOutputConnections); + &supportedVideoOutputConnections); // Get supported audio connections attributes->GetInt(BMDDeckLinkAudioInputConnections, - &supportedAudioInputConnections); + &supportedAudioInputConnections); attributes->GetInt(BMDDeckLinkAudioOutputConnections, - &supportedAudioOutputConnections); + &supportedAudioOutputConnections); // find output modes ComPtr<IDeckLinkOutput> output; - if (device->QueryInterface(IID_IDeckLinkOutput, (void **) &output) == S_OK) { + if (device->QueryInterface(IID_IDeckLinkOutput, (void **)&output) == + S_OK) { IDeckLinkDisplayModeIterator *modeIterator; if (output->GetDisplayModeIterator(&modeIterator) == S_OK) { @@ -98,7 +99,8 @@ continue; DeckLinkDeviceMode *mode = - new DeckLinkDeviceMode(displayMode, modeId); + new DeckLinkDeviceMode(displayMode, + modeId); outputModes.push_back(mode); outputModeIdMap[modeId] = mode; displayMode->Release(); @@ -111,9 +113,9 @@ // get keyer support attributes->GetFlag(BMDDeckLinkSupportsExternalKeying, - &supportsExternalKeyer); + &supportsExternalKeyer); attributes->GetFlag(BMDDeckLinkSupportsInternalKeying, - &supportsInternalKeyer); + &supportsInternalKeyer); // Sub Device Counts attributes->GetInt(BMDDeckLinkSubDeviceIndex, &subDeviceIndex); @@ -139,7 +141,8 @@ /* Intensity Shuttle for Thunderbolt return 2; however, it supports 8 channels */ if (name == "Intensity Shuttle Thunderbolt") maxChannel = 8; - else if (attributes->GetInt(BMDDeckLinkMaximumAudioChannels, &channels) == S_OK) + else if (attributes->GetInt(BMDDeckLinkMaximumAudioChannels, + &channels) == S_OK) maxChannel = (int32_t)channels; else maxChannel = 2; @@ -149,7 +152,7 @@ * BMDDeckLinkPersistentID for newer ones */ int64_t value; - if (attributes->GetInt(BMDDeckLinkPersistentID, &value) != S_OK && + if (attributes->GetInt(BMDDeckLinkPersistentID, &value) != S_OK && attributes->GetInt(BMDDeckLinkTopologicalID, &value) != S_OK) return true; @@ -161,14 +164,15 @@ bool DeckLinkDevice::GetInput(IDeckLinkInput **input) { - if (device->QueryInterface(IID_IDeckLinkInput, (void**)input) != S_OK) + if (device->QueryInterface(IID_IDeckLinkInput, (void **)input) != S_OK) return false; return true; } bool DeckLinkDevice::GetOutput(IDeckLinkOutput **output) { - if (device->QueryInterface(IID_IDeckLinkOutput, (void**)output) != S_OK) + if (device->QueryInterface(IID_IDeckLinkOutput, (void **)output) != + S_OK) return false; return true; @@ -176,9 +180,10 @@ bool DeckLinkDevice::GetKeyer(IDeckLinkKeyer **deckLinkKeyer) { - if (device->QueryInterface(IID_IDeckLinkKeyer, (void**)deckLinkKeyer) != S_OK) - { - fprintf(stderr, "Could not obtain the IDeckLinkKeyer interface\n"); + if (device->QueryInterface(IID_IDeckLinkKeyer, + (void **)deckLinkKeyer) != S_OK) { + fprintf(stderr, + "Could not obtain the IDeckLinkKeyer interface\n"); return false; } @@ -205,22 +210,24 @@ return outputModeIdMap[id]; } -const std::string& DeckLinkDevice::GetDisplayName(void) +const std::string &DeckLinkDevice::GetDisplayName(void) { return displayName; } -const std::string& DeckLinkDevice::GetHash(void) const +const std::string &DeckLinkDevice::GetHash(void) const { return hash; } -const std::vector<DeckLinkDeviceMode *>& DeckLinkDevice::GetInputModes(void) const +const std::vector<DeckLinkDeviceMode *> & +DeckLinkDevice::GetInputModes(void) const { return inputModes; } -const std::vector<DeckLinkDeviceMode *>& DeckLinkDevice::GetOutputModes(void) const +const std::vector<DeckLinkDeviceMode *> & +DeckLinkDevice::GetOutputModes(void) const { return outputModes; } @@ -235,7 +242,6 @@ return supportedAudioInputConnections; } - bool DeckLinkDevice::GetSupportsExternalKeyer(void) const { return supportsExternalKeyer; @@ -256,7 +262,7 @@ return subDeviceIndex; } -const std::string& DeckLinkDevice::GetName(void) const +const std::string &DeckLinkDevice::GetName(void) const { return name; }
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-device.hpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-device.hpp
Changed
@@ -7,28 +7,26 @@ #include <vector> #include <stdint.h> - - class DeckLinkDevice { - ComPtr<IDeckLink> device; + ComPtr<IDeckLink> device; std::map<long long, DeckLinkDeviceMode *> inputModeIdMap; - std::vector<DeckLinkDeviceMode *> inputModes; + std::vector<DeckLinkDeviceMode *> inputModes; std::map<long long, DeckLinkDeviceMode *> outputModeIdMap; - std::vector<DeckLinkDeviceMode *> outputModes; - std::string name; - std::string displayName; - std::string hash; - int32_t maxChannel = 0; - decklink_bool_t supportsExternalKeyer = false; - decklink_bool_t supportsInternalKeyer = false; - int64_t subDeviceIndex = 0; - int64_t numSubDevices = 0; - int64_t supportedVideoInputConnections = -1; - int64_t supportedVideoOutputConnections = -1; - int64_t supportedAudioInputConnections = -1; - int64_t supportedAudioOutputConnections = -1; - int keyerMode = 0; - volatile long refCount = 1; + std::vector<DeckLinkDeviceMode *> outputModes; + std::string name; + std::string displayName; + std::string hash; + int32_t maxChannel = 0; + decklink_bool_t supportsExternalKeyer = false; + decklink_bool_t supportsInternalKeyer = false; + int64_t subDeviceIndex = 0; + int64_t numSubDevices = 0; + int64_t supportedVideoInputConnections = -1; + int64_t supportedVideoOutputConnections = -1; + int64_t supportedAudioInputConnections = -1; + int64_t supportedAudioOutputConnections = -1; + int keyerMode = 0; + volatile long refCount = 1; public: DeckLinkDevice(IDeckLink *device); @@ -41,10 +39,10 @@ DeckLinkDeviceMode *FindInputMode(long long id); DeckLinkDeviceMode *FindOutputMode(long long id); - const std::string& GetDisplayName(void); - const std::string& GetHash(void) const; - const std::vector<DeckLinkDeviceMode *>& GetInputModes(void) const; - const std::vector<DeckLinkDeviceMode *>& GetOutputModes(void) const; + const std::string &GetDisplayName(void); + const std::string &GetHash(void) const; + const std::vector<DeckLinkDeviceMode *> &GetInputModes(void) const; + const std::vector<DeckLinkDeviceMode *> &GetOutputModes(void) const; int64_t GetVideoInputConnections(); int64_t GetAudioInputConnections(); bool GetSupportsExternalKeyer(void) const; @@ -53,15 +51,12 @@ int64_t GetSubDeviceIndex(); int GetKeyerMode(void); void SetKeyerMode(int newKeyerMode); - const std::string& GetName(void) const; + const std::string &GetName(void) const; int32_t GetMaxChannel(void) const; bool GetInput(IDeckLinkInput **input); bool GetOutput(IDeckLinkOutput **output); bool GetKeyer(IDeckLinkKeyer **keyer); - inline bool IsDevice(IDeckLink *device_) - { - return device_ == device; - } + inline bool IsDevice(IDeckLink *device_) { return device_ == device; } };
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-devices.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-devices.cpp
Changed
@@ -6,11 +6,11 @@ { deviceEnum->Lock(); - const std::vector<DeckLinkDevice*> &devices = deviceEnum->GetDevices(); + const std::vector<DeckLinkDevice *> &devices = deviceEnum->GetDevices(); for (DeckLinkDevice *device : devices) { obs_property_list_add_string(list, - device->GetDisplayName().c_str(), - device->GetHash().c_str()); + device->GetDisplayName().c_str(), + device->GetHash().c_str()); } deviceEnum->Unlock();
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-output.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-output.cpp
Changed
@@ -48,7 +48,8 @@ decklink->audio_samplerate = aoi.samples_per_sec; decklink->audio_planes = 2; - decklink->audio_size = get_audio_size(AUDIO_FORMAT_16BIT, aoi.speakers, 1); + decklink->audio_size = + get_audio_size(AUDIO_FORMAT_16BIT, aoi.speakers, 1); decklink->start_timestamp = 0; @@ -68,7 +69,7 @@ to.format = VIDEO_FORMAT_UYVY; } to.width = mode->GetWidth(); - to.height = mode->GetHeight(); + to.height = mode->GetHeight(); obs_output_set_video_conversion(decklink->GetOutput(), &to); @@ -78,7 +79,7 @@ struct audio_convert_info conversion = {}; conversion.format = AUDIO_FORMAT_16BIT; conversion.speakers = SPEAKERS_STEREO; - conversion.samples_per_sec = 48000; // Only format the decklink supports + conversion.samples_per_sec = 48000; // Only format the decklink supports obs_output_set_audio_conversion(decklink->GetOutput(), &conversion); @@ -112,14 +113,14 @@ } static bool prepare_audio(DeckLinkOutput *decklink, - const struct audio_data *frame, - struct audio_data *output) + const struct audio_data *frame, + struct audio_data *output) { *output = *frame; if (frame->timestamp < decklink->start_timestamp) { uint64_t duration = (uint64_t)frame->frames * 1000000000 / - (uint64_t)decklink->audio_samplerate; + (uint64_t)decklink->audio_samplerate; uint64_t end_ts = frame->timestamp + duration; uint64_t cutoff; @@ -132,8 +133,8 @@ cutoff *= (uint64_t)decklink->audio_samplerate / 1000000000; for (size_t i = 0; i < decklink->audio_planes; i++) - output->data[i] += decklink->audio_size * - (uint32_t)cutoff; + output->data[i] += + decklink->audio_size * (uint32_t)cutoff; output->frames -= (uint32_t)cutoff; } @@ -156,7 +157,8 @@ } static bool decklink_output_device_changed(obs_properties_t *props, - obs_property_t *list, obs_data_t *settings) + obs_property_t *list, + obs_data_t *settings) { const char *name = obs_data_get_string(settings, DEVICE_NAME); const char *hash = obs_data_get_string(settings, DEVICE_HASH); @@ -193,13 +195,13 @@ obs_property_list_item_disable(modeList, 0, true); obs_property_list_item_disable(keyerList, 0, true); } else { - const std::vector<DeckLinkDeviceMode*> &modes = - device->GetOutputModes(); + const std::vector<DeckLinkDeviceMode *> &modes = + device->GetOutputModes(); for (DeckLinkDeviceMode *mode : modes) { obs_property_list_add_int(modeList, - mode->GetName().c_str(), - mode->GetId()); + mode->GetName().c_str(), + mode->GetId()); } obs_property_list_add_int(keyerList, "Disabled", 0); @@ -222,22 +224,26 @@ obs_properties_t *props = obs_properties_create(); obs_property_t *list = obs_properties_add_list(props, DEVICE_HASH, - TEXT_DEVICE, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); - obs_property_set_modified_callback(list, decklink_output_device_changed); + TEXT_DEVICE, + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); + obs_property_set_modified_callback(list, + decklink_output_device_changed); fill_out_devices(list); - obs_properties_add_list(props, - MODE_ID, TEXT_MODE, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_properties_add_list(props, MODE_ID, TEXT_MODE, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_properties_add_bool(props, AUTO_START, TEXT_AUTO_START); - obs_properties_add_list(props, KEYER, TEXT_ENABLE_KEYER, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_properties_add_list(props, KEYER, TEXT_ENABLE_KEYER, + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); return props; } -static const char *decklink_output_get_name(void*) +static const char *decklink_output_get_name(void *) { return obs_module_text("BlackmagicDevice"); } @@ -246,17 +252,17 @@ { struct obs_output_info decklink_output_info = {}; - decklink_output_info.id = "decklink_output"; - decklink_output_info.flags = OBS_OUTPUT_AV; - decklink_output_info.get_name = decklink_output_get_name; - decklink_output_info.create = decklink_output_create; - decklink_output_info.destroy = decklink_output_destroy; - decklink_output_info.start = decklink_output_start; - decklink_output_info.stop = decklink_output_stop; + decklink_output_info.id = "decklink_output"; + decklink_output_info.flags = OBS_OUTPUT_AV; + decklink_output_info.get_name = decklink_output_get_name; + decklink_output_info.create = decklink_output_create; + decklink_output_info.destroy = decklink_output_destroy; + decklink_output_info.start = decklink_output_start; + decklink_output_info.stop = decklink_output_stop; decklink_output_info.get_properties = decklink_output_properties; - decklink_output_info.raw_video = decklink_output_raw_video; - decklink_output_info.raw_audio = decklink_output_raw_audio; - decklink_output_info.update = decklink_output_update; + decklink_output_info.raw_video = decklink_output_raw_video; + decklink_output_info.raw_audio = decklink_output_raw_audio; + decklink_output_info.update = decklink_output_update; return decklink_output_info; }
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/decklink-source.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/decklink-source.cpp
Changed
@@ -15,7 +15,8 @@ decklink->buffering = enabled; } -static void decklink_deactivate_when_not_showing(DeckLinkInput *decklink, bool dwns) +static void decklink_deactivate_when_not_showing(DeckLinkInput *decklink, + bool dwns) { decklink->dwns = dwns; } @@ -26,7 +27,7 @@ obs_source_set_async_decoupled(source, true); decklink_enable_buffering(decklink, - obs_data_get_bool(settings, BUFFERING)); + obs_data_get_bool(settings, BUFFERING)); obs_source_update(source, settings); return decklink; @@ -43,16 +44,18 @@ DeckLinkInput *decklink = (DeckLinkInput *)data; const char *hash = obs_data_get_string(settings, DEVICE_HASH); long long id = obs_data_get_int(settings, MODE_ID); - BMDVideoConnection videoConnection = (BMDVideoConnection) obs_data_get_int(settings, - VIDEO_CONNECTION); - BMDAudioConnection audioConnection = (BMDAudioConnection) obs_data_get_int(settings, - AUDIO_CONNECTION); - BMDPixelFormat pixelFormat = (BMDPixelFormat)obs_data_get_int(settings, - PIXEL_FORMAT); - video_colorspace colorSpace = (video_colorspace)obs_data_get_int(settings, - COLOR_SPACE); - video_range_type colorRange = (video_range_type)obs_data_get_int(settings, - COLOR_RANGE); + BMDVideoConnection videoConnection = + (BMDVideoConnection)obs_data_get_int(settings, + VIDEO_CONNECTION); + BMDAudioConnection audioConnection = + (BMDAudioConnection)obs_data_get_int(settings, + AUDIO_CONNECTION); + BMDPixelFormat pixelFormat = + (BMDPixelFormat)obs_data_get_int(settings, PIXEL_FORMAT); + video_colorspace colorSpace = + (video_colorspace)obs_data_get_int(settings, COLOR_SPACE); + video_range_type colorRange = + (video_range_type)obs_data_get_int(settings, COLOR_RANGE); int chFmtInt = (int)obs_data_get_int(settings, CHANNEL_FORMAT); if (chFmtInt == 7) @@ -63,10 +66,10 @@ speaker_layout channelFormat = (speaker_layout)chFmtInt; decklink_enable_buffering(decklink, - obs_data_get_bool(settings, BUFFERING)); + obs_data_get_bool(settings, BUFFERING)); - decklink_deactivate_when_not_showing(decklink, - obs_data_get_bool(settings, DEACTIVATE_WNS)); + decklink_deactivate_when_not_showing( + decklink, obs_data_get_bool(settings, DEACTIVATE_WNS)); ComPtr<DeckLinkDevice> device; device.Set(deviceEnum->FindByHash(hash)); @@ -88,8 +91,9 @@ if (decklink->dwns && showing && !decklink->Capturing()) { ComPtr<DeckLinkDevice> device; device.Set(deviceEnum->FindByHash(decklink->hash.c_str())); - decklink->Activate(device, decklink->id, decklink->videoConnection, - decklink->audioConnection); + decklink->Activate(device, decklink->id, + decklink->videoConnection, + decklink->audioConnection); } } static void decklink_hide(void *data) @@ -111,13 +115,13 @@ obs_data_set_default_bool(settings, SWAP, false); } -static const char *decklink_get_name(void*) +static const char *decklink_get_name(void *) { return obs_module_text("BlackmagicDevice"); } static bool decklink_device_changed(obs_properties_t *props, - obs_property_t *list, obs_data_t *settings) + obs_property_t *list, obs_data_t *settings) { const char *name = obs_data_get_string(settings, DEVICE_NAME); const char *hash = obs_data_get_string(settings, DEVICE_HASH); @@ -140,10 +144,10 @@ obs_property_list_item_disable(list, 0, true); } - obs_property_t *videoConnectionList = obs_properties_get(props, - VIDEO_CONNECTION); - obs_property_t *audioConnectionList = obs_properties_get(props, - AUDIO_CONNECTION); + obs_property_t *videoConnectionList = + obs_properties_get(props, VIDEO_CONNECTION); + obs_property_t *audioConnectionList = + obs_properties_get(props, AUDIO_CONNECTION); obs_property_t *modeList = obs_properties_get(props, MODE_ID); obs_property_t *channelList = obs_properties_get(props, CHANNEL_FORMAT); @@ -154,9 +158,9 @@ obs_property_list_clear(channelList); obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_NONE, - SPEAKERS_UNKNOWN); + SPEAKERS_UNKNOWN); obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_2_0CH, - SPEAKERS_STEREO); + SPEAKERS_STEREO); ComPtr<DeckLinkDevice> device; device.Set(deviceEnum->FindByHash(hash)); @@ -168,60 +172,75 @@ obs_property_list_item_disable(modeList, 0, true); } else { const BMDVideoConnection BMDVideoConnections[] = { - bmdVideoConnectionSDI, bmdVideoConnectionHDMI, - bmdVideoConnectionOpticalSDI, bmdVideoConnectionComponent, - bmdVideoConnectionComposite, bmdVideoConnectionSVideo - }; + bmdVideoConnectionSDI, + bmdVideoConnectionHDMI, + bmdVideoConnectionOpticalSDI, + bmdVideoConnectionComponent, + bmdVideoConnectionComposite, + bmdVideoConnectionSVideo}; for (BMDVideoConnection conn : BMDVideoConnections) { - if ((device->GetVideoInputConnections() & conn) == conn) { - obs_property_list_add_int(videoConnectionList, - bmd_video_connection_to_name(conn), conn); + if ((device->GetVideoInputConnections() & conn) == + conn) { + obs_property_list_add_int( + videoConnectionList, + bmd_video_connection_to_name(conn), + conn); } } const BMDAudioConnection BMDAudioConnections[] = { - bmdAudioConnectionEmbedded, bmdAudioConnectionAESEBU, - bmdAudioConnectionAnalog, bmdAudioConnectionAnalogXLR, - bmdAudioConnectionAnalogRCA, bmdAudioConnectionMicrophone, - bmdAudioConnectionHeadphones - }; + bmdAudioConnectionEmbedded, + bmdAudioConnectionAESEBU, + bmdAudioConnectionAnalog, + bmdAudioConnectionAnalogXLR, + bmdAudioConnectionAnalogRCA, + bmdAudioConnectionMicrophone, + bmdAudioConnectionHeadphones}; for (BMDAudioConnection conn : BMDAudioConnections) { - if ((device->GetAudioInputConnections() & conn) == conn) { - obs_property_list_add_int(audioConnectionList, - bmd_audio_connection_to_name(conn), conn); + if ((device->GetAudioInputConnections() & conn) == + conn) { + obs_property_list_add_int( + audioConnectionList, + bmd_audio_connection_to_name(conn), + conn); } } - const std::vector<DeckLinkDeviceMode*> &modes = - device->GetInputModes(); + const std::vector<DeckLinkDeviceMode *> &modes = + device->GetInputModes(); for (DeckLinkDeviceMode *mode : modes) { obs_property_list_add_int(modeList, - mode->GetName().c_str(), - mode->GetId()); + mode->GetName().c_str(), + mode->GetId()); } if (device->GetMaxChannel() >= 8) { obs_property_list_add_int(channelList, - TEXT_CHANNEL_FORMAT_2_1CH, SPEAKERS_2POINT1); + TEXT_CHANNEL_FORMAT_2_1CH, + SPEAKERS_2POINT1); obs_property_list_add_int(channelList, - TEXT_CHANNEL_FORMAT_4_0CH, SPEAKERS_4POINT0); + TEXT_CHANNEL_FORMAT_4_0CH, + SPEAKERS_4POINT0); obs_property_list_add_int(channelList, - TEXT_CHANNEL_FORMAT_4_1CH, SPEAKERS_4POINT1); + TEXT_CHANNEL_FORMAT_4_1CH, + SPEAKERS_4POINT1); obs_property_list_add_int(channelList, - TEXT_CHANNEL_FORMAT_5_1CH, SPEAKERS_5POINT1); + TEXT_CHANNEL_FORMAT_5_1CH, + SPEAKERS_5POINT1); obs_property_list_add_int(channelList, - TEXT_CHANNEL_FORMAT_7_1CH, SPEAKERS_7POINT1); + TEXT_CHANNEL_FORMAT_7_1CH, + SPEAKERS_7POINT1); } } return true; } -static bool mode_id_changed(obs_properties_t *props, - obs_property_t *list, obs_data_t *settings) +static bool mode_id_changed(obs_properties_t *props, obs_property_t *list, + obs_data_t *settings) { long long id = obs_data_get_int(settings, MODE_ID); @@ -236,56 +255,65 @@ obs_properties_t *props = obs_properties_create(); obs_property_t *list = obs_properties_add_list(props, DEVICE_HASH, - TEXT_DEVICE, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + TEXT_DEVICE, + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_set_modified_callback(list, decklink_device_changed); fill_out_devices(list); obs_properties_add_list(props, VIDEO_CONNECTION, TEXT_VIDEO_CONNECTION, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_properties_add_list(props, AUDIO_CONNECTION, TEXT_AUDIO_CONNECTION, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); list = obs_properties_add_list(props, MODE_ID, TEXT_MODE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_set_modified_callback(list, mode_id_changed); - list = obs_properties_add_list(props, PIXEL_FORMAT, - TEXT_PIXEL_FORMAT, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_INT); + list = obs_properties_add_list(props, PIXEL_FORMAT, TEXT_PIXEL_FORMAT, + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_list_add_int(list, "8-bit YUV", bmdFormat8BitYUV); obs_property_list_add_int(list, "8-bit BGRA", bmdFormat8BitBGRA); list = obs_properties_add_list(props, COLOR_SPACE, TEXT_COLOR_SPACE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); - obs_property_list_add_int(list, TEXT_COLOR_SPACE_DEFAULT, VIDEO_CS_DEFAULT); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); + obs_property_list_add_int(list, TEXT_COLOR_SPACE_DEFAULT, + VIDEO_CS_DEFAULT); obs_property_list_add_int(list, "BT.601", VIDEO_CS_601); obs_property_list_add_int(list, "BT.709", VIDEO_CS_709); list = obs_properties_add_list(props, COLOR_RANGE, TEXT_COLOR_RANGE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); - obs_property_list_add_int(list, TEXT_COLOR_RANGE_DEFAULT, VIDEO_RANGE_DEFAULT); - obs_property_list_add_int(list, TEXT_COLOR_RANGE_PARTIAL, VIDEO_RANGE_PARTIAL); - obs_property_list_add_int(list, TEXT_COLOR_RANGE_FULL, VIDEO_RANGE_FULL); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); + obs_property_list_add_int(list, TEXT_COLOR_RANGE_DEFAULT, + VIDEO_RANGE_DEFAULT); + obs_property_list_add_int(list, TEXT_COLOR_RANGE_PARTIAL, + VIDEO_RANGE_PARTIAL); + obs_property_list_add_int(list, TEXT_COLOR_RANGE_FULL, + VIDEO_RANGE_FULL); list = obs_properties_add_list(props, CHANNEL_FORMAT, - TEXT_CHANNEL_FORMAT, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_INT); + TEXT_CHANNEL_FORMAT, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_NONE, - SPEAKERS_UNKNOWN); + SPEAKERS_UNKNOWN); obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_2_0CH, - SPEAKERS_STEREO); + SPEAKERS_STEREO); obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_2_1CH, - SPEAKERS_2POINT1); + SPEAKERS_2POINT1); obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_4_0CH, - SPEAKERS_4POINT0); + SPEAKERS_4POINT0); obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_4_1CH, - SPEAKERS_4POINT1); + SPEAKERS_4POINT1); obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_5_1CH, - SPEAKERS_5POINT1); + SPEAKERS_5POINT1); obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_7_1CH, - SPEAKERS_7POINT1); + SPEAKERS_7POINT1); obs_property_t *swap = obs_properties_add_bool(props, SWAP, TEXT_SWAP); obs_property_set_long_description(swap, TEXT_SWAP_TOOLTIP); @@ -298,21 +326,22 @@ return props; } - struct obs_source_info create_decklink_source_info() { struct obs_source_info decklink_source_info = {}; - decklink_source_info.id = "decklink-input"; - decklink_source_info.type = OBS_SOURCE_TYPE_INPUT; - decklink_source_info.output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO | OBS_SOURCE_DO_NOT_DUPLICATE; - decklink_source_info.create = decklink_create; - decklink_source_info.destroy = decklink_destroy; - decklink_source_info.get_defaults = decklink_get_defaults; - decklink_source_info.get_name = decklink_get_name; + decklink_source_info.id = "decklink-input"; + decklink_source_info.type = OBS_SOURCE_TYPE_INPUT; + decklink_source_info.output_flags = OBS_SOURCE_ASYNC_VIDEO | + OBS_SOURCE_AUDIO | + OBS_SOURCE_DO_NOT_DUPLICATE; + decklink_source_info.create = decklink_create; + decklink_source_info.destroy = decklink_destroy; + decklink_source_info.get_defaults = decklink_get_defaults; + decklink_source_info.get_name = decklink_get_name; decklink_source_info.get_properties = decklink_get_properties; - decklink_source_info.update = decklink_update; - decklink_source_info.show = decklink_show; - decklink_source_info.hide = decklink_hide; + decklink_source_info.update = decklink_update; + decklink_source_info.show = decklink_show; + decklink_source_info.hide = decklink_hide; return decklink_source_info; }
View file
obs-studio-24.0.0.tar.xz/plugins/decklink/linux/decklink-sdk/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/linux/platform.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/linux/platform.cpp
Changed
@@ -1,6 +1,6 @@ #include "../platform.hpp" -bool DeckLinkStringToStdString(decklink_string_t input, std::string& output) +bool DeckLinkStringToStdString(decklink_string_t input, std::string &output) { if (input == nullptr) return false;
View file
obs-studio-24.0.0.tar.xz/plugins/decklink/mac/decklink-sdk/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/mac/platform.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/mac/platform.cpp
Changed
@@ -1,7 +1,7 @@ #include "../platform.hpp" #include <util/apple/cfstring-utils.h> -bool DeckLinkStringToStdString(decklink_string_t input, std::string& output) +bool DeckLinkStringToStdString(decklink_string_t input, std::string &output) { const CFStringRef string = static_cast<CFStringRef>(input);
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/platform.hpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/platform.hpp
Changed
@@ -24,4 +24,4 @@ #include <string> -bool DeckLinkStringToStdString(decklink_string_t input, std::string& output); +bool DeckLinkStringToStdString(decklink_string_t input, std::string &output);
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/util.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/util.cpp
Changed
@@ -3,41 +3,41 @@ const char *bmd_video_connection_to_name(BMDVideoConnection connection) { switch (connection) { - case bmdVideoConnectionSDI: - return "SDI"; - case bmdVideoConnectionHDMI: - return "HDMI"; - case bmdVideoConnectionOpticalSDI: - return "Optical SDI"; - case bmdVideoConnectionComponent: - return "Component"; - case bmdVideoConnectionComposite: - return "Composite"; - case bmdVideoConnectionSVideo: - return "S-Video"; - default: - return "Unknown"; + case bmdVideoConnectionSDI: + return "SDI"; + case bmdVideoConnectionHDMI: + return "HDMI"; + case bmdVideoConnectionOpticalSDI: + return "Optical SDI"; + case bmdVideoConnectionComponent: + return "Component"; + case bmdVideoConnectionComposite: + return "Composite"; + case bmdVideoConnectionSVideo: + return "S-Video"; + default: + return "Unknown"; } } const char *bmd_audio_connection_to_name(BMDAudioConnection connection) { switch (connection) { - case bmdAudioConnectionEmbedded: - return "Embedded"; - case bmdAudioConnectionAESEBU: - return "AES/EBU"; - case bmdAudioConnectionAnalog: - return "Analog"; - case bmdAudioConnectionAnalogXLR: - return "Analog XLR"; - case bmdAudioConnectionAnalogRCA: - return "Analog RCA"; - case bmdAudioConnectionMicrophone: - return "Microphone"; - case bmdAudioConnectionHeadphones: - return "Headphones"; - default: - return "Unknown"; + case bmdAudioConnectionEmbedded: + return "Embedded"; + case bmdAudioConnectionAESEBU: + return "AES/EBU"; + case bmdAudioConnectionAnalog: + return "Analog"; + case bmdAudioConnectionAnalogXLR: + return "Analog XLR"; + case bmdAudioConnectionAnalogRCA: + return "Analog RCA"; + case bmdAudioConnectionMicrophone: + return "Microphone"; + case bmdAudioConnectionHeadphones: + return "Headphones"; + default: + return "Unknown"; } } \ No newline at end of file
View file
obs-studio-23.2.1.tar.xz/plugins/decklink/win/platform.cpp -> obs-studio-24.0.0.tar.xz/plugins/decklink/win/platform.cpp
Changed
@@ -5,13 +5,13 @@ IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void) { IDeckLinkDiscovery *instance; - const HRESULT result = CoCreateInstance(CLSID_CDeckLinkDiscovery, - nullptr, CLSCTX_ALL, IID_IDeckLinkDiscovery, - (void **)&instance); + const HRESULT result = + CoCreateInstance(CLSID_CDeckLinkDiscovery, nullptr, CLSCTX_ALL, + IID_IDeckLinkDiscovery, (void **)&instance); return result == S_OK ? instance : nullptr; } -bool DeckLinkStringToStdString(decklink_string_t input, std::string& output) +bool DeckLinkStringToStdString(decklink_string_t input, std::string &output) { if (input == nullptr) return false;
View file
obs-studio-23.2.1.tar.xz/plugins/image-source/color-source.c -> obs-studio-24.0.0.tar.xz/plugins/image-source/color-source.c
Changed
@@ -51,13 +51,15 @@ obs_properties_t *props = obs_properties_create(); obs_properties_add_color(props, "color", - obs_module_text("ColorSource.Color")); + obs_module_text("ColorSource.Color")); obs_properties_add_int(props, "width", - obs_module_text("ColorSource.Width"), 0, 4096, 1); + obs_module_text("ColorSource.Width"), 0, 4096, + 1); obs_properties_add_int(props, "height", - obs_module_text("ColorSource.Height"), 0, 4096, 1); + obs_module_text("ColorSource.Height"), 0, 4096, + 1); return props; } @@ -68,9 +70,9 @@ struct color_source *context = data; - gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_SOLID); - gs_eparam_t *color = gs_effect_get_param_by_name(solid, "color"); - gs_technique_t *tech = gs_effect_get_technique(solid, "Solid"); + gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_SOLID); + gs_eparam_t *color = gs_effect_get_param_by_name(solid, "color"); + gs_technique_t *tech = gs_effect_get_technique(solid, "Solid"); struct vec4 colorVal; vec4_from_rgba(&colorVal, context->color); @@ -99,25 +101,22 @@ static void color_source_defaults(obs_data_t *settings) { - struct obs_video_info ovi; - obs_get_video_info(&ovi); - obs_data_set_default_int(settings, "color", 0xFFFFFFFF); - obs_data_set_default_int(settings, "width", ovi.base_width); - obs_data_set_default_int(settings, "height", ovi.base_height); + obs_data_set_default_int(settings, "width", 400); + obs_data_set_default_int(settings, "height", 400); } struct obs_source_info color_source_info = { - .id = "color_source", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW, - .create = color_source_create, - .destroy = color_source_destroy, - .update = color_source_update, - .get_name = color_source_get_name, - .get_defaults = color_source_defaults, - .get_width = color_source_getwidth, - .get_height = color_source_getheight, - .video_render = color_source_render, - .get_properties = color_source_properties + .id = "color_source", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW, + .create = color_source_create, + .destroy = color_source_destroy, + .update = color_source_update, + .get_name = color_source_get_name, + .get_defaults = color_source_defaults, + .get_width = color_source_getwidth, + .get_height = color_source_getheight, + .video_render = color_source_render, + .get_properties = color_source_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/image-source/data/locale/es-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/image-source/data/locale/es-ES.ini
Changed
@@ -13,8 +13,8 @@ SlideShow.Transition="Transición" SlideShow.Transition.Cut="Corte" SlideShow.Transition.Fade="Desvanecimiento" -SlideShow.Transition.Swipe="Deslizar Rapido" -SlideShow.Transition.Slide="Deslizar" +SlideShow.Transition.Swipe="Deslizar" +SlideShow.Transition.Slide="Diapositiva" SlideShow.PlaybackBehavior="Comportamiento de visibilidad" SlideShow.PlaybackBehavior.StopRestart="Detener cuando no sea visible, reiniciar cuando sea visible" SlideShow.PlaybackBehavior.PauseUnpause="Pausar cuando no sea visible, reanudar cuando sea visible"
View file
obs-studio-23.2.1.tar.xz/plugins/image-source/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/image-source/data/locale/gl-ES.ini
Changed
@@ -1,6 +1,36 @@ ImageInput="Imaxe" File="Ficheiro de imaxe" -UnloadWhenNotShowing="Non descargar a imaxe cando non se mostre" +UnloadWhenNotShowing="Descargar a imaxe cando non se amosa" +SlideShow="Diaporama" +SlideShow.TransitionSpeed="Velocidade da transición (milisegundos)" +SlideShow.SlideTime="Tempo entre diapositivas (milisegundos)" +SlideShow.Files="Ficheiros de imaxe" +SlideShow.CustomSize="Límite do tamaño/relación de aspecto" +SlideShow.CustomSize.Auto="Automático" +SlideShow.Randomize="Reproducir ao chou" +SlideShow.Loop="Bucle" +SlideShow.Transition="Transición" +SlideShow.Transition.Cut="Cortar" +SlideShow.Transition.Fade="Esvaecer" +SlideShow.Transition.Swipe="Esvarar" +SlideShow.Transition.Slide="Diapositiva" +SlideShow.PlaybackBehavior="Comportamento da visibilidade" +SlideShow.PlaybackBehavior.StopRestart="Parar cando non é visíbel, reiniciar cando sexa visíbel" +SlideShow.PlaybackBehavior.PauseUnpause="Pór en pausa cando non é visíbel, reiniciar cando sexa visíbel" +SlideShow.PlaybackBehavior.AlwaysPlay="Reproducir sempre cando non estea visíbel" +SlideShow.SlideMode="Modo de diapositiva" +SlideShow.SlideMode.Auto="Automático" +SlideShow.SlideMode.Manual="Manual (use as teclas rápidas para controlar o disporama)" +SlideShow.PlayPause="Reproducir/Pór en pausa" +SlideShow.Restart="Reiniciar" +SlideShow.Stop="Parar" +SlideShow.NextSlide="Seguinte diapositiva" +SlideShow.PreviousSlide="Diapositiva anterior" +SlideShow.HideWhenDone="Agochar cando se reproduce o diaporama" +ColorSource="Orixe da cor" +ColorSource.Color="Cor" +ColorSource.Width="Largo" +ColorSource.Height="Alto"
View file
obs-studio-23.2.1.tar.xz/plugins/image-source/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/image-source/data/locale/ro-RO.ini
Changed
@@ -13,6 +13,7 @@ SlideShow.Transition.Fade="Estompare" SlideShow.Transition.Swipe="Glisare" SlideShow.Transition.Slide="Culisare" +SlideShow.SlideMode="Mod de culisare" SlideShow.SlideMode.Auto="Automat" SlideShow.PlayPause="Redă/Pune pe pauză" SlideShow.Restart="Repornește"
View file
obs-studio-23.2.1.tar.xz/plugins/image-source/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/image-source/data/locale/sl-SI.ini
Changed
@@ -1,6 +1,36 @@ ImageInput="Slika" File="Slikovna datoteka" -UnloadWhenNotShowing="Ne naloži slike, ko ni prikazana" +UnloadWhenNotShowing="Razloži sliko, ko ni prikazana" +SlideShow="Slikovna predstavitev" +SlideShow.TransitionSpeed="Hitrost prehodov (ms)" +SlideShow.SlideTime="Čas med slikami (ms)" +SlideShow.Files="Slikovne datoteke" +SlideShow.CustomSize="Omejitev velikost/Razmerje" +SlideShow.CustomSize.Auto="Samodejno" +SlideShow.Randomize="Naključno predvajanje" +SlideShow.Loop="Ponavljaj" +SlideShow.Transition="Prehod" +SlideShow.Transition.Cut="Izreži" +SlideShow.Transition.Fade="Pojemaj" +SlideShow.Transition.Swipe="Potegni" +SlideShow.Transition.Slide="Podrsaj" +SlideShow.PlaybackBehavior="Vedenje vidnosti" +SlideShow.PlaybackBehavior.StopRestart="Ustavi, ko ni vidno; ponovno zaženi, ko je vidno" +SlideShow.PlaybackBehavior.PauseUnpause="Premor, ko ni vidno; nadaljuj, ko je vidno" +SlideShow.PlaybackBehavior.AlwaysPlay="Vedno predvajaj, ko ni vidno" +SlideShow.SlideMode="Način predstavitve" +SlideShow.SlideMode.Auto="Samodejno" +SlideShow.SlideMode.Manual="Ročno (uporabi hitre tipke na nadzor predstavitve)" +SlideShow.PlayPause="Predvajaj/Premor" +SlideShow.Restart="Ponovno zaženi" +SlideShow.Stop="Ustavi" +SlideShow.NextSlide="Naslednja slika" +SlideShow.PreviousSlide="Prejšnja slika" +SlideShow.HideWhenDone="Skrij, ko je predstavitev končana" +ColorSource="Barvni vir" +ColorSource.Color="Barva" +ColorSource.Width="Širina" +ColorSource.Height="Višina"
View file
obs-studio-23.2.1.tar.xz/plugins/image-source/image-source.c -> obs-studio-24.0.0.tar.xz/plugins/image-source/image-source.c
Changed
@@ -4,31 +4,27 @@ #include <util/dstr.h> #include <sys/stat.h> -#define blog(log_level, format, ...) \ +#define blog(log_level, format, ...) \ blog(log_level, "[image_source: '%s'] " format, \ - obs_source_get_name(context->source), ##__VA_ARGS__) + obs_source_get_name(context->source), ##__VA_ARGS__) -#define debug(format, ...) \ - blog(LOG_DEBUG, format, ##__VA_ARGS__) -#define info(format, ...) \ - blog(LOG_INFO, format, ##__VA_ARGS__) -#define warn(format, ...) \ - blog(LOG_WARNING, format, ##__VA_ARGS__) +#define debug(format, ...) blog(LOG_DEBUG, format, ##__VA_ARGS__) +#define info(format, ...) blog(LOG_INFO, format, ##__VA_ARGS__) +#define warn(format, ...) blog(LOG_WARNING, format, ##__VA_ARGS__) struct image_source { obs_source_t *source; - char *file; - bool persistent; - time_t file_timestamp; - float update_time_elapsed; - uint64_t last_time; - bool active; + char *file; + bool persistent; + time_t file_timestamp; + float update_time_elapsed; + uint64_t last_time; + bool active; gs_image_file2_t if2; }; - static time_t get_modified_timestamp(const char *filename) { struct stat stats; @@ -152,9 +148,9 @@ return; gs_effect_set_texture(gs_effect_get_param_by_name(effect, "image"), - context->if2.image.texture); - gs_draw_sprite(context->if2.image.texture, 0, - context->if2.image.cx, context->if2.image.cy); + context->if2.image.texture); + gs_draw_sprite(context->if2.image.texture, 0, context->if2.image.cx, + context->if2.image.cy); } static void image_source_tick(void *data, float seconds) @@ -212,7 +208,6 @@ context->last_time = frame_time; } - static const char *image_filter = "All formats (*.bmp *.tga *.png *.jpeg *.jpg *.gif *.psd);;" "BMP Files (*.bmp);;" @@ -240,11 +235,10 @@ dstr_resize(&path, slash - path.array + 1); } - obs_properties_add_path(props, - "file", obs_module_text("File"), - OBS_PATH_FILE, image_filter, path.array); - obs_properties_add_bool(props, - "unload", obs_module_text("UnloadWhenNotShowing")); + obs_properties_add_path(props, "file", obs_module_text("File"), + OBS_PATH_FILE, image_filter, path.array); + obs_properties_add_bool(props, "unload", + obs_module_text("UnloadWhenNotShowing")); dstr_free(&path); return props; @@ -257,22 +251,21 @@ } static struct obs_source_info image_source_info = { - .id = "image_source", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = image_source_get_name, - .create = image_source_create, - .destroy = image_source_destroy, - .update = image_source_update, - .get_defaults = image_source_defaults, - .show = image_source_show, - .hide = image_source_hide, - .get_width = image_source_getwidth, - .get_height = image_source_getheight, - .video_render = image_source_render, - .video_tick = image_source_tick, - .get_properties = image_source_properties -}; + .id = "image_source", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = image_source_get_name, + .create = image_source_create, + .destroy = image_source_destroy, + .update = image_source_update, + .get_defaults = image_source_defaults, + .show = image_source_show, + .hide = image_source_hide, + .get_width = image_source_getwidth, + .get_height = image_source_getheight, + .video_render = image_source_render, + .video_tick = image_source_tick, + .get_properties = image_source_properties}; OBS_DECLARE_MODULE() OBS_MODULE_USE_DEFAULT_LOCALE("image-source", "en-US")
View file
obs-studio-23.2.1.tar.xz/plugins/image-source/obs-slideshow.c -> obs-studio-24.0.0.tar.xz/plugins/image-source/obs-slideshow.c
Changed
@@ -4,11 +4,13 @@ #include <util/darray.h> #include <util/dstr.h> -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[slideshow: '%s'] " format, \ - obs_source_get_name(ss->source), ##__VA_ARGS__) + obs_source_get_name(ss->source), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) + +/* clang-format off */ #define S_TR_SPEED "transition_speed" #define S_CUSTOM_SIZE "use_custom_size" @@ -55,12 +57,14 @@ #define T_TR_SWIPE T_TR_("Swipe") #define T_TR_SLIDE T_TR_("Slide") +/* clang-format on */ + /* ------------------------------------------------------------------------- */ extern uint64_t image_source_get_memory_usage(void *data); #define BYTES_TO_MBYTES (1024 * 1024) -#define MAX_MEM_USAGE (250 * BYTES_TO_MBYTES) +#define MAX_MEM_USAGE (250 * BYTES_TO_MBYTES) struct image_file_data { char *path; @@ -182,7 +186,7 @@ } static void add_file(struct slideshow *ss, struct darray *array, - const char *path, uint32_t *cx, uint32_t *cy) + const char *path, uint32_t *cx, uint32_t *cy) { DARRAY(struct image_file_data) new_files; struct image_file_data data; @@ -207,8 +211,10 @@ data.source = new_source; da_push_back(new_files, &data); - if (new_cx > *cx) *cx = new_cx; - if (new_cy > *cy) *cy = new_cy; + if (new_cx > *cx) + *cx = new_cx; + if (new_cy > *cy) + *cy = new_cy; void *source_data = obs_obj_get_data(new_source); ss->mem_usage += image_source_get_memory_usage(source_data); @@ -221,12 +227,9 @@ { if (!ext) return false; - return astrcmpi(ext, ".bmp") == 0 || - astrcmpi(ext, ".tga") == 0 || - astrcmpi(ext, ".png") == 0 || - astrcmpi(ext, ".jpeg") == 0 || - astrcmpi(ext, ".jpg") == 0 || - astrcmpi(ext, ".gif") == 0; + return astrcmpi(ext, ".bmp") == 0 || astrcmpi(ext, ".tga") == 0 || + astrcmpi(ext, ".png") == 0 || astrcmpi(ext, ".jpeg") == 0 || + astrcmpi(ext, ".jpg") == 0 || astrcmpi(ext, ".gif") == 0; } static inline bool item_valid(struct slideshow *ss) @@ -241,19 +244,16 @@ if (valid && ss->use_cut) obs_transition_set(ss->transition, - ss->files.array[ss->cur_item].source); + ss->files.array[ss->cur_item].source); else if (valid && !to_null) - obs_transition_start(ss->transition, - OBS_TRANSITION_MODE_AUTO, - ss->tr_speed, - ss->files.array[ss->cur_item].source); + obs_transition_start(ss->transition, OBS_TRANSITION_MODE_AUTO, + ss->tr_speed, + ss->files.array[ss->cur_item].source); else - obs_transition_start(ss->transition, - OBS_TRANSITION_MODE_AUTO, - ss->tr_speed, - NULL); + obs_transition_start(ss->transition, OBS_TRANSITION_MODE_AUTO, + ss->tr_speed, NULL); } static void ss_update(void *data, obs_data_t *settings) @@ -344,8 +344,8 @@ dstr_copy(&dir_path, path); dstr_cat_ch(&dir_path, '/'); dstr_cat(&dir_path, ent->d_name); - add_file(ss, &new_files.da, dir_path.array, - &cx, &cy); + add_file(ss, &new_files.da, dir_path.array, &cx, + &cy); if (ss->mem_usage >= MAX_MEM_USAGE) break; @@ -447,7 +447,7 @@ obs_transition_set_size(ss->transition, cx, cy); obs_transition_set_alignment(ss->transition, OBS_ALIGN_CENTER); obs_transition_set_scale_type(ss->transition, - OBS_TRANSITION_SCALE_ASPECT); + OBS_TRANSITION_SCALE_ASPECT); if (ss->randomize && ss->files.num) ss->cur_item = random_file(ss); @@ -475,7 +475,7 @@ ss->cur_item = 0; obs_transition_set(ss->transition, - ss->files.array[ss->cur_item].source); + ss->files.array[ss->cur_item].source); ss->stop = false; ss->paused = false; @@ -522,7 +522,7 @@ } static void play_pause_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -533,8 +533,8 @@ ss_play_pause(ss); } -static void restart_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) +static void restart_hotkey(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey, + bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -545,8 +545,8 @@ ss_restart(ss); } -static void stop_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) +static void stop_hotkey(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey, + bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -558,7 +558,7 @@ } static void next_slide_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -573,7 +573,7 @@ } static void previous_slide_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -607,30 +607,26 @@ ss->paused = false; ss->stop = false; - ss->play_pause_hotkey = obs_hotkey_register_source(source, - "SlideShow.PlayPause", - obs_module_text("SlideShow.PlayPause"), - play_pause_hotkey, ss); + ss->play_pause_hotkey = obs_hotkey_register_source( + source, "SlideShow.PlayPause", + obs_module_text("SlideShow.PlayPause"), play_pause_hotkey, ss); - ss->restart_hotkey = obs_hotkey_register_source(source, - "SlideShow.Restart", - obs_module_text("SlideShow.Restart"), - restart_hotkey, ss); + ss->restart_hotkey = obs_hotkey_register_source( + source, "SlideShow.Restart", + obs_module_text("SlideShow.Restart"), restart_hotkey, ss); - ss->stop_hotkey = obs_hotkey_register_source(source, - "SlideShow.Stop", - obs_module_text("SlideShow.Stop"), - stop_hotkey, ss); + ss->stop_hotkey = obs_hotkey_register_source( + source, "SlideShow.Stop", obs_module_text("SlideShow.Stop"), + stop_hotkey, ss); - ss->prev_hotkey = obs_hotkey_register_source(source, - "SlideShow.NextSlide", - obs_module_text("SlideShow.NextSlide"), - next_slide_hotkey, ss); + ss->prev_hotkey = obs_hotkey_register_source( + source, "SlideShow.NextSlide", + obs_module_text("SlideShow.NextSlide"), next_slide_hotkey, ss); - ss->prev_hotkey = obs_hotkey_register_source(source, - "SlideShow.PreviousSlide", - obs_module_text("SlideShow.PreviousSlide"), - previous_slide_hotkey, ss); + ss->prev_hotkey = obs_hotkey_register_source( + source, "SlideShow.PreviousSlide", + obs_module_text("SlideShow.PreviousSlide"), + previous_slide_hotkey, ss); pthread_mutex_init_value(&ss->mutex); if (pthread_mutex_init(&ss->mutex, NULL) != 0) @@ -682,7 +678,7 @@ /* ----------------------------------------------------- */ /* fade to transparency when the file list becomes empty */ if (!ss->files.num) { - obs_source_t* active_transition_source = + obs_source_t *active_transition_source = obs_transition_get_active_source(ss->transition); if (active_transition_source) { @@ -725,8 +721,9 @@ } static inline bool ss_audio_render_(obs_source_t *transition, uint64_t *ts_out, - struct obs_source_audio_mix *audio_output, - uint32_t mixers, size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio_output, + uint32_t mixers, size_t channels, + size_t sample_rate) { struct obs_source_audio_mix child_audio; uint64_t source_ts; @@ -747,8 +744,9 @@ float *out = audio_output->output[mix].data[ch]; float *in = child_audio.output[mix].data[ch]; - memcpy(out, in, AUDIO_OUTPUT_FRAMES * - MAX_AUDIO_CHANNELS * sizeof(float)); + memcpy(out, in, + AUDIO_OUTPUT_FRAMES * MAX_AUDIO_CHANNELS * + sizeof(float)); } } @@ -759,8 +757,9 @@ } static bool ss_audio_render(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio_output, - uint32_t mixers, size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio_output, + uint32_t mixers, size_t channels, + size_t sample_rate) { struct slideshow *ss = data; obs_source_t *transition = get_transition(ss); @@ -770,7 +769,7 @@ return false; success = ss_audio_render_(transition, ts_out, audio_output, mixers, - channels, sample_rate); + channels, sample_rate); obs_source_release(transition); return success; @@ -803,9 +802,10 @@ obs_data_set_default_string(settings, S_TRANSITION, "fade"); obs_data_set_default_int(settings, S_SLIDE_TIME, 8000); obs_data_set_default_int(settings, S_TR_SPEED, 700); - obs_data_set_default_string(settings, S_CUSTOM_SIZE, T_CUSTOM_SIZE_AUTO); + obs_data_set_default_string(settings, S_CUSTOM_SIZE, + T_CUSTOM_SIZE_AUTO); obs_data_set_default_string(settings, S_BEHAVIOR, - S_BEHAVIOR_ALWAYS_PLAY); + S_BEHAVIOR_ALWAYS_PLAY); obs_data_set_default_string(settings, S_MODE, S_MODE_AUTO); obs_data_set_default_bool(settings, S_LOOP, true); } @@ -813,12 +813,7 @@ static const char *file_filter = "Image files (*.bmp *.tga *.png *.jpeg *.jpg *.gif)"; -static const char *aspects[] = { - "16:9", - "16:10", - "4:3", - "1:1" -}; +static const char *aspects[] = {"16:9", "16:10", "4:3", "1:1"}; #define NUM_ASPECTS (sizeof(aspects) / sizeof(const char *)) @@ -841,36 +836,38 @@ /* ----------------- */ p = obs_properties_add_list(ppts, S_BEHAVIOR, T_BEHAVIOR, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, T_BEHAVIOR_ALWAYS_PLAY, - S_BEHAVIOR_ALWAYS_PLAY); + S_BEHAVIOR_ALWAYS_PLAY); obs_property_list_add_string(p, T_BEHAVIOR_STOP_RESTART, - S_BEHAVIOR_STOP_RESTART); + S_BEHAVIOR_STOP_RESTART); obs_property_list_add_string(p, T_BEHAVIOR_PAUSE_UNPAUSE, - S_BEHAVIOR_PAUSE_UNPAUSE); + S_BEHAVIOR_PAUSE_UNPAUSE); - p = obs_properties_add_list(ppts, S_MODE, T_MODE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + p = obs_properties_add_list(ppts, S_MODE, T_MODE, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, T_MODE_AUTO, S_MODE_AUTO); obs_property_list_add_string(p, T_MODE_MANUAL, S_MODE_MANUAL); p = obs_properties_add_list(ppts, S_TRANSITION, T_TRANSITION, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, T_TR_CUT, TR_CUT); obs_property_list_add_string(p, T_TR_FADE, TR_FADE); obs_property_list_add_string(p, T_TR_SWIPE, TR_SWIPE); obs_property_list_add_string(p, T_TR_SLIDE, TR_SLIDE); - obs_properties_add_int(ppts, S_SLIDE_TIME, T_SLIDE_TIME, - 50, 3600000, 50); - obs_properties_add_int(ppts, S_TR_SPEED, T_TR_SPEED, - 0, 3600000, 50); + obs_properties_add_int(ppts, S_SLIDE_TIME, T_SLIDE_TIME, 50, 3600000, + 50); + obs_properties_add_int(ppts, S_TR_SPEED, T_TR_SPEED, 0, 3600000, 50); obs_properties_add_bool(ppts, S_LOOP, T_LOOP); obs_properties_add_bool(ppts, S_HIDE, T_HIDE); obs_properties_add_bool(ppts, S_RANDOMIZE, T_RANDOMIZE); p = obs_properties_add_list(ppts, S_CUSTOM_SIZE, T_CUSTOM_SIZE, - OBS_COMBO_TYPE_EDITABLE, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_EDITABLE, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, T_CUSTOM_SIZE_AUTO, T_CUSTOM_SIZE_AUTO); @@ -897,7 +894,8 @@ } obs_properties_add_editable_list(ppts, S_FILES, T_FILES, - OBS_EDITABLE_LIST_TYPE_FILES, file_filter, path.array); + OBS_EDITABLE_LIST_TYPE_FILES, + file_filter, path.array); dstr_free(&path); return ppts; @@ -924,23 +922,22 @@ } struct obs_source_info slideshow_info = { - .id = "slideshow", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_VIDEO | - OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_COMPOSITE, - .get_name = ss_getname, - .create = ss_create, - .destroy = ss_destroy, - .update = ss_update, - .activate = ss_activate, - .deactivate = ss_deactivate, - .video_render = ss_video_render, - .video_tick = ss_video_tick, - .audio_render = ss_audio_render, + .id = "slideshow", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | + OBS_SOURCE_COMPOSITE, + .get_name = ss_getname, + .create = ss_create, + .destroy = ss_destroy, + .update = ss_update, + .activate = ss_activate, + .deactivate = ss_deactivate, + .video_render = ss_video_render, + .video_tick = ss_video_tick, + .audio_render = ss_audio_render, .enum_active_sources = ss_enum_sources, - .get_width = ss_width, - .get_height = ss_height, - .get_defaults = ss_defaults, - .get_properties = ss_properties + .get_width = ss_width, + .get_height = ss_height, + .get_defaults = ss_defaults, + .get_properties = ss_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/linux-alsa/alsa-input.c -> obs-studio-24.0.0.tar.xz/plugins/linux-alsa/alsa-input.c
Changed
@@ -29,7 +29,7 @@ #define blog(level, msg, ...) blog(level, "alsa-input: " msg, ##__VA_ARGS__) -#define NSEC_PER_SEC 1000000000LL +#define NSEC_PER_SEC 1000000000LL #define NSEC_PER_MSEC 1000000L #define STARTUP_TIMEOUT_NS (500 * NSEC_PER_MSEC) #define REOPEN_TIMEOUT 1000UL @@ -63,11 +63,11 @@ uint64_t first_ts; }; -static const char * alsa_get_name(void *); -static bool alsa_devices_changed(obs_properties_t *props, - obs_property_t *p, obs_data_t *settings); -static obs_properties_t * alsa_get_properties(void *); -static void * alsa_create(obs_data_t *, obs_source_t *); +static const char *alsa_get_name(void *); +static bool alsa_devices_changed(obs_properties_t *props, obs_property_t *p, + obs_data_t *settings); +static obs_properties_t *alsa_get_properties(void *); +static void *alsa_create(obs_data_t *, obs_source_t *); static void alsa_destroy(void *); static void alsa_activate(void *); static void alsa_deactivate(void *); @@ -75,19 +75,19 @@ static void alsa_update(void *, obs_data_t *); struct obs_source_info alsa_input_capture = { - .id = "alsa_input_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_AUDIO, - .create = alsa_create, - .destroy = alsa_destroy, + .id = "alsa_input_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_AUDIO, + .create = alsa_create, + .destroy = alsa_destroy, #if SHUTDOWN_ON_DEACTIVATE - .activate = alsa_activate, - .deactivate = alsa_deactivate, + .activate = alsa_activate, + .deactivate = alsa_deactivate, #endif - .update = alsa_update, - .get_defaults = alsa_get_defaults, - .get_name = alsa_get_name, - .get_properties = alsa_get_properties + .update = alsa_update, + .get_defaults = alsa_get_defaults, + .get_name = alsa_get_name, + .get_properties = alsa_get_properties, }; static bool _alsa_try_open(struct alsa_data *); @@ -96,28 +96,28 @@ static bool _alsa_configure(struct alsa_data *); static void _alsa_start_reopen(struct alsa_data *); static void _alsa_stop_reopen(struct alsa_data *); -static void * _alsa_listen(void *); -static void * _alsa_reopen(void *); +static void *_alsa_listen(void *); +static void *_alsa_reopen(void *); static enum audio_format _alsa_to_obs_audio_format(snd_pcm_format_t); static enum speaker_layout _alsa_channels_to_obs_speakers(unsigned int); /*****************************************************************************/ -void * alsa_create(obs_data_t *settings, obs_source_t *source) +void *alsa_create(obs_data_t *settings, obs_source_t *source) { struct alsa_data *data = bzalloc(sizeof(struct alsa_data)); - data->source = source; + data->source = source; #if SHUTDOWN_ON_DEACTIVATE - data->active = false; + data->active = false; #endif - data->buffer = NULL; - data->device = NULL; + data->buffer = NULL; + data->device = NULL; data->first_ts = 0; - data->handle = NULL; - data->listen = false; - data->reopen = false; + data->handle = NULL; + data->listen = false; + data->reopen = false; data->listen_thread = 0; data->reopen_thread = 0; @@ -217,7 +217,7 @@ #endif } -const char * alsa_get_name(void *unused) +const char *alsa_get_name(void *unused) { UNUSED_PARAMETER(unused); return obs_module_text("AlsaInput"); @@ -230,8 +230,8 @@ obs_data_set_default_int(settings, "rate", 44100); } -static bool alsa_devices_changed(obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) +static bool alsa_devices_changed(obs_properties_t *props, obs_property_t *p, + obs_data_t *settings) { UNUSED_PARAMETER(p); bool visible = false; @@ -248,14 +248,14 @@ return true; } -obs_properties_t * alsa_get_properties(void *unused) +obs_properties_t *alsa_get_properties(void *unused) { void **hints; void **hint; char *name = NULL; char *descr = NULL; char *io = NULL; - char *descr_i; + char *descr_i; obs_properties_t *props; obs_property_t *devices; obs_property_t *rate; @@ -265,17 +265,18 @@ props = obs_properties_create(); devices = obs_properties_add_list(props, "device_id", - obs_module_text("Device"), OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_STRING); + obs_module_text("Device"), + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(devices, "Default", "default"); - obs_properties_add_text(props, "custom_pcm", - obs_module_text("PCM"), OBS_TEXT_DEFAULT); + obs_properties_add_text(props, "custom_pcm", obs_module_text("PCM"), + OBS_TEXT_DEFAULT); - rate = obs_properties_add_list(props, "rate", - obs_module_text("Rate"), OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_INT); + rate = obs_properties_add_list(props, "rate", obs_module_text("Rate"), + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_set_modified_callback(devices, alsa_devices_changed); @@ -304,10 +305,10 @@ descr_i = descr; while (*descr_i) { if (*descr_i == '\n') { - *descr_i = '\0'; - break; - } - else ++descr_i; + *descr_i = '\0'; + break; + } else + ++descr_i; } obs_property_list_add_string(devices, descr, name); @@ -350,11 +351,11 @@ pthread_attr_t attr; int err; - err = snd_pcm_open(&data->handle, data->device, - SND_PCM_STREAM_CAPTURE, 0); + err = snd_pcm_open(&data->handle, data->device, SND_PCM_STREAM_CAPTURE, + 0); if (err < 0) { - blog(LOG_ERROR, "Failed to open '%s': %s", - data->device, snd_strerror(err)); + blog(LOG_ERROR, "Failed to open '%s': %s", data->device, + snd_strerror(err)); return false; } @@ -362,8 +363,7 @@ goto cleanup; if (snd_pcm_state(data->handle) != SND_PCM_STATE_PREPARED) { - blog(LOG_ERROR, "Device not prepared: '%s'", - data->device); + blog(LOG_ERROR, "Device not prepared: '%s'", data->device); goto cleanup; } @@ -371,8 +371,8 @@ err = snd_pcm_start(data->handle); if (err < 0) { - blog(LOG_ERROR, "Failed to start '%s': %s", - data->device, snd_strerror(err)); + blog(LOG_ERROR, "Failed to start '%s': %s", data->device, + snd_strerror(err)); goto cleanup; } @@ -385,8 +385,8 @@ if (err) { pthread_attr_destroy(&attr); blog(LOG_ERROR, - "Failed to create capture thread for device '%s'.", - data->device); + "Failed to create capture thread for device '%s'.", + data->device); goto cleanup; } @@ -412,7 +412,7 @@ } if (data->buffer) - bfree(data->buffer), data->buffer = NULL; + bfree(data->buffer), data->buffer = NULL; } bool _alsa_configure(struct alsa_data *data) @@ -425,37 +425,33 @@ err = snd_pcm_hw_params_any(data->handle, hwparams); if (err < 0) { - blog(LOG_ERROR, - "snd_pcm_hw_params_any failed: %s", - snd_strerror(err)); + blog(LOG_ERROR, "snd_pcm_hw_params_any failed: %s", + snd_strerror(err)); return false; } err = snd_pcm_hw_params_set_access(data->handle, hwparams, - SND_PCM_ACCESS_RW_INTERLEAVED); + SND_PCM_ACCESS_RW_INTERLEAVED); if (err < 0) { - blog(LOG_ERROR, - "snd_pcm_hw_params_set_access failed: %s", - snd_strerror(err)); + blog(LOG_ERROR, "snd_pcm_hw_params_set_access failed: %s", + snd_strerror(err)); return false; } data->format = SND_PCM_FORMAT_S16; err = snd_pcm_hw_params_set_format(data->handle, hwparams, - data->format); + data->format); if (err < 0) { - blog(LOG_ERROR, - "snd_pcm_hw_params_set_format failed: %s", - snd_strerror(err)); + blog(LOG_ERROR, "snd_pcm_hw_params_set_format failed: %s", + snd_strerror(err)); return false; } err = snd_pcm_hw_params_set_rate_near(data->handle, hwparams, - &data->rate, 0); + &data->rate, 0); if (err < 0) { - blog(LOG_ERROR, - "snd_pcm_hw_params_set_rate_near failed: %s", - snd_strerror(err)); + blog(LOG_ERROR, "snd_pcm_hw_params_set_rate_near failed: %s", + snd_strerror(err)); return false; } blog(LOG_INFO, "PCM '%s' rate set to %d", data->device, data->rate); @@ -465,34 +461,34 @@ data->channels = 2; err = snd_pcm_hw_params_set_channels_near(data->handle, hwparams, - &data->channels); + &data->channels); if (err < 0) { blog(LOG_ERROR, - "snd_pcm_hw_params_set_channels_near failed: %s", - snd_strerror(err)); + "snd_pcm_hw_params_set_channels_near failed: %s", + snd_strerror(err)); return false; } - blog(LOG_INFO, "PCM '%s' channels set to %d", - data->device, data->channels); + blog(LOG_INFO, "PCM '%s' channels set to %d", data->device, + data->channels); err = snd_pcm_hw_params(data->handle, hwparams); if (err < 0) { blog(LOG_ERROR, "snd_pcm_hw_params failed: %s", - snd_strerror(err)); + snd_strerror(err)); return false; } err = snd_pcm_hw_params_get_period_size(hwparams, &data->period_size, - &dir); + &dir); if (err < 0) { - blog(LOG_ERROR, - "snd_pcm_hw_params_get_period_size failed: %s", - snd_strerror(err)); + blog(LOG_ERROR, "snd_pcm_hw_params_get_period_size failed: %s", + snd_strerror(err)); return false; } - data->sample_size = (data->channels - * snd_pcm_format_physical_width(data->format)) / 8; + data->sample_size = + (data->channels * snd_pcm_format_physical_width(data->format)) / + 8; if (data->buffer) bfree(data->buffer); @@ -515,8 +511,8 @@ err = pthread_create(&data->reopen_thread, &attr, _alsa_reopen, data); if (err) { blog(LOG_ERROR, - "Failed to create reopen thread for device '%s'.", - data->device); + "Failed to create reopen thread for device '%s'.", + data->device); } pthread_attr_destroy(&attr); @@ -535,23 +531,23 @@ os_event_reset(data->abort_event); } -void * _alsa_listen(void *attr) +void *_alsa_listen(void *attr) { struct alsa_data *data = attr; struct obs_source_audio out; blog(LOG_DEBUG, "Capture thread started."); - out.data[0] = data->buffer; - out.format = _alsa_to_obs_audio_format(data->format); + out.data[0] = data->buffer; + out.format = _alsa_to_obs_audio_format(data->format); out.speakers = _alsa_channels_to_obs_speakers(data->channels); out.samples_per_sec = data->rate; os_atomic_set_bool(&data->listen, true); do { - snd_pcm_sframes_t frames = snd_pcm_readi(data->handle, - data->buffer, data->period_size); + snd_pcm_sframes_t frames = snd_pcm_readi( + data->handle, data->buffer, data->period_size); if (!os_atomic_load_bool(&data->listen)) break; @@ -565,8 +561,8 @@ } out.frames = frames; - out.timestamp = os_gettime_ns() - - ((frames * NSEC_PER_SEC) / data->rate); + out.timestamp = os_gettime_ns() - + ((frames * NSEC_PER_SEC) / data->rate); if (!data->first_ts) data->first_ts = out.timestamp + STARTUP_TIMEOUT_NS; @@ -581,7 +577,7 @@ return NULL; } -void * _alsa_reopen(void *attr) +void *_alsa_reopen(void *attr) { struct alsa_data *data = attr; unsigned long timeout = REOPEN_TIMEOUT; @@ -609,11 +605,16 @@ enum audio_format _alsa_to_obs_audio_format(snd_pcm_format_t format) { switch (format) { - case SND_PCM_FORMAT_U8: return AUDIO_FORMAT_U8BIT; - case SND_PCM_FORMAT_S16_LE: return AUDIO_FORMAT_16BIT; - case SND_PCM_FORMAT_S32_LE: return AUDIO_FORMAT_32BIT; - case SND_PCM_FORMAT_FLOAT_LE: return AUDIO_FORMAT_FLOAT; - default: break; + case SND_PCM_FORMAT_U8: + return AUDIO_FORMAT_U8BIT; + case SND_PCM_FORMAT_S16_LE: + return AUDIO_FORMAT_16BIT; + case SND_PCM_FORMAT_S32_LE: + return AUDIO_FORMAT_32BIT; + case SND_PCM_FORMAT_FLOAT_LE: + return AUDIO_FORMAT_FLOAT; + default: + break; } return AUDIO_FORMAT_UNKNOWN; @@ -621,16 +622,22 @@ enum speaker_layout _alsa_channels_to_obs_speakers(unsigned int channels) { - switch(channels) { - case 1: return SPEAKERS_MONO; - case 2: return SPEAKERS_STEREO; - case 3: return SPEAKERS_2POINT1; - case 4: return SPEAKERS_4POINT0; - case 5: return SPEAKERS_4POINT1; - case 6: return SPEAKERS_5POINT1; - case 8: return SPEAKERS_7POINT1; + switch (channels) { + case 1: + return SPEAKERS_MONO; + case 2: + return SPEAKERS_STEREO; + case 3: + return SPEAKERS_2POINT1; + case 4: + return SPEAKERS_4POINT0; + case 5: + return SPEAKERS_4POINT1; + case 6: + return SPEAKERS_5POINT1; + case 8: + return SPEAKERS_7POINT1; } return SPEAKERS_UNKNOWN; } -
View file
obs-studio-24.0.0.tar.xz/plugins/linux-alsa/data/locale/bg-BG.ini
Added
@@ -0,0 +1,3 @@ +AlsaInput="Устройство за улавяне на звука (ALSA)" +Device="Устройство" +
View file
obs-studio-23.2.1.tar.xz/plugins/linux-alsa/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-alsa/data/locale/gl-ES.ini
Changed
@@ -1,3 +1,3 @@ -AlsaInput="Dispositivo de captura de audio (ALSA)" +AlsaInput="Dispositivo de captura de son (ALSA)" Device="Dispositivo"
View file
obs-studio-24.0.0.tar.xz/plugins/linux-alsa/data/locale/sl-SI.ini
Added
@@ -0,0 +1,2 @@ +AlsaInput="Naprava za zajemanje zvoka (ALSA)" +
View file
obs-studio-23.2.1.tar.xz/plugins/linux-alsa/linux-alsa.c -> obs-studio-24.0.0.tar.xz/plugins/linux-alsa/linux-alsa.c
Changed
@@ -30,4 +30,3 @@ obs_register_source(&alsa_input_capture); return true; } -
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/data/locale/de-DE.ini
Changed
@@ -2,7 +2,7 @@ Screen="Bildschirm" CaptureCursor="Mauszeiger aufnehmen" AdvancedSettings="Erweiterte Einstellungen" -XServer="X-Server" +XServer="X‐Server" XCCapture="Fensteraufnahme (Xcomposite)" Window="Fenster" CropTop="Oben abschneiden (Pixel)" @@ -10,7 +10,7 @@ CropRight="Rechts abschneiden (Pixel)" CropBottom="Unten abschneiden (Pixel)" SwapRedBlue="Rot und Blau tauschen" -LockX="X-Server während der Aufnahme sperren" -IncludeXBorder="X-Rahmen anzeigen" -ExcludeAlpha="Alphaloses Texturformat verwenden (Mesa-Problemumgehung)" +LockX="X‐Server während der Aufnahme sperren" +IncludeXBorder="X‐Rahmen anzeigen" +ExcludeAlpha="Alphaloses Texturformat verwenden (Mesa‐Problemumgehung)"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/data/locale/gl-ES.ini
Changed
@@ -1,15 +1,16 @@ X11SharedMemoryScreenInput="Captura de pantalla (XSHM)" Screen="Pantalla" -CaptureCursor="Captura de cursor" +CaptureCursor="Capturar o cursor" AdvancedSettings="Axustes avanzados" -XServer="X Server" +XServer="Servidor das X" XCCapture="Captura de xanela (Xcomposite)" Window="Xanela" -CropTop="Recortar por arriba (píxeles)" -CropLeft="Recortar pola esquerda (píxeles)" -CropRight="Recortar pola dereita (píxeles)" -CropBottom="Recortar por abaixo (píxeles)" -SwapRedBlue="Trocar vermello e azul" -LockX="Bloquear o servidor X durante a captura" +CropTop="Recortar por riba (píxeis)" +CropLeft="Recortar pola esquerda (píxeis)" +CropRight="Recortar pola dereita (píxeis)" +CropBottom="Recortar por baixo (píxeis)" +SwapRedBlue="Intercambiar vermello e azul" +LockX="Bloquear o servidor das X durante a captura" IncludeXBorder="Incluír o bordo da xanela X" +ExcludeAlpha="Empregar o formato de textura sen alfa (solución Mesa)"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/data/locale/ro-RO.ini
Changed
@@ -10,7 +10,7 @@ CropRight="Trunchiază dreapta (pixeli)" CropBottom="Trunchiază partea inferioară (pixeli)" SwapRedBlue="Schimbă roșu cu albastru" -LockX="Blochează serverul X atunci când se capturează" +LockX="Blochează X server când se capturează" IncludeXBorder="Include marginea cu X" ExcludeAlpha="Folosește formatul de texturi fără alpha (soluție de evitare pentru Mesa)"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/data/locale/sl-SI.ini
Changed
@@ -1,6 +1,6 @@ X11SharedMemoryScreenInput="Zajemanje zaslona (XSHM)" Screen="Zaslon" -CaptureCursor="Zajemaj kazalec" +CaptureCursor="Zajemi kazalec" AdvancedSettings="Napredne nastavitve" XServer="X Server" XCCapture="Zajemanje okna (Xcomposite)"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xcompcap-helper.cpp -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xcompcap-helper.cpp
Changed
@@ -11,291 +11,259 @@ #include "xcompcap-helper.hpp" -namespace XCompcap +namespace XCompcap { +static Display *xdisplay = 0; + +Display *disp() { - static Display* xdisplay = 0; + if (!xdisplay) + xdisplay = XOpenDisplay(NULL); - Display *disp() - { - if (!xdisplay) - xdisplay = XOpenDisplay(NULL); + return xdisplay; +} - return xdisplay; - } +void cleanupDisplay() +{ + if (!xdisplay) + return; - void cleanupDisplay() - { - if (!xdisplay) - return; + XCloseDisplay(xdisplay); + xdisplay = 0; +} - XCloseDisplay(xdisplay); - xdisplay = 0; - } +static void getAllWindows(Window parent, std::list<Window> &windows) +{ + UNUSED_PARAMETER(parent); + UNUSED_PARAMETER(windows); +} - static void getAllWindows(Window parent, std::list<Window>& windows) - { - UNUSED_PARAMETER(parent); - UNUSED_PARAMETER(windows); - } +std::list<Window> getAllWindows() +{ + std::list<Window> res; - std::list<Window> getAllWindows() - { - std::list<Window> res; + for (int i = 0; i < ScreenCount(disp()); ++i) + getAllWindows(RootWindow(disp(), i), res); - for (int i = 0; i < ScreenCount(disp()); ++i) - getAllWindows(RootWindow(disp(), i), res); + return res; +} - return res; - } +// Specification for checking for ewmh support at +// http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472693600 - // Specification for checking for ewmh support at - // http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472693600 - - bool ewmhIsSupported() - { - Display *display = disp(); - Atom netSupportingWmCheck = XInternAtom(display, - "_NET_SUPPORTING_WM_CHECK", true); - Atom actualType; - int format = 0; - unsigned long num = 0, bytes = 0; - unsigned char *data = NULL; - Window ewmh_window = 0; - - int status = XGetWindowProperty( - display, - DefaultRootWindow(display), - netSupportingWmCheck, - 0L, - 1L, - false, - XA_WINDOW, - &actualType, - &format, - &num, - &bytes, - &data); - - if (status == Success) { - if (num > 0) { - ewmh_window = ((Window*)data)[0]; - } - if (data) { - XFree(data); - data = NULL; - } +bool ewmhIsSupported() +{ + Display *display = disp(); + Atom netSupportingWmCheck = + XInternAtom(display, "_NET_SUPPORTING_WM_CHECK", true); + Atom actualType; + int format = 0; + unsigned long num = 0, bytes = 0; + unsigned char *data = NULL; + Window ewmh_window = 0; + + int status = XGetWindowProperty(display, DefaultRootWindow(display), + netSupportingWmCheck, 0L, 1L, false, + XA_WINDOW, &actualType, &format, &num, + &bytes, &data); + + if (status == Success) { + if (num > 0) { + ewmh_window = ((Window *)data)[0]; } - - if (ewmh_window) { - status = XGetWindowProperty( - display, - ewmh_window, - netSupportingWmCheck, - 0L, - 1L, - false, - XA_WINDOW, - &actualType, - &format, - &num, - &bytes, - &data); - if (status != Success || num == 0 || - ewmh_window != ((Window*)data)[0]) { - ewmh_window = 0; - } - if (status == Success && data) { - XFree(data); - } + if (data) { + XFree(data); + data = NULL; } - - return ewmh_window != 0; } - std::list<Window> getTopLevelWindows() - { - std::list<Window> res; - - if (!ewmhIsSupported()) { - blog(LOG_WARNING, "Unable to query window list " - "because window manager " - "does not support extended " - "window manager Hints"); - return res; + if (ewmh_window) { + status = XGetWindowProperty(display, ewmh_window, + netSupportingWmCheck, 0L, 1L, false, + XA_WINDOW, &actualType, &format, + &num, &bytes, &data); + if (status != Success || num == 0 || + ewmh_window != ((Window *)data)[0]) { + ewmh_window = 0; } - - Atom netClList = XInternAtom(disp(), "_NET_CLIENT_LIST", true); - Atom actualType; - int format; - unsigned long num, bytes; - Window* data = 0; - - for (int i = 0; i < ScreenCount(disp()); ++i) { - Window rootWin = RootWindow(disp(), i); - - int status = XGetWindowProperty( - disp(), - rootWin, - netClList, - 0L, - ~0L, - false, - AnyPropertyType, - &actualType, - &format, - &num, - &bytes, - (uint8_t**)&data); - - if (status != Success) { - blog(LOG_WARNING, "Failed getting root " - "window properties"); - continue; - } - - for (unsigned long i = 0; i < num; ++i) - res.push_back(data[i]); - + if (status == Success && data) { XFree(data); } + } + + return ewmh_window != 0; +} +std::list<Window> getTopLevelWindows() +{ + std::list<Window> res; + + if (!ewmhIsSupported()) { + blog(LOG_WARNING, "Unable to query window list " + "because window manager " + "does not support extended " + "window manager Hints"); return res; } - int getRootWindowScreen(Window root) - { - XWindowAttributes attr; + Atom netClList = XInternAtom(disp(), "_NET_CLIENT_LIST", true); + Atom actualType; + int format; + unsigned long num, bytes; + Window *data = 0; - if (!XGetWindowAttributes(disp(), root, &attr)) - return DefaultScreen(disp()); + for (int i = 0; i < ScreenCount(disp()); ++i) { + Window rootWin = RootWindow(disp(), i); - return XScreenNumberOfScreen(attr.screen); + int status = XGetWindowProperty(disp(), rootWin, netClList, 0L, + ~0L, false, AnyPropertyType, + &actualType, &format, &num, + &bytes, (uint8_t **)&data); + + if (status != Success) { + blog(LOG_WARNING, "Failed getting root " + "window properties"); + continue; + } + + for (unsigned long i = 0; i < num; ++i) + res.push_back(data[i]); + + XFree(data); } - std::string getWindowAtom(Window win, const char *atom) - { - Atom netWmName = XInternAtom(disp(), atom, false); - int n; - char **list = 0; - XTextProperty tp; - std::string res = "unknown"; + return res; +} + +int getRootWindowScreen(Window root) +{ + XWindowAttributes attr; - XGetTextProperty(disp(), win, &tp, netWmName); + if (!XGetWindowAttributes(disp(), root, &attr)) + return DefaultScreen(disp()); - if (!tp.nitems) - XGetWMName(disp(), win, &tp); + return XScreenNumberOfScreen(attr.screen); +} - if (!tp.nitems) - return "error"; +std::string getWindowAtom(Window win, const char *atom) +{ + Atom netWmName = XInternAtom(disp(), atom, false); + int n; + char **list = 0; + XTextProperty tp; + std::string res = "unknown"; - if (tp.encoding == XA_STRING) { - res = (char*)tp.value; - } else { - int ret = XmbTextPropertyToTextList(disp(), &tp, &list, - &n); + XGetTextProperty(disp(), win, &tp, netWmName); - if (ret >= Success && n > 0 && *list) { - res = *list; - XFreeStringList(list); - } - } + if (!tp.nitems) + XGetWMName(disp(), win, &tp); - char *conv = nullptr; - if (os_mbs_to_utf8_ptr(res.c_str(), 0, &conv)) - res = conv; - bfree(conv); + if (!tp.nitems) + return "error"; - XFree(tp.value); + if (tp.encoding == XA_STRING) { + res = (char *)tp.value; + } else { + int ret = XmbTextPropertyToTextList(disp(), &tp, &list, &n); - return res; + if (ret >= Success && n > 0 && *list) { + res = *list; + XFreeStringList(list); + } } - std::string getWindowCommand(Window win) - { - Atom xi = XInternAtom(disp(), "WM_COMMAND", false); - int n; - char **list = 0; - XTextProperty tp; - std::string res = "error"; - - XGetTextProperty(disp(), win, &tp, xi); - - if (!tp.nitems) - return std::string(); - - if (tp.encoding == XA_STRING) { - res = (char*)tp.value; - } else { - int ret = XmbTextPropertyToTextList(disp(), &tp, &list, - &n); - if (ret >= Success && n > 0 && *list) { - res = *list; - XFreeStringList(list); - } - } + char *conv = nullptr; + if (os_mbs_to_utf8_ptr(res.c_str(), 0, &conv)) + res = conv; + bfree(conv); - XFree(tp.value); + XFree(tp.value); - return res; - } + return res; +} - int getWindowPid(Window win) - { - UNUSED_PARAMETER(win); - return 1234; //TODO +std::string getWindowCommand(Window win) +{ + Atom xi = XInternAtom(disp(), "WM_COMMAND", false); + int n; + char **list = 0; + XTextProperty tp; + std::string res = "error"; + + XGetTextProperty(disp(), win, &tp, xi); + + if (!tp.nitems) + return std::string(); + + if (tp.encoding == XA_STRING) { + res = (char *)tp.value; + } else { + int ret = XmbTextPropertyToTextList(disp(), &tp, &list, &n); + if (ret >= Success && n > 0 && *list) { + res = *list; + XFreeStringList(list); + } } - static std::unordered_set<Window> changedWindows; - static pthread_mutex_t changeLock = PTHREAD_MUTEX_INITIALIZER; - void processEvents() - { - PLock lock(&changeLock); + XFree(tp.value); - XLockDisplay(disp()); + return res; +} + +int getWindowPid(Window win) +{ + UNUSED_PARAMETER(win); + return 1234; //TODO +} - while (XEventsQueued(disp(), QueuedAfterReading) > 0) { - XEvent ev; +static std::unordered_set<Window> changedWindows; +static pthread_mutex_t changeLock = PTHREAD_MUTEX_INITIALIZER; +void processEvents() +{ + PLock lock(&changeLock); - XNextEvent(disp(), &ev); + XLockDisplay(disp()); - if (ev.type == ConfigureNotify) - changedWindows.insert(ev.xconfigure.event); + while (XEventsQueued(disp(), QueuedAfterReading) > 0) { + XEvent ev; - if (ev.type == MapNotify) - changedWindows.insert(ev.xmap.event); + XNextEvent(disp(), &ev); - if (ev.type == Expose) - changedWindows.insert(ev.xexpose.window); + if (ev.type == ConfigureNotify) + changedWindows.insert(ev.xconfigure.event); - if (ev.type == VisibilityNotify) - changedWindows.insert(ev.xvisibility.window); + if (ev.type == MapNotify) + changedWindows.insert(ev.xmap.event); - if (ev.type == DestroyNotify) - changedWindows.insert(ev.xdestroywindow.event); - } + if (ev.type == Expose) + changedWindows.insert(ev.xexpose.window); - XUnlockDisplay(disp()); + if (ev.type == VisibilityNotify) + changedWindows.insert(ev.xvisibility.window); + + if (ev.type == DestroyNotify) + changedWindows.insert(ev.xdestroywindow.event); } - bool windowWasReconfigured(Window win) - { - PLock lock(&changeLock); + XUnlockDisplay(disp()); +} - auto it = changedWindows.find(win); +bool windowWasReconfigured(Window win) +{ + PLock lock(&changeLock); - if (it != changedWindows.end()) { - changedWindows.erase(it); - return true; - } + auto it = changedWindows.find(win); - return false; + if (it != changedWindows.end()) { + changedWindows.erase(it); + return true; } + return false; } +} -PLock::PLock(pthread_mutex_t* mtx, bool trylock) - :m(mtx) +PLock::PLock(pthread_mutex_t *mtx, bool trylock) : m(mtx) { if (trylock) islock = mtx && pthread_mutex_trylock(mtx) == 0; @@ -331,11 +299,9 @@ } } - - -static bool* curErrorTarget = 0; +static bool *curErrorTarget = 0; static char curErrorText[200]; -static int xerrorlock_handler(Display* disp, XErrorEvent* err) +static int xerrorlock_handler(Display *disp, XErrorEvent *err) { if (curErrorTarget) @@ -451,7 +417,6 @@ } } - ObsGsContextHolder::ObsGsContextHolder() { obs_enter_graphics();
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xcompcap-helper.hpp -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xcompcap-helper.hpp
Changed
@@ -5,17 +5,15 @@ #define blog(level, msg, ...) blog(level, "xcompcap: " msg, ##__VA_ARGS__) - -class PLock -{ +class PLock { pthread_mutex_t *m; bool islock; - public: - PLock(const PLock&) = delete; - PLock& operator=(const PLock&) = delete; +public: + PLock(const PLock &) = delete; + PLock &operator=(const PLock &) = delete; - PLock(pthread_mutex_t* mtx, bool trylock = false); + PLock(pthread_mutex_t *mtx, bool trylock = false); ~PLock(); @@ -25,15 +23,14 @@ void lock(); }; -class XErrorLock -{ +class XErrorLock { bool islock; bool goterr; XErrorHandler prevhandler; - public: - XErrorLock(const XErrorLock&) = delete; - XErrorLock& operator=(const XErrorLock&) = delete; +public: + XErrorLock(const XErrorLock &) = delete; + XErrorLock &operator=(const XErrorLock &) = delete; XErrorLock(); ~XErrorLock(); @@ -48,13 +45,12 @@ void resetError(); }; -class XDisplayLock -{ +class XDisplayLock { bool islock; - public: - XDisplayLock(const XDisplayLock&) = delete; - XDisplayLock& operator=(const XDisplayLock&) = delete; +public: + XDisplayLock(const XDisplayLock &) = delete; + XDisplayLock &operator=(const XDisplayLock &) = delete; XDisplayLock(); ~XDisplayLock(); @@ -65,39 +61,37 @@ void lock(); }; -class ObsGsContextHolder -{ - public: - ObsGsContextHolder(const ObsGsContextHolder&) = delete; - ObsGsContextHolder& operator=(const ObsGsContextHolder&) = delete; +class ObsGsContextHolder { +public: + ObsGsContextHolder(const ObsGsContextHolder &) = delete; + ObsGsContextHolder &operator=(const ObsGsContextHolder &) = delete; ObsGsContextHolder(); ~ObsGsContextHolder(); }; -namespace XCompcap +namespace XCompcap { +Display *disp(); +void cleanupDisplay(); + +std::string getWindowCommand(Window win); +int getRootWindowScreen(Window root); +std::string getWindowAtom(Window win, const char *atom); +int getWindowPid(Window win); +bool ewmhIsSupported(); +std::list<Window> getTopLevelWindows(); +std::list<Window> getAllWindows(); + +inline std::string getWindowName(Window win) +{ + return getWindowAtom(win, "_NET_WM_NAME"); +} + +inline std::string getWindowClass(Window win) { - Display* disp(); - void cleanupDisplay(); - - std::string getWindowCommand(Window win); - int getRootWindowScreen(Window root); - std::string getWindowAtom(Window win, const char *atom); - int getWindowPid(Window win); - bool ewmhIsSupported(); - std::list<Window> getTopLevelWindows(); - std::list<Window> getAllWindows(); - - inline std::string getWindowName(Window win) - { - return getWindowAtom(win, "_NET_WM_NAME"); - } - - inline std::string getWindowClass(Window win) - { - return getWindowAtom(win, "WM_CLASS"); - } - - void processEvents(); - bool windowWasReconfigured(Window win); + return getWindowAtom(win, "WM_CLASS"); +} + +void processEvents(); +bool windowWasReconfigured(Window win); }
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xcompcap-main.cpp -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xcompcap-main.cpp
Changed
@@ -35,7 +35,7 @@ if (major == 0 && minor < 2) { blog(LOG_ERROR, "Xcomposite extension is too old: %d.%d < 0.2", - major, minor); + major, minor); return false; } @@ -51,43 +51,41 @@ { obs_properties_t *props = obs_properties_create(); - obs_property_t *wins = obs_properties_add_list(props, "capture_window", - obs_module_text("Window"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_property_t *wins = obs_properties_add_list( + props, "capture_window", obs_module_text("Window"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); - for (Window win: XCompcap::getTopLevelWindows()) { + for (Window win : XCompcap::getTopLevelWindows()) { std::string wname = XCompcap::getWindowName(win); std::string cls = XCompcap::getWindowClass(win); std::string winid = std::to_string((long long)win); std::string desc = - (winid + WIN_STRING_DIV + wname + - WIN_STRING_DIV + cls); + (winid + WIN_STRING_DIV + wname + WIN_STRING_DIV + cls); - obs_property_list_add_string(wins, wname.c_str(), - desc.c_str()); + obs_property_list_add_string(wins, wname.c_str(), desc.c_str()); } - obs_properties_add_int(props, "cut_top", obs_module_text("CropTop"), - 0, 4096, 1); + obs_properties_add_int(props, "cut_top", obs_module_text("CropTop"), 0, + 4096, 1); obs_properties_add_int(props, "cut_left", obs_module_text("CropLeft"), - 0, 4096, 1); + 0, 4096, 1); obs_properties_add_int(props, "cut_right", obs_module_text("CropRight"), - 0, 4096, 1); + 0, 4096, 1); obs_properties_add_int(props, "cut_bot", obs_module_text("CropBottom"), - 0, 4096, 1); + 0, 4096, 1); obs_properties_add_bool(props, "swap_redblue", - obs_module_text("SwapRedBlue")); + obs_module_text("SwapRedBlue")); obs_properties_add_bool(props, "lock_x", obs_module_text("LockX")); obs_properties_add_bool(props, "show_cursor", - obs_module_text("CaptureCursor")); + obs_module_text("CaptureCursor")); obs_properties_add_bool(props, "include_border", - obs_module_text("IncludeXBorder")); + obs_module_text("IncludeXBorder")); obs_properties_add_bool(props, "exclude_alpha", - obs_module_text("ExcludeAlpha")); + obs_module_text("ExcludeAlpha")); return props; } @@ -108,20 +106,24 @@ #define FIND_WINDOW_INTERVAL 2.0 -struct XCompcapMain_private -{ +struct XCompcapMain_private { XCompcapMain_private() - :win(0) - ,cut_top(0), cur_cut_top(0) - ,cut_left(0), cur_cut_left(0) - ,cut_right(0), cur_cut_right(0) - ,cut_bot(0), cur_cut_bot(0) - ,inverted(false) - ,width(0),height(0) - ,pixmap(0) - ,glxpixmap(0) - ,tex(0) - ,gltex(0) + : win(0), + cut_top(0), + cur_cut_top(0), + cut_left(0), + cur_cut_left(0), + cut_right(0), + cur_cut_right(0), + cut_bot(0), + cur_cut_bot(0), + inverted(false), + width(0), + height(0), + pixmap(0), + glxpixmap(0), + tex(0), + gltex(0) { pthread_mutexattr_init(&lockattr); pthread_mutexattr_settype(&lockattr, PTHREAD_MUTEX_RECURSIVE); @@ -169,7 +171,6 @@ xcursor_t *cursor = nullptr; }; - XCompcapMain::XCompcapMain(obs_data_t *settings, obs_source_t *source) { p = new XCompcapMain_private; @@ -231,7 +232,7 @@ std::string wcls = wstr.substr(lastMark + markSize); Window matchedNameWin = wid; - for (Window cwin: XCompcap::getTopLevelWindows()) { + for (Window cwin : XCompcap::getTopLevelWindows()) { std::string cwinname = XCompcap::getWindowName(cwin); std::string ccls = XCompcap::getWindowClass(cwin); @@ -249,38 +250,103 @@ static void xcc_cleanup(XCompcapMain_private *p) { PLock lock(&p->lock); - XDisplayLock xlock; + XErrorLock xlock; if (p->gltex) { - GLuint gltex = *(GLuint*)gs_texture_get_obj(p->gltex); + GLuint gltex = *(GLuint *)gs_texture_get_obj(p->gltex); glBindTexture(GL_TEXTURE_2D, gltex); - glXReleaseTexImageEXT(xdisp, p->glxpixmap, GLX_FRONT_LEFT_EXT); + if (p->glxpixmap) { + glXReleaseTexImageEXT(xdisp, p->glxpixmap, + GLX_FRONT_LEFT_EXT); + if (xlock.gotError()) { + blog(LOG_ERROR, + "cleanup glXReleaseTexImageEXT failed: %s", + xlock.getErrorText().c_str()); + xlock.resetError(); + } + glXDestroyPixmap(xdisp, p->glxpixmap); + if (xlock.gotError()) { + blog(LOG_ERROR, + "cleanup glXDestroyPixmap failed: %s", + xlock.getErrorText().c_str()); + xlock.resetError(); + } + p->glxpixmap = 0; + } gs_texture_destroy(p->gltex); p->gltex = 0; } - if (p->glxpixmap) { - glXDestroyPixmap(xdisp, p->glxpixmap); - p->glxpixmap = 0; - } - if (p->pixmap) { XFreePixmap(xdisp, p->pixmap); + if (xlock.gotError()) { + blog(LOG_ERROR, "cleanup glXDestroyPixmap failed: %s", + xlock.getErrorText().c_str()); + xlock.resetError(); + } p->pixmap = 0; } if (p->win) { XCompositeUnredirectWindow(xdisp, p->win, - CompositeRedirectAutomatic); + CompositeRedirectAutomatic); XSelectInput(xdisp, p->win, 0); p->win = 0; } + + if (p->tex) { + gs_texture_destroy(p->tex); + p->tex = 0; + } +} + +static gs_color_format gs_format_from_tex() +{ + GLint iformat = 0; + // consider GL_ARB_internalformat_query + glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, + &iformat); + + // These formats are known to be wrong on Intel platforms. We intentionally + // use swapped internal formats here to preserve historic behavior which + // swapped colors accidentally and because D3D11 would not support a + // GS_RGBX format + switch (iformat) { + case GL_RGB: + return GS_BGRX; + case GL_RGBA: + return GS_RGBA; + default: + return GS_RGBA; + } } +// from libobs-opengl/gl-subsystem.h because we need to handle GLX modifying textures outside libobs. +struct fb_info; + +struct gs_texture { + gs_device_t *device; + enum gs_texture_type type; + enum gs_color_format format; + GLenum gl_format; + GLenum gl_target; + GLenum gl_internal_format; + GLenum gl_type; + GLuint texture; + uint32_t levels; + bool is_dynamic; + bool is_render_target; + bool is_dummy; + bool gen_mipmaps; + + gs_samplerstate_t *cur_sampler; + struct fbo_info *fbo; +}; +// End shitty hack. + void XCompcapMain::updateSettings(obs_data_t *settings) { PLock lock(&p->lock); - XErrorLock xlock; ObsGsContextHolder obsctx; blog(LOG_DEBUG, "Settings updating"); @@ -290,8 +356,8 @@ xcc_cleanup(p); if (settings) { - const char *windowName = obs_data_get_string(settings, - "capture_window"); + const char *windowName = + obs_data_get_string(settings, "capture_window"); p->windowName = windowName; p->win = getWindowFromString(windowName); @@ -303,30 +369,28 @@ p->lockX = obs_data_get_bool(settings, "lock_x"); p->swapRedBlue = obs_data_get_bool(settings, "swap_redblue"); p->show_cursor = obs_data_get_bool(settings, "show_cursor"); - p->include_border = obs_data_get_bool(settings, "include_border"); + p->include_border = + obs_data_get_bool(settings, "include_border"); p->exclude_alpha = obs_data_get_bool(settings, "exclude_alpha"); p->draw_opaque = false; } else { p->win = prevWin; } - xlock.resetError(); - + XErrorLock xlock; if (p->win) XCompositeRedirectWindow(xdisp, p->win, - CompositeRedirectAutomatic); - + CompositeRedirectAutomatic); if (xlock.gotError()) { blog(LOG_ERROR, "XCompositeRedirectWindow failed: %s", - xlock.getErrorText().c_str()); + xlock.getErrorText().c_str()); return; } if (p->win) XSelectInput(xdisp, p->win, - StructureNotifyMask - | ExposureMask - | VisibilityChangeMask); + StructureNotifyMask | ExposureMask | + VisibilityChangeMask); XSync(xdisp, 0); XWindowAttributes attr; @@ -342,41 +406,25 @@ int x, y; XTranslateCoordinates(xdisp, p->win, attr.root, 0, 0, &x, &y, - &child); + &child); xcursor_offset(p->cursor, x, y); } - gs_color_format cf = GS_RGBA; - - if (p->exclude_alpha) { - cf = GS_BGRX; - } - - bool has_alpha = true; - - const int attrs[] = - { - GLX_BIND_TO_TEXTURE_RGBA_EXT, GL_TRUE, - GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT, - GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, - GLX_ALPHA_SIZE, 8, - GLX_DOUBLEBUFFER, GL_FALSE, - None - }; - + const int config_attrs[] = {GLX_BIND_TO_TEXTURE_RGBA_EXT, + GL_TRUE, + GLX_DRAWABLE_TYPE, + GLX_PIXMAP_BIT, + GLX_BIND_TO_TEXTURE_TARGETS_EXT, + GLX_TEXTURE_2D_BIT_EXT, + GLX_DOUBLEBUFFER, + GL_FALSE, + None}; int nelem = 0; - GLXFBConfig *configs = glXGetFBConfigs(xdisp, - XCompcap::getRootWindowScreen(attr.root), - &nelem); - - if (nelem <= 0) { - blog(LOG_ERROR, "no fb configs available"); - p->win = 0; - p->height = 0; - p->width = 0; - return; - } + GLXFBConfig *configs = glXChooseFBConfig( + xdisp, XCompcap::getRootWindowScreen(attr.root), config_attrs, + &nelem); + bool found = false; GLXFBConfig config; for (int i = 0; i < nelem; i++) { config = configs[i]; @@ -384,51 +432,24 @@ if (!visual) continue; - if (attr.visual->visualid != visual->visualid) { + if (attr.depth != visual->depth) { XFree(visual); continue; } XFree(visual); - - int value; - glXGetFBConfigAttrib(xdisp, config, GLX_ALPHA_SIZE, &value); - if (value != 8) - has_alpha = false; - + found = true; break; } - - XFree(configs); - configs = glXChooseFBConfig(xdisp, - XCompcap::getRootWindowScreen(attr.root), - attrs, &nelem); - - if (nelem <= 0) { + if (!found) { blog(LOG_ERROR, "no matching fb config found"); p->win = 0; p->height = 0; p->width = 0; + XFree(configs); return; } - bool found = false; - for (int i = 0; i < nelem; i++) { - config = configs[i]; - XVisualInfo *visual = glXGetVisualFromFBConfig(xdisp, config); - if (!visual) - continue; - if (attr.depth != visual->depth) { - XFree(visual); - continue; - } - XFree(visual); - found = true; - break; - } - if (!found) - config = configs[0]; - - if (cf == GS_BGRX || !has_alpha) { + if (p->exclude_alpha || attr.depth != 32) { p->draw_opaque = true; } @@ -462,93 +483,83 @@ p->cur_cut_right = 0; } - if (p->tex) - gs_texture_destroy(p->tex); - - uint8_t *texData = new uint8_t[width() * height() * 4]; - - memset(texData, 0, width() * height() * 4); - - const uint8_t* texDataArr[] = { texData, 0 }; - - p->tex = gs_texture_create(width(), height(), cf, 1, - texDataArr, 0); - - delete[] texData; - - if (p->swapRedBlue) { - GLuint tex = *(GLuint*)gs_texture_get_obj(p->tex); - glBindTexture(GL_TEXTURE_2D, tex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE); - glBindTexture(GL_TEXTURE_2D, 0); - } - + // Precautionary since we dont error check every GLX call above. xlock.resetError(); p->pixmap = XCompositeNameWindowPixmap(xdisp, p->win); - if (xlock.gotError()) { blog(LOG_ERROR, "XCompositeNameWindowPixmap failed: %s", - xlock.getErrorText().c_str()); + xlock.getErrorText().c_str()); p->pixmap = 0; XFree(configs); return; } - const int attribs_alpha[] = - { - GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, - GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT, - None - }; - - const int attribs_no_alpha[] = - { - GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, - GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGB_EXT, - None - }; - - const int *attribs = cf == GS_RGBA ? attribs_alpha : attribs_no_alpha; - - p->glxpixmap = glXCreatePixmap(xdisp, config, p->pixmap, attribs); + // Should be consistent format with config we are using. Since we searched on RGBA lets use RGBA here. + const int pixmap_attrs[] = {GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, + GLX_TEXTURE_FORMAT_EXT, + GLX_TEXTURE_FORMAT_RGBA_EXT, None}; + p->glxpixmap = glXCreatePixmap(xdisp, config, p->pixmap, pixmap_attrs); if (xlock.gotError()) { blog(LOG_ERROR, "glXCreatePixmap failed: %s", - xlock.getErrorText().c_str()); + xlock.getErrorText().c_str()); XFreePixmap(xdisp, p->pixmap); XFree(configs); p->pixmap = 0; p->glxpixmap = 0; return; } - XFree(configs); - p->gltex = gs_texture_create(p->width, p->height, cf, 1, 0, - GS_GL_DUMMYTEX); - - GLuint gltex = *(GLuint*)gs_texture_get_obj(p->gltex); + // Build an OBS texture to bind the pixmap to. + p->gltex = gs_texture_create(p->width, p->height, GS_RGBA, 1, 0, + GS_GL_DUMMYTEX); + GLuint gltex = *(GLuint *)gs_texture_get_obj(p->gltex); glBindTexture(GL_TEXTURE_2D, gltex); glXBindTexImageEXT(xdisp, p->glxpixmap, GLX_FRONT_LEFT_EXT, NULL); + if (xlock.gotError()) { + blog(LOG_ERROR, "glXBindTexImageEXT failed: %s", + xlock.getErrorText().c_str()); + XFreePixmap(xdisp, p->pixmap); + XFree(configs); + p->pixmap = 0; + p->glxpixmap = 0; + return; + } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + // glxBindTexImageEXT might modify the textures format. + gs_color_format format = gs_format_from_tex(); + glBindTexture(GL_TEXTURE_2D, 0); + // sync OBS texture format based on any glxBindTexImageEXT changes + p->gltex->format = format; + + // Create a pure OBS texture to use for rendering. Using the same + // format so we can copy instead of drawing from the source gltex. + if (p->tex) + gs_texture_destroy(p->tex); + p->tex = gs_texture_create(width(), height(), format, 1, 0, + GS_GL_DUMMYTEX); + if (p->swapRedBlue) { + GLuint tex = *(GLuint *)gs_texture_get_obj(p->tex); + glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE); + glBindTexture(GL_TEXTURE_2D, 0); + } if (!p->windowName.empty()) { - blog(LOG_INFO, "[window-capture: '%s'] update settings:\n" - "\ttitle: %s\n" - "\tclass: %s\n" - "\tHas alpha: %s\n" - "\tFound proper GLXFBConfig: %s\n", - obs_source_get_name(p->source), - XCompcap::getWindowName(p->win).c_str(), - XCompcap::getWindowClass(p->win).c_str(), - has_alpha ? "yes" : "no", - found ? "yes" : "no"); - blog(LOG_DEBUG, "\n" - "\tid: %s", - std::to_string((long long)p->win).c_str()); + blog(LOG_INFO, + "[window-capture: '%s'] update settings:\n" + "\ttitle: %s\n" + "\tclass: %s\n" + "\tBit depth: %i\n" + "\tFound proper GLXFBConfig (in %i): %s\n", + obs_source_get_name(p->source), + XCompcap::getWindowName(p->win).c_str(), + XCompcap::getWindowClass(p->win).c_str(), attr.depth, + nelem, found ? "yes" : "no"); } } @@ -596,33 +607,28 @@ obs_enter_graphics(); if (p->lockX) { + // XDisplayLock is still live so we should already be locked. XLockDisplay(xdisp); XSync(xdisp, 0); } if (p->include_border) { - gs_copy_texture_region( - p->tex, 0, 0, - p->gltex, - p->cur_cut_left, - p->cur_cut_top, - width(), height()); + gs_copy_texture_region(p->tex, 0, 0, p->gltex, p->cur_cut_left, + p->cur_cut_top, width(), height()); } else { - gs_copy_texture_region( - p->tex, 0, 0, - p->gltex, - p->cur_cut_left + p->border, - p->cur_cut_top + p->border, - width(), height()); + gs_copy_texture_region(p->tex, 0, 0, p->gltex, + p->cur_cut_left + p->border, + p->cur_cut_top + p->border, width(), + height()); } if (p->cursor && p->show_cursor) { xcursor_tick(p->cursor); p->cursor_outside = - p->cursor->x < p->cur_cut_left || - p->cursor->y < p->cur_cut_top || - p->cursor->x > int(p->width - p->cur_cut_right) || + p->cursor->x < p->cur_cut_left || + p->cursor->y < p->cur_cut_top || + p->cursor->x > int(p->width - p->cur_cut_right) || p->cursor->y > int(p->height - p->cur_cut_bot); }
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xcompcap-main.hpp -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xcompcap-main.hpp
Changed
@@ -2,9 +2,8 @@ struct XCompcapMain_private; -class XCompcapMain -{ - public: +class XCompcapMain { +public: static bool init(); static void deinit(); @@ -22,6 +21,6 @@ uint32_t width(); uint32_t height(); - private: +private: XCompcapMain_private *p; };
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xcomposite-main.cpp -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xcomposite-main.cpp
Changed
@@ -2,38 +2,38 @@ #include "xcompcap-main.hpp" -static void* xcompcap_create(obs_data_t *settings, obs_source_t *source) +static void *xcompcap_create(obs_data_t *settings, obs_source_t *source) { return new XCompcapMain(settings, source); } static void xcompcap_destroy(void *data) { - XCompcapMain* cc = (XCompcapMain*)data; + XCompcapMain *cc = (XCompcapMain *)data; delete cc; } -static void xcompcap_video_tick(void* data, float seconds) +static void xcompcap_video_tick(void *data, float seconds) { - XCompcapMain* cc = (XCompcapMain*)data; + XCompcapMain *cc = (XCompcapMain *)data; cc->tick(seconds); } -static void xcompcap_video_render(void* data, gs_effect_t *effect) +static void xcompcap_video_render(void *data, gs_effect_t *effect) { - XCompcapMain* cc = (XCompcapMain*)data; + XCompcapMain *cc = (XCompcapMain *)data; cc->render(effect); } -static uint32_t xcompcap_getwidth(void* data) +static uint32_t xcompcap_getwidth(void *data) { - XCompcapMain* cc = (XCompcapMain*)data; + XCompcapMain *cc = (XCompcapMain *)data; return cc->width(); } -static uint32_t xcompcap_getheight(void* data) +static uint32_t xcompcap_getheight(void *data) { - XCompcapMain* cc = (XCompcapMain*)data; + XCompcapMain *cc = (XCompcapMain *)data; return cc->height(); } @@ -51,11 +51,11 @@ void xcompcap_update(void *data, obs_data_t *settings) { - XCompcapMain* cc = (XCompcapMain*)data; + XCompcapMain *cc = (XCompcapMain *)data; cc->updateSettings(settings); } -static const char* xcompcap_getname(void*) +static const char *xcompcap_getname(void *) { return obs_module_text("XCCapture"); } @@ -69,20 +69,19 @@ memset(&sinfo, 0, sizeof(obs_source_info)); sinfo.id = "xcomposite_input"; - sinfo.output_flags = OBS_SOURCE_VIDEO | - OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_DO_NOT_DUPLICATE; + sinfo.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | + OBS_SOURCE_DO_NOT_DUPLICATE; - sinfo.get_name = xcompcap_getname; - sinfo.create = xcompcap_create; - sinfo.destroy = xcompcap_destroy; + sinfo.get_name = xcompcap_getname; + sinfo.create = xcompcap_create; + sinfo.destroy = xcompcap_destroy; sinfo.get_properties = xcompcap_props; - sinfo.get_defaults = xcompcap_defaults; - sinfo.update = xcompcap_update; - sinfo.video_tick = xcompcap_video_tick; - sinfo.video_render = xcompcap_video_render; - sinfo.get_width = xcompcap_getwidth; - sinfo.get_height = xcompcap_getheight; + sinfo.get_defaults = xcompcap_defaults; + sinfo.update = xcompcap_update; + sinfo.video_tick = xcompcap_video_tick; + sinfo.video_render = xcompcap_video_render; + sinfo.get_width = xcompcap_getwidth; + sinfo.get_height = xcompcap_getheight; obs_register_source(&sinfo); }
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xcursor-xcb.c -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xcursor-xcb.c
Changed
@@ -26,26 +26,27 @@ * size or by creating a new texture if the size is different */ static void xcb_xcursor_create(xcb_xcursor_t *data, - xcb_xfixes_get_cursor_image_reply_t *xc) + xcb_xfixes_get_cursor_image_reply_t *xc) { uint32_t *pixels = xcb_xfixes_get_cursor_image_cursor_image(xc); if (!pixels) return; if (data->tex && data->last_height == xc->width && - data->last_width == xc->height) { - gs_texture_set_image(data->tex, (const uint8_t *) pixels, - xc->width * sizeof(uint32_t), false); + data->last_width == xc->height) { + gs_texture_set_image(data->tex, (const uint8_t *)pixels, + xc->width * sizeof(uint32_t), false); } else { if (data->tex) gs_texture_destroy(data->tex); - data->tex = gs_texture_create(xc->width, xc->height, - GS_BGRA, 1, (const uint8_t **) &pixels, GS_DYNAMIC); + data->tex = gs_texture_create(xc->width, xc->height, GS_BGRA, 1, + (const uint8_t **)&pixels, + GS_DYNAMIC); } data->last_serial = xc->cursor_serial; - data->last_width = xc->width; + data->last_width = xc->width; data->last_height = xc->height; } @@ -58,8 +59,8 @@ xcb_xfixes_query_version_cookie_t xfix_c; - xfix_c = xcb_xfixes_query_version_unchecked(xcb, - XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION); + xfix_c = xcb_xfixes_query_version_unchecked( + xcb, XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION); free(xcb_xfixes_query_version_reply(xcb, xfix_c, NULL)); return data; @@ -73,7 +74,7 @@ } void xcb_xcursor_update(xcb_xcursor_t *data, - xcb_xfixes_get_cursor_image_reply_t *xc) + xcb_xfixes_get_cursor_image_reply_t *xc) { if (!data || !xc) return; @@ -81,8 +82,8 @@ if (!data->tex || data->last_serial != xc->cursor_serial) xcb_xcursor_create(data, xc); - data->x = xc->x - data->x_org; - data->y = xc->y - data->y_org; + data->x = xc->x - data->x_org; + data->y = xc->y - data->y_org; data->x_render = data->x - xc->xhot; data->y_render = data->y - xc->yhot; } @@ -92,7 +93,7 @@ if (!data->tex) return; - gs_effect_t *effect = gs_get_effect(); + gs_effect_t *effect = gs_get_effect(); gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); gs_effect_set_texture(image, data->tex); @@ -109,9 +110,8 @@ gs_blend_state_pop(); } -void xcb_xcursor_offset(xcb_xcursor_t* data, const int x_org, const int y_org) +void xcb_xcursor_offset(xcb_xcursor_t *data, const int x_org, const int y_org) { data->x_org = x_org; data->y_org = y_org; } -
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xcursor-xcb.h -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xcursor-xcb.h
Changed
@@ -30,12 +30,12 @@ unsigned int last_height; gs_texture_t *tex; - int x; - int y; - int x_org; - int y_org; - float x_render; - float y_render; + int x; + int y; + int x_org; + int y_org; + float x_render; + float y_render; } xcb_xcursor_t; /** @@ -60,7 +60,7 @@ * */ void xcb_xcursor_update(xcb_xcursor_t *data, - xcb_xfixes_get_cursor_image_reply_t *xc); + xcb_xfixes_get_cursor_image_reply_t *xc); /** * Draw the cursor
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xcursor.c -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xcursor.c
Changed
@@ -28,12 +28,13 @@ * Theres a lot of talk about this in other implementation and they tend to * be really complicated, but this naive approach seems to work fine ... */ -static uint32_t *xcursor_pixels(XFixesCursorImage *xc) { +static uint32_t *xcursor_pixels(XFixesCursorImage *xc) +{ uint_fast32_t size = xc->width * xc->height; uint32_t *pixels = bmalloc(size * sizeof(uint32_t)); for (uint_fast32_t i = 0; i < size; ++i) - pixels[i] = (uint32_t) xc->pixels[i]; + pixels[i] = (uint32_t)xc->pixels[i]; return pixels; } @@ -42,22 +43,23 @@ * Create the cursor texture, either by updating if the new cursor has the same * size or by creating a new texture if the size is different */ -static void xcursor_create(xcursor_t *data, XFixesCursorImage *xc) { +static void xcursor_create(xcursor_t *data, XFixesCursorImage *xc) +{ uint32_t *pixels = xcursor_pixels(xc); if (!pixels) return; - if (data->tex - && data->last_height == xc->width - && data->last_width == xc->height) { - gs_texture_set_image(data->tex, (const uint8_t *) pixels, - xc->width * sizeof(uint32_t), False); + if (data->tex && data->last_height == xc->width && + data->last_width == xc->height) { + gs_texture_set_image(data->tex, (const uint8_t *)pixels, + xc->width * sizeof(uint32_t), False); } else { if (data->tex) gs_texture_destroy(data->tex); - data->tex = gs_texture_create(xc->width, xc->height, - GS_BGRA, 1, (const uint8_t **) &pixels, GS_DYNAMIC); + data->tex = gs_texture_create(xc->width, xc->height, GS_BGRA, 1, + (const uint8_t **)&pixels, + GS_DYNAMIC); } bfree(pixels); @@ -67,7 +69,8 @@ data->last_height = xc->height; } -xcursor_t *xcursor_init(Display *dpy) { +xcursor_t *xcursor_init(Display *dpy) +{ xcursor_t *data = bzalloc(sizeof(xcursor_t)); data->dpy = dpy; @@ -76,13 +79,15 @@ return data; } -void xcursor_destroy(xcursor_t *data) { +void xcursor_destroy(xcursor_t *data) +{ if (data->tex) gs_texture_destroy(data->tex); bfree(data); } -void xcursor_tick(xcursor_t *data) { +void xcursor_tick(xcursor_t *data) +{ XFixesCursorImage *xc = XFixesGetCursorImage(data->dpy); if (!xc) return; @@ -98,11 +103,12 @@ XFree(xc); } -void xcursor_render(xcursor_t *data) { +void xcursor_render(xcursor_t *data) +{ if (!data->tex) return; - gs_effect_t *effect = gs_get_effect(); + gs_effect_t *effect = gs_get_effect(); gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); gs_effect_set_texture(image, data->tex); @@ -119,9 +125,8 @@ gs_blend_state_pop(); } -void xcursor_offset(xcursor_t* data, int_fast32_t x_org, int_fast32_t y_org) +void xcursor_offset(xcursor_t *data, int_fast32_t x_org, int_fast32_t y_org) { data->x_org = x_org; data->y_org = y_org; } -
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xhelpers.c -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xhelpers.c
Changed
@@ -30,7 +30,7 @@ bool active = true; xcb_xinerama_is_active_cookie_t xnr_c; - xcb_xinerama_is_active_reply_t *xnr_r; + xcb_xinerama_is_active_reply_t *xnr_r; xnr_c = xcb_xinerama_is_active_unchecked(xcb); xnr_r = xcb_xinerama_is_active_reply(xcb, xnr_c, NULL); @@ -48,7 +48,7 @@ int screens = 0; xcb_xinerama_query_screens_cookie_t scr_c; - xcb_xinerama_query_screens_reply_t *scr_r; + xcb_xinerama_query_screens_reply_t *scr_r; scr_c = xcb_xinerama_query_screens_unchecked(xcb); scr_r = xcb_xinerama_query_screens_reply(xcb, scr_c, NULL); @@ -60,15 +60,15 @@ } int xinerama_screen_geo(xcb_connection_t *xcb, int_fast32_t screen, - int_fast32_t *x, int_fast32_t *y, - int_fast32_t *w, int_fast32_t *h) + int_fast32_t *x, int_fast32_t *y, int_fast32_t *w, + int_fast32_t *h) { if (!xcb) goto fail; bool success = false; xcb_xinerama_query_screens_cookie_t scr_c; - xcb_xinerama_query_screens_reply_t *scr_r; + xcb_xinerama_query_screens_reply_t *scr_r; xcb_xinerama_screen_info_iterator_t iter; scr_c = xcb_xinerama_query_screens_unchecked(xcb); @@ -113,7 +113,7 @@ screen = xcb_setup_roots_iterator(xcb_get_setup(xcb)).data; xcb_randr_get_screen_resources_cookie_t res_c; - xcb_randr_get_screen_resources_reply_t* res_r; + xcb_randr_get_screen_resources_reply_t *res_r; res_c = xcb_randr_get_screen_resources(xcb, screen->root); res_r = xcb_randr_get_screen_resources_reply(xcb, res_c, 0); @@ -124,15 +124,14 @@ } int randr_screen_geo(xcb_connection_t *xcb, int_fast32_t screen, - int_fast32_t *x, int_fast32_t *y, - int_fast32_t *w, int_fast32_t *h, - xcb_screen_t **rscreen) + int_fast32_t *x, int_fast32_t *y, int_fast32_t *w, + int_fast32_t *h, xcb_screen_t **rscreen) { xcb_screen_t *xscreen; xscreen = xcb_setup_roots_iterator(xcb_get_setup(xcb)).data; xcb_randr_get_screen_resources_cookie_t res_c; - xcb_randr_get_screen_resources_reply_t* res_r; + xcb_randr_get_screen_resources_reply_t *res_r; res_c = xcb_randr_get_screen_resources(xcb, xscreen->root); res_r = xcb_randr_get_screen_resources_reply(xcb, res_c, 0); @@ -168,8 +167,8 @@ return -1; } -int x11_screen_geo(xcb_connection_t *xcb, int_fast32_t screen, - int_fast32_t *w, int_fast32_t *h) +int x11_screen_geo(xcb_connection_t *xcb, int_fast32_t screen, int_fast32_t *w, + int_fast32_t *h) { if (!xcb) goto fail; @@ -194,14 +193,14 @@ return -1; } -xcb_shm_t* xshm_xcb_attach(xcb_connection_t *xcb, const int w, const int h) +xcb_shm_t *xshm_xcb_attach(xcb_connection_t *xcb, const int w, const int h) { if (!xcb) return NULL; xcb_shm_t *shm = bzalloc(sizeof(xcb_shm_t)); - shm->xcb = xcb; - shm->seg = xcb_generate_id(shm->xcb); + shm->xcb = xcb; + shm->seg = xcb_generate_id(shm->xcb); shm->shmid = shmget(IPC_PRIVATE, w * h * 4, IPC_CREAT | 0777); if (shm->shmid == -1) @@ -224,7 +223,7 @@ xcb_shm_detach(shm->xcb, shm->seg); - if ((char *) shm->data != (char *) -1) + if ((char *)shm->data != (char *)-1) shmdt(shm->data); if (shm->shmid != -1)
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xhelpers.h -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xhelpers.h
Changed
@@ -27,9 +27,9 @@ typedef struct { xcb_connection_t *xcb; - xcb_shm_seg_t seg; - int shmid; - uint8_t *data; + xcb_shm_seg_t seg; + int shmid; + uint8_t *data; } xcb_shm_t; /** @@ -61,8 +61,8 @@ * @return < 0 on error */ int xinerama_screen_geo(xcb_connection_t *xcb, int_fast32_t screen, - int_fast32_t *x, int_fast32_t *y, - int_fast32_t *w, int_fast32_t *h); + int_fast32_t *x, int_fast32_t *y, int_fast32_t *w, + int_fast32_t *h); /** * Check for Randr extension @@ -93,9 +93,8 @@ * @return < 0 on error */ int randr_screen_geo(xcb_connection_t *xcb, int_fast32_t screen, - int_fast32_t *x, int_fast32_t *y, - int_fast32_t *w, int_fast32_t *h, - xcb_screen_t **rscreen); + int_fast32_t *x, int_fast32_t *y, int_fast32_t *w, + int_fast32_t *h, xcb_screen_t **rscreen); /** * Get screen geometry for a X11 screen @@ -109,8 +108,8 @@ * * @return < 0 on error */ -int x11_screen_geo(xcb_connection_t *xcb, int_fast32_t screen, - int_fast32_t *w, int_fast32_t *h); +int x11_screen_geo(xcb_connection_t *xcb, int_fast32_t screen, int_fast32_t *w, + int_fast32_t *h); /** * Attach a shared memory segment to the X-Server
View file
obs-studio-23.2.1.tar.xz/plugins/linux-capture/xshm-input.c -> obs-studio-24.0.0.tar.xz/plugins/linux-capture/xshm-input.c
Changed
@@ -33,26 +33,26 @@ #define blog(level, msg, ...) blog(level, "xshm-input: " msg, ##__VA_ARGS__) struct xshm_data { - obs_source_t *source; + obs_source_t *source; xcb_connection_t *xcb; - xcb_screen_t *xcb_screen; - xcb_shm_t *xshm; - xcb_xcursor_t *cursor; - - char *server; - uint_fast32_t screen_id; - int_fast32_t x_org; - int_fast32_t y_org; - int_fast32_t width; - int_fast32_t height; - - gs_texture_t *texture; - - bool show_cursor; - bool use_xinerama; - bool use_randr; - bool advanced; + xcb_screen_t *xcb_screen; + xcb_shm_t *xshm; + xcb_xcursor_t *cursor; + + char *server; + uint_fast32_t screen_id; + int_fast32_t x_org; + int_fast32_t y_org; + int_fast32_t width; + int_fast32_t height; + + gs_texture_t *texture; + + bool show_cursor; + bool use_xinerama; + bool use_randr; + bool advanced; }; /** @@ -66,8 +66,8 @@ { if (data->texture) gs_texture_destroy(data->texture); - data->texture = gs_texture_create(data->width, data->height, - GS_BGRA, 1, NULL, GS_DYNAMIC); + data->texture = gs_texture_create(data->width, data->height, GS_BGRA, 1, + NULL, GS_DYNAMIC); } /** @@ -102,26 +102,23 @@ int_fast32_t old_height = data->height; if (data->use_randr) { - if (randr_screen_geo(data->xcb, data->screen_id, - &data->x_org, &data->y_org, - &data->width, &data->height, - &data->xcb_screen) < 0) { + if (randr_screen_geo(data->xcb, data->screen_id, &data->x_org, + &data->y_org, &data->width, &data->height, + &data->xcb_screen) < 0) { return -1; } - } - else if (data->use_xinerama) { + } else if (data->use_xinerama) { if (xinerama_screen_geo(data->xcb, data->screen_id, - &data->x_org, &data->y_org, - &data->width, &data->height) < 0) { + &data->x_org, &data->y_org, + &data->width, &data->height) < 0) { return -1; } data->xcb_screen = xcb_get_screen(data->xcb, 0); - } - else { + } else { data->x_org = 0; data->y_org = 0; - if (x11_screen_geo(data->xcb, data->screen_id, - &data->width, &data->height) < 0) { + if (x11_screen_geo(data->xcb, data->screen_id, &data->width, + &data->height) < 0) { return -1; } data->xcb_screen = xcb_get_screen(data->xcb, data->screen_id); @@ -132,9 +129,10 @@ return -1; } - blog(LOG_INFO, "Geometry %"PRIdFAST32"x%"PRIdFAST32 - " @ %"PRIdFAST32",%"PRIdFAST32, - data->width, data->height, data->x_org, data->y_org); + blog(LOG_INFO, + "Geometry %" PRIdFAST32 "x%" PRIdFAST32 " @ %" PRIdFAST32 + ",%" PRIdFAST32, + data->width, data->height, data->x_org, data->y_org); if (old_width == data->width && old_height == data->height) return 0; @@ -145,7 +143,7 @@ /** * Returns the name of the plugin */ -static const char* xshm_getname(void *unused) +static const char *xshm_getname(void *unused) { UNUSED_PARAMETER(unused); return obs_module_text("X11SharedMemoryScreenInput"); @@ -190,8 +188,8 @@ */ static void xshm_capture_start(struct xshm_data *data) { - const char *server = (data->advanced && *data->server) - ? data->server : NULL; + const char *server = (data->advanced && *data->server) ? data->server + : NULL; data->xcb = xcb_connect(server, NULL); if (!data->xcb || xcb_connection_has_error(data->xcb)) { @@ -239,10 +237,10 @@ xshm_capture_stop(data); - data->screen_id = obs_data_get_int(settings, "screen"); + data->screen_id = obs_data_get_int(settings, "screen"); data->show_cursor = obs_data_get_bool(settings, "show_cursor"); - data->advanced = obs_data_get_bool(settings, "advanced"); - data->server = bstrdup(obs_data_get_string(settings, "server")); + data->advanced = obs_data_get_bool(settings, "advanced"); + data->server = bstrdup(obs_data_get_string(settings, "server")); xshm_capture_start(data); } @@ -260,11 +258,11 @@ /** * Toggle visibility of advanced settings */ -static bool xshm_toggle_advanced(obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) +static bool xshm_toggle_advanced(obs_properties_t *props, obs_property_t *p, + obs_data_t *settings) { UNUSED_PARAMETER(p); - const bool visible = obs_data_get_bool(settings, "advanced"); + const bool visible = obs_data_get_bool(settings, "advanced"); obs_property_t *server = obs_properties_get(props, "server"); obs_property_set_visible(server, visible); @@ -278,14 +276,14 @@ /** * The x server was changed */ -static bool xshm_server_changed(obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) +static bool xshm_server_changed(obs_properties_t *props, obs_property_t *p, + obs_data_t *settings) { UNUSED_PARAMETER(p); - bool advanced = obs_data_get_bool(settings, "advanced"); + bool advanced = obs_data_get_bool(settings, "advanced"); int_fast32_t old_screen = obs_data_get_int(settings, "screen"); - const char *server = obs_data_get_string(settings, "server"); + const char *server = obs_data_get_string(settings, "server"); obs_property_t *screens = obs_properties_get(props, "screen"); /* we want a real NULL here in case there is no string here */ @@ -303,11 +301,11 @@ dstr_init(&screen_info); bool randr = randr_is_active(xcb); bool xinerama = xinerama_is_active(xcb); - int_fast32_t count = (randr) ? - randr_screen_count(xcb) : - (xinerama) ? - xinerama_screen_count(xcb) : - xcb_setup_roots_length(xcb_get_setup(xcb)); + int_fast32_t count = + (randr) ? randr_screen_count(xcb) + : (xinerama) + ? xinerama_screen_count(xcb) + : xcb_setup_roots_length(xcb_get_setup(xcb)); for (int_fast32_t i = 0; i < count; ++i) { int_fast32_t x, y, w, h; @@ -320,21 +318,22 @@ else x11_screen_geo(xcb, i, &w, &h); - dstr_printf(&screen_info, "Screen %"PRIuFAST32" (%"PRIuFAST32 - "x%"PRIuFAST32" @ %"PRIuFAST32 - ",%"PRIuFAST32")", i, w, h, x, y); + dstr_printf(&screen_info, + "Screen %" PRIuFAST32 " (%" PRIuFAST32 + "x%" PRIuFAST32 " @ %" PRIuFAST32 ",%" PRIuFAST32 + ")", + i, w, h, x, y); obs_property_list_add_int(screens, screen_info.array, i); } /* handle missing screen */ if (old_screen + 1 > count) { - dstr_printf(&screen_info, "Screen %"PRIuFAST32" (not found)", - old_screen); - size_t index = obs_property_list_add_int(screens, - screen_info.array, old_screen); + dstr_printf(&screen_info, "Screen %" PRIuFAST32 " (not found)", + old_screen); + size_t index = obs_property_list_add_int( + screens, screen_info.array, old_screen); obs_property_list_item_disable(screens, index, true); - } dstr_free(&screen_info); @@ -355,13 +354,13 @@ obs_properties_t *props = obs_properties_create(); obs_properties_add_list(props, "screen", obs_module_text("Screen"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_properties_add_bool(props, "show_cursor", - obs_module_text("CaptureCursor")); - obs_property_t *advanced = obs_properties_add_bool(props, "advanced", - obs_module_text("AdvancedSettings")); - obs_property_t *server = obs_properties_add_text(props, "server", - obs_module_text("XServer"), OBS_TEXT_DEFAULT); + obs_module_text("CaptureCursor")); + obs_property_t *advanced = obs_properties_add_bool( + props, "advanced", obs_module_text("AdvancedSettings")); + obs_property_t *server = obs_properties_add_text( + props, "server", obs_module_text("XServer"), OBS_TEXT_DEFAULT); obs_property_set_modified_callback(advanced, xshm_toggle_advanced); obs_property_set_modified_callback(server, xshm_server_changed); @@ -415,14 +414,16 @@ if (!obs_source_showing(data->source)) return; - xcb_shm_get_image_cookie_t img_c; - xcb_shm_get_image_reply_t *img_r; + xcb_shm_get_image_cookie_t img_c; + xcb_shm_get_image_reply_t *img_r; xcb_xfixes_get_cursor_image_cookie_t cur_c; - xcb_xfixes_get_cursor_image_reply_t *cur_r; + xcb_xfixes_get_cursor_image_reply_t *cur_r; img_c = xcb_shm_get_image_unchecked(data->xcb, data->xcb_screen->root, - data->x_org, data->y_org, data->width, data->height, - ~0, XCB_IMAGE_FORMAT_Z_PIXMAP, data->xshm->seg, 0); + data->x_org, data->y_org, + data->width, data->height, ~0, + XCB_IMAGE_FORMAT_Z_PIXMAP, + data->xshm->seg, 0); cur_c = xcb_xfixes_get_cursor_image_unchecked(data->xcb); img_r = xcb_shm_get_image_reply(data->xcb, img_c, NULL); @@ -433,8 +434,8 @@ obs_enter_graphics(); - gs_texture_set_image(data->texture, (void *) data->xshm->data, - data->width * 4, false); + gs_texture_set_image(data->texture, (void *)data->xshm->data, + data->width * 4, false); xcb_xcursor_update(data->cursor, cur_r); obs_leave_graphics(); @@ -491,19 +492,18 @@ } struct obs_source_info xshm_input = { - .id = "xshm_input", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_VIDEO | - OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_DO_NOT_DUPLICATE, - .get_name = xshm_getname, - .create = xshm_create, - .destroy = xshm_destroy, - .update = xshm_update, - .get_defaults = xshm_defaults, + .id = "xshm_input", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | + OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = xshm_getname, + .create = xshm_create, + .destroy = xshm_destroy, + .update = xshm_update, + .get_defaults = xshm_defaults, .get_properties = xshm_properties, - .video_tick = xshm_video_tick, - .video_render = xshm_video_render, - .get_width = xshm_getwidth, - .get_height = xshm_getheight + .video_tick = xshm_video_tick, + .video_render = xshm_video_render, + .get_width = xshm_getwidth, + .get_height = xshm_getheight, };
View file
obs-studio-23.2.1.tar.xz/plugins/linux-jack/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-jack/data/locale/de-DE.ini
Changed
@@ -1,4 +1,4 @@ -StartJACKServer="JACK-Server starten" +StartJACKServer="JACK‐Server starten" Channels="Anzahl der Kanäle" -JACKInput="JACK-Eingabe-Client" +JACKInput="JACK‐Eingabe‐Client"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-jack/jack-input.c -> obs-studio-24.0.0.tar.xz/plugins/linux-jack/jack-input.c
Changed
@@ -33,7 +33,7 @@ */ static void jack_destroy(void *vptr) { - struct jack_data* data = (struct jack_data*)vptr; + struct jack_data *data = (struct jack_data *)vptr; if (!data) return; @@ -51,14 +51,14 @@ */ static void jack_update(void *vptr, obs_data_t *settings) { - struct jack_data* data = (struct jack_data*)vptr; + struct jack_data *data = (struct jack_data *)vptr; if (!data) return; const char *new_device; - bool settings_changed = false; + bool settings_changed = false; bool new_jack_start_server = obs_data_get_bool(settings, "startjack"); - int new_channel_count = obs_data_get_int(settings, "channels"); + int new_channel_count = obs_data_get_int(settings, "channels"); if (new_jack_start_server != data->start_jack_server) { data->start_jack_server = new_jack_start_server; @@ -99,7 +99,7 @@ struct jack_data *data = bzalloc(sizeof(struct jack_data)); pthread_mutex_init(&data->jack_mutex, NULL); - data->source = source; + data->source = source; data->channels = -1; jack_update(data, settings); @@ -129,22 +129,22 @@ obs_properties_t *props = obs_properties_create(); - obs_properties_add_int(props, "channels", - obs_module_text("Channels"), 1, 8, 1); + obs_properties_add_int(props, "channels", obs_module_text("Channels"), + 1, 8, 1); obs_properties_add_bool(props, "startjack", - obs_module_text("StartJACKServer")); + obs_module_text("StartJACKServer")); return props; } struct obs_source_info jack_output_capture = { - .id = "jack_output_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_AUDIO, - .get_name = jack_input_getname, - .create = jack_create, - .destroy = jack_destroy, - .update = jack_update, - .get_defaults = jack_input_defaults, - .get_properties = jack_input_properties + .id = "jack_output_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_AUDIO, + .get_name = jack_input_getname, + .create = jack_create, + .destroy = jack_destroy, + .update = jack_update, + .get_defaults = jack_input_defaults, + .get_properties = jack_input_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/linux-jack/jack-wrapper.c -> obs-studio-24.0.0.tar.xz/plugins/linux-jack/jack-wrapper.c
Changed
@@ -36,33 +36,39 @@ */ static enum speaker_layout jack_channels_to_obs_speakers(uint_fast32_t channels) { - switch(channels) { - case 1: return SPEAKERS_MONO; - case 2: return SPEAKERS_STEREO; - case 3: return SPEAKERS_2POINT1; - case 5: return SPEAKERS_4POINT1; - case 6: return SPEAKERS_5POINT1; + switch (channels) { + case 1: + return SPEAKERS_MONO; + case 2: + return SPEAKERS_STEREO; + case 3: + return SPEAKERS_2POINT1; + case 5: + return SPEAKERS_4POINT1; + case 6: + return SPEAKERS_5POINT1; /* What should we do with 7 channels? */ /* case 7: return SPEAKERS_...; */ - case 8: return SPEAKERS_7POINT1; + case 8: + return SPEAKERS_7POINT1; } return SPEAKERS_UNKNOWN; } -int jack_process_callback(jack_nframes_t nframes, void* arg) +int jack_process_callback(jack_nframes_t nframes, void *arg) { - struct jack_data* data = (struct jack_data*)arg; + struct jack_data *data = (struct jack_data *)arg; if (data == 0) return 0; pthread_mutex_lock(&data->jack_mutex); struct obs_source_audio out; - out.speakers = jack_channels_to_obs_speakers(data->channels); - out.samples_per_sec = jack_get_sample_rate (data->jack_client); + out.speakers = jack_channels_to_obs_speakers(data->channels); + out.samples_per_sec = jack_get_sample_rate(data->jack_client); /* format is always 32 bit float for jack */ - out.format = AUDIO_FORMAT_FLOAT_PLANAR; + out.format = AUDIO_FORMAT_FLOAT_PLANAR; for (unsigned int i = 0; i < data->channels; ++i) { jack_default_audio_sample_t *jack_buffer = @@ -71,61 +77,61 @@ out.data[i] = (uint8_t *)jack_buffer; } - out.frames = nframes; + out.frames = nframes; out.timestamp = os_gettime_ns() - - jack_frames_to_time(data->jack_client, nframes); + jack_frames_to_time(data->jack_client, nframes); obs_source_output_audio(data->source, &out); pthread_mutex_unlock(&data->jack_mutex); return 0; } -int_fast32_t jack_init(struct jack_data* data) +int_fast32_t jack_init(struct jack_data *data) { pthread_mutex_lock(&data->jack_mutex); if (data->jack_client != NULL) goto good; - jack_options_t jack_option = data->start_jack_server ? - JackNullOption : JackNoStartServer; + jack_options_t jack_option = + data->start_jack_server ? JackNullOption : JackNoStartServer; data->jack_client = jack_client_open(data->device, jack_option, 0); if (data->jack_client == NULL) { blog(LOG_ERROR, - "jack_client_open Error:" - "Could not create JACK client! %s", - data->device); + "jack_client_open Error:" + "Could not create JACK client! %s", + data->device); goto error; } - data->jack_ports = (jack_port_t**)bzalloc( - sizeof(jack_port_t*) * data->channels); + data->jack_ports = + (jack_port_t **)bzalloc(sizeof(jack_port_t *) * data->channels); for (unsigned int i = 0; i < data->channels; ++i) { char port_name[10] = {'\0'}; - snprintf(port_name, sizeof(port_name), "in_%u", i+1); + snprintf(port_name, sizeof(port_name), "in_%u", i + 1); - data->jack_ports[i] = jack_port_register(data->jack_client, - port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); + data->jack_ports[i] = jack_port_register( + data->jack_client, port_name, JACK_DEFAULT_AUDIO_TYPE, + JackPortIsInput, 0); if (data->jack_ports[i] == NULL) { blog(LOG_ERROR, - "jack_port_register Error:" - "Could not create JACK port! %s", - port_name); + "jack_port_register Error:" + "Could not create JACK port! %s", + port_name); goto error; } } - if (jack_set_process_callback(data->jack_client, - jack_process_callback, data) != 0) { + if (jack_set_process_callback(data->jack_client, jack_process_callback, + data) != 0) { blog(LOG_ERROR, "jack_set_process_callback Error"); goto error; } if (jack_activate(data->jack_client) != 0) { - blog(LOG_ERROR, - "jack_activate Error:" - "Could not activate JACK client!"); + blog(LOG_ERROR, "jack_activate Error:" + "Could not activate JACK client!"); goto error; } @@ -138,7 +144,7 @@ return 1; } -void deactivate_jack(struct jack_data* data) +void deactivate_jack(struct jack_data *data) { pthread_mutex_lock(&data->jack_mutex); @@ -146,7 +152,8 @@ if (data->jack_ports != NULL) { for (int i = 0; i < data->channels; ++i) { if (data->jack_ports[i] != NULL) - jack_port_unregister(data->jack_client, + jack_port_unregister( + data->jack_client, data->jack_ports[i]); } bfree(data->jack_ports);
View file
obs-studio-23.2.1.tar.xz/plugins/linux-jack/jack-wrapper.h -> obs-studio-24.0.0.tar.xz/plugins/linux-jack/jack-wrapper.h
Changed
@@ -43,9 +43,9 @@ /** * Initialize the jack client and register the ports */ -int_fast32_t jack_init(struct jack_data* data); +int_fast32_t jack_init(struct jack_data *data); /** * Destroys the jack client and unregisters the ports */ -void deactivate_jack(struct jack_data* data); +void deactivate_jack(struct jack_data *data);
View file
obs-studio-23.2.1.tar.xz/plugins/linux-pulseaudio/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-pulseaudio/data/locale/gl-ES.ini
Changed
@@ -1,4 +1,4 @@ -PulseInput="Captura de entrada audio (PulseAudio)" -PulseOutput="Captura de saída de audio (PulseAudio)" +PulseInput="Captura de entrada son (PulseAudio)" +PulseOutput="Captura de saída de son (PulseAudio)" Device="Dispositivo"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-pulseaudio/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-pulseaudio/data/locale/ka-GE.ini
Changed
@@ -1,4 +1,4 @@ -PulseInput="შემავალი ხმოვანი სიგნალის ჩაწერა (PulseAudio)" +PulseInput="შემავალი ხმის ჩაწერა (PulseAudio)" PulseOutput="გამოტანილი ხმის ჩაწერა (PulseAudio)" Device="მოწყობილობა"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-pulseaudio/pulse-input.c -> obs-studio-24.0.0.tar.xz/plugins/linux-pulseaudio/pulse-input.c
Changed
@@ -21,7 +21,7 @@ #include "pulse-wrapper.h" -#define NSEC_PER_SEC 1000000000LL +#define NSEC_PER_SEC 1000000000LL #define NSEC_PER_MSEC 1000000L #define PULSE_DATA(voidptr) struct pulse_data *data = voidptr; @@ -53,15 +53,19 @@ /** * get obs from pulse audio format */ -static enum audio_format pulse_to_obs_audio_format( - pa_sample_format_t format) +static enum audio_format pulse_to_obs_audio_format(pa_sample_format_t format) { switch (format) { - case PA_SAMPLE_U8: return AUDIO_FORMAT_U8BIT; - case PA_SAMPLE_S16LE: return AUDIO_FORMAT_16BIT; - case PA_SAMPLE_S32LE: return AUDIO_FORMAT_32BIT; - case PA_SAMPLE_FLOAT32LE: return AUDIO_FORMAT_FLOAT; - default: return AUDIO_FORMAT_UNKNOWN; + case PA_SAMPLE_U8: + return AUDIO_FORMAT_U8BIT; + case PA_SAMPLE_S16LE: + return AUDIO_FORMAT_16BIT; + case PA_SAMPLE_S32LE: + return AUDIO_FORMAT_32BIT; + case PA_SAMPLE_FLOAT32LE: + return AUDIO_FORMAT_FLOAT; + default: + return AUDIO_FORMAT_UNKNOWN; } return AUDIO_FORMAT_UNKNOWN; @@ -77,17 +81,24 @@ * @note This *might* not work for some rather unusual setups, but should work * fine for the majority of cases. */ -static enum speaker_layout pulse_channels_to_obs_speakers( - uint_fast32_t channels) +static enum speaker_layout +pulse_channels_to_obs_speakers(uint_fast32_t channels) { - switch(channels) { - case 1: return SPEAKERS_MONO; - case 2: return SPEAKERS_STEREO; - case 3: return SPEAKERS_2POINT1; - case 4: return SPEAKERS_4POINT0; - case 5: return SPEAKERS_4POINT1; - case 6: return SPEAKERS_5POINT1; - case 8: return SPEAKERS_7POINT1; + switch (channels) { + case 1: + return SPEAKERS_MONO; + case 2: + return SPEAKERS_STEREO; + case 3: + return SPEAKERS_2POINT1; + case 4: + return SPEAKERS_4POINT0; + case 5: + return SPEAKERS_4POINT1; + case 6: + return SPEAKERS_5POINT1; + case 8: + return SPEAKERS_7POINT1; } return SPEAKERS_UNKNOWN; @@ -185,19 +196,18 @@ if (!frames) { blog(LOG_ERROR, "Got audio hole of %u bytes", - (unsigned int) bytes); + (unsigned int)bytes); pa_stream_drop(data->stream); goto exit; } struct obs_source_audio out; - out.speakers = data->speakers; + out.speakers = data->speakers; out.samples_per_sec = data->samples_per_sec; - out.format = pulse_to_obs_audio_format(data->format); - out.data[0] = (uint8_t *) frames; - out.frames = bytes / data->bytes_per_frame; - out.timestamp = get_sample_time(out.frames, - out.samples_per_sec); + out.format = pulse_to_obs_audio_format(data->format); + out.data[0] = (uint8_t *)frames; + out.frames = bytes / data->bytes_per_frame; + out.timestamp = get_sample_time(out.frames, out.samples_per_sec); if (!data->first_ts) data->first_ts = out.timestamp + STARTUP_TIMEOUT_NS; @@ -217,29 +227,32 @@ * Server info callback */ static void pulse_server_info(pa_context *c, const pa_server_info *i, - void *userdata) + void *userdata) { UNUSED_PARAMETER(c); PULSE_DATA(userdata); - blog(LOG_INFO, "Server name: '%s %s'", - i->server_name, i->server_version); + blog(LOG_INFO, "Server name: '%s %s'", i->server_name, + i->server_version); if (data->device && strcmp("default", data->device) == 0) { if (data->input) { bfree(data->device); data->device = bstrdup(i->default_source_name); - blog(LOG_DEBUG, "Default input device: '%s'", data->device); + blog(LOG_DEBUG, "Default input device: '%s'", + data->device); } else { - char *monitor = bzalloc(strlen(i->default_sink_name) + 9); + char *monitor = + bzalloc(strlen(i->default_sink_name) + 9); strcat(monitor, i->default_sink_name); strcat(monitor, ".monitor"); bfree(data->device); data->device = bstrdup(monitor); - blog(LOG_DEBUG, "Default output device: '%s'", data->device); + blog(LOG_DEBUG, "Default output device: '%s'", + data->device); bfree(monitor); } } @@ -254,7 +267,7 @@ * configured to something obs can't deal with. */ static void pulse_source_info(pa_context *c, const pa_source_info *i, int eol, - void *userdata) + void *userdata) { UNUSED_PARAMETER(c); PULSE_DATA(userdata); @@ -267,35 +280,36 @@ if (eol > 0) goto skip; - blog(LOG_INFO, "Audio format: %s, %"PRIu32" Hz" - ", %"PRIu8" channels", - pa_sample_format_to_string(i->sample_spec.format), - i->sample_spec.rate, - i->sample_spec.channels); + blog(LOG_INFO, + "Audio format: %s, %" PRIu32 " Hz" + ", %" PRIu8 " channels", + pa_sample_format_to_string(i->sample_spec.format), + i->sample_spec.rate, i->sample_spec.channels); pa_sample_format_t format = i->sample_spec.format; if (pulse_to_obs_audio_format(format) == AUDIO_FORMAT_UNKNOWN) { format = PA_SAMPLE_FLOAT32LE; - blog(LOG_INFO, "Sample format %s not supported by OBS," - "using %s instead for recording", - pa_sample_format_to_string(i->sample_spec.format), - pa_sample_format_to_string(format)); + blog(LOG_INFO, + "Sample format %s not supported by OBS," + "using %s instead for recording", + pa_sample_format_to_string(i->sample_spec.format), + pa_sample_format_to_string(format)); } uint8_t channels = i->sample_spec.channels; if (pulse_channels_to_obs_speakers(channels) == SPEAKERS_UNKNOWN) { channels = 2; - blog(LOG_INFO, "%c channels not supported by OBS," - "using %c instead for recording", - i->sample_spec.channels, - channels); + blog(LOG_INFO, + "%c channels not supported by OBS," + "using %c instead for recording", + i->sample_spec.channels, channels); } - data->format = format; + data->format = format; data->samples_per_sec = i->sample_spec.rate; - data->channels = channels; + data->channels = channels; skip: pulse_signal(0); @@ -313,24 +327,25 @@ */ static int_fast32_t pulse_start_recording(struct pulse_data *data) { - if (pulse_get_server_info(pulse_server_info, (void *) data) < 0) { + if (pulse_get_server_info(pulse_server_info, (void *)data) < 0) { blog(LOG_ERROR, "Unable to get server info !"); return -1; } if (pulse_get_source_info(pulse_source_info, data->device, - (void *) data) < 0) { + (void *)data) < 0) { blog(LOG_ERROR, "Unable to get source info !"); return -1; } if (data->format == PA_SAMPLE_INVALID) { - blog(LOG_ERROR, "An error occurred while getting the source info!"); + blog(LOG_ERROR, + "An error occurred while getting the source info!"); return -1; } pa_sample_spec spec; - spec.format = data->format; - spec.rate = data->samples_per_sec; + spec.format = data->format; + spec.rate = data->samples_per_sec; spec.channels = data->channels; if (!pa_sample_spec_valid(&spec)) { @@ -344,7 +359,7 @@ pa_channel_map channel_map = pulse_channel_map(data->speakers); data->stream = pulse_stream_new(obs_source_get_name(data->source), - &spec, &channel_map); + &spec, &channel_map); if (!data->stream) { blog(LOG_ERROR, "Unable to create stream"); return -1; @@ -352,21 +367,21 @@ pulse_lock(); pa_stream_set_read_callback(data->stream, pulse_stream_read, - (void *) data); + (void *)data); pulse_unlock(); pa_buffer_attr attr; - attr.fragsize = pa_usec_to_bytes(25000, &spec); - attr.maxlength = (uint32_t) -1; - attr.minreq = (uint32_t) -1; - attr.prebuf = (uint32_t) -1; - attr.tlength = (uint32_t) -1; + attr.fragsize = pa_usec_to_bytes(25000, &spec); + attr.maxlength = (uint32_t)-1; + attr.minreq = (uint32_t)-1; + attr.prebuf = (uint32_t)-1; + attr.tlength = (uint32_t)-1; pa_stream_flags_t flags = PA_STREAM_ADJUST_LATENCY; pulse_lock(); int_fast32_t ret = pa_stream_connect_record(data->stream, data->device, - &attr, flags); + &attr, flags); pulse_unlock(); if (ret < 0) { pulse_stop_recording(data); @@ -392,8 +407,9 @@ } blog(LOG_INFO, "Stopped recording from '%s'", data->device); - blog(LOG_INFO, "Got %"PRIuFAST32" packets with %"PRIuFAST64" frames", - data->packets, data->frames); + blog(LOG_INFO, + "Got %" PRIuFAST32 " packets with %" PRIuFAST64 " frames", + data->packets, data->frames); data->first_ts = 0; data->packets = 0; @@ -404,14 +420,14 @@ * input info callback */ static void pulse_input_info(pa_context *c, const pa_source_info *i, int eol, - void *userdata) + void *userdata) { UNUSED_PARAMETER(c); if (eol != 0 || i->monitor_of_sink != PA_INVALID_INDEX) goto skip; - obs_property_list_add_string((obs_property_t*) userdata, - i->description, i->name); + obs_property_list_add_string((obs_property_t *)userdata, i->description, + i->name); skip: pulse_signal(0); @@ -421,14 +437,14 @@ * output info callback */ static void pulse_output_info(pa_context *c, const pa_sink_info *i, int eol, - void *userdata) + void *userdata) { UNUSED_PARAMETER(c); if (eol != 0 || i->monitor_source == PA_INVALID_INDEX) goto skip; - obs_property_list_add_string((obs_property_t*) userdata, - i->description, i->monitor_source_name); + obs_property_list_add_string((obs_property_t *)userdata, i->description, + i->monitor_source_name); skip: pulse_signal(0); @@ -440,22 +456,22 @@ static obs_properties_t *pulse_properties(bool input) { obs_properties_t *props = obs_properties_create(); - obs_property_t *devices = obs_properties_add_list(props, "device_id", - obs_module_text("Device"), OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_STRING); + obs_property_t *devices = obs_properties_add_list( + props, "device_id", obs_module_text("Device"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); pulse_init(); if (input) - pulse_get_source_info_list(pulse_input_info, (void *) devices); + pulse_get_source_info_list(pulse_input_info, (void *)devices); else - pulse_get_sink_info_list(pulse_output_info, (void *) devices); + pulse_get_sink_info_list(pulse_output_info, (void *)devices); pulse_unref(); size_t count = obs_property_list_item_count(devices); if (count > 0) - obs_property_list_insert_string(devices, 0, - obs_module_text("Default"), "default"); + obs_property_list_insert_string( + devices, 0, obs_module_text("Default"), "default"); return props; } @@ -544,12 +560,13 @@ /** * Create the plugin object */ -static void *pulse_create(obs_data_t *settings, obs_source_t *source, bool input) +static void *pulse_create(obs_data_t *settings, obs_source_t *source, + bool input) { struct pulse_data *data = bzalloc(sizeof(struct pulse_data)); - data->input = input; - data->source = source; + data->input = input; + data->source = source; pulse_init(); pulse_update(data, settings); @@ -568,28 +585,26 @@ } struct obs_source_info pulse_input_capture = { - .id = "pulse_input_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_AUDIO | - OBS_SOURCE_DO_NOT_DUPLICATE, - .get_name = pulse_input_getname, - .create = pulse_input_create, - .destroy = pulse_destroy, - .update = pulse_update, - .get_defaults = pulse_defaults, - .get_properties = pulse_input_properties + .id = "pulse_input_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_AUDIO | OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = pulse_input_getname, + .create = pulse_input_create, + .destroy = pulse_destroy, + .update = pulse_update, + .get_defaults = pulse_defaults, + .get_properties = pulse_input_properties, }; struct obs_source_info pulse_output_capture = { - .id = "pulse_output_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_AUDIO | - OBS_SOURCE_DO_NOT_DUPLICATE | - OBS_SOURCE_DO_NOT_SELF_MONITOR, - .get_name = pulse_output_getname, - .create = pulse_output_create, - .destroy = pulse_destroy, - .update = pulse_update, - .get_defaults = pulse_defaults, - .get_properties = pulse_output_properties + .id = "pulse_output_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_AUDIO | OBS_SOURCE_DO_NOT_DUPLICATE | + OBS_SOURCE_DO_NOT_SELF_MONITOR, + .get_name = pulse_output_getname, + .create = pulse_output_create, + .destroy = pulse_destroy, + .update = pulse_update, + .get_defaults = pulse_defaults, + .get_properties = pulse_output_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/linux-pulseaudio/pulse-wrapper.c -> obs-studio-24.0.0.tar.xz/plugins/linux-pulseaudio/pulse-wrapper.c
Changed
@@ -70,7 +70,7 @@ pa_threaded_mainloop_get_api(pulse_mainloop), "OBS", p); pa_context_set_state_callback(pulse_context, - pulse_context_state_changed, NULL); + pulse_context_state_changed, NULL); pa_context_connect(pulse_context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL); pa_proplist_free(p); @@ -163,15 +163,15 @@ pa_threaded_mainloop_accept(pulse_mainloop); } -int_fast32_t pulse_get_source_info_list(pa_source_info_cb_t cb, void* userdata) +int_fast32_t pulse_get_source_info_list(pa_source_info_cb_t cb, void *userdata) { if (pulse_context_ready() < 0) return -1; pulse_lock(); - pa_operation *op = pa_context_get_source_info_list( - pulse_context, cb, userdata); + pa_operation *op = + pa_context_get_source_info_list(pulse_context, cb, userdata); if (!op) { pulse_unlock(); return -1; @@ -192,8 +192,8 @@ pulse_lock(); - pa_operation *op = pa_context_get_sink_info_list( - pulse_context, cb, userdata); + pa_operation *op = + pa_context_get_sink_info_list(pulse_context, cb, userdata); if (!op) { pulse_unlock(); return -1; @@ -208,7 +208,7 @@ } int_fast32_t pulse_get_source_info(pa_source_info_cb_t cb, const char *name, - void *userdata) + void *userdata) { if (pulse_context_ready() < 0) return -1; @@ -230,15 +230,15 @@ return 0; } -int_fast32_t pulse_get_server_info(pa_server_info_cb_t cb, void* userdata) +int_fast32_t pulse_get_server_info(pa_server_info_cb_t cb, void *userdata) { if (pulse_context_ready() < 0) return -1; pulse_lock(); - pa_operation *op = pa_context_get_server_info( - pulse_context, cb, userdata); + pa_operation *op = + pa_context_get_server_info(pulse_context, cb, userdata); if (!op) { pulse_unlock(); return -1; @@ -251,8 +251,8 @@ return 0; } -pa_stream* pulse_stream_new(const char* name, const pa_sample_spec* ss, - const pa_channel_map* map) +pa_stream *pulse_stream_new(const char *name, const pa_sample_spec *ss, + const pa_channel_map *map) { if (pulse_context_ready() < 0) return NULL; @@ -260,11 +260,10 @@ pulse_lock(); pa_proplist *p = pulse_properties(); - pa_stream *s = pa_stream_new_with_proplist( - pulse_context, name, ss, map, p); + pa_stream *s = + pa_stream_new_with_proplist(pulse_context, name, ss, map, p); pa_proplist_free(p); pulse_unlock(); return s; } -
View file
obs-studio-23.2.1.tar.xz/plugins/linux-pulseaudio/pulse-wrapper.h -> obs-studio-24.0.0.tar.xz/plugins/linux-pulseaudio/pulse-wrapper.h
Changed
@@ -124,7 +124,7 @@ * @warning call without active locks */ int_fast32_t pulse_get_source_info(pa_source_info_cb_t cb, const char *name, - void *userdata); + void *userdata); /** * Request server information @@ -148,4 +148,4 @@ * @warning call without active locks */ pa_stream *pulse_stream_new(const char *name, const pa_sample_spec *ss, - const pa_channel_map *map); + const pa_channel_map *map);
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/ar-SA.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/ar-SA.ini
Changed
@@ -1,5 +1,6 @@ V4L2Input="جهاز التقاط الفيديو (V4L2)" Device="الجهاز" +Input="الوارد" VideoFormat="تنسيق الفيديو" VideoStandard="معيار الفيديو" DVTiming="توقيت DV"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/ca-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/ca-ES.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="No ho canviïs" UseBuffering="Usa memòria intermèdia" ColorRange="Gamma de colors" +ColorRange.Default="Per defecte" ColorRange.Partial="Parcial" ColorRange.Full="Complet"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/cs-CZ.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/cs-CZ.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Ponechat nezměněné" UseBuffering="Použít vyrovnávací paměť" ColorRange="Rozsah barev" +ColorRange.Default="Výchozí" ColorRange.Partial="Částečný" ColorRange.Full="Plný"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/da-DK.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/da-DK.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Behold uændret" UseBuffering="Benyt buffering" ColorRange="Farveområde" +ColorRange.Default="Standard" ColorRange.Partial="Delvist" ColorRange.Full="Fuldt"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/de-DE.ini
Changed
@@ -3,12 +3,13 @@ Input="Eingabe" VideoFormat="Videoformat" VideoStandard="Videostandard" -DVTiming="DV-Timing" +DVTiming="DV‐Timing" Resolution="Auflösung" FrameRate="Bildrate" LeaveUnchanged="Unverändert lassen" UseBuffering="Puffern benutzen" ColorRange="Farbbereich" +ColorRange.Default="Standard" ColorRange.Partial="Begrenzt" ColorRange.Full="Voll"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/en-US.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/en-US.ini
Changed
@@ -9,5 +9,6 @@ LeaveUnchanged="Leave Unchanged" UseBuffering="Use Buffering" ColorRange="Color Range" +ColorRange.Default="Default" ColorRange.Partial="Partial" ColorRange.Full="Full"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/es-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/es-ES.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Dejar sin cambios" UseBuffering="Utilizar el almacenamiento en búfer" ColorRange="Gama de Colores" +ColorRange.Default="Predeterminado" ColorRange.Partial="Parcial" ColorRange.Full="Completo"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/eu-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/eu-ES.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Utzi aldatu gabe" UseBuffering="Erabili bufferreratzea" ColorRange="Kolore tartea" +ColorRange.Default="Lehenetsia" ColorRange.Partial="Partziala" ColorRange.Full="Osoa"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/fi-FI.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/fi-FI.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Jätä ennalleen" UseBuffering="Käytä puskurointia" ColorRange="Värialue" +ColorRange.Default="Oletus" ColorRange.Partial="Osittainen" ColorRange.Full="Täysi"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/fr-FR.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/fr-FR.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Annuler les modifications" UseBuffering="Utiliser le tampon mémoire" ColorRange="Gamme de couleurs" +ColorRange.Default="Par défaut" ColorRange.Partial="Partielle" ColorRange.Full="Complète"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/gl-ES.ini
Changed
@@ -3,9 +3,13 @@ Input="Entrada" VideoFormat="Formato de vídeo" VideoStandard="Vídeo estándar" -DVTiming="Axuste DV" +DVTiming="Sincronización do vídeo dixital (DV)" Resolution="Resolución" -FrameRate="Velocidade de fotogramas" +FrameRate="Taxa de fotogramas" LeaveUnchanged="Deixar sen cambios" -UseBuffering="Utilizar o almacenamento no búfer" +UseBuffering="Utilizar o almacenamento na memoria temporal" +ColorRange="Gama de cores" +ColorRange.Default="Predeterminado" +ColorRange.Partial="Parcial" +ColorRange.Full="Total"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/hu-HU.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/hu-HU.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Változatlanul hagyni" UseBuffering="Pufferelés használata" ColorRange="Színtartomány" +ColorRange.Default="Alapértelmezett" ColorRange.Partial="Részleges" ColorRange.Full="Teljes"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/it-IT.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/it-IT.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Lascia invariato" UseBuffering="Utilizza il buffering" ColorRange="Gamma di colori" +ColorRange.Default="Predefinito" ColorRange.Partial="Parziale" ColorRange.Full="Intero"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/ja-JP.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/ja-JP.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="変更せずに戻る" UseBuffering="バッファリングを使用する" ColorRange="色範囲" +ColorRange.Default="既定" ColorRange.Partial="一部" ColorRange.Full="全部"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/ka-GE.ini
Changed
@@ -1,6 +1,6 @@ -V4L2Input="ვიდეოს გადამღები მოწყობილობა (V4L2)" +V4L2Input="ვიდეოჩამწერი მოწყობილობა (V4L2)" Device="მოწყობილობა" -Input="შემავალი" +Input="შეტანა" VideoFormat="ვიდეოს ფორმატი" VideoStandard="ვიდეოს სტანდარტი" DVTiming="ციფრული ვიდეოს სინქრონიზაცია" @@ -9,6 +9,7 @@ LeaveUnchanged="უცვლელად დატოვება" UseBuffering="ბუფერიზაციის გამოყენება" ColorRange="ფერთა გამა" +ColorRange.Default="ნაგულისხმევი" ColorRange.Partial="ნაწილობრივი" ColorRange.Full="სრული"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/ko-KR.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/ko-KR.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="저장하지 않고 두기" UseBuffering="버퍼링 사용" ColorRange="색상 범위" +ColorRange.Default="기본값" ColorRange.Partial="부분" ColorRange.Full="전체"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/nl-NL.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/nl-NL.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Ongewijzigd Laten" UseBuffering="Buffering Gebruiken" ColorRange="Kleurbereik" +ColorRange.Default="Standaard" ColorRange.Partial="Gedeeltelijk" ColorRange.Full="Volledig"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/pl-PL.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/pl-PL.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Pozostaw bez zmian" UseBuffering="Użyj buforowania" ColorRange="Zakres kolorów" +ColorRange.Default="Domyślny" ColorRange.Partial="Częściowy" ColorRange.Full="Pełny"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/pt-BR.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/pt-BR.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Deixar inalterado" UseBuffering="Utilizar Buffering" ColorRange="Intervalo de Cor" +ColorRange.Default="Padrão" ColorRange.Partial="Parcial" ColorRange.Full="Completo"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/ro-RO.ini
Changed
@@ -8,4 +8,8 @@ FrameRate="Frecvență de cadre" LeaveUnchanged="Lasă neschimbat" UseBuffering="Folosește zona tampon" +ColorRange="Gamă de culori" +ColorRange.Default="Implicită" +ColorRange.Partial="Parțială" +ColorRange.Full="Completă"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/ru-RU.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/ru-RU.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Оставить без изменений" UseBuffering="Использовать буферизацию" ColorRange="Цветовой диапазон" +ColorRange.Default="По умолчанию" ColorRange.Partial="Частичный" ColorRange.Full="Полный"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/sv-SE.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/sv-SE.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Lämna oförändrat" UseBuffering="Använd buffer" ColorRange="Färgintervall" +ColorRange.Default="Standard" ColorRange.Partial="Delvis" ColorRange.Full="Full"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/tr-TR.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/tr-TR.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Değişmeden Bırak" UseBuffering="Arabelleğe Almayı Kullan" ColorRange="Renk Aralığı" +ColorRange.Default="Varsayılan" ColorRange.Partial="Kısmi" ColorRange.Full="Tam"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/uk-UA.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/uk-UA.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="Залишити без змін" UseBuffering="Увімкнути буферизацію" ColorRange="Колірний діапазон" +ColorRange.Default="За замовчанням" ColorRange.Partial="Частковий" ColorRange.Full="Повний"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/zh-CN.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/zh-CN.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="保持不变" UseBuffering="使用缓冲" ColorRange="颜色范围" +ColorRange.Default="默认" ColorRange.Partial="部分" ColorRange.Full="全部"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/data/locale/zh-TW.ini -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/data/locale/zh-TW.ini
Changed
@@ -9,6 +9,7 @@ LeaveUnchanged="不改變並離開" UseBuffering="使用緩衝" ColorRange="顏色範圍" +ColorRange.Default="預設" ColorRange.Partial="部分" ColorRange.Full="完整"
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/v4l2-helpers.c -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/v4l2-helpers.c
Changed
@@ -29,7 +29,7 @@ struct v4l2_buffer enq; memset(&enq, 0, sizeof(enq)); - enq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + enq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; enq.memory = V4L2_MEMORY_MMAP; for (enq.index = 0; enq.index < buf->count; ++enq.index) { @@ -67,8 +67,8 @@ struct v4l2_buffer map; memset(&req, 0, sizeof(req)); - req.count = 4; - req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + req.count = 4; + req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.memory = V4L2_MEMORY_MMAP; if (v4l2_ioctl(dev, VIDIOC_REQBUFS, &req) < 0) { @@ -82,10 +82,10 @@ } buf->count = req.count; - buf->info = bzalloc(req.count * sizeof(struct v4l2_mmap_info)); + buf->info = bzalloc(req.count * sizeof(struct v4l2_mmap_info)); memset(&map, 0, sizeof(map)); - map.type = req.type; + map.type = req.type; map.memory = req.memory; for (map.index = 0; map.index < req.count; ++map.index) { @@ -95,9 +95,9 @@ } buf->info[map.index].length = map.length; - buf->info[map.index].start = v4l2_mmap(NULL, map.length, - PROT_READ | PROT_WRITE, MAP_SHARED, - dev, map.m.offset); + buf->info[map.index].start = + v4l2_mmap(NULL, map.length, PROT_READ | PROT_WRITE, + MAP_SHARED, dev, map.m.offset); if (buf->info[map.index].start == MAP_FAILED) { blog(LOG_ERROR, "mmap for buffer failed"); @@ -110,7 +110,7 @@ int_fast32_t v4l2_destroy_mmap(struct v4l2_buffer_data *buf) { - for(uint_fast32_t i = 0; i < buf->count; ++i) { + for (uint_fast32_t i = 0; i < buf->count; ++i) { if (buf->info[i].start != MAP_FAILED && buf->info[i].start != 0) v4l2_munmap(buf->info[i].start, buf->info[i].length); } @@ -128,9 +128,8 @@ if (!dev || !input) return -1; - return (*input == -1) - ? v4l2_ioctl(dev, VIDIOC_G_INPUT, input) - : v4l2_ioctl(dev, VIDIOC_S_INPUT, input); + return (*input == -1) ? v4l2_ioctl(dev, VIDIOC_G_INPUT, input) + : v4l2_ioctl(dev, VIDIOC_S_INPUT, input); } int_fast32_t v4l2_get_input_caps(int_fast32_t dev, int input, uint32_t *caps) @@ -155,7 +154,7 @@ } int_fast32_t v4l2_set_format(int_fast32_t dev, int *resolution, - int *pixelformat, int *bytesperline) + int *pixelformat, int *bytesperline) { bool set = false; int width, height; @@ -172,7 +171,7 @@ if (*resolution != -1) { v4l2_unpack_tuple(&width, &height, *resolution); - fmt.fmt.pix.width = width; + fmt.fmt.pix.width = width; fmt.fmt.pix.height = height; set = true; } @@ -185,8 +184,8 @@ if (set && (v4l2_ioctl(dev, VIDIOC_S_FMT, &fmt) < 0)) return -1; - *resolution = v4l2_pack_tuple(fmt.fmt.pix.width, fmt.fmt.pix.height); - *pixelformat = fmt.fmt.pix.pixelformat; + *resolution = v4l2_pack_tuple(fmt.fmt.pix.width, fmt.fmt.pix.height); + *pixelformat = fmt.fmt.pix.pixelformat; *bytesperline = fmt.fmt.pix.bytesperline; return 0; } @@ -208,7 +207,7 @@ if (*framerate != -1) { v4l2_unpack_tuple(&num, &denom, *framerate); - par.parm.capture.timeperframe.numerator = num; + par.parm.capture.timeperframe.numerator = num; par.parm.capture.timeperframe.denominator = denom; set = true; } @@ -217,7 +216,7 @@ return -1; *framerate = v4l2_pack_tuple(par.parm.capture.timeperframe.numerator, - par.parm.capture.timeperframe.denominator); + par.parm.capture.timeperframe.denominator); return 0; } @@ -238,7 +237,7 @@ } int_fast32_t v4l2_enum_dv_timing(int_fast32_t dev, struct v4l2_dv_timings *dvt, - int index) + int index) { #if !defined(VIDIOC_ENUM_DV_TIMINGS) || !defined(V4L2_IN_CAP_DV_TIMINGS) UNUSED_PARAMETER(dev); @@ -251,7 +250,7 @@ struct v4l2_enum_dv_timings iter; memset(&iter, 0, sizeof(iter)); - iter.index = index; + iter.index = index; if (v4l2_ioctl(dev, VIDIOC_ENUM_DV_TIMINGS, &iter) < 0) return -1;
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/v4l2-helpers.h -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/v4l2-helpers.h
Changed
@@ -57,19 +57,30 @@ static inline enum video_format v4l2_to_obs_video_format(uint_fast32_t format) { switch (format) { - case V4L2_PIX_FMT_YVYU: return VIDEO_FORMAT_YVYU; - case V4L2_PIX_FMT_YUYV: return VIDEO_FORMAT_YUY2; - case V4L2_PIX_FMT_UYVY: return VIDEO_FORMAT_UYVY; - case V4L2_PIX_FMT_NV12: return VIDEO_FORMAT_NV12; - case V4L2_PIX_FMT_YUV420: return VIDEO_FORMAT_I420; - case V4L2_PIX_FMT_YVU420: return VIDEO_FORMAT_I420; + case V4L2_PIX_FMT_YVYU: + return VIDEO_FORMAT_YVYU; + case V4L2_PIX_FMT_YUYV: + return VIDEO_FORMAT_YUY2; + case V4L2_PIX_FMT_UYVY: + return VIDEO_FORMAT_UYVY; + case V4L2_PIX_FMT_NV12: + return VIDEO_FORMAT_NV12; + case V4L2_PIX_FMT_YUV420: + return VIDEO_FORMAT_I420; + case V4L2_PIX_FMT_YVU420: + return VIDEO_FORMAT_I420; #ifdef V4L2_PIX_FMT_XBGR32 - case V4L2_PIX_FMT_XBGR32: return VIDEO_FORMAT_BGRX; + case V4L2_PIX_FMT_XBGR32: + return VIDEO_FORMAT_BGRX; #endif #ifdef V4L2_PIX_FMT_ABGR32 - case V4L2_PIX_FMT_ABGR32: return VIDEO_FORMAT_BGRA; + case V4L2_PIX_FMT_ABGR32: + return VIDEO_FORMAT_BGRA; #endif - default: return VIDEO_FORMAT_NONE; + case V4L2_PIX_FMT_BGR24: + return VIDEO_FORMAT_BGR3; + default: + return VIDEO_FORMAT_NONE; } } @@ -80,48 +91,26 @@ * and the height in the low word. * The array is terminated with a zero. */ -static const int v4l2_framesizes[] = -{ +static const int v4l2_framesizes[] = { /* 4:3 */ - 160<<16 | 120, - 320<<16 | 240, - 480<<16 | 320, - 640<<16 | 480, - 800<<16 | 600, - 1024<<16 | 768, - 1280<<16 | 960, - 1440<<16 | 1050, - 1440<<16 | 1080, - 1600<<16 | 1200, + 160 << 16 | 120, 320 << 16 | 240, 480 << 16 | 320, 640 << 16 | 480, + 800 << 16 | 600, 1024 << 16 | 768, 1280 << 16 | 960, 1440 << 16 | 1050, + 1440 << 16 | 1080, 1600 << 16 | 1200, /* 16:9 */ - 640<<16 | 360, - 960<<16 | 540, - 1280<<16 | 720, - 1600<<16 | 900, - 1920<<16 | 1080, - 1920<<16 | 1200, - 2560<<16 | 1440, - 3840<<16 | 2160, + 640 << 16 | 360, 960 << 16 | 540, 1280 << 16 | 720, 1600 << 16 | 900, + 1920 << 16 | 1080, 1920 << 16 | 1200, 2560 << 16 | 1440, + 3840 << 16 | 2160, /* 21:9 */ - 2560<<16 | 1080, - 3440<<16 | 1440, - 5120<<16 | 2160, + 2560 << 16 | 1080, 3440 << 16 | 1440, 5120 << 16 | 2160, /* tv */ - 432<<16 | 520, - 480<<16 | 320, - 480<<16 | 530, - 486<<16 | 440, - 576<<16 | 310, - 576<<16 | 520, - 576<<16 | 570, - 720<<16 | 576, - 1024<<16 | 576, + 432 << 16 | 520, 480 << 16 | 320, 480 << 16 | 530, 486 << 16 | 440, + 576 << 16 | 310, 576 << 16 | 520, 576 << 16 | 570, 720 << 16 | 576, + 1024 << 16 | 576, - 0 -}; + 0}; /** * Fixed framerates for devices that don't support enumerating discrete values. @@ -130,19 +119,16 @@ * word and the denominator in the low word. * The array is terminated with a zero. */ -static const int v4l2_framerates[] = -{ - 1<<16 | 60, - 1<<16 | 50, - 1<<16 | 30, - 1<<16 | 25, - 1<<16 | 20, - 1<<16 | 15, - 1<<16 | 10, - 1<<16 | 5, +static const int v4l2_framerates[] = {1 << 16 | 60, + 1 << 16 | 50, + 1 << 16 | 30, + 1 << 16 | 25, + 1 << 16 | 20, + 1 << 16 | 15, + 1 << 16 | 10, + 1 << 16 | 5, - 0 -}; + 0}; /** * Pack two integer values into one @@ -256,7 +242,7 @@ * @return negative on failure */ int_fast32_t v4l2_set_format(int_fast32_t dev, int *resolution, - int *pixelformat, int *bytesperline); + int *pixelformat, int *bytesperline); /** * Set the framerate on the device. @@ -292,7 +278,7 @@ * @return negative on failure */ int_fast32_t v4l2_enum_dv_timing(int_fast32_t dev, struct v4l2_dv_timings *dvt, - int index); + int index); /** * Set a dv timing on the device *
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/v4l2-input.c -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/v4l2-input.c
Changed
@@ -50,15 +50,13 @@ #define V4L2_DATA(voidptr) struct v4l2_data *data = voidptr; #define timeval2ns(tv) \ - (((uint64_t) tv.tv_sec * 1000000000) + ((uint64_t) tv.tv_usec * 1000)) - -#define V4L2_FOURCC_STR(code) \ - (char[5]) { \ - (code >> 24) & 0xFF, \ - (code >> 16) & 0xFF, \ - (code >> 8) & 0xFF, \ - code & 0xFF, \ - 0 \ + (((uint64_t)tv.tv_sec * 1000000000) + ((uint64_t)tv.tv_usec * 1000)) + +#define V4L2_FOURCC_STR(code) \ + (char[5]) \ + { \ + (code >> 24) & 0xFF, (code >> 16) & 0xFF, (code >> 8) & 0xFF, \ + code & 0xFF, 0 \ } #define blog(level, msg, ...) blog(level, "v4l2-input: " msg, ##__VA_ARGS__) @@ -105,7 +103,8 @@ * pointers for the individual planes. */ static void v4l2_prep_obs_frame(struct v4l2_data *data, - struct obs_source_frame *frame, size_t *plane_offsets) + struct obs_source_frame *frame, + size_t *plane_offsets) { memset(frame, 0, sizeof(struct obs_source_frame)); memset(plane_offsets, 0, sizeof(size_t) * MAX_AV_PLANES); @@ -114,10 +113,10 @@ frame->height = data->height; frame->format = v4l2_to_obs_video_format(data->pixfmt); video_format_get_parameters(VIDEO_CS_DEFAULT, data->color_range, - frame->color_matrix, frame->color_range_min, - frame->color_range_max); + frame->color_matrix, frame->color_range_min, + frame->color_range_max); - switch(data->pixfmt) { + switch (data->pixfmt) { case V4L2_PIX_FMT_NV12: frame->linesize[0] = data->linesize; frame->linesize[1] = data->linesize / 2; @@ -162,7 +161,7 @@ if (v4l2_start_capture(data->dev, &data->buffers) < 0) goto exit; - frames = 0; + frames = 0; first_ts = 0; v4l2_prep_obs_frame(data, &out, plane_offsets); @@ -198,7 +197,7 @@ first_ts = out.timestamp; out.timestamp -= first_ts; - start = (uint8_t *) data->buffers.info[buf.index].start; + start = (uint8_t *)data->buffers.info[buf.index].start; for (uint_fast32_t i = 0; i < MAX_AV_PLANES; ++i) out.data[i] = start + plane_offsets[i]; obs_source_output_video(data->source, &out); @@ -211,14 +210,14 @@ frames++; } - blog(LOG_INFO, "Stopped capture after %"PRIu64" frames", frames); + blog(LOG_INFO, "Stopped capture after %" PRIu64 " frames", frames); exit: v4l2_stop_capture(data->dev); return NULL; } -static const char* v4l2_getname(void *unused) +static const char *v4l2_getname(void *unused) { UNUSED_PARAMETER(unused); return obs_module_text("V4L2Input"); @@ -232,7 +231,7 @@ obs_data_set_default_int(settings, "dv_timing", -1); obs_data_set_default_int(settings, "resolution", -1); obs_data_set_default_int(settings, "framerate", -1); - obs_data_set_default_int(settings, "color_range", VIDEO_RANGE_PARTIAL); + obs_data_set_default_int(settings, "color_range", VIDEO_RANGE_DEFAULT); obs_data_set_default_bool(settings, "buffering", true); } @@ -246,13 +245,13 @@ * @param enable enable/disable all properties */ static void v4l2_props_set_enabled(obs_properties_t *props, - obs_property_t *ignore, bool enable) + obs_property_t *ignore, bool enable) { if (!props) return; for (obs_property_t *prop = obs_properties_first(props); prop != NULL; - obs_property_next(&prop)) { + obs_property_next(&prop)) { if (prop == ignore) continue; @@ -281,7 +280,7 @@ return; cur_device_found = false; - cur_device_name = obs_data_get_string(settings, "device_id"); + cur_device_name = obs_data_get_string(settings, "device_id"); obs_property_list_clear(prop); @@ -320,8 +319,8 @@ #else /* ... since Linux 3.3 */ caps = (video_cap.capabilities & V4L2_CAP_DEVICE_CAPS) - ? video_cap.device_caps - : video_cap.capabilities; + ? video_cap.device_caps + : video_cap.capabilities; #endif if (!(caps & V4L2_CAP_VIDEO_CAPTURE)) { @@ -334,11 +333,11 @@ /* make sure device names are unique */ char unique_device_name[68]; sprintf(unique_device_name, "%s (%s)", video_cap.card, - video_cap.bus_info); + video_cap.bus_info); obs_property_list_add_string(prop, unique_device_name, - device.array); + device.array); blog(LOG_INFO, "Found device '%s' at %s", video_cap.card, - device.array); + device.array); /* check if this is the currently used device */ if (cur_device_name && !strcmp(cur_device_name, device.array)) @@ -349,8 +348,8 @@ /* add currently selected device if not present, but disable it ... */ if (!cur_device_found && cur_device_name && strlen(cur_device_name)) { - cur_device_index = obs_property_list_add_string(prop, - cur_device_name, cur_device_name); + cur_device_index = obs_property_list_add_string( + prop, cur_device_name, cur_device_name); obs_property_list_item_disable(prop, cur_device_index, true); } @@ -369,9 +368,9 @@ obs_property_list_clear(prop); while (v4l2_ioctl(dev, VIDIOC_ENUMINPUT, &in) == 0) { - obs_property_list_add_int(prop, (char *) in.name, in.index); + obs_property_list_add_int(prop, (char *)in.name, in.index); blog(LOG_INFO, "Found input '%s' (Index %d)", in.name, - in.index); + in.index); in.index++; } } @@ -390,14 +389,14 @@ obs_property_list_clear(prop); while (v4l2_ioctl(dev, VIDIOC_ENUM_FMT, &fmt) == 0) { - dstr_copy(&buffer, (char *) fmt.description); + dstr_copy(&buffer, (char *)fmt.description); if (fmt.flags & V4L2_FMT_FLAG_EMULATED) dstr_cat(&buffer, " (Emulated)"); - if (v4l2_to_obs_video_format(fmt.pixelformat) - != VIDEO_FORMAT_NONE) { + if (v4l2_to_obs_video_format(fmt.pixelformat) != + VIDEO_FORMAT_NONE) { obs_property_list_add_int(prop, buffer.array, - fmt.pixelformat); + fmt.pixelformat); blog(LOG_INFO, "Pixelformat: %s (available)", buffer.array); } else { @@ -423,7 +422,7 @@ obs_property_list_add_int(prop, obs_module_text("LeaveUnchanged"), -1); while (v4l2_ioctl(dev, VIDIOC_ENUMSTD, &std) == 0) { - obs_property_list_add_int(prop, (char *) std.name, std.id); + obs_property_list_add_int(prop, (char *)std.name, std.id); std.index++; } } @@ -444,18 +443,17 @@ while (v4l2_enum_dv_timing(dev, &dvt, index) == 0) { /* i do not pretend to understand, this is from qv4l2 ... */ - double h = (double) dvt.bt.height + dvt.bt.vfrontporch + - dvt.bt.vsync + dvt.bt.vbackporch + - dvt.bt.il_vfrontporch + dvt.bt.il_vsync + - dvt.bt.il_vbackporch; - double w = (double) dvt.bt.width + dvt.bt.hfrontporch + - dvt.bt.hsync + dvt.bt.hbackporch; - double i = (dvt.bt.interlaced) ? 2.0f : 1.0f; - double rate = (double) dvt.bt.pixelclock / (w * (h / i)); - - dstr_printf(&buf, "%ux%u%c %.2f", - dvt.bt.width, dvt.bt.height, - (dvt.bt.interlaced) ? 'i' : 'p', rate); + double h = (double)dvt.bt.height + dvt.bt.vfrontporch + + dvt.bt.vsync + dvt.bt.vbackporch + + dvt.bt.il_vfrontporch + dvt.bt.il_vsync + + dvt.bt.il_vbackporch; + double w = (double)dvt.bt.width + dvt.bt.hfrontporch + + dvt.bt.hsync + dvt.bt.hbackporch; + double i = (dvt.bt.interlaced) ? 2.0f : 1.0f; + double rate = (double)dvt.bt.pixelclock / (w * (h / i)); + + dstr_printf(&buf, "%ux%u%c %.2f", dvt.bt.width, dvt.bt.height, + (dvt.bt.interlaced) ? 'i' : 'p', rate); obs_property_list_add_int(prop, buf.array, index); @@ -469,7 +467,7 @@ * List resolutions for device and format */ static void v4l2_resolution_list(int dev, uint_fast32_t pixelformat, - obs_property_t *prop) + obs_property_t *prop) { struct v4l2_frmsizeenum frmsize; frmsize.pixel_format = pixelformat; @@ -483,20 +481,21 @@ v4l2_ioctl(dev, VIDIOC_ENUM_FRAMESIZES, &frmsize); - switch(frmsize.type) { + switch (frmsize.type) { case V4L2_FRMSIZE_TYPE_DISCRETE: while (v4l2_ioctl(dev, VIDIOC_ENUM_FRAMESIZES, &frmsize) == 0) { dstr_printf(&buffer, "%dx%d", frmsize.discrete.width, - frmsize.discrete.height); - obs_property_list_add_int(prop, buffer.array, - v4l2_pack_tuple(frmsize.discrete.width, - frmsize.discrete.height)); + frmsize.discrete.height); + obs_property_list_add_int( + prop, buffer.array, + v4l2_pack_tuple(frmsize.discrete.width, + frmsize.discrete.height)); frmsize.index++; } break; default: blog(LOG_INFO, "Stepwise and Continuous framesizes " - "are currently hardcoded"); + "are currently hardcoded"); for (const int *packed = v4l2_framesizes; *packed; ++packed) { int width; @@ -515,7 +514,8 @@ * List framerates for device and resolution */ static void v4l2_framerate_list(int dev, uint_fast32_t pixelformat, - uint_fast32_t width, uint_fast32_t height, obs_property_t *prop) + uint_fast32_t width, uint_fast32_t height, + obs_property_t *prop) { struct v4l2_frmivalenum frmival; frmival.pixel_format = pixelformat; @@ -531,14 +531,15 @@ v4l2_ioctl(dev, VIDIOC_ENUM_FRAMEINTERVALS, &frmival); - switch(frmival.type) { + switch (frmival.type) { case V4L2_FRMIVAL_TYPE_DISCRETE: - while (v4l2_ioctl(dev, VIDIOC_ENUM_FRAMEINTERVALS, - &frmival) == 0) { - float fps = (float) frmival.discrete.denominator / - frmival.discrete.numerator; - int pack = v4l2_pack_tuple(frmival.discrete.numerator, - frmival.discrete.denominator); + while (v4l2_ioctl(dev, VIDIOC_ENUM_FRAMEINTERVALS, &frmival) == + 0) { + float fps = (float)frmival.discrete.denominator / + frmival.discrete.numerator; + int pack = + v4l2_pack_tuple(frmival.discrete.numerator, + frmival.discrete.denominator); dstr_printf(&buffer, "%.2f", fps); obs_property_list_add_int(prop, buffer.array, pack); frmival.index++; @@ -546,13 +547,13 @@ break; default: blog(LOG_INFO, "Stepwise and Continuous framerates " - "are currently hardcoded"); + "are currently hardcoded"); for (const int *packed = v4l2_framerates; *packed; ++packed) { int num; int denom; v4l2_unpack_tuple(&num, &denom, *packed); - float fps = (float) denom / num; + float fps = (float)denom / num; dstr_printf(&buffer, "%.2f", fps); obs_property_list_add_int(prop, buffer.array, *packed); } @@ -566,10 +567,10 @@ * Device selected callback */ static bool device_selected(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { int dev = v4l2_open(obs_data_get_string(settings, "device_id"), - O_RDWR | O_NONBLOCK); + O_RDWR | O_NONBLOCK); v4l2_props_set_enabled(props, p, (dev == -1) ? false : true); @@ -589,11 +590,11 @@ * Input selected callback */ static bool input_selected(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { UNUSED_PARAMETER(p); int dev = v4l2_open(obs_data_get_string(settings, "device_id"), - O_RDWR | O_NONBLOCK); + O_RDWR | O_NONBLOCK); if (dev == -1) return false; @@ -610,35 +611,36 @@ * Format selected callback */ static bool format_selected(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { UNUSED_PARAMETER(p); int dev = v4l2_open(obs_data_get_string(settings, "device_id"), - O_RDWR | O_NONBLOCK); + O_RDWR | O_NONBLOCK); if (dev == -1) return false; - int input = (int) obs_data_get_int(settings, "input"); + int input = (int)obs_data_get_int(settings, "input"); uint32_t caps = 0; if (v4l2_get_input_caps(dev, input, &caps) < 0) return false; caps &= V4L2_IN_CAP_STD | V4L2_IN_CAP_DV_TIMINGS; obs_property_t *resolution = obs_properties_get(props, "resolution"); - obs_property_t *framerate = obs_properties_get(props, "framerate"); - obs_property_t *standard = obs_properties_get(props, "standard"); - obs_property_t *dv_timing = obs_properties_get(props, "dv_timing"); + obs_property_t *framerate = obs_properties_get(props, "framerate"); + obs_property_t *standard = obs_properties_get(props, "standard"); + obs_property_t *dv_timing = obs_properties_get(props, "dv_timing"); obs_property_set_visible(resolution, (!caps) ? true : false); - obs_property_set_visible(framerate, (!caps) ? true : false); + obs_property_set_visible(framerate, (!caps) ? true : false); obs_property_set_visible(standard, - (caps & V4L2_IN_CAP_STD) ? true : false); - obs_property_set_visible(dv_timing, - (caps & V4L2_IN_CAP_DV_TIMINGS) ? true : false); + (caps & V4L2_IN_CAP_STD) ? true : false); + obs_property_set_visible( + dv_timing, (caps & V4L2_IN_CAP_DV_TIMINGS) ? true : false); if (!caps) { - v4l2_resolution_list(dev, obs_data_get_int( - settings, "pixelformat"), resolution); + v4l2_resolution_list(dev, + obs_data_get_int(settings, "pixelformat"), + resolution); } if (caps & V4L2_IN_CAP_STD) v4l2_standard_list(dev, standard); @@ -661,20 +663,20 @@ * Resolution selected callback */ static bool resolution_selected(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { UNUSED_PARAMETER(p); int width, height; int dev = v4l2_open(obs_data_get_string(settings, "device_id"), - O_RDWR | O_NONBLOCK); + O_RDWR | O_NONBLOCK); if (dev == -1) return false; obs_property_t *prop = obs_properties_get(props, "framerate"); - v4l2_unpack_tuple(&width, &height, obs_data_get_int(settings, - "resolution")); + v4l2_unpack_tuple(&width, &height, + obs_data_get_int(settings, "resolution")); v4l2_framerate_list(dev, obs_data_get_int(settings, "pixelformat"), - width, height, prop); + width, height, prop); v4l2_close(dev); obs_property_modified(prop, settings); @@ -735,44 +737,51 @@ obs_properties_t *props = obs_properties_create(); - obs_property_t *device_list = obs_properties_add_list(props, - "device_id", obs_module_text("Device"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_property_t *device_list = obs_properties_add_list( + props, "device_id", obs_module_text("Device"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); - obs_property_t *input_list = obs_properties_add_list(props, - "input", obs_module_text("Input"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *input_list = obs_properties_add_list( + props, "input", obs_module_text("Input"), OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); - obs_property_t *format_list = obs_properties_add_list(props, - "pixelformat", obs_module_text("VideoFormat"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *format_list = obs_properties_add_list( + props, "pixelformat", obs_module_text("VideoFormat"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); - obs_property_t *standard_list = obs_properties_add_list(props, - "standard", obs_module_text("VideoStandard"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *standard_list = obs_properties_add_list( + props, "standard", obs_module_text("VideoStandard"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_set_visible(standard_list, false); - obs_property_t *dv_timing_list = obs_properties_add_list(props, - "dv_timing", obs_module_text("DVTiming"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *dv_timing_list = obs_properties_add_list( + props, "dv_timing", obs_module_text("DVTiming"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_set_visible(dv_timing_list, false); - obs_property_t *resolution_list = obs_properties_add_list(props, - "resolution", obs_module_text("Resolution"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); - - obs_properties_add_list(props, - "framerate", obs_module_text("FrameRate"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); - - obs_property_t *color_range_list = obs_properties_add_list(props, - "color_range", obs_module_text("ColorRange"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); - obs_property_list_add_int(color_range_list, obs_module_text("ColorRange.Partial"), VIDEO_RANGE_PARTIAL); - obs_property_list_add_int(color_range_list, obs_module_text("ColorRange.Full"), VIDEO_RANGE_FULL); - - obs_properties_add_bool(props, - "buffering", obs_module_text("UseBuffering")); + obs_property_t *resolution_list = obs_properties_add_list( + props, "resolution", obs_module_text("Resolution"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + + obs_properties_add_list(props, "framerate", + obs_module_text("FrameRate"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + + obs_property_t *color_range_list = obs_properties_add_list( + props, "color_range", obs_module_text("ColorRange"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_list_add_int(color_range_list, + obs_module_text("ColorRange.Default"), + VIDEO_RANGE_DEFAULT); + obs_property_list_add_int(color_range_list, + obs_module_text("ColorRange.Partial"), + VIDEO_RANGE_PARTIAL); + obs_property_list_add_int(color_range_list, + obs_module_text("ColorRange.Full"), + VIDEO_RANGE_FULL); + + obs_properties_add_bool(props, "buffering", + obs_module_text("UseBuffering")); obs_data_t *settings = obs_source_get_settings(data->source); v4l2_device_list(device_list, settings); @@ -782,7 +791,7 @@ obs_property_set_modified_callback(input_list, input_selected); obs_property_set_modified_callback(format_list, format_selected); obs_property_set_modified_callback(resolution_list, - resolution_selected); + resolution_selected); return props; } @@ -868,7 +877,7 @@ goto fail; } data->resolution = -1; - data->framerate = -1; + data->framerate = -1; } /* set dv timing if supported */ if (input_caps & V4L2_IN_CAP_DV_TIMINGS) { @@ -877,12 +886,12 @@ goto fail; } data->resolution = -1; - data->framerate = -1; + data->framerate = -1; } /* set pixel format and resolution */ if (v4l2_set_format(data->dev, &data->resolution, &data->pixfmt, - &data->linesize) < 0) { + &data->linesize) < 0) { blog(LOG_ERROR, "Unable to set format"); goto fail; } @@ -901,7 +910,7 @@ goto fail; } v4l2_unpack_tuple(&fps_num, &fps_denom, data->framerate); - blog(LOG_INFO, "Framerate: %.2f fps", (float) fps_denom / fps_num); + blog(LOG_INFO, "Framerate: %.2f fps", (float)fps_denom / fps_num); /* map buffers */ if (v4l2_create_mmap(data->dev, &data->buffers) < 0) { @@ -922,10 +931,10 @@ /** Update source flags depending on the settings */ static void v4l2_update_source_flags(struct v4l2_data *data, - obs_data_t *settings) + obs_data_t *settings) { - obs_source_set_async_unbuffered(data->source, - !obs_data_get_bool(settings, "buffering")); + obs_source_set_async_unbuffered( + data->source, !obs_data_get_bool(settings, "buffering")); } /** @@ -945,14 +954,14 @@ if (data->device_id) bfree(data->device_id); - data->device_id = bstrdup(obs_data_get_string(settings, "device_id")); - data->input = obs_data_get_int(settings, "input"); - data->pixfmt = obs_data_get_int(settings, "pixelformat"); - data->standard = obs_data_get_int(settings, "standard"); - data->dv_timing = obs_data_get_int(settings, "dv_timing"); + data->device_id = bstrdup(obs_data_get_string(settings, "device_id")); + data->input = obs_data_get_int(settings, "input"); + data->pixfmt = obs_data_get_int(settings, "pixelformat"); + data->standard = obs_data_get_int(settings, "standard"); + data->dv_timing = obs_data_get_int(settings, "dv_timing"); data->resolution = obs_data_get_int(settings, "resolution"); - data->framerate = obs_data_get_int(settings, "framerate"); - data->color_range = obs_data_get_int(settings, "color_range"); + data->framerate = obs_data_get_int(settings, "framerate"); + data->color_range = obs_data_get_int(settings, "color_range"); v4l2_update_source_flags(data, settings); @@ -987,14 +996,13 @@ } struct obs_source_info v4l2_input = { - .id = "v4l2_input", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_ASYNC_VIDEO | - OBS_SOURCE_DO_NOT_DUPLICATE, - .get_name = v4l2_getname, - .create = v4l2_create, - .destroy = v4l2_destroy, - .update = v4l2_update, - .get_defaults = v4l2_defaults, - .get_properties = v4l2_properties + .id = "v4l2_input", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = v4l2_getname, + .create = v4l2_create, + .destroy = v4l2_destroy, + .update = v4l2_update, + .get_defaults = v4l2_defaults, + .get_properties = v4l2_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/linux-v4l2/v4l2-udev.c -> obs-studio-24.0.0.tar.xz/plugins/linux-v4l2/v4l2-udev.c
Changed
@@ -30,14 +30,12 @@ UDEV_ACTION_UNKNOWN }; -static const char *udev_signals[] = { - "void device_added(string device)", - "void device_removed(string device)", - NULL -}; +static const char *udev_signals[] = {"void device_added(string device)", + "void device_removed(string device)", + NULL}; /* global data */ -static uint_fast32_t udev_refs = 0; +static uint_fast32_t udev_refs = 0; static pthread_mutex_t udev_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_t udev_thread; @@ -77,7 +75,7 @@ pthread_mutex_lock(&udev_mutex); - node = udev_device_get_devnode(dev); + node = udev_device_get_devnode(dev); action = udev_action_to_enum(udev_device_get_action(dev)); calldata_init(&data); @@ -86,12 +84,12 @@ switch (action) { case UDEV_ACTION_ADDED: - signal_handler_signal(udev_signalhandler, - "device_added", &data); + signal_handler_signal(udev_signalhandler, "device_added", + &data); break; case UDEV_ACTION_REMOVED: - signal_handler_signal(udev_signalhandler, - "device_removed", &data); + signal_handler_signal(udev_signalhandler, "device_removed", + &data); break; default: break; @@ -118,9 +116,9 @@ /* set up udev monitoring */ udev = udev_new(); - mon = udev_monitor_new_from_netlink(udev, "udev"); - udev_monitor_filter_add_match_subsystem_devtype( - mon, "video4linux", NULL); + mon = udev_monitor_new_from_netlink(udev, "udev"); + udev_monitor_filter_add_match_subsystem_devtype(mon, "video4linux", + NULL); if (udev_monitor_enable_receiving(mon) < 0) return NULL; @@ -130,7 +128,7 @@ while (os_event_try(udev_event) == EAGAIN) { FD_ZERO(&fds); FD_SET(fd, &fds); - tv.tv_sec = 1; + tv.tv_sec = 1; tv.tv_usec = 0; if (select(fd + 1, &fds, NULL, NULL, &tv) <= 0) @@ -160,14 +158,13 @@ if (os_event_init(&udev_event, OS_EVENT_TYPE_MANUAL) != 0) goto fail; if (pthread_create(&udev_thread, NULL, udev_event_thread, - NULL) != 0) + NULL) != 0) goto fail; udev_signalhandler = signal_handler_create(); if (!udev_signalhandler) goto fail; signal_handler_add_array(udev_signalhandler, udev_signals); - } udev_refs++;
View file
obs-studio-23.2.1.tar.xz/plugins/mac-avcapture/av-capture.mm -> obs-studio-24.0.0.tar.xz/plugins/mac-avcapture/av-capture.mm
Changed
@@ -26,37 +26,29 @@ namespace std { -template <> -struct default_delete<obs_data_t> { - void operator()(obs_data_t *data) - { - obs_data_release(data); - } +template<> struct default_delete<obs_data_t> { + void operator()(obs_data_t *data) { obs_data_release(data); } }; -template <> -struct default_delete<obs_data_item_t> { - void operator()(obs_data_item_t *item) - { - obs_data_item_release(&item); - } +template<> struct default_delete<obs_data_item_t> { + void operator()(obs_data_item_t *item) { obs_data_item_release(&item); } }; } -#define TEXT_AVCAPTURE obs_module_text("AVCapture") -#define TEXT_DEVICE obs_module_text("Device") +#define TEXT_AVCAPTURE obs_module_text("AVCapture") +#define TEXT_DEVICE obs_module_text("Device") #define TEXT_USE_PRESET obs_module_text("UsePreset") -#define TEXT_PRESET obs_module_text("Preset") +#define TEXT_PRESET obs_module_text("Preset") #define TEXT_RESOLUTION obs_module_text("Resolution") #define TEXT_FRAME_RATE obs_module_text("FrameRate") -#define TEXT_MATCH_OBS obs_module_text("MatchOBS") +#define TEXT_MATCH_OBS obs_module_text("MatchOBS") #define TEXT_INPUT_FORMAT obs_module_text("InputFormat") #define TEXT_COLOR_SPACE obs_module_text("ColorSpace") #define TEXT_VIDEO_RANGE obs_module_text("VideoRange") #define TEXT_RANGE_PARTIAL obs_module_text("VideoRange.Partial") #define TEXT_RANGE_FULL obs_module_text("VideoRange.Full") -#define TEXT_AUTO obs_module_text("Auto") +#define TEXT_AUTO obs_module_text("Auto") #define TEXT_COLOR_UNKNOWN_NAME "Unknown" #define TEXT_RANGE_UNKNOWN_NAME "Unknown" @@ -67,53 +59,52 @@ #define MILLI_TIMESCALE 1000 #define MICRO_TIMESCALE (MILLI_TIMESCALE * 1000) -#define NANO_TIMESCALE (MICRO_TIMESCALE * 1000) +#define NANO_TIMESCALE (MICRO_TIMESCALE * 1000) -#define AV_FOURCC_STR(code) \ - (char[5]) { \ - static_cast<char>((code >> 24) & 0xFF), \ - static_cast<char>((code >> 16) & 0xFF), \ - static_cast<char>((code >> 8) & 0xFF), \ - static_cast<char>( code & 0xFF), \ - 0 \ +#define AV_FOURCC_STR(code) \ + (char[5]) \ + { \ + static_cast<char>((code >> 24) & 0xFF), \ + static_cast<char>((code >> 16) & 0xFF), \ + static_cast<char>((code >> 8) & 0xFF), \ + static_cast<char>(code & 0xFF), 0 \ } struct av_capture; -#define AVLOG(level, format, ...) \ - blog(level, "%s: " format, \ - obs_source_get_name(capture->source), ##__VA_ARGS__) +#define AVLOG(level, format, ...) \ + blog(level, "%s: " format, obs_source_get_name(capture->source), \ + ##__VA_ARGS__) -@interface OBSAVCaptureDelegate : - NSObject<AVCaptureVideoDataOutputSampleBufferDelegate> -{ +@interface OBSAVCaptureDelegate + : NSObject <AVCaptureVideoDataOutputSampleBufferDelegate> { @public struct av_capture *capture; } - (void)captureOutput:(AVCaptureOutput *)out - didDropSampleBuffer:(CMSampleBufferRef)sampleBuffer - fromConnection:(AVCaptureConnection *)connection; + didDropSampleBuffer:(CMSampleBufferRef)sampleBuffer + fromConnection:(AVCaptureConnection *)connection; - (void)captureOutput:(AVCaptureOutput *)captureOutput - didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer - fromConnection:(AVCaptureConnection *)connection; + didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer + fromConnection:(AVCaptureConnection *)connection; @end namespace { -static auto remove_observer = [](id observer) -{ +static auto remove_observer = [](id observer) { [[NSNotificationCenter defaultCenter] removeObserver:observer]; }; -struct observer_handle : - unique_ptr<remove_pointer<id>::type, decltype(remove_observer)> { - - using base = unique_ptr<remove_pointer<id>::type, - decltype(remove_observer)>; +struct observer_handle + : unique_ptr<remove_pointer<id>::type, decltype(remove_observer)> { + + using base = + unique_ptr<remove_pointer<id>::type, decltype(remove_observer)>; explicit observer_handle(id observer = nullptr) : base(observer, remove_observer) - {} + { + } }; struct av_video_info { @@ -134,10 +125,10 @@ left_right::left_right<av_video_info> video_info; AVCaptureVideoDataOutput *out; - AVCaptureDevice *device; - AVCaptureDeviceInput *device_input; - AVCaptureSession *session; - + AVCaptureDevice *device; + AVCaptureDeviceInput *device_input; + AVCaptureSession *session; + NSString *uid; observer_handle connect_observer; observer_handle disconnect_observer; @@ -146,7 +137,7 @@ video_format video_format; bool use_preset = false; - int requested_colorspace = COLOR_SPACE_AUTO; + int requested_colorspace = COLOR_SPACE_AUTO; int requested_video_range = VIDEO_RANGE_AUTO; obs_source_t *source; @@ -165,13 +156,16 @@ return [AVCaptureDevice deviceWithUniqueID:uid]; } -template <typename T, typename U> -static void clamp(T& store, U val, T low = numeric_limits<T>::min(), - T high = numeric_limits<T>::max()) +template<typename T, typename U> +static void clamp(T &store, U val, T low = numeric_limits<T>::min(), + T high = numeric_limits<T>::max()) { - store = static_cast<intmax_t>(val) < static_cast<intmax_t>(low) ? low : - (static_cast<intmax_t>(val) > static_cast<intmax_t>(high) ? - high : static_cast<T>(val)); + store = static_cast<intmax_t>(val) < static_cast<intmax_t>(low) + ? low + : (static_cast<intmax_t>(val) > + static_cast<intmax_t>(high) + ? high + : static_cast<T>(val)); } static bool get_resolution(obs_data_t *settings, CMVideoDimensions &dims) @@ -220,9 +214,9 @@ AVCaptureDevice *dev_ = nullptr; bool dims_valid : 1; - bool fr_valid : 1; - bool fps_valid : 1; - bool if_valid : 1; + bool fr_valid : 1; + bool fps_valid : 1; + bool if_valid : 1; CMVideoDimensions dims_{}; @@ -231,25 +225,21 @@ FourCharCode input_format_ = INPUT_FORMAT_AUTO; - explicit config_helper(obs_data_t *settings) - : settings(settings) + explicit config_helper(obs_data_t *settings) : settings(settings) { dev_ = get_device(settings); dims_valid = get_resolution(settings, dims_); - fr_valid = obs_data_get_frames_per_second(settings, - "frame_rate", nullptr, &frame_rate_); - fps_valid = obs_data_get_frames_per_second(settings, - "frame_rate", &fps_, nullptr); + fr_valid = obs_data_get_frames_per_second( + settings, "frame_rate", nullptr, &frame_rate_); + fps_valid = obs_data_get_frames_per_second( + settings, "frame_rate", &fps_, nullptr); if_valid = get_input_format(settings, input_format_); } - AVCaptureDevice *dev() const - { - return dev_; - } + AVCaptureDevice *dev() const { return dev_; } const CMVideoDimensions *dims() const { @@ -287,23 +277,16 @@ capture = capture_; } - operator av_capture *() - { - return capture; - } + operator av_capture *() { return capture; } - av_capture *operator->() - { - return capture; - } + av_capture *operator->() { return capture; } }; struct properties_param { av_capture *capture = nullptr; OBSWeakSource weak_source; - properties_param(av_capture *capture) - : capture(capture) + properties_param(av_capture *capture) : capture(capture) { if (!capture) return; @@ -311,10 +294,7 @@ weak_source = OBSGetWeakRef(capture->source); } - av_capture_ref get_ref() - { - return {capture, weak_source}; - } + av_capture_ref get_ref() { return {capture, weak_source}; } }; } @@ -325,7 +305,7 @@ if (!param) return {}; - return static_cast<properties_param*>(param)->get_ref(); + return static_cast<properties_param *>(param)->get_ref(); } static inline video_format format_from_subtype(FourCharCode subtype) @@ -351,8 +331,9 @@ static const char *fourcc_subtype_name(FourCharCode fourcc); -static const char *format_description_subtype_name(CMFormatDescriptionRef desc, - FourCharCode *fourcc_=nullptr) +static const char * +format_description_subtype_name(CMFormatDescriptionRef desc, + FourCharCode *fourcc_ = nullptr) { FourCharCode fourcc = CMFormatDescriptionGetMediaSubType(desc); if (fourcc_) @@ -376,17 +357,28 @@ case kCVPixelFormatType_32BGRA: return "BGRA - 32BGRA"; //VIDEO_FORMAT_BGRA; - case kCMVideoCodecType_Animation: return "Apple Animation"; - case kCMVideoCodecType_Cinepak: return "Cinepak"; - case kCMVideoCodecType_JPEG: return "JPEG"; - case kCMVideoCodecType_JPEG_OpenDML: return "MJPEG - JPEG OpenDML"; - case kCMVideoCodecType_SorensonVideo: return "Sorenson Video"; - case kCMVideoCodecType_SorensonVideo3: return "Sorenson Video 3"; - case kCMVideoCodecType_H263: return "H.263"; - case kCMVideoCodecType_H264: return "H.264"; - case kCMVideoCodecType_MPEG4Video: return "MPEG-4"; - case kCMVideoCodecType_MPEG2Video: return "MPEG-2"; - case kCMVideoCodecType_MPEG1Video: return "MPEG-1"; + case kCMVideoCodecType_Animation: + return "Apple Animation"; + case kCMVideoCodecType_Cinepak: + return "Cinepak"; + case kCMVideoCodecType_JPEG: + return "JPEG"; + case kCMVideoCodecType_JPEG_OpenDML: + return "MJPEG - JPEG OpenDML"; + case kCMVideoCodecType_SorensonVideo: + return "Sorenson Video"; + case kCMVideoCodecType_SorensonVideo3: + return "Sorenson Video 3"; + case kCMVideoCodecType_H263: + return "H.263"; + case kCMVideoCodecType_H264: + return "H.264"; + case kCMVideoCodecType_MPEG4Video: + return "MPEG-4"; + case kCMVideoCodecType_MPEG2Video: + return "MPEG-2"; + case kCMVideoCodecType_MPEG1Video: + return "MPEG-1"; case kCMVideoCodecType_DVCNTSC: return "DV NTSC"; @@ -443,39 +435,40 @@ static inline video_colorspace get_colorspace(CMFormatDescriptionRef desc) { - CFPropertyListRef matrix = CMFormatDescriptionGetExtension(desc, - kCMFormatDescriptionExtension_YCbCrMatrix); + CFPropertyListRef matrix = CMFormatDescriptionGetExtension( + desc, kCMFormatDescriptionExtension_YCbCrMatrix); if (!matrix) return VIDEO_CS_DEFAULT; if (CFStringCompare(static_cast<CFStringRef>(matrix), - kCVImageBufferYCbCrMatrix_ITU_R_709_2, 0) - == kCFCompareEqualTo) + kCVImageBufferYCbCrMatrix_ITU_R_709_2, + 0) == kCFCompareEqualTo) return VIDEO_CS_709; return VIDEO_CS_601; } static inline bool update_colorspace(av_capture *capture, - obs_source_frame *frame, CMFormatDescriptionRef desc, - bool full_range, av_video_info &vi) + obs_source_frame *frame, + CMFormatDescriptionRef desc, + bool full_range, av_video_info &vi) { auto cs_auto = capture->use_preset || - capture->requested_colorspace == COLOR_SPACE_AUTO; + capture->requested_colorspace == COLOR_SPACE_AUTO; auto vr_auto = capture->use_preset || - capture->requested_video_range == VIDEO_RANGE_AUTO; + capture->requested_video_range == VIDEO_RANGE_AUTO; video_colorspace colorspace = get_colorspace(desc); - video_range_type range = full_range ? - VIDEO_RANGE_FULL : VIDEO_RANGE_PARTIAL; + video_range_type range = full_range ? VIDEO_RANGE_FULL + : VIDEO_RANGE_PARTIAL; bool cs_matches = false; if (cs_auto) { cs_matches = colorspace == vi.colorspace; } else { colorspace = static_cast<video_colorspace>( - capture->requested_colorspace); + capture->requested_colorspace); cs_matches = colorspace == vi.colorspace; } @@ -484,43 +477,41 @@ vr_matches = range == vi.video_range; } else { range = static_cast<video_range_type>( - capture->requested_video_range); + capture->requested_video_range); vr_matches = range == vi.video_range; full_range = range == VIDEO_RANGE_FULL; } if (cs_matches && vr_matches) { if (!vi.video_params_valid) - capture->video_info.update([&](av_video_info &vi_) - { - vi_.video_params_valid = - vi.video_params_valid = true; + capture->video_info.update([&](av_video_info &vi_) { + vi_.video_params_valid = vi.video_params_valid = + true; }); return true; } frame->full_range = full_range; - if (!video_format_get_parameters(colorspace, range, - frame->color_matrix, - frame->color_range_min, - frame->color_range_max)) { - AVLOG(LOG_ERROR, "Failed to get colorspace parameters for " - "colorspace %u range %u", colorspace, range); + if (!video_format_get_parameters(colorspace, range, frame->color_matrix, + frame->color_range_min, + frame->color_range_max)) { + AVLOG(LOG_ERROR, + "Failed to get colorspace parameters for " + "colorspace %u range %u", + colorspace, range); if (vi.video_params_valid) - capture->video_info.update([&](av_video_info &vi_) - { - vi_.video_params_valid = - vi.video_params_valid = false; + capture->video_info.update([&](av_video_info &vi_) { + vi_.video_params_valid = vi.video_params_valid = + false; }); return false; } - capture->video_info.update([&](av_video_info &vi_) - { - vi_.colorspace = colorspace; + capture->video_info.update([&](av_video_info &vi_) { + vi_.colorspace = colorspace; vi_.video_range = range; vi_.video_params_valid = vi.video_params_valid = true; }); @@ -528,17 +519,17 @@ return true; } -static inline bool update_frame(av_capture *capture, - obs_source_frame *frame, CMSampleBufferRef sample_buffer) +static inline bool update_frame(av_capture *capture, obs_source_frame *frame, + CMSampleBufferRef sample_buffer) { CMFormatDescriptionRef desc = CMSampleBufferGetFormatDescription(sample_buffer); - FourCharCode fourcc = CMFormatDescriptionGetMediaSubType(desc); - video_format format = format_from_subtype(fourcc); + FourCharCode fourcc = CMFormatDescriptionGetMediaSubType(desc); + video_format format = format_from_subtype(fourcc); CMVideoDimensions dims = CMVideoFormatDescriptionGetDimensions(desc); - CVImageBufferRef img = CMSampleBufferGetImageBuffer(sample_buffer); + CVImageBufferRef img = CMSampleBufferGetImageBuffer(sample_buffer); auto vi = capture->video_info.read(); @@ -555,32 +546,32 @@ capture->fourcc = fourcc; AVLOG(LOG_ERROR, "Unhandled fourcc: %s (0x%x) (%zu planes)", - AV_FOURCC_STR(fourcc), fourcc, - CVPixelBufferGetPlaneCount(img)); + AV_FOURCC_STR(fourcc), fourcc, + CVPixelBufferGetPlaneCount(img)); return false; } if (frame->format != format) - AVLOG(LOG_DEBUG, "Switching fourcc: " - "'%s' (0x%x) -> '%s' (0x%x)", - AV_FOURCC_STR(capture->fourcc), capture->fourcc, - AV_FOURCC_STR(fourcc), fourcc); + AVLOG(LOG_DEBUG, + "Switching fourcc: " + "'%s' (0x%x) -> '%s' (0x%x)", + AV_FOURCC_STR(capture->fourcc), capture->fourcc, + AV_FOURCC_STR(fourcc), fourcc); bool was_yuv = format_is_yuv(frame->format); capture->fourcc = fourcc; - frame->format = format; - frame->width = dims.width; - frame->height = dims.height; + frame->format = format; + frame->width = dims.width; + frame->height = dims.height; - if (format_is_yuv(format) && !update_colorspace(capture, frame, desc, - is_fullrange_yuv(fourcc), vi)) { + if (format_is_yuv(format) && + !update_colorspace(capture, frame, desc, is_fullrange_yuv(fourcc), + vi)) { return false; } else if (was_yuv == format_is_yuv(format)) { - capture->video_info.update([&](av_video_info &vi_) - { - vi_.video_params_valid = - vi.video_params_valid = true; + capture->video_info.update([&](av_video_info &vi_) { + vi_.video_params_valid = vi.video_params_valid = true; }); } @@ -588,24 +579,24 @@ if (!CVPixelBufferIsPlanar(img)) { frame->linesize[0] = CVPixelBufferGetBytesPerRow(img); - frame->data[0] = static_cast<uint8_t*>( - CVPixelBufferGetBaseAddress(img)); + frame->data[0] = static_cast<uint8_t *>( + CVPixelBufferGetBaseAddress(img)); return true; } size_t count = CVPixelBufferGetPlaneCount(img); for (size_t i = 0; i < count; i++) { frame->linesize[i] = CVPixelBufferGetBytesPerRowOfPlane(img, i); - frame->data[i] = static_cast<uint8_t*>( - CVPixelBufferGetBaseAddressOfPlane(img, i)); + frame->data[i] = static_cast<uint8_t *>( + CVPixelBufferGetBaseAddressOfPlane(img, i)); } return true; } @implementation OBSAVCaptureDelegate - (void)captureOutput:(AVCaptureOutput *)out - didDropSampleBuffer:(CMSampleBufferRef)sampleBuffer - fromConnection:(AVCaptureConnection *)connection + didDropSampleBuffer:(CMSampleBufferRef)sampleBuffer + fromConnection:(AVCaptureConnection *)connection { UNUSED_PARAMETER(out); UNUSED_PARAMETER(sampleBuffer); @@ -613,8 +604,8 @@ } - (void)captureOutput:(AVCaptureOutput *)captureOutput - didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer - fromConnection:(AVCaptureConnection *)connection + didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer + fromConnection:(AVCaptureConnection *)connection { UNUSED_PARAMETER(captureOutput); UNUSED_PARAMETER(connection); @@ -627,8 +618,8 @@ CMTime target_pts = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer); - CMTime target_pts_nano = CMTimeConvertScale(target_pts, NANO_TIMESCALE, - kCMTimeRoundingMethod_Default); + CMTime target_pts_nano = CMTimeConvertScale( + target_pts, NANO_TIMESCALE, kCMTimeRoundingMethod_Default); frame->timestamp = target_pts_nano.value; if (!update_frame(capture, frame, sampleBuffer)) { @@ -648,12 +639,12 @@ obs_source_set_async_unbuffered(capture->source, !enabled); } -static const char *av_capture_getname(void*) +static const char *av_capture_getname(void *) { return TEXT_AVCAPTURE; } -static void unlock_device(av_capture *capture, AVCaptureDevice *dev=nullptr) +static void unlock_device(av_capture *capture, AVCaptureDevice *dev = nullptr) { if (!dev) dev = capture->device; @@ -692,7 +683,7 @@ static void av_capture_destroy(void *data) { - auto capture = static_cast<av_capture*>(data); + auto capture = static_cast<av_capture *>(data); delete capture; } @@ -731,9 +722,8 @@ capture->queue = queue; [capture->session addOutput:capture->out]; - [capture->out - setSampleBufferDelegate:capture->delegate - queue:capture->queue]; + [capture->out setSampleBufferDelegate:capture->delegate + queue:capture->queue]; return true; } @@ -743,11 +733,11 @@ static bool init_device_input(av_capture *capture, AVCaptureDevice *dev) { NSError *err = nil; - AVCaptureDeviceInput *device_input = [AVCaptureDeviceInput - deviceInputWithDevice:dev error:&err]; + AVCaptureDeviceInput *device_input = + [AVCaptureDeviceInput deviceInputWithDevice:dev error:&err]; if (!device_input) { AVLOG(LOG_ERROR, "Error while initializing device input: %s", - err.localizedFailureReason.UTF8String); + err.localizedFailureReason.UTF8String); return false; } @@ -765,38 +755,38 @@ static uint32_t uint_from_dict(NSDictionary *dict, CFStringRef key) { - return ((NSNumber*)dict[(__bridge NSString*)key]).unsignedIntValue; + return ((NSNumber *)dict[(__bridge NSString *)key]).unsignedIntValue; } static bool init_format(av_capture *capture, AVCaptureDevice *dev) { AVCaptureDeviceFormat *format = dev.activeFormat; - CMMediaType mtype = CMFormatDescriptionGetMediaType( - format.formatDescription); + CMMediaType mtype = + CMFormatDescriptionGetMediaType(format.formatDescription); // TODO: support other media types if (mtype != kCMMediaType_Video && mtype != kCMMediaType_Muxed) { AVLOG(LOG_ERROR, "CMMediaType '%s' is unsupported", - AV_FOURCC_STR(mtype)); + AV_FOURCC_STR(mtype)); return false; } capture->out.videoSettings = nil; FourCharCode subtype = uint_from_dict(capture->out.videoSettings, - kCVPixelBufferPixelFormatTypeKey); + kCVPixelBufferPixelFormatTypeKey); if (format_from_subtype(subtype) != VIDEO_FORMAT_NONE) { AVLOG(LOG_DEBUG, "Using native fourcc '%s'", - AV_FOURCC_STR(subtype)); + AV_FOURCC_STR(subtype)); return true; } AVLOG(LOG_DEBUG, "Using fallback fourcc '%s' ('%s' 0x%08x unsupported)", - AV_FOURCC_STR(kCVPixelFormatType_32BGRA), - AV_FOURCC_STR(subtype), subtype); + AV_FOURCC_STR(kCVPixelFormatType_32BGRA), AV_FOURCC_STR(subtype), + subtype); capture->out.videoSettings = @{ - (__bridge NSString*)kCVPixelBufferPixelFormatTypeKey: - @(kCVPixelFormatType_32BGRA) + (__bridge NSString *) + kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA) }; return true; } @@ -824,7 +814,7 @@ } static bool init_preset(av_capture *capture, AVCaptureDevice *dev, - obs_data_t *settings) + obs_data_t *settings) { clear_capture(capture); @@ -833,19 +823,18 @@ NSString *preset = get_string(settings, "preset"); if (![dev supportsAVCaptureSessionPreset:preset]) { AVLOG(LOG_WARNING, "Preset %s not available", - preset_names(preset).UTF8String); + preset_names(preset).UTF8String); preset = select_preset(dev, preset); } if (!preset) { AVLOG(LOG_WARNING, "Could not select a preset, " - "initialization failed"); + "initialization failed"); return false; } capture->session.sessionPreset = preset; - AVLOG(LOG_INFO, "Using preset %s", - preset_names(preset).UTF8String); + AVLOG(LOG_INFO, "Using preset %s", preset_names(preset).UTF8String); return true; } @@ -854,7 +843,7 @@ static CMVideoDimensions get_dimensions(AVCaptureDeviceFormat *format); static AVCaptureDeviceFormat *find_format(AVCaptureDevice *dev, - CMVideoDimensions dims) + CMVideoDimensions dims) { for (AVCaptureDeviceFormat *format in dev.formats) { if (get_dimensions(format) == dims) @@ -880,8 +869,10 @@ NSError *err; if (![dev lockForConfiguration:&err]) { - AVLOG(LOG_WARNING, "Could not lock device for configuration: " - "%s", err.localizedDescription.UTF8String); + AVLOG(LOG_WARNING, + "Could not lock device for configuration: " + "%s", + err.localizedDescription.UTF8String); return false; } @@ -889,9 +880,9 @@ return true; } -template <typename Func> +template<typename Func> static void find_formats(media_frames_per_second fps, AVCaptureDevice *dev, - const CMVideoDimensions *dims, Func &&f) + const CMVideoDimensions *dims, Func &&f) { auto time = convert(fps); @@ -899,11 +890,10 @@ if (!(get_dimensions(format) == *dims)) continue; - for (AVFrameRateRange *range in - format.videoSupportedFrameRateRanges) { + for (AVFrameRateRange *range in format + .videoSupportedFrameRateRanges) { if (CMTimeCompare(range.maxFrameDuration, time) >= 0 && - CMTimeCompare(range.minFrameDuration, - time) <= 0) + CMTimeCompare(range.minFrameDuration, time) <= 0) if (f(format)) return; } @@ -926,10 +916,14 @@ static const char *color_space_name(int color_space) { switch (color_space) { - case COLOR_SPACE_AUTO: return "Auto"; - case VIDEO_CS_DEFAULT: return "Default"; - case VIDEO_CS_601: return "CS 601"; - case VIDEO_CS_709: return "CS 709"; + case COLOR_SPACE_AUTO: + return "Auto"; + case VIDEO_CS_DEFAULT: + return "Default"; + case VIDEO_CS_601: + return "CS 601"; + case VIDEO_CS_709: + return "CS 709"; } return "Unknown"; @@ -951,17 +945,21 @@ static const char *video_range_name(int video_range) { switch (video_range) { - case VIDEO_RANGE_AUTO: return "Auto"; - case VIDEO_RANGE_DEFAULT: return "Default"; - case VIDEO_RANGE_PARTIAL: return "Partial"; - case VIDEO_RANGE_FULL: return "Full"; + case VIDEO_RANGE_AUTO: + return "Auto"; + case VIDEO_RANGE_DEFAULT: + return "Default"; + case VIDEO_RANGE_PARTIAL: + return "Partial"; + case VIDEO_RANGE_FULL: + return "Full"; } return "Unknown"; } static bool init_manual(av_capture *capture, AVCaptureDevice *dev, - obs_data_t *settings) + obs_data_t *settings) { clear_capture(capture); @@ -973,14 +971,15 @@ bool refresh = false; if (input_format != actual_format) { refresh = obs_data_get_autoselect_int(settings, - "input_format") != actual_format; + "input_format") != + actual_format; obs_data_set_autoselect_int(settings, "input_format", - actual_format); + actual_format); } else { refresh = obs_data_has_autoselect_value(settings, - "input_format"); + "input_format"); obs_data_unset_autoselect_value(settings, - "input_format"); + "input_format"); } if (refresh) @@ -991,7 +990,7 @@ obs_data_get_int(settings, "color_space"); if (!color_space_valid(capture->requested_colorspace)) { AVLOG(LOG_WARNING, "Unsupported color space: %d", - capture->requested_colorspace); + capture->requested_colorspace); return false; } @@ -999,7 +998,7 @@ obs_data_get_int(settings, "video_range"); if (!video_range_valid(capture->requested_video_range)) { AVLOG(LOG_WARNING, "Unsupported color range: %d", - capture->requested_video_range); + capture->requested_video_range); return false; } @@ -1011,14 +1010,13 @@ media_frames_per_second fps{}; if (!obs_data_get_frames_per_second(settings, "frame_rate", &fps, - nullptr)) { + nullptr)) { AVLOG(LOG_WARNING, "Could not load frame rate"); return false; } AVCaptureDeviceFormat *format = nullptr; - find_formats(fps, dev, &dims, [&](AVCaptureDeviceFormat *format_) - { + find_formats(fps, dev, &dims, [&](AVCaptureDeviceFormat *format_) { auto desc = format_.formatDescription; auto fourcc = CMFormatDescriptionGetMediaSubType(desc); if (input_format != INPUT_FORMAT_AUTO && fourcc != input_format) @@ -1030,57 +1028,55 @@ }); if (!format) { - AVLOG(LOG_WARNING, "Frame rate is not supported: %g FPS " - "(%u/%u)", - media_frames_per_second_to_fps(fps), - fps.numerator, fps.denominator); + AVLOG(LOG_WARNING, + "Frame rate is not supported: %g FPS " + "(%u/%u)", + media_frames_per_second_to_fps(fps), fps.numerator, + fps.denominator); return false; } if (!lock_device(capture, dev)) return false; - const char *if_name = input_format == INPUT_FORMAT_AUTO ? - "Auto" : fourcc_subtype_name(input_format); + const char *if_name = input_format == INPUT_FORMAT_AUTO + ? "Auto" + : fourcc_subtype_name(input_format); #define IF_AUTO(x) (input_format != INPUT_FORMAT_AUTO ? "" : x) - AVLOG(LOG_INFO, "Capturing '%s' (%s):\n" - " Resolution: %ux%u\n" - " FPS: %g (%" PRIu32 "/%" PRIu32 ")\n" - " Frame interval: %g" NBSP "s\n" - " Input format: %s%s%s (%s)%s\n" - " Requested color space: %s (%d)\n" - " Requested video range: %s (%d)\n" - " Using format: %s", - dev.localizedName.UTF8String, dev.uniqueID.UTF8String, - dims.width, dims.height, - media_frames_per_second_to_fps(fps), - fps.numerator, fps.denominator, - media_frames_per_second_to_frame_interval(fps), - if_name, IF_AUTO(" (actual: "), - IF_AUTO(fourcc_subtype_name(actual_format)), - AV_FOURCC_STR(actual_format), IF_AUTO(")"), - color_space_name(capture->requested_colorspace), - capture->requested_colorspace, - video_range_name(capture->requested_video_range), - capture->requested_video_range, - format.description.UTF8String); + AVLOG(LOG_INFO, + "Capturing '%s' (%s):\n" + " Resolution: %ux%u\n" + " FPS: %g (%" PRIu32 "/%" PRIu32 ")\n" + " Frame interval: %g" NBSP "s\n" + " Input format: %s%s%s (%s)%s\n" + " Requested color space: %s (%d)\n" + " Requested video range: %s (%d)\n" + " Using format: %s", + dev.localizedName.UTF8String, dev.uniqueID.UTF8String, dims.width, + dims.height, media_frames_per_second_to_fps(fps), fps.numerator, + fps.denominator, media_frames_per_second_to_frame_interval(fps), + if_name, IF_AUTO(" (actual: "), + IF_AUTO(fourcc_subtype_name(actual_format)), + AV_FOURCC_STR(actual_format), IF_AUTO(")"), + color_space_name(capture->requested_colorspace), + capture->requested_colorspace, + video_range_name(capture->requested_video_range), + capture->requested_video_range, format.description.UTF8String); #undef IF_AUTO dev.activeFormat = format; dev.activeVideoMinFrameDuration = convert(fps); dev.activeVideoMaxFrameDuration = convert(fps); - capture->video_info.update([&](av_video_info &vi) - { - vi.video_params_valid = false; - }); + capture->video_info.update( + [&](av_video_info &vi) { vi.video_params_valid = false; }); return true; } static void capture_device(av_capture *capture, AVCaptureDevice *dev, - obs_data_t *settings) + obs_data_t *settings) { const char *name = dev.localizedName.UTF8String; obs_data_set_string(settings, "device_name", name); @@ -1108,25 +1104,24 @@ } static inline void handle_disconnect_capture(av_capture *capture, - AVCaptureDevice *dev) + AVCaptureDevice *dev) { if (![dev.uniqueID isEqualTo:capture->uid]) return; if (!capture->device) { AVLOG(LOG_INFO, "Received disconnect for inactive device '%s'", - capture->uid.UTF8String); + capture->uid.UTF8String); return; } AVLOG(LOG_WARNING, "Device with unique ID '%s' disconnected", - dev.uniqueID.UTF8String); + dev.uniqueID.UTF8String); remove_device(capture); } -static inline void handle_disconnect(av_capture *capture, - AVCaptureDevice *dev) +static inline void handle_disconnect(av_capture *capture, AVCaptureDevice *dev) { if (!dev) return; @@ -1136,25 +1131,28 @@ } static inline void handle_connect_capture(av_capture *capture, - AVCaptureDevice *dev, obs_data_t *settings) + AVCaptureDevice *dev, + obs_data_t *settings) { if (![dev.uniqueID isEqualTo:capture->uid]) return; if (capture->device) { AVLOG(LOG_ERROR, "Received connect for in-use device '%s'", - capture->uid.UTF8String); + capture->uid.UTF8String); return; } - AVLOG(LOG_INFO, "Device with unique ID '%s' connected, " - "resuming capture", dev.uniqueID.UTF8String); + AVLOG(LOG_INFO, + "Device with unique ID '%s' connected, " + "resuming capture", + dev.uniqueID.UTF8String); capture_device(capture, dev, settings); } -static inline void handle_connect(av_capture *capture, - AVCaptureDevice *dev, obs_data_t *settings) +static inline void handle_connect(av_capture *capture, AVCaptureDevice *dev, + obs_data_t *settings) { if (!dev) return; @@ -1175,21 +1173,17 @@ addObserverForName:AVCaptureDeviceWasDisconnectedNotification object:nil queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification *note) - { + usingBlock:^(NSNotification *note) { handle_disconnect(capture, note.object); - } - ]); + }]); capture->connect_observer.reset([nc addObserverForName:AVCaptureDeviceWasConnectedNotification object:nil queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification *note) - { + usingBlock:^(NSNotification *note) { handle_connect(capture, note.object, settings); - } - ]); + }]); AVCaptureDevice *dev = [AVCaptureDevice deviceWithUniqueID:capture->uid]; @@ -1198,9 +1192,10 @@ if (capture->uid.length < 1) AVLOG(LOG_INFO, "No device selected"); else - AVLOG(LOG_WARNING, "Could not initialize device " \ - "with unique ID '%s'", - capture->uid.UTF8String); + AVLOG(LOG_WARNING, + "Could not initialize device " + "with unique ID '%s'", + capture->uid.UTF8String); return true; } @@ -1227,7 +1222,7 @@ } av_capture_enable_buffering(capture.get(), - obs_data_get_bool(settings, "buffering")); + obs_data_get_bool(settings, "buffering")); return capture.release(); } @@ -1237,12 +1232,9 @@ return @[ //AVCaptureSessionPresetiFrame1280x720, //AVCaptureSessionPresetiFrame960x540, - AVCaptureSessionPreset1280x720, - AVCaptureSessionPreset960x540, - AVCaptureSessionPreset640x480, - AVCaptureSessionPreset352x288, - AVCaptureSessionPreset320x240, - AVCaptureSessionPresetHigh, + AVCaptureSessionPreset1280x720, AVCaptureSessionPreset960x540, + AVCaptureSessionPreset640x480, AVCaptureSessionPreset352x288, + AVCaptureSessionPreset320x240, AVCaptureSessionPresetHigh, //AVCaptureSessionPresetMedium, //AVCaptureSessionPresetLow, //AVCaptureSessionPresetPhoto, @@ -1252,15 +1244,15 @@ static NSString *preset_names(NSString *preset) { NSDictionary *preset_names = @{ - AVCaptureSessionPresetLow:@"Low", - AVCaptureSessionPresetMedium:@"Medium", - AVCaptureSessionPresetHigh:@"High", - AVCaptureSessionPreset320x240:@"320x240", - AVCaptureSessionPreset352x288:@"352x288", - AVCaptureSessionPreset640x480:@"640x480", - AVCaptureSessionPreset960x540:@"960x540", - AVCaptureSessionPreset1280x720:@"1280x720", - AVCaptureSessionPresetHigh:@"High", + AVCaptureSessionPresetLow: @"Low", + AVCaptureSessionPresetMedium: @"Medium", + AVCaptureSessionPresetHigh: @"High", + AVCaptureSessionPreset320x240: @"320x240", + AVCaptureSessionPreset352x288: @"352x288", + AVCaptureSessionPreset640x480: @"640x480", + AVCaptureSessionPreset960x540: @"960x540", + AVCaptureSessionPreset1280x720: @"1280x720", + AVCaptureSessionPresetHigh: @"High", }; NSString *name = preset_names[preset]; if (name) @@ -1268,31 +1260,30 @@ return [NSString stringWithFormat:@"Unknown (%@)", preset]; } - static void av_capture_defaults(obs_data_t *settings) { obs_data_set_default_string(settings, "uid", ""); obs_data_set_default_bool(settings, "use_preset", true); obs_data_set_default_string(settings, "preset", - AVCaptureSessionPreset1280x720.UTF8String); + AVCaptureSessionPreset1280x720.UTF8String); obs_data_set_default_int(settings, "input_format", INPUT_FORMAT_AUTO); obs_data_set_default_int(settings, "color_space", COLOR_SPACE_AUTO); obs_data_set_default_int(settings, "video_range", VIDEO_RANGE_AUTO); } -static bool update_device_list(obs_property_t *list, - NSString *uid, NSString *name, bool disconnected) +static bool update_device_list(obs_property_t *list, NSString *uid, + NSString *name, bool disconnected) { - bool dev_found = false; + bool dev_found = false; bool list_modified = false; size_t size = obs_property_list_item_count(list); for (size_t i = 0; i < size;) { const char *uid_ = obs_property_list_item_string(list, i); - bool found = [uid isEqualToString:@(uid_ ? uid_ : "")]; - bool disabled = obs_property_list_item_disabled(list, i); + bool found = [uid isEqualToString:@(uid_ ? uid_ : "")]; + bool disabled = obs_property_list_item_disabled(list, i); if (!found && !disabled) { i += 1; continue; @@ -1303,7 +1294,7 @@ obs_property_list_item_remove(list, i); continue; } - + if (disabled != disconnected) list_modified = true; @@ -1316,22 +1307,22 @@ return list_modified; size_t idx = obs_property_list_add_string(list, name.UTF8String, - uid.UTF8String); + uid.UTF8String); obs_property_list_item_disable(list, idx, disconnected); return true; } static void fill_presets(AVCaptureDevice *dev, obs_property_t *list, - NSString *current_preset) + NSString *current_preset) { obs_property_list_clear(list); bool preset_found = false; for (NSString *preset in presets()) { bool is_current = [preset isEqualToString:current_preset]; - bool supported = dev && - [dev supportsAVCaptureSessionPreset:preset]; + bool supported = dev && + [dev supportsAVCaptureSessionPreset:preset]; if (is_current) preset_found = true; @@ -1339,23 +1330,23 @@ if (!supported && !is_current) continue; - size_t idx = obs_property_list_add_string(list, - preset_names(preset).UTF8String, - preset.UTF8String); + size_t idx = obs_property_list_add_string( + list, preset_names(preset).UTF8String, + preset.UTF8String); obs_property_list_item_disable(list, idx, !supported); } if (preset_found) return; - size_t idx = obs_property_list_add_string(list, - preset_names(current_preset).UTF8String, - current_preset.UTF8String); + size_t idx = obs_property_list_add_string( + list, preset_names(current_preset).UTF8String, + current_preset.UTF8String); obs_property_list_item_disable(list, idx, true); } -static bool check_preset(AVCaptureDevice *dev, - obs_property_t *list, obs_data_t *settings) +static bool check_preset(AVCaptureDevice *dev, obs_property_t *list, + obs_data_t *settings) { NSString *current_preset = get_string(settings, "preset"); @@ -1368,8 +1359,8 @@ bool presets_changed = false; for (NSString *preset in presets()) { bool is_listed = [listed member:preset] != nil; - bool supported = dev && - [dev supportsAVCaptureSessionPreset:preset]; + bool supported = dev && + [dev supportsAVCaptureSessionPreset:preset]; if (supported == is_listed) continue; @@ -1399,7 +1390,7 @@ obs_data_get_autoselect_string(settings, "preset"); if (![preset isEqualToString:@(autoselect)]) { obs_data_set_autoselect_string(settings, "preset", - preset.UTF8String); + preset.UTF8String); return true; } } @@ -1436,8 +1427,7 @@ static void sort_resolutions(vector<CMVideoDimensions> &resolutions) { - auto cmp = [](const CMVideoDimensions &a, const CMVideoDimensions &b) - { + auto cmp = [](const CMVideoDimensions &a, const CMVideoDimensions &b) { return a.width * a.height > b.width * b.height; }; @@ -1446,18 +1436,18 @@ static void data_set_resolution(obs_data_t *data, const CMVideoDimensions &dims) { - obs_data_set_int(data, "width", dims.width); + obs_data_set_int(data, "width", dims.width); obs_data_set_int(data, "height", dims.height); } static void data_set_resolution(const unique_ptr<obs_data_t> &data, - const CMVideoDimensions &dims) + const CMVideoDimensions &dims) { data_set_resolution(data.get(), dims); } static bool add_resolution_to_list(vector<CMVideoDimensions> &res, - const CMVideoDimensions &dims) + const CMVideoDimensions &dims) { if (find(begin(res), end(res), dims) != end(res)) return false; @@ -1477,7 +1467,7 @@ } static bool resolution_property_needs_update(obs_property_t *p, - const resolutions_t &resolutions) + const resolutions_t &resolutions) { vector<bool> res_found(resolutions.size()); @@ -1498,11 +1488,12 @@ } return any_of(begin(res_found), end(res_found), - [](bool b) { return !b; }); + [](bool b) { return !b; }); } static bool update_resolution_property(obs_properties_t *props, - const config_helper &conf, obs_property_t *p=nullptr) + const config_helper &conf, + obs_property_t *p = nullptr) { if (!p) p = obs_properties_get(props, "resolution"); @@ -1546,23 +1537,23 @@ static media_frames_per_second convert(CMTime time_) { media_frames_per_second res{}; - clamp(res.numerator, time_.timescale); + clamp(res.numerator, time_.timescale); clamp(res.denominator, time_.value); return res; } -using frame_rates_t = vector<pair<media_frames_per_second, - media_frames_per_second>>; -static frame_rates_t enumerate_frame_rates(AVCaptureDevice *dev, - const CMVideoDimensions *dims = nullptr) +using frame_rates_t = + vector<pair<media_frames_per_second, media_frames_per_second>>; +static frame_rates_t +enumerate_frame_rates(AVCaptureDevice *dev, + const CMVideoDimensions *dims = nullptr) { frame_rates_t res; if (!dev || !dims) return res; - auto add_unique_frame_rate_range = [&](AVFrameRateRange *range) - { + auto add_unique_frame_rate_range = [&](AVFrameRateRange *range) { auto min = convert(range.maxFrameDuration); auto max = convert(range.minFrameDuration); @@ -1578,22 +1569,21 @@ if (!(get_dimensions(format) == *dims)) continue; - for (AVFrameRateRange *range in - format.videoSupportedFrameRateRanges) { + for (AVFrameRateRange *range in format + .videoSupportedFrameRateRanges) { add_unique_frame_rate_range(range); if (CMTimeCompare(range.minFrameDuration, - range.maxFrameDuration) != 0) { - blog(LOG_WARNING, "Got actual frame rate range:" - " %g - %g " - "({%lld, %d} - {%lld, %d})", - range.minFrameRate, - range.maxFrameRate, - range.maxFrameDuration.value, - range.maxFrameDuration.timescale, - range.minFrameDuration.value, - range.minFrameDuration.timescale - ); + range.maxFrameDuration) != 0) { + blog(LOG_WARNING, + "Got actual frame rate range:" + " %g - %g " + "({%lld, %d} - {%lld, %d})", + range.minFrameRate, range.maxFrameRate, + range.maxFrameDuration.value, + range.maxFrameDuration.timescale, + range.minFrameDuration.value, + range.minFrameDuration.timescale); } } } @@ -1602,19 +1592,19 @@ } static bool operator==(const media_frames_per_second &a, - const media_frames_per_second &b) + const media_frames_per_second &b) { return a.numerator == b.numerator && a.denominator == b.denominator; } static bool operator!=(const media_frames_per_second &a, - const media_frames_per_second &b) + const media_frames_per_second &b) { return !(a == b); } static bool frame_rate_property_needs_update(obs_property_t *p, - const frame_rates_t &frame_rates) + const frame_rates_t &frame_rates) { auto fps_num = frame_rates.size(); auto num = obs_property_frame_rate_fps_ranges_count(p); @@ -1627,7 +1617,7 @@ auto max_ = obs_property_frame_rate_fps_range_max(p, i); auto it = find(begin(frame_rates), end(frame_rates), - make_pair(min_, max_)); + make_pair(min_, max_)); if (it == end(frame_rates)) return true; @@ -1635,11 +1625,12 @@ } return any_of(begin(fps_found), end(fps_found), - [](bool b) { return !b; }); + [](bool b) { return !b; }); } static bool update_frame_rate_property(obs_properties_t *props, - const config_helper &conf, obs_property_t *p=nullptr) + const config_helper &conf, + obs_property_t *p = nullptr) { if (!p) p = obs_properties_get(props, "frame_rate"); @@ -1658,20 +1649,19 @@ obs_property_frame_rate_fps_ranges_clear(p); for (auto &pair : frame_rates) - obs_property_frame_rate_fps_range_add(p, - pair.first, pair.second); + obs_property_frame_rate_fps_range_add(p, pair.first, + pair.second); return true; } -static vector<AVCaptureDeviceFormat*> enumerate_formats(AVCaptureDevice *dev, - const CMVideoDimensions &dims, - const media_frames_per_second &fps) +static vector<AVCaptureDeviceFormat *> +enumerate_formats(AVCaptureDevice *dev, const CMVideoDimensions &dims, + const media_frames_per_second &fps) { - vector<AVCaptureDeviceFormat*> result; + vector<AVCaptureDeviceFormat *> result; - find_formats(fps, dev, &dims, [&](AVCaptureDeviceFormat *format) - { + find_formats(fps, dev, &dims, [&](AVCaptureDeviceFormat *format) { result.push_back(format); return false; }); @@ -1679,9 +1669,9 @@ return result; } -static bool input_format_property_needs_update(obs_property_t *p, - const vector<AVCaptureDeviceFormat*> &formats, - const FourCharCode *fourcc_) +static bool input_format_property_needs_update( + obs_property_t *p, const vector<AVCaptureDeviceFormat *> &formats, + const FourCharCode *fourcc_) { bool fourcc_found = !fourcc_; vector<bool> if_found(formats.size()); @@ -1692,13 +1682,13 @@ fourcc_found = fourcc_found || fourcc == *fourcc_; auto pos = find_if(begin(formats), end(formats), - [&](AVCaptureDeviceFormat *format) - { - FourCharCode fourcc_ = 0; - format_description_subtype_name( - format.formatDescription, &fourcc_); - return fourcc_ == fourcc; - }); + [&](AVCaptureDeviceFormat *format) { + FourCharCode fourcc_ = 0; + format_description_subtype_name( + format.formatDescription, + &fourcc_); + return fourcc_ == fourcc; + }); if (pos == end(formats)) return true; @@ -1706,11 +1696,12 @@ } return fourcc_found || any_of(begin(if_found), end(if_found), - [](bool b) { return !b; }); + [](bool b) { return !b; }); } static bool update_input_format_property(obs_properties_t *props, - const config_helper &conf, obs_property_t *p=nullptr) + const config_helper &conf, + obs_property_t *p = nullptr) { if (!p) p = obs_properties_get(props, "input_format"); @@ -1718,16 +1709,15 @@ if (!p) return false; - auto update_enabled = [&](bool enabled) - { + auto update_enabled = [&](bool enabled) { bool was_enabled = obs_property_enabled(p); obs_property_set_enabled(p, enabled); return was_enabled != enabled; }; auto valid_dims = conf.dims(); - auto valid_fps = conf.fps(); - auto valid_if = conf.input_format(); + auto valid_fps = conf.fps(); + auto valid_if = conf.input_format(); if (!valid_dims || !valid_fps) return update_enabled(false); @@ -1743,7 +1733,7 @@ for (auto &format : formats) { FourCharCode fourcc = 0; const char *name = format_description_subtype_name( - format.formatDescription, &fourcc); + format.formatDescription, &fourcc); obs_property_list_add_int(p, name, fourcc); fourcc_found = fourcc_found || fourcc == *valid_if; } @@ -1757,7 +1747,8 @@ } static bool update_int_list_property(obs_property_t *p, const int *val, - const size_t count, const char *localization_name) + const size_t count, + const char *localization_name) { size_t num = obs_property_list_item_count(p); if (num > count) { @@ -1784,12 +1775,12 @@ return true; } -template <typename Func> -static bool update_int_list_property(const char *prop_name, - const char *localization_name, size_t count, - int auto_val, bool (*valid_func)(int), - obs_properties_t *props, const config_helper &conf, - obs_property_t *p, Func get_val) +template<typename Func> +static bool +update_int_list_property(const char *prop_name, const char *localization_name, + size_t count, int auto_val, bool (*valid_func)(int), + obs_properties_t *props, const config_helper &conf, + obs_property_t *p, Func get_val) { auto ref = get_ref(props); if (!p) @@ -1808,20 +1799,20 @@ obs_data_has_autoselect_value(conf.settings, prop_name); if ((params_valid && format_is_yuv(ref->frame.format)) || - !valid_func(val)) + !valid_func(val)) should_enable = true; obs_property_set_enabled(p, should_enable); bool updated = enabled != should_enable; - updated = update_int_list_property(p, - valid_func(val) ? nullptr : &val, - count, localization_name) || updated; + updated = update_int_list_property(p, valid_func(val) ? nullptr : &val, + count, localization_name) || + updated; if (!should_enable) { if (has_autoselect) obs_data_unset_autoselect_value(conf.settings, - prop_name); + prop_name); return updated || has_autoselect; } @@ -1829,14 +1820,14 @@ if (!use_autoselect) { if (has_autoselect) obs_data_unset_autoselect_value(conf.settings, - prop_name); + prop_name); return updated || has_autoselect; } - if (params_valid && get_val(vi) != - obs_data_get_autoselect_int(conf.settings, prop_name)) { + if (params_valid && get_val(vi) != obs_data_get_autoselect_int( + conf.settings, prop_name)) { obs_data_set_autoselect_int(conf.settings, prop_name, - get_val(vi)); + get_val(vi)); return true; } @@ -1844,52 +1835,53 @@ } static bool update_color_space_property(obs_properties_t *props, - const config_helper &conf, obs_property_t *p=nullptr) + const config_helper &conf, + obs_property_t *p = nullptr) { return update_int_list_property("color_space", TEXT_COLOR_UNKNOWN_NAME, - 4, COLOR_SPACE_AUTO, color_space_valid, props, conf, p, - [](av_video_info vi) - { - return vi.colorspace; - }); + 4, COLOR_SPACE_AUTO, color_space_valid, + props, conf, p, [](av_video_info vi) { + return vi.colorspace; + }); } static bool update_video_range_property(obs_properties_t *props, - const config_helper &conf, obs_property_t *p=nullptr) + const config_helper &conf, + obs_property_t *p = nullptr) { return update_int_list_property("video_range", TEXT_RANGE_UNKNOWN_NAME, - 5, VIDEO_RANGE_AUTO, video_range_valid, props, conf, p, - [](av_video_info vi) - { - return vi.video_range; - }); + 5, VIDEO_RANGE_AUTO, video_range_valid, + props, conf, p, [](av_video_info vi) { + return vi.video_range; + }); } -static bool properties_device_changed(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) +static bool properties_device_changed(obs_properties_t *props, + obs_property_t *p, obs_data_t *settings) { NSString *uid = get_string(settings, "device"); AVCaptureDevice *dev = [AVCaptureDevice deviceWithUniqueID:uid]; NSString *name = get_string(settings, "device_name"); - bool dev_list_updated = update_device_list(p, uid, name, - !dev && uid.length); + bool dev_list_updated = + update_device_list(p, uid, name, !dev && uid.length); p = obs_properties_get(props, "preset"); bool preset_list_changed = check_preset(dev, p, settings); - bool autoselect_changed = autoselect_preset(dev, settings); + bool autoselect_changed = autoselect_preset(dev, settings); config_helper conf{settings}; bool res_changed = update_resolution_property(props, conf); bool fps_changed = update_frame_rate_property(props, conf); - bool if_changed = update_input_format_property(props, conf); + bool if_changed = update_input_format_property(props, conf); - return preset_list_changed || autoselect_changed || dev_list_updated - || res_changed || fps_changed || if_changed; + return preset_list_changed || autoselect_changed || dev_list_updated || + res_changed || fps_changed || if_changed; } static bool properties_use_preset_changed(obs_properties_t *props, - obs_property_t *, obs_data_t *settings) + obs_property_t *, + obs_data_t *settings) { auto use_preset = obs_data_get_bool(settings, "use_preset"); @@ -1899,83 +1891,84 @@ bool visible = false; obs_property_t *p = nullptr; - auto noop = [](obs_properties_t *, const config_helper&, - obs_property_t *) - { - return false; - }; + auto noop = [](obs_properties_t *, const config_helper &, + obs_property_t *) { return false; }; -#define UPDATE_PROPERTY(prop, uses_preset, func) \ - p = obs_properties_get(props, prop); \ - visible = use_preset == uses_preset; \ +#define UPDATE_PROPERTY(prop, uses_preset, func) \ + p = obs_properties_get(props, prop); \ + visible = use_preset == uses_preset; \ updated = obs_property_visible(p) != visible || updated; \ - obs_property_set_visible(p, visible);\ + obs_property_set_visible(p, visible); \ updated = func(props, conf, p) || updated; - UPDATE_PROPERTY("preset", true, noop); - UPDATE_PROPERTY("resolution", false, update_resolution_property); - UPDATE_PROPERTY("frame_rate", false, update_frame_rate_property); + UPDATE_PROPERTY("preset", true, noop); + UPDATE_PROPERTY("resolution", false, update_resolution_property); + UPDATE_PROPERTY("frame_rate", false, update_frame_rate_property); UPDATE_PROPERTY("input_format", false, update_input_format_property); - UPDATE_PROPERTY("color_space", false, update_color_space_property); - UPDATE_PROPERTY("video_range", false, update_video_range_property); + UPDATE_PROPERTY("color_space", false, update_color_space_property); + UPDATE_PROPERTY("video_range", false, update_video_range_property); return updated; } static bool properties_preset_changed(obs_properties_t *, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { NSString *uid = get_string(settings, "device"); AVCaptureDevice *dev = [AVCaptureDevice deviceWithUniqueID:uid]; bool preset_list_changed = check_preset(dev, p, settings); - bool autoselect_changed = autoselect_preset(dev, settings); + bool autoselect_changed = autoselect_preset(dev, settings); return preset_list_changed || autoselect_changed; } static bool properties_resolution_changed(obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) + obs_property_t *p, + obs_data_t *settings) { config_helper conf{settings}; bool res_updated = update_resolution_property(props, conf, p); bool fps_updated = update_frame_rate_property(props, conf); - bool if_updated = update_input_format_property(props, conf); - bool cs_updated = update_color_space_property(props, conf); - bool cr_updated = update_video_range_property(props, conf); + bool if_updated = update_input_format_property(props, conf); + bool cs_updated = update_color_space_property(props, conf); + bool cr_updated = update_video_range_property(props, conf); - return res_updated || fps_updated || - if_updated || cs_updated || cr_updated; + return res_updated || fps_updated || if_updated || cs_updated || + cr_updated; } static bool properties_frame_rate_changed(obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) + obs_property_t *p, + obs_data_t *settings) { config_helper conf{settings}; bool fps_updated = update_frame_rate_property(props, conf, p); - bool if_updated = update_input_format_property(props, conf); - bool cs_updated = update_color_space_property(props, conf); - bool cr_updated = update_video_range_property(props, conf); + bool if_updated = update_input_format_property(props, conf); + bool cs_updated = update_color_space_property(props, conf); + bool cr_updated = update_video_range_property(props, conf); return fps_updated || if_updated || cs_updated || cr_updated; } static bool properties_input_format_changed(obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) + obs_property_t *p, + obs_data_t *settings) { config_helper conf{settings}; - bool if_updated = update_input_format_property(props, conf, p); - bool cs_updated = update_color_space_property(props, conf); - bool cr_updated = update_video_range_property(props, conf); + bool if_updated = update_input_format_property(props, conf, p); + bool cs_updated = update_color_space_property(props, conf); + bool cr_updated = update_video_range_property(props, conf); return if_updated || cs_updated || cr_updated; } static bool properties_color_space_changed(obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) + obs_property_t *p, + obs_data_t *settings) { config_helper conf{settings}; @@ -1983,7 +1976,8 @@ } static bool properties_video_range_changed(obs_properties_t *props, - obs_property_t *p, obs_data_t *settings) + obs_property_t *p, + obs_data_t *settings) { config_helper conf{settings}; @@ -1992,77 +1986,73 @@ static void add_properties_param(obs_properties_t *props, av_capture *capture) { - auto param = unique_ptr<properties_param>( - new properties_param(capture)); + auto param = + unique_ptr<properties_param>(new properties_param(capture)); - obs_properties_set_param(props, param.release(), - [](void *param) - { - delete static_cast<properties_param*>(param); + obs_properties_set_param(props, param.release(), [](void *param) { + delete static_cast<properties_param *>(param); }); } static void add_preset_properties(obs_properties_t *props) { - obs_property_t *preset_list = obs_properties_add_list(props, "preset", - TEXT_PRESET, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_STRING); + obs_property_t *preset_list = obs_properties_add_list( + props, "preset", TEXT_PRESET, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); for (NSString *preset in presets()) obs_property_list_add_string(preset_list, - preset_names(preset).UTF8String, - preset.UTF8String); + preset_names(preset).UTF8String, + preset.UTF8String); obs_property_set_modified_callback(preset_list, - properties_preset_changed); + properties_preset_changed); } static void add_manual_properties(obs_properties_t *props) { - obs_property_t *resolutions = obs_properties_add_list(props, - "resolution", TEXT_RESOLUTION, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_STRING); + obs_property_t *resolutions = obs_properties_add_list( + props, "resolution", TEXT_RESOLUTION, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_set_enabled(resolutions, false); obs_property_set_modified_callback(resolutions, - properties_resolution_changed); + properties_resolution_changed); - obs_property_t *frame_rates = obs_properties_add_frame_rate(props, - "frame_rate", TEXT_FRAME_RATE); + obs_property_t *frame_rates = obs_properties_add_frame_rate( + props, "frame_rate", TEXT_FRAME_RATE); /*obs_property_frame_rate_option_add(frame_rates, "match obs", TEXT_MATCH_OBS);*/ obs_property_set_enabled(frame_rates, false); obs_property_set_modified_callback(frame_rates, - properties_frame_rate_changed); + properties_frame_rate_changed); - obs_property_t *input_format = obs_properties_add_list(props, - "input_format", TEXT_INPUT_FORMAT, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); - obs_property_list_add_int(input_format, TEXT_AUTO, - INPUT_FORMAT_AUTO); + obs_property_t *input_format = obs_properties_add_list( + props, "input_format", TEXT_INPUT_FORMAT, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); + obs_property_list_add_int(input_format, TEXT_AUTO, INPUT_FORMAT_AUTO); obs_property_set_enabled(input_format, false); obs_property_set_modified_callback(input_format, - properties_input_format_changed); + properties_input_format_changed); - obs_property_t *color_space = obs_properties_add_list(props, - "color_space", TEXT_COLOR_SPACE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *color_space = obs_properties_add_list( + props, "color_space", TEXT_COLOR_SPACE, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_list_add_int(color_space, TEXT_AUTO, COLOR_SPACE_AUTO); obs_property_list_add_int(color_space, "Rec. 601", VIDEO_CS_601); obs_property_list_add_int(color_space, "Rec. 709", VIDEO_CS_709); obs_property_set_enabled(color_space, false); obs_property_set_modified_callback(color_space, - properties_color_space_changed); + properties_color_space_changed); -#define ADD_RANGE(x) \ - obs_property_list_add_int(video_range, TEXT_ ## x, VIDEO_ ## x) - obs_property_t *video_range = obs_properties_add_list(props, - "video_range", TEXT_VIDEO_RANGE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); +#define ADD_RANGE(x) obs_property_list_add_int(video_range, TEXT_##x, VIDEO_##x) + obs_property_t *video_range = obs_properties_add_list( + props, "video_range", TEXT_VIDEO_RANGE, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_list_add_int(video_range, TEXT_AUTO, VIDEO_RANGE_AUTO); ADD_RANGE(RANGE_PARTIAL); ADD_RANGE(RANGE_FULL); obs_property_set_enabled(video_range, false); obs_property_set_modified_callback(video_range, - properties_video_range_changed); + properties_video_range_changed); #undef ADD_RANGE } @@ -2070,43 +2060,41 @@ { obs_properties_t *props = obs_properties_create(); - add_properties_param(props, static_cast<av_capture*>(capture)); + add_properties_param(props, static_cast<av_capture *>(capture)); - obs_property_t *dev_list = obs_properties_add_list(props, "device", - TEXT_DEVICE, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_STRING); + obs_property_t *dev_list = obs_properties_add_list( + props, "device", TEXT_DEVICE, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(dev_list, "", ""); - for (AVCaptureDevice *dev in [AVCaptureDevice - devices]) { - if ([dev hasMediaType: AVMediaTypeVideo] || - [dev hasMediaType: AVMediaTypeMuxed]) { - obs_property_list_add_string(dev_list, - dev.localizedName.UTF8String, - dev.uniqueID.UTF8String); + for (AVCaptureDevice *dev in [AVCaptureDevice devices]) { + if ([dev hasMediaType:AVMediaTypeVideo] || + [dev hasMediaType:AVMediaTypeMuxed]) { + obs_property_list_add_string( + dev_list, dev.localizedName.UTF8String, + dev.uniqueID.UTF8String); } } - obs_property_set_modified_callback(dev_list, - properties_device_changed); + obs_property_set_modified_callback(dev_list, properties_device_changed); - obs_property_t *use_preset = obs_properties_add_bool(props, - "use_preset", TEXT_USE_PRESET); + obs_property_t *use_preset = + obs_properties_add_bool(props, "use_preset", TEXT_USE_PRESET); obs_property_set_modified_callback(use_preset, - properties_use_preset_changed); + properties_use_preset_changed); add_preset_properties(props); add_manual_properties(props); obs_properties_add_bool(props, "buffering", - obs_module_text("Buffering")); + obs_module_text("Buffering")); return props; } static void switch_device(av_capture *capture, NSString *uid, - obs_data_t *settings) + obs_data_t *settings) { if (!uid) return; @@ -2124,7 +2112,7 @@ AVCaptureDevice *dev = [AVCaptureDevice deviceWithUniqueID:uid]; if (!dev) { AVLOG(LOG_WARNING, "Device with unique id '%s' not found", - uid.UTF8String); + uid.UTF8String); return; } @@ -2138,7 +2126,7 @@ NSString *preset = get_string(settings, "preset"); if (![capture->device supportsAVCaptureSessionPreset:preset]) { AVLOG(LOG_WARNING, "Preset %s not available", - preset.UTF8String); + preset.UTF8String); preset = select_preset(capture->device, preset); } @@ -2156,7 +2144,7 @@ static void av_capture_update(void *data, obs_data_t *settings) { - auto capture = static_cast<av_capture*>(data); + auto capture = static_cast<av_capture *>(data); NSString *uid = get_string(settings, "device"); @@ -2170,7 +2158,7 @@ } av_capture_enable_buffering(capture, - obs_data_get_bool(settings, "buffering")); + obs_data_get_bool(settings, "buffering")); } OBS_DECLARE_MODULE() @@ -2187,26 +2175,25 @@ // From WWDC video 2014 #508 at 5:34 // https://developer.apple.com/videos/wwdc/2014/#508 CMIOObjectPropertyAddress prop = { - kCMIOHardwarePropertyAllowScreenCaptureDevices, - kCMIOObjectPropertyScopeGlobal, - kCMIOObjectPropertyElementMaster - }; + kCMIOHardwarePropertyAllowScreenCaptureDevices, + kCMIOObjectPropertyScopeGlobal, + kCMIOObjectPropertyElementMaster}; UInt32 allow = 1; CMIOObjectSetPropertyData(kCMIOObjectSystemObject, &prop, 0, NULL, - sizeof(allow), &allow); + sizeof(allow), &allow); #endif obs_source_info av_capture_info = { - .id = "av_capture_input", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_ASYNC_VIDEO | - OBS_SOURCE_DO_NOT_DUPLICATE, - .get_name = av_capture_getname, - .create = av_capture_create, - .destroy = av_capture_destroy, - .get_defaults = av_capture_defaults, + .id = "av_capture_input", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_ASYNC_VIDEO | + OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = av_capture_getname, + .create = av_capture_create, + .destroy = av_capture_destroy, + .get_defaults = av_capture_defaults, .get_properties = av_capture_properties, - .update = av_capture_update, + .update = av_capture_update, }; obs_register_source(&av_capture_info);
View file
obs-studio-23.2.1.tar.xz/plugins/mac-avcapture/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-avcapture/data/locale/gl-ES.ini
Changed
@@ -1,14 +1,14 @@ AVCapture="Dispositivo de captura de vídeo" Device="Dispositivo" -UsePreset="Usar valores predefinidos" -Preset="Valores predefinidos" -Buffering="Utilizar o almacenamento no búfer" -FrameRate="Velocidade de fotogramas" +UsePreset="Usar valor predefinido" +Preset="Predefinido" +Buffering="Usar o almacenamento na memoria temporal" +FrameRate="Taxa de fotogramas" InputFormat="Formato de entrada" ColorSpace="Espazo de cor" -VideoRange="Rango de video" +VideoRange="Intervalo de vídeo" VideoRange.Partial="Parcial" -VideoRange.Full="Completo" +VideoRange.Full="Total" Auto="Automático" Unknown="Descoñecido ($1)"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-avcapture/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-avcapture/data/locale/ka-GE.ini
Changed
@@ -1,4 +1,4 @@ -AVCapture="ვიდეოს გადამღები მოწყობილობა" +AVCapture="ვიდეოჩამწერი მოწყობილობა" Device="მოწყობილობა" UsePreset="მზა პარამეტრებით სარგებლობა" Preset="მზა პარამეტრები"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-avcapture/left-right.hpp -> obs-studio-24.0.0.tar.xz/plugins/mac-avcapture/left-right.hpp
Changed
@@ -12,10 +12,8 @@ namespace left_right { -template <typename T> -struct left_right { - template <typename Func> - void update(Func &&f) +template<typename T> struct left_right { + template<typename Func> void update(Func &&f) { std::lock_guard<std::mutex> lock(write_mutex); auto cur = current.load(); @@ -56,8 +54,8 @@ private: std::atomic_uint_fast8_t current; - std::atomic_long readers[2]; - std::mutex write_mutex; + std::atomic_long readers[2]; + std::mutex write_mutex; T data[2] = {{}, {}}; };
View file
obs-studio-23.2.1.tar.xz/plugins/mac-avcapture/scope-guard.hpp -> obs-studio-24.0.0.tar.xz/plugins/mac-avcapture/scope-guard.hpp
Changed
@@ -8,21 +8,13 @@ namespace scope_guard_util { -template <typename FunctionType> -class ScopeGuard { +template<typename FunctionType> class ScopeGuard { public: - void dismiss() noexcept - { - dismissed_ = true; - } + void dismiss() noexcept { dismissed_ = true; } - explicit ScopeGuard(const FunctionType &fn) - : function_(fn) - {} + explicit ScopeGuard(const FunctionType &fn) : function_(fn) {} - explicit ScopeGuard(FunctionType &&fn) - : function_(std::move(fn)) - {} + explicit ScopeGuard(FunctionType &&fn) : function_(std::move(fn)) {} ScopeGuard(ScopeGuard &&other) : dismissed_(other.dismissed_), @@ -38,43 +30,40 @@ } private: - void* operator new(size_t) = delete; + void *operator new(size_t) = delete; - void execute() noexcept - { - function_(); - } + void execute() noexcept { function_(); } bool dismissed_ = false; FunctionType function_; }; -template <typename FunctionType> +template<typename FunctionType> ScopeGuard<typename std::decay<FunctionType>::type> make_guard(FunctionType &&fn) { return ScopeGuard<typename std::decay<FunctionType>::type>{ - std::forward<FunctionType>(fn)}; + std::forward<FunctionType>(fn)}; } namespace detail { enum class ScopeGuardOnExit {}; -template <typename FunctionType> +template<typename FunctionType> ScopeGuard<typename std::decay<FunctionType>::type> -operator+(detail::ScopeGuardOnExit, FunctionType &&fn) { - return ScopeGuard<typename std::decay<FunctionType>::type>( - std::forward<FunctionType>(fn)); +operator+(detail::ScopeGuardOnExit, FunctionType &&fn) +{ + return ScopeGuard<typename std::decay<FunctionType>::type>( + std::forward<FunctionType>(fn)); } } } // namespace scope_guard_util -#define SCOPE_EXIT_CONCAT2(x, y) x ## y +#define SCOPE_EXIT_CONCAT2(x, y) x##y #define SCOPE_EXIT_CONCAT(x, y) SCOPE_EXIT_CONCAT2(x, y) -#define SCOPE_EXIT \ +#define SCOPE_EXIT \ auto SCOPE_EXIT_CONCAT(SCOPE_EXIT_STATE, __LINE__) = \ ::scope_guard_util::detail::ScopeGuardOnExit() + [&]() noexcept -
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/audio-device-enum.c -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/audio-device-enum.c
Changed
@@ -10,15 +10,15 @@ static inline bool device_is_input(char *device) { return astrstri(device, "soundflower") == NULL && - astrstri(device, "wavtap") == NULL && + astrstri(device, "wavtap") == NULL && astrstri(device, "soundsiphon") == NULL; } static inline bool enum_success(OSStatus stat, const char *msg) { if (stat != noErr) { - blog(LOG_WARNING, "[coreaudio_enum_devices] %s failed: %d", - msg, (int)stat); + blog(LOG_WARNING, "[coreaudio_enum_devices] %s failed: %d", msg, + (int)stat); return false; } @@ -26,22 +26,20 @@ } typedef bool (*enum_device_proc_t)(void *param, CFStringRef cf_name, - CFStringRef cf_uid, AudioDeviceID id); + CFStringRef cf_uid, AudioDeviceID id); static bool coreaudio_enum_device(enum_device_proc_t proc, void *param, - AudioDeviceID id) + AudioDeviceID id) { - UInt32 size = 0; - CFStringRef cf_name = NULL; - CFStringRef cf_uid = NULL; - bool enum_next = true; - OSStatus stat; - - AudioObjectPropertyAddress addr = { - kAudioDevicePropertyStreams, - kAudioDevicePropertyScopeInput, - kAudioObjectPropertyElementMaster - }; + UInt32 size = 0; + CFStringRef cf_name = NULL; + CFStringRef cf_uid = NULL; + bool enum_next = true; + OSStatus stat; + + AudioObjectPropertyAddress addr = {kAudioDevicePropertyStreams, + kAudioDevicePropertyScopeInput, + kAudioObjectPropertyElementMaster}; /* check to see if it's a mac input device */ AudioObjectGetPropertyDataSize(id, &addr, 0, NULL, &size); @@ -72,27 +70,25 @@ static void enum_devices(enum_device_proc_t proc, void *param) { - AudioObjectPropertyAddress addr = { - kAudioHardwarePropertyDevices, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; - - UInt32 size = 0; - UInt32 count; - OSStatus stat; + AudioObjectPropertyAddress addr = {kAudioHardwarePropertyDevices, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster}; + + UInt32 size = 0; + UInt32 count; + OSStatus stat; AudioDeviceID *ids; stat = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &addr, - 0, NULL, &size); + 0, NULL, &size); if (!enum_success(stat, "get kAudioObjectSystemObject data size")) return; - ids = bmalloc(size); + ids = bmalloc(size); count = size / sizeof(AudioDeviceID); - stat = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, - 0, NULL, &size, ids); + stat = AudioObjectGetPropertyData(kAudioObjectSystemObject, &addr, 0, + NULL, &size, ids); if (enum_success(stat, "get kAudioObjectSystemObject data")) for (UInt32 i = 0; i < count; i++) @@ -104,20 +100,20 @@ struct add_data { struct device_list *list; - bool input; + bool input; }; static bool coreaudio_enum_add_device(void *param, CFStringRef cf_name, - CFStringRef cf_uid, AudioDeviceID id) + CFStringRef cf_uid, AudioDeviceID id) { - struct add_data *data = param; + struct add_data *data = param; struct device_item item; memset(&item, 0, sizeof(item)); if (!cfstr_copy_dstr(cf_name, kCFStringEncodingUTF8, &item.name)) goto fail; - if (!cfstr_copy_dstr(cf_uid, kCFStringEncodingUTF8, &item.value)) + if (!cfstr_copy_dstr(cf_uid, kCFStringEncodingUTF8, &item.value)) goto fail; if (data->input || !device_is_input(item.value.array)) @@ -137,18 +133,18 @@ } struct device_id_data { - CFStringRef uid; + CFStringRef uid; AudioDeviceID *id; - bool found; + bool found; }; static bool get_device_id(void *param, CFStringRef cf_name, CFStringRef cf_uid, - AudioDeviceID id) + AudioDeviceID id) { struct device_id_data *data = param; if (CFStringCompare(cf_uid, data->uid, 0) == 0) { - *data->id = id; + *data->id = id; data->found = true; return false; }
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/audio-device-enum.h -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/audio-device-enum.h
Changed
@@ -20,13 +20,13 @@ static inline void device_list_free(struct device_list *list) { for (size_t i = 0; i < list->items.num; i++) - device_item_free(list->items.array+i); + device_item_free(list->items.array + i); da_free(list->items); } static inline void device_list_add(struct device_list *list, - struct device_item *item) + struct device_item *item) { da_push_back(list->items, item); memset(item, 0, sizeof(struct device_item));
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/data/locale/gl-ES.ini
Changed
@@ -1,21 +1,21 @@ -CoreAudio.InputCapture="Captura de entrada de audio" -CoreAudio.OutputCapture="Captura de saída de audio" +CoreAudio.InputCapture="Captura de entrada de son" +CoreAudio.OutputCapture="Captura de saída de son" CoreAudio.Device="Dispositivo" -CoreAudio.Device.Default="Por defecto" +CoreAudio.Device.Default="Predeterminado" DisplayCapture="Captura de pantalla" DisplayCapture.Display="Pantalla" -DisplayCapture.ShowCursor="Mostrar o cursor" -WindowCapture="Capturar xanela" -WindowCapture.ShowShadow="Mostrar sombra da xanela" +DisplayCapture.ShowCursor="Amosar o cursor" +WindowCapture="Captura da xanela" +WindowCapture.ShowShadow="Amosar a sombra da xanela" WindowUtils.Window="Xanela" -WindowUtils.ShowEmptyNames="Mostrar xanelas con nomes baleiros" +WindowUtils.ShowEmptyNames="Amosar as xanelas con nomes baleiros" CropMode="Recortar" CropMode.None="Ningún" CropMode.Manual="Manual" CropMode.ToWindow="Á xanela" CropMode.ToWindowAndManual="Á xanela e manual" -Crop.origin.x="Recortar á esquerda" -Crop.origin.y="Recortar arriba" -Crop.size.width="Recortar á dereita" -Crop.size.height="Recortar abaixo" +Crop.origin.x="Recortar pola esquerda" +Crop.origin.y="Recortar por riba" +Crop.size.width="Recortar pola dereita" +Crop.size.height="Recortar por baixo"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/data/locale/ka-GE.ini
Changed
@@ -1,4 +1,4 @@ -CoreAudio.InputCapture="შემავალი ხმოვანი სიგნალის ჩაწერა" +CoreAudio.InputCapture="შემავალი ხმის ჩაწერა" CoreAudio.OutputCapture="გამოტანილი ხმის ჩაწერა" CoreAudio.Device="მოწყობილობა" CoreAudio.Device.Default="ნაგულისხმევი"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/data/locale/ro-RO.ini
Changed
@@ -4,7 +4,7 @@ CoreAudio.Device.Default="Implicit" DisplayCapture="Captură de display" DisplayCapture.Display="Display" -DisplayCapture.ShowCursor="Arată cursorul" +DisplayCapture.ShowCursor="Afișează cursorul" WindowCapture="Captură de fereastră" WindowCapture.ShowShadow="Afișează umbra ferestrei" WindowUtils.Window="Fereastră"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/data/locale/sl-SI.ini
Changed
@@ -5,7 +5,7 @@ DisplayCapture="Zajemanje zaslona" DisplayCapture.Display="Zaslon" DisplayCapture.ShowCursor="Prikaži kazalec" -WindowCapture="Zajem Okna" +WindowCapture="Zajemanje okna" WindowCapture.ShowShadow="Prikaži senco okna" WindowUtils.Window="Okno" WindowUtils.ShowEmptyNames="Prikaži okna z praznimi imeni"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/mac-audio.c -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/mac-audio.c
Changed
@@ -15,44 +15,44 @@ #define PROPERTY_FORMATS kAudioStreamPropertyAvailablePhysicalFormats #define SCOPE_OUTPUT kAudioUnitScope_Output -#define SCOPE_INPUT kAudioUnitScope_Input +#define SCOPE_INPUT kAudioUnitScope_Input #define SCOPE_GLOBAL kAudioUnitScope_Global #define BUS_OUTPUT 0 -#define BUS_INPUT 1 +#define BUS_INPUT 1 #define MAX_DEVICES 20 #define set_property AudioUnitSetProperty #define get_property AudioUnitGetProperty -#define TEXT_AUDIO_INPUT obs_module_text("CoreAudio.InputCapture"); -#define TEXT_AUDIO_OUTPUT obs_module_text("CoreAudio.OutputCapture"); -#define TEXT_DEVICE obs_module_text("CoreAudio.Device") +#define TEXT_AUDIO_INPUT obs_module_text("CoreAudio.InputCapture"); +#define TEXT_AUDIO_OUTPUT obs_module_text("CoreAudio.OutputCapture"); +#define TEXT_DEVICE obs_module_text("CoreAudio.Device") #define TEXT_DEVICE_DEFAULT obs_module_text("CoreAudio.Device.Default") struct coreaudio_data { - char *device_name; - char *device_uid; - AudioUnit unit; - AudioDeviceID device_id; - AudioBufferList *buf_list; - bool au_initialized; - bool active; - bool default_device; - bool input; - bool no_devices; - - uint32_t sample_rate; - enum audio_format format; + char *device_name; + char *device_uid; + AudioUnit unit; + AudioDeviceID device_id; + AudioBufferList *buf_list; + bool au_initialized; + bool active; + bool default_device; + bool input; + bool no_devices; + + uint32_t sample_rate; + enum audio_format format; enum speaker_layout speakers; - pthread_t reconnect_thread; - os_event_t *exit_event; - volatile bool reconnecting; - unsigned long retry_time; + pthread_t reconnect_thread; + os_event_t *exit_event; + volatile bool reconnecting; + unsigned long retry_time; - obs_source_t *source; + obs_source_t *source; }; static bool get_default_output_device(struct coreaudio_data *ca) @@ -74,17 +74,16 @@ static bool find_device_id_by_uid(struct coreaudio_data *ca) { - UInt32 size = sizeof(AudioDeviceID); - CFStringRef cf_uid = NULL; - CFStringRef qual = NULL; - UInt32 qual_size = 0; - OSStatus stat; - bool success; + UInt32 size = sizeof(AudioDeviceID); + CFStringRef cf_uid = NULL; + CFStringRef qual = NULL; + UInt32 qual_size = 0; + OSStatus stat; + bool success; AudioObjectPropertyAddress addr = { - .mScope = kAudioObjectPropertyScopeGlobal, - .mElement = kAudioObjectPropertyElementMaster - }; + .mScope = kAudioObjectPropertyScopeGlobal, + .mElement = kAudioObjectPropertyElementMaster}; if (!ca->device_uid) ca->device_uid = bstrdup("default"); @@ -105,12 +104,13 @@ } cf_uid = CFStringCreateWithCString(NULL, ca->device_uid, - kCFStringEncodingUTF8); + kCFStringEncodingUTF8); if (ca->default_device) { addr.mSelector = PROPERTY_DEFAULT_DEVICE; stat = AudioObjectGetPropertyData(kAudioObjectSystemObject, - &addr, qual_size, &qual, &size, &ca->device_id); + &addr, qual_size, &qual, + &size, &ca->device_id); success = (stat == noErr); } else { success = coreaudio_get_device_id(cf_uid, &ca->device_id); @@ -123,7 +123,7 @@ } static inline void ca_warn(struct coreaudio_data *ca, const char *func, - const char *format, ...) + const char *format, ...) { va_list args; struct dstr str = {0}; @@ -139,11 +139,11 @@ } static inline bool ca_success(OSStatus stat, struct coreaudio_data *ca, - const char *func, const char *action) + const char *func, const char *action) { if (stat != noErr) { - blog(LOG_WARNING, "[%s]:[device '%s'] %s failed: %d", - func, ca->device_name, action, (int)stat); + blog(LOG_WARNING, "[%s]:[device '%s'] %s failed: %d", func, + ca->device_name, action, (int)stat); return false; } @@ -156,17 +156,18 @@ }; static inline bool enable_io(struct coreaudio_data *ca, - enum coreaudio_io_type type, bool enable) + enum coreaudio_io_type type, bool enable) { UInt32 enable_int = enable; return set_property(ca->unit, kAudioOutputUnitProperty_EnableIO, - (type == IO_TYPE_INPUT) ? SCOPE_INPUT : SCOPE_OUTPUT, - (type == IO_TYPE_INPUT) ? BUS_INPUT : BUS_OUTPUT, - &enable_int, sizeof(enable_int)); + (type == IO_TYPE_INPUT) ? SCOPE_INPUT + : SCOPE_OUTPUT, + (type == IO_TYPE_INPUT) ? BUS_INPUT : BUS_OUTPUT, + &enable_int, sizeof(enable_int)); } static inline enum audio_format convert_ca_format(UInt32 format_flags, - UInt32 bits) + UInt32 bits) { bool planar = (format_flags & kAudioFormatFlagIsNonInterleaved) != 0; @@ -191,13 +192,20 @@ static inline enum speaker_layout convert_ca_speaker_layout(UInt32 channels) { switch (channels) { - case 1: return SPEAKERS_MONO; - case 2: return SPEAKERS_STEREO; - case 3: return SPEAKERS_2POINT1; - case 4: return SPEAKERS_4POINT0; - case 5: return SPEAKERS_4POINT1; - case 6: return SPEAKERS_5POINT1; - case 8: return SPEAKERS_7POINT1; + case 1: + return SPEAKERS_MONO; + case 2: + return SPEAKERS_STEREO; + case 3: + return SPEAKERS_2POINT1; + case 4: + return SPEAKERS_4POINT0; + case 5: + return SPEAKERS_4POINT1; + case 6: + return SPEAKERS_5POINT1; + case 8: + return SPEAKERS_7POINT1; } return SPEAKERS_UNKNOWN; @@ -218,7 +226,7 @@ channels = get_audio_channels(aoi.speakers); stat = get_property(ca->unit, kAudioUnitProperty_StreamFormat, - SCOPE_INPUT, BUS_INPUT, &desc, &size); + SCOPE_INPUT, BUS_INPUT, &desc, &size); if (!ca_success(stat, ca, "coreaudio_init_format", "get input format")) return false; @@ -229,11 +237,11 @@ desc.mChannelsPerFrame = channels; desc.mBytesPerFrame = channels * desc.mBitsPerChannel / 8; desc.mBytesPerPacket = - desc.mFramesPerPacket * desc.mBytesPerFrame; + desc.mFramesPerPacket * desc.mBytesPerFrame; } stat = set_property(ca->unit, kAudioUnitProperty_StreamFormat, - SCOPE_OUTPUT, BUS_INPUT, &desc, size); + SCOPE_OUTPUT, BUS_INPUT, &desc, size); if (!ca_success(stat, ca, "coreaudio_init_format", "set output format")) return false; @@ -244,10 +252,11 @@ ca->format = convert_ca_format(desc.mFormatFlags, desc.mBitsPerChannel); if (ca->format == AUDIO_FORMAT_UNKNOWN) { - ca_warn(ca, "coreaudio_init_format", "unknown format flags: " - "%u, bits: %u", - (unsigned int)desc.mFormatFlags, - (unsigned int)desc.mBitsPerChannel); + ca_warn(ca, "coreaudio_init_format", + "unknown format flags: " + "%u, bits: %u", + (unsigned int)desc.mFormatFlags, + (unsigned int)desc.mBitsPerChannel); return false; } @@ -255,9 +264,10 @@ ca->speakers = convert_ca_speaker_layout(desc.mChannelsPerFrame); if (ca->speakers == SPEAKERS_UNKNOWN) { - ca_warn(ca, "coreaudio_init_format", "unknown speaker layout: " - "%u channels", - (unsigned int)desc.mChannelsPerFrame); + ca_warn(ca, "coreaudio_init_format", + "unknown speaker layout: " + "%u channels", + (unsigned int)desc.mChannelsPerFrame); return false; } @@ -267,24 +277,23 @@ static bool coreaudio_init_buffer(struct coreaudio_data *ca) { UInt32 buf_size = 0; - UInt32 size = 0; - UInt32 frames = 0; + UInt32 size = 0; + UInt32 frames = 0; OSStatus stat; AudioObjectPropertyAddress addr = { kAudioDevicePropertyStreamConfiguration, kAudioDevicePropertyScopeInput, - kAudioObjectPropertyElementMaster - }; + kAudioObjectPropertyElementMaster}; stat = AudioObjectGetPropertyDataSize(ca->device_id, &addr, 0, NULL, - &buf_size); + &buf_size); if (!ca_success(stat, ca, "coreaudio_init_buffer", "get list size")) return false; size = sizeof(frames); stat = get_property(ca->unit, kAudioDevicePropertyBufferFrameSize, - SCOPE_GLOBAL, 0, &frames, &size); + SCOPE_GLOBAL, 0, &frames, &size); if (!ca_success(stat, ca, "coreaudio_init_buffer", "get frame size")) return false; @@ -293,7 +302,7 @@ ca->buf_list = bmalloc(buf_size); stat = AudioObjectGetPropertyData(ca->device_id, &addr, 0, NULL, - &buf_size, ca->buf_list); + &buf_size, ca->buf_list); if (!ca_success(stat, ca, "coreaudio_init_buffer", "allocate")) { bfree(ca->buf_list); ca->buf_list = NULL; @@ -304,7 +313,7 @@ size = ca->buf_list->mBuffers[i].mDataByteSize; ca->buf_list->mBuffers[i].mData = bmalloc(size); } - + return true; } @@ -318,31 +327,28 @@ } } -static OSStatus input_callback( - void *data, - AudioUnitRenderActionFlags *action_flags, - const AudioTimeStamp *ts_data, - UInt32 bus_num, - UInt32 frames, - AudioBufferList *ignored_buffers) +static OSStatus input_callback(void *data, + AudioUnitRenderActionFlags *action_flags, + const AudioTimeStamp *ts_data, UInt32 bus_num, + UInt32 frames, AudioBufferList *ignored_buffers) { struct coreaudio_data *ca = data; OSStatus stat; struct obs_source_audio audio; stat = AudioUnitRender(ca->unit, action_flags, ts_data, bus_num, frames, - ca->buf_list); + ca->buf_list); if (!ca_success(stat, ca, "input_callback", "audio retrieval")) return noErr; for (UInt32 i = 0; i < ca->buf_list->mNumberBuffers; i++) audio.data[i] = ca->buf_list->mBuffers[i].mData; - audio.frames = frames; - audio.speakers = ca->speakers; - audio.format = ca->format; + audio.frames = frames; + audio.speakers = ca->speakers; + audio.format = ca->format; audio.samples_per_sec = ca->sample_rate; - audio.timestamp = ts_data->mHostTime; + audio.timestamp = ts_data->mHostTime; obs_source_output_audio(ca->source, &audio); @@ -360,7 +366,8 @@ ca->reconnecting = true; - while (os_event_timedwait(ca->exit_event, ca->retry_time) == ETIMEDOUT) { + while (os_event_timedwait(ca->exit_event, ca->retry_time) == + ETIMEDOUT) { if (coreaudio_init(ca)) break; } @@ -379,15 +386,15 @@ ret = pthread_create(&ca->reconnect_thread, NULL, reconnect_thread, ca); if (ret != 0) - blog(LOG_WARNING, "[coreaudio_begin_reconnect] failed to " - "create thread, error code: %d", ret); + blog(LOG_WARNING, + "[coreaudio_begin_reconnect] failed to " + "create thread, error code: %d", + ret); } -static OSStatus notification_callback( - AudioObjectID id, - UInt32 num_addresses, - const AudioObjectPropertyAddress addresses[], - void *data) +static OSStatus +notification_callback(AudioObjectID id, UInt32 num_addresses, + const AudioObjectPropertyAddress addresses[], void *data) { struct coreaudio_data *ca = data; @@ -399,8 +406,10 @@ else ca->retry_time = 2000; - blog(LOG_INFO, "coreaudio: device '%s' disconnected or changed. " - "attempting to reconnect", ca->device_name); + blog(LOG_INFO, + "coreaudio: device '%s' disconnected or changed. " + "attempting to reconnect", + ca->device_name); coreaudio_begin_reconnect(ca); @@ -412,50 +421,48 @@ static OSStatus add_listener(struct coreaudio_data *ca, UInt32 property) { - AudioObjectPropertyAddress addr = { - property, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; + AudioObjectPropertyAddress addr = {property, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster}; return AudioObjectAddPropertyListener(ca->device_id, &addr, - notification_callback, ca); + notification_callback, ca); } static bool coreaudio_init_hooks(struct coreaudio_data *ca) { OSStatus stat; - AURenderCallbackStruct callback_info = { - .inputProc = input_callback, - .inputProcRefCon = ca - }; + AURenderCallbackStruct callback_info = {.inputProc = input_callback, + .inputProcRefCon = ca}; stat = add_listener(ca, kAudioDevicePropertyDeviceIsAlive); if (!ca_success(stat, ca, "coreaudio_init_hooks", - "set disconnect callback")) + "set disconnect callback")) return false; stat = add_listener(ca, PROPERTY_FORMATS); if (!ca_success(stat, ca, "coreaudio_init_hooks", - "set format change callback")) + "set format change callback")) return false; if (ca->default_device) { AudioObjectPropertyAddress addr = { PROPERTY_DEFAULT_DEVICE, kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; + kAudioObjectPropertyElementMaster}; stat = AudioObjectAddPropertyListener(kAudioObjectSystemObject, - &addr, notification_callback, ca); + &addr, + notification_callback, + ca); if (!ca_success(stat, ca, "coreaudio_init_hooks", - "set device change callback")) + "set device change callback")) return false; } stat = set_property(ca->unit, kAudioOutputUnitProperty_SetInputCallback, - SCOPE_GLOBAL, 0, &callback_info, sizeof(callback_info)); + SCOPE_GLOBAL, 0, &callback_info, + sizeof(callback_info)); if (!ca_success(stat, ca, "coreaudio_init_hooks", "set input callback")) return false; @@ -464,32 +471,29 @@ static void coreaudio_remove_hooks(struct coreaudio_data *ca) { - AURenderCallbackStruct callback_info = { - .inputProc = NULL, - .inputProcRefCon = NULL - }; + AURenderCallbackStruct callback_info = {.inputProc = NULL, + .inputProcRefCon = NULL}; - AudioObjectPropertyAddress addr = { - kAudioDevicePropertyDeviceIsAlive, - kAudioObjectPropertyScopeGlobal, - kAudioObjectPropertyElementMaster - }; + AudioObjectPropertyAddress addr = {kAudioDevicePropertyDeviceIsAlive, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster}; AudioObjectRemovePropertyListener(ca->device_id, &addr, - notification_callback, ca); + notification_callback, ca); addr.mSelector = PROPERTY_FORMATS; AudioObjectRemovePropertyListener(ca->device_id, &addr, - notification_callback, ca); + notification_callback, ca); if (ca->default_device) { addr.mSelector = PROPERTY_DEFAULT_DEVICE; AudioObjectRemovePropertyListener(kAudioObjectSystemObject, - &addr, notification_callback, ca); + &addr, notification_callback, + ca); } set_property(ca->unit, kAudioOutputUnitProperty_SetInputCallback, - SCOPE_GLOBAL, 0, &callback_info, sizeof(callback_info)); + SCOPE_GLOBAL, 0, &callback_info, sizeof(callback_info)); } static bool coreaudio_get_device_name(struct coreaudio_data *ca) @@ -501,21 +505,22 @@ const AudioObjectPropertyAddress addr = { kAudioDevicePropertyDeviceNameCFString, kAudioObjectPropertyScopeInput, - kAudioObjectPropertyElementMaster - }; + kAudioObjectPropertyElementMaster}; - OSStatus stat = AudioObjectGetPropertyData(ca->device_id, &addr, - 0, NULL, &size, &cf_name); + OSStatus stat = AudioObjectGetPropertyData(ca->device_id, &addr, 0, + NULL, &size, &cf_name); if (stat != noErr) { - blog(LOG_WARNING, "[coreaudio_get_device_name] failed to " - "get name: %d", (int)stat); + blog(LOG_WARNING, + "[coreaudio_get_device_name] failed to " + "get name: %d", + (int)stat); return false; } name = cfstr_copy_cstr(cf_name, kCFStringEncodingUTF8); if (!name) { blog(LOG_WARNING, "[coreaudio_get_device_name] failed to " - "convert name to cstr for some reason"); + "convert name to cstr for some reason"); return false; } @@ -555,9 +560,8 @@ static bool coreaudio_init_unit(struct coreaudio_data *ca) { AudioComponentDescription desc = { - .componentType = kAudioUnitType_Output, - .componentSubType = kAudioUnitSubType_HALOutput - }; + .componentType = kAudioUnitType_Output, + .componentSubType = kAudioUnitSubType_HALOutput}; AudioComponent component = AudioComponentFindNext(NULL, &desc); if (!component) { @@ -596,7 +600,8 @@ goto fail; stat = set_property(ca->unit, kAudioOutputUnitProperty_CurrentDevice, - SCOPE_GLOBAL, 0, &ca->device_id, sizeof(ca->device_id)); + SCOPE_GLOBAL, 0, &ca->device_id, + sizeof(ca->device_id)); if (!ca_success(stat, ca, "coreaudio_init", "set current device")) goto fail; @@ -625,9 +630,10 @@ static void coreaudio_try_init(struct coreaudio_data *ca) { if (!coreaudio_init(ca)) { - blog(LOG_INFO, "coreaudio: failed to find device " - "uid: %s, waiting for connection", - ca->device_uid); + blog(LOG_INFO, + "coreaudio: failed to find device " + "uid: %s, waiting for connection", + ca->device_uid); ca->retry_time = 2000; @@ -723,20 +729,22 @@ } static void *coreaudio_create(obs_data_t *settings, obs_source_t *source, - bool input) + bool input) { struct coreaudio_data *ca = bzalloc(sizeof(struct coreaudio_data)); if (os_event_init(&ca->exit_event, OS_EVENT_TYPE_MANUAL) != 0) { - blog(LOG_ERROR, "[coreaudio_create] failed to create " - "semephore: %d", errno); + blog(LOG_ERROR, + "[coreaudio_create] failed to create " + "semephore: %d", + errno); bfree(ca); return NULL; } ca->device_uid = bstrdup(obs_data_get_string(settings, "device_id")); - ca->source = source; - ca->input = input; + ca->source = source; + ca->input = input; if (!ca->device_uid) ca->device_uid = bstrdup("default"); @@ -746,38 +754,39 @@ } static void *coreaudio_create_input_capture(obs_data_t *settings, - obs_source_t *source) + obs_source_t *source) { return coreaudio_create(settings, source, true); } static void *coreaudio_create_output_capture(obs_data_t *settings, - obs_source_t *source) + obs_source_t *source) { return coreaudio_create(settings, source, false); } static obs_properties_t *coreaudio_properties(bool input) { - obs_properties_t *props = obs_properties_create(); - obs_property_t *property; + obs_properties_t *props = obs_properties_create(); + obs_property_t *property; struct device_list devices; memset(&devices, 0, sizeof(struct device_list)); property = obs_properties_add_list(props, "device_id", TEXT_DEVICE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); coreaudio_enum_devices(&devices, input); if (devices.items.num) obs_property_list_add_string(property, TEXT_DEVICE_DEFAULT, - "default"); + "default"); for (size_t i = 0; i < devices.items.num; i++) { - struct device_item *item = devices.items.array+i; - obs_property_list_add_string(property, - item->name.array, item->value.array); + struct device_item *item = devices.items.array + i; + obs_property_list_add_string(property, item->name.array, + item->value.array); } device_list_free(&devices); @@ -799,28 +808,26 @@ } struct obs_source_info coreaudio_input_capture_info = { - .id = "coreaudio_input_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_AUDIO | - OBS_SOURCE_DO_NOT_DUPLICATE, - .get_name = coreaudio_input_getname, - .create = coreaudio_create_input_capture, - .destroy = coreaudio_destroy, - .update = coreaudio_update, - .get_defaults = coreaudio_defaults, - .get_properties = coreaudio_input_properties + .id = "coreaudio_input_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_AUDIO | OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = coreaudio_input_getname, + .create = coreaudio_create_input_capture, + .destroy = coreaudio_destroy, + .update = coreaudio_update, + .get_defaults = coreaudio_defaults, + .get_properties = coreaudio_input_properties, }; struct obs_source_info coreaudio_output_capture_info = { - .id = "coreaudio_output_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_AUDIO | - OBS_SOURCE_DO_NOT_DUPLICATE | - OBS_SOURCE_DO_NOT_SELF_MONITOR, - .get_name = coreaudio_output_getname, - .create = coreaudio_create_output_capture, - .destroy = coreaudio_destroy, - .update = coreaudio_update, - .get_defaults = coreaudio_defaults, - .get_properties = coreaudio_output_properties + .id = "coreaudio_output_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_AUDIO | OBS_SOURCE_DO_NOT_DUPLICATE | + OBS_SOURCE_DO_NOT_SELF_MONITOR, + .get_name = coreaudio_output_getname, + .create = coreaudio_create_output_capture, + .destroy = coreaudio_destroy, + .update = coreaudio_update, + .get_defaults = coreaudio_defaults, + .get_properties = coreaudio_output_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/mac-display-capture.m -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/mac-display-capture.m
Changed
@@ -120,16 +120,15 @@ if (!requires_window(dc->crop)) return; - NSArray *arr = (NSArray*)CGWindowListCopyWindowInfo( - kCGWindowListOptionIncludingWindow, - dc->window.window_id); - + NSArray *arr = (NSArray *)CGWindowListCopyWindowInfo( + kCGWindowListOptionIncludingWindow, dc->window.window_id); + if (arr.count) { NSDictionary *dict = arr[0]; - NSDictionary *ref = dict[(NSString*)kCGWindowBounds]; + NSDictionary *ref = dict[(NSString *)kCGWindowBounds]; CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)ref, - &dc->window_rect); - dc->on_screen = dict[(NSString*)kCGWindowIsOnscreen] != nil; + &dc->window_rect); + dc->on_screen = dict[(NSString *)kCGWindowIsOnscreen] != nil; dc->window_rect = [dc->screen convertRectToBacking:dc->window_rect]; @@ -144,8 +143,10 @@ } static inline void display_stream_update(struct display_capture *dc, - CGDisplayStreamFrameStatus status, uint64_t display_time, - IOSurfaceRef frame_surface, CGDisplayStreamUpdateRef update_ref) + CGDisplayStreamFrameStatus status, + uint64_t display_time, + IOSurfaceRef frame_surface, + CGDisplayStreamUpdateRef update_ref) { UNUSED_PARAMETER(display_time); UNUSED_PARAMETER(update_ref); @@ -176,8 +177,7 @@ size_t dropped_frames = CGDisplayStreamUpdateGetDropCount(update_ref); if (dropped_frames > 0) blog(LOG_INFO, "%s: Dropped %zu frames", - obs_source_get_name(dc->source), - dropped_frames); + obs_source_get_name(dc->source), dropped_frames); } static bool init_display_stream(struct display_capture *dc) @@ -192,38 +192,34 @@ NSNumber *screen_num = dc->screen.deviceDescription[@"NSScreenNumber"]; CGDirectDisplayID disp_id = (CGDirectDisplayID)screen_num.pointerValue; - NSDictionary *rect_dict = CFBridgingRelease( - CGRectCreateDictionaryRepresentation( - CGRectMake(0, 0, - dc->screen.frame.size.width, - dc->screen.frame.size.height))); + NSDictionary *rect_dict = + CFBridgingRelease(CGRectCreateDictionaryRepresentation( + CGRectMake(0, 0, dc->screen.frame.size.width, + dc->screen.frame.size.height))); - CFBooleanRef show_cursor_cf = - dc->hide_cursor ? kCFBooleanFalse : kCFBooleanTrue; + CFBooleanRef show_cursor_cf = dc->hide_cursor ? kCFBooleanFalse + : kCFBooleanTrue; NSDictionary *dict = @{ - (__bridge NSString*)kCGDisplayStreamSourceRect: rect_dict, - (__bridge NSString*)kCGDisplayStreamQueueDepth: @5, - (__bridge NSString*)kCGDisplayStreamShowCursor: - (id)show_cursor_cf, + (__bridge NSString *)kCGDisplayStreamSourceRect: rect_dict, + (__bridge NSString *)kCGDisplayStreamQueueDepth: @5, + (__bridge NSString *) + kCGDisplayStreamShowCursor: (id)show_cursor_cf, }; os_event_init(&dc->disp_finished, OS_EVENT_TYPE_MANUAL); const CGSize *size = &dc->frame.size; - dc->disp = CGDisplayStreamCreateWithDispatchQueue(disp_id, - size->width, size->height, 'BGRA', - (__bridge CFDictionaryRef)dict, - dispatch_queue_create(NULL, NULL), - ^(CGDisplayStreamFrameStatus status, - uint64_t displayTime, - IOSurfaceRef frameSurface, - CGDisplayStreamUpdateRef updateRef) - { - display_stream_update(dc, status, displayTime, - frameSurface, updateRef); - } - ); + dc->disp = CGDisplayStreamCreateWithDispatchQueue( + disp_id, size->width, size->height, 'BGRA', + (__bridge CFDictionaryRef)dict, + dispatch_queue_create(NULL, NULL), + ^(CGDisplayStreamFrameStatus status, uint64_t displayTime, + IOSurfaceRef frameSurface, + CGDisplayStreamUpdateRef updateRef) { + display_stream_update(dc, status, displayTime, + frameSurface, updateRef); + }); return !CGDisplayStreamStart(dc->disp); } @@ -252,8 +248,7 @@ void load_crop(struct display_capture *dc, obs_data_t *settings); -static void *display_capture_create(obs_data_t *settings, - obs_source_t *source) +static void *display_capture_create(obs_data_t *settings, obs_source_t *source) { UNUSED_PARAMETER(source); UNUSED_PARAMETER(settings); @@ -303,25 +298,24 @@ } static void build_sprite(struct gs_vb_data *data, float fcx, float fcy, - float start_u, float end_u, float start_v, float end_v) + float start_u, float end_u, float start_v, float end_v) { struct vec2 *tvarray = data->tvarray[0].array; - vec3_set(data->points+1, fcx, 0.0f, 0.0f); - vec3_set(data->points+2, 0.0f, fcy, 0.0f); - vec3_set(data->points+3, fcx, fcy, 0.0f); - vec2_set(tvarray, start_u, start_v); - vec2_set(tvarray+1, end_u, start_v); - vec2_set(tvarray+2, start_u, end_v); - vec2_set(tvarray+3, end_u, end_v); + vec3_set(data->points + 1, fcx, 0.0f, 0.0f); + vec3_set(data->points + 2, 0.0f, fcy, 0.0f); + vec3_set(data->points + 3, fcx, fcy, 0.0f); + vec2_set(tvarray, start_u, start_v); + vec2_set(tvarray + 1, end_u, start_v); + vec2_set(tvarray + 2, start_u, end_v); + vec2_set(tvarray + 3, end_u, end_v); } -static inline void build_sprite_rect(struct gs_vb_data *data, - float origin_x, float origin_y, float end_x, float end_y) +static inline void build_sprite_rect(struct gs_vb_data *data, float origin_x, + float origin_y, float end_x, float end_y) { build_sprite(data, fabs(end_x - origin_x), fabs(end_y - origin_y), - origin_x, end_x, - origin_y, end_y); + origin_x, end_x, origin_y, end_y); } static void display_capture_video_tick(void *data, float seconds) @@ -348,8 +342,8 @@ if (requires_window(dc->crop) && !dc->on_screen) goto cleanup; - CGPoint origin = { 0.f }; - CGPoint end = { 0.f }; + CGPoint origin = {0.f}; + CGPoint end = {0.f}; switch (dc->crop) { float x, y; @@ -379,10 +373,9 @@ break; } - obs_enter_graphics(); - build_sprite_rect(gs_vertexbuffer_get_data(dc->vertbuf), - origin.x, origin.y, end.x, end.y); + build_sprite_rect(gs_vertexbuffer_get_data(dc->vertbuf), origin.x, + origin.y, end.x, end.y); if (dc->tex) gs_texture_rebind_iosurface(dc->tex, dc->prev); @@ -412,7 +405,7 @@ gs_load_samplerstate(dc->sampler, 0); gs_technique_t *tech = gs_effect_get_technique(dc->effect, "Draw"); gs_effect_set_texture(gs_effect_get_param_by_name(dc->effect, "image"), - dc->tex); + dc->tex); gs_technique_begin(tech); gs_technique_begin_pass(tech, 0); @@ -428,9 +421,9 @@ return obs_module_text("DisplayCapture"); } -#define CROPPED_LENGTH(rect, origin_, length) \ - fabs((rect ## .size. ## length - dc->crop_rect.size. ## length) - \ - (rect ## .origin. ## origin_ + dc->crop_rect.origin. ## origin_)) +#define CROPPED_LENGTH(rect, origin_, length) \ + fabs((rect##.size.##length - dc->crop_rect.size.##length) - \ + (rect##.origin.##origin_ + dc->crop_rect.origin.##origin_)) static uint32_t display_capture_getwidth(void *data) { @@ -502,20 +495,20 @@ #define CROP_VAR_NAME(var, mode) (mode "." #var) #define LOAD_CROP_VAR(var, mode) \ - dc->crop_rect.var = obs_data_get_double(settings, \ - CROP_VAR_NAME(var, mode)); + dc->crop_rect.var = \ + obs_data_get_double(settings, CROP_VAR_NAME(var, mode)); switch (dc->crop) { case CROP_MANUAL: - LOAD_CROP_VAR(origin.x, "manual"); - LOAD_CROP_VAR(origin.y, "manual"); - LOAD_CROP_VAR(size.width, "manual"); + LOAD_CROP_VAR(origin.x, "manual"); + LOAD_CROP_VAR(origin.y, "manual"); + LOAD_CROP_VAR(size.width, "manual"); LOAD_CROP_VAR(size.height, "manual"); break; case CROP_TO_WINDOW_AND_MANUAL: - LOAD_CROP_VAR(origin.x, "window"); - LOAD_CROP_VAR(origin.y, "window"); - LOAD_CROP_VAR(size.width, "window"); + LOAD_CROP_VAR(origin.x, "window"); + LOAD_CROP_VAR(origin.y, "window"); + LOAD_CROP_VAR(size.width, "window"); LOAD_CROP_VAR(size.height, "window"); break; @@ -552,7 +545,7 @@ } static bool switch_crop_mode(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { UNUSED_PARAMETER(p); @@ -561,20 +554,20 @@ const char *name; bool visible; -#define LOAD_CROP_VAR(var, mode) \ +#define LOAD_CROP_VAR(var, mode) \ name = CROP_VAR_NAME(var, mode); \ obs_property_set_visible(obs_properties_get(props, name), visible); visible = crop == CROP_MANUAL; - LOAD_CROP_VAR(origin.x, "manual"); - LOAD_CROP_VAR(origin.y, "manual"); - LOAD_CROP_VAR(size.width, "manual"); + LOAD_CROP_VAR(origin.x, "manual"); + LOAD_CROP_VAR(origin.y, "manual"); + LOAD_CROP_VAR(size.width, "manual"); LOAD_CROP_VAR(size.height, "manual"); visible = crop == CROP_TO_WINDOW_AND_MANUAL; - LOAD_CROP_VAR(origin.x, "window"); - LOAD_CROP_VAR(origin.y, "window"); - LOAD_CROP_VAR(size.width, "window"); + LOAD_CROP_VAR(origin.x, "window"); + LOAD_CROP_VAR(origin.y, "window"); + LOAD_CROP_VAR(size.width, "window"); LOAD_CROP_VAR(size.height, "window"); #undef LOAD_CROP_VAR @@ -582,15 +575,12 @@ return true; } -static const char *crop_names[] = { - "CropMode.None", - "CropMode.Manual", - "CropMode.ToWindow", - "CropMode.ToWindowAndManual" -}; +static const char *crop_names[] = {"CropMode.None", "CropMode.Manual", + "CropMode.ToWindow", + "CropMode.ToWindowAndManual"}; #ifndef COUNTOF -#define COUNTOF(x) (sizeof(x)/sizeof(x[0])) +#define COUNTOF(x) (sizeof(x) / sizeof(x[0])) #endif static obs_properties_t *display_capture_properties(void *unused) { @@ -598,9 +588,9 @@ obs_properties_t *props = obs_properties_create(); - obs_property_t *list = obs_properties_add_list(props, - "display", obs_module_text("DisplayCapture.Display"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *list = obs_properties_add_list( + props, "display", obs_module_text("DisplayCapture.Display"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); for (unsigned i = 0; i < [NSScreen screens].count; i++) { char buf[10]; @@ -609,11 +599,11 @@ } obs_properties_add_bool(props, "show_cursor", - obs_module_text("DisplayCapture.ShowCursor")); + obs_module_text("DisplayCapture.ShowCursor")); - obs_property_t *crop = obs_properties_add_list(props, "crop_mode", - obs_module_text("CropMode"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *crop = obs_properties_add_list( + props, "crop_mode", obs_module_text("CropMode"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_set_modified_callback(crop, switch_crop_mode); for (unsigned i = 0; i < COUNTOF(crop_names); i++) { @@ -627,22 +617,22 @@ obs_property_t *p; const char *name; float min; -#define LOAD_CROP_VAR(var, mode) \ - name = CROP_VAR_NAME(var, mode); \ - p = obs_properties_add_float(props, name, \ - obs_module_text("Crop."#var), min, 4096.f, .5f); \ +#define LOAD_CROP_VAR(var, mode) \ + name = CROP_VAR_NAME(var, mode); \ + p = obs_properties_add_float( \ + props, name, obs_module_text("Crop." #var), min, 4096.f, .5f); \ obs_property_set_visible(p, false); min = 0.f; - LOAD_CROP_VAR(origin.x, "manual"); - LOAD_CROP_VAR(origin.y, "manual"); - LOAD_CROP_VAR(size.width, "manual"); + LOAD_CROP_VAR(origin.x, "manual"); + LOAD_CROP_VAR(origin.y, "manual"); + LOAD_CROP_VAR(size.width, "manual"); LOAD_CROP_VAR(size.height, "manual"); min = -4096.f; - LOAD_CROP_VAR(origin.x, "window"); - LOAD_CROP_VAR(origin.y, "window"); - LOAD_CROP_VAR(size.width, "window"); + LOAD_CROP_VAR(origin.x, "window"); + LOAD_CROP_VAR(origin.y, "window"); + LOAD_CROP_VAR(size.width, "window"); LOAD_CROP_VAR(size.height, "window"); #undef LOAD_CROP_VAR @@ -650,22 +640,22 @@ } struct obs_source_info display_capture_info = { - .id = "display_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .get_name = display_capture_getname, + .id = "display_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .get_name = display_capture_getname, - .create = display_capture_create, - .destroy = display_capture_destroy, + .create = display_capture_create, + .destroy = display_capture_destroy, - .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_DO_NOT_DUPLICATE, - .video_tick = display_capture_video_tick, - .video_render = display_capture_video_render, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | + OBS_SOURCE_DO_NOT_DUPLICATE, + .video_tick = display_capture_video_tick, + .video_render = display_capture_video_render, - .get_width = display_capture_getwidth, - .get_height = display_capture_getheight, + .get_width = display_capture_getwidth, + .get_height = display_capture_getheight, - .get_defaults = display_capture_defaults, + .get_defaults = display_capture_defaults, .get_properties = display_capture_properties, - .update = display_capture_update, + .update = display_capture_update, };
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/mac-window-capture.m -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/mac-window-capture.m
Changed
@@ -21,61 +21,59 @@ DARRAY(uint8_t) buffer; - pthread_t capture_thread; + pthread_t capture_thread; os_event_t *capture_event; os_event_t *stop_event; }; static CGImageRef get_image(struct window_capture *wc) { - NSArray *arr = (NSArray*)CGWindowListCreate( - kCGWindowListOptionIncludingWindow, - wc->window.window_id); + NSArray *arr = (NSArray *)CGWindowListCreate( + kCGWindowListOptionIncludingWindow, wc->window.window_id); [arr autorelease]; if (arr.count) - return CGWindowListCreateImage(CGRectNull, - kCGWindowListOptionIncludingWindow, - wc->window.window_id, wc->image_option); + return CGWindowListCreateImage( + CGRectNull, kCGWindowListOptionIncludingWindow, + wc->window.window_id, wc->image_option); if (!find_window(&wc->window, NULL, false)) return NULL; return CGWindowListCreateImage(CGRectNull, - kCGWindowListOptionIncludingWindow, - wc->window.window_id, wc->image_option); + kCGWindowListOptionIncludingWindow, + wc->window.window_id, wc->image_option); } static inline void capture_frame(struct window_capture *wc) { - uint64_t ts = os_gettime_ns(); + uint64_t ts = os_gettime_ns(); CGImageRef img = get_image(wc); if (!img) return; - size_t width = CGImageGetWidth(img); + size_t width = CGImageGetWidth(img); size_t height = CGImageGetHeight(img); CGRect rect = {{0, 0}, {width, height}}; da_reserve(wc->buffer, width * height * 4); uint8_t *data = wc->buffer.array; - CGContextRef cg_context = CGBitmapContextCreate(data, width, height, - 8, width * 4, wc->color_space, - kCGBitmapByteOrder32Host | - kCGImageAlphaPremultipliedFirst); + CGContextRef cg_context = CGBitmapContextCreate( + data, width, height, 8, width * 4, wc->color_space, + kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst); CGContextSetBlendMode(cg_context, kCGBlendModeCopy); CGContextDrawImage(cg_context, rect, img); CGContextRelease(cg_context); CGImageRelease(img); struct obs_source_frame frame = { - .format = VIDEO_FORMAT_BGRA, - .width = width, - .height = height, - .data[0] = data, + .format = VIDEO_FORMAT_BGRA, + .width = width, + .height = height, + .data[0] = data, .linesize[0] = width * 4, - .timestamp = ts, + .timestamp = ts, }; obs_source_output_video(wc->source, &frame); @@ -99,7 +97,7 @@ } static inline void *window_capture_create_internal(obs_data_t *settings, - obs_source_t *source) + obs_source_t *source) { struct window_capture *wc = bzalloc(sizeof(struct window_capture)); @@ -111,8 +109,9 @@ init_window(&wc->window, settings); - wc->image_option = obs_data_get_bool(settings, "show_shadow") ? - kCGWindowImageDefault : kCGWindowImageBoundsIgnoreFraming; + wc->image_option = obs_data_get_bool(settings, "show_shadow") + ? kCGWindowImageDefault + : kCGWindowImageBoundsIgnoreFraming; os_event_init(&wc->capture_event, OS_EVENT_TYPE_AUTO); os_event_init(&wc->stop_event, OS_EVENT_TYPE_MANUAL); @@ -135,7 +134,7 @@ os_event_signal(cap->stop_event); os_event_signal(cap->capture_event); - + pthread_join(cap->capture_thread, NULL); CGColorSpaceRelease(cap->color_space); @@ -165,26 +164,28 @@ add_window_properties(props); obs_properties_add_bool(props, "show_shadow", - obs_module_text("WindowCapture.ShowShadow")); + obs_module_text("WindowCapture.ShowShadow")); return props; } static inline void window_capture_update_internal(struct window_capture *wc, - obs_data_t *settings) + obs_data_t *settings) { - wc->image_option = obs_data_get_bool(settings, "show_shadow") ? - kCGWindowImageDefault : kCGWindowImageBoundsIgnoreFraming; + wc->image_option = obs_data_get_bool(settings, "show_shadow") + ? kCGWindowImageDefault + : kCGWindowImageBoundsIgnoreFraming; update_window(&wc->window, settings); if (wc->window.window_name.length) { - blog(LOG_INFO, "[window-capture: '%s'] update settings:\n" - "\twindow: %s\n" - "\towner: %s", - obs_source_get_name(wc->source), - [wc->window.window_name UTF8String], - [wc->window.owner_name UTF8String]); + blog(LOG_INFO, + "[window-capture: '%s'] update settings:\n" + "\twindow: %s\n" + "\towner: %s", + obs_source_get_name(wc->source), + [wc->window.window_name UTF8String], + [wc->window.owner_name UTF8String]); } } @@ -202,7 +203,7 @@ } static inline void window_capture_tick_internal(struct window_capture *wc, - float seconds) + float seconds) { UNUSED_PARAMETER(seconds); os_event_signal(wc->capture_event); @@ -221,17 +222,17 @@ } struct obs_source_info window_capture_info = { - .id = "window_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .get_name = window_capture_getname, + .id = "window_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .get_name = window_capture_getname, - .create = window_capture_create, - .destroy = window_capture_destroy, + .create = window_capture_create, + .destroy = window_capture_destroy, - .output_flags = OBS_SOURCE_ASYNC_VIDEO, - .video_tick = window_capture_tick, + .output_flags = OBS_SOURCE_ASYNC_VIDEO, + .video_tick = window_capture_tick, - .get_defaults = window_capture_defaults, + .get_defaults = window_capture_defaults, .get_properties = window_capture_properties, - .update = window_capture_update, + .update = window_capture_update, };
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/window-utils.h -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/window-utils.h
Changed
@@ -5,11 +5,11 @@ #include <obs-module.h> struct cocoa_window { - CGWindowID window_id; + CGWindowID window_id; pthread_mutex_t name_lock; - NSString *owner_name; - NSString *window_name; + NSString *owner_name; + NSString *window_name; uint64_t next_search_time; };
View file
obs-studio-23.2.1.tar.xz/plugins/mac-capture/window-utils.m -> obs-studio-24.0.0.tar.xz/plugins/mac-capture/window-utils.m
Changed
@@ -2,13 +2,12 @@ #include <util/platform.h> -#define WINDOW_NAME ((NSString*)kCGWindowName) -#define WINDOW_NUMBER ((NSString*)kCGWindowNumber) -#define OWNER_NAME ((NSString*)kCGWindowOwnerName) -#define OWNER_PID ((NSNumber*)kCGWindowOwnerPID) +#define WINDOW_NAME ((NSString *)kCGWindowName) +#define WINDOW_NUMBER ((NSString *)kCGWindowNumber) +#define OWNER_NAME ((NSString *)kCGWindowOwnerName) +#define OWNER_PID ((NSNumber *)kCGWindowOwnerPID) -static NSComparator win_info_cmp = ^(NSDictionary *o1, NSDictionary *o2) -{ +static NSComparator win_info_cmp = ^(NSDictionary *o1, NSDictionary *o2) { NSComparisonResult res = [o1[OWNER_NAME] compare:o2[OWNER_NAME]]; if (res != NSOrderedSame) return res; @@ -26,9 +25,8 @@ NSArray *enumerate_windows(void) { - NSArray *arr = (NSArray*)CGWindowListCopyWindowInfo( - kCGWindowListOptionOnScreenOnly, - kCGNullWindowID); + NSArray *arr = (NSArray *)CGWindowListCopyWindowInfo( + kCGWindowListOptionOnScreenOnly, kCGNullWindowID); [arr autorelease]; @@ -60,8 +58,8 @@ pthread_mutex_unlock(&cw->name_lock); - NSNumber *window_id = (NSNumber*)dict[WINDOW_NUMBER]; - cw->window_id = window_id.intValue; + NSNumber *window_id = (NSNumber *)dict[WINDOW_NUMBER]; + cw->window_id = window_id.intValue; obs_data_set_int(settings, "window", cw->window_id); return true; @@ -76,9 +74,9 @@ { pthread_mutex_init(&cw->name_lock, NULL); - cw->owner_name = @(obs_data_get_string(settings, "owner_name")); + cw->owner_name = @(obs_data_get_string(settings, "owner_name")); cw->window_name = @(obs_data_get_string(settings, "window_name")); - [cw->owner_name retain]; + [cw->owner_name retain]; [cw->window_name retain]; find_window(cw, settings, true); } @@ -86,22 +84,22 @@ void destroy_window(cocoa_window_t cw) { pthread_mutex_destroy(&cw->name_lock); - [cw->owner_name release]; + [cw->owner_name release]; [cw->window_name release]; } void update_window(cocoa_window_t cw, obs_data_t *settings) { pthread_mutex_lock(&cw->name_lock); - [cw->owner_name release]; + [cw->owner_name release]; [cw->window_name release]; - cw->owner_name = @(obs_data_get_string(settings, "owner_name")); - cw->window_name = @(obs_data_get_string(settings, "window_name")); - [cw->owner_name retain]; + cw->owner_name = @(obs_data_get_string(settings, "owner_name")); + cw->window_name = @(obs_data_get_string(settings, "window_name")); + [cw->owner_name retain]; [cw->window_name retain]; pthread_mutex_unlock(&cw->name_lock); - cw->window_id = obs_data_get_int(settings, "window"); + cw->window_id = obs_data_get_int(settings, "window"); } static inline const char *make_name(NSString *owner, NSString *name) @@ -116,7 +114,7 @@ static inline NSDictionary *find_window_dict(NSArray *arr, int window_id) { for (NSDictionary *dict in arr) { - NSNumber *wid = (NSNumber*)dict[WINDOW_NUMBER]; + NSNumber *wid = (NSNumber *)dict[WINDOW_NUMBER]; if (wid.intValue == window_id) return dict; } @@ -125,12 +123,11 @@ } static inline bool window_changed_internal(obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { - int window_id = obs_data_get_int(settings, "window"); + int window_id = obs_data_get_int(settings, "window"); NSString *window_owner = @(obs_data_get_string(settings, "owner_name")); - NSString *window_name = - @(obs_data_get_string(settings, "window_name")); + NSString *window_name = @(obs_data_get_string(settings, "window_name")); NSDictionary *win_info = @{ OWNER_NAME: window_owner, @@ -147,39 +144,38 @@ obs_property_list_clear(p); for (NSDictionary *dict in arr) { - NSString *owner = (NSString*)dict[OWNER_NAME]; - NSString *name = (NSString*)dict[WINDOW_NAME]; - NSNumber *wid = (NSNumber*)dict[WINDOW_NUMBER]; + NSString *owner = (NSString *)dict[OWNER_NAME]; + NSString *name = (NSString *)dict[WINDOW_NAME]; + NSNumber *wid = (NSNumber *)dict[WINDOW_NUMBER]; if (!window_added && - win_info_cmp(win_info, dict) == NSOrderedAscending) { + win_info_cmp(win_info, dict) == NSOrderedAscending) { window_added = true; - size_t idx = obs_property_list_add_int(p, - make_name(window_owner, window_name), - window_id); + size_t idx = obs_property_list_add_int( + p, make_name(window_owner, window_name), + window_id); obs_property_list_item_disable(p, idx, true); } if (!show_empty_names && !name.length && - window_id != wid.intValue) + window_id != wid.intValue) continue; obs_property_list_add_int(p, make_name(owner, name), - wid.intValue); + wid.intValue); } if (!window_added) { - size_t idx = obs_property_list_add_int(p, - make_name(window_owner, window_name), - window_id); + size_t idx = obs_property_list_add_int( + p, make_name(window_owner, window_name), window_id); obs_property_list_item_disable(p, idx, true); } if (!window_found) return true; - NSString *owner = (NSString*)cur[OWNER_NAME]; - NSString *window = (NSString*)cur[WINDOW_NAME]; + NSString *owner = (NSString *)cur[OWNER_NAME]; + NSString *window = (NSString *)cur[WINDOW_NAME]; obs_data_set_string(settings, "owner_name", owner.UTF8String); obs_data_set_string(settings, "window_name", window.UTF8String); @@ -188,7 +184,7 @@ } static bool window_changed(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { UNUSED_PARAMETER(props); @@ -198,12 +194,12 @@ } static bool toggle_empty_names(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { UNUSED_PARAMETER(p); return window_changed(props, obs_properties_get(props, "window"), - settings); + settings); } void window_defaults(obs_data_t *settings) @@ -214,20 +210,20 @@ void add_window_properties(obs_properties_t *props) { - obs_property_t *window_list = obs_properties_add_list(props, - "window", obs_module_text("WindowUtils.Window"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *window_list = obs_properties_add_list( + props, "window", obs_module_text("WindowUtils.Window"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_set_modified_callback(window_list, window_changed); - obs_property_t *empty = obs_properties_add_bool(props, - "show_empty_names", - obs_module_text("WindowUtils.ShowEmptyNames")); + obs_property_t *empty = obs_properties_add_bool( + props, "show_empty_names", + obs_module_text("WindowUtils.ShowEmptyNames")); obs_property_set_modified_callback(empty, toggle_empty_names); } void show_window_properties(obs_properties_t *props, bool show) { obs_property_set_visible(obs_properties_get(props, "window"), show); - obs_property_set_visible( - obs_properties_get(props, "show_empty_names"), show); + obs_property_set_visible(obs_properties_get(props, "show_empty_names"), + show); }
View file
obs-studio-23.2.1.tar.xz/plugins/mac-syphon/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-syphon/data/locale/de-DE.ini
Changed
@@ -1,9 +1,9 @@ -Syphon="Syphon-Client" +Syphon="Syphon‐Client" Source="Quelle" LaunchSyphonInject="SyphonInject starten" Inject="Injizieren" Application="Anwendung" -SyphonLicense="Syphon-Lizenz" +SyphonLicense="Syphon‐Lizenz" Crop="Zuschneiden" Crop.origin.x="Links abschneiden" Crop.origin.y="Oben abschneiden"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-syphon/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-syphon/data/locale/gl-ES.ini
Changed
@@ -1,12 +1,13 @@ +Syphon="Cliente Syphon" Source="Fonte" -LaunchSyphonInject="Lanzar SyphonInject" +LaunchSyphonInject="Iniciar SyphonInject" Inject="Inxectar" -Application="Aplicación" +Application="Aplicativo" SyphonLicense="Licenza Syphon" Crop="Recortar" -Crop.origin.x="Recortar á esquerda" -Crop.origin.y="Recortar arriba" -Crop.size.width="Recortar á dereita" -Crop.size.height="Recortar abaixo" +Crop.origin.x="Recortar pola esquerda" +Crop.origin.y="Recortar por riba" +Crop.size.width="Recortar pola dereita" +Crop.size.height="Recortar por baixo" AllowTransparency="Permitir transparencia"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-syphon/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-syphon/data/locale/sl-SI.ini
Changed
@@ -2,7 +2,7 @@ LaunchSyphonInject="Zaženi SyphonInject" Inject="Vstavi" Application="Aplikacija" -SyphonLicense="Syphon Licenca" +SyphonLicense="Licenca za Syphon" Crop="Obreži" Crop.origin.x="Obreži levo" Crop.origin.y="Obreži vrh"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-syphon/syphon.m -> obs-studio-24.0.0.tar.xz/plugins/mac-syphon/syphon.m
Changed
@@ -3,40 +3,41 @@ #import "syphon-framework/Syphon.h" #include <obs-module.h> -#define LOG(level, message, ...) \ - blog(level, "%s: " message, obs_source_get_name(s->source), ##__VA_ARGS__) +#define LOG(level, message, ...) \ + blog(level, "%s: " message, obs_source_get_name(s->source), \ + ##__VA_ARGS__) struct syphon { SYPHON_CLIENT_UNIQUE_CLASS_NAME *client; IOSurfaceRef ref; gs_samplerstate_t *sampler; - gs_effect_t *effect; - gs_vertbuffer_t *vertbuffer; - gs_texture_t *tex; - uint32_t width, height; - bool crop; - CGRect crop_rect; - bool allow_transparency; + gs_effect_t *effect; + gs_vertbuffer_t *vertbuffer; + gs_texture_t *tex; + uint32_t width, height; + bool crop; + CGRect crop_rect; + bool allow_transparency; obs_source_t *source; bool active; bool uuid_changed; - id new_server_listener; - id retire_listener; + id new_server_listener; + id retire_listener; NSString *app_name; NSString *name; NSString *uuid; obs_data_t *inject_info; - NSString *inject_app; - NSString *inject_uuid; - bool inject_active; - id launch_listener; - bool inject_server_found; - float inject_wait_time; + NSString *inject_app; + NSString *inject_uuid; + bool inject_active; + id launch_listener; + bool inject_server_found; + float inject_wait_time; }; typedef struct syphon *syphon_t; @@ -55,9 +56,9 @@ @interface OBSSyphonKVObserver : NSObject - (void)observeValueForKeyPath:(NSString *)keyPath - ofObject:(id)object - change:(NSDictionary *)change - context:(void *)context; + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context; @end static inline void handle_application_launch(syphon_t s, NSArray *new) @@ -73,9 +74,9 @@ @implementation OBSSyphonKVObserver - (void)observeValueForKeyPath:(NSString *)keyPath - ofObject:(id)object - change:(NSDictionary *)change - context:(void *)context + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context { UNUSED_PARAMETER(keyPath); UNUSED_PARAMETER(object); @@ -117,7 +118,7 @@ s->ref = NULL; } - s->width = 0; + s->width = 0; s->height = 0; obs_leave_graphics(); @@ -143,8 +144,10 @@ "VersionKey"); if (version.unsignedIntValue > 0) - LOG(LOG_WARNING, "Got server description version %d, " - "expected 0", version.unsignedIntValue); + LOG(LOG_WARNING, + "Got server description version %d, " + "expected 0", + version.unsignedIntValue); } static inline void check_description(syphon_t s, NSDictionary *desc) @@ -169,9 +172,10 @@ } NSString *surfaces_string = [NSString stringWithFormat:@"%@", surfaces]; - LOG(LOG_WARNING, "SyphonSurfaces does not contain" - "'SyphonSurfaceTypeIOSurface': %s", - surfaces_string.UTF8String); + LOG(LOG_WARNING, + "SyphonSurfaces does not contain" + "'SyphonSurfaceTypeIOSurface': %s", + surfaces_string.UTF8String); } static inline bool update_string(NSString **str, NSString *new) @@ -185,7 +189,7 @@ } static inline void handle_new_frame(syphon_t s, - SYPHON_CLIENT_UNIQUE_CLASS_NAME *client) + SYPHON_CLIENT_UNIQUE_CLASS_NAME *client) { IOSurfaceRef ref = [client IOSurface]; @@ -206,9 +210,9 @@ CFRelease(s->ref); } - s->ref = ref; - s->tex = gs_texture_create_from_iosurface(s->ref); - s->width = gs_texture_get_width(s->tex); + s->ref = ref; + s->tex = gs_texture_create_from_iosurface(s->ref); + s->width = gs_texture_get_width(s->tex); s->height = gs_texture_get_height(s->tex); obs_leave_graphics(); } @@ -230,7 +234,7 @@ if (!desc) { desc = servers[0]; if (update_string(&s->uuid, - desc[SyphonServerDescriptionUUIDKey])) + desc[SyphonServerDescriptionUUIDKey])) s->uuid_changed = true; } @@ -241,11 +245,11 @@ s->client = [[SYPHON_CLIENT_UNIQUE_CLASS_NAME alloc] initWithServerDescription:desc options:nil - newFrameHandler:^ - (SYPHON_CLIENT_UNIQUE_CLASS_NAME *client) - { - handle_new_frame(s, client); - }]; + newFrameHandler:^( + SYPHON_CLIENT_UNIQUE_CLASS_NAME + *client) { + handle_new_frame(s, client); + }]; } s->active = true; @@ -254,27 +258,27 @@ static inline void release_settings(syphon_t s) { [s->app_name release]; - [s->name release]; - [s->uuid release]; + [s->name release]; + [s->uuid release]; } static inline bool load_syphon_settings(syphon_t s, obs_data_t *settings) { NSString *app_name = @(obs_data_get_string(settings, "app_name")); - NSString *name = @(obs_data_get_string(settings, "name")); - bool equal_names = [app_name isEqual:s->app_name] && - [name isEqual:s->name]; + NSString *name = @(obs_data_get_string(settings, "name")); + bool equal_names = [app_name isEqual:s->app_name] && + [name isEqual:s->name]; if (s->uuid_changed && equal_names) return false; - NSString *uuid = @(obs_data_get_string(settings, "uuid")); + NSString *uuid = @(obs_data_get_string(settings, "uuid")); if ([uuid isEqual:s->uuid] && equal_names) return false; release_settings(s); - s->app_name = [app_name retain]; - s->name = [name retain]; - s->uuid = [uuid retain]; + s->app_name = [app_name retain]; + s->name = [name retain]; + s->uuid = [uuid retain]; s->uuid_changed = false; return true; } @@ -288,15 +292,15 @@ return; NSString *app_name = info[SyphonServerDescriptionAppNameKey]; - NSString *name = info[SyphonServerDescriptionNameKey]; - NSString *uuid = info[SyphonServerDescriptionUUIDKey]; + NSString *name = info[SyphonServerDescriptionNameKey]; + NSString *uuid = info[SyphonServerDescriptionUUIDKey]; if (![uuid isEqual:s->uuid] && - !([app_name isEqual:s->app_name] && [name isEqual:s->name])) + !([app_name isEqual:s->app_name] && [name isEqual:s->name])) return; update_string(&s->app_name, app_name); - update_string(&s->name, name); + update_string(&s->name, name); if (update_string(&s->uuid, uuid)) s->uuid_changed = true; @@ -304,27 +308,28 @@ } static inline void update_inject_state(syphon_t s, NSDictionary *info, - bool announce) + bool announce) { if (!info) return; NSString *app_name = info[SyphonServerDescriptionAppNameKey]; - NSString *name = info[SyphonServerDescriptionNameKey]; - NSString *uuid = info[SyphonServerDescriptionUUIDKey]; + NSString *name = info[SyphonServerDescriptionNameKey]; + NSString *uuid = info[SyphonServerDescriptionUUIDKey]; if (![uuid isEqual:s->inject_uuid] && - (![app_name isEqual:s->inject_app] - || ![name isEqual:@"InjectedSyphon"])) + (![app_name isEqual:s->inject_app] || + ![name isEqual:@"InjectedSyphon"])) return; if (!(s->inject_server_found = announce)) { s->inject_wait_time = 0.f; objc_release(&s->inject_uuid); - LOG(LOG_INFO, "Injected server retired: " - "[%s] InjectedSyphon (%s)", - s->inject_app.UTF8String, uuid.UTF8String); + LOG(LOG_INFO, + "Injected server retired: " + "[%s] InjectedSyphon (%s)", + s->inject_app.UTF8String, uuid.UTF8String); return; } @@ -333,8 +338,7 @@ s->inject_uuid = [uuid retain]; LOG(LOG_INFO, "Injected server found: [%s] %s (%s)", - app_name.UTF8String, name.UTF8String, - uuid.UTF8String); + app_name.UTF8String, name.UTF8String, uuid.UTF8String); } static inline void handle_announce(syphon_t s, NSNotification *note) @@ -406,15 +410,15 @@ static inline bool init_obs_graphics_objects(syphon_t s) { struct gs_sampler_info info = { - .filter = GS_FILTER_LINEAR, - .address_u = GS_ADDRESS_CLAMP, - .address_v = GS_ADDRESS_CLAMP, - .address_w = GS_ADDRESS_CLAMP, + .filter = GS_FILTER_LINEAR, + .address_u = GS_ADDRESS_CLAMP, + .address_v = GS_ADDRESS_CLAMP, + .address_w = GS_ADDRESS_CLAMP, .max_anisotropy = 1, }; obs_enter_graphics(); - s->sampler = gs_samplerstate_create(&info); + s->sampler = gs_samplerstate_create(&info); s->vertbuffer = create_vertbuffer(); obs_leave_graphics(); @@ -426,25 +430,21 @@ static inline bool create_syphon_listeners(syphon_t s) { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - s->new_server_listener = [nc + s->new_server_listener = [nc addObserverForName:SyphonServerAnnounceNotification object:nil queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification *note) - { - handle_announce(s, note); - } - ]; + usingBlock:^(NSNotification *note) { + handle_announce(s, note); + }]; - s->retire_listener = [nc + s->retire_listener = [nc addObserverForName:SyphonServerRetireNotification object:nil queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification *note) - { - handle_retire(s, note); - } - ]; + usingBlock:^(NSNotification *note) { + handle_retire(s, note); + }]; return s->new_server_listener != nil && s->retire_listener != nil; } @@ -456,9 +456,9 @@ return false; [ws addObserver:s->launch_listener - forKeyPath:NSStringFromSelector(@selector(runningApplications)) - options:NSKeyValueObservingOptionNew - context:s]; + forKeyPath:NSStringFromSelector(@selector(runningApplications)) + options:NSKeyValueObservingOptionNew + context:s]; return true; } @@ -467,8 +467,7 @@ { s->crop = obs_data_get_bool(settings, "crop"); -#define LOAD_CROP(x) \ - s->crop_rect.x = obs_data_get_double(settings, "crop." #x) +#define LOAD_CROP(x) s->crop_rect.x = obs_data_get_double(settings, "crop." #x) LOAD_CROP(origin.x); LOAD_CROP(origin.y); LOAD_CROP(size.width); @@ -486,7 +485,7 @@ if (!s) return s; - s->source = source; + s->source = source; if (!init_obs_graphics_objects(s)) goto fail; @@ -495,9 +494,9 @@ goto fail; const char *inject_info = obs_data_get_string(settings, "application"); - s->inject_info = obs_data_create_from_json(inject_info); - s->inject_active = obs_data_get_bool(settings, "inject"); - s->inject_app = @(obs_data_get_string(s->inject_info, "name")); + s->inject_info = obs_data_create_from_json(inject_info); + s->inject_active = obs_data_get_bool(settings, "inject"); + s->inject_app = @(obs_data_get_string(s->inject_info, "name")); if (s->inject_app) [s->inject_app retain]; @@ -516,8 +515,8 @@ load_crop(s, settings); - s->allow_transparency = obs_data_get_bool(settings, - "allow_transparency"); + s->allow_transparency = + obs_data_get_bool(settings, "allow_transparency"); return s; @@ -549,7 +548,8 @@ NSWorkspace *ws = [NSWorkspace sharedWorkspace]; [ws removeObserver:s->launch_listener - forKeyPath:NSStringFromSelector(@selector(runningApplications))]; + forKeyPath:NSStringFromSelector(@selector + (runningApplications))]; objc_release(&s->launch_listener); objc_release(&s->inject_app); @@ -561,7 +561,7 @@ obs_enter_graphics(); stop_client(s); - + if (s->sampler) gs_samplerstate_destroy(s->sampler); if (s->vertbuffer) @@ -587,44 +587,45 @@ } static inline void update_strings_from_context(syphon_t s, obs_data_t *settings, - NSString **app, NSString **name, NSString **uuid) + NSString **app, NSString **name, + NSString **uuid) { if (!s || !s->uuid_changed) return; s->uuid_changed = false; - *app = s->app_name; + *app = s->app_name; *name = s->name; *uuid = s->uuid; obs_data_set_string(settings, "app_name", s->app_name.UTF8String); - obs_data_set_string(settings, "name", s->name.UTF8String); - obs_data_set_string(settings, "uuid", s->uuid.UTF8String); + obs_data_set_string(settings, "name", s->name.UTF8String); + obs_data_set_string(settings, "uuid", s->uuid.UTF8String); } static inline void add_servers(syphon_t s, obs_property_t *list, - obs_data_t *settings) + obs_data_t *settings) { bool found_current = settings == NULL; - NSString *set_app = get_string(settings, "app_name"); + NSString *set_app = get_string(settings, "app_name"); NSString *set_name = get_string(settings, "name"); NSString *set_uuid = get_string(settings, "uuid"); - update_strings_from_context(s, settings, - &set_app, &set_name, &set_uuid); + update_strings_from_context(s, settings, &set_app, &set_name, + &set_uuid); obs_property_list_add_string(list, "", ""); NSArray *arr = [[SyphonServerDirectory sharedDirectory] servers]; for (NSDictionary *server in arr) { - NSString *app = server[SyphonServerDescriptionAppNameKey]; + NSString *app = server[SyphonServerDescriptionAppNameKey]; NSString *name = server[SyphonServerDescriptionNameKey]; NSString *uuid = server[SyphonServerDescriptionUUIDKey]; - NSString *serv = [NSString stringWithFormat:@"[%@] %@", - app, name]; + NSString *serv = + [NSString stringWithFormat:@"[%@] %@", app, name]; - obs_property_list_add_string(list, - serv.UTF8String, uuid.UTF8String); + obs_property_list_add_string(list, serv.UTF8String, + uuid.UTF8String); if (!found_current) found_current = [uuid isEqual:set_uuid]; @@ -633,15 +634,15 @@ if (found_current || !set_uuid.length || !set_app.length) return; - NSString *serv = [NSString stringWithFormat:@"[%@] %@", - set_app, set_name]; - size_t idx = obs_property_list_add_string(list, - serv.UTF8String, set_uuid.UTF8String); + NSString *serv = + [NSString stringWithFormat:@"[%@] %@", set_app, set_name]; + size_t idx = obs_property_list_add_string(list, serv.UTF8String, + set_uuid.UTF8String); obs_property_list_item_disable(list, idx, true); } static bool servers_changed(obs_properties_t *props, obs_property_t *list, - obs_data_t *settings) + obs_data_t *settings) { @autoreleasepool { obs_property_list_clear(list); @@ -662,16 +663,15 @@ if (!url.isFileURL) return false; - for (NSString *path in [fm - contentsOfDirectoryAtPath:url.path - error:nil]) { + for (NSString *path in [fm contentsOfDirectoryAtPath:url.path + error:nil]) { NSURL *bundle_url = [url URLByAppendingPathComponent:path]; - NSBundle *bundle = [NSBundle bundleWithURL:bundle_url]; + NSBundle *bundle = [NSBundle bundleWithURL:bundle_url]; if (!bundle) continue; if ([bundle.bundleIdentifier - isEqual:@"zakk.lol.SASyphonInjector"]) + isEqual:@"zakk.lol.SASyphonInjector"]) return true; } @@ -705,7 +705,7 @@ } static bool launch_syphon_inject(obs_properties_t *props, obs_property_t *prop, - void *data) + void *data) { UNUSED_PARAMETER(props); UNUSED_PARAMETER(prop); @@ -720,13 +720,13 @@ static int describes_app(obs_data_t *info, NSRunningApplication *app) { int score = 0; - if ([app.localizedName isEqual:get_string(info, "name")]) + if ([app.localizedName isEqual:get_string(info, "name")]) score += 2; if ([app.bundleIdentifier isEqual:get_string(info, "bundle")]) score += 2; - if ([app.executableURL isEqual:get_string(info, "executable")]) + if ([app.executableURL isEqual:get_string(info, "executable")]) score += 2; if (score && app.processIdentifier == obs_data_get_int(info, "pid")) @@ -739,10 +739,10 @@ { obs_data_set_string(app_data, "name", app.localizedName.UTF8String); obs_data_set_string(app_data, "bundle", - app.bundleIdentifier.UTF8String); + app.bundleIdentifier.UTF8String); // Until we drop 10.8, use path.fileSystemRepsentation obs_data_set_string(app_data, "executable", - app.executableURL.path.fileSystemRepresentation); + app.executableURL.path.fileSystemRepresentation); obs_data_set_int(app_data, "pid", app.processIdentifier); } @@ -760,8 +760,9 @@ } static inline size_t add_app(obs_property_t *prop, NSDictionary *duplicates, - NSString *name, const char *bundle, const char *json_data, - bool is_duplicate, pid_t pid) + NSString *name, const char *bundle, + const char *json_data, bool is_duplicate, + pid_t pid) { if (!is_duplicate) { NSNumber *val = duplicates[name]; @@ -769,20 +770,21 @@ } if (is_duplicate) - name = [NSString stringWithFormat:@"%@ (%s: %d)", - name, bundle, pid]; + name = [NSString + stringWithFormat:@"%@ (%s: %d)", name, bundle, pid]; return obs_property_list_add_string(prop, name.UTF8String, json_data); } static void update_inject_list_internal(obs_properties_t *props, - obs_property_t *prop, obs_data_t *settings) + obs_property_t *prop, + obs_data_t *settings) { UNUSED_PARAMETER(props); - const char *current_str = obs_data_get_string(settings, "application"); - obs_data_t *current = obs_data_create_from_json(current_str); - NSString *current_name = @(obs_data_get_string(current, "name")); + const char *current_str = obs_data_get_string(settings, "application"); + obs_data_t *current = obs_data_create_from_json(current_str); + NSString *current_name = @(obs_data_get_string(current, "name")); bool current_found = !obs_data_has_user_value(current, "name"); @@ -790,10 +792,10 @@ obs_property_list_add_string(prop, "", ""); NSWorkspace *ws = [NSWorkspace sharedWorkspace]; - NSArray *apps = ws.runningApplications; + NSArray *apps = ws.runningApplications; NSDictionary *duplicates = get_duplicate_names(apps); - NSMapTable *candidates = [NSMapTable weakToStrongObjectsMapTable]; + NSMapTable *candidates = [NSMapTable weakToStrongObjectsMapTable]; obs_data_t *app_data = obs_data_create(); for (NSRunningApplication *app in apps) { @@ -801,11 +803,10 @@ int score = describes_app(current, app); NSString *name = app.localizedName; - add_app(prop, duplicates, name, - app.bundleIdentifier.UTF8String, - obs_data_get_json(app_data), - [name isEqual:current_name] && score < 4, - app.processIdentifier); + add_app(prop, duplicates, name, app.bundleIdentifier.UTF8String, + obs_data_get_json(app_data), + [name isEqual:current_name] && score < 4, + app.processIdentifier); if (score >= 4) { [candidates setObject:@(score) forKey:app]; @@ -816,10 +817,10 @@ if (!current_found) { size_t idx = add_app(prop, duplicates, current_name, - obs_data_get_string(current, "bundle"), - current_str, - duplicates[current_name] != nil, - obs_data_get_int(current, "pid")); + obs_data_get_string(current, "bundle"), + current_str, + duplicates[current_name] != nil, + obs_data_get_int(current, "pid")); obs_property_list_item_disable(prop, idx, true); } else if (candidates.count > 0) { @@ -829,7 +830,7 @@ for (NSRunningApplication *app in candidates.keyEnumerator) { NSNumber *score = [candidates objectForKey:app]; if ([score compare:best_match_score] == - NSOrderedDescending) { + NSOrderedDescending) { best_match = app; best_match_score = score; } @@ -839,7 +840,7 @@ if (best_match_score.intValue >= 4) { app_to_data(best_match, current); obs_data_set_string(settings, "application", - obs_data_get_json(current)); + obs_data_get_json(current)); } } @@ -847,7 +848,7 @@ } static void toggle_inject_internal(obs_properties_t *props, - obs_property_t *prop, obs_data_t *settings) + obs_property_t *prop, obs_data_t *settings) { bool enabled = obs_data_get_bool(settings, "inject"); obs_property_t *inject_list = obs_properties_get(props, "application"); @@ -857,7 +858,7 @@ } static bool toggle_inject(obs_properties_t *props, obs_property_t *prop, - obs_data_t *settings) + obs_data_t *settings) { @autoreleasepool { toggle_inject_internal(props, prop, settings); @@ -866,7 +867,7 @@ } static bool update_inject_list(obs_properties_t *props, obs_property_t *prop, - obs_data_t *settings) + obs_data_t *settings) { @autoreleasepool { update_inject_list_internal(props, prop, settings); @@ -875,11 +876,11 @@ } static bool update_crop(obs_properties_t *props, obs_property_t *prop, - obs_data_t *settings) + obs_data_t *settings) { bool enabled = obs_data_get_bool(settings, "crop"); -#define LOAD_CROP(x) \ +#define LOAD_CROP(x) \ prop = obs_properties_get(props, "crop." #x); \ obs_property_set_enabled(prop, enabled); LOAD_CROP(origin.x); @@ -903,7 +904,7 @@ } static bool show_syphon_license(obs_properties_t *props, obs_property_t *prop, - void *data) + void *data) { UNUSED_PARAMETER(props); UNUSED_PARAMETER(prop); @@ -928,28 +929,28 @@ if (s) obs_source_addref(s->source); - obs_properties_t *props = obs_properties_create_param(s, - syphon_release); + obs_properties_t *props = + obs_properties_create_param(s, syphon_release); - obs_property_t *list = obs_properties_add_list(props, - "uuid", obs_module_text("Source"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_property_t *list = obs_properties_add_list( + props, "uuid", obs_module_text("Source"), OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_set_modified_callback(list, servers_changed); obs_properties_add_bool(props, "allow_transparency", - obs_module_text("AllowTransparency")); + obs_module_text("AllowTransparency")); - obs_property_t *launch = obs_properties_add_button(props, - "launch inject", obs_module_text("LaunchSyphonInject"), - launch_syphon_inject); + obs_property_t *launch = obs_properties_add_button( + props, "launch inject", obs_module_text("LaunchSyphonInject"), + launch_syphon_inject); - obs_property_t *inject = obs_properties_add_bool(props, - "inject", obs_module_text("Inject")); + obs_property_t *inject = obs_properties_add_bool( + props, "inject", obs_module_text("Inject")); obs_property_set_modified_callback(inject, toggle_inject); - obs_property_t *inject_list = obs_properties_add_list(props, - "application", obs_module_text("Application"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_property_t *inject_list = obs_properties_add_list( + props, "application", obs_module_text("Application"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); obs_property_set_modified_callback(inject_list, update_inject_list); if (!get_inject_application_path()) @@ -960,13 +961,14 @@ obs_property_set_enabled(inject_list, false); } - obs_property_t *crop = obs_properties_add_bool(props, "crop", - obs_module_text("Crop")); + obs_property_t *crop = + obs_properties_add_bool(props, "crop", obs_module_text("Crop")); obs_property_set_modified_callback(crop, update_crop); -#define LOAD_CROP(x) \ - obs_properties_add_float(props, "crop." #x, \ - obs_module_text("Crop." #x), 0., 4096.f, .5f); +#define LOAD_CROP(x) \ + obs_properties_add_float(props, "crop." #x, \ + obs_module_text("Crop." #x), 0., 4096.f, \ + .5f); LOAD_CROP(origin.x); LOAD_CROP(origin.y); LOAD_CROP(size.width); @@ -974,8 +976,8 @@ #undef LOAD_CROP obs_properties_add_button(props, "syphon license", - obs_module_text("SyphonLicense"), - show_syphon_license); + obs_module_text("SyphonLicense"), + show_syphon_license); return props; } @@ -993,8 +995,8 @@ return; obs_data_set_string(settings, "app_name", s->app_name.UTF8String); - obs_data_set_string(settings, "name", s->name.UTF8String); - obs_data_set_string(settings, "uuid", s->uuid.UTF8String); + obs_data_set_string(settings, "name", s->name.UTF8String); + obs_data_set_string(settings, "uuid", s->uuid.UTF8String); } static void syphon_save(void *data, obs_data_t *settings) @@ -1005,25 +1007,25 @@ } static inline void build_sprite(struct gs_vb_data *data, float fcx, float fcy, - float start_u, float end_u, float start_v, float end_v) + float start_u, float end_u, float start_v, + float end_v) { struct vec2 *tvarray = data->tvarray[0].array; - vec3_set(data->points+1, fcx, 0.0f, 0.0f); - vec3_set(data->points+2, 0.0f, fcy, 0.0f); - vec3_set(data->points+3, fcx, fcy, 0.0f); - vec2_set(tvarray, start_u, start_v); - vec2_set(tvarray+1, end_u, start_v); - vec2_set(tvarray+2, start_u, end_v); - vec2_set(tvarray+3, end_u, end_v); + vec3_set(data->points + 1, fcx, 0.0f, 0.0f); + vec3_set(data->points + 2, 0.0f, fcy, 0.0f); + vec3_set(data->points + 3, fcx, fcy, 0.0f); + vec2_set(tvarray, start_u, start_v); + vec2_set(tvarray + 1, end_u, start_v); + vec2_set(tvarray + 2, start_u, end_v); + vec2_set(tvarray + 3, end_u, end_v); } -static inline void build_sprite_rect(struct gs_vb_data *data, - float origin_x, float origin_y, float end_x, float end_y) +static inline void build_sprite_rect(struct gs_vb_data *data, float origin_x, + float origin_y, float end_x, float end_y) { build_sprite(data, fabs(end_x - origin_x), fabs(end_y - origin_y), - origin_x, end_x, - origin_y, end_y); + origin_x, end_x, origin_y, end_y); } static inline void tick_inject_state(syphon_t s, float seconds) @@ -1050,17 +1052,15 @@ if (!s->tex) return; - static const CGRect null_crop = { { 0.f } }; + static const CGRect null_crop = {{0.f}}; const CGRect *crop = &null_crop; if (s->crop) crop = &s->crop_rect; obs_enter_graphics(); build_sprite_rect(gs_vertexbuffer_get_data(s->vertbuffer), - crop->origin.x, - s->height - crop->origin.y, - s->width - crop->size.width, - crop->size.height); + crop->origin.x, s->height - crop->origin.y, + s->width - crop->size.width, crop->size.height); obs_leave_graphics(); } @@ -1085,7 +1085,7 @@ gs_load_samplerstate(s->sampler, 0); gs_technique_t *tech = gs_effect_get_technique(s->effect, "Draw"); gs_effect_set_texture(gs_effect_get_param_by_name(s->effect, "image"), - s->tex); + s->tex); gs_technique_begin(tech); gs_technique_begin_pass(tech, 0); @@ -1105,9 +1105,8 @@ syphon_t s = (syphon_t)data; if (!s->crop) return s->width; - int32_t width = s->width - - s->crop_rect.origin.x - - s->crop_rect.size.width; + int32_t width = + s->width - s->crop_rect.origin.x - s->crop_rect.size.width; return MAX(0, width); } @@ -1116,9 +1115,8 @@ syphon_t s = (syphon_t)data; if (!s->crop) return s->height; - int32_t height = s->height - - s->crop_rect.origin.y - - s->crop_rect.size.height; + int32_t height = + s->height - s->crop_rect.origin.y - s->crop_rect.size.height; return MAX(0, height); } @@ -1134,9 +1132,9 @@ if (!sbapp) return LOG(LOG_ERROR, "Could not inject %s", - app.localizedName.UTF8String); + app.localizedName.UTF8String); - sbapp.timeout = 10*60; + sbapp.timeout = 10 * 60; sbapp.sendMode = kAEWaitReply; [sbapp sendEvent:'ascr' id:'gdut' parameters:0]; sbapp.sendMode = kAENoReply; @@ -1145,9 +1143,8 @@ if (retry) return; - LOG(LOG_INFO, "Injected '%s' (%d, '%s')", - app.localizedName.UTF8String, - app.processIdentifier, app.bundleIdentifier.UTF8String); + LOG(LOG_INFO, "Injected '%s' (%d, '%s')", app.localizedName.UTF8String, + app.processIdentifier, app.bundleIdentifier.UTF8String); } static inline void find_and_inject_target(syphon_t s, NSArray *arr, bool retry) @@ -1174,20 +1171,17 @@ static inline bool inject_info_equal(obs_data_t *prev, obs_data_t *new) { - if (![get_string(prev, "name") - isEqual:get_string(new, "name")]) + if (![get_string(prev, "name") isEqual:get_string(new, "name")]) return false; - if (![get_string(prev, "bundle") - isEqual:get_string(new, "bundle")]) + if (![get_string(prev, "bundle") isEqual:get_string(new, "bundle")]) return false; if (![get_string(prev, "executable") - isEqual:get_string(new, "executable")]) + isEqual:get_string(new, "executable")]) return false; - if (![get_string(prev, "pid") - isEqual:get_string(new, "pid")]) + if (![get_string(prev, "pid") isEqual:get_string(new, "pid")]) return false; return true; @@ -1195,15 +1189,15 @@ static inline void update_inject(syphon_t s, obs_data_t *settings) { - bool try_injecting = s->inject_active; - s->inject_active = obs_data_get_bool(settings, "inject"); + bool try_injecting = s->inject_active; + s->inject_active = obs_data_get_bool(settings, "inject"); const char *inject_str = obs_data_get_string(settings, "application"); try_injecting = !try_injecting && s->inject_active; obs_data_t *prev = s->inject_info; s->inject_info = obs_data_create_from_json(inject_str); - + NSString *prev_app = s->inject_app; s->inject_app = [@(obs_data_get_string(s->inject_info, "name")) retain]; [prev_app release]; @@ -1216,10 +1210,10 @@ s->inject_server_found = false; for (NSDictionary *server in servers) update_inject_state(s, server, true); - + if (!try_injecting) try_injecting = s->inject_active && - !inject_info_equal(prev, s->inject_info); + !inject_info_equal(prev, s->inject_info); obs_data_release(prev); @@ -1239,15 +1233,15 @@ NSDictionary *dict = find_by_uuid(arr, s->uuid); if (dict) { - NSString *app = dict[SyphonServerDescriptionAppNameKey]; + NSString *app = dict[SyphonServerDescriptionAppNameKey]; NSString *name = dict[SyphonServerDescriptionNameKey]; obs_data_set_string(settings, "app_name", app.UTF8String); - obs_data_set_string(settings, "name", name.UTF8String); + obs_data_set_string(settings, "name", name.UTF8String); load_syphon_settings(s, settings); } else if (!dict && !s->uuid.length) { obs_data_set_string(settings, "app_name", ""); - obs_data_set_string(settings, "name", ""); + obs_data_set_string(settings, "name", ""); load_syphon_settings(s, settings); } @@ -1256,8 +1250,8 @@ static void syphon_update_internal(syphon_t s, obs_data_t *settings) { - s->allow_transparency = obs_data_get_bool(settings, - "allow_transparency"); + s->allow_transparency = + obs_data_get_bool(settings, "allow_transparency"); load_crop(s, settings); update_inject(s, settings); @@ -1273,19 +1267,18 @@ } struct obs_source_info syphon_info = { - .id = "syphon-input", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_DO_NOT_DUPLICATE, - .get_name = syphon_get_name, - .create = syphon_create, - .destroy = syphon_destroy, - .video_render = syphon_video_render, - .video_tick = syphon_video_tick, + .id = "syphon-input", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | + OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = syphon_get_name, + .create = syphon_create, + .destroy = syphon_destroy, + .video_render = syphon_video_render, + .video_tick = syphon_video_tick, .get_properties = syphon_properties, - .get_width = syphon_get_width, - .get_height = syphon_get_height, - .update = syphon_update, - .save = syphon_save, + .get_width = syphon_get_width, + .get_height = syphon_get_height, + .update = syphon_update, + .save = syphon_save, }; -
View file
obs-studio-24.0.0.tar.xz/plugins/mac-vth264/data/locale/bg-BG.ini
Added
@@ -0,0 +1,12 @@ +VTH264EncHW="Хардуерно кодиращо устройство Apple VT H264" +VTH264EncSW="Софтуерно кодиращо устройство Apple VT H264" +Bitrate="Битрейт" +UseMaxBitrate="Ограничаване на битрейта" +MaxBitrate="Макс. битрейт" +MaxBitrateWindow="Прозорец с максимален битрейт (в секунди)" +KeyframeIntervalSec="Интервал за ключови кадри (секунди, 0=автоматично)" +Profile="Профил" +DefaultEncoder="(Стандартно кодиране)" +UseBFrames="Използване на B-кадри" + +
View file
obs-studio-23.2.1.tar.xz/plugins/mac-vth264/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-vth264/data/locale/de-DE.ini
Changed
@@ -1,14 +1,14 @@ -VTH264EncHW="Apple-VT-H264-Hardware-Kodierer" -VTH264EncSW="Apple-VT-H264-Software-Kodierer" -VTEncoder="VideoToolbox-Kodierer" +VTH264EncHW="Apple‐VT‐H264‐Hardware‐Kodierer" +VTH264EncSW="Apple‐VT‐H264‐Software‐Kodierer" +VTEncoder="VideoToolbox‐Kodierer" Bitrate="Bitrate" UseMaxBitrate="Limitiere Bitrate" MaxBitrate="Max. Bitrate" MaxBitrateWindow="Maximales Bitratenfenster (Sekunden)" -KeyframeIntervalSec="Keyframeintervall (Sekunden, 0 = auto)" +KeyframeIntervalSec="Keyframeintervall in Sek. (0 = automatisch)" Profile="Profil" None="(Nichts)" DefaultEncoder="(Standardkodierer)" -UseBFrames="B-Frames verwenden" +UseBFrames="B‐Frames verwenden"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-vth264/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/mac-vth264/data/locale/gl-ES.ini
Changed
@@ -1,12 +1,14 @@ VTH264EncHW="Codificador de hárdware Apple VT H264" VTH264EncSW="Codificador de sóftware Apple VT H264" VTEncoder="Codificador VideoToolbox" -UseMaxBitrate="Limitar velocidade de bits" -MaxBitrate="Velocidade de bits máxima" -MaxBitrateWindow="Xanela de velocidade de bits máxima (segundos)" +Bitrate="Taxa de bits" +UseMaxBitrate="Limitar a taxa de bits" +MaxBitrate="Taxa de bits máxima" +MaxBitrateWindow="Xanela de taxa de bits máxima (segundos)" +KeyframeIntervalSec="Intervalo de fotogramas clave (segundos, 0=auto)" Profile="Perfil" None="(Ningún)" -DefaultEncoder="(Codificador predefinido)" +DefaultEncoder="(Codificador predeterminado)" UseBFrames="Utilizar B-Frames"
View file
obs-studio-23.2.1.tar.xz/plugins/mac-vth264/encoder.c -> obs-studio-24.0.0.tar.xz/plugins/mac-vth264/encoder.c
Changed
@@ -12,13 +12,11 @@ #define VT_LOG(level, format, ...) \ blog(level, "[VideoToolbox encoder]: " format, ##__VA_ARGS__) -#define VT_LOG_ENCODER(encoder, level, format, ...) \ +#define VT_LOG_ENCODER(encoder, level, format, ...) \ blog(level, "[VideoToolbox %s: 'h264']: " format, \ - obs_encoder_get_name(encoder), \ - ##__VA_ARGS__) + obs_encoder_get_name(encoder), ##__VA_ARGS__) #define VT_BLOG(level, format, ...) \ - VT_LOG_ENCODER(enc->encoder, level, format, \ - ##__VA_ARGS__) + VT_LOG_ENCODER(enc->encoder, level, format, ##__VA_ARGS__) // Clipped from NSApplication as it is in a ObjC header extern const double NSAppKitVersionNumber; @@ -28,8 +26,7 @@ #define APPLE_H264_ENC_ID_SW "com.apple.videotoolbox.videoencoder.h264" // Get around missing symbol on 10.8 during compilation -enum { - kCMFormatDescriptionBridgeError_InvalidParameter_ = -12712, +enum { kCMFormatDescriptionBridgeError_InvalidParameter_ = -12712, }; static bool is_appkit10_9_or_greater() @@ -44,8 +41,7 @@ const char *codec_name; }) vt_encoders; -struct vt_h264_encoder -{ +struct vt_h264_encoder { obs_encoder_t *encoder; const char *vt_encoder_id; @@ -74,11 +70,11 @@ }; static void log_osstatus(int log_level, struct vt_h264_encoder *enc, - const char *context, OSStatus code) + const char *context, OSStatus code) { char *c_str = NULL; CFErrorRef err = CFErrorCreate(kCFAllocatorDefault, - kCFErrorDomainOSStatus, code, NULL); + kCFErrorDomainOSStatus, code, NULL); CFStringRef str = CFErrorCopyDescription(err); c_str = cfstr_copy_cstr(str, kCFStringEncodingUTF8); @@ -116,17 +112,19 @@ return NULL; } -#define STATUS_CHECK(c) \ - code = c; \ - if (code) { \ +#define STATUS_CHECK(c) \ + code = c; \ + if (code) { \ log_osstatus(LOG_ERROR, enc, #c, code); \ - goto fail; \ + goto fail; \ } -#define SESSION_CHECK(x) if ((code = (x)) != noErr) return code; +#define SESSION_CHECK(x) \ + if ((code = (x)) != noErr) \ + return code; static OSStatus session_set_prop_int(VTCompressionSessionRef session, - CFStringRef key, int32_t val) + CFStringRef key, int32_t val) { CFNumberRef n = CFNumberCreate(NULL, kCFNumberSInt32Type, &val); OSStatus code = VTSessionSetProperty(session, key, n); @@ -136,7 +134,7 @@ } static OSStatus session_set_prop_str(VTCompressionSessionRef session, - CFStringRef key, char *val) + CFStringRef key, char *val) { CFStringRef s = CFStringCreateWithFileSystemRepresentation(NULL, val); OSStatus code = VTSessionSetProperty(session, key, s); @@ -146,39 +144,38 @@ } static OSStatus session_set_prop(VTCompressionSessionRef session, - CFStringRef key, CFTypeRef val) + CFStringRef key, CFTypeRef val) { return VTSessionSetProperty(session, key, val); } static OSStatus session_set_bitrate(VTCompressionSessionRef session, - int new_bitrate, bool limit_bitrate, int max_bitrate, - float max_bitrate_window) + int new_bitrate, bool limit_bitrate, + int max_bitrate, float max_bitrate_window) { OSStatus code; - SESSION_CHECK(session_set_prop_int(session, - kVTCompressionPropertyKey_AverageBitRate, - new_bitrate * 1000)); + SESSION_CHECK(session_set_prop_int( + session, kVTCompressionPropertyKey_AverageBitRate, + new_bitrate * 1000)); if (limit_bitrate) { int32_t cpb_size = max_bitrate * 125 * max_bitrate_window; - CFNumberRef cf_cpb_size = CFNumberCreate(NULL, - kCFNumberIntType, &cpb_size); - CFNumberRef cf_cpb_window_s = CFNumberCreate(NULL, - kCFNumberFloatType, &max_bitrate_window); + CFNumberRef cf_cpb_size = + CFNumberCreate(NULL, kCFNumberIntType, &cpb_size); + CFNumberRef cf_cpb_window_s = CFNumberCreate( + NULL, kCFNumberFloatType, &max_bitrate_window); CFMutableArrayRef rate_control = CFArrayCreateMutable( - kCFAllocatorDefault, 2, - &kCFTypeArrayCallBacks); + kCFAllocatorDefault, 2, &kCFTypeArrayCallBacks); CFArrayAppendValue(rate_control, cf_cpb_size); CFArrayAppendValue(rate_control, cf_cpb_window_s); - code = session_set_prop(session, - kVTCompressionPropertyKey_DataRateLimits, - rate_control); + code = session_set_prop( + session, kVTCompressionPropertyKey_DataRateLimits, + rate_control); CFRelease(cf_cpb_size); CFRelease(cf_cpb_window_s); @@ -186,7 +183,7 @@ if (code == kVTPropertyNotSupportedErr) { log_osstatus(LOG_WARNING, NULL, - "setting DataRateLimits on session", code); + "setting DataRateLimits on session", code); return noErr; } } @@ -195,21 +192,21 @@ } static OSStatus session_set_colorspace(VTCompressionSessionRef session, - enum video_colorspace cs) + enum video_colorspace cs) { CFStringRef matrix = obs_to_vt_colorspace(cs); OSStatus code; if (matrix != NULL) { - SESSION_CHECK(session_set_prop(session, - kVTCompressionPropertyKey_ColorPrimaries, - kCVImageBufferColorPrimaries_ITU_R_709_2)); - SESSION_CHECK(session_set_prop(session, - kVTCompressionPropertyKey_TransferFunction, - kCVImageBufferTransferFunction_ITU_R_709_2)); - SESSION_CHECK(session_set_prop(session, - kVTCompressionPropertyKey_YCbCrMatrix, - matrix)); + SESSION_CHECK(session_set_prop( + session, kVTCompressionPropertyKey_ColorPrimaries, + kCVImageBufferColorPrimaries_ITU_R_709_2)); + SESSION_CHECK(session_set_prop( + session, kVTCompressionPropertyKey_TransferFunction, + kCVImageBufferTransferFunction_ITU_R_709_2)); + SESSION_CHECK(session_set_prop( + session, kVTCompressionPropertyKey_YCbCrMatrix, + matrix)); } return noErr; @@ -218,7 +215,8 @@ #undef SESSION_CHECK void sample_encoded_callback(void *data, void *source, OSStatus status, - VTEncodeInfoFlags info_flags, CMSampleBufferRef buffer) + VTEncodeInfoFlags info_flags, + CMSampleBufferRef buffer) { UNUSED_PARAMETER(status); UNUSED_PARAMETER(info_flags); @@ -231,23 +229,20 @@ } CFRelease(pixbuf); } -#define ENCODER_ID \ - kVTVideoEncoderSpecification_EncoderID +#define ENCODER_ID kVTVideoEncoderSpecification_EncoderID #define ENABLE_HW_ACCEL \ kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder #define REQUIRE_HW_ACCEL \ kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder -static inline CFMutableDictionaryRef create_encoder_spec( - const char *vt_encoder_id) +static inline CFMutableDictionaryRef +create_encoder_spec(const char *vt_encoder_id) { CFMutableDictionaryRef encoder_spec = CFDictionaryCreateMutable( - kCFAllocatorDefault, - 3, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + kCFAllocatorDefault, 3, &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); - CFStringRef id = CFStringCreateWithFileSystemRepresentation( - NULL, vt_encoder_id); + CFStringRef id = + CFStringCreateWithFileSystemRepresentation(NULL, vt_encoder_id); CFDictionaryAddValue(encoder_spec, ENCODER_ID, id); CFRelease(id); @@ -260,17 +255,15 @@ #undef REQUIRE_HW_ACCEL #undef ENABLE_HW_ACCEL -static inline CFMutableDictionaryRef create_pixbuf_spec( - struct vt_h264_encoder *enc) +static inline CFMutableDictionaryRef +create_pixbuf_spec(struct vt_h264_encoder *enc) { CFMutableDictionaryRef pixbuf_spec = CFDictionaryCreateMutable( - kCFAllocatorDefault, - 3, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); + kCFAllocatorDefault, 3, &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); - CFNumberRef n = CFNumberCreate(NULL, kCFNumberSInt32Type, - &enc->vt_pix_fmt); + CFNumberRef n = + CFNumberCreate(NULL, kCFNumberSInt32Type, &enc->vt_pix_fmt); CFDictionaryAddValue(pixbuf_spec, kCVPixelBufferPixelFormatTypeKey, n); CFRelease(n); @@ -295,22 +288,16 @@ CFDictionaryRef pixbuf_spec = create_pixbuf_spec(enc); STATUS_CHECK(VTCompressionSessionCreate( - kCFAllocatorDefault, - enc->width, - enc->height, - kCMVideoCodecType_H264, - encoder_spec, - pixbuf_spec, - NULL, - &sample_encoded_callback, - enc->queue, - &s)); + kCFAllocatorDefault, enc->width, enc->height, + kCMVideoCodecType_H264, encoder_spec, pixbuf_spec, NULL, + &sample_encoded_callback, enc->queue, &s)); CFRelease(encoder_spec); CFRelease(pixbuf_spec); CFBooleanRef b = NULL; - code = VTSessionCopyProperty(s, + code = VTSessionCopyProperty( + s, kVTCompressionPropertyKey_UsingHardwareAcceleratedVideoEncoder, NULL, &b); @@ -322,35 +309,35 @@ if (b != NULL) CFRelease(b); - STATUS_CHECK(session_set_prop_int(s, - kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration, - enc->keyint)); - STATUS_CHECK(session_set_prop_int(s, - kVTCompressionPropertyKey_MaxKeyFrameInterval, - enc->keyint * ((float)enc->fps_num/enc->fps_den))); - STATUS_CHECK(session_set_prop_int(s, - kVTCompressionPropertyKey_ExpectedFrameRate, - ceil((float)enc->fps_num/ enc->fps_den))); - STATUS_CHECK(session_set_prop(s, - kVTCompressionPropertyKey_AllowFrameReordering, - enc->bframes ? kCFBooleanTrue : kCFBooleanFalse)); + STATUS_CHECK(session_set_prop_int( + s, kVTCompressionPropertyKey_MaxKeyFrameIntervalDuration, + enc->keyint)); + STATUS_CHECK(session_set_prop_int( + s, kVTCompressionPropertyKey_MaxKeyFrameInterval, + enc->keyint * ((float)enc->fps_num / enc->fps_den))); + STATUS_CHECK(session_set_prop_int( + s, kVTCompressionPropertyKey_ExpectedFrameRate, + ceil((float)enc->fps_num / enc->fps_den))); + STATUS_CHECK(session_set_prop( + s, kVTCompressionPropertyKey_AllowFrameReordering, + enc->bframes ? kCFBooleanTrue : kCFBooleanFalse)); // This can fail depending on hardware configuration code = session_set_prop(s, kVTCompressionPropertyKey_RealTime, - kCFBooleanTrue); + kCFBooleanTrue); if (code != noErr) log_osstatus(LOG_WARNING, enc, - "setting " - "kVTCompressionPropertyKey_RealTime, " - "frame delay might be increased", - code); + "setting " + "kVTCompressionPropertyKey_RealTime, " + "frame delay might be increased", + code); - STATUS_CHECK(session_set_prop(s, - kVTCompressionPropertyKey_ProfileLevel, - obs_to_vt_profile(enc->profile))); + STATUS_CHECK(session_set_prop(s, kVTCompressionPropertyKey_ProfileLevel, + obs_to_vt_profile(enc->profile))); STATUS_CHECK(session_set_bitrate(s, enc->bitrate, enc->limit_bitrate, - enc->rc_max_bitrate, enc->rc_max_bitrate_window)); + enc->rc_max_bitrate, + enc->rc_max_bitrate_window)); STATUS_CHECK(session_set_colorspace(s, enc->colorspace)); @@ -386,7 +373,8 @@ static void dump_encoder_info(struct vt_h264_encoder *enc) { - VT_BLOG(LOG_INFO, "settings:\n" + VT_BLOG(LOG_INFO, + "settings:\n" "\tvt_encoder_id %s\n" "\tbitrate: %d (kbps)\n" "\tfps_num: %d\n" @@ -399,19 +387,12 @@ "\trc_max_bitrate_window: %f (s)\n" "\thw_enc: %s\n" "\tprofile: %s\n", - enc->vt_encoder_id, - enc->bitrate, - enc->fps_num, - enc->fps_den, - enc->width, - enc->height, - enc->keyint, - enc->limit_bitrate ? "on" : "off", - enc->rc_max_bitrate, - enc->rc_max_bitrate_window, - enc->hw_enc ? "on" : "off", - (enc->profile != NULL && !!strlen(enc->profile)) - ? enc->profile : "default"); + enc->vt_encoder_id, enc->bitrate, enc->fps_num, enc->fps_den, + enc->width, enc->height, enc->keyint, + enc->limit_bitrate ? "on" : "off", enc->rc_max_bitrate, + enc->rc_max_bitrate_window, enc->hw_enc ? "on" : "off", + (enc->profile != NULL && !!strlen(enc->profile)) ? enc->profile + : "default"); } static void vt_h264_video_info(void *data, struct video_scale_info *info) @@ -420,8 +401,9 @@ if (info->format == VIDEO_FORMAT_I420) { enc->obs_pix_fmt = info->format; - enc->vt_pix_fmt = enc->fullrange ? - kCVPixelFormatType_420YpCbCr8PlanarFullRange + enc->vt_pix_fmt = + enc->fullrange + ? kCVPixelFormatType_420YpCbCr8PlanarFullRange : kCVPixelFormatType_420YpCbCr8Planar; return; } @@ -431,8 +413,9 @@ // Anything else, return default enc->obs_pix_fmt = VIDEO_FORMAT_NV12; - enc->vt_pix_fmt = enc->fullrange ? - kCVPixelFormatType_420YpCbCr8BiPlanarFullRange + enc->vt_pix_fmt = + enc->fullrange + ? kCVPixelFormatType_420YpCbCr8BiPlanarFullRange : kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; info->format = enc->obs_pix_fmt; @@ -443,7 +426,7 @@ video_t *video = obs_encoder_video(enc->encoder); const struct video_output_info *voi = video_output_get_info(video); - struct video_scale_info info = { .format = voi->format }; + struct video_scale_info info = {.format = voi->format}; enc->fullrange = voi->range == VIDEO_RANGE_FULL; @@ -461,8 +444,8 @@ enc->profile = obs_data_get_string(settings, "profile"); enc->limit_bitrate = obs_data_get_bool(settings, "limit_bitrate"); enc->rc_max_bitrate = obs_data_get_int(settings, "max_bitrate"); - enc->rc_max_bitrate_window = obs_data_get_double(settings, - "max_bitrate_window"); + enc->rc_max_bitrate_window = + obs_data_get_double(settings, "max_bitrate_window"); enc->bframes = obs_data_get_bool(settings, "bframes"); } @@ -479,34 +462,35 @@ old_limit_bitrate == enc->limit_bitrate) return true; - OSStatus code = session_set_bitrate(enc->session, - enc->bitrate, enc->limit_bitrate, enc->rc_max_bitrate, - enc->rc_max_bitrate_window); + OSStatus code = session_set_bitrate(enc->session, enc->bitrate, + enc->limit_bitrate, + enc->rc_max_bitrate, + enc->rc_max_bitrate_window); if (code != noErr) - VT_BLOG(LOG_WARNING, - "failed to set bitrate to session"); + VT_BLOG(LOG_WARNING, "failed to set bitrate to session"); CFNumberRef n; VTSessionCopyProperty(enc->session, - kVTCompressionPropertyKey_AverageBitRate, NULL, - &n); + kVTCompressionPropertyKey_AverageBitRate, NULL, + &n); uint32_t session_bitrate; CFNumberGetValue(n, kCFNumberIntType, &session_bitrate); CFRelease(n); if (session_bitrate == old_bitrate) { - VT_BLOG(LOG_WARNING, "failed to update current session " - " bitrate from %d->%d", - old_bitrate, enc->bitrate); + VT_BLOG(LOG_WARNING, + "failed to update current session " + " bitrate from %d->%d", + old_bitrate, enc->bitrate); } dump_encoder_info(enc); return true; } -static void *vt_h264_create(obs_data_t *settings, - obs_encoder_t *encoder, const char *vt_encoder_id) +static void *vt_h264_create(obs_data_t *settings, obs_encoder_t *encoder, + const char *vt_encoder_id) { struct vt_h264_encoder *enc = bzalloc(sizeof(struct vt_h264_encoder)); @@ -556,27 +540,28 @@ } static void convert_block_nals_to_annexb(struct vt_h264_encoder *enc, - struct darray *packet, CMBlockBufferRef block, - int nal_length_bytes) + struct darray *packet, + CMBlockBufferRef block, + int nal_length_bytes) { size_t block_size; uint8_t *block_buf; CMBlockBufferGetDataPointer(block, 0, NULL, &block_size, - (char **)&block_buf); + (char **)&block_buf); size_t bytes_remaining = block_size; - while(bytes_remaining > 0) { + while (bytes_remaining > 0) { uint32_t nal_size; if (nal_length_bytes == 1) nal_size = block_buf[0]; else if (nal_length_bytes == 2) nal_size = CFSwapInt16BigToHost( - ((uint16_t *)block_buf)[0]); + ((uint16_t *)block_buf)[0]); else if (nal_length_bytes == 4) nal_size = CFSwapInt32BigToHost( - ((uint32_t *)block_buf)[0]); + ((uint32_t *)block_buf)[0]); else return; @@ -597,21 +582,22 @@ } static bool handle_keyframe(struct vt_h264_encoder *enc, - CMFormatDescriptionRef format_desc, size_t param_count, - struct darray *packet, struct darray *extra_data) + CMFormatDescriptionRef format_desc, + size_t param_count, struct darray *packet, + struct darray *extra_data) { OSStatus code; const uint8_t *param; size_t param_size; - for(size_t i = 0; i < param_count; i++) { + for (size_t i = 0; i < param_count; i++) { code = CMVideoFormatDescriptionGetH264ParameterSetAtIndex( - format_desc, i, ¶m, ¶m_size, - NULL, NULL); + format_desc, i, ¶m, ¶m_size, NULL, NULL); if (code != noErr) { log_osstatus(LOG_ERROR, enc, - "getting NAL parameter " - "at index", code); + "getting NAL parameter " + "at index", + code); return false; } @@ -628,35 +614,35 @@ } static bool convert_sample_to_annexb(struct vt_h264_encoder *enc, - struct darray *packet, struct darray *extra_data, - CMSampleBufferRef buffer, bool keyframe) + struct darray *packet, + struct darray *extra_data, + CMSampleBufferRef buffer, bool keyframe) { OSStatus code; CMFormatDescriptionRef format_desc = - CMSampleBufferGetFormatDescription(buffer); + CMSampleBufferGetFormatDescription(buffer); size_t param_count; int nal_length_bytes; - code = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(format_desc, - 0, NULL, NULL, ¶m_count, &nal_length_bytes); + code = CMVideoFormatDescriptionGetH264ParameterSetAtIndex( + format_desc, 0, NULL, NULL, ¶m_count, &nal_length_bytes); // it is not clear what errors this function can return // so we check the two most reasonable if (code == kCMFormatDescriptionBridgeError_InvalidParameter_ || code == kCMFormatDescriptionError_InvalidParameter) { VT_BLOG(LOG_WARNING, "assuming 2 parameter sets " - "and 4 byte NAL length header"); + "and 4 byte NAL length header"); param_count = 2; nal_length_bytes = 4; } else if (code != noErr) { log_osstatus(LOG_ERROR, enc, - "getting parameter count from sample", - code); + "getting parameter count from sample", code); return false; } - if (keyframe && !handle_keyframe(enc, format_desc, param_count, - packet, extra_data)) + if (keyframe && + !handle_keyframe(enc, format_desc, param_count, packet, extra_data)) return false; CMBlockBufferRef block = CMSampleBufferGetDataBuffer(buffer); @@ -667,13 +653,13 @@ static bool is_sample_keyframe(CMSampleBufferRef buffer) { - CFArrayRef attachments = CMSampleBufferGetSampleAttachmentsArray( - buffer, false); - if(attachments != NULL) { + CFArrayRef attachments = + CMSampleBufferGetSampleAttachmentsArray(buffer, false); + if (attachments != NULL) { CFDictionaryRef attachment; CFBooleanRef has_dependencies; - attachment = (CFDictionaryRef)CFArrayGetValueAtIndex( - attachments, 0); + attachment = + (CFDictionaryRef)CFArrayGetValueAtIndex(attachments, 0); has_dependencies = (CFBooleanRef)CFDictionaryGetValue( attachment, kCMSampleAttachmentKey_DependsOnOthers); return has_dependencies == kCFBooleanFalse; @@ -683,15 +669,15 @@ } static bool parse_sample(struct vt_h264_encoder *enc, CMSampleBufferRef buffer, - struct encoder_packet *packet, CMTime off) + struct encoder_packet *packet, CMTime off) { CMTime pts = CMSampleBufferGetPresentationTimeStamp(buffer); CMTime dts = CMSampleBufferGetDecodeTimeStamp(buffer); pts = CMTimeMultiplyByFloat64(pts, - ((Float64)enc->fps_num/enc->fps_den)); + ((Float64)enc->fps_num / enc->fps_den)); dts = CMTimeMultiplyByFloat64(dts, - ((Float64)enc->fps_num/enc->fps_den)); + ((Float64)enc->fps_num / enc->fps_den)); // imitate x264's negative dts when bframes might have pts < dts if (enc->bframes) @@ -707,7 +693,7 @@ extra_data = &enc->extra_data.da; if (!convert_sample_to_annexb(enc, &enc->packet_data.da, extra_data, - buffer, keyframe)) + buffer, keyframe)) goto fail; packet->type = OBS_ENCODER_VIDEO; @@ -725,20 +711,16 @@ return false; } -bool get_cached_pixel_buffer(struct vt_h264_encoder *enc, - CVPixelBufferRef *buf) +bool get_cached_pixel_buffer(struct vt_h264_encoder *enc, CVPixelBufferRef *buf) { OSStatus code; CVPixelBufferPoolRef pool = - VTCompressionSessionGetPixelBufferPool( - enc->session); + VTCompressionSessionGetPixelBufferPool(enc->session); if (!pool) return kCVReturnError; CVPixelBufferRef pixbuf; - STATUS_CHECK(CVPixelBufferPoolCreatePixelBuffer(NULL, pool, - &pixbuf)); - + STATUS_CHECK(CVPixelBufferPoolCreatePixelBuffer(NULL, pool, &pixbuf)); // Why aren't these already set on the pixel buffer? // I would have expected pixel buffers from the session's @@ -746,18 +728,14 @@ CFStringRef matrix = obs_to_vt_colorspace(enc->colorspace); - CVBufferSetAttachment(pixbuf, - kCVImageBufferYCbCrMatrixKey, - matrix, - kCVAttachmentMode_ShouldPropagate); - CVBufferSetAttachment(pixbuf, - kCVImageBufferColorPrimariesKey, - kCVImageBufferColorPrimaries_ITU_R_709_2, - kCVAttachmentMode_ShouldPropagate); - CVBufferSetAttachment(pixbuf, - kCVImageBufferTransferFunctionKey, - kCVImageBufferTransferFunction_ITU_R_709_2, - kCVAttachmentMode_ShouldPropagate); + CVBufferSetAttachment(pixbuf, kCVImageBufferYCbCrMatrixKey, matrix, + kCVAttachmentMode_ShouldPropagate); + CVBufferSetAttachment(pixbuf, kCVImageBufferColorPrimariesKey, + kCVImageBufferColorPrimaries_ITU_R_709_2, + kCVAttachmentMode_ShouldPropagate); + CVBufferSetAttachment(pixbuf, kCVImageBufferTransferFunctionKey, + kCVImageBufferTransferFunction_ITU_R_709_2, + kCVAttachmentMode_ShouldPropagate); *buf = pixbuf; return true; @@ -767,7 +745,7 @@ } static bool vt_h264_encode(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, bool *received_packet) { struct vt_h264_encoder *enc = data; @@ -786,17 +764,17 @@ STATUS_CHECK(CVPixelBufferLockBaseAddress(pixbuf, 0)); - for(int i = 0; i < MAX_AV_PLANES; i++) { + for (int i = 0; i < MAX_AV_PLANES; i++) { if (frame->data[i] == NULL) break; uint8_t *p = (uint8_t *)CVPixelBufferGetBaseAddressOfPlane( - pixbuf, i); + pixbuf, i); uint8_t *f = frame->data[i]; - size_t plane_linesize = CVPixelBufferGetBytesPerRowOfPlane( - pixbuf, i); + size_t plane_linesize = + CVPixelBufferGetBytesPerRowOfPlane(pixbuf, i); size_t plane_height = CVPixelBufferGetHeightOfPlane(pixbuf, i); - for(size_t j = 0; j < plane_height; j++) { + for (size_t j = 0; j < plane_height; j++) { memcpy(p, f, frame->linesize[i]); p += plane_linesize; f += frame->linesize[i]; @@ -806,10 +784,10 @@ STATUS_CHECK(CVPixelBufferUnlockBaseAddress(pixbuf, 0)); STATUS_CHECK(VTCompressionSessionEncodeFrame(enc->session, pixbuf, pts, - dur, NULL, pixbuf, NULL)); + dur, NULL, pixbuf, NULL)); CMSampleBufferRef buffer = - (CMSampleBufferRef)CMSimpleQueueDequeue(enc->queue); + (CMSampleBufferRef)CMSimpleQueueDequeue(enc->queue); // No samples waiting in the queue if (buffer == NULL) @@ -845,19 +823,19 @@ return obs_module_text("VTH264EncSW"); } -#define TEXT_VT_ENCODER obs_module_text("VTEncoder") -#define TEXT_BITRATE obs_module_text("Bitrate") -#define TEXT_USE_MAX_BITRATE obs_module_text("UseMaxBitrate") -#define TEXT_MAX_BITRATE obs_module_text("MaxBitrate") +#define TEXT_VT_ENCODER obs_module_text("VTEncoder") +#define TEXT_BITRATE obs_module_text("Bitrate") +#define TEXT_USE_MAX_BITRATE obs_module_text("UseMaxBitrate") +#define TEXT_MAX_BITRATE obs_module_text("MaxBitrate") #define TEXT_MAX_BITRATE_WINDOW obs_module_text("MaxBitrateWindow") -#define TEXT_KEYINT_SEC obs_module_text("KeyframeIntervalSec") -#define TEXT_PROFILE obs_module_text("Profile") -#define TEXT_NONE obs_module_text("None") -#define TEXT_DEFAULT obs_module_text("DefaultEncoder") -#define TEXT_BFRAMES obs_module_text("UseBFrames") +#define TEXT_KEYINT_SEC obs_module_text("KeyframeIntervalSec") +#define TEXT_PROFILE obs_module_text("Profile") +#define TEXT_NONE obs_module_text("None") +#define TEXT_DEFAULT obs_module_text("DefaultEncoder") +#define TEXT_BFRAMES obs_module_text("UseBFrames") static bool limit_bitrate_modified(obs_properties_t *ppts, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { bool use_max_bitrate = obs_data_get_bool(settings, "limit_bitrate"); p = obs_properties_get(ppts, "max_bitrate"); @@ -874,25 +852,26 @@ obs_properties_t *props = obs_properties_create(); obs_property_t *p; - p = obs_properties_add_int(props, "bitrate", - TEXT_BITRATE, 50, 10000000, 50); + p = obs_properties_add_int(props, "bitrate", TEXT_BITRATE, 50, 10000000, + 50); obs_property_int_set_suffix(p, " Kbps"); p = obs_properties_add_bool(props, "limit_bitrate", - TEXT_USE_MAX_BITRATE); + TEXT_USE_MAX_BITRATE); obs_property_set_modified_callback(p, limit_bitrate_modified); p = obs_properties_add_int(props, "max_bitrate", TEXT_MAX_BITRATE, 50, - 10000000, 50); + 10000000, 50); obs_property_int_set_suffix(p, " Kbps"); obs_properties_add_float(props, "max_bitrate_window", - TEXT_MAX_BITRATE_WINDOW, 0.10f, 10.0f, 0.25f); + TEXT_MAX_BITRATE_WINDOW, 0.10f, 10.0f, 0.25f); obs_properties_add_int(props, "keyint_sec", TEXT_KEYINT_SEC, 0, 20, 1); p = obs_properties_add_list(props, "profile", TEXT_PROFILE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, TEXT_NONE, ""); obs_property_list_add_string(p, "baseline", "baseline"); obs_property_list_add_string(p, "main", "main"); @@ -923,15 +902,15 @@ VTCopyVideoEncoderList(NULL, &encoder_list); CFIndex size = CFArrayGetCount(encoder_list); - for(CFIndex i = 0; i < size; i++) { + for (CFIndex i = 0; i < size; i++) { CFDictionaryRef encoder_dict = - CFArrayGetValueAtIndex(encoder_list, i); + CFArrayGetValueAtIndex(encoder_list, i); -#define VT_DICTSTR(key, name) \ - CFStringRef name ## _ref = CFDictionaryGetValue(encoder_dict, key); \ - CFIndex name ## _len = CFStringGetLength(name ## _ref); \ - char * name = bzalloc(name ## _len + 1); \ - CFStringGetFileSystemRepresentation(name ## _ref, name, name ## _len); +#define VT_DICTSTR(key, name) \ + CFStringRef name##_ref = CFDictionaryGetValue(encoder_dict, key); \ + CFIndex name##_len = CFStringGetLength(name##_ref); \ + char *name = bzalloc(name##_len + 1); \ + CFStringGetFileSystemRepresentation(name##_ref, name, name##_len); VT_DICTSTR(kVTVideoEncoderList_CodecName, codec_name); if (strcmp("H.264", codec_name) != 0) { @@ -945,7 +924,7 @@ .name = name, .id = id, .disp_name = disp_name, - .codec_name = codec_name + .codec_name = codec_name, }; da_push_back(vt_encoders, &enc); #undef VT_DICTSTR @@ -954,7 +933,7 @@ void encoder_list_destroy() { - for(size_t i = 0; i < vt_encoders.num; i++) { + for (size_t i = 0; i < vt_encoders.num; i++) { bfree((char *)vt_encoders.array[i].name); bfree((char *)vt_encoders.array[i].id); bfree((char *)vt_encoders.array[i].codec_name); @@ -966,26 +945,27 @@ void register_encoders() { struct obs_encoder_info info = { - .type = OBS_ENCODER_VIDEO, - .codec = "h264", - .destroy = vt_h264_destroy, - .encode = vt_h264_encode, - .update = vt_h264_update, + .type = OBS_ENCODER_VIDEO, + .codec = "h264", + .destroy = vt_h264_destroy, + .encode = vt_h264_encode, + .update = vt_h264_update, .get_properties = vt_h264_properties, - .get_defaults = vt_h264_defaults, + .get_defaults = vt_h264_defaults, .get_video_info = vt_h264_video_info, - .get_extra_data = vt_h264_extra_data + .get_extra_data = vt_h264_extra_data, + .caps = OBS_ENCODER_CAP_DYN_BITRATE, }; - for(size_t i = 0; i < vt_encoders.num; i++) { - if (strcmp(vt_encoders.array[i].id, - APPLE_H264_ENC_ID_HW) == 0) { + for (size_t i = 0; i < vt_encoders.num; i++) { + if (strcmp(vt_encoders.array[i].id, APPLE_H264_ENC_ID_HW) == + 0) { info.id = "vt_h264_hw"; info.get_name = vt_h264_getname_hw; info.create = vt_h264_create_hw; obs_register_encoder(&info); } else if (strcmp(vt_encoders.array[i].id, - APPLE_H264_ENC_ID_SW) == 0) { + APPLE_H264_ENC_ID_SW) == 0) { info.id = "vt_h264_sw"; info.get_name = vt_h264_getname_sw; info.create = vt_h264_create_sw; @@ -998,7 +978,7 @@ { if (!is_appkit10_9_or_greater()) { VT_LOG(LOG_WARNING, "Not adding VideoToolbox H264 encoder; " - "AppKit must be version 10.9 or greater"); + "AppKit must be version 10.9 or greater"); return false; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/CMakeLists.txt
Changed
@@ -93,6 +93,7 @@ set(obs-browser_SOURCES obs-browser-source.cpp + obs-browser-source-audio.cpp obs-browser-plugin.cpp browser-scheme.cpp browser-client.cpp
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/browser-app.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/browser-app.cpp
Changed
@@ -43,19 +43,22 @@ return this; } -void BrowserApp::OnRegisterCustomSchemes( - CefRawPtr<CefSchemeRegistrar> registrar) +void BrowserApp::OnRegisterCustomSchemes(CefRawPtr<CefSchemeRegistrar> registrar) { -#if CHROME_VERSION_BUILD >= 3029 +#if CHROME_VERSION_BUILD >= 3683 + registrar->AddCustomScheme("http", + CEF_SCHEME_OPTION_STANDARD | + CEF_SCHEME_OPTION_CORS_ENABLED); +#elif CHROME_VERSION_BUILD >= 3029 registrar->AddCustomScheme("http", true, false, false, false, true, - false); + false); #else registrar->AddCustomScheme("http", true, false, false, false, true); #endif } void BrowserApp::OnBeforeChildProcessLaunch( - CefRefPtr<CefCommandLine> command_line) + CefRefPtr<CefCommandLine> command_line) { #ifdef _WIN32 std::string pid = std::to_string(GetCurrentProcessId()); @@ -66,8 +69,7 @@ } void BrowserApp::OnBeforeCommandLineProcessing( - const CefString &, - CefRefPtr<CefCommandLine> command_line) + const CefString &, CefRefPtr<CefCommandLine> command_line) { if (!shared_texture_available) { bool enableGPU = command_line->HasSwitch("enable-gpu"); @@ -82,38 +84,45 @@ command_line->AppendSwitch("enable-system-flash"); command_line->AppendSwitchWithValue("autoplay-policy", - "no-user-gesture-required"); + "no-user-gesture-required"); } -void BrowserApp::OnContextCreated(CefRefPtr<CefBrowser>, - CefRefPtr<CefFrame>, - CefRefPtr<CefV8Context> context) +void BrowserApp::OnContextCreated(CefRefPtr<CefBrowser> browser, + CefRefPtr<CefFrame>, + CefRefPtr<CefV8Context> context) { CefRefPtr<CefV8Value> globalObj = context->GetGlobal(); CefRefPtr<CefV8Value> obsStudioObj = CefV8Value::CreateObject(0, 0); - globalObj->SetValue("obsstudio", - obsStudioObj, V8_PROPERTY_ATTRIBUTE_NONE); + globalObj->SetValue("obsstudio", obsStudioObj, + V8_PROPERTY_ATTRIBUTE_NONE); CefRefPtr<CefV8Value> pluginVersion = CefV8Value::CreateString(OBS_BROWSER_VERSION_STRING); - obsStudioObj->SetValue("pluginVersion", - pluginVersion, V8_PROPERTY_ATTRIBUTE_NONE); + obsStudioObj->SetValue("pluginVersion", pluginVersion, + V8_PROPERTY_ATTRIBUTE_NONE); CefRefPtr<CefV8Value> func = CefV8Value::CreateFunction("getCurrentScene", this); - obsStudioObj->SetValue("getCurrentScene", - func, V8_PROPERTY_ATTRIBUTE_NONE); + obsStudioObj->SetValue("getCurrentScene", func, + V8_PROPERTY_ATTRIBUTE_NONE); CefRefPtr<CefV8Value> getStatus = CefV8Value::CreateFunction("getStatus", this); - obsStudioObj->SetValue("getStatus", - getStatus, V8_PROPERTY_ATTRIBUTE_NONE); + obsStudioObj->SetValue("getStatus", getStatus, + V8_PROPERTY_ATTRIBUTE_NONE); + +#if !ENABLE_WASHIDDEN + int id = browser->GetIdentifier(); + if (browserVis.find(id) != browserVis.end()) { + SetDocumentVisibility(browser, browserVis[id]); + } +#endif } void BrowserApp::ExecuteJSFunction(CefRefPtr<CefBrowser> browser, - const char *functionName, - CefV8ValueList arguments) + const char *functionName, + CefV8ValueList arguments) { CefRefPtr<CefV8Context> context = browser->GetMainFrame()->GetV8Context(); @@ -130,9 +139,96 @@ context->Exit(); } +#if !ENABLE_WASHIDDEN +void BrowserApp::SetFrameDocumentVisibility(CefRefPtr<CefBrowser> browser, + CefRefPtr<CefFrame> frame, + bool isVisible) +{ + CefRefPtr<CefV8Context> context = frame->GetV8Context(); + + context->Enter(); + + CefRefPtr<CefV8Value> globalObj = context->GetGlobal(); + + CefRefPtr<CefV8Value> documentObject = globalObj->GetValue("document"); + + if (!!documentObject) { + documentObject->SetValue("hidden", + CefV8Value::CreateBool(!isVisible), + V8_PROPERTY_ATTRIBUTE_READONLY); + + documentObject->SetValue( + "visibilityState", + CefV8Value::CreateString(isVisible ? "visible" + : "hidden"), + V8_PROPERTY_ATTRIBUTE_READONLY); + + std::string script = "new CustomEvent('visibilitychange', {});"; + + CefRefPtr<CefV8Value> returnValue; + CefRefPtr<CefV8Exception> exception; + + /* Create the CustomEvent object + * We have to use eval to invoke the new operator */ + bool success = context->Eval(script, frame->GetURL(), 0, + returnValue, exception); + + if (success) { + CefV8ValueList arguments; + arguments.push_back(returnValue); + + CefRefPtr<CefV8Value> dispatchEvent = + documentObject->GetValue("dispatchEvent"); + + /* Dispatch visibilitychange event on the document + * object */ + dispatchEvent->ExecuteFunction(documentObject, + arguments); + } + } + + context->Exit(); +} + +void BrowserApp::SetDocumentVisibility(CefRefPtr<CefBrowser> browser, + bool isVisible) +{ + /* This method might be called before OnContextCreated + * call is made. We'll save the requested visibility + * state here, and use it later in OnContextCreated to + * set initial page visibility state. */ + browserVis[browser->GetIdentifier()] = isVisible; + + std::vector<int64> frameIdentifiers; + /* Set visibility state for every frame in the browser + * + * According to the Page Visibility API documentation: + * https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API + * + * "Visibility states of an <iframe> are the same as + * the parent document. Hiding an <iframe> using CSS + * properties (such as display: none;) doesn't trigger + * visibility events or change the state of the document + * contained within the frame." + * + * Thus, we set the same visibility state for every frame of the browser. + */ + browser->GetFrameIdentifiers(frameIdentifiers); + + for (int64 frameId : frameIdentifiers) { + CefRefPtr<CefFrame> frame = browser->GetFrame(frameId); + + SetFrameDocumentVisibility(browser, frame, isVisible); + } +} +#endif + bool BrowserApp::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, - CefProcessId source_process, - CefRefPtr<CefProcessMessage> message) +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefFrame> frame, +#endif + CefProcessId source_process, + CefRefPtr<CefProcessMessage> message) { DCHECK(source_process == PID_BROWSER); @@ -144,6 +240,10 @@ ExecuteJSFunction(browser, "onVisibilityChange", arguments); +#if !ENABLE_WASHIDDEN + SetDocumentVisibility(browser, args->GetBool(0)); +#endif + } else if (message->GetName() == "Active") { CefV8ValueList arguments; arguments.push_back(CefV8Value::CreateBool(args->GetBool(0))); @@ -159,7 +259,8 @@ CefRefPtr<CefV8Value> globalObj = context->GetGlobal(); std::string err; - auto payloadJson = Json::parse(args->GetString(1).ToString(), err); + auto payloadJson = + Json::parse(args->GetString(1).ToString(), err); Json::object wrapperJson; if (args->GetSize() > 1) @@ -178,8 +279,8 @@ /* Create the CustomEvent object * We have to use eval to invoke the new operator */ - context->Eval(script, browser->GetMainFrame()->GetURL(), - 0, returnValue, exception); + context->Eval(script, browser->GetMainFrame()->GetURL(), 0, + returnValue, exception); CefV8ValueList arguments; arguments.push_back(returnValue); @@ -210,12 +311,12 @@ CefRefPtr<CefV8Value> callback = callbackMap[callbackID]; CefV8ValueList args; - context->Eval(script, browser->GetMainFrame()->GetURL(), - 0, retval, exception); + context->Eval(script, browser->GetMainFrame()->GetURL(), 0, + retval, exception); args.push_back(retval); - if(callback) + if (callback) callback->ExecuteFunction(NULL, args); context->Exit(); @@ -229,11 +330,9 @@ return true; } -bool BrowserApp::Execute(const CefString &name, - CefRefPtr<CefV8Value>, - const CefV8ValueList &arguments, - CefRefPtr<CefV8Value> &, - CefString &) +bool BrowserApp::Execute(const CefString &name, CefRefPtr<CefV8Value>, + const CefV8ValueList &arguments, + CefRefPtr<CefV8Value> &, CefString &) { if (name == "getCurrentScene") { if (arguments.size() == 1 && arguments[0]->IsFunction()) { @@ -248,7 +347,7 @@ CefRefPtr<CefBrowser> browser = CefV8Context::GetCurrentContext()->GetBrowser(); - browser->SendProcessMessage(PID_BROWSER, msg); + SendBrowserProcessMessage(browser, PID_BROWSER, msg); } else if (name == "getStatus") { if (arguments.size() == 1 && arguments[0]->IsFunction()) { @@ -263,7 +362,7 @@ CefRefPtr<CefBrowser> browser = CefV8Context::GetCurrentContext()->GetBrowser(); - browser->SendProcessMessage(PID_BROWSER, msg); + SendBrowserProcessMessage(browser, PID_BROWSER, msg); } else { /* Function does not exist. */ @@ -283,7 +382,7 @@ messageObject.browserTasks.emplace_back(browser, func); QMetaObject::invokeMethod(&messageObject, "ExecuteNextBrowserTask", - Qt::QueuedConnection); + Qt::QueuedConnection); } bool MessageObject::ExecuteNextBrowserTask() @@ -310,7 +409,8 @@ void MessageObject::DoCefMessageLoop(int ms) { if (ms) - QTimer::singleShot((int)ms + 2, [] () {CefDoMessageLoopWork();}); + QTimer::singleShot((int)ms + 2, + []() { CefDoMessageLoopWork(); }); else CefDoMessageLoopWork(); } @@ -323,8 +423,7 @@ void ProcessCef() { QMetaObject::invokeMethod(&messageObject, "DoCefMessageLoop", - Qt::QueuedConnection, - Q_ARG(int, (int)0)); + Qt::QueuedConnection, Q_ARG(int, (int)0)); } #define MAX_DELAY (1000 / 30) @@ -337,14 +436,14 @@ delay_ms = MAX_DELAY; if (!frameTimer.isActive()) { - QObject::connect(&frameTimer, &QTimer::timeout, - &messageObject, &MessageObject::Process); + QObject::connect(&frameTimer, &QTimer::timeout, &messageObject, + &MessageObject::Process); frameTimer.setSingleShot(false); frameTimer.start(33); } QMetaObject::invokeMethod(&messageObject, "DoCefMessageLoop", - Qt::QueuedConnection, - Q_ARG(int, (int)delay_ms)); + Qt::QueuedConnection, + Q_ARG(int, (int)delay_ms)); } #endif
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/browser-app.hpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/browser-app.hpp
Changed
@@ -19,6 +19,7 @@ #pragma once #include <map> +#include <unordered_map> #include <functional> #include "cef-headers.hpp" @@ -36,7 +37,7 @@ Q_OBJECT friend void QueueBrowserTask(CefRefPtr<CefBrowser> browser, - BrowserFunc func); + BrowserFunc func); struct Task { CefRefPtr<CefBrowser> browser; @@ -44,9 +45,9 @@ inline Task() {} inline Task(CefRefPtr<CefBrowser> browser_, BrowserFunc func_) - : browser(browser_), - func(func_) - {} + : browser(browser_), func(func_) + { + } }; std::mutex browserTaskMutex; @@ -63,13 +64,13 @@ #endif class BrowserApp : public CefApp, - public CefRenderProcessHandler, - public CefBrowserProcessHandler, - public CefV8Handler { + public CefRenderProcessHandler, + public CefBrowserProcessHandler, + public CefV8Handler { void ExecuteJSFunction(CefRefPtr<CefBrowser> browser, - const char *functionName, - CefV8ValueList arguments); + const char *functionName, + CefV8ValueList arguments); typedef std::map<int, CefRefPtr<CefV8Value>> CallbackMap; @@ -83,32 +84,47 @@ { } - virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() override; - virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() override; + virtual CefRefPtr<CefRenderProcessHandler> + GetRenderProcessHandler() override; + virtual CefRefPtr<CefBrowserProcessHandler> + GetBrowserProcessHandler() override; virtual void OnBeforeChildProcessLaunch( - CefRefPtr<CefCommandLine> command_line) override; + CefRefPtr<CefCommandLine> command_line) override; virtual void OnRegisterCustomSchemes( - CefRawPtr<CefSchemeRegistrar> registrar) override; + CefRawPtr<CefSchemeRegistrar> registrar) override; virtual void OnBeforeCommandLineProcessing( - const CefString &process_type, - CefRefPtr<CefCommandLine> command_line) override; + const CefString &process_type, + CefRefPtr<CefCommandLine> command_line) override; virtual void OnContextCreated(CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame> frame, - CefRefPtr<CefV8Context> context) override; - virtual bool OnProcessMessageReceived( - CefRefPtr<CefBrowser> browser, - CefProcessId source_process, - CefRefPtr<CefProcessMessage> message) override; + CefRefPtr<CefFrame> frame, + CefRefPtr<CefV8Context> context) override; + virtual bool + OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefFrame> frame, +#endif + CefProcessId source_process, + CefRefPtr<CefProcessMessage> message) override; virtual bool Execute(const CefString &name, - CefRefPtr<CefV8Value> object, - const CefV8ValueList &arguments, - CefRefPtr<CefV8Value> &retval, - CefString &exception) override; + CefRefPtr<CefV8Value> object, + const CefV8ValueList &arguments, + CefRefPtr<CefV8Value> &retval, + CefString &exception) override; #ifdef USE_QT_LOOP virtual void OnScheduleMessagePumpWork(int64 delay_ms) override; QTimer frameTimer; #endif +#if !ENABLE_WASHIDDEN + std::unordered_map<int, bool> browserVis; + + void SetFrameDocumentVisibility(CefRefPtr<CefBrowser> browser, + CefRefPtr<CefFrame> frame, + bool isVisible); + void SetDocumentVisibility(CefRefPtr<CefBrowser> browser, + bool isVisible); +#endif + IMPLEMENT_REFCOUNTING(BrowserApp); };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/browser-client.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/browser-client.cpp
Changed
@@ -22,6 +22,7 @@ #include "json11/json11.hpp" #include <obs-frontend-api.h> #include <obs.hpp> +#include <util/platform.h> using namespace json11; @@ -61,28 +62,31 @@ return this; } -bool BrowserClient::OnBeforePopup( - CefRefPtr<CefBrowser>, - CefRefPtr<CefFrame>, - const CefString &, - const CefString &, - WindowOpenDisposition, - bool, - const CefPopupFeatures &, - CefWindowInfo &, - CefRefPtr<CefClient> &, - CefBrowserSettings&, - bool *) +#if CHROME_VERSION_BUILD >= 3683 +CefRefPtr<CefAudioHandler> BrowserClient::GetAudioHandler() +{ + return reroute_audio ? this : nullptr; +} +#endif + +bool BrowserClient::OnBeforePopup(CefRefPtr<CefBrowser>, CefRefPtr<CefFrame>, + const CefString &, const CefString &, + WindowOpenDisposition, bool, + const CefPopupFeatures &, CefWindowInfo &, + CefRefPtr<CefClient> &, CefBrowserSettings &, +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefDictionaryValue> &, +#endif + bool *) { /* block popups */ return true; } -void BrowserClient::OnBeforeContextMenu( - CefRefPtr<CefBrowser>, - CefRefPtr<CefFrame>, - CefRefPtr<CefContextMenuParams>, - CefRefPtr<CefMenuModel> model) +void BrowserClient::OnBeforeContextMenu(CefRefPtr<CefBrowser>, + CefRefPtr<CefFrame>, + CefRefPtr<CefContextMenuParams>, + CefRefPtr<CefMenuModel> model) { /* remove all context menu contributions */ model->Clear(); @@ -90,8 +94,10 @@ bool BrowserClient::OnProcessMessageReceived( CefRefPtr<CefBrowser> browser, - CefProcessId, - CefRefPtr<CefProcessMessage> message) +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefFrame>, +#endif + CefProcessId, CefRefPtr<CefProcessMessage> message) { const std::string &name = message->GetName(); Json json; @@ -111,18 +117,16 @@ if (!name) return false; - json = Json::object { + json = Json::object{ {"name", name}, {"width", (int)obs_source_get_width(current_scene)}, - {"height", (int)obs_source_get_height(current_scene)} - }; + {"height", (int)obs_source_get_height(current_scene)}}; } else if (name == "getStatus") { - json = Json::object { + json = Json::object{ {"recording", obs_frontend_recording_active()}, {"streaming", obs_frontend_streaming_active()}, - {"replaybuffer", obs_frontend_replay_buffer_active()} - }; + {"replaybuffer", obs_frontend_replay_buffer_active()}}; } else { return false; @@ -135,7 +139,7 @@ args->SetInt(0, message->GetArgumentList()->GetInt(0)); args->SetString(1, json.dump()); - browser->SendProcessMessage(PID_RENDERER, msg); + SendBrowserProcessMessage(browser, PID_RENDERER, msg); return true; } @@ -144,11 +148,11 @@ #else bool BrowserClient::GetViewRect( #endif - CefRefPtr<CefBrowser>, - CefRect &rect) + CefRefPtr<CefBrowser>, CefRect &rect) { if (!bs) { #if CHROME_VERSION_BUILD >= 3578 + rect.Set(0, 0, 16, 16); return; #else return false; @@ -163,13 +167,9 @@ #endif } -void BrowserClient::OnPaint( - CefRefPtr<CefBrowser>, - PaintElementType type, - const RectList &, - const void *buffer, - int width, - int height) +void BrowserClient::OnPaint(CefRefPtr<CefBrowser>, PaintElementType type, + const RectList &, const void *buffer, int width, + int height) { if (type != PET_VIEW) { return; @@ -193,28 +193,23 @@ if (!bs->texture && width && height) { obs_enter_graphics(); - bs->texture = gs_texture_create( - width, height, GS_BGRA, 1, - (const uint8_t **)&buffer, - GS_DYNAMIC); + bs->texture = gs_texture_create(width, height, GS_BGRA, 1, + (const uint8_t **)&buffer, + GS_DYNAMIC); bs->width = width; bs->height = height; obs_leave_graphics(); } else { obs_enter_graphics(); - gs_texture_set_image(bs->texture, - (const uint8_t *)buffer, - width * 4, false); + gs_texture_set_image(bs->texture, (const uint8_t *)buffer, + width * 4, false); obs_leave_graphics(); } } #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED -void BrowserClient::OnAcceleratedPaint( - CefRefPtr<CefBrowser>, - PaintElementType, - const RectList &, - void *shared_handle) +void BrowserClient::OnAcceleratedPaint(CefRefPtr<CefBrowser>, PaintElementType, + const RectList &, void *shared_handle) { if (!bs) { return; @@ -231,7 +226,7 @@ #if USE_TEXTURE_COPY texture = gs_texture_open_shared( - (uint32_t)(uintptr_t)shared_handle); + (uint32_t)(uintptr_t)shared_handle); uint32_t cx = gs_texture_get_width(texture); uint32_t cy = gs_texture_get_height(texture); @@ -240,7 +235,7 @@ bs->texture = gs_texture_create(cx, cy, format, 1, nullptr, 0); #else bs->texture = gs_texture_open_shared( - (uint32_t)(uintptr_t)shared_handle); + (uint32_t)(uintptr_t)shared_handle); #endif obs_leave_graphics(); @@ -257,10 +252,111 @@ } #endif -void BrowserClient::OnLoadEnd( - CefRefPtr<CefBrowser>, - CefRefPtr<CefFrame> frame, - int) +#if CHROME_VERSION_BUILD >= 3683 +static speaker_layout GetSpeakerLayout(CefAudioHandler::ChannelLayout cefLayout) +{ + switch (cefLayout) { + case CEF_CHANNEL_LAYOUT_MONO: + return SPEAKERS_MONO; /**< Channels: MONO */ + case CEF_CHANNEL_LAYOUT_STEREO: + return SPEAKERS_STEREO; /**< Channels: FL, FR */ + case CEF_CHANNEL_LAYOUT_2POINT1: + return SPEAKERS_2POINT1; /**< Channels: FL, FR, LFE */ + case CEF_CHANNEL_LAYOUT_2_2: + case CEF_CHANNEL_LAYOUT_QUAD: + case CEF_CHANNEL_LAYOUT_4_0: + return SPEAKERS_4POINT0; /**< Channels: FL, FR, FC, RC */ + case CEF_CHANNEL_LAYOUT_4_1: + return SPEAKERS_4POINT1; /**< Channels: FL, FR, FC, LFE, RC */ + case CEF_CHANNEL_LAYOUT_5_1: + case CEF_CHANNEL_LAYOUT_5_1_BACK: + return SPEAKERS_5POINT1; /**< Channels: FL, FR, FC, LFE, RL, RR */ + case CEF_CHANNEL_LAYOUT_7_1: + case CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK: + case CEF_CHANNEL_LAYOUT_7_1_WIDE: + return SPEAKERS_7POINT1; /**< Channels: FL, FR, FC, LFE, RL, RR, SL, SR */ + } + return SPEAKERS_UNKNOWN; +} + +void BrowserClient::OnAudioStreamStarted(CefRefPtr<CefBrowser> browser, int id, + int, ChannelLayout channel_layout, + int sample_rate, int) +{ + if (!bs) { + return; + } + + AudioStream &stream = bs->audio_streams[id]; + if (!stream.source) { + stream.source = obs_source_create_private("audio_line", nullptr, + nullptr); + obs_source_release(stream.source); + + obs_source_add_active_child(bs->source, stream.source); + + std::lock_guard<std::mutex> lock(bs->audio_sources_mutex); + bs->audio_sources.push_back(stream.source); + } + + stream.speakers = GetSpeakerLayout(channel_layout); + stream.channels = get_audio_channels(stream.speakers); + stream.sample_rate = sample_rate; +} + +void BrowserClient::OnAudioStreamPacket(CefRefPtr<CefBrowser> browser, int id, + const float **data, int frames, + int64_t pts) +{ + if (!bs) { + return; + } + + AudioStream &stream = bs->audio_streams[id]; + struct obs_source_audio audio = {}; + + const uint8_t **pcm = (const uint8_t **)data; + for (int i = 0; i < stream.channels; i++) + audio.data[i] = pcm[i]; + + audio.samples_per_sec = stream.sample_rate; + audio.frames = frames; + audio.format = AUDIO_FORMAT_FLOAT_PLANAR; + audio.speakers = stream.speakers; + audio.timestamp = (uint64_t)pts * 1000000LLU; + + obs_source_output_audio(stream.source, &audio); +} + +void BrowserClient::OnAudioStreamStopped(CefRefPtr<CefBrowser> browser, int id) +{ + if (!bs) { + return; + } + + auto pair = bs->audio_streams.find(id); + if (pair == bs->audio_streams.end()) { + return; + } + + AudioStream &stream = pair->second; + { + std::lock_guard<std::mutex> lock(bs->audio_sources_mutex); + for (size_t i = 0; i < bs->audio_sources.size(); i++) { + obs_source_t *source = bs->audio_sources[i]; + if (source == stream.source) { + bs->audio_sources.erase( + bs->audio_sources.begin() + i); + break; + } + } + } + bs->audio_streams.erase(pair); +} +#endif + +void BrowserClient::OnLoadEnd(CefRefPtr<CefBrowser>, CefRefPtr<CefFrame> frame, + int) { if (!bs) { return; @@ -278,7 +374,8 @@ script += "link.setAttribute('rel', 'stylesheet');"; script += "link.setAttribute('type', 'text/css');"; script += "link.setAttribute('href', '" + href + "');"; - script += "document.getElementsByTagName('head')[0].appendChild(link);"; + script += + "document.getElementsByTagName('head')[0].appendChild(link);"; frame->ExecuteJavaScript(script, href, 0); } @@ -286,11 +383,10 @@ bool BrowserClient::OnConsoleMessage(CefRefPtr<CefBrowser>, #if CHROME_VERSION_BUILD >= 3282 - cef_log_severity_t level, + cef_log_severity_t level, #endif - const CefString &message, - const CefString &source, - int line) + const CefString &message, + const CefString &source, int line) { #if CHROME_VERSION_BUILD >= 3282 if (level < LOGSEVERITY_ERROR) @@ -298,8 +394,6 @@ #endif blog(LOG_INFO, "obs-browser: %s (source: %s:%d)", - message.ToString().c_str(), - source.ToString().c_str(), - line); + message.ToString().c_str(), source.ToString().c_str(), line); return false; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/browser-client.hpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/browser-client.hpp
Changed
@@ -27,11 +27,14 @@ struct BrowserSource; class BrowserClient : public CefClient, - public CefDisplayHandler, - public CefLifeSpanHandler, - public CefContextMenuHandler, - public CefRenderHandler, - public CefLoadHandler { + public CefDisplayHandler, + public CefLifeSpanHandler, + public CefContextMenuHandler, + public CefRenderHandler, +#if CHROME_VERSION_BUILD >= 3683 + public CefAudioHandler, +#endif + public CefLoadHandler { #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED #if USE_TEXTURE_COPY @@ -40,16 +43,19 @@ void *last_handle = INVALID_HANDLE_VALUE; #endif bool sharing_available = false; + bool reroute_audio = true; public: BrowserSource *bs; CefRect popupRect; CefRect originalPopupRect; - inline BrowserClient(BrowserSource *bs_, bool sharing_avail) - : bs(bs_) + inline BrowserClient(BrowserSource *bs_, bool sharing_avail, + bool reroute_audio_) + : bs(bs_), + sharing_available(sharing_avail), + reroute_audio(reroute_audio_) { - sharing_available = sharing_avail; } virtual ~BrowserClient(); @@ -59,43 +65,49 @@ virtual CefRefPtr<CefRenderHandler> GetRenderHandler() override; virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() override; virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override; - virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() - override; + virtual CefRefPtr<CefContextMenuHandler> + GetContextMenuHandler() override; +#if CHROME_VERSION_BUILD >= 3683 + virtual CefRefPtr<CefAudioHandler> GetAudioHandler() override; +#endif - virtual bool OnProcessMessageReceived( - CefRefPtr<CefBrowser> browser, - CefProcessId source_process, - CefRefPtr<CefProcessMessage> message) override; + virtual bool + OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefFrame> frame, +#endif + CefProcessId source_process, + CefRefPtr<CefProcessMessage> message) override; /* CefDisplayHandler */ virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser, #if CHROME_VERSION_BUILD >= 3282 - cef_log_severity_t level, + cef_log_severity_t level, #endif - const CefString &message, - const CefString &source, - int line) override; + const CefString &message, + const CefString &source, + int line) override; /* CefLifeSpanHandler */ - virtual bool OnBeforePopup( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame> frame, - const CefString &target_url, - const CefString &target_frame_name, - WindowOpenDisposition target_disposition, - bool user_gesture, - const CefPopupFeatures &popupFeatures, - CefWindowInfo &windowInfo, - CefRefPtr<CefClient> &client, - CefBrowserSettings &settings, - bool *no_javascript_access) override; + virtual bool + OnBeforePopup(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, + const CefString &target_url, + const CefString &target_frame_name, + WindowOpenDisposition target_disposition, + bool user_gesture, const CefPopupFeatures &popupFeatures, + CefWindowInfo &windowInfo, CefRefPtr<CefClient> &client, + CefBrowserSettings &settings, +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefDictionaryValue> &extra_info, +#endif + bool *no_javascript_access) override; /* CefContextMenuHandler */ - virtual void OnBeforeContextMenu( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame> frame, - CefRefPtr<CefContextMenuParams> params, - CefRefPtr<CefMenuModel> model) override; + virtual void + OnBeforeContextMenu(CefRefPtr<CefBrowser> browser, + CefRefPtr<CefFrame> frame, + CefRefPtr<CefContextMenuParams> params, + CefRefPtr<CefMenuModel> model) override; /* CefRenderHandler */ #if CHROME_VERSION_BUILD >= 3578 @@ -103,28 +115,37 @@ #else virtual bool GetViewRect( #endif - CefRefPtr<CefBrowser> browser, - CefRect &rect) override; - virtual void OnPaint( - CefRefPtr<CefBrowser> browser, - PaintElementType type, - const RectList &dirtyRects, - const void *buffer, - int width, - int height) override; + CefRefPtr<CefBrowser> browser, CefRect &rect) override; + virtual void OnPaint(CefRefPtr<CefBrowser> browser, + PaintElementType type, const RectList &dirtyRects, + const void *buffer, int width, + int height) override; #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED - virtual void OnAcceleratedPaint( - CefRefPtr<CefBrowser> browser, - PaintElementType type, - const RectList &dirtyRects, - void *shared_handle) override; + virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser, + PaintElementType type, + const RectList &dirtyRects, + void *shared_handle) override; #endif +#if CHROME_VERSION_BUILD >= 3683 + virtual void OnAudioStreamPacket(CefRefPtr<CefBrowser> browser, + int audio_stream_id, + const float **data, int frames, + int64_t pts) override; + virtual void OnAudioStreamStopped(CefRefPtr<CefBrowser> browser, + int audio_stream_id); + + virtual void OnAudioStreamStarted(CefRefPtr<CefBrowser> browser, + int audio_stream_id, int channels, + ChannelLayout channel_layout, + int sample_rate, + int frames_per_buffer) override; + +#endif /* CefLoadHandler */ - virtual void OnLoadEnd( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame> frame, - int httpStatusCode) override; + virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser, + CefRefPtr<CefFrame> frame, + int httpStatusCode) override; IMPLEMENT_REFCOUNTING(BrowserClient); };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/browser-scheme.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/browser-scheme.cpp
Changed
@@ -18,112 +18,44 @@ #include "browser-scheme.hpp" #include "wide-string.hpp" +#include <include/wrapper/cef_stream_resource_handler.h> -/* ------------------------------------------------------------------------- */ - -CefRefPtr<CefResourceHandler> BrowserSchemeHandlerFactory::Create( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame>, - const CefString &, - CefRefPtr<CefRequest> request) +#if !ENABLE_LOCAL_FILE_URL_SCHEME +CefRefPtr<CefResourceHandler> +BrowserSchemeHandlerFactory::Create(CefRefPtr<CefBrowser> browser, + CefRefPtr<CefFrame>, const CefString &, + CefRefPtr<CefRequest> request) { if (!browser || !request) return nullptr; - return CefRefPtr<BrowserSchemeHandler>(new BrowserSchemeHandler()); -} - -/* ------------------------------------------------------------------------- */ - -bool BrowserSchemeHandler::ProcessRequest( - CefRefPtr<CefRequest> request, - CefRefPtr<CefCallback> callback) -{ CefURLParts parts; CefParseURL(request->GetURL(), parts); std::string path = CefString(&parts.path); path = CefURIDecode(path, true, cef_uri_unescape_rule_t::UU_SPACES); - path = CefURIDecode(path, true, cef_uri_unescape_rule_t::UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS); - -#ifdef WIN32 - inputStream.open(to_wide(path.erase(0,1)), std::ifstream::binary); -#else - inputStream.open(path, std::ifstream::binary); -#endif - - /* Set fileName for use in GetResponseHeaders */ - fileName = path; - - if (!inputStream.is_open()) { - return false; - } - - inputStream.seekg(0, std::ifstream::end); - length = remaining = inputStream.tellg(); - inputStream.seekg(0, std::ifstream::beg); - callback->Continue(); - return true; -} - -void BrowserSchemeHandler::GetResponseHeaders( - CefRefPtr<CefResponse> response, - int64 &response_length, - CefString &redirectUrl) -{ - if (!response) { - response_length = -1; - redirectUrl = ""; - return; - } + path = CefURIDecode( + path, true, + cef_uri_unescape_rule_t:: + UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS); - std::string fileExtension = - fileName.substr(fileName.find_last_of(".") + 1); + std::string fileExtension = path.substr(path.find_last_of(".") + 1); for (char &ch : fileExtension) ch = (char)tolower(ch); if (fileExtension.compare("woff2") == 0) fileExtension = "woff"; - response->SetStatus(200); - response->SetMimeType(CefGetMimeType(fileExtension)); - response->SetStatusText("OK"); - response_length = length; - redirectUrl = ""; -} - -bool BrowserSchemeHandler::ReadResponse( - void *data_out, - int bytes_to_read, - int &bytes_read, - CefRefPtr<CefCallback>) -{ - if (!data_out || !inputStream.is_open()) { - bytes_read = 0; - inputStream.close(); - return false; - } - - if (isComplete) { - bytes_read = 0; - return false; - } - - inputStream.read((char *)data_out, bytes_to_read); - bytes_read = (int)inputStream.gcount(); - remaining -= bytes_read; - - if (remaining == 0) { - isComplete = true; - inputStream.close(); - } - - return true; -} +#ifdef _WIN32 + CefRefPtr<CefStreamReader> stream = + CefStreamReader::CreateForFile(path.substr(1)); +#else + CefRefPtr<CefStreamReader> stream = + CefStreamReader::CreateForFile(path); +#endif -void BrowserSchemeHandler::Cancel() -{ - if (inputStream.is_open()) - inputStream.close(); + return new CefStreamResourceHandler(CefGetMimeType(fileExtension), + stream); } +#endif
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/browser-scheme.hpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/browser-scheme.hpp
Changed
@@ -22,38 +22,19 @@ #include <string> #include <fstream> +#if CHROME_VERSION_BUILD >= 3440 +#define ENABLE_LOCAL_FILE_URL_SCHEME 1 +#else +#define ENABLE_LOCAL_FILE_URL_SCHEME 0 +#endif + +#if !ENABLE_LOCAL_FILE_URL_SCHEME class BrowserSchemeHandlerFactory : public CefSchemeHandlerFactory { public: - virtual CefRefPtr<CefResourceHandler> Create( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame>, - const CefString &, - CefRefPtr<CefRequest> request) override; + virtual CefRefPtr<CefResourceHandler> + Create(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame>, + const CefString &, CefRefPtr<CefRequest> request) override; IMPLEMENT_REFCOUNTING(BrowserSchemeHandlerFactory); }; - -class BrowserSchemeHandler : public CefResourceHandler { - std::string fileName; - std::ifstream inputStream; - bool isComplete = false; - int64 length = 0; - int64 remaining = 0; - -public: - virtual bool ProcessRequest( - CefRefPtr<CefRequest> request, - CefRefPtr<CefCallback> callback) override; - virtual void GetResponseHeaders( - CefRefPtr<CefResponse> response, - int64 &response_length, - CefString &redirectUrl) override; - virtual bool ReadResponse( - void *data_out, - int bytes_to_read, - int &bytes_read, - CefRefPtr<CefCallback> callback) override; - virtual void Cancel() override; - - IMPLEMENT_REFCOUNTING(BrowserSchemeHandler); -}; +#endif
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/browser-version.h -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/browser-version.h
Changed
@@ -1,25 +1,23 @@ #pragma once #define OBS_BROWSER_VERSION_MAJOR 2 -#define OBS_BROWSER_VERSION_MINOR 4 -#define OBS_BROWSER_VERSION_PATCH 0 +#define OBS_BROWSER_VERSION_MINOR 7 +#define OBS_BROWSER_VERSION_PATCH 8 #ifndef MAKE_SEMANTIC_VERSION #define MAKE_SEMANTIC_VERSION(major, minor, patch) \ - ((major << 24) | \ - (minor << 16) | \ - patch ) + ((major << 24) | (minor << 16) | patch) #endif -#define OBS_BROWSER_VERSION_INT \ +#define OBS_BROWSER_VERSION_INT \ MAKE_SEMANTIC_VERSION(OBS_BROWSER_VERSION_MAJOR, \ - OBS_BROWSER_VERSION_MINOR, \ - OBS_BROWSER_VERSION_PATCH) + OBS_BROWSER_VERSION_MINOR, \ + OBS_BROWSER_VERSION_PATCH) #define OBS_BROWSER_MACRO_STR_(x) #x #define OBS_BROWSER_MACRO_STR(x) OBS_BROWSER_MACRO_STR_(x) -#define OBS_BROWSER_VERSION_STRING \ - OBS_BROWSER_MACRO_STR(OBS_BROWSER_VERSION_MAJOR) "." \ - OBS_BROWSER_MACRO_STR(OBS_BROWSER_VERSION_MINOR) "." \ - OBS_BROWSER_MACRO_STR(OBS_BROWSER_VERSION_PATCH) +#define OBS_BROWSER_VERSION_STRING \ + OBS_BROWSER_MACRO_STR(OBS_BROWSER_VERSION_MAJOR) \ + "." OBS_BROWSER_MACRO_STR(OBS_BROWSER_VERSION_MINOR) "." OBS_BROWSER_MACRO_STR( \ + OBS_BROWSER_VERSION_PATCH)
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/cef-headers.hpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/cef-headers.hpp
Changed
@@ -19,12 +19,12 @@ #pragma once #ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable : 4100) +#pragma warning(push) +#pragma warning(disable : 4100) #else -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-parameter" -# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif #include <include/cef_app.h> @@ -35,9 +35,24 @@ #include <include/cef_scheme.h> #include <include/cef_version.h> #include <include/cef_render_process_handler.h> +#include <include/cef_request_context_handler.h> + +#if CHROME_VERSION_BUILD < 3507 +#define ENABLE_WASHIDDEN 1 +#else +#define ENABLE_WASHIDDEN 0 +#endif + +#if CHROME_VERSION_BUILD >= 3770 +#define SendBrowserProcessMessage(browser, pid, msg) \ + browser->GetMainFrame()->SendProcessMessage(pid, msg); +#else +#define SendBrowserProcessMessage(browser, pid, msg) \ + browser->SendProcessMessage(pid, msg); +#endif #ifdef _MSC_VER -# pragma warning(pop) +#pragma warning(pop) #else -# pragma GCC diagnostic pop +#pragma GCC diagnostic pop #endif
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/ar-SA.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/ar-SA.ini
Changed
@@ -7,4 +7,7 @@ ShutdownSourceNotVisible="إيقاف تشغيل المصدر عندما لا يكون مرئياً" RefreshBrowserActive="قم بتحديث المستعرض عندما يصبح المشهد نشطاً" RefreshNoCache="تحديث ذاكرة التخزين المؤقت للصفحة الحالية" +BrowserSource="متصفح" +CustomFrameRate="استخدام معدل إطارات مخصص" +RerouteAudio="إعادة توجيه الصوت إلى OBS"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/bg-BG.ini
Added
@@ -0,0 +1,12 @@ +LocalFile="Локален файл" +URL="URL адрес" +Width="Ширина" +Height="Височина" +FPS="Кдр. в сек." +ShutdownSourceNotVisible="Изключване на източника, когато не е видим" +RefreshBrowserActive="Опресняване на браузъра, когато сцената стане активна" +RefreshNoCache="Опресняване на кеша на текущата страница" +RestartCEF="Рестартиране на CEF" +BrowserSource="Браузър" +CustomFrameRate="Използване на настроена кадрова честота" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/ca-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/ca-ES.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Reinicia CEF" BrowserSource="Navegador" CustomFrameRate="Utilitza una taxa de fotogrames personalitzada" +RerouteAudio="Encamina l'àudio a l'OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/cs-CZ.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/cs-CZ.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Restartovat CEF" BrowserSource="Prohlížeč" CustomFrameRate="Použít vlastní snímkovací frekvenci" +RerouteAudio="Přesměrovat zvuk do OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/da-DK.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/da-DK.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Genstart CEF" BrowserSource="Browser" CustomFrameRate="Benyt tilpasset billedhastighed" +RerouteAudio="Omdirigér lyd til OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/de-DE.ini
Changed
@@ -7,7 +7,8 @@ ShutdownSourceNotVisible="Deaktivieren, wenn Quelle nicht sichtbar ist" RefreshBrowserActive="Browser aktualisieren, wenn die Szene aktiv wird" RefreshNoCache="Cache der aktuellen Seite aktualisieren" -RestartCEF="CEF neu starten" +RestartCEF="CEF neustarten" BrowserSource="Browser" CustomFrameRate="Benutzerdefinierte FPS verwenden" +RerouteAudio="Audio zu OBS umleiten"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/el-GR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/el-GR.ini
Changed
@@ -9,4 +9,5 @@ RefreshNoCache="Ανανέωση της μνήμης cache της τρέχουσας σελίδας" RestartCEF="Επανεκκίνηση του CEF" BrowserSource="Πρόγραμμα περιήγησης" +RerouteAudio="Επαναφέρετε τον ήχο στο OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/en-US.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/en-US.ini
Changed
@@ -10,3 +10,4 @@ RestartCEF="Restart CEF" BrowserSource="Browser" CustomFrameRate="Use custom frame rate" +RerouteAudio="Reroute audio to OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/es-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/es-ES.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Reiniciar CEF" BrowserSource="Navegador" CustomFrameRate="Usar frecuencia de imágenes personalizada" +RerouteAudio="Redirigir audio a OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/eu-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/eu-ES.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Berrabiarazi CEF" BrowserSource="Nabigatzailea" CustomFrameRate="Erabili fotograma-emari pertsonalizatua" +RerouteAudio="Birbideratu audioa OBSra"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/fa-IR.ini
Added
@@ -0,0 +1,13 @@ +LocalFile="فایل محلی" +URL="آدرس اینترنتی" +Width="عرض" +Height="ارتفاع" +FPS="فریم در ثانیه (اف پی اس)" +CSS="css سفارشی" +ShutdownSourceNotVisible="خاموش کردن منبع وقتی قابل رویت نیست" +RefreshBrowserActive="تازه کردن مرورگر که صحنه فعال می شود" +RefreshNoCache="تازه کردن حافظه نهان صفحه کنونی" +RestartCEF="راه اندازی مجدد CEF" +BrowserSource="مرورگر" +CustomFrameRate="نرخ فریم های سفارشی استفاده" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/fr-FR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/fr-FR.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Redémarrer CEF" BrowserSource="Navigateur" CustomFrameRate="Utiliser un débit d'images personnalisé" +RerouteAudio="Router l'audio vers OBS"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/gl-ES.ini
Added
@@ -0,0 +1,14 @@ +LocalFile="Ficheiro local" +URL="URL" +Width="Largo" +Height="Alto" +FPS="FPS" +CSS="CSS personalizado" +ShutdownSourceNotVisible="Apagar a fonte cando non sexa visíbel" +RefreshBrowserActive="Actualizar o navegador cando se active a escena" +RefreshNoCache="Actualizar a caché da páxina actual" +RestartCEF="Reiniciar CEF" +BrowserSource="Navegador" +CustomFrameRate="Usar unha taxa de fotogramas personalizada" +RerouteAudio="Redirixir o son a OBS" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/hu-HU.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/hu-HU.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="CEF újraindítása" BrowserSource="Böngésző" CustomFrameRate="Egyéni képkockaráta használata" +RerouteAudio="Hang átvezetése OBS-be"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/it-IT.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/it-IT.ini
Changed
@@ -2,12 +2,13 @@ URL="URL" Width="Larghezza" Height="Altezza" -FPS="FPS (Fotogrammi al secondo)" +FPS="Fotogrammi al secondo" CSS="CSS personalizzato" -ShutdownSourceNotVisible="Arresta quando la sorgente non è visibile" -RefreshBrowserActive="Aggiorna il browser quando la scena diventa attiva" -RefreshNoCache="Ricarica cache della la pagina attuale" +ShutdownSourceNotVisible="Chiudi la fonte quando non è visibile" +RefreshBrowserActive="Ricarica la pagina del browser quando la scena diventa attiva" +RefreshNoCache="Aggiorna la cache della pagina attuale" RestartCEF="Riavvia il CEF" BrowserSource="Browser" -CustomFrameRate="Usa un frame rate personalizzato" +CustomFrameRate="Utilizza una velocità dei fotogrammi personalizzata" +RerouteAudio="Indirizza audio a OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/ja-JP.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/ja-JP.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="CEF を再起動" BrowserSource="ブラウザ" CustomFrameRate="カスタムフレームレートを使用" +RerouteAudio="OBSに音声を再ルーティングする"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/ka-GE.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="CEF-ის ხელახლა გაშვება" BrowserSource="ბრაუზერი" CustomFrameRate="მითითებული კადრის სიხშირე" +RerouteAudio="ხმოვანი სიგნალის გადაწყობა OBS-ში"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/ko-KR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/ko-KR.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="CEF 재시작" BrowserSource="브라우저" CustomFrameRate="사용자가 임의로 설정한 프레임 레이트 사용" +RerouteAudio="OBS로 오디오를 재편성"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/nl-NL.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/nl-NL.ini
Changed
@@ -9,4 +9,6 @@ RefreshNoCache="Cache van de huidige pagina vernieuwen" RestartCEF="CEF herstarten" BrowserSource="Browser" +CustomFrameRate="Gebruik aangepaste frame rate" +RerouteAudio="Audio omleiden naar OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/pl-PL.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/pl-PL.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Uruchom ponownie CEF" BrowserSource="Przeglądarka" CustomFrameRate="Własne ustawienia FPS" +RerouteAudio="Przekieruj dźwięk z powrotem do OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/pt-BR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/pt-BR.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Reiniciar o CEF" BrowserSource="Navegador" CustomFrameRate="Usar taxa de quadros personalizada" +RerouteAudio="Redirecionar áudio para o OBS"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/ro-RO.ini
Added
@@ -0,0 +1,9 @@ +LocalFile="Fișier local" +Width="Lățime" +Height="Înălțime" +CSS="CSS personalizat" +ShutdownSourceNotVisible="Închide sursa când nu este vizibilă" +RefreshBrowserActive="Reîmprospătează browserul când scena devine activă" +RefreshNoCache="Reîmprospătează memoria cache a paginii actuale" +CustomFrameRate="Folosește o frecvență de cadre personalizată" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/ru-RU.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/ru-RU.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Перезапустить CEF" BrowserSource="Браузер" CustomFrameRate="Использовать настраиваемую частоту кадров" +RerouteAudio="Перенаправить аудио в OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/sk-SK.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/sk-SK.ini
Changed
@@ -9,4 +9,5 @@ RefreshNoCache="Vyčistiť medzi-pamäť aktuálnej stránky" RestartCEF="Reštartovať CEF" BrowserSource="Prehliadač" +CustomFrameRate="Použiť vlastnú snímkovú rýchlosť"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/sl-SI.ini
Added
@@ -0,0 +1,14 @@ +LocalFile="Lokalna datoteka" +URL="URL" +Width="Širina" +Height="Višina" +FPS="sl./s" +CSS="CSS po meri" +ShutdownSourceNotVisible="Izklopi vir, ko ni viden" +RefreshBrowserActive="Osveži brskalnik, ko prizor postane dejaven" +RefreshNoCache="Osveži medpomnilnik trenutne strani" +RestartCEF="Ponovno zaženi CEF" +BrowserSource="Brskalnik" +CustomFrameRate="Uporabi hitrost sličic po meri" +RerouteAudio="Preusmeri zvok v OBS" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/sv-SE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/sv-SE.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Uppdatera CEF" BrowserSource="Webbläsare" CustomFrameRate="Använd anpassad bildfrekvens" +RerouteAudio="Omdirigera ljud till OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/uk-UA.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/uk-UA.ini
Changed
@@ -10,4 +10,5 @@ RestartCEF="Перезапустити CEF" BrowserSource="Браузер" CustomFrameRate="Використовувати власну Частоту кадрів" +RerouteAudio="Перенаправити джерела звуку до OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/zh-CN.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/zh-CN.ini
Changed
@@ -9,5 +9,6 @@ RefreshNoCache="刷新当前页面缓存" RestartCEF="重启 CEF" BrowserSource="浏览器" -CustomFrameRate="使用自定义帧速率" +CustomFrameRate="使用自定义帧率" +RerouteAudio="将音频重新路由到 OBS"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/data/locale/zh-TW.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/data/locale/zh-TW.ini
Changed
@@ -7,7 +7,8 @@ ShutdownSourceNotVisible="不可見時關閉來源" RefreshBrowserActive="取得焦點時更新瀏覽器" RefreshNoCache="更新當前頁面快取" -RestartCEF="重新啟動CEF" +RestartCEF="重新啟動 CEF" BrowserSource="瀏覽器" CustomFrameRate="使用自訂的畫面速率" +RerouteAudio="重新路由音訊至 OBS"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-browser/deps/base64/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-24.0.0.tar.xz/plugins/obs-browser/deps/json11/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/obs-browser-page/obs-browser-page-main.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/obs-browser-page/obs-browser-page-main.cpp
Changed
@@ -34,17 +34,18 @@ static bool thread_initialized = false; DECLARE_HANDLE(OBS_DPI_AWARENESS_CONTEXT); -#define OBS_DPI_AWARENESS_CONTEXT_UNAWARE ((OBS_DPI_AWARENESS_CONTEXT)-1) -#define OBS_DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((OBS_DPI_AWARENESS_CONTEXT)-2) -#define OBS_DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((OBS_DPI_AWARENESS_CONTEXT)-3) -#define OBS_DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((OBS_DPI_AWARENESS_CONTEXT)-4) +#define OBS_DPI_AWARENESS_CONTEXT_UNAWARE ((OBS_DPI_AWARENESS_CONTEXT)-1) +#define OBS_DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((OBS_DPI_AWARENESS_CONTEXT)-2) +#define OBS_DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE \ + ((OBS_DPI_AWARENESS_CONTEXT)-3) +#define OBS_DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 \ + ((OBS_DPI_AWARENESS_CONTEXT)-4) static bool SetHighDPIv2Scaling() { - static BOOL (WINAPI *func)(OBS_DPI_AWARENESS_CONTEXT) = nullptr; + static BOOL(WINAPI * func)(OBS_DPI_AWARENESS_CONTEXT) = nullptr; func = reinterpret_cast<decltype(func)>(GetProcAddress( - GetModuleHandleW(L"USER32"), - "SetProcessDpiAwarenessContext")); + GetModuleHandleW(L"USER32"), "SetProcessDpiAwarenessContext")); if (!func) { return false; } @@ -73,8 +74,7 @@ CloseHandle(parent); } -int CALLBACK WinMain(HINSTANCE, HINSTANCE, - LPSTR, int) +int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { std::thread shutdown_check; @@ -91,9 +91,8 @@ if (!parent_pid_str.empty()) { shutdown_event = CreateEvent(nullptr, true, false, nullptr); DWORD parent_pid = (DWORD)std::stoi(parent_pid_str); - shutdown_check = std::thread(shutdown_check_thread, - parent_pid, - GetCurrentThreadId()); + shutdown_check = std::thread(shutdown_check_thread, parent_pid, + GetCurrentThreadId()); thread_initialized = true; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/obs-browser-plugin.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/obs-browser-plugin.cpp
Changed
@@ -83,8 +83,8 @@ * call otherwise the CEF message pump may stop functioning * correctly, it's only supposed to take 10ms max */ QMetaObject::invokeMethod(&messageObject, "ExecuteTask", - Qt::QueuedConnection, - Q_ARG(MessageTask, task)); + Qt::QueuedConnection, + Q_ARG(MessageTask, task)); #else task(); #endif @@ -95,7 +95,8 @@ bool QueueCEFTask(std::function<void()> task) { - return CefPostTask(TID_UI, CefRefPtr<BrowserTask>(new BrowserTask(task))); + return CefPostTask(TID_UI, + CefRefPtr<BrowserTask>(new BrowserTask(task))); } /* ========================================================================= */ @@ -110,7 +111,7 @@ static void browser_source_get_defaults(obs_data_t *settings) { obs_data_set_default_string(settings, "url", - "https://obsproject.com/browser-source"); + "https://obsproject.com/browser-source"); obs_data_set_default_int(settings, "width", 800); obs_data_set_default_int(settings, "height", 600); obs_data_set_default_int(settings, "fps", 30); @@ -122,10 +123,11 @@ obs_data_set_default_bool(settings, "shutdown", false); obs_data_set_default_bool(settings, "restart_when_active", false); obs_data_set_default_string(settings, "css", default_css); + obs_data_set_default_bool(settings, "reroute_audio", true); } -static bool is_local_file_modified(obs_properties_t *props, - obs_property_t *, obs_data_t *settings) +static bool is_local_file_modified(obs_properties_t *props, obs_property_t *, + obs_data_t *settings) { bool enabled = obs_data_get_bool(settings, "is_local_file"); obs_property_t *url = obs_properties_get(props, "url"); @@ -136,8 +138,8 @@ return true; } -static bool is_fps_custom(obs_properties_t *props, - obs_property_t *, obs_data_t *settings) +static bool is_fps_custom(obs_properties_t *props, obs_property_t *, + obs_data_t *settings) { bool enabled = obs_data_get_bool(settings, "fps_custom"); obs_property_t *fps = obs_properties_get(props, "fps"); @@ -153,8 +155,8 @@ DStr path; obs_properties_set_flags(props, OBS_PROPERTIES_DEFER_UPDATE); - obs_property_t *prop = obs_properties_add_bool(props, "is_local_file", - obs_module_text("LocalFile")); + obs_property_t *prop = obs_properties_add_bool( + props, "is_local_file", obs_module_text("LocalFile")); if (bs && !bs->url.empty()) { const char *slash; @@ -168,40 +170,41 @@ obs_property_set_modified_callback(prop, is_local_file_modified); obs_properties_add_path(props, "local_file", - obs_module_text("Local file"), OBS_PATH_FILE, "*.*", - path->array); - obs_properties_add_text(props, "url", - obs_module_text("URL"), OBS_TEXT_DEFAULT); - - obs_properties_add_int(props, "width", - obs_module_text("Width"), 1, 4096, 1); - obs_properties_add_int(props, "height", - obs_module_text("Height"), 1, 4096, 1); - - obs_property_t *fps_set = obs_properties_add_bool(props, "fps_custom", - obs_module_text("CustomFrameRate")); + obs_module_text("Local file"), OBS_PATH_FILE, + "*.*", path->array); + obs_properties_add_text(props, "url", obs_module_text("URL"), + OBS_TEXT_DEFAULT); + + obs_properties_add_int(props, "width", obs_module_text("Width"), 1, + 4096, 1); + obs_properties_add_int(props, "height", obs_module_text("Height"), 1, + 4096, 1); + + obs_property_t *fps_set = obs_properties_add_bool( + props, "fps_custom", obs_module_text("CustomFrameRate")); obs_property_set_modified_callback(fps_set, is_fps_custom); #if !EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED obs_property_set_enabled(fps_set, false); #endif - obs_properties_add_int(props, "fps", - obs_module_text("FPS"), 1, 60, 1); - obs_properties_add_text(props, "css", - obs_module_text("CSS"), OBS_TEXT_MULTILINE); + obs_properties_add_int(props, "fps", obs_module_text("FPS"), 1, 60, 1); + obs_properties_add_text(props, "css", obs_module_text("CSS"), + OBS_TEXT_MULTILINE); obs_properties_add_bool(props, "shutdown", - obs_module_text("ShutdownSourceNotVisible")); + obs_module_text("ShutdownSourceNotVisible")); obs_properties_add_bool(props, "restart_when_active", - obs_module_text("RefreshBrowserActive")); - - obs_properties_add_button(props, "refreshnocache", - obs_module_text("RefreshNoCache"), - [] (obs_properties_t *, obs_property_t *, void *data) - { - static_cast<BrowserSource *>(data)->Refresh(); - return false; - }); + obs_module_text("RefreshBrowserActive")); + + obs_properties_add_button( + props, "refreshnocache", obs_module_text("RefreshNoCache"), + [](obs_properties_t *, obs_property_t *, void *data) { + static_cast<BrowserSource *>(data)->Refresh(); + return false; + }); + + obs_properties_add_bool(props, "reroute_audio", + obs_module_text("RerouteAudio")); return props; } @@ -216,7 +219,8 @@ path += ".exe"; CefMainArgs args; #else - /* On non-windows platforms, ie macOS, we'll want to pass thru flags to CEF */ + /* On non-windows platforms, ie macOS, we'll want to pass thru flags to + * CEF */ struct obs_cmdline_args cmdline_args = obs_get_cmdline_args(); CefMainArgs args(cmdline_args.argc, cmdline_args.argv); #endif @@ -266,8 +270,12 @@ app = new BrowserApp(tex_sharing_avail); CefExecuteProcess(args, app, nullptr); CefInitialize(args, settings, app, nullptr); +#if !ENABLE_LOCAL_FILE_URL_SCHEME + /* Register http://absolute/ scheme handler for older + * CEF builds which do not support file:// URLs */ CefRegisterSchemeHandlerFactory("http", "absolute", - new BrowserSchemeHandlerFactory()); + new BrowserSchemeHandlerFactory()); +#endif os_event_signal(cef_started_event); } @@ -278,7 +286,8 @@ static void BrowserShutdown(void) { #ifdef USE_QT_LOOP - while (messageObject.ExecuteNextBrowserTask()); + while (messageObject.ExecuteNextBrowserTask()) + ; CefDoMessageLoopWork(); #endif CefShutdown(); @@ -308,103 +317,89 @@ void RegisterBrowserSource() { struct obs_source_info info = {}; - info.id = "browser_source"; - info.type = OBS_SOURCE_TYPE_INPUT; - info.output_flags = OBS_SOURCE_VIDEO | - OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_INTERACTION | - OBS_SOURCE_DO_NOT_DUPLICATE; - info.get_properties = browser_source_get_properties; - info.get_defaults = browser_source_get_defaults; - - info.get_name = [] (void *) - { - return obs_module_text("BrowserSource"); - }; - info.create = [] (obs_data_t *settings, obs_source_t *source) -> void * - { + info.id = "browser_source"; + info.type = OBS_SOURCE_TYPE_INPUT; + info.output_flags = OBS_SOURCE_VIDEO | +#if CHROME_VERSION_BUILD >= 3683 + OBS_SOURCE_AUDIO | +#endif + OBS_SOURCE_CUSTOM_DRAW | OBS_SOURCE_INTERACTION | + OBS_SOURCE_DO_NOT_DUPLICATE | + OBS_SOURCE_MONITOR_BY_DEFAULT; + info.get_properties = browser_source_get_properties; + info.get_defaults = browser_source_get_defaults; + + info.get_name = [](void *) { return obs_module_text("BrowserSource"); }; + info.create = [](obs_data_t *settings, obs_source_t *source) -> void * { obs_browser_initialize(); return new BrowserSource(settings, source); }; - info.destroy = [] (void *data) - { + info.destroy = [](void *data) { delete static_cast<BrowserSource *>(data); }; - info.update = [] (void *data, obs_data_t *settings) - { + info.update = [](void *data, obs_data_t *settings) { static_cast<BrowserSource *>(data)->Update(settings); }; - info.get_width = [] (void *data) - { - return (uint32_t)static_cast<BrowserSource *>(data)->width; + info.get_width = [](void *data) { + return (uint32_t) static_cast<BrowserSource *>(data)->width; }; - info.get_height = [] (void *data) - { - return (uint32_t)static_cast<BrowserSource *>(data)->height; + info.get_height = [](void *data) { + return (uint32_t) static_cast<BrowserSource *>(data)->height; }; - info.video_tick = [] (void *data, float) - { + info.video_tick = [](void *data, float) { static_cast<BrowserSource *>(data)->Tick(); }; - info.video_render = [] (void *data, gs_effect_t *) - { + info.video_render = [](void *data, gs_effect_t *) { static_cast<BrowserSource *>(data)->Render(); }; - info.mouse_click = [] ( - void *data, - const struct obs_mouse_event *event, - int32_t type, - bool mouse_up, - uint32_t click_count) - { +#if CHROME_VERSION_BUILD >= 3683 + info.audio_mix = [](void *data, uint64_t *ts_out, + struct audio_output_data *audio_output, + size_t channels, size_t sample_rate) { + return static_cast<BrowserSource *>(data)->AudioMix( + ts_out, audio_output, channels, sample_rate); + }; + info.enum_active_sources = [](void *data, obs_source_enum_proc_t cb, + void *param) { + static_cast<BrowserSource *>(data)->EnumAudioStreams(cb, param); + }; +#endif + info.mouse_click = [](void *data, const struct obs_mouse_event *event, + int32_t type, bool mouse_up, + uint32_t click_count) { static_cast<BrowserSource *>(data)->SendMouseClick( - event, type, mouse_up, click_count); + event, type, mouse_up, click_count); }; - info.mouse_move = [] ( - void *data, - const struct obs_mouse_event *event, - bool mouse_leave) - { - static_cast<BrowserSource *>(data)->SendMouseMove( - event, mouse_leave); + info.mouse_move = [](void *data, const struct obs_mouse_event *event, + bool mouse_leave) { + static_cast<BrowserSource *>(data)->SendMouseMove(event, + mouse_leave); }; - info.mouse_wheel = [] ( - void *data, - const struct obs_mouse_event *event, - int x_delta, - int y_delta) - { + info.mouse_wheel = [](void *data, const struct obs_mouse_event *event, + int x_delta, int y_delta) { static_cast<BrowserSource *>(data)->SendMouseWheel( - event, x_delta, y_delta); + event, x_delta, y_delta); }; - info.focus = [] (void *data, bool focus) - { + info.focus = [](void *data, bool focus) { static_cast<BrowserSource *>(data)->SendFocus(focus); }; - info.key_click = [] ( - void *data, - const struct obs_key_event *event, - bool key_up) - { + info.key_click = [](void *data, const struct obs_key_event *event, + bool key_up) { static_cast<BrowserSource *>(data)->SendKeyClick(event, key_up); }; - info.show = [] (void *data) - { + info.show = [](void *data) { static_cast<BrowserSource *>(data)->SetShowing(true); }; - info.hide = [] (void *data) - { + info.hide = [](void *data) { static_cast<BrowserSource *>(data)->SetShowing(false); }; - info.activate = [] (void *data) - { + info.activate = [](void *data) { BrowserSource *bs = static_cast<BrowserSource *>(data); if (bs->restart) bs->Refresh(); bs->SetActive(true); }; - info.deactivate = [] (void *data) - { + info.deactivate = [](void *data) { static_cast<BrowserSource *>(data)->SetActive(false); }; @@ -442,27 +437,25 @@ case OBS_FRONTEND_EVENT_RECORDING_STOPPED: DispatchJSEvent("obsRecordingStopped", ""); break; - case OBS_FRONTEND_EVENT_SCENE_CHANGED: - { - OBSSource source = obs_frontend_get_current_scene(); - obs_source_release(source); + case OBS_FRONTEND_EVENT_SCENE_CHANGED: { + OBSSource source = obs_frontend_get_current_scene(); + obs_source_release(source); - if (!source) - break; + if (!source) + break; - const char *name = obs_source_get_name(source); - if (!name) - break; + const char *name = obs_source_get_name(source); + if (!name) + break; - Json json = Json::object { - {"name", name}, - {"width", (int)obs_source_get_width(source)}, - {"height", (int)obs_source_get_height(source)} - }; + Json json = Json::object{ + {"name", name}, + {"width", (int)obs_source_get_width(source)}, + {"height", (int)obs_source_get_height(source)}}; - DispatchJSEvent("obsSceneChanged", json.dump()); - break; - } + DispatchJSEvent("obsSceneChanged", json.dump()); + break; + } case OBS_FRONTEND_EVENT_EXIT: DispatchJSEvent("obsExit", ""); break; @@ -478,7 +471,7 @@ HRESULT hr; UINT i = 0; - hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&factory); + hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void **)&factory); if (FAILED(hr)) return; @@ -503,18 +496,12 @@ #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED static const wchar_t *blacklisted_devices[] = { - L"Intel", - L"Microsoft", - L"Radeon HD 8850M", - L"Radeon HD 7660", - nullptr -}; + L"Intel", L"Microsoft", L"Radeon HD 8850M", L"Radeon HD 7660", nullptr}; #endif bool obs_module_load(void) { - blog(LOG_INFO, "[obs-browser]: Version %s", - OBS_BROWSER_VERSION_STRING); + blog(LOG_INFO, "[obs-browser]: Version %s", OBS_BROWSER_VERSION_STRING); #ifdef USE_QT_LOOP qRegisterMetaType<MessageTask>("MessageTask"); @@ -541,11 +528,11 @@ if (!!wstrstri(deviceId.c_str(), *device)) { hwaccel = false; blog(LOG_INFO, "[obs-browser]: " - "Blacklisted device " - "detected, " - "disabling browser " - "source hardware " - "acceleration."); + "Blacklisted device " + "detected, " + "disabling browser " + "source hardware " + "acceleration."); break; } device++; @@ -562,7 +549,7 @@ BrowserShutdown(); #else if (manager_thread.joinable()) { - while (!QueueCEFTask([] () {CefQuitMessageLoop();})) + while (!QueueCEFTask([]() { CefQuitMessageLoop(); })) os_sleep_ms(5); manager_thread.join();
View file
obs-studio-24.0.0.tar.xz/plugins/obs-browser/obs-browser-source-audio.cpp
Added
@@ -0,0 +1,87 @@ +/****************************************************************************** + Copyright (C) 2019 by Hugh Bailey ("Jim") <jim@obsproject.com> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + ******************************************************************************/ + +#include "obs-browser-source.hpp" + +void BrowserSource::EnumAudioStreams(obs_source_enum_proc_t cb, void *param) +{ + std::lock_guard<std::mutex> lock(audio_sources_mutex); + for (obs_source_t *audio_source : audio_sources) { + cb(source, audio_source, param); + } +} + +static inline void mix_audio(float *p_out, float *p_in, size_t pos, + size_t count) +{ + register float *out = p_out; + register float *in = p_in + pos; + register float *end = in + count; + + while (in < end) + *(out++) += *(in++); +} + +bool BrowserSource::AudioMix(uint64_t *ts_out, + struct audio_output_data *audio_output, + size_t channels, size_t sample_rate) +{ + uint64_t timestamp = 0; + struct obs_source_audio_mix child_audio; + + std::lock_guard<std::mutex> lock(audio_sources_mutex); + for (obs_source_t *s : audio_sources) { + if (!obs_source_audio_pending(s)) { + uint64_t source_ts = obs_source_get_audio_timestamp(s); + + if (source_ts && (!timestamp || source_ts < timestamp)) + timestamp = source_ts; + } + } + + if (!timestamp) + return false; + + for (obs_source_t *s : audio_sources) { + uint64_t source_ts; + size_t pos, count; + + if (obs_source_audio_pending(s)) { + continue; + } + + source_ts = obs_source_get_audio_timestamp(s); + if (!source_ts) { + continue; + } + + pos = (size_t)ns_to_audio_frames(sample_rate, + source_ts - timestamp); + count = AUDIO_OUTPUT_FRAMES - pos; + + obs_source_get_audio_mix(s, &child_audio); + for (size_t ch = 0; ch < channels; ch++) { + float *out = audio_output->data[ch]; + float *in = child_audio.output[0].data[ch]; + + mix_audio(out, in, pos, count); + } + } + + *ts_out = timestamp; + return true; +}
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/obs-browser-source.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/obs-browser-source.cpp
Changed
@@ -18,14 +18,16 @@ #include "obs-browser-source.hpp" #include "browser-client.hpp" +#include "browser-scheme.hpp" #include "wide-string.hpp" #include <util/threading.h> +#include <QApplication> +#include <util/dstr.h> #include <functional> #include <thread> #include <mutex> #ifdef USE_QT_LOOP -#include <QApplication> #include <QEventLoop> #include <QThread> #endif @@ -37,6 +39,27 @@ static mutex browser_list_mutex; static BrowserSource *first_browser = nullptr; +static void SendBrowserVisibility(CefRefPtr<CefBrowser> browser, bool isVisible) +{ + if (!browser) + return; + +#if ENABLE_WASHIDDEN + if (isVisible) { + browser->GetHost()->WasHidden(false); + browser->GetHost()->Invalidate(PET_VIEW); + } else { + browser->GetHost()->WasHidden(true); + } +#endif + + CefRefPtr<CefProcessMessage> msg = + CefProcessMessage::Create("Visibility"); + CefRefPtr<CefListValue> args = msg->GetArgumentList(); + args->SetBool(0, isVisible); + SendBrowserProcessMessage(browser, PID_RENDERER, msg); +} + BrowserSource::BrowserSource(obs_data_t *, obs_source_t *source_) : source(source_) { @@ -46,7 +69,8 @@ lock_guard<mutex> lock(browser_list_mutex); p_prev_next = &first_browser; next = first_browser; - if (first_browser) first_browser->p_prev_next = &next; + if (first_browser) + first_browser->p_prev_next = &next; first_browser = this; } @@ -56,7 +80,8 @@ DestroyTextures(); lock_guard<mutex> lock(browser_list_mutex); - if (next) next->p_prev_next = p_prev_next; + if (next) + next->p_prev_next = p_prev_next; *p_prev_next = next; } @@ -72,13 +97,14 @@ #endif os_event_t *finishedEvent; os_event_init(&finishedEvent, OS_EVENT_TYPE_AUTO); - bool success = QueueCEFTask([&] () { + bool success = QueueCEFTask([&]() { if (!!cefBrowser) func(cefBrowser); os_event_signal(finishedEvent); }); - if (success) + if (success) { os_event_wait(finishedEvent); + } os_event_destroy(finishedEvent); } else { CefRefPtr<CefBrowser> browser = cefBrowser; @@ -86,9 +112,7 @@ #ifdef USE_QT_LOOP QueueBrowserTask(cefBrowser, func); #else - QueueCEFTask([=] () { - func(browser); - }); + QueueCEFTask([=]() { func(browser); }); #endif } } @@ -96,8 +120,7 @@ bool BrowserSource::CreateBrowser() { - return QueueCEFTask([this] () - { + return QueueCEFTask([this]() { #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED if (hwaccel) { obs_enter_graphics(); @@ -111,8 +134,8 @@ struct obs_video_info ovi; obs_get_video_info(&ovi); - CefRefPtr<BrowserClient> browserClient = - new BrowserClient(this, hwaccel && tex_sharing_avail); + CefRefPtr<BrowserClient> browserClient = new BrowserClient( + this, hwaccel && tex_sharing_avail, reroute_audio); CefWindowInfo windowInfo; #if CHROME_VERSION_BUILD < 3071 @@ -139,150 +162,169 @@ cefBrowserSettings.windowless_frame_rate = fps; #endif +#if ENABLE_LOCAL_FILE_URL_SCHEME + if (is_local) { + /* Disable web security for file:// URLs to allow + * local content access to remote APIs */ + cefBrowserSettings.web_security = STATE_DISABLED; + } +#endif + cefBrowser = CefBrowserHost::CreateBrowserSync( - windowInfo, - browserClient, - url, - cefBrowserSettings, - nullptr); + windowInfo, browserClient, url, cefBrowserSettings, +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefDictionaryValue>(), +#endif + nullptr); +#if CHROME_VERSION_BUILD >= 3683 + if (reroute_audio) + cefBrowser->GetHost()->SetAudioMuted(true); +#endif + + SendBrowserVisibility(cefBrowser, is_showing); }); } void BrowserSource::DestroyBrowser(bool async) { - ExecuteOnBrowser([] (CefRefPtr<CefBrowser> cefBrowser) - { - CefRefPtr<CefClient> client = + ExecuteOnBrowser( + [](CefRefPtr<CefBrowser> cefBrowser) { + CefRefPtr<CefClient> client = cefBrowser->GetHost()->GetClient(); - BrowserClient *bc = - reinterpret_cast<BrowserClient*>(client.get()); - if (bc) { - bc->bs = nullptr; - } + BrowserClient *bc = + reinterpret_cast<BrowserClient *>(client.get()); + if (bc) { + bc->bs = nullptr; + } - /* + /* * This stops rendering * http://magpcss.org/ceforum/viewtopic.php?f=6&t=12079 * https://bitbucket.org/chromiumembedded/cef/issues/1363/washidden-api-got-broken-on-branch-2062) */ - cefBrowser->GetHost()->WasHidden(true); - cefBrowser->GetHost()->CloseBrowser(true); - }, async); + cefBrowser->GetHost()->WasHidden(true); + cefBrowser->GetHost()->CloseBrowser(true); + }, + async); cefBrowser = nullptr; } -void BrowserSource::SendMouseClick( - const struct obs_mouse_event *event, - int32_t type, - bool mouse_up, - uint32_t click_count) +void BrowserSource::ClearAudioStreams() +{ + QueueCEFTask([this]() { + audio_streams.clear(); + std::lock_guard<std::mutex> lock(audio_sources_mutex); + audio_sources.clear(); + }); +} + +void BrowserSource::SendMouseClick(const struct obs_mouse_event *event, + int32_t type, bool mouse_up, + uint32_t click_count) { uint32_t modifiers = event->modifiers; - int32_t x = event->x; - int32_t y = event->y; - - ExecuteOnBrowser([=] (CefRefPtr<CefBrowser> cefBrowser) - { - CefMouseEvent e; - e.modifiers = modifiers; - e.x = x; - e.y = y; - CefBrowserHost::MouseButtonType buttonType = - (CefBrowserHost::MouseButtonType)type; - cefBrowser->GetHost()->SendMouseClickEvent(e, buttonType, - mouse_up, click_count); - }, true); + int32_t x = event->x; + int32_t y = event->y; + + ExecuteOnBrowser( + [=](CefRefPtr<CefBrowser> cefBrowser) { + CefMouseEvent e; + e.modifiers = modifiers; + e.x = x; + e.y = y; + CefBrowserHost::MouseButtonType buttonType = + (CefBrowserHost::MouseButtonType)type; + cefBrowser->GetHost()->SendMouseClickEvent( + e, buttonType, mouse_up, click_count); + }, + true); } -void BrowserSource::SendMouseMove( - const struct obs_mouse_event *event, - bool mouse_leave) +void BrowserSource::SendMouseMove(const struct obs_mouse_event *event, + bool mouse_leave) { uint32_t modifiers = event->modifiers; - int32_t x = event->x; - int32_t y = event->y; - - ExecuteOnBrowser([=] (CefRefPtr<CefBrowser> cefBrowser) - { - CefMouseEvent e; - e.modifiers = modifiers; - e.x = x; - e.y = y; - cefBrowser->GetHost()->SendMouseMoveEvent(e, mouse_leave); - }, true); + int32_t x = event->x; + int32_t y = event->y; + + ExecuteOnBrowser( + [=](CefRefPtr<CefBrowser> cefBrowser) { + CefMouseEvent e; + e.modifiers = modifiers; + e.x = x; + e.y = y; + cefBrowser->GetHost()->SendMouseMoveEvent(e, + mouse_leave); + }, + true); } -void BrowserSource::SendMouseWheel( - const struct obs_mouse_event *event, - int x_delta, - int y_delta) +void BrowserSource::SendMouseWheel(const struct obs_mouse_event *event, + int x_delta, int y_delta) { uint32_t modifiers = event->modifiers; - int32_t x = event->x; - int32_t y = event->y; - - ExecuteOnBrowser([=] (CefRefPtr<CefBrowser> cefBrowser) - { - CefMouseEvent e; - e.modifiers = modifiers; - e.x = x; - e.y = y; - cefBrowser->GetHost()->SendMouseWheelEvent(e, x_delta, y_delta); - }, true); + int32_t x = event->x; + int32_t y = event->y; + + ExecuteOnBrowser( + [=](CefRefPtr<CefBrowser> cefBrowser) { + CefMouseEvent e; + e.modifiers = modifiers; + e.x = x; + e.y = y; + cefBrowser->GetHost()->SendMouseWheelEvent(e, x_delta, + y_delta); + }, + true); } void BrowserSource::SendFocus(bool focus) { - ExecuteOnBrowser([=] (CefRefPtr<CefBrowser> cefBrowser) - { - cefBrowser->GetHost()->SendFocusEvent(focus); - }, true); + ExecuteOnBrowser( + [=](CefRefPtr<CefBrowser> cefBrowser) { + cefBrowser->GetHost()->SendFocusEvent(focus); + }, + true); } -void BrowserSource::SendKeyClick( - const struct obs_key_event *event, - bool key_up) +void BrowserSource::SendKeyClick(const struct obs_key_event *event, bool key_up) { - uint32_t modifiers = event->modifiers; - std::string text = event->text; - uint32_t native_vkey = event->native_vkey; - - ExecuteOnBrowser([=] (CefRefPtr<CefBrowser> cefBrowser) - { - CefKeyEvent e; - e.windows_key_code = native_vkey; - e.native_key_code = 0; - - e.type = key_up ? KEYEVENT_KEYUP : KEYEVENT_RAWKEYDOWN; - - if (!text.empty()) { - wstring wide = to_wide(text); - if (wide.size()) - e.character = wide[0]; - } + uint32_t modifiers = event->modifiers; + std::string text = event->text; + uint32_t native_vkey = event->native_vkey; - //e.native_key_code = native_vkey; - e.modifiers = modifiers; + ExecuteOnBrowser( + [=](CefRefPtr<CefBrowser> cefBrowser) { + CefKeyEvent e; + e.windows_key_code = native_vkey; + e.native_key_code = 0; + + e.type = key_up ? KEYEVENT_KEYUP : KEYEVENT_RAWKEYDOWN; + + if (!text.empty()) { + wstring wide = to_wide(text); + if (wide.size()) + e.character = wide[0]; + } + + //e.native_key_code = native_vkey; + e.modifiers = modifiers; - cefBrowser->GetHost()->SendKeyEvent(e); - if (!text.empty() && !key_up) { - e.type = KEYEVENT_CHAR; - e.windows_key_code = e.character; - e.native_key_code = native_vkey; cefBrowser->GetHost()->SendKeyEvent(e); - } - }, true); + if (!text.empty() && !key_up) { + e.type = KEYEVENT_CHAR; + e.windows_key_code = e.character; + e.native_key_code = native_vkey; + cefBrowser->GetHost()->SendKeyEvent(e); + } + }, + true); } void BrowserSource::SetShowing(bool showing) { - if (!showing) { - ExecuteOnBrowser([] (CefRefPtr<CefBrowser> cefBrowser) - { - cefBrowser->GetHost()->WasHidden(true); - }, true); - } + is_showing = showing; if (shutdown_on_invisible) { if (showing) { @@ -291,53 +333,48 @@ DestroyBrowser(true); } } else { - ExecuteOnBrowser([=] (CefRefPtr<CefBrowser> cefBrowser) - { - CefRefPtr<CefProcessMessage> msg = - CefProcessMessage::Create("Visibility"); - CefRefPtr<CefListValue> args = msg->GetArgumentList(); - args->SetBool(0, showing); - cefBrowser->SendProcessMessage(PID_RENDERER, msg); - }, true); - } +#if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED + if (showing && !fps_custom) { + reset_frame = false; + } +#endif - if (showing) { - ExecuteOnBrowser([] (CefRefPtr<CefBrowser> cefBrowser) - { - cefBrowser->GetHost()->WasHidden(false); - cefBrowser->GetHost()->Invalidate(PET_VIEW); - }, true); + SendBrowserVisibility(cefBrowser, showing); } } void BrowserSource::SetActive(bool active) { - ExecuteOnBrowser([=] (CefRefPtr<CefBrowser> cefBrowser) - { - CefRefPtr<CefProcessMessage> msg = - CefProcessMessage::Create("Active"); - CefRefPtr<CefListValue> args = msg->GetArgumentList(); - args->SetBool(0, active); - cefBrowser->SendProcessMessage(PID_RENDERER, msg); - }, true); + ExecuteOnBrowser( + [=](CefRefPtr<CefBrowser> cefBrowser) { + CefRefPtr<CefProcessMessage> msg = + CefProcessMessage::Create("Active"); + CefRefPtr<CefListValue> args = msg->GetArgumentList(); + args->SetBool(0, active); + SendBrowserProcessMessage(cefBrowser, PID_RENDERER, + msg); + }, + true); } void BrowserSource::Refresh() { - ExecuteOnBrowser([] (CefRefPtr<CefBrowser> cefBrowser) - { - cefBrowser->ReloadIgnoreCache(); - }, true); + ExecuteOnBrowser( + [](CefRefPtr<CefBrowser> cefBrowser) { + cefBrowser->ReloadIgnoreCache(); + }, + true); } #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED inline void BrowserSource::SignalBeginFrame() { if (reset_frame) { - ExecuteOnBrowser([] (CefRefPtr<CefBrowser> cefBrowser) - { - cefBrowser->GetHost()->SendExternalBeginFrame(); - }, true); + ExecuteOnBrowser( + [](CefRefPtr<CefBrowser> cefBrowser) { + cefBrowser->GetHost()->SendExternalBeginFrame(); + }, + true); reset_frame = false; } @@ -354,50 +391,73 @@ int n_fps; bool n_shutdown; bool n_restart; + bool n_reroute; std::string n_url; std::string n_css; - n_is_local = obs_data_get_bool(settings, "is_local_file"); - n_width = (int)obs_data_get_int(settings, "width"); - n_height = (int)obs_data_get_int(settings, "height"); - n_fps_custom = obs_data_get_bool(settings, "fps_custom"); - n_fps = (int)obs_data_get_int(settings, "fps"); - n_shutdown = obs_data_get_bool(settings, "shutdown"); - n_restart = obs_data_get_bool(settings, "restart_when_active"); - n_css = obs_data_get_string(settings, "css"); - n_url = obs_data_get_string(settings, - n_is_local ? "local_file" : "url"); - - if (n_is_local) + n_is_local = obs_data_get_bool(settings, "is_local_file"); + n_width = (int)obs_data_get_int(settings, "width"); + n_height = (int)obs_data_get_int(settings, "height"); + n_fps_custom = obs_data_get_bool(settings, "fps_custom"); + n_fps = (int)obs_data_get_int(settings, "fps"); + n_shutdown = obs_data_get_bool(settings, "shutdown"); + n_restart = obs_data_get_bool(settings, "restart_when_active"); + n_css = obs_data_get_string(settings, "css"); + n_url = obs_data_get_string(settings, + n_is_local ? "local_file" : "url"); + n_reroute = obs_data_get_bool(settings, "reroute_audio"); + + if (n_is_local) { +#if !ENABLE_LOCAL_FILE_URL_SCHEME + /* http://absolute/ based mapping for older CEF */ n_url = "http://absolute/" + n_url; +#elif defined(_WIN32) + /* Widows-style local file URL: + * file:///C:/file/path.webm */ + n_url = "file:///" + n_url; +#else + /* UNIX-style local file URL: + * file:///home/user/file.webm */ + n_url = "file://" + n_url; +#endif + } + +#if ENABLE_LOCAL_FILE_URL_SCHEME + if (astrcmpi_n(n_url.c_str(), "http://absolute/", 16) == 0) { + /* Replace http://absolute/ URLs with file:// + * URLs if file:// URLs are enabled */ + n_url = "file:///" + n_url.substr(16); + n_is_local = true; + } +#endif - if (n_is_local == is_local && - n_width == width && - n_height == height && - n_fps_custom == fps_custom && - n_fps == fps && - n_shutdown == shutdown_on_invisible && - n_restart == restart && - n_css == css && - n_url == url) { + if (n_is_local == is_local && n_width == width && + n_height == height && n_fps_custom == fps_custom && + n_fps == fps && n_shutdown == shutdown_on_invisible && + n_restart == restart && n_css == css && n_url == url && + n_reroute == reroute_audio) { return; } - is_local = n_is_local; - width = n_width; - height = n_height; - fps = n_fps; - fps_custom = n_fps_custom; + is_local = n_is_local; + width = n_width; + height = n_height; + fps = n_fps; + fps_custom = n_fps_custom; shutdown_on_invisible = n_shutdown; - restart = n_restart; - css = n_css; - url = n_url; + reroute_audio = n_reroute; + restart = n_restart; + css = n_css; + url = n_url; } DestroyBrowser(true); DestroyTextures(); + ClearAudioStreams(); if (!shutdown_on_invisible || obs_source_showing(source)) create_browser = true; + + first_update = false; } void BrowserSource::Tick() @@ -420,8 +480,8 @@ #endif if (texture) { - gs_effect_t *effect = obs_get_base_effect( - OBS_EFFECT_PREMULTIPLIED_ALPHA); + gs_effect_t *effect = + obs_get_base_effect(OBS_EFFECT_PREMULTIPLIED_ALPHA); while (gs_effect_loop(effect, "Draw")) obs_source_draw(texture, 0, 0, 0, 0, flip); } @@ -436,11 +496,10 @@ static void ExecuteOnAllBrowsers(BrowserFunc func) { lock_guard<mutex> lock(browser_list_mutex); - + BrowserSource *bs = first_browser; while (bs) { - BrowserSource *bsw = - reinterpret_cast<BrowserSource *>(bs); + BrowserSource *bsw = reinterpret_cast<BrowserSource *>(bs); bsw->ExecuteOnBrowser(func, true); bs = bs->next; } @@ -448,14 +507,13 @@ void DispatchJSEvent(std::string eventName, std::string jsonString) { - ExecuteOnAllBrowsers([=] (CefRefPtr<CefBrowser> cefBrowser) - { + ExecuteOnAllBrowsers([=](CefRefPtr<CefBrowser> cefBrowser) { CefRefPtr<CefProcessMessage> msg = CefProcessMessage::Create("DispatchJSEvent"); CefRefPtr<CefListValue> args = msg->GetArgumentList(); args->SetString(0, eventName); args->SetString(1, jsonString); - cefBrowser->SendProcessMessage(PID_RENDERER, msg); + SendBrowserProcessMessage(cefBrowser, PID_RENDERER, msg); }); }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/obs-browser-source.hpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/obs-browser-source.hpp
Changed
@@ -19,41 +19,55 @@ #pragma once #include <obs-module.h> +#include <obs.hpp> #include "cef-headers.hpp" #include "browser-config.h" #include "browser-app.hpp" +#include <unordered_map> #include <functional> +#include <vector> #include <string> +#include <mutex> #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED extern bool hwaccel; #endif +struct AudioStream { + OBSSource source; + speaker_layout speakers; + int channels; + int sample_rate; +}; + struct BrowserSource { - BrowserSource **p_prev_next = nullptr; - BrowserSource *next = nullptr; + BrowserSource **p_prev_next = nullptr; + BrowserSource *next = nullptr; - obs_source_t *source = nullptr; + obs_source_t *source = nullptr; - bool tex_sharing_avail = false; - bool create_browser = false; + bool tex_sharing_avail = false; + bool create_browser = false; CefRefPtr<CefBrowser> cefBrowser; - std::string url; - std::string css; - gs_texture_t *texture = nullptr; - int width = 0; - int height = 0; - bool fps_custom = false; - int fps = 0; - bool restart = false; - bool shutdown_on_invisible = false; - bool is_local = false; + std::string url; + std::string css; + gs_texture_t *texture = nullptr; + int width = 0; + int height = 0; + bool fps_custom = false; + int fps = 0; + bool restart = false; + bool shutdown_on_invisible = false; + bool is_local = false; + bool first_update = true; + bool reroute_audio = true; #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED - bool reset_frame = false; + bool reset_frame = false; #endif + bool is_showing = false; inline void DestroyTextures() { @@ -69,6 +83,7 @@ bool CreateBrowser(); void DestroyBrowser(bool async = false); + void ClearAudioStreams(); void ExecuteOnBrowser(BrowserFunc func, bool async = false); /* ---------------------------- */ @@ -79,22 +94,17 @@ void Update(obs_data_t *settings = nullptr); void Tick(); void Render(); - void SendMouseClick( - const struct obs_mouse_event *event, - int32_t type, - bool mouse_up, - uint32_t click_count); - void SendMouseMove( - const struct obs_mouse_event *event, - bool mouse_leave); - void SendMouseWheel( - const struct obs_mouse_event *event, - int x_delta, - int y_delta); + void EnumAudioStreams(obs_source_enum_proc_t cb, void *param); + bool AudioMix(uint64_t *ts_out, struct audio_output_data *audio_output, + size_t channels, size_t sample_rate); + void SendMouseClick(const struct obs_mouse_event *event, int32_t type, + bool mouse_up, uint32_t click_count); + void SendMouseMove(const struct obs_mouse_event *event, + bool mouse_leave); + void SendMouseWheel(const struct obs_mouse_event *event, int x_delta, + int y_delta); void SendFocus(bool focus); - void SendKeyClick( - const struct obs_key_event *event, - bool key_up); + void SendKeyClick(const struct obs_key_event *event, bool key_up); void SetShowing(bool showing); void SetActive(bool active); void Refresh(); @@ -102,4 +112,9 @@ #if EXPERIMENTAL_SHARED_TEXTURE_SUPPORT_ENABLED inline void SignalBeginFrame(); #endif + + std::mutex audio_sources_mutex; + std::vector<obs_source_t *> audio_sources; + + std::unordered_map<int, AudioStream> audio_streams; };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/panel/browser-panel-client.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/panel/browser-panel-client.cpp
Changed
@@ -34,17 +34,15 @@ return this; } - /* CefDisplayHandler */ -void QCefBrowserClient::OnTitleChange( - CefRefPtr<CefBrowser> browser, - const CefString &title) +void QCefBrowserClient::OnTitleChange(CefRefPtr<CefBrowser> browser, + const CefString &title) { if (widget && widget->cefBrowser->IsSame(browser)) { std::string str_title = title; QString qt_title = QString::fromUtf8(str_title.c_str()); QMetaObject::invokeMethod(widget, "titleChanged", - Q_ARG(QString, qt_title)); + Q_ARG(QString, qt_title)); } else { /* handle popup title */ #ifdef _WIN32 std::wstring str_title = title; @@ -55,12 +53,10 @@ } /* CefRequestHandler */ -bool QCefBrowserClient::OnBeforeBrowse( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame>, - CefRefPtr<CefRequest> request, - bool, - bool) +bool QCefBrowserClient::OnBeforeBrowse(CefRefPtr<CefBrowser> browser, + CefRefPtr<CefFrame>, + CefRefPtr<CefRequest> request, bool, + bool) { std::string str_url = request->GetURL(); @@ -85,17 +81,14 @@ if (widget) { QString qt_url = QString::fromUtf8(str_url.c_str()); QMetaObject::invokeMethod(widget, "urlChanged", - Q_ARG(QString, qt_url)); + Q_ARG(QString, qt_url)); } return false; } bool QCefBrowserClient::OnOpenURLFromTab( - CefRefPtr<CefBrowser>, - CefRefPtr<CefFrame>, - const CefString &target_url, - CefRequestHandler::WindowOpenDisposition, - bool) + CefRefPtr<CefBrowser>, CefRefPtr<CefFrame>, const CefString &target_url, + CefRequestHandler::WindowOpenDisposition, bool) { std::string str_url = target_url; @@ -107,18 +100,23 @@ /* CefLifeSpanHandler */ bool QCefBrowserClient::OnBeforePopup( - CefRefPtr<CefBrowser>, - CefRefPtr<CefFrame>, - const CefString &target_url, - const CefString &, - CefLifeSpanHandler::WindowOpenDisposition, - bool, - const CefPopupFeatures &, - CefWindowInfo &windowInfo, - CefRefPtr<CefClient> &, - CefBrowserSettings &, - bool *) + CefRefPtr<CefBrowser>, CefRefPtr<CefFrame>, const CefString &target_url, + const CefString &, CefLifeSpanHandler::WindowOpenDisposition, bool, + const CefPopupFeatures &, CefWindowInfo &windowInfo, + CefRefPtr<CefClient> &, CefBrowserSettings &, +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefDictionaryValue> &, +#endif + bool *) { + if (allowAllPopups) { +#ifdef _WIN32 + HWND hwnd = (HWND)widget->effectiveWinId(); + windowInfo.parent_window = hwnd; +#endif + return false; + } + std::string str_url = target_url; std::lock_guard<std::mutex> lock(popup_whitelist_mutex); @@ -126,7 +124,8 @@ PopupWhitelistInfo &info = popup_whitelist[i - 1]; if (!info.obj) { - popup_whitelist.erase(popup_whitelist.begin() + (i - 1)); + popup_whitelist.erase(popup_whitelist.begin() + + (i - 1)); continue; } @@ -145,20 +144,16 @@ return true; } -void QCefBrowserClient::OnLoadEnd( - CefRefPtr<CefBrowser>, - CefRefPtr<CefFrame> frame, - int) +void QCefBrowserClient::OnLoadEnd(CefRefPtr<CefBrowser>, + CefRefPtr<CefFrame> frame, int) { if (frame->IsMain() && !script.empty()) frame->ExecuteJavaScript(script, CefString(), 0); } -bool QCefBrowserClient::OnPreKeyEvent( - CefRefPtr<CefBrowser> browser, - const CefKeyEvent &event, - CefEventHandle, - bool *) +bool QCefBrowserClient::OnPreKeyEvent(CefRefPtr<CefBrowser> browser, + const CefKeyEvent &event, CefEventHandle, + bool *) { #ifdef _WIN32 if (event.type != KEYEVENT_RAWKEYDOWN)
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/panel/browser-panel-client.hpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/panel/browser-panel-client.hpp
Changed
@@ -6,17 +6,19 @@ #include <string> class QCefBrowserClient : public CefClient, - public CefDisplayHandler, - public CefRequestHandler, - public CefLifeSpanHandler, - public CefLoadHandler, - public CefKeyboardHandler { + public CefDisplayHandler, + public CefRequestHandler, + public CefLifeSpanHandler, + public CefLoadHandler, + public CefKeyboardHandler { public: inline QCefBrowserClient(QCefWidgetInternal *widget_, - const std::string &script_) + const std::string &script_, + bool allowAllPopups_) : widget(widget_), - script(script_) + script(script_), + allowAllPopups(allowAllPopups_) { } @@ -28,54 +30,49 @@ virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() override; /* CefDisplayHandler */ - virtual void OnTitleChange( - CefRefPtr<CefBrowser> browser, - const CefString &title) override; + virtual void OnTitleChange(CefRefPtr<CefBrowser> browser, + const CefString &title) override; /* CefRequestHandler */ - virtual bool OnBeforeBrowse( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame> frame, - CefRefPtr<CefRequest> request, - bool user_gesture, - bool is_redirect) override; + virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser, + CefRefPtr<CefFrame> frame, + CefRefPtr<CefRequest> request, + bool user_gesture, + bool is_redirect) override; virtual bool OnOpenURLFromTab( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame> frame, - const CefString& target_url, - CefRequestHandler::WindowOpenDisposition target_disposition, - bool user_gesture) override; + CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, + const CefString &target_url, + CefRequestHandler::WindowOpenDisposition target_disposition, + bool user_gesture) override; /* CefLifeSpanHandler */ virtual bool OnBeforePopup( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame> frame, - const CefString &target_url, - const CefString &target_frame_name, - CefLifeSpanHandler::WindowOpenDisposition target_disposition, - bool user_gesture, - const CefPopupFeatures &popupFeatures, - CefWindowInfo &windowInfo, - CefRefPtr<CefClient> &client, - CefBrowserSettings &settings, - bool *no_javascript_access) override; + CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, + const CefString &target_url, const CefString &target_frame_name, + CefLifeSpanHandler::WindowOpenDisposition target_disposition, + bool user_gesture, const CefPopupFeatures &popupFeatures, + CefWindowInfo &windowInfo, CefRefPtr<CefClient> &client, + CefBrowserSettings &settings, +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefDictionaryValue> &extra_info, +#endif + bool *no_javascript_access) override; /* CefLoadHandler */ - virtual void OnLoadEnd( - CefRefPtr<CefBrowser> browser, - CefRefPtr<CefFrame> frame, - int httpStatusCode) override; + virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser, + CefRefPtr<CefFrame> frame, + int httpStatusCode) override; /* CefKeyboardHandler */ - virtual bool OnPreKeyEvent( - CefRefPtr<CefBrowser> browser, - const CefKeyEvent &event, - CefEventHandle os_event, - bool *is_keyboard_shortcut) override; + virtual bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser, + const CefKeyEvent &event, + CefEventHandle os_event, + bool *is_keyboard_shortcut) override; QCefWidgetInternal *widget = nullptr; std::string script; + bool allowAllPopups; IMPLEMENT_REFCOUNTING(QCefBrowserClient); };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/panel/browser-panel-internal.hpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/panel/browser-panel-internal.hpp
Changed
@@ -9,35 +9,36 @@ #include <mutex> struct PopupWhitelistInfo { - std::string url; + std::string url; QPointer<QObject> obj; - inline PopupWhitelistInfo( - const std::string &url_, - QObject *obj_) - : url (url_), - obj (obj_) - {} + inline PopupWhitelistInfo(const std::string &url_, QObject *obj_) + : url(url_), obj(obj_) + { + } }; -extern std::mutex popup_whitelist_mutex; +extern std::mutex popup_whitelist_mutex; extern std::vector<PopupWhitelistInfo> popup_whitelist; extern std::vector<PopupWhitelistInfo> forced_popups; /* ------------------------------------------------------------------------- */ +#if CHROME_VERSION_BUILD < 3770 class QCefRequestContextHandler : public CefRequestContextHandler { CefRefPtr<CefCookieManager> cm; public: inline QCefRequestContextHandler(CefRefPtr<CefCookieManager> cm_) : cm(cm_) - {} + { + } virtual CefRefPtr<CefCookieManager> GetCookieManager() override; IMPLEMENT_REFCOUNTING(QCefRequestContextHandler); }; +#endif /* ------------------------------------------------------------------------- */ @@ -45,10 +46,8 @@ Q_OBJECT public: - QCefWidgetInternal( - QWidget *parent, - const std::string &url, - CefRefPtr<CefRequestContext> rqc); + QCefWidgetInternal(QWidget *parent, const std::string &url, + CefRefPtr<CefRequestContext> rqc); ~QCefWidgetInternal(); CefRefPtr<CefBrowser> cefBrowser; @@ -56,6 +55,7 @@ std::string script; CefRefPtr<CefRequestContext> rqc; QTimer timer; + bool allowAllPopups_ = false; virtual void resizeEvent(QResizeEvent *event) override; virtual void showEvent(QShowEvent *event) override; @@ -63,6 +63,8 @@ virtual void setURL(const std::string &url) override; virtual void setStartupScript(const std::string &script) override; + virtual void allowAllPopups(bool allow) override; + virtual void closeBrowser() override; void Resize();
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/panel/browser-panel.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/panel/browser-panel.cpp
Changed
@@ -4,9 +4,9 @@ #include "browser-app.hpp" #include <QWindow> +#include <QApplication> #ifdef USE_QT_LOOP -#include <QApplication> #include <QEventLoop> #include <QThread> #endif @@ -20,16 +20,18 @@ extern "C" void obs_browser_initialize(void); extern os_event_t *cef_started_event; -std::mutex popup_whitelist_mutex; +std::mutex popup_whitelist_mutex; std::vector<PopupWhitelistInfo> popup_whitelist; std::vector<PopupWhitelistInfo> forced_popups; /* ------------------------------------------------------------------------- */ +#if CHROME_VERSION_BUILD < 3770 CefRefPtr<CefCookieManager> QCefRequestContextHandler::GetCookieManager() { return cm; } +#endif class CookieCheck : public CefCookieVisitor { public: @@ -37,24 +39,15 @@ std::string target; bool cookie_found = false; - inline CookieCheck( - QCefCookieManager::cookie_exists_cb callback_, - const std::string target_) - : callback (callback_), - target (target_) + inline CookieCheck(QCefCookieManager::cookie_exists_cb callback_, + const std::string target_) + : callback(callback_), target(target_) { } - virtual ~CookieCheck() - { - callback(cookie_found); - } + virtual ~CookieCheck() { callback(cookie_found); } - virtual bool Visit( - const CefCookie &cookie, - int, - int, - bool &) override + virtual bool Visit(const CefCookie &cookie, int, int, bool &) override { CefString cef_name = cookie.name.str; std::string name = cef_name; @@ -71,64 +64,84 @@ struct QCefCookieManagerInternal : QCefCookieManager { CefRefPtr<CefCookieManager> cm; +#if CHROME_VERSION_BUILD < 3770 CefRefPtr<CefRequestContextHandler> rch; +#endif CefRefPtr<CefRequestContext> rc; - QCefCookieManagerInternal( - const std::string &storage_path, - bool persist_session_cookies) + QCefCookieManagerInternal(const std::string &storage_path, + bool persist_session_cookies) { if (os_event_try(cef_started_event) != 0) throw "Browser thread not initialized"; - BPtr<char> path = obs_module_config_path(storage_path.c_str()); + BPtr<char> rpath = obs_module_config_path(storage_path.c_str()); + BPtr<char> path = os_get_abs_path_ptr(rpath.Get()); +#if CHROME_VERSION_BUILD < 3770 cm = CefCookieManager::CreateManager( - path.Get(), - persist_session_cookies, - nullptr); + path.Get(), persist_session_cookies, nullptr); if (!cm) throw "Failed to create cookie manager"; +#endif +#if CHROME_VERSION_BUILD < 3770 rch = new QCefRequestContextHandler(cm); rc = CefRequestContext::CreateContext( - CefRequestContext::GetGlobalContext(), - rch); + CefRequestContext::GetGlobalContext(), rch); +#else + CefRequestContextSettings settings; + CefString(&settings.cache_path) = path.Get(); + rc = CefRequestContext::CreateContext( + settings, CefRefPtr<CefRequestContextHandler>()); + if (rc) + cm = rc->GetCookieManager(nullptr); + + UNUSED_PARAMETER(persist_session_cookies); +#endif } - virtual bool DeleteCookies( - const std::string &url, - const std::string &name) override + virtual bool DeleteCookies(const std::string &url, + const std::string &name) override { - return cm->DeleteCookies( - url, - name, - nullptr); + return !!cm ? cm->DeleteCookies(url, name, nullptr) : false; } - virtual bool SetStoragePath( - const std::string &storage_path, - bool persist_session_cookies) override + virtual bool SetStoragePath(const std::string &storage_path, + bool persist_session_cookies) override { - BPtr<char> path = obs_module_config_path(storage_path.c_str()); + BPtr<char> rpath = obs_module_config_path(storage_path.c_str()); + BPtr<char> path = os_get_abs_path_ptr(rpath.Get()); - return cm->SetStoragePath( - path.Get(), - persist_session_cookies, - nullptr); +#if CHROME_VERSION_BUILD < 3770 + return cm->SetStoragePath(path.Get(), persist_session_cookies, + nullptr); +#else + CefRequestContextSettings settings; + CefString(&settings.cache_path) = storage_path; + rc = CefRequestContext::CreateContext( + settings, CefRefPtr<CefRequestContextHandler>()); + if (rc) + cm = rc->GetCookieManager(nullptr); + + UNUSED_PARAMETER(persist_session_cookies); + return true; +#endif } virtual bool FlushStore() override { - return cm->FlushStore(nullptr); + return !!cm ? cm->FlushStore(nullptr) : false; } - virtual void CheckForCookie( - const std::string &site, - const std::string &cookie, - cookie_exists_cb callback) override + virtual void CheckForCookie(const std::string &site, + const std::string &cookie, + cookie_exists_cb callback) override { + if (!cm) + return; + CefRefPtr<CookieCheck> c = new CookieCheck(callback, cookie); cm->VisitUrlCookies(site, false, c); } @@ -136,13 +149,9 @@ /* ------------------------------------------------------------------------- */ -QCefWidgetInternal::QCefWidgetInternal( - QWidget *parent, - const std::string &url_, - CefRefPtr<CefRequestContext> rqc_) - : QCefWidget (parent), - url (url_), - rqc (rqc_) +QCefWidgetInternal::QCefWidgetInternal(QWidget *parent, const std::string &url_, + CefRefPtr<CefRequestContext> rqc_) + : QCefWidget(parent), url(url_), rqc(rqc_) { setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_StaticContents); @@ -156,18 +165,19 @@ QCefWidgetInternal::~QCefWidgetInternal() { + closeBrowser(); +} + +void QCefWidgetInternal::closeBrowser() +{ CefRefPtr<CefBrowser> browser = cefBrowser; if (!!browser) { - auto destroyBrowser = [] (CefRefPtr<CefBrowser> cefBrowser) - { - if (!cefBrowser) { - return; - } + auto destroyBrowser = [](CefRefPtr<CefBrowser> cefBrowser) { CefRefPtr<CefClient> client = - cefBrowser->GetHost()->GetClient(); + cefBrowser->GetHost()->GetClient(); QCefBrowserClient *bc = - reinterpret_cast<QCefBrowserClient*>( - client.get()); + reinterpret_cast<QCefBrowserClient *>( + client.get()); cefBrowser->GetHost()->WasHidden(true); cefBrowser->GetHost()->CloseBrowser(true); @@ -175,10 +185,43 @@ bc->widget = nullptr; }; +#ifdef _WIN32 + /* So you're probably wondering what's going on here. If you + * call CefBrowserHost::CloseBrowser, and it fails to unload + * the web page *before* WM_NCDESTROY is called on the browser + * HWND, it will call an internal CEF function + * CefBrowserPlatformDelegateNativeWin::CloseHostWindow, which + * will attempt to close the browser's main window itself. + * Problem is, this closes the root window containing the + * browser's HWND rather than the browser's specific HWND for + * whatever mysterious reason. If the browser is in a dock + * widget, then the window it closes is, unfortunately, the + * main program's window, causing the entire program to shut + * down. + * + * So, instead, before closing the browser, we need to decouple + * the browser from the widget. To do this, we hide it, then + * remove its parent. */ + HWND hwnd = (HWND)cefBrowser->GetHost()->GetWindowHandle(); + if (hwnd) { + ShowWindow(hwnd, SW_HIDE); + SetParent(hwnd, nullptr); + } +#endif + #ifdef USE_QT_LOOP - QueueBrowserTask(cefBrowser, destroyBrowser); + destroyBrowser(browser); #else - QueueCEFTask([=] () {destroyBrowser(browser);}); + os_event_t *finishedEvent; + os_event_init(&finishedEvent, OS_EVENT_TYPE_AUTO); + bool success = QueueCEFTask([=]() { + destroyBrowser(browser); + os_event_signal(finishedEvent); + }); + if (success) { + os_event_wait(finishedEvent); + } + os_event_destroy(finishedEvent); #endif cefBrowser = nullptr; } @@ -189,8 +232,7 @@ QSize size = this->size() * devicePixelRatio(); WId id = winId(); - bool success = QueueCEFTask([this, size, id] () - { + bool success = QueueCEFTask([this, size, id]() { CefWindowInfo windowInfo; /* Make sure Init isn't called more than once. */ @@ -201,20 +243,20 @@ RECT rc = {0, 0, size.width(), size.height()}; windowInfo.SetAsChild((HWND)id, rc); #elif __APPLE__ - windowInfo.SetAsChild((CefWindowHandle)id, 0, 0, - size.width(),size.height()); + windowInfo.SetAsChild((CefWindowHandle)id, 0, 0, size.width(), + size.height()); #endif CefRefPtr<QCefBrowserClient> browserClient = - new QCefBrowserClient(this, script); + new QCefBrowserClient(this, script, allowAllPopups_); CefBrowserSettings cefBrowserSettings; cefBrowser = CefBrowserHost::CreateBrowserSync( - windowInfo, - browserClient, - url, - cefBrowserSettings, - rqc); + windowInfo, browserClient, url, cefBrowserSettings, +#if CHROME_VERSION_BUILD >= 3770 + CefRefPtr<CefDictionaryValue>(), +#endif + rqc); #ifdef _WIN32 Resize(); #endif @@ -235,15 +277,14 @@ #ifdef _WIN32 QSize size = this->size() * devicePixelRatio(); - QueueCEFTask([this, size] () - { + QueueCEFTask([this, size]() { if (!cefBrowser) return; HWND hwnd = cefBrowser->GetHost()->GetWindowHandle(); SetWindowPos(hwnd, nullptr, 0, 0, size.width(), size.height(), - SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER); + SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER); SendMessage(hwnd, WM_SIZE, 0, - MAKELPARAM(size.width(), size.height())); + MAKELPARAM(size.width(), size.height())); }); #endif } @@ -265,8 +306,9 @@ return nullptr; } -void QCefWidgetInternal::setURL(const std::string &url) +void QCefWidgetInternal::setURL(const std::string &url_) { + url = url_; if (cefBrowser) { cefBrowser->GetMainFrame()->LoadURL(url); } @@ -277,6 +319,11 @@ script = script_; } +void QCefWidgetInternal::allowAllPopups(bool allow) +{ + allowAllPopups_ = allow; +} + /* ------------------------------------------------------------------------- */ struct QCefInternal : QCef { @@ -284,24 +331,21 @@ virtual bool initialized(void) override; virtual bool wait_for_browser_init(void) override; - virtual QCefWidget *create_widget( - QWidget *parent, - const std::string &url, - QCefCookieManager *cookie_manager) override; + virtual QCefWidget * + create_widget(QWidget *parent, const std::string &url, + QCefCookieManager *cookie_manager) override; - virtual QCefCookieManager *create_cookie_manager( - const std::string &storage_path, - bool persist_session_cookies) override; + virtual QCefCookieManager * + create_cookie_manager(const std::string &storage_path, + bool persist_session_cookies) override; - virtual BPtr<char> get_cookie_path( - const std::string &storage_path) override; + virtual BPtr<char> + get_cookie_path(const std::string &storage_path) override; - virtual void add_popup_whitelist_url( - const std::string &url, - QObject *obj) override; - virtual void add_force_popup_url( - const std::string &url, - QObject *obj) override; + virtual void add_popup_whitelist_url(const std::string &url, + QObject *obj) override; + virtual void add_force_popup_url(const std::string &url, + QObject *obj) override; }; bool QCefInternal::init_browser(void) @@ -323,51 +367,41 @@ return os_event_wait(cef_started_event) == 0; } -QCefWidget *QCefInternal::create_widget( - QWidget *parent, - const std::string &url, - QCefCookieManager *cm) +QCefWidget *QCefInternal::create_widget(QWidget *parent, const std::string &url, + QCefCookieManager *cm) { QCefCookieManagerInternal *cmi = - reinterpret_cast<QCefCookieManagerInternal*>(cm); + reinterpret_cast<QCefCookieManagerInternal *>(cm); - return new QCefWidgetInternal( - parent, - url, - cmi ? cmi->rc : nullptr); + return new QCefWidgetInternal(parent, url, cmi ? cmi->rc : nullptr); } -QCefCookieManager *QCefInternal::create_cookie_manager( - const std::string &storage_path, - bool persist_session_cookies) +QCefCookieManager * +QCefInternal::create_cookie_manager(const std::string &storage_path, + bool persist_session_cookies) { try { - return new QCefCookieManagerInternal( - storage_path, - persist_session_cookies); + return new QCefCookieManagerInternal(storage_path, + persist_session_cookies); } catch (const char *error) { blog(LOG_ERROR, "Failed to create cookie manager: %s", error); return nullptr; } } -BPtr<char> QCefInternal::get_cookie_path( - const std::string &storage_path) +BPtr<char> QCefInternal::get_cookie_path(const std::string &storage_path) { - return obs_module_config_path(storage_path.c_str()); + BPtr<char> rpath = obs_module_config_path(storage_path.c_str()); + return os_get_abs_path_ptr(rpath.Get()); } -void QCefInternal::add_popup_whitelist_url( - const std::string &url, - QObject *obj) +void QCefInternal::add_popup_whitelist_url(const std::string &url, QObject *obj) { std::lock_guard<std::mutex> lock(popup_whitelist_mutex); popup_whitelist.emplace_back(url, obj); } -void QCefInternal::add_force_popup_url( - const std::string &url, - QObject *obj) +void QCefInternal::add_force_popup_url(const std::string &url, QObject *obj) { std::lock_guard<std::mutex> lock(popup_whitelist_mutex); forced_popups.emplace_back(url, obj); @@ -377,3 +411,10 @@ { return new QCefInternal(); } + +#define BROWSER_PANEL_VERSION 2 + +extern "C" EXPORT int obs_browser_qcef_version_export(void) +{ + return BROWSER_PANEL_VERSION; +}
View file
obs-studio-23.2.1.tar.xz/plugins/obs-browser/panel/browser-panel.hpp -> obs-studio-24.0.0.tar.xz/plugins/obs-browser/panel/browser-panel.hpp
Changed
@@ -10,20 +10,17 @@ struct QCefCookieManager { virtual ~QCefCookieManager() {} - virtual bool DeleteCookies( - const std::string &url, - const std::string &name)=0; - virtual bool SetStoragePath( - const std::string &storage_path, - bool persist_session_cookies = false)=0; - virtual bool FlushStore()=0; + virtual bool DeleteCookies(const std::string &url, + const std::string &name) = 0; + virtual bool SetStoragePath(const std::string &storage_path, + bool persist_session_cookies = false) = 0; + virtual bool FlushStore() = 0; typedef std::function<void(bool)> cookie_exists_cb; - virtual void CheckForCookie( - const std::string &site, - const std::string &cookie, - cookie_exists_cb callback)=0; + virtual void CheckForCookie(const std::string &site, + const std::string &cookie, + cookie_exists_cb callback) = 0; }; /* ------------------------------------------------------------------------- */ @@ -32,13 +29,13 @@ Q_OBJECT protected: - inline QCefWidget(QWidget *parent) : QWidget(parent) - { - } + inline QCefWidget(QWidget *parent) : QWidget(parent) {} public: - virtual void setURL(const std::string &url)=0; - virtual void setStartupScript(const std::string &script)=0; + virtual void setURL(const std::string &url) = 0; + virtual void setStartupScript(const std::string &script) = 0; + virtual void allowAllPopups(bool allow) = 0; + virtual void closeBrowser() = 0; signals: void titleChanged(const QString &title); @@ -50,27 +47,24 @@ struct QCef { virtual ~QCef() {} - virtual bool init_browser(void)=0; - virtual bool initialized(void)=0; - virtual bool wait_for_browser_init(void)=0; + virtual bool init_browser(void) = 0; + virtual bool initialized(void) = 0; + virtual bool wait_for_browser_init(void) = 0; - virtual QCefWidget *create_widget( - QWidget *parent, - const std::string &url, - QCefCookieManager *cookie_manager = nullptr)=0; + virtual QCefWidget * + create_widget(QWidget *parent, const std::string &url, + QCefCookieManager *cookie_manager = nullptr) = 0; - virtual QCefCookieManager *create_cookie_manager( - const std::string &storage_path, - bool persist_session_cookies = false)=0; + virtual QCefCookieManager * + create_cookie_manager(const std::string &storage_path, + bool persist_session_cookies = false) = 0; - virtual BPtr<char> get_cookie_path(const std::string &storage_path)=0; + virtual BPtr<char> get_cookie_path(const std::string &storage_path) = 0; - virtual void add_popup_whitelist_url( - const std::string &url, - QObject *obj)=0; - virtual void add_force_popup_url( - const std::string &url, - QObject *obj)=0; + virtual void add_popup_whitelist_url(const std::string &url, + QObject *obj) = 0; + virtual void add_force_popup_url(const std::string &url, + QObject *obj) = 0; }; static inline QCef *obs_browser_init_panel(void) @@ -86,10 +80,31 @@ return nullptr; } - create_qcef = (decltype(create_qcef)) - os_dlsym(lib, "obs_browser_create_qcef"); + create_qcef = + (decltype(create_qcef))os_dlsym(lib, "obs_browser_create_qcef"); if (!create_qcef) return nullptr; return create_qcef(); } + +static inline int obs_browser_qcef_version(void) +{ +#ifdef _WIN32 + void *lib = os_dlopen("obs-browser"); +#else + void *lib = os_dlopen("../obs-plugins/obs-browser"); +#endif + int (*qcef_version)(void) = nullptr; + + if (!lib) { + return 0; + } + + qcef_version = (decltype(qcef_version))os_dlsym( + lib, "obs_browser_qcef_version_export"); + if (!qcef_version) + return 0; + + return qcef_version(); +}
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/CMakeLists.txt
Changed
@@ -5,10 +5,20 @@ w32-pthreads) endif() +option(ENABLE_FFMPEG_LOGGING "Enables obs-ffmpeg logging" OFF) + find_package(FFmpeg REQUIRED COMPONENTS avcodec avfilter avdevice avutil swscale avformat swresample) include_directories(${FFMPEG_INCLUDE_DIRS}) +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/obs-ffmpeg-config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/obs-ffmpeg-config.h") +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +set(obs-ffmpeg_config_HEADERS + "${CMAKE_CURRENT_BINARY_DIR}/obs-ffmpeg-config.h") + set(obs-ffmpeg_HEADERS obs-ffmpeg-formats.h obs-ffmpeg-compat.h @@ -29,6 +39,11 @@ ${LIBVA_LBRARIES}) endif() +if(ENABLE_FFMPEG_LOGGING) + list(APPEND obs-ffmpeg_SOURCES + obs-ffmpeg-logging.c) +endif() + if(WIN32) list(APPEND obs-ffmpeg_SOURCES jim-nvenc.c @@ -38,6 +53,7 @@ endif() add_library(obs-ffmpeg MODULE + ${obs-ffmpeg_config_HEADERS} ${obs-ffmpeg_HEADERS} ${obs-ffmpeg_SOURCES}) target_link_libraries(obs-ffmpeg
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/closest-pixel-format.h -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/closest-pixel-format.h
Changed
@@ -1,82 +1,42 @@ #pragma once static const enum AVPixelFormat i420_formats[] = { - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_NV12, - AV_PIX_FMT_NV21, - AV_PIX_FMT_YUYV422, - AV_PIX_FMT_UYVY422, - AV_PIX_FMT_YUV422P, - AV_PIX_FMT_YUV444P, - AV_PIX_FMT_NONE -}; + AV_PIX_FMT_YUV420P, AV_PIX_FMT_NV12, AV_PIX_FMT_NV21, + AV_PIX_FMT_YUYV422, AV_PIX_FMT_UYVY422, AV_PIX_FMT_YUV422P, + AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE}; static const enum AVPixelFormat nv12_formats[] = { - AV_PIX_FMT_NV12, - AV_PIX_FMT_NV21, - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUYV422, - AV_PIX_FMT_UYVY422, - AV_PIX_FMT_YUV444P, - AV_PIX_FMT_NONE -}; + AV_PIX_FMT_NV12, AV_PIX_FMT_NV21, AV_PIX_FMT_YUV420P, + AV_PIX_FMT_YUYV422, AV_PIX_FMT_UYVY422, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_NONE}; static const enum AVPixelFormat i444_formats[] = { - AV_PIX_FMT_YUV444P, - AV_PIX_FMT_RGBA, - AV_PIX_FMT_BGRA, - AV_PIX_FMT_YUYV422, - AV_PIX_FMT_UYVY422, - AV_PIX_FMT_NV12, - AV_PIX_FMT_NV21, - AV_PIX_FMT_NONE -}; + AV_PIX_FMT_YUV444P, AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, + AV_PIX_FMT_YUYV422, AV_PIX_FMT_UYVY422, AV_PIX_FMT_NV12, + AV_PIX_FMT_NV21, AV_PIX_FMT_NONE}; static const enum AVPixelFormat yuy2_formats[] = { - AV_PIX_FMT_YUYV422, - AV_PIX_FMT_UYVY422, - AV_PIX_FMT_NV12, - AV_PIX_FMT_NV21, - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUV444P, - AV_PIX_FMT_NONE -}; + AV_PIX_FMT_YUYV422, AV_PIX_FMT_UYVY422, AV_PIX_FMT_NV12, + AV_PIX_FMT_NV21, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_NONE}; static const enum AVPixelFormat uyvy_formats[] = { - AV_PIX_FMT_UYVY422, - AV_PIX_FMT_YUYV422, - AV_PIX_FMT_NV12, - AV_PIX_FMT_NV21, - AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUV444P, - AV_PIX_FMT_NONE -}; + AV_PIX_FMT_UYVY422, AV_PIX_FMT_YUYV422, AV_PIX_FMT_NV12, + AV_PIX_FMT_NV21, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_NONE}; static const enum AVPixelFormat rgba_formats[] = { - AV_PIX_FMT_RGBA, - AV_PIX_FMT_BGRA, - AV_PIX_FMT_YUV444P, - AV_PIX_FMT_YUYV422, - AV_PIX_FMT_UYVY422, - AV_PIX_FMT_NV12, - AV_PIX_FMT_NV21, - AV_PIX_FMT_NONE -}; + AV_PIX_FMT_RGBA, AV_PIX_FMT_BGRA, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_YUYV422, AV_PIX_FMT_UYVY422, AV_PIX_FMT_NV12, + AV_PIX_FMT_NV21, AV_PIX_FMT_NONE}; static const enum AVPixelFormat bgra_formats[] = { - AV_PIX_FMT_BGRA, - AV_PIX_FMT_RGBA, - AV_PIX_FMT_YUV444P, - AV_PIX_FMT_YUYV422, - AV_PIX_FMT_UYVY422, - AV_PIX_FMT_NV12, - AV_PIX_FMT_NV21, - AV_PIX_FMT_NONE -}; - -static enum AVPixelFormat get_best_format( - const enum AVPixelFormat *best, - const enum AVPixelFormat *formats) + AV_PIX_FMT_BGRA, AV_PIX_FMT_RGBA, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_YUYV422, AV_PIX_FMT_UYVY422, AV_PIX_FMT_NV12, + AV_PIX_FMT_NV21, AV_PIX_FMT_NONE}; + +static enum AVPixelFormat get_best_format(const enum AVPixelFormat *best, + const enum AVPixelFormat *formats) { while (*best != AV_PIX_FMT_NONE) { enum AVPixelFormat best_format = *best; @@ -97,9 +57,8 @@ return AV_PIX_FMT_NONE; } -static inline enum AVPixelFormat get_closest_format( - enum AVPixelFormat format, - const enum AVPixelFormat *formats) +static inline enum AVPixelFormat +get_closest_format(enum AVPixelFormat format, const enum AVPixelFormat *formats) { enum AVPixelFormat best_format = AV_PIX_FMT_NONE;
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/bg-BG.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/bg-BG.ini
Changed
@@ -24,7 +24,6 @@ Looping="Преповтаряне" Input="Вход" InputFormat="Формат за вход" -BufferingMB="Мрежова буферизация (MB)" HardwareDecode="Използване на хардуерно декодиране, ако е налично" Advanced="Разширено" RestartWhenActivated="Възобновява възпроизвеждането когато източникът е активен" @@ -32,7 +31,6 @@ ColorRange.Auto="Автоматично" ColorRange.Partial="Частично" ColorRange.Full="Пълно" -SpeedPercentage="Скорост (процент)"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/ca-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/ca-ES.ini
Changed
@@ -29,7 +29,7 @@ Looping="Bucle" Input="Entrada" InputFormat="Format d'entrada" -BufferingMB="Memòria intermèdia de xarxa (MB)" +BufferingMB="Memòria intermèdia de xarxa" HardwareDecode="Usa la descodificació per maquinari si és disponible" ClearOnMediaEnd="No mostris res quan acabi la reproducció" Advanced="Avançat" @@ -41,7 +41,7 @@ ColorRange.Partial="Parcial" ColorRange.Full="Màxim" RestartMedia="Reinicia els mitjans" -SpeedPercentage="Velocitat (percentatge)" +SpeedPercentage="Velocitat" Seekable="Cercable" MediaFileFilter.AllMediaFiles="Tots els arxius multimèdia"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/cs-CZ.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/cs-CZ.ini
Changed
@@ -29,7 +29,7 @@ Looping="Opakovat" Input="Vstup" InputFormat="Formát vstupu" -BufferingMB="Vyrovnávací paměť pro síť (MB)" +BufferingMB="Vyrovnávací paměť pro síť" HardwareDecode="Použít hardwarové dekódování, pokud je k dispozici" ClearOnMediaEnd="Po skončení přehrávání nezobrazovat nic" Advanced="Pokročilé" @@ -41,7 +41,7 @@ ColorRange.Partial="Částečný" ColorRange.Full="Celkový" RestartMedia="Restartovat mediální zdroj" -SpeedPercentage="Rychlost (procenta)" +SpeedPercentage="Rychlost" Seekable="Posouvatelné" MediaFileFilter.AllMediaFiles="Všechny mediální soubory"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/da-DK.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/da-DK.ini
Changed
@@ -29,7 +29,7 @@ Looping="Gentagelse" Input="Input" InputFormat="Inputformat" -BufferingMB="Netværksbuffering (MB)" +BufferingMB="Netværksbuffering" HardwareDecode="Benyt hardwareafkodning, når tilgængelig" ClearOnMediaEnd="Vis intet, når afspilning afsluttes" Advanced="Avanceret" @@ -41,7 +41,7 @@ ColorRange.Partial="Delvis" ColorRange.Full="Fuld" RestartMedia="Genstart Media" -SpeedPercentage="Hastighed (procent)" +SpeedPercentage="Hastighed" Seekable="Søgbar" MediaFileFilter.AllMediaFiles="Alle mediefiler"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/de-DE.ini
Changed
@@ -1,16 +1,16 @@ -FFmpegOutput="FFmpeg-Ausgabe" -FFmpegAAC="FFmpeg-Standard-AAC-Kodierer" -FFmpegOpus="FFmpeg-Opus-Kodierer" +FFmpegOutput="FFmpeg‐Ausgabe" +FFmpegAAC="FFmpeg‐Standard‐AAC‐Kodierer" +FFmpegOpus="FFmpeg‐Opus‐Kodierer" Bitrate="Bitrate" MaxBitrate="Max. Bitrate" Preset="Voreinstellung" RateControl="Qualitäts Regulierungsmethode" -KeyframeIntervalSec="Keyframeintervall in Sek. (0 = auto)" +KeyframeIntervalSec="Keyframeintervall in Sek. (0 = automatisch)" Lossless="Verlustfrei" -BFrames="Max. B-Frames" +BFrames="Max. B‐Frames" -NVENC.Use2Pass="Two-Pass-Kodierung verwenden" +NVENC.Use2Pass="Two‐Pass‐Kodierung verwenden" NVENC.Preset.default="Leistung" NVENC.Preset.hq="Qualität" NVENC.Preset.hp="Max. Leistung" @@ -18,30 +18,30 @@ NVENC.Preset.ll="Niedrige Latenz" NVENC.Preset.llhq="Niedrige Latenz + Qualität" NVENC.Preset.llhp="Niedrige Latenz + Leistung" -NVENC.LookAhead="Look-ahead" -NVENC.LookAhead.ToolTip="Aktiviert dynamische B-Frames.\n\nWenn deaktiviert, wird der Kodierer immer die Anzahl der B-Frames verwenden, die in der „Max B-Frames“-Einstellung angegeben sind.\n\nWenn aktiviert, wird er die visuelle Qualität erhöhen, indem nur so viele B-Frames verwendet werden wie benötigt, bis zum Maximum,\nzu den Kosten einer erhöhten GPU-Nutzung." -NVENC.PsychoVisualTuning="Psycho-visuelle Optimierung" -NVENC.PsychoVisualTuning.ToolTip="Aktiviert Kodierereinstellungen, die die Verwendung der Bitrate für eine erhöhte wahrgenommene visuelle Qualität optimieren,\ninsbesondere in Situationen mit hoher Bewegung, zu Kosten einer erhöhten GPU-Nutzung." -NVENC.CQLevel="CQ-Level" +NVENC.LookAhead="Look‐ahead" +NVENC.LookAhead.ToolTip="Aktiviert dynamische B‐Frames.\n\nWenn deaktiviert, wird der Kodierer immer die Anzahl der B‐Frames verwenden, die in der „Max B‐Frames“‐Einstellung angegeben sind.\n\nWenn aktiviert, wird er die visuelle Qualität erhöhen, indem nur so viele B‐Frames verwendet werden wie benötigt, bis zum Maximum,\nzu den Kosten einer erhöhten GPU‐Nutzung." +NVENC.PsychoVisualTuning="Psycho Visual Tuning" +NVENC.PsychoVisualTuning.ToolTip="Aktiviert Kodierereinstellungen, die die Verwendung der Bitrate für eine erhöhte wahrgenommene visuelle Qualität optimieren,\ninsbesondere in Situationen mit hoher Bewegung, zu Kosten einer erhöhten GPU‐Nutzung." +NVENC.CQLevel="CQ‐Level" FFmpegSource="Medienquelle" LocalFile="Lokale Datei" Looping="Endlosschleife" Input="Eingabe" InputFormat="Eingabeformat" -BufferingMB="Netzwerkpufferung (MB)" +BufferingMB="Netzwerkpufferung" HardwareDecode="Hardwaredekodierung verwenden, falls verfügbar" ClearOnMediaEnd="Nichts anzeigen, wenn Wiedergabe endet" Advanced="Erweitert" RestartWhenActivated="Wiedergabe erneut starten, wenn Quelle aktiviert wird" CloseFileWhenInactive="Datei schließen, wenn inaktiv" -CloseFileWhenInactive.ToolTip="Schließt die Datei, wenn die Quelle im Stream oder der Aufnahme nicht angezeigt wird.\nDies ermöglicht, dass die Datei geändert werden kann, wenn die Quelle nicht aktiv ist,\n aber es gibt wahrscheinlich etwas Startverzögerung, wenn die Quelle reaktiviert wird." -ColorRange="YUV-Farbmatrix" +CloseFileWhenInactive.ToolTip="Schließt die Datei, wenn die Quelle im Stream oder der Aufnahme nicht angezeigt wird.\nDies ermöglicht, dass die Datei geändert werden kann.\nDafür können aber Startverzögerungen auftreten, wenn die Quelle reaktiviert wird." +ColorRange="YUV‐Farbmatrix" ColorRange.Auto="Automatisch" ColorRange.Partial="Teilweise" ColorRange.Full="Voll" RestartMedia="Medium neustarten" -SpeedPercentage="Geschwindigkeit (Prozent)" +SpeedPercentage="Geschwindigkeit" Seekable="Durchsuchbar" MediaFileFilter.AllMediaFiles="Alle Mediendateien" @@ -49,10 +49,10 @@ MediaFileFilter.AudioFiles="Audiodateien" MediaFileFilter.AllFiles="Alle Dateien" -ReplayBuffer="Replaypuffer" +ReplayBuffer="Replay‐Puffer" ReplayBuffer.Save="Replay speichern" -HelperProcessFailed="Der Aufnahmehelferprozeß kann nicht gestartet werden. Überprüfen Sie, ob OBS-Dateien nicht von einer Drittanbieter Antiviren- / Sicherheitssoftware blockiert oder entfernt wurden." +HelperProcessFailed="Der Aufnahme‐Helfer‐Prozess kann nicht gestartet werden. Überprüfen Sie, ob OBS‐Dateien nicht von einer Drittanbieter‐Antiviren‐/Sicherheitssoftware blockiert oder entfernt werden." UnableToWritePath="Kann nicht zu %1 schreiben. Vergewissern Sie sich, dass Sie einen Aufnahmepfad verwenden, für das Ihr Benutzerkonto Schreibrechte hat und dass genügend Speicherplatz zur Verfügung steht." -WarnWindowsDefender="Wenn Windows-10-Ransomware-Schutz aktiviert ist, kann dies auch den Fehler auslösen. Versuchen Sie, den überwachten Ordnerzugriff in Windows-Sicherheit → Viren- & Bedrohungsschutz auszuschalten." +WarnWindowsDefender="Wenn Windows‐10‐Ransomware‐Schutz aktiviert ist, kann dies auch den Fehler auslösen. Versuchen Sie, den überwachten Ordnerzugriff in Windows‐Sicherheit → Viren‐ & Bedrohungsschutz auszuschalten."
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/el-GR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/el-GR.ini
Changed
@@ -16,7 +16,6 @@ Looping="Επανάληψη" Input="Είσοδος" InputFormat="Μορφή Εισόδου" -BufferingMB="Μέγεθος προσωρινης αποθήκευσης Δικτύου (MB)" HardwareDecode="Χρήση αποκωδικοποίησης υλικού όταν είναι διαθέσιμη" Advanced="Σύνθετες επιλογές" RestartWhenActivated="Επανεκκίνηση της αναπαραγωγής όταν η πηγή γίνεται ξανά ενεργή" @@ -27,7 +26,6 @@ ColorRange.Partial="Μερικός" ColorRange.Full="Πλήρης" RestartMedia="Επανεκκίνηση Πολυμέσων" -SpeedPercentage="Ταχύτητα (τοις εκατό)" Seekable="Παρεχόμενη" MediaFileFilter.AllMediaFiles="Όλα τα αρχεία πολυμέσων"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/en-US.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/en-US.ini
Changed
@@ -29,7 +29,7 @@ Looping="Loop" Input="Input" InputFormat="Input Format" -BufferingMB="Network Buffering (MB)" +BufferingMB="Network Buffering" HardwareDecode="Use hardware decoding when available" ClearOnMediaEnd="Show nothing when playback ends" Advanced="Advanced" @@ -41,7 +41,7 @@ ColorRange.Partial="Partial" ColorRange.Full="Full" RestartMedia="Restart Media" -SpeedPercentage="Speed (percent)" +SpeedPercentage="Speed" Seekable="Seekable" MediaFileFilter.AllMediaFiles="All Media Files"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/es-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/es-ES.ini
Changed
@@ -29,7 +29,7 @@ Looping="Bucle" Input="Entrada" InputFormat="Formato de entrada" -BufferingMB="Almacenamiento búfer de Red (MB)" +BufferingMB="Buffering de la red" HardwareDecode="Utilizar la decodificación por hardware cuando esté disponible" ClearOnMediaEnd="No mostrar nada al terminar la reproducción" Advanced="Avanzado" @@ -41,7 +41,7 @@ ColorRange.Partial="Parcial" ColorRange.Full="Completo" RestartMedia="Reiniciar Medio" -SpeedPercentage="Velocidad (porcentaje)" +SpeedPercentage="Velocidad" Seekable="Buscable" MediaFileFilter.AllMediaFiles="Todos los archivos multimedia"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/eu-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/eu-ES.ini
Changed
@@ -29,7 +29,7 @@ Looping="Begizta" Input="Sarrera" InputFormat="Sarrera formatua" -BufferingMB="Sareko bufferreratzea (MB)" +BufferingMB="Sareko bufferreratzea" HardwareDecode="Erabili hardware deskodeketa eskuragarri dagoenean" ClearOnMediaEnd="Erreprodukzioa bukatzean ez erakutsi ezer" Advanced="Aurreratua" @@ -41,7 +41,7 @@ ColorRange.Partial="Partziala" ColorRange.Full="Osoa" RestartMedia="Berrabiarazi euskarria" -SpeedPercentage="Abiadura (ehunekoa)" +SpeedPercentage="Abiadura" Seekable="Bilagai" MediaFileFilter.AllMediaFiles="Multimedia-fitxategi guztiak"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/fa-IR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/fa-IR.ini
Changed
@@ -24,12 +24,10 @@ Looping="چرخه" Input="ورودی" InputFormat="فرمت های ورودی" -BufferingMB="شبکه بافری (مگابایت)" ColorRange.Auto="خودکار" ColorRange.Partial="جزئی" ColorRange.Full="کامل" RestartMedia="راه اندازی مجدد رسانه ها" -SpeedPercentage="سرعت (درصد)" Seekable="جستجوگر" MediaFileFilter.AllMediaFiles="تمامی فایل های رسانه"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/fi-FI.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/fi-FI.ini
Changed
@@ -29,7 +29,6 @@ Looping="Toista jatkuvasti" Input="Sisääntulo" InputFormat="Sisääntulon muoto" -BufferingMB="Verkon puskurointi (MB)" HardwareDecode="Käytä laitteistotason purkua, kun mahdollista" ClearOnMediaEnd="Älä näytä mitään kun toisto päättyy" Advanced="Lisäasetukset" @@ -41,7 +40,6 @@ ColorRange.Partial="Osittainen" ColorRange.Full="Täysi" RestartMedia="Uudelleenkäynnistä media" -SpeedPercentage="Nopeus (prosentti)" Seekable="Haettava" MediaFileFilter.AllMediaFiles="Kaikki mediatiedostot"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/fil-PH.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/fil-PH.ini
Changed
@@ -16,7 +16,6 @@ Looping="I-Loop" Input="Ang Input" InputFormat="Ang Format ng Input" -BufferingMB="Nag buffering ang Network (MB)" HardwareDecode="Gamitin ang hardware decoding kapag magagamit" Advanced="I-Advanced" RestartWhenActivated="Simulan mulang ang playback kapag aktibo ang pinagmulan"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/fr-FR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/fr-FR.ini
Changed
@@ -29,7 +29,7 @@ Looping="En boucle" Input="Entrée" InputFormat="Format d'entrée" -BufferingMB="Mémoire tampon réseau (Mo)" +BufferingMB="Tampon réseau (Mo)" HardwareDecode="Utiliser le décodage matériel si possible" ClearOnMediaEnd="Ne rien afficher lorsque la lecture se termine" Advanced="Options avancées" @@ -41,7 +41,7 @@ ColorRange.Partial="Partielle" ColorRange.Full="Complète" RestartMedia="Reprendre depuis le début" -SpeedPercentage="Vitesse (pourcentage)" +SpeedPercentage="Vitesse" Seekable="Navigable" MediaFileFilter.AllMediaFiles="Tous les fichiers multimédias"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/gd-GB.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/gd-GB.ini
Changed
@@ -25,7 +25,6 @@ Looping="Lùb" Input="Ion-chur" InputFormat="Fòrmat an ion-chuir" -BufferingMB="Bufair an lìonraidh (MB)" HardwareDecode="Cleachd dì-chòdachadh bathair-chruaidh ma bhios e ri fhaighinn" Advanced="Adhartach" RestartWhenActivated="Ath-thòisich a’ chluiche nuair a thig gnìomh on tùs" @@ -35,7 +34,6 @@ ColorRange.Partial="Leth-phàirteach" ColorRange.Full="Làn" RestartMedia="Ath-thòisich am meadhan" -SpeedPercentage="Luaths (sa cheud)" Seekable="Gabhaidh sireadh ann" MediaFileFilter.AllMediaFiles="A h-uile faidhle meadhain"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/gl-ES.ini
Changed
@@ -1,17 +1,58 @@ FFmpegOutput="Saída de FFmpeg" -FFmpegAAC="Codificador AAC FFmpeg predefinido" -Bitrate="Velocidade de bits" +FFmpegAAC="Codificador AAC de FFmpeg predeterminado" +FFmpegOpus="Codificador Opus de FFmpeg" +Bitrate="Taxa de bits" +MaxBitrate="Taxa de bits máxima" +Preset="Preaxuste" +RateControl="Control da taxa" +KeyframeIntervalSec="Intervalo de fotogramas clave (segundos, 0=auto)" +Lossless="Sen perdas" +BFrames="Máximo de B-frames" +NVENC.Use2Pass="Usar codificación en dúas pasadas" +NVENC.Preset.default="Rendemento" +NVENC.Preset.hq="Calidade" +NVENC.Preset.hp="Máximo rendemento" +NVENC.Preset.mq="Máxima Calidade" +NVENC.Preset.ll="Baixa latencia" +NVENC.Preset.llhq="Calidade de baixa Latencia" +NVENC.Preset.llhp="Rendemento de baixa Latencia" +NVENC.LookAhead="Previsión" +NVENC.LookAhead.ToolTip="Activar B-frames dinámicos.\n\nSe está desactivado, o codificador empregará sempre o número de B-frames especificados na configuración «Máximo de B-frames».\n\nSe está activado, aumentará a calidade visual empregando só a cantidade de B-frames necesarios, ata o máximo,\nco custo do aumento de emprego da GPU." +NVENC.PsychoVisualTuning="Sintonización psico visual" +NVENC.PsychoVisualTuning.ToolTip="Activa os axustes do codificador que optimizan o uso da taxa de bits para aumentar a calidade visual percibida,\nespecialmente nas situacións con alto movemento, a costa de incrementar a utilización da GPU." +NVENC.CQLevel="Nivel de cuantificación constante" FFmpegSource="Fonte multimedia" LocalFile="Ficheiro local" Looping="Bucle" Input="Entrada" InputFormat="Formato de entrada" +BufferingMB="Memoria intermedia de rede" HardwareDecode="Utilizar a descodificación por hárdware cando estiver dispoñible" +ClearOnMediaEnd="Non amosar nada ao rematar a reprodución" Advanced="Avanzado" +RestartWhenActivated="Reiniciar a reprodución cando fonte estea activa" +CloseFileWhenInactive="Pechar o ficheiro cando estea inactivo" +CloseFileWhenInactive.ToolTip="Pecha o ficheiro cando a fonte non se está a amosar na emisión ou na\ngravación. Isto permite cambiar o ficheiro cando a fonte non está activa,\nmais pode haber algún atraso de inicio cando se reactive a fonte." +ColorRange="Gama de cor YUV" +ColorRange.Auto="Automático" +ColorRange.Partial="Parcial" +ColorRange.Full="Total" +RestartMedia="Reiniciar multimedia" +SpeedPercentage="Velocidade" +Seekable="Buscábel" +MediaFileFilter.AllMediaFiles="Todos os ficheiros multimedia" +MediaFileFilter.VideoFiles="Ficheiros de vídeo" +MediaFileFilter.AudioFiles="Ficheiros de son" +MediaFileFilter.AllFiles="Todos os ficheiros" +ReplayBuffer="Reproducir a memoria intermedia" +ReplayBuffer.Save="Gardar a reprodución" +HelperProcessFailed="Non foi posíbel iniciar o proceso do axudante de gravación. Comprobe que os ficheiros do OBS non foron bloqueados ou eliminados por un antivirus ou software de seguridade de terceiros." +UnableToWritePath="Non foi posíbel escribir en %1. Asegúrese de que está a usar unha ruta de gravación na que a súa conta de usuario teña permisos de escritura e que haxa espazo abondo no disco." +WarnWindowsDefender="Se a protección do Ransomware do Windows está activada tamén pode causar este erro. Tente desactivar o acceso controlado ao cartafol nos axustes de seguridade do Windows / virus e protección contra ameazas."
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/hu-HU.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/hu-HU.ini
Changed
@@ -29,7 +29,7 @@ Looping="Ismétlés" Input="Bemenet" InputFormat="Bemeneti formátum" -BufferingMB="Hálózati pufferelés (MB)" +BufferingMB="Hálózati pufferelés" HardwareDecode="Hardveres dekódolás használata, ha rendelkezésre áll" ClearOnMediaEnd="Semmit se mutasson, a lejátszás végeztével" Advanced="Haladó" @@ -41,7 +41,7 @@ ColorRange.Partial="Részleges" ColorRange.Full="Teljes" RestartMedia="Media újraindítása" -SpeedPercentage="Sebesség (százalékos)" +SpeedPercentage="Sebesség" Seekable="Kereshető" MediaFileFilter.AllMediaFiles="Minden médiafájl"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/it-IT.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/it-IT.ini
Changed
@@ -29,7 +29,7 @@ Looping="Ripeti" Input="Input" InputFormat="Formato dell'input" -BufferingMB="Buffering della rete (in MB)" +BufferingMB="Buffering della rete" HardwareDecode="Utilizza la decodifica hardware quando disponibile" ClearOnMediaEnd="Non mostrare nulla quando la riproduzione finisce" Advanced="Avanzate" @@ -41,7 +41,7 @@ ColorRange.Partial="Parziale" ColorRange.Full="Intero" RestartMedia="Riavvia media dall'inizio" -SpeedPercentage="Velocità (in percentuale)" +SpeedPercentage="Velocità" Seekable="Ricercabile" MediaFileFilter.AllMediaFiles="Tutti i file multimediali"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/ja-JP.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/ja-JP.ini
Changed
@@ -29,7 +29,7 @@ Looping="繰り返し" Input="入力" InputFormat="入力フォーマット" -BufferingMB="ネットワークバッファリング (MB)" +BufferingMB="ネットワークバッファリング" HardwareDecode="可能な場合ハードウェアデコードを使用" ClearOnMediaEnd="再生終了時に何も表示しない" Advanced="高度な設定" @@ -41,7 +41,7 @@ ColorRange.Partial="一部" ColorRange.Full="全部" RestartMedia="メディアを再開する" -SpeedPercentage="速度 (パーセント)" +SpeedPercentage="速度" Seekable="シーク可能" MediaFileFilter.AllMediaFiles="すべてのメディアファイル"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/ka-GE.ini
Changed
@@ -29,7 +29,7 @@ Looping="დაუსრულებლად გამეორება" Input="შეტანა" InputFormat="შეტანის ფორმატი" -BufferingMB="ქსელის ბუფერიზაცია (მბაიტი)" +BufferingMB="ქსელის ბუფერიზაცია" HardwareDecode="აპარატურული დაშიფვრის გამოყენება, ხელმისაწვდომობის შემთხვევაში" ClearOnMediaEnd="აღარაფერი გამოჩნდეს, ჩვენების დასრულების შემდგომ" Advanced="გაფართოებული" @@ -41,7 +41,7 @@ ColorRange.Partial="ნაწილობრივი" ColorRange.Full="სრული" RestartMedia="მასალის ხელახლა გაშვება" -SpeedPercentage="სიჩქარე (პროცენტი)" +SpeedPercentage="სიჩქარე" Seekable="გადახვევით" MediaFileFilter.AllMediaFiles="ყველა მასალა"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/ko-KR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/ko-KR.ini
Changed
@@ -29,7 +29,7 @@ Looping="반복" Input="입력" InputFormat="입력 형식" -BufferingMB="네트워크 버퍼링 (MB)" +BufferingMB="네트워크 버퍼링" HardwareDecode="가능한 경우 하드웨어 디코딩 사용" ClearOnMediaEnd="재생이 끝나면 아무 것도 표시하지 않기" Advanced="고급" @@ -41,7 +41,7 @@ ColorRange.Partial="부분" ColorRange.Full="전체" RestartMedia="미디어 다시재생" -SpeedPercentage="속도 (백분율)" +SpeedPercentage="속도" Seekable="탐색 가능" MediaFileFilter.AllMediaFiles="모든 미디어 파일"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/nb-NO.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/nb-NO.ini
Changed
@@ -29,7 +29,6 @@ Looping="Repeter" Input="Inngang" InputFormat="Inngangsformat" -BufferingMB="Nettverksbuffer (Mb)" HardwareDecode="Bruk maskinvaredekoding når tilgjengelig" ClearOnMediaEnd="Vis ingenting når avspillingen slutter" Advanced="Avansert" @@ -41,7 +40,6 @@ ColorRange.Partial="Delvis" ColorRange.Full="Hel" RestartMedia="Start media på nytt" -SpeedPercentage="Fart (prosent)" Seekable="Søkbar" MediaFileFilter.AllMediaFiles="Alle mediefiler"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/nl-NL.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/nl-NL.ini
Changed
@@ -29,7 +29,7 @@ Looping="Herhalen" Input="Invoer" InputFormat="Invoerformaat" -BufferingMB="Netwerk Buffering (MB)" +BufferingMB="Netwerkbuffering" HardwareDecode="Gebruik hardware-decoding wanneer mogelijk" ClearOnMediaEnd="Toon niets wanneer het afspelen eindigt" Advanced="Geavanceerd" @@ -41,7 +41,7 @@ ColorRange.Partial="Gedeeltelijk" ColorRange.Full="Volledig" RestartMedia="Media herstarten" -SpeedPercentage="Snelheid (percentage)" +SpeedPercentage="Snelheid" Seekable="Zoekbaar" MediaFileFilter.AllMediaFiles="Alle mediabestanden"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/pl-PL.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/pl-PL.ini
Changed
@@ -29,7 +29,7 @@ Looping="Pętla" Input="Wejście" InputFormat="Format wejściowy" -BufferingMB="Bufor sieciowy (MB)" +BufferingMB="Rozmiar bufora" HardwareDecode="Użyj sprzętowego dekodowania gdy to możliwe" ClearOnMediaEnd="Po zakończeniu odtwarzania nie pokazuj nic" Advanced="Zaawansowane" @@ -41,7 +41,7 @@ ColorRange.Partial="Częściowy" ColorRange.Full="Pełny" RestartMedia="Zrestartuj plik audio-wideo" -SpeedPercentage="Szybkość (procent)" +SpeedPercentage="Szybkość" Seekable="Przeszukiwalny" MediaFileFilter.AllMediaFiles="Wszystkie pliki multimedialne"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/pt-BR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/pt-BR.ini
Changed
@@ -29,7 +29,7 @@ Looping="Loop" Input="Entrada" InputFormat="Formato de entrada" -BufferingMB="Buffer de Rede (MB)" +BufferingMB="Buffering de rede" HardwareDecode="Utilizar descodificação de hardware quando disponível" ClearOnMediaEnd="Não mostrar nada quando terminar a reprodução" Advanced="Avançado" @@ -41,7 +41,7 @@ ColorRange.Partial="Parcial" ColorRange.Full="Completo" RestartMedia="Reiniciar Mídia" -SpeedPercentage="Velocidade (percentagem)" +SpeedPercentage="Velocidade" Seekable="Procurável" MediaFileFilter.AllMediaFiles="Todos Arquivos de Mídia"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/pt-PT.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/pt-PT.ini
Changed
@@ -30,7 +30,6 @@ ColorRange.Auto="Auto" ColorRange.Partial="Parcial" ColorRange.Full="Completo" -SpeedPercentage="Velocidade (percentagem)" MediaFileFilter.AllMediaFiles="Todos os Arquivos de Media" MediaFileFilter.VideoFiles="Arquivos de Vídeo"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/ro-RO.ini
Changed
@@ -1,6 +1,7 @@ FFmpegOutput="Ieșire FFmpeg" FFmpegAAC="Codificator AAC implicit FFmpeg" Bitrate="Rată de biți" +MaxBitrate="Rată de biți maximă" Preset="Presetare" RateControl="Controlul ratei" KeyframeIntervalSec="Interval de cadre cheie (secunde, 0=auto)" @@ -19,12 +20,11 @@ Looping="Buclă" Input="Intrare" InputFormat="Format de intrare" -BufferingMB="Zonă tampon pentru rețea (MB)" HardwareDecode="Folosește decodarea hardware când este disponibilă" Advanced="Avansat" RestartWhenActivated="Repornește redarea când sursa devine activă" ColorRange="Gamă de culori YUV" -ColorRange.Auto="Auto" +ColorRange.Auto="Automată" ColorRange.Partial="Parțială" ColorRange.Full="Completă"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/ru-RU.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/ru-RU.ini
Changed
@@ -29,7 +29,7 @@ Looping="Повтор" Input="Ввод" InputFormat="Формат ввода" -BufferingMB="Сетевая буферизация (МБ)" +BufferingMB="Сетевая буферизация" HardwareDecode="Использовать аппаратное декодирование при наличии" ClearOnMediaEnd="Ничего не показывать, когда воспроизведение заканчивается" Advanced="Дополнительно" @@ -41,7 +41,7 @@ ColorRange.Partial="Частичный" ColorRange.Full="Полный" RestartMedia="Перезапустить медиа" -SpeedPercentage="Скорость (проценты)" +SpeedPercentage="Скорость" Seekable="Перематываемый" MediaFileFilter.AllMediaFiles="Все медиа-файлы"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/sk-SK.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/sk-SK.ini
Changed
@@ -16,7 +16,6 @@ Looping="Slučka" Input="Vstup" InputFormat="Vstupný formát" -BufferingMB="Sieťové zapisovanie do medzipamäte (MB)" HardwareDecode="Použiť hardvérové dekódovanie podľa dostupnosti" Advanced="Rozšírené" RestartWhenActivated="Obnoviť prehrávanie pri aktivovaní zdroja" @@ -27,7 +26,6 @@ ColorRange.Partial="Čiastočný" ColorRange.Full="Plný" RestartMedia="Reštartuj mediálny zdroj" -SpeedPercentage="Rýchlosť (v percentách)" Seekable="Posúvateľný" MediaFileFilter.AllMediaFiles="Všetky mediálne súbory"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/sl-SI.ini
Changed
@@ -1,17 +1,58 @@ -FFmpegOutput="FFmpeg izhod" -FFmpegAAC="FFmpeg Prevzeti AAC Encoder" -Bitrate="Bitrate" +FFmpegOutput="Izhod FFmpeg" +FFmpegAAC="Privzeti kodirnik AAC FFmpeg" +FFmpegOpus="Kodirnik Opus FFmpeg" +Bitrate="Bitna hitrost" +MaxBitrate="Največja bitna hitrost" +Preset="Prednastavitev" +RateControl="Nadzor hitrosti" +KeyframeIntervalSec="Razmik med ključnimi sličicami (s, 0=samodejno)" +Lossless="Brezizgubno" +BFrames="Največje št. sličic B" +NVENC.Use2Pass="Uporabi kodiranje z dvema prehodoma" +NVENC.Preset.default="Zmogljivost" +NVENC.Preset.hq="Kakovost" +NVENC.Preset.hp="Največja zmogljivost" +NVENC.Preset.mq="Najboljša kakovost" +NVENC.Preset.ll="Nizka zakasnitev" +NVENC.Preset.llhq="Kakovost z nizko zakasnitvijo" +NVENC.Preset.llhp="Zmogljivost z nizko zakasnitvijo" +NVENC.LookAhead="Predvidevanje" +NVENC.LookAhead.ToolTip="Omogoči dinamične sličice B.\n\nČe je onemogočeno, bo kodirnik vedno uporabil število sličic B, ki so navedene v nastavitvi 'Največje št. sličic B'.\n\nČe je omogočeno, bo vidna kakovost izboljšana, ker bo uporabljeno samo toliko sličic B, kot je potrebno, do\nnajvečjega števila na račun dodatne porabe GPE-ja." +NVENC.PsychoVisualTuning="Psiho-vidno uglaševanje" +NVENC.PsychoVisualTuning.ToolTip="Omogoči nastavitve kodirnika, ki optimizirajo uporabo bitne hitrosti za povečano zaznavno vidno kakovost,\nposebno v razmerah z veliko gibanja na račun povečane porabe GPE-ja." +NVENC.CQLevel="Raven CQ" -FFmpegSource="Medijski Vir" -LocalFile="Lokalna Datoteka" +FFmpegSource="Predstavnostni vir" +LocalFile="Lokalna datoteka" Looping="Ponavljaj" Input="Vhod" -InputFormat="Format vnosa" -HardwareDecode="Uporabi strojno pospeševanje, ko je na voljo" +InputFormat="Oblika vhoda" +BufferingMB="Omrežno medpomnenje" +HardwareDecode="Uporabi strojno odkodiranje, ko je na voljo" +ClearOnMediaEnd="Ne prikaži ničesar, ko se predvajanje konča" Advanced="Napredno" +RestartWhenActivated="Ponovno predvajaj, ki vir postane dejaven" +CloseFileWhenInactive="Zapri datoteko, ko ni dejaven" +CloseFileWhenInactive.ToolTip="Zapre datoteko, ki vir ni prikazan v pretoku ali posnetku. To omogoča\nspreminjanje datoteke, ko vir ni dejaven, vendar lahko pride do zakasnitve zagona,\nko vir ponovno postane dejaven." +ColorRange="Barvni razpon YUV" +ColorRange.Auto="Samodejno" +ColorRange.Partial="Delno" +ColorRange.Full="Polno" +RestartMedia="Pon. zaženi predstavnost" +SpeedPercentage="Hitrost" +Seekable="Omogoči iskanje" +MediaFileFilter.AllMediaFiles="Vse predstavne datoteke" +MediaFileFilter.VideoFiles="Videodatoteke" +MediaFileFilter.AudioFiles="Zvočne datoteke" +MediaFileFilter.AllFiles="Vse datoteke" +ReplayBuffer="Medpomn. za pon. predv." +ReplayBuffer.Save="Shrani pon. predv." +HelperProcessFailed="Pomožnega opravila za snemanje ni bilo mogoče začeti. Preverite, da protivirusni/varnostni program ni blokiral ali odstranil datotek OBS." +UnableToWritePath="Ni mogoče pisati v %1. Prepričajte se, da uporabljate pot za snemanje, na katero lahko vaš uporabniški račun zapisuje in da imate dovolj prostora na disku." +WarnWindowsDefender="To napako lahko povzroči tudi omogočena zaščita sistema Windows 10 proti izsiljevanju. V nastavitvah za varnost/zaščito proti virusom in grožnjami sistema Windows poizkusite izklopiti nadziran dostop do map."
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/sr-CS.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/sr-CS.ini
Changed
@@ -29,7 +29,6 @@ Looping="Ponavljanje" Input="Ulaz" InputFormat="Format ulaza" -BufferingMB="Baferovanje mreže (MB)" HardwareDecode="Koristi hardversko enkodiranje kada je dostupno" Advanced="Napredno" RestartWhenActivated="Ponovi reprodukciju kada izvor postane aktivan" @@ -40,7 +39,6 @@ ColorRange.Partial="Delimični" ColorRange.Full="Potpuni" RestartMedia="Restartuj medij" -SpeedPercentage="Brzina (procenat)" Seekable="Pretraživanje" MediaFileFilter.AllMediaFiles="Sve medija datoteke"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/sr-SP.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/sr-SP.ini
Changed
@@ -29,7 +29,6 @@ Looping="Понављање" Input="Улаз" InputFormat="Формат улаза" -BufferingMB="Баферовање мреже (мегабајти)" HardwareDecode="Користи хардверско енкодирање када је доступно" Advanced="Напредно" RestartWhenActivated="Понови репродукцију када извор постане активан" @@ -40,7 +39,6 @@ ColorRange.Partial="Делимични" ColorRange.Full="Потпуни" RestartMedia="Рестартуј медиј" -SpeedPercentage="Брзина (проценат)" Seekable="Претраживање" MediaFileFilter.AllMediaFiles="Све медија датотеке"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/sv-SE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/sv-SE.ini
Changed
@@ -29,7 +29,7 @@ Looping="Upprepa" Input="Infoga" InputFormat="Inmatningsformat" -BufferingMB="Nätverksbuffring (MB)" +BufferingMB="Nätverksbuffring" HardwareDecode="Använda hårdvareavkodning när tillgängligt" ClearOnMediaEnd="Visa ingenting när uppspelningen slutar" Advanced="Avancerat" @@ -41,7 +41,7 @@ ColorRange.Partial="Delvis" ColorRange.Full="Full" RestartMedia="Starta om media" -SpeedPercentage="Hastighet (procent)" +SpeedPercentage="Hastighet" Seekable="Sökbar" MediaFileFilter.AllMediaFiles="Alla mediafiler"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/tl-PH.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/tl-PH.ini
Changed
@@ -16,7 +16,6 @@ Looping="Silo" Input="Pampasok" InputFormat="Pampasok na Format" -BufferingMB="Ang Network Buffering (MB)" HardwareDecode="Gamitin ang hardware sa pag-decode kapag itong magagamit na" Advanced="Nauuna" RestartWhenActivated="I-restart ang playback kapag ang pinagmulan ay naging aktibo na"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/tr-TR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/tr-TR.ini
Changed
@@ -25,7 +25,6 @@ Looping="Döngü" Input="Giriş" InputFormat="Giriş Biçimi" -BufferingMB="Ağ Arabelleğe Alma (MB)" HardwareDecode="Kullanılabilir ise, donanım kod çözmeyi kullan" Advanced="Gelişmiş" RestartWhenActivated="Yeniden oynatmayı kaynak etkin olduğunda yeniden başlat" @@ -36,7 +35,7 @@ ColorRange.Partial="Kısmi" ColorRange.Full="Tam" RestartMedia="Ortamı Yeniden Başlat" -SpeedPercentage="Hız (yüzde)" +SpeedPercentage="Hız" Seekable="Aranabilir" MediaFileFilter.AllMediaFiles="Tüm Medya Dosyaları"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/uk-UA.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/uk-UA.ini
Changed
@@ -29,7 +29,7 @@ Looping="Циклічно відтворювати" Input="Вхід" InputFormat="Вхідний формат" -BufferingMB="Буферизація мережевого контенту (МБ)" +BufferingMB="Буферизація мережевого контенту" HardwareDecode="Використовувати апаратне декодування, за наявності" ClearOnMediaEnd="Не показувати джерело, коли відтворення завершено" Advanced="Розширені параметри" @@ -41,7 +41,7 @@ ColorRange.Partial="Частковий" ColorRange.Full="Повний" RestartMedia="Перезапустити медіа" -SpeedPercentage="Швидкість (відсотків)" +SpeedPercentage="Швидкість" Seekable="HTTP з перемотуванням" MediaFileFilter.AllMediaFiles="Файли мультимедіа"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/zh-CN.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/zh-CN.ini
Changed
@@ -29,7 +29,7 @@ Looping="循环" Input="输入" InputFormat="输入格式" -BufferingMB="网络缓冲 (MB)" +BufferingMB="网络缓冲" HardwareDecode="在可用时使用硬件解码" ClearOnMediaEnd="播放结束时不显示任何内容" Advanced="高级" @@ -41,7 +41,7 @@ ColorRange.Partial="局部" ColorRange.Full="全部" RestartMedia="重新启动媒体" -SpeedPercentage="速度(百分比)" +SpeedPercentage="速度" Seekable="可搜索" MediaFileFilter.AllMediaFiles="所有媒体文件"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/data/locale/zh-TW.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/data/locale/zh-TW.ini
Changed
@@ -29,7 +29,7 @@ Looping="循環" Input="輸入" InputFormat="輸入格式" -BufferingMB="網路緩衝 (MB)" +BufferingMB="網路緩衝" HardwareDecode="盡可能使用硬體解碼" ClearOnMediaEnd="播放結束時不顯示任何內容" Advanced="進階" @@ -41,7 +41,7 @@ ColorRange.Partial="部分" ColorRange.Full="全部" RestartMedia="重新播放媒體" -SpeedPercentage="速度 (百分比)" +SpeedPercentage="速度" Seekable="可查找" MediaFileFilter.AllMediaFiles="所有媒體檔案"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/external
Added
+(directory)
View file
obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/external/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/external/dynlink_cuda.h
Changed
(renamed from plugins/obs-ffmpeg/dynlink_cuda.h)
View file
obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/external/nvEncodeAPI.h
Changed
(renamed from plugins/obs-ffmpeg/nvEncodeAPI.h)
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c
Changed
@@ -39,8 +39,8 @@ struct resize_buf { uint8_t *buf; - size_t size; - size_t capacity; + size_t size; + size_t capacity; }; static inline void resize_buf_resize(struct resize_buf *rb, size_t size) @@ -96,15 +96,15 @@ }; struct ffmpeg_mux { - AVFormatContext *output; - AVStream *video_stream; - AVStream **audio_streams; - struct main_params params; - struct audio_params *audio; - struct header video_header; - struct header *audio_header; - int num_audio_streams; - bool initialized; + AVFormatContext *output; + AVStream *video_stream; + AVStream **audio_streams; + struct main_params params; + struct audio_params *audio; + struct header video_header; + struct header *audio_header; + int num_audio_streams; + bool initialized; char error[4096]; }; @@ -158,7 +158,7 @@ } static bool get_opt_str(int *p_argc, char ***p_argv, char **str, - const char *opt) + const char *opt) { int argc = *p_argc; char **argv = *p_argv; @@ -187,7 +187,7 @@ } static bool get_audio_params(struct audio_params *audio, int *argc, - char ***argv) + char ***argv) { if (!get_opt_str(argc, argv, &audio->name, "audio track name")) return false; @@ -201,7 +201,7 @@ } static bool init_params(int *argc, char ***argv, struct main_params *params, - struct audio_params **p_audio) + struct audio_params **p_audio) { struct audio_params *audio = NULL; @@ -228,7 +228,8 @@ if (params->has_video) { if (!get_opt_str(argc, argv, ¶ms->vcodec, "video codec")) return false; - if (!get_opt_int(argc, argv, ¶ms->vbitrate,"video bitrate")) + if (!get_opt_int(argc, argv, ¶ms->vbitrate, + "video bitrate")) return false; if (!get_opt_int(argc, argv, ¶ms->width, "video width")) return false; @@ -262,7 +263,7 @@ } static bool new_stream(struct ffmpeg_mux *ffm, AVStream **stream, - const char *name, enum AVCodecID *id) + const char *name, enum AVCodecID *id) { const AVCodecDescriptor *desc = avcodec_descriptor_get_by_name(name); AVCodec *codec; @@ -282,11 +283,12 @@ *stream = avformat_new_stream(ffm->output, codec); if (!*stream) { - fprintf(stderr, "Couldn't create stream for encoder '%s'\n", name); + fprintf(stderr, "Couldn't create stream for encoder '%s'\n", + name); return false; } - (*stream)->id = ffm->output->nb_streams-1; + (*stream)->id = ffm->output->nb_streams - 1; return true; } @@ -296,21 +298,21 @@ void *extradata = NULL; if (!new_stream(ffm, &ffm->video_stream, ffm->params.vcodec, - &ffm->output->oformat->video_codec)) + &ffm->output->oformat->video_codec)) return; if (ffm->video_header.size) { extradata = av_memdup(ffm->video_header.data, - ffm->video_header.size); + ffm->video_header.size); } - context = ffm->video_stream->codec; - context->bit_rate = ffm->params.vbitrate * 1000; - context->width = ffm->params.width; - context->height = ffm->params.height; - context->coded_width = ffm->params.width; - context->coded_height = ffm->params.height; - context->extradata = extradata; + context = ffm->video_stream->codec; + context->bit_rate = ffm->params.vbitrate * 1000; + context->width = ffm->params.width; + context->height = ffm->params.height; + context->coded_width = ffm->params.width; + context->coded_height = ffm->params.height; + context->extradata = extradata; context->extradata_size = ffm->video_header.size; context->time_base = (AVRational){ffm->params.fps_den, ffm->params.fps_num}; @@ -329,7 +331,7 @@ void *extradata = NULL; if (!new_stream(ffm, &stream, ffm->params.acodec, - &ffm->output->oformat->audio_codec)) + &ffm->output->oformat->audio_codec)) return; ffm->audio_streams[idx] = stream; @@ -340,19 +342,19 @@ if (ffm->audio_header[idx].size) { extradata = av_memdup(ffm->audio_header[idx].data, - ffm->audio_header[idx].size); + ffm->audio_header[idx].size); } - context = stream->codec; - context->bit_rate = ffm->audio[idx].abitrate * 1000; - context->channels = ffm->audio[idx].channels; - context->sample_rate = ffm->audio[idx].sample_rate; - context->sample_fmt = AV_SAMPLE_FMT_S16; - context->time_base = stream->time_base; - context->extradata = extradata; + context = stream->codec; + context->bit_rate = ffm->audio[idx].abitrate * 1000; + context->channels = ffm->audio[idx].channels; + context->sample_rate = ffm->audio[idx].sample_rate; + context->sample_fmt = AV_SAMPLE_FMT_S16; + context->time_base = stream->time_base; + context->extradata = extradata; context->extradata_size = ffm->audio_header[idx].size; context->channel_layout = - av_get_default_channel_layout(context->channels); + av_get_default_channel_layout(context->channels); //AVlib default channel layout for 4 channels is 4.0 ; fix for quad if (context->channels == 4) context->channel_layout = av_get_channel_layout("quad"); @@ -372,7 +374,7 @@ if (ffm->params.tracks) { ffm->audio_streams = - calloc(1, ffm->params.tracks * sizeof(void*)); + calloc(1, ffm->params.tracks * sizeof(void *)); for (int i = 0; i < ffm->params.tracks; i++) create_audio_stream(ffm, i); @@ -392,20 +394,20 @@ } static void ffmpeg_mux_header(struct ffmpeg_mux *ffm, uint8_t *data, - struct ffm_packet_info *info) + struct ffm_packet_info *info) { if (info->type == FFM_PACKET_VIDEO) { set_header(&ffm->video_header, data, (size_t)info->size); } else { set_header(&ffm->audio_header[info->index], data, - (size_t)info->size); + (size_t)info->size); } } static size_t safe_read(void *vdata, size_t size) { uint8_t *data = vdata; - size_t total = size; + size_t total = size; while (size > 0) { size_t in_size = fread(data, 1, size, stdin); @@ -470,20 +472,20 @@ AVIO_FLAG_WRITE); if (ret < 0) { fprintf(stderr, "Couldn't open '%s', %s", - ffm->params.file, av_err2str(ret)); + ffm->params.file, av_err2str(ret)); return FFM_ERROR; } } strncpy(ffm->output->filename, ffm->params.file, - sizeof(ffm->output->filename)); + sizeof(ffm->output->filename)); ffm->output->filename[sizeof(ffm->output->filename) - 1] = 0; AVDictionary *dict = NULL; - if ((ret = av_dict_parse_string(&dict, ffm->params.muxer_settings, - "=", " ", 0))) { + if ((ret = av_dict_parse_string(&dict, ffm->params.muxer_settings, "=", + " ", 0))) { fprintf(stderr, "Failed to parse muxer settings: %s\n%s", - av_err2str(ret), ffm->params.muxer_settings); + av_err2str(ret), ffm->params.muxer_settings); av_dict_free(&dict); } @@ -493,7 +495,7 @@ AVDictionaryEntry *entry = NULL; while ((entry = av_dict_get(dict, "", entry, - AV_DICT_IGNORE_SUFFIX))) + AV_DICT_IGNORE_SUFFIX))) printf("\n\t%s=%s", entry->key, entry->value); printf("\n"); @@ -501,8 +503,8 @@ ret = avformat_write_header(ffm->output, &dict); if (ret < 0) { - fprintf(stderr, "Error opening '%s': %s", - ffm->params.file, av_err2str(ret)); + fprintf(stderr, "Error opening '%s': %s", ffm->params.file, + av_err2str(ret)); av_dict_free(&dict); @@ -522,15 +524,15 @@ output_format = av_guess_format(NULL, ffm->params.file, NULL); if (output_format == NULL) { fprintf(stderr, "Couldn't find an appropriate muxer for '%s'\n", - ffm->params.file); + ffm->params.file); return FFM_ERROR; } - ret = avformat_alloc_output_context2(&ffm->output, output_format, - NULL, NULL); + ret = avformat_alloc_output_context2(&ffm->output, output_format, NULL, + NULL); if (ret < 0) { fprintf(stderr, "Couldn't initialize output context: %s\n", - av_err2str(ret)); + av_err2str(ret)); return FFM_ERROR; } @@ -552,7 +554,7 @@ } static int ffmpeg_mux_init_internal(struct ffmpeg_mux *ffm, int argc, - char *argv[]) + char *argv[]) { argc--; argv++; @@ -564,7 +566,9 @@ calloc(1, sizeof(struct header) * ffm->params.tracks); } +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); +#endif if (!ffmpeg_mux_get_extra_data(ffm)) return FFM_ERROR; @@ -587,7 +591,7 @@ } static inline int get_index(struct ffmpeg_mux *ffm, - struct ffm_packet_info *info) + struct ffm_packet_info *info) { if (info->type == FFM_PACKET_VIDEO) { if (ffm->video_stream) { @@ -612,12 +616,12 @@ AVStream *stream = get_stream(ffm, idx); return av_rescale_q_rnd(val / stream->codec->time_base.num, - stream->codec->time_base, stream->time_base, - AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX); + stream->codec->time_base, stream->time_base, + AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX); } static inline bool ffmpeg_mux_packet(struct ffmpeg_mux *ffm, uint8_t *buf, - struct ffm_packet_info *info) + struct ffm_packet_info *info) { int idx = get_index(ffm, info); AVPacket packet = {0}; @@ -627,7 +631,7 @@ return true; } - av_init_packet(&packet); + av_init_packet(&packet); packet.data = buf; packet.size = (int)info->size; @@ -660,16 +664,16 @@ SetErrorMode(SEM_FAILCRITICALERRORS); - argv = malloc(argc * sizeof(char*)); + argv = malloc(argc * sizeof(char *)); for (int i = 0; i < argc; i++) { size_t len = wcslen(argv_w[i]); int size; size = WideCharToMultiByte(CP_UTF8, 0, argv_w[i], (int)len, - NULL, 0, NULL, NULL); + NULL, 0, NULL, NULL); argv[i] = malloc(size + 1); WideCharToMultiByte(CP_UTF8, 0, argv_w[i], (int)len, argv[i], - size + 1, NULL, NULL); + size + 1, NULL, NULL); argv[i][size] = 0; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.h -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.h
Changed
@@ -20,18 +20,18 @@ enum ffm_packet_type { FFM_PACKET_VIDEO, - FFM_PACKET_AUDIO + FFM_PACKET_AUDIO, }; -#define FFM_SUCCESS 0 -#define FFM_ERROR -1 +#define FFM_SUCCESS 0 +#define FFM_ERROR -1 #define FFM_UNSUPPORTED -2 struct ffm_packet_info { - int64_t pts; - int64_t dts; - uint32_t size; - uint32_t index; + int64_t pts; + int64_t dts; + uint32_t size; + uint32_t index; enum ffm_packet_type type; - bool keyframe; + bool keyframe; };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/jim-nvenc-helpers.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/jim-nvenc-helpers.c
Changed
@@ -7,16 +7,16 @@ NV_ENCODE_API_FUNCTION_LIST nv = {NV_ENCODE_API_FUNCTION_LIST_VER}; NV_CREATE_INSTANCE_FUNC nv_create_instance = NULL; -#define error(format, ...) \ - blog(LOG_ERROR, "[jim-nvenc] " format, ##__VA_ARGS__) +#define error(format, ...) blog(LOG_ERROR, "[jim-nvenc] " format, ##__VA_ARGS__) -static inline bool nv_failed(NVENCSTATUS err, const char *func, const char *call) +static inline bool nv_failed(NVENCSTATUS err, const char *func, + const char *call) { if (err == NV_ENC_SUCCESS) return false; error("%s: %s failed: %d (%s)", func, call, (int)err, - nv_error_name(err)); + nv_error_name(err)); return true; } @@ -24,7 +24,7 @@ bool load_nvenc_lib(void) { - if (sizeof(void*) == 8) { + if (sizeof(void *) == 8) { nvenc_lib = os_dlopen("nvEncodeAPI64.dll"); } else { nvenc_lib = os_dlopen("nvEncodeAPI.dll"); @@ -42,40 +42,41 @@ return func_ptr; } -typedef NVENCSTATUS (NVENCAPI *NV_MAX_VER_FUNC)(uint32_t*); +typedef NVENCSTATUS(NVENCAPI *NV_MAX_VER_FUNC)(uint32_t *); const char *nv_error_name(NVENCSTATUS err) { #define RETURN_CASE(x) \ - case x: return #x + case x: \ + return #x switch (err) { - RETURN_CASE(NV_ENC_SUCCESS); - RETURN_CASE(NV_ENC_ERR_NO_ENCODE_DEVICE); - RETURN_CASE(NV_ENC_ERR_UNSUPPORTED_DEVICE); - RETURN_CASE(NV_ENC_ERR_INVALID_ENCODERDEVICE); - RETURN_CASE(NV_ENC_ERR_INVALID_DEVICE); - RETURN_CASE(NV_ENC_ERR_DEVICE_NOT_EXIST); - RETURN_CASE(NV_ENC_ERR_INVALID_PTR); - RETURN_CASE(NV_ENC_ERR_INVALID_EVENT); - RETURN_CASE(NV_ENC_ERR_INVALID_PARAM); - RETURN_CASE(NV_ENC_ERR_INVALID_CALL); - RETURN_CASE(NV_ENC_ERR_OUT_OF_MEMORY); - RETURN_CASE(NV_ENC_ERR_ENCODER_NOT_INITIALIZED); - RETURN_CASE(NV_ENC_ERR_UNSUPPORTED_PARAM); - RETURN_CASE(NV_ENC_ERR_LOCK_BUSY); - RETURN_CASE(NV_ENC_ERR_NOT_ENOUGH_BUFFER); - RETURN_CASE(NV_ENC_ERR_INVALID_VERSION); - RETURN_CASE(NV_ENC_ERR_MAP_FAILED); - RETURN_CASE(NV_ENC_ERR_NEED_MORE_INPUT); - RETURN_CASE(NV_ENC_ERR_ENCODER_BUSY); - RETURN_CASE(NV_ENC_ERR_EVENT_NOT_REGISTERD); - RETURN_CASE(NV_ENC_ERR_GENERIC); - RETURN_CASE(NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY); - RETURN_CASE(NV_ENC_ERR_UNIMPLEMENTED); - RETURN_CASE(NV_ENC_ERR_RESOURCE_REGISTER_FAILED); - RETURN_CASE(NV_ENC_ERR_RESOURCE_NOT_REGISTERED); - RETURN_CASE(NV_ENC_ERR_RESOURCE_NOT_MAPPED); + RETURN_CASE(NV_ENC_SUCCESS); + RETURN_CASE(NV_ENC_ERR_NO_ENCODE_DEVICE); + RETURN_CASE(NV_ENC_ERR_UNSUPPORTED_DEVICE); + RETURN_CASE(NV_ENC_ERR_INVALID_ENCODERDEVICE); + RETURN_CASE(NV_ENC_ERR_INVALID_DEVICE); + RETURN_CASE(NV_ENC_ERR_DEVICE_NOT_EXIST); + RETURN_CASE(NV_ENC_ERR_INVALID_PTR); + RETURN_CASE(NV_ENC_ERR_INVALID_EVENT); + RETURN_CASE(NV_ENC_ERR_INVALID_PARAM); + RETURN_CASE(NV_ENC_ERR_INVALID_CALL); + RETURN_CASE(NV_ENC_ERR_OUT_OF_MEMORY); + RETURN_CASE(NV_ENC_ERR_ENCODER_NOT_INITIALIZED); + RETURN_CASE(NV_ENC_ERR_UNSUPPORTED_PARAM); + RETURN_CASE(NV_ENC_ERR_LOCK_BUSY); + RETURN_CASE(NV_ENC_ERR_NOT_ENOUGH_BUFFER); + RETURN_CASE(NV_ENC_ERR_INVALID_VERSION); + RETURN_CASE(NV_ENC_ERR_MAP_FAILED); + RETURN_CASE(NV_ENC_ERR_NEED_MORE_INPUT); + RETURN_CASE(NV_ENC_ERR_ENCODER_BUSY); + RETURN_CASE(NV_ENC_ERR_EVENT_NOT_REGISTERD); + RETURN_CASE(NV_ENC_ERR_GENERIC); + RETURN_CASE(NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY); + RETURN_CASE(NV_ENC_ERR_UNIMPLEMENTED); + RETURN_CASE(NV_ENC_ERR_RESOURCE_REGISTER_FAILED); + RETURN_CASE(NV_ENC_ERR_RESOURCE_NOT_REGISTERED); + RETURN_CASE(NV_ENC_ERR_RESOURCE_NOT_MAPPED); } #undef RETURN_CASE @@ -91,8 +92,8 @@ return success; initialized = true; - NV_MAX_VER_FUNC nv_max_ver = (NV_MAX_VER_FUNC) - load_nv_func("NvEncodeAPIGetMaxSupportedVersion"); + NV_MAX_VER_FUNC nv_max_ver = (NV_MAX_VER_FUNC)load_nv_func( + "NvEncodeAPIGetMaxSupportedVersion"); if (!nv_max_ver) { return false; } @@ -102,16 +103,16 @@ return false; } - uint32_t cur_ver = - (NVENCAPI_MAJOR_VERSION << 4) | NVENCAPI_MINOR_VERSION; + uint32_t cur_ver = (NVENCAPI_MAJOR_VERSION << 4) | + NVENCAPI_MINOR_VERSION; if (cur_ver > ver) { error("Current driver version does not support this NVENC " - "version, please upgrade your driver"); + "version, please upgrade your driver"); return false; } - nv_create_instance = (NV_CREATE_INSTANCE_FUNC) - load_nv_func("NvEncodeAPICreateInstance"); + nv_create_instance = (NV_CREATE_INSTANCE_FUNC)load_nv_func( + "NvEncodeAPICreateInstance"); if (!nv_create_instance) { return false; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/jim-nvenc.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/jim-nvenc.c
Changed
@@ -12,17 +12,16 @@ #define EXTRA_BUFFERS 5 -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[jim-nvenc: '%s'] " format, \ - obs_encoder_get_name(enc->encoder), ##__VA_ARGS__) + obs_encoder_get_name(enc->encoder), ##__VA_ARGS__) -#define error(format, ...) do_log(LOG_ERROR, format, ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define error(format, ...) do_log(LOG_ERROR, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) -#define error_hr(msg) \ - error("%s: %s: 0x%08lX", __FUNCTION__, msg, (uint32_t)hr); +#define error_hr(msg) error("%s: %s: 0x%08lX", __FUNCTION__, msg, (uint32_t)hr); struct nv_bitstream; struct nv_texture; @@ -39,57 +38,57 @@ struct nvenc_data { obs_encoder_t *encoder; - void *session; + void *session; NV_ENC_INITIALIZE_PARAMS params; - NV_ENC_CONFIG config; - size_t buf_count; - size_t output_delay; - size_t buffers_queued; - size_t next_bitstream; - size_t cur_bitstream; - bool encode_started; - bool first_packet; - bool can_change_bitrate; - bool bframes; + NV_ENC_CONFIG config; + size_t buf_count; + size_t output_delay; + size_t buffers_queued; + size_t next_bitstream; + size_t cur_bitstream; + bool encode_started; + bool first_packet; + bool can_change_bitrate; + bool bframes; DARRAY(struct nv_bitstream) bitstreams; - DARRAY(struct nv_texture) textures; - DARRAY(struct handle_tex) input_textures; - struct circlebuf dts_list; + DARRAY(struct nv_texture) textures; + DARRAY(struct handle_tex) input_textures; + struct circlebuf dts_list; DARRAY(uint8_t) packet_data; - int64_t packet_pts; - bool packet_keyframe; + int64_t packet_pts; + bool packet_keyframe; - ID3D11Device *device; + ID3D11Device *device; ID3D11DeviceContext *context; uint32_t cx; uint32_t cy; uint8_t *header; - size_t header_size; + size_t header_size; uint8_t *sei; - size_t sei_size; + size_t sei_size; }; /* ------------------------------------------------------------------------- */ /* Bitstream Buffer */ struct nv_bitstream { - void *ptr; + void *ptr; HANDLE event; }; static inline bool nv_failed(struct nvenc_data *enc, NVENCSTATUS err, - const char *func, const char *call) + const char *func, const char *call) { if (err == NV_ENC_SUCCESS) return false; error("%s: %s failed: %d (%s)", func, call, (int)err, - nv_error_name(err)); + nv_error_name(err)); return true; } @@ -97,7 +96,8 @@ static bool nv_bitstream_init(struct nvenc_data *enc, struct nv_bitstream *bs) { - NV_ENC_CREATE_BITSTREAM_BUFFER buf = {NV_ENC_CREATE_BITSTREAM_BUFFER_VER}; + NV_ENC_CREATE_BITSTREAM_BUFFER buf = { + NV_ENC_CREATE_BITSTREAM_BUFFER_VER}; NV_ENC_EVENT_PARAMS params = {NV_ENC_EVENT_PARAMS_VER}; HANDLE event = NULL; @@ -126,7 +126,7 @@ } if (buf.bitstreamBuffer) { nv.nvEncDestroyBitstreamBuffer(enc->session, - buf.bitstreamBuffer); + buf.bitstreamBuffer); } return false; } @@ -147,9 +147,9 @@ /* Texture Resource */ struct nv_texture { - void *res; + void *res; ID3D11Texture2D *tex; - void *mapped_res; + void *mapped_res; }; static bool nv_texture_init(struct nvenc_data *enc, struct nv_texture *nvtex) @@ -159,13 +159,13 @@ HRESULT hr; D3D11_TEXTURE2D_DESC desc = {0}; - desc.Width = enc->cx; - desc.Height = enc->cy; - desc.MipLevels = 1; - desc.ArraySize = 1; - desc.Format = DXGI_FORMAT_NV12; - desc.SampleDesc.Count = 1; - desc.BindFlags = D3D11_BIND_RENDER_TARGET; + desc.Width = enc->cx; + desc.Height = enc->cy; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.Format = DXGI_FORMAT_NV12; + desc.SampleDesc.Count = 1; + desc.BindFlags = D3D11_BIND_RENDER_TARGET; hr = device->lpVtbl->CreateTexture2D(device, &desc, NULL, &tex); if (FAILED(hr)) { @@ -176,11 +176,11 @@ tex->lpVtbl->SetEvictionPriority(tex, DXGI_RESOURCE_PRIORITY_MAXIMUM); NV_ENC_REGISTER_RESOURCE res = {NV_ENC_REGISTER_RESOURCE_VER}; - res.resourceType = NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX; - res.resourceToRegister = tex; - res.width = enc->cx; - res.height = enc->cy; - res.bufferFormat = NV_ENC_BUFFER_FORMAT_NV12; + res.resourceType = NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX; + res.resourceToRegister = tex; + res.width = enc->cx; + res.height = enc->cy; + res.bufferFormat = NV_ENC_BUFFER_FORMAT_NV12; if (NV_FAILED(nv.nvEncRegisterResource(enc->session, &res))) { tex->lpVtbl->Release(tex); @@ -197,7 +197,7 @@ if (nvtex->res) { if (nvtex->mapped_res) { nv.nvEncUnmapInputResource(enc->session, - nvtex->mapped_res); + nvtex->mapped_res); } nv.nvEncUnregisterResource(enc->session, nvtex->res); nvtex->tex->lpVtbl->Release(nvtex->tex); @@ -235,13 +235,16 @@ int bitrate = (int)obs_data_get_int(settings, "bitrate"); enc->config.rcParams.averageBitRate = bitrate * 1000; - enc->config.rcParams.maxBitRate = bitrate * 1000; + enc->config.rcParams.maxBitRate = bitrate * 1000; NV_ENC_RECONFIGURE_PARAMS params = {0}; - params.version = NV_ENC_RECONFIGURE_PARAMS_VER; - params.reInitEncodeParams = enc->params; + params.version = NV_ENC_RECONFIGURE_PARAMS_VER; + params.reInitEncodeParams = enc->params; + params.resetEncoder = 1; + params.forceIDR = 1; - if (FAILED(nv.nvEncReconfigureEncoder(enc->session, ¶ms))) { + if (NV_FAILED(nv.nvEncReconfigureEncoder(enc->session, + ¶ms))) { return false; } } @@ -261,28 +264,28 @@ return mod; } -typedef HRESULT (WINAPI *CREATEDXGIFACTORY1PROC)(REFIID, void **); +typedef HRESULT(WINAPI *CREATEDXGIFACTORY1PROC)(REFIID, void **); static bool init_d3d11(struct nvenc_data *enc, obs_data_t *settings) { - HMODULE dxgi = get_lib(enc, "DXGI.dll"); - HMODULE d3d11 = get_lib(enc, "D3D11.dll"); - CREATEDXGIFACTORY1PROC create_dxgi; + HMODULE dxgi = get_lib(enc, "DXGI.dll"); + HMODULE d3d11 = get_lib(enc, "D3D11.dll"); + CREATEDXGIFACTORY1PROC create_dxgi; PFN_D3D11_CREATE_DEVICE create_device; - IDXGIFactory1 *factory; - IDXGIAdapter *adapter; - ID3D11Device *device; - ID3D11DeviceContext *context; - HRESULT hr; + IDXGIFactory1 *factory; + IDXGIAdapter *adapter; + ID3D11Device *device; + ID3D11DeviceContext *context; + HRESULT hr; if (!dxgi || !d3d11) { return false; } - create_dxgi = (CREATEDXGIFACTORY1PROC)GetProcAddress(dxgi, - "CreateDXGIFactory1"); - create_device = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(d3d11, - "D3D11CreateDevice"); + create_dxgi = (CREATEDXGIFACTORY1PROC)GetProcAddress( + dxgi, "CreateDXGIFactory1"); + create_device = (PFN_D3D11_CREATE_DEVICE)GetProcAddress( + d3d11, "D3D11CreateDevice"); if (!create_dxgi || !create_device) { error("Failed to load D3D11/DXGI procedures"); @@ -302,8 +305,8 @@ return false; } - hr = create_device(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, 0, - NULL, 0, D3D11_SDK_VERSION, &device, NULL, &context); + hr = create_device(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, 0, NULL, 0, + D3D11_SDK_VERSION, &device, NULL, &context); adapter->lpVtbl->Release(adapter); if (FAILED(hr)) { error_hr("D3D11CreateDevice failed"); @@ -317,8 +320,8 @@ static bool init_session(struct nvenc_data *enc) { - NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params = - {NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER}; + NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS params = { + NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER}; params.device = enc->device; params.deviceType = NV_ENC_DEVICE_TYPE_DIRECTX; params.apiVersion = NVENCAPI_VERSION; @@ -384,19 +387,19 @@ } if (astrcmpi(rc, "lossless") == 0) { - nv_preset = hp - ? NV_ENC_PRESET_LOSSLESS_HP_GUID - : NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID; + nv_preset = hp ? NV_ENC_PRESET_LOSSLESS_HP_GUID + : NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID; } /* -------------------------- */ /* get preset default config */ - NV_ENC_PRESET_CONFIG preset_config = - {NV_ENC_PRESET_CONFIG_VER, {NV_ENC_CONFIG_VER}}; + NV_ENC_PRESET_CONFIG preset_config = {NV_ENC_PRESET_CONFIG_VER, + {NV_ENC_CONFIG_VER}}; err = nv.nvEncGetEncodePresetConfig(enc->session, - NV_ENC_CODEC_H264_GUID, nv_preset, &preset_config); + NV_ENC_CODEC_H264_GUID, nv_preset, + &preset_config); if (nv_failed(enc, err, __FUNCTION__, "nvEncGetEncodePresetConfig")) { return false; } @@ -406,9 +409,8 @@ enc->config = preset_config.presetCfg; - uint32_t gop_size = (keyint_sec) - ? keyint_sec * voi->fps_num / voi->fps_den - : 250; + uint32_t gop_size = + (keyint_sec) ? keyint_sec * voi->fps_num / voi->fps_den : 250; NV_ENC_INITIALIZE_PARAMS *params = &enc->params; NV_ENC_CONFIG *config = &enc->config; @@ -461,9 +463,8 @@ enc->can_change_bitrate = nv_get_cap(enc, NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE); - config->rcParams.rateControlMode = twopass - ? NV_ENC_PARAMS_RC_VBR_HQ - : NV_ENC_PARAMS_RC_VBR; + config->rcParams.rateControlMode = twopass ? NV_ENC_PARAMS_RC_VBR_HQ + : NV_ENC_PARAMS_RC_VBR; if (astrcmpi(rc, "cqp") == 0 || astrcmpi(rc, "lossless") == 0) { if (astrcmpi(rc, "lossless") == 0) @@ -480,9 +481,9 @@ } else if (astrcmpi(rc, "vbr") != 0) { /* CBR by default */ h264_config->outputBufferingPeriodSEI = 1; - config->rcParams.rateControlMode = twopass - ? NV_ENC_PARAMS_RC_2_PASS_QUALITY - : NV_ENC_PARAMS_RC_CBR; + config->rcParams.rateControlMode = + twopass ? NV_ENC_PARAMS_RC_2_PASS_QUALITY + : NV_ENC_PARAMS_RC_CBR; } h264_config->outputPictureTimingSEI = 1; @@ -508,7 +509,7 @@ } enc->buf_count = config->frameIntervalP + - config->rcParams.lookaheadDepth + EXTRA_BUFFERS; + config->rcParams.lookaheadDepth + EXTRA_BUFFERS; enc->output_delay = enc->buf_count - 1; info("settings:\n" @@ -524,12 +525,8 @@ "\tb-frames: %d\n" "\tlookahead: %s\n" "\tpsycho_aq: %s\n", - rc, bitrate, cqp, gop_size, - preset, profile, - enc->cx, enc->cy, - twopass ? "true" : "false", - bf, - lookahead ? "true" : "false", + rc, bitrate, cqp, gop_size, preset, profile, enc->cx, enc->cy, + twopass ? "true" : "false", bf, lookahead ? "true" : "false", psycho_aq ? "true" : "false"); return true; @@ -662,12 +659,13 @@ } static ID3D11Texture2D *get_tex_from_handle(struct nvenc_data *enc, - uint32_t handle, IDXGIKeyedMutex **km_out) + uint32_t handle, + IDXGIKeyedMutex **km_out) { - ID3D11Device *device = enc->device; + ID3D11Device *device = enc->device; IDXGIKeyedMutex *km; ID3D11Texture2D *input_tex; - HRESULT hr; + HRESULT hr; for (size_t i = 0; i < enc->input_textures.num; i++) { struct handle_tex *ht = &enc->input_textures.array[i]; @@ -678,15 +676,16 @@ } hr = device->lpVtbl->OpenSharedResource(device, - (HANDLE)(uintptr_t)handle, - &IID_ID3D11Texture2D, &input_tex); + (HANDLE)(uintptr_t)handle, + &IID_ID3D11Texture2D, + &input_tex); if (FAILED(hr)) { error_hr("OpenSharedResource failed"); return NULL; } hr = input_tex->lpVtbl->QueryInterface(input_tex, &IID_IDXGIKeyedMutex, - &km); + &km); if (FAILED(hr)) { error_hr("QueryInterface(IDXGIKeyedMutex) failed"); input_tex->lpVtbl->Release(input_tex); @@ -694,7 +693,7 @@ } input_tex->lpVtbl->SetEvictionPriority(input_tex, - DXGI_RESOURCE_PRIORITY_MAXIMUM); + DXGI_RESOURCE_PRIORITY_MAXIMUM); *km_out = km; @@ -717,15 +716,15 @@ size_t count = finalize ? enc->buffers_queued : 1; for (size_t i = 0; i < count; i++) { - size_t cur_bs_idx = enc->cur_bitstream; - struct nv_bitstream *bs = &enc->bitstreams.array[cur_bs_idx]; - struct nv_texture *nvtex = &enc->textures.array[cur_bs_idx]; + size_t cur_bs_idx = enc->cur_bitstream; + struct nv_bitstream *bs = &enc->bitstreams.array[cur_bs_idx]; + struct nv_texture *nvtex = &enc->textures.array[cur_bs_idx]; /* ---------------- */ NV_ENC_LOCK_BITSTREAM lock = {NV_ENC_LOCK_BITSTREAM_VER}; - lock.outputBitstream = bs->ptr; - lock.doNotWait = false; + lock.outputBitstream = bs->ptr; + lock.doNotWait = false; if (NV_FAILED(nv.nvEncLockBitstream(s, &lock))) { return false; @@ -736,19 +735,17 @@ size_t size; enc->first_packet = false; - obs_extract_avc_headers( - lock.bitstreamBufferPtr, - lock.bitstreamSizeInBytes, - &new_packet, &size, - &enc->header, &enc->header_size, - &enc->sei, &enc->sei_size); + obs_extract_avc_headers(lock.bitstreamBufferPtr, + lock.bitstreamSizeInBytes, + &new_packet, &size, + &enc->header, &enc->header_size, + &enc->sei, &enc->sei_size); da_copy_array(enc->packet_data, new_packet, size); bfree(new_packet); } else { - da_copy_array(enc->packet_data, - lock.bitstreamBufferPtr, - lock.bitstreamSizeInBytes); + da_copy_array(enc->packet_data, lock.bitstreamBufferPtr, + lock.bitstreamSizeInBytes); } enc->packet_pts = (int64_t)lock.outputTimeStamp; @@ -781,18 +778,19 @@ } static bool nvenc_encode_tex(void *data, uint32_t handle, int64_t pts, - uint64_t lock_key, uint64_t *next_key, - struct encoder_packet *packet, bool *received_packet) + uint64_t lock_key, uint64_t *next_key, + struct encoder_packet *packet, + bool *received_packet) { - struct nvenc_data *enc = data; - ID3D11Device *device = enc->device; + struct nvenc_data *enc = data; + ID3D11Device *device = enc->device; ID3D11DeviceContext *context = enc->context; - ID3D11Texture2D *input_tex; - ID3D11Texture2D *output_tex; - IDXGIKeyedMutex *km; - struct nv_texture *nvtex; + ID3D11Texture2D *input_tex; + ID3D11Texture2D *output_tex; + IDXGIKeyedMutex *km; + struct nv_texture *nvtex; struct nv_bitstream *bs; - NVENCSTATUS err; + NVENCSTATUS err; if (handle == GS_INVALID_HANDLE) { error("Encode failed: bad texture handle"); @@ -800,10 +798,10 @@ return false; } - bs = &enc->bitstreams.array[enc->next_bitstream]; + bs = &enc->bitstreams.array[enc->next_bitstream]; nvtex = &enc->textures.array[enc->next_bitstream]; - input_tex = get_tex_from_handle(enc, handle, &km); + input_tex = get_tex_from_handle(enc, handle, &km); output_tex = nvtex->tex; if (!input_tex) { @@ -823,9 +821,8 @@ km->lpVtbl->AcquireSync(km, lock_key, INFINITE); - context->lpVtbl->CopyResource(context, - (ID3D11Resource *)output_tex, - (ID3D11Resource *)input_tex); + context->lpVtbl->CopyResource(context, (ID3D11Resource *)output_tex, + (ID3D11Resource *)input_tex); km->lpVtbl->ReleaseSync(km, *next_key); @@ -833,7 +830,7 @@ /* map output tex so nvenc can use it */ NV_ENC_MAP_INPUT_RESOURCE map = {NV_ENC_MAP_INPUT_RESOURCE_VER}; - map.registeredResource = nvtex->res; + map.registeredResource = nvtex->res; if (NV_FAILED(nv.nvEncMapInputResource(enc->session, &map))) { return false; } @@ -844,15 +841,15 @@ /* do actual encode call */ NV_ENC_PIC_PARAMS params = {0}; - params.version = NV_ENC_PIC_PARAMS_VER; - params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME; - params.inputBuffer = nvtex->mapped_res; - params.bufferFmt = NV_ENC_BUFFER_FORMAT_NV12; - params.inputTimeStamp = (uint64_t)pts; - params.inputWidth = enc->cx; - params.inputHeight = enc->cy; - params.outputBitstream = bs->ptr; - params.completionEvent = bs->event; + params.version = NV_ENC_PIC_PARAMS_VER; + params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME; + params.inputBuffer = nvtex->mapped_res; + params.bufferFmt = NV_ENC_BUFFER_FORMAT_NV12; + params.inputTimeStamp = (uint64_t)pts; + params.inputWidth = enc->cx; + params.inputHeight = enc->cy; + params.outputBitstream = bs->ptr; + params.completionEvent = bs->event; err = nv.nvEncEncodePicture(enc->session, ¶ms); if (err != NV_ENC_SUCCESS && err != NV_ENC_ERR_NEED_MORE_INPUT) { @@ -886,11 +883,11 @@ dts -= packet->timebase_num; *received_packet = true; - packet->data = enc->packet_data.array; - packet->size = enc->packet_data.num; - packet->type = OBS_ENCODER_VIDEO; - packet->pts = enc->packet_pts; - packet->dts = dts; + packet->data = enc->packet_data.array; + packet->size = enc->packet_data.num; + packet->type = OBS_ENCODER_VIDEO; + packet->pts = enc->packet_pts; + packet->dts = dts; packet->keyframe = enc->packet_keyframe; } else { *received_packet = false; @@ -911,7 +908,7 @@ } *header = enc->header; - *size = enc->header_size; + *size = enc->header_size; return true; } @@ -923,23 +920,23 @@ return false; } - *sei = enc->sei; + *sei = enc->sei; *size = enc->sei_size; return true; } struct obs_encoder_info nvenc_info = { - .id = "jim_nvenc", - .codec = "h264", - .type = OBS_ENCODER_VIDEO, - .caps = OBS_ENCODER_CAP_PASS_TEXTURE, - .get_name = nvenc_get_name, - .create = nvenc_create, - .destroy = nvenc_destroy, - .update = nvenc_update, - .encode_texture = nvenc_encode_tex, - .get_defaults = nvenc_defaults, - .get_properties = nvenc_properties, - .get_extra_data = nvenc_extra_data, - .get_sei_data = nvenc_sei_data, + .id = "jim_nvenc", + .codec = "h264", + .type = OBS_ENCODER_VIDEO, + .caps = OBS_ENCODER_CAP_PASS_TEXTURE | OBS_ENCODER_CAP_DYN_BITRATE, + .get_name = nvenc_get_name, + .create = nvenc_create, + .destroy = nvenc_destroy, + .update = nvenc_update, + .encode_texture = nvenc_encode_tex, + .get_defaults = nvenc_defaults, + .get_properties = nvenc_properties, + .get_extra_data = nvenc_extra_data, + .get_sei_data = nvenc_sei_data, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/jim-nvenc.h -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/jim-nvenc.h
Changed
@@ -4,9 +4,10 @@ #include <windows.h> #include <obs-module.h> -#include "nvEncodeAPI.h" +#include "external/nvEncodeAPI.h" -typedef NVENCSTATUS (NVENCAPI *NV_CREATE_INSTANCE_FUNC)(NV_ENCODE_API_FUNCTION_LIST*); +typedef NVENCSTATUS(NVENCAPI *NV_CREATE_INSTANCE_FUNC)( + NV_ENCODE_API_FUNCTION_LIST *); extern const char *nv_error_name(NVENCSTATUS err); extern NV_ENCODE_API_FUNCTION_LIST nv;
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c
Changed
@@ -26,68 +26,82 @@ #include "obs-ffmpeg-formats.h" #include "obs-ffmpeg-compat.h" -#define do_log(level, format, ...) \ - blog(level, "[FFmpeg %s encoder: '%s'] " format, \ - enc->type, \ - obs_encoder_get_name(enc->encoder), \ - ##__VA_ARGS__) +#define do_log(level, format, ...) \ + blog(level, "[FFmpeg %s encoder: '%s'] " format, enc->type, \ + obs_encoder_get_name(enc->encoder), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) struct enc_encoder { - obs_encoder_t *encoder; + obs_encoder_t *encoder; - const char *type; + const char *type; - AVCodec *codec; - AVCodecContext *context; + AVCodec *codec; + AVCodecContext *context; - uint8_t *samples[MAX_AV_PLANES]; - AVFrame *aframe; - int64_t total_samples; + uint8_t *samples[MAX_AV_PLANES]; + AVFrame *aframe; + int64_t total_samples; - DARRAY(uint8_t) packet_buffer; + DARRAY(uint8_t) packet_buffer; - size_t audio_planes; - size_t audio_size; + size_t audio_planes; + size_t audio_size; - int frame_size; /* pretty much always 1024 for AAC */ - int frame_size_bytes; + int frame_size; /* pretty much always 1024 for AAC */ + int frame_size_bytes; }; static inline uint64_t convert_speaker_layout(enum speaker_layout layout) { switch (layout) { - case SPEAKERS_UNKNOWN: return 0; - case SPEAKERS_MONO: return AV_CH_LAYOUT_MONO; - case SPEAKERS_STEREO: return AV_CH_LAYOUT_STEREO; - case SPEAKERS_2POINT1: return AV_CH_LAYOUT_SURROUND; - case SPEAKERS_4POINT0: return AV_CH_LAYOUT_4POINT0; - case SPEAKERS_4POINT1: return AV_CH_LAYOUT_4POINT1; - case SPEAKERS_5POINT1: return AV_CH_LAYOUT_5POINT1_BACK; - case SPEAKERS_7POINT1: return AV_CH_LAYOUT_7POINT1; + case SPEAKERS_UNKNOWN: + return 0; + case SPEAKERS_MONO: + return AV_CH_LAYOUT_MONO; + case SPEAKERS_STEREO: + return AV_CH_LAYOUT_STEREO; + case SPEAKERS_2POINT1: + return AV_CH_LAYOUT_SURROUND; + case SPEAKERS_4POINT0: + return AV_CH_LAYOUT_4POINT0; + case SPEAKERS_4POINT1: + return AV_CH_LAYOUT_4POINT1; + case SPEAKERS_5POINT1: + return AV_CH_LAYOUT_5POINT1_BACK; + case SPEAKERS_7POINT1: + return AV_CH_LAYOUT_7POINT1; } /* shouldn't get here */ return 0; } -static inline enum speaker_layout convert_ff_channel_layout(uint64_t channel_layout) +static inline enum speaker_layout +convert_ff_channel_layout(uint64_t channel_layout) { switch (channel_layout) { - case AV_CH_LAYOUT_MONO: return SPEAKERS_MONO; - case AV_CH_LAYOUT_STEREO: return SPEAKERS_STEREO; - case AV_CH_LAYOUT_SURROUND: return SPEAKERS_2POINT1; - case AV_CH_LAYOUT_4POINT0: return SPEAKERS_4POINT0; - case AV_CH_LAYOUT_4POINT1: return SPEAKERS_4POINT1; - case AV_CH_LAYOUT_5POINT1_BACK: return SPEAKERS_5POINT1; - case AV_CH_LAYOUT_7POINT1: return SPEAKERS_7POINT1; + case AV_CH_LAYOUT_MONO: + return SPEAKERS_MONO; + case AV_CH_LAYOUT_STEREO: + return SPEAKERS_STEREO; + case AV_CH_LAYOUT_SURROUND: + return SPEAKERS_2POINT1; + case AV_CH_LAYOUT_4POINT0: + return SPEAKERS_4POINT0; + case AV_CH_LAYOUT_4POINT1: + return SPEAKERS_4POINT1; + case AV_CH_LAYOUT_5POINT1_BACK: + return SPEAKERS_5POINT1; + case AV_CH_LAYOUT_7POINT1: + return SPEAKERS_7POINT1; } /* shouldn't get here */ - return SPEAKERS_UNKNOWN; + return SPEAKERS_UNKNOWN; } static const char *aac_getname(void *unused) @@ -121,7 +135,7 @@ { int ret; - enc->aframe = av_frame_alloc(); + enc->aframe = av_frame_alloc(); if (!enc->aframe) { warn("Failed to allocate audio frame"); return false; @@ -144,7 +158,7 @@ enc->frame_size_bytes = enc->frame_size * (int)enc->audio_size; ret = av_samples_alloc(enc->samples, NULL, enc->context->channels, - enc->frame_size, enc->context->sample_fmt, 0); + enc->frame_size, enc->context->sample_fmt, 0); if (ret < 0) { warn("Failed to create audio buffer: %s", av_err2str(ret)); return false; @@ -158,11 +172,11 @@ const struct audio_output_info *aoi; enum audio_format format; - aoi = audio_output_get_info(audio); + aoi = audio_output_get_info(audio); format = convert_ffmpeg_sample_format(enc->context->sample_fmt); enc->audio_planes = get_audio_planes(format, aoi->speakers); - enc->audio_size = get_audio_size(format, aoi->speakers, 1); + enc->audio_size = get_audio_size(format, aoi->speakers, 1); } #ifndef MIN @@ -170,22 +184,24 @@ #endif static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder, - const char *type, const char *alt) + const char *type, const char *alt) { struct enc_encoder *enc; - int bitrate = (int)obs_data_get_int(settings, "bitrate"); - audio_t *audio = obs_encoder_audio(encoder); + int bitrate = (int)obs_data_get_int(settings, "bitrate"); + audio_t *audio = obs_encoder_audio(encoder); +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) avcodec_register_all(); +#endif - enc = bzalloc(sizeof(struct enc_encoder)); + enc = bzalloc(sizeof(struct enc_encoder)); enc->encoder = encoder; - enc->codec = avcodec_find_encoder_by_name(type); - enc->type = type; + enc->codec = avcodec_find_encoder_by_name(type); + enc->type = type; if (!enc->codec && alt) { enc->codec = avcodec_find_encoder_by_name(alt); - enc->type = alt; + enc->type = alt; } blog(LOG_INFO, "---------------------------------"); @@ -206,14 +222,15 @@ goto fail; } - enc->context->bit_rate = bitrate * 1000; + enc->context->bit_rate = bitrate * 1000; const struct audio_output_info *aoi; aoi = audio_output_get_info(audio); - enc->context->channels = (int)audio_output_get_channels(audio); + enc->context->channels = (int)audio_output_get_channels(audio); enc->context->channel_layout = convert_speaker_layout(aoi->speakers); enc->context->sample_rate = audio_output_get_sample_rate(audio); - enc->context->sample_fmt = enc->codec->sample_fmts ? - enc->codec->sample_fmts[0] : AV_SAMPLE_FMT_FLTP; + enc->context->sample_fmt = enc->codec->sample_fmts + ? enc->codec->sample_fmts[0] + : AV_SAMPLE_FMT_FLTP; /* check to make sure sample rate is supported */ if (enc->codec->supported_samplerates) { @@ -239,9 +256,9 @@ } info("bitrate: %" PRId64 ", channels: %d, channel_layout: %x\n", - (int64_t)enc->context->bit_rate / 1000, - (int)enc->context->channels, - (unsigned int)enc->context->channel_layout); + (int64_t)enc->context->bit_rate / 1000, + (int)enc->context->channels, + (unsigned int)enc->context->channel_layout); init_sizes(enc, audio); @@ -268,22 +285,23 @@ return enc_create(settings, encoder, "libopus", "opus"); } -static bool do_encode(struct enc_encoder *enc, - struct encoder_packet *packet, bool *received_packet) +static bool do_encode(struct enc_encoder *enc, struct encoder_packet *packet, + bool *received_packet) { AVRational time_base = {1, enc->context->sample_rate}; - AVPacket avpacket = {0}; - int got_packet; - int ret; + AVPacket avpacket = {0}; + int got_packet; + int ret; enc->aframe->nb_samples = enc->frame_size; - enc->aframe->pts = av_rescale_q(enc->total_samples, - (AVRational){1, enc->context->sample_rate}, - enc->context->time_base); - - ret = avcodec_fill_audio_frame(enc->aframe, enc->context->channels, - enc->context->sample_fmt, enc->samples[0], - enc->frame_size_bytes * enc->context->channels, 1); + enc->aframe->pts = av_rescale_q( + enc->total_samples, (AVRational){1, enc->context->sample_rate}, + enc->context->time_base); + + ret = avcodec_fill_audio_frame( + enc->aframe, enc->context->channels, enc->context->sample_fmt, + enc->samples[0], enc->frame_size_bytes * enc->context->channels, + 1); if (ret < 0) { warn("avcodec_fill_audio_frame failed: %s", av_err2str(ret)); return false; @@ -302,7 +320,7 @@ ret = 0; #else ret = avcodec_encode_audio2(enc->context, &avpacket, enc->aframe, - &got_packet); + &got_packet); #endif if (ret < 0) { warn("avcodec_encode_audio2 failed: %s", av_err2str(ret)); @@ -316,8 +334,8 @@ da_resize(enc->packet_buffer, 0); da_push_back_array(enc->packet_buffer, avpacket.data, avpacket.size); - packet->pts = rescale_ts(avpacket.pts, enc->context, time_base); - packet->dts = rescale_ts(avpacket.dts, enc->context, time_base); + packet->pts = rescale_ts(avpacket.pts, enc->context, time_base); + packet->dts = rescale_ts(avpacket.dts, enc->context, time_base); packet->data = enc->packet_buffer.array; packet->size = avpacket.size; packet->type = OBS_ENCODER_AUDIO; @@ -328,7 +346,7 @@ } static bool enc_encode(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, bool *received_packet) { struct enc_encoder *enc = data; @@ -348,8 +366,8 @@ UNUSED_PARAMETER(unused); obs_properties_t *props = obs_properties_create(); - obs_properties_add_int(props, "bitrate", - obs_module_text("Bitrate"), 64, 1024, 32); + obs_properties_add_int(props, "bitrate", obs_module_text("Bitrate"), 64, + 1024, 32); return props; } @@ -358,7 +376,7 @@ struct enc_encoder *enc = data; *extra_data = enc->context->extradata; - *size = enc->context->extradata_size; + *size = enc->context->extradata_size; return true; } @@ -367,41 +385,42 @@ struct enc_encoder *enc = data; info->format = convert_ffmpeg_sample_format(enc->context->sample_fmt); info->samples_per_sec = (uint32_t)enc->context->sample_rate; - info->speakers = convert_ff_channel_layout(enc->context->channel_layout); + info->speakers = + convert_ff_channel_layout(enc->context->channel_layout); } static size_t enc_frame_size(void *data) { - struct enc_encoder *enc =data; + struct enc_encoder *enc = data; return enc->frame_size; } struct obs_encoder_info aac_encoder_info = { - .id = "ffmpeg_aac", - .type = OBS_ENCODER_AUDIO, - .codec = "AAC", - .get_name = aac_getname, - .create = aac_create, - .destroy = enc_destroy, - .encode = enc_encode, + .id = "ffmpeg_aac", + .type = OBS_ENCODER_AUDIO, + .codec = "AAC", + .get_name = aac_getname, + .create = aac_create, + .destroy = enc_destroy, + .encode = enc_encode, .get_frame_size = enc_frame_size, - .get_defaults = enc_defaults, + .get_defaults = enc_defaults, .get_properties = enc_properties, .get_extra_data = enc_extra_data, - .get_audio_info = enc_audio_info + .get_audio_info = enc_audio_info, }; struct obs_encoder_info opus_encoder_info = { - .id = "ffmpeg_opus", - .type = OBS_ENCODER_AUDIO, - .codec = "opus", - .get_name = opus_getname, - .create = opus_create, - .destroy = enc_destroy, - .encode = enc_encode, + .id = "ffmpeg_opus", + .type = OBS_ENCODER_AUDIO, + .codec = "opus", + .get_name = opus_getname, + .create = opus_create, + .destroy = enc_destroy, + .encode = enc_encode, .get_frame_size = enc_frame_size, - .get_defaults = enc_defaults, + .get_defaults = enc_defaults, .get_properties = enc_properties, .get_extra_data = enc_extra_data, - .get_audio_info = enc_audio_info + .get_audio_info = enc_audio_info, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-compat.h -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-compat.h
Changed
@@ -6,18 +6,20 @@ * a is the major version * b and c the minor and micro versions of libav * d and e the minor and micro versions of FFmpeg */ -#define LIBAVCODEC_VERSION_CHECK( a, b, c, d, e ) \ - ( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \ - (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) ) +#define LIBAVCODEC_VERSION_CHECK(a, b, c, d, e) \ + ((LIBAVCODEC_VERSION_MICRO < 100 && \ + LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, b, c)) || \ + (LIBAVCODEC_VERSION_MICRO >= 100 && \ + LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(a, d, e))) #if !LIBAVCODEC_VERSION_CHECK(54, 28, 0, 59, 100) -# define avcodec_free_frame av_freep +#define avcodec_free_frame av_freep #endif #if LIBAVCODEC_VERSION_INT < 0x371c01 -# define av_frame_alloc avcodec_alloc_frame -# define av_frame_unref avcodec_get_frame_defaults -# define av_frame_free avcodec_free_frame +#define av_frame_alloc avcodec_alloc_frame +#define av_frame_unref avcodec_get_frame_defaults +#define av_frame_free avcodec_free_frame #endif #if LIBAVCODEC_VERSION_MAJOR >= 57
View file
obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-config.h.in
Added
@@ -0,0 +1,17 @@ +#ifndef ON +#define ON 1 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef OFF +#define OFF 0 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#define ENABLE_FFMPEG_LOGGING @ENABLE_FFMPEG_LOGGING@
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-formats.h -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-formats.h
Changed
@@ -1,61 +1,110 @@ #pragma once static inline int64_t rescale_ts(int64_t val, AVCodecContext *context, - AVRational new_base) + AVRational new_base) { return av_rescale_q_rnd(val, context->time_base, new_base, - AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX); + AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX); } -static inline enum AVPixelFormat obs_to_ffmpeg_video_format( - enum video_format format) +static inline enum AVPixelFormat +obs_to_ffmpeg_video_format(enum video_format format) { switch (format) { - case VIDEO_FORMAT_NONE: return AV_PIX_FMT_NONE; - case VIDEO_FORMAT_I444: return AV_PIX_FMT_YUV444P; - case VIDEO_FORMAT_I420: return AV_PIX_FMT_YUV420P; - case VIDEO_FORMAT_NV12: return AV_PIX_FMT_NV12; - case VIDEO_FORMAT_YVYU: return AV_PIX_FMT_NONE; - case VIDEO_FORMAT_YUY2: return AV_PIX_FMT_YUYV422; - case VIDEO_FORMAT_UYVY: return AV_PIX_FMT_UYVY422; - case VIDEO_FORMAT_RGBA: return AV_PIX_FMT_RGBA; - case VIDEO_FORMAT_BGRA: return AV_PIX_FMT_BGRA; - case VIDEO_FORMAT_BGRX: return AV_PIX_FMT_BGRA; - case VIDEO_FORMAT_Y800: return AV_PIX_FMT_GRAY8; + case VIDEO_FORMAT_I444: + return AV_PIX_FMT_YUV444P; + case VIDEO_FORMAT_I420: + return AV_PIX_FMT_YUV420P; + case VIDEO_FORMAT_NV12: + return AV_PIX_FMT_NV12; + case VIDEO_FORMAT_YUY2: + return AV_PIX_FMT_YUYV422; + case VIDEO_FORMAT_UYVY: + return AV_PIX_FMT_UYVY422; + case VIDEO_FORMAT_RGBA: + return AV_PIX_FMT_RGBA; + case VIDEO_FORMAT_BGRA: + return AV_PIX_FMT_BGRA; + case VIDEO_FORMAT_BGRX: + return AV_PIX_FMT_BGRA; + case VIDEO_FORMAT_Y800: + return AV_PIX_FMT_GRAY8; + case VIDEO_FORMAT_BGR3: + return AV_PIX_FMT_BGR24; + case VIDEO_FORMAT_I422: + return AV_PIX_FMT_YUV422P; + case VIDEO_FORMAT_I40A: + return AV_PIX_FMT_YUVA420P; + case VIDEO_FORMAT_I42A: + return AV_PIX_FMT_YUVA422P; + case VIDEO_FORMAT_YUVA: + return AV_PIX_FMT_YUVA444P; + case VIDEO_FORMAT_NONE: + case VIDEO_FORMAT_YVYU: + case VIDEO_FORMAT_AYUV: + /* not supported by FFmpeg */ + return AV_PIX_FMT_NONE; } return AV_PIX_FMT_NONE; } -static inline enum video_format ffmpeg_to_obs_video_format( - enum AVPixelFormat format) +static inline enum video_format +ffmpeg_to_obs_video_format(enum AVPixelFormat format) { switch (format) { - case AV_PIX_FMT_YUV444P: return VIDEO_FORMAT_I444; - case AV_PIX_FMT_YUV420P: return VIDEO_FORMAT_I420; - case AV_PIX_FMT_NV12: return VIDEO_FORMAT_NV12; - case AV_PIX_FMT_YUYV422: return VIDEO_FORMAT_YUY2; - case AV_PIX_FMT_UYVY422: return VIDEO_FORMAT_UYVY; - case AV_PIX_FMT_RGBA: return VIDEO_FORMAT_RGBA; - case AV_PIX_FMT_BGRA: return VIDEO_FORMAT_BGRA; - case AV_PIX_FMT_GRAY8: return VIDEO_FORMAT_Y800; + case AV_PIX_FMT_YUV444P: + return VIDEO_FORMAT_I444; + case AV_PIX_FMT_YUV420P: + return VIDEO_FORMAT_I420; + case AV_PIX_FMT_NV12: + return VIDEO_FORMAT_NV12; + case AV_PIX_FMT_YUYV422: + return VIDEO_FORMAT_YUY2; + case AV_PIX_FMT_UYVY422: + return VIDEO_FORMAT_UYVY; + case AV_PIX_FMT_RGBA: + return VIDEO_FORMAT_RGBA; + case AV_PIX_FMT_BGRA: + return VIDEO_FORMAT_BGRA; + case AV_PIX_FMT_GRAY8: + return VIDEO_FORMAT_Y800; + case AV_PIX_FMT_BGR24: + return VIDEO_FORMAT_BGR3; + case AV_PIX_FMT_YUV422P: + return VIDEO_FORMAT_I422; + case AV_PIX_FMT_YUVA420P: + return VIDEO_FORMAT_I40A; + case AV_PIX_FMT_YUVA422P: + return VIDEO_FORMAT_I42A; + case AV_PIX_FMT_YUVA444P: + return VIDEO_FORMAT_YUVA; case AV_PIX_FMT_NONE: - default: return VIDEO_FORMAT_NONE; + default: + return VIDEO_FORMAT_NONE; } } -static inline enum audio_format convert_ffmpeg_sample_format( - enum AVSampleFormat format) +static inline enum audio_format +convert_ffmpeg_sample_format(enum AVSampleFormat format) { switch ((uint32_t)format) { - case AV_SAMPLE_FMT_U8: return AUDIO_FORMAT_U8BIT; - case AV_SAMPLE_FMT_S16: return AUDIO_FORMAT_16BIT; - case AV_SAMPLE_FMT_S32: return AUDIO_FORMAT_32BIT; - case AV_SAMPLE_FMT_FLT: return AUDIO_FORMAT_FLOAT; - case AV_SAMPLE_FMT_U8P: return AUDIO_FORMAT_U8BIT_PLANAR; - case AV_SAMPLE_FMT_S16P: return AUDIO_FORMAT_16BIT_PLANAR; - case AV_SAMPLE_FMT_S32P: return AUDIO_FORMAT_32BIT_PLANAR; - case AV_SAMPLE_FMT_FLTP: return AUDIO_FORMAT_FLOAT_PLANAR; + case AV_SAMPLE_FMT_U8: + return AUDIO_FORMAT_U8BIT; + case AV_SAMPLE_FMT_S16: + return AUDIO_FORMAT_16BIT; + case AV_SAMPLE_FMT_S32: + return AUDIO_FORMAT_32BIT; + case AV_SAMPLE_FMT_FLT: + return AUDIO_FORMAT_FLOAT; + case AV_SAMPLE_FMT_U8P: + return AUDIO_FORMAT_U8BIT_PLANAR; + case AV_SAMPLE_FMT_S16P: + return AUDIO_FORMAT_16BIT_PLANAR; + case AV_SAMPLE_FMT_S32P: + return AUDIO_FORMAT_32BIT_PLANAR; + case AV_SAMPLE_FMT_FLTP: + return AUDIO_FORMAT_FLOAT_PLANAR; } /* shouldn't get here */
View file
obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-logging.c
Added
@@ -0,0 +1,138 @@ +#include <obs-module.h> +#include <util/darray.h> +#include <util/threading.h> +#include <libavutil/log.h> + +static DARRAY(struct log_context { + void *context; + char str[4096]; + int print_prefix; +} *) active_log_contexts; +static DARRAY(struct log_context *) cached_log_contexts; +pthread_mutex_t log_contexts_mutex = PTHREAD_MUTEX_INITIALIZER; + +static struct log_context *create_or_fetch_log_context(void *context) +{ + pthread_mutex_lock(&log_contexts_mutex); + for (size_t i = 0; i < active_log_contexts.num; i++) { + if (context == active_log_contexts.array[i]->context) { + pthread_mutex_unlock(&log_contexts_mutex); + return active_log_contexts.array[i]; + } + } + + struct log_context *new_log_context = NULL; + + size_t cnt = cached_log_contexts.num; + if (!!cnt) { + new_log_context = cached_log_contexts.array[cnt - 1]; + da_pop_back(cached_log_contexts); + } + + if (!new_log_context) + new_log_context = bzalloc(sizeof(struct log_context)); + + new_log_context->context = context; + new_log_context->str[0] = '\0'; + new_log_context->print_prefix = 1; + + da_push_back(active_log_contexts, &new_log_context); + + pthread_mutex_unlock(&log_contexts_mutex); + + return new_log_context; +} + +static void destroy_log_context(struct log_context *log_context) +{ + pthread_mutex_lock(&log_contexts_mutex); + da_erase_item(active_log_contexts, &log_context); + da_push_back(cached_log_contexts, &log_context); + pthread_mutex_unlock(&log_contexts_mutex); +} + +static void ffmpeg_log_callback(void *context, int level, const char *format, + va_list args) +{ + if (format == NULL) + return; + + struct log_context *log_context = create_or_fetch_log_context(context); + + char *str = log_context->str; + + av_log_format_line(context, level, format, args, str + strlen(str), + (int)(sizeof(log_context->str) - strlen(str)), + &log_context->print_prefix); + + int obs_level; + switch (level) { + case AV_LOG_PANIC: + case AV_LOG_FATAL: + obs_level = LOG_ERROR; + break; + case AV_LOG_ERROR: + case AV_LOG_WARNING: + obs_level = LOG_WARNING; + break; + case AV_LOG_INFO: + case AV_LOG_VERBOSE: + obs_level = LOG_INFO; + break; + case AV_LOG_DEBUG: + default: + obs_level = LOG_DEBUG; + } + + if (!log_context->print_prefix) + return; + + char *str_end = str + strlen(str) - 1; + while (str < str_end) { + if (*str_end != '\n') + break; + *str_end-- = '\0'; + } + + if (str_end <= str) + goto cleanup; + + blog(obs_level, "[ffmpeg] %s", str); + +cleanup: + destroy_log_context(log_context); +} + +static bool logging_initialized = false; + +void obs_ffmpeg_load_logging(void) +{ + da_init(active_log_contexts); + da_init(cached_log_contexts); + + if (pthread_mutex_init(&log_contexts_mutex, NULL) == 0) { + av_log_set_callback(ffmpeg_log_callback); + logging_initialized = true; + } +} + +void obs_ffmpeg_unload_logging(void) +{ + if (!logging_initialized) + return; + + logging_initialized = false; + + av_log_set_callback(av_log_default_callback); + pthread_mutex_destroy(&log_contexts_mutex); + + for (size_t i = 0; i < active_log_contexts.num; i++) { + bfree(active_log_contexts.array[i]); + } + for (size_t i = 0; i < cached_log_contexts.num; i++) { + bfree(cached_log_contexts.array[i]); + } + + da_free(active_log_contexts); + da_free(cached_log_contexts); +}
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-mux.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-mux.c
Changed
@@ -32,38 +32,38 @@ #include <libavformat/avformat.h> -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[ffmpeg muxer: '%s'] " format, \ - obs_output_get_name(stream->output), ##__VA_ARGS__) + obs_output_get_name(stream->output), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) struct ffmpeg_muxer { - obs_output_t *output; + obs_output_t *output; os_process_pipe_t *pipe; - int64_t stop_ts; - uint64_t total_bytes; - struct dstr path; - bool sent_headers; - volatile bool active; - volatile bool stopping; - volatile bool capturing; + int64_t stop_ts; + uint64_t total_bytes; + struct dstr path; + bool sent_headers; + volatile bool active; + volatile bool stopping; + volatile bool capturing; /* replay buffer */ - struct circlebuf packets; - int64_t cur_size; - int64_t cur_time; - int64_t max_size; - int64_t max_time; - int64_t save_ts; - int keyframes; - obs_hotkey_id hotkey; + struct circlebuf packets; + int64_t cur_size; + int64_t cur_time; + int64_t max_size; + int64_t max_time; + int64_t save_ts; + int keyframes; + obs_hotkey_id hotkey; DARRAY(struct encoder_packet) mux_packets; - pthread_t mux_thread; - bool mux_thread_joinable; - volatile bool muxing; + pthread_t mux_thread; + bool mux_thread_joinable; + volatile bool muxing; }; static const char *ffmpeg_mux_getname(void *type) @@ -136,7 +136,7 @@ /* TODO: allow codecs other than h264 whenever we start using them */ static void add_video_encoder_params(struct ffmpeg_muxer *stream, - struct dstr *cmd, obs_encoder_t *vencoder) + struct dstr *cmd, obs_encoder_t *vencoder) { obs_data_t *settings = obs_encoder_get_settings(vencoder); int bitrate = (int)obs_data_get_int(settings, "bitrate"); @@ -145,13 +145,10 @@ obs_data_release(settings); - dstr_catf(cmd, "%s %d %d %d %d %d ", - obs_encoder_get_codec(vencoder), - bitrate, - obs_output_get_width(stream->output), - obs_output_get_height(stream->output), - (int)info->fps_num, - (int)info->fps_den); + dstr_catf(cmd, "%s %d %d %d %d %d ", obs_encoder_get_codec(vencoder), + bitrate, obs_output_get_width(stream->output), + obs_output_get_height(stream->output), (int)info->fps_num, + (int)info->fps_den); } static void add_audio_encoder_params(struct dstr *cmd, obs_encoder_t *aencoder) @@ -166,11 +163,9 @@ dstr_copy(&name, obs_encoder_get_name(aencoder)); dstr_replace(&name, "\"", "\"\""); - dstr_catf(cmd, "\"%s\" %d %d %d ", - name.array, - bitrate, - (int)obs_encoder_get_sample_rate(aencoder), - (int)audio_output_get_channels(audio)); + dstr_catf(cmd, "\"%s\" %d %d %d ", name.array, bitrate, + (int)obs_encoder_get_sample_rate(aencoder), + (int)audio_output_get_channels(audio)); dstr_free(&name); } @@ -181,8 +176,8 @@ AVDictionary *dict = NULL; if ((ret = av_dict_parse_string(&dict, settings, "=", " ", 0))) { - warn("Failed to parse muxer settings: %s\n%s", - av_err2str(ret), settings); + warn("Failed to parse muxer settings: %s\n%s", av_err2str(ret), + settings); av_dict_free(&dict); return; @@ -193,7 +188,7 @@ AVDictionaryEntry *entry = NULL; while ((entry = av_dict_get(dict, "", entry, - AV_DICT_IGNORE_SUFFIX))) + AV_DICT_IGNORE_SUFFIX))) dstr_catf(&str, "\n\t%s=%s", entry->key, entry->value); info("Using muxer settings:%s", str.array); @@ -221,7 +216,7 @@ } static void build_command_line(struct ffmpeg_muxer *stream, struct dstr *cmd, - const char *path) + const char *path) { obs_encoder_t *vencoder = obs_output_get_video_encoder(stream->output); obs_encoder_t *aencoders[MAX_AUDIO_MIXES]; @@ -229,7 +224,7 @@ for (;;) { obs_encoder_t *aencoder = obs_output_get_audio_encoder( - stream->output, num_tracks); + stream->output, num_tracks); if (!aencoder) break; @@ -289,7 +284,7 @@ if (!test_file) { struct dstr error_message; dstr_init_copy(&error_message, - obs_module_text("UnableToWritePath")); + obs_module_text("UnableToWritePath")); #ifdef _WIN32 // special warning for Windows 10 users about Defender struct win_version_info ver; @@ -297,12 +292,11 @@ if (ver.major >= 10) { dstr_cat(&error_message, "\n\n"); dstr_cat(&error_message, - obs_module_text("WarnWindowsDefender")); + obs_module_text("WarnWindowsDefender")); } #endif dstr_replace(&error_message, "%1", path); - obs_output_set_last_error(stream->output, - error_message.array); + obs_output_set_last_error(stream->output, error_message.array); dstr_free(&error_message); obs_data_release(settings); return false; @@ -315,8 +309,8 @@ obs_data_release(settings); if (!stream->pipe) { - obs_output_set_last_error(stream->output, - obs_module_text("HelperProcessFailed")); + obs_output_set_last_error( + stream->output, obs_module_text("HelperProcessFailed")); warn("Failed to create process pipe"); return false; } @@ -375,19 +369,22 @@ size_t len; len = os_process_pipe_read_err(stream->pipe, (uint8_t *)error, - sizeof(error) - 1); + sizeof(error) - 1); if (len > 0) { error[len] = 0; - warn ("ffmpeg-mux: %s", error); - obs_output_set_last_error (stream->output, error); + warn("ffmpeg-mux: %s", error); + obs_output_set_last_error(stream->output, error); } ret = deactivate(stream, 0); switch (ret) { - case FFM_UNSUPPORTED: code = OBS_OUTPUT_UNSUPPORTED; break; - default: code = OBS_OUTPUT_ERROR; + case FFM_UNSUPPORTED: + code = OBS_OUTPUT_UNSUPPORTED; + break; + default: + code = OBS_OUTPUT_ERROR; } obs_output_signal_stop(stream->output, code); @@ -395,22 +392,21 @@ } static bool write_packet(struct ffmpeg_muxer *stream, - struct encoder_packet *packet) + struct encoder_packet *packet) { bool is_video = packet->type == OBS_ENCODER_VIDEO; size_t ret; - struct ffm_packet_info info = { - .pts = packet->pts, - .dts = packet->dts, - .size = (uint32_t)packet->size, - .index = (int)packet->track_idx, - .type = is_video ? FFM_PACKET_VIDEO : FFM_PACKET_AUDIO, - .keyframe = packet->keyframe - }; - - ret = os_process_pipe_write(stream->pipe, (const uint8_t*)&info, - sizeof(info)); + struct ffm_packet_info info = {.pts = packet->pts, + .dts = packet->dts, + .size = (uint32_t)packet->size, + .index = (int)packet->track_idx, + .type = is_video ? FFM_PACKET_VIDEO + : FFM_PACKET_AUDIO, + .keyframe = packet->keyframe}; + + ret = os_process_pipe_write(stream->pipe, (const uint8_t *)&info, + sizeof(info)); if (ret != sizeof(info)) { warn("os_process_pipe_write for info structure failed"); signal_failure(stream); @@ -429,13 +425,10 @@ } static bool send_audio_headers(struct ffmpeg_muxer *stream, - obs_encoder_t *aencoder, size_t idx) + obs_encoder_t *aencoder, size_t idx) { struct encoder_packet packet = { - .type = OBS_ENCODER_AUDIO, - .timebase_den = 1, - .track_idx = idx - }; + .type = OBS_ENCODER_AUDIO, .timebase_den = 1, .track_idx = idx}; obs_encoder_get_extra_data(aencoder, &packet.data, &packet.size); return write_packet(stream, &packet); @@ -445,10 +438,8 @@ { obs_encoder_t *vencoder = obs_output_get_video_encoder(stream->output); - struct encoder_packet packet = { - .type = OBS_ENCODER_VIDEO, - .timebase_den = 1 - }; + struct encoder_packet packet = {.type = OBS_ENCODER_VIDEO, + .timebase_den = 1}; obs_encoder_get_extra_data(vencoder, &packet.data, &packet.size); return write_packet(stream, &packet); @@ -511,9 +502,8 @@ obs_properties_t *props = obs_properties_create(); - obs_properties_add_text(props, "path", - obs_module_text("FilePath"), - OBS_TEXT_DEFAULT); + obs_properties_add_text(props, "path", obs_module_text("FilePath"), + OBS_TEXT_DEFAULT); return props; } @@ -524,18 +514,17 @@ } struct obs_output_info ffmpeg_muxer = { - .id = "ffmpeg_muxer", - .flags = OBS_OUTPUT_AV | - OBS_OUTPUT_ENCODED | - OBS_OUTPUT_MULTI_TRACK, - .get_name = ffmpeg_mux_getname, - .create = ffmpeg_mux_create, - .destroy = ffmpeg_mux_destroy, - .start = ffmpeg_mux_start, - .stop = ffmpeg_mux_stop, + .id = "ffmpeg_muxer", + .flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED | OBS_OUTPUT_MULTI_TRACK | + OBS_OUTPUT_CAN_PAUSE, + .get_name = ffmpeg_mux_getname, + .create = ffmpeg_mux_create, + .destroy = ffmpeg_mux_destroy, + .start = ffmpeg_mux_start, + .stop = ffmpeg_mux_stop, .encoded_packet = ffmpeg_mux_data, - .get_total_bytes= ffmpeg_mux_total_bytes, - .get_properties = ffmpeg_mux_properties + .get_total_bytes = ffmpeg_mux_total_bytes, + .get_properties = ffmpeg_mux_properties, }; /* ------------------------------------------------------------------------ */ @@ -547,15 +536,27 @@ } static void replay_buffer_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); UNUSED_PARAMETER(pressed); + if (!pressed) + return; + struct ffmpeg_muxer *stream = data; - if (os_atomic_load_bool(&stream->active)) + + if (os_atomic_load_bool(&stream->active)) { + obs_encoder_t *vencoder = + obs_output_get_video_encoder(stream->output); + if (obs_encoder_paused(vencoder)) { + info("Could not save buffer because encoders paused"); + return; + } + stream->save_ts = os_gettime_ns() / 1000LL; + } } static void save_replay_proc(void *data, calldata_t *cd) @@ -577,15 +578,15 @@ struct ffmpeg_muxer *stream = bzalloc(sizeof(*stream)); stream->output = output; - stream->hotkey = obs_hotkey_register_output(output, - "ReplayBuffer.Save", - obs_module_text("ReplayBuffer.Save"), - replay_buffer_hotkey, stream); + stream->hotkey = + obs_hotkey_register_output(output, "ReplayBuffer.Save", + obs_module_text("ReplayBuffer.Save"), + replay_buffer_hotkey, stream); proc_handler_t *ph = obs_output_get_proc_handler(output); proc_handler_add(ph, "void save()", save_replay_proc, stream); proc_handler_add(ph, "void get_last_replay(out string path)", - get_last_replay, stream); + get_last_replay, stream); return stream; } @@ -653,7 +654,7 @@ for (;;) { circlebuf_peek_front(&stream->packets, &pkt, - sizeof(pkt)); + sizeof(pkt)); if (pkt.type == OBS_ENCODER_VIDEO && pkt.keyframe) return; @@ -663,14 +664,14 @@ } static inline void replay_buffer_purge(struct ffmpeg_muxer *stream, - struct encoder_packet *pkt) + struct encoder_packet *pkt) { if (stream->max_size) { if (!stream->packets.size || stream->keyframes <= 2) return; while ((stream->cur_size + (int64_t)pkt->size) > - stream->max_size) + stream->max_size) purge(stream); } @@ -682,8 +683,8 @@ } static void insert_packet(struct darray *array, struct encoder_packet *packet, - int64_t video_offset, int64_t *audio_offsets, - int64_t video_dts_offset, int64_t *audio_dts_offsets) + int64_t video_offset, int64_t *audio_offsets, + int64_t video_dts_offset, int64_t *audio_dts_offsets) { struct encoder_packet pkt; DARRAY(struct encoder_packet) packets; @@ -725,7 +726,7 @@ if (!send_headers(stream)) { warn("Could not write headers for file '%s'", - stream->path.array); + stream->path.array); goto error; } @@ -780,9 +781,9 @@ } } - insert_packet(&stream->mux_packets.da, pkt, - video_offset, audio_offsets, - video_dts_offset, audio_dts_offsets); + insert_packet(&stream->mux_packets.da, pkt, video_offset, + audio_offsets, video_dts_offset, + audio_dts_offsets); } /* ---------------------------- */ @@ -809,7 +810,8 @@ os_atomic_set_bool(&stream->muxing, true); stream->mux_thread_joinable = pthread_create(&stream->mux_thread, NULL, - replay_buffer_mux_thread, stream) == 0; + replay_buffer_mux_thread, + stream) == 0; } static void deactivate_replay_buffer(struct ffmpeg_muxer *stream, int code) @@ -883,16 +885,15 @@ } struct obs_output_info replay_buffer = { - .id = "replay_buffer", - .flags = OBS_OUTPUT_AV | - OBS_OUTPUT_ENCODED | - OBS_OUTPUT_MULTI_TRACK, - .get_name = replay_buffer_getname, - .create = replay_buffer_create, - .destroy = replay_buffer_destroy, - .start = replay_buffer_start, - .stop = ffmpeg_mux_stop, + .id = "replay_buffer", + .flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED | OBS_OUTPUT_MULTI_TRACK | + OBS_OUTPUT_CAN_PAUSE, + .get_name = replay_buffer_getname, + .create = replay_buffer_create, + .destroy = replay_buffer_destroy, + .start = replay_buffer_start, + .stop = ffmpeg_mux_stop, .encoded_packet = replay_buffer_data, - .get_total_bytes= ffmpeg_mux_total_bytes, - .get_defaults = replay_buffer_defaults + .get_total_bytes = ffmpeg_mux_total_bytes, + .get_defaults = replay_buffer_defaults, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c
Changed
@@ -28,33 +28,33 @@ #include "obs-ffmpeg-formats.h" -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[NVENC encoder: '%s'] " format, \ - obs_encoder_get_name(enc->encoder), ##__VA_ARGS__) + obs_encoder_get_name(enc->encoder), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) struct nvenc_encoder { - obs_encoder_t *encoder; + obs_encoder_t *encoder; - AVCodec *nvenc; - AVCodecContext *context; + AVCodec *nvenc; + AVCodecContext *context; - AVFrame *vframe; + AVFrame *vframe; - DARRAY(uint8_t) buffer; + DARRAY(uint8_t) buffer; - uint8_t *header; - size_t header_size; + uint8_t *header; + size_t header_size; - uint8_t *sei; - size_t sei_size; + uint8_t *sei; + size_t sei_size; - int height; - bool first_packet; - bool initialized; + int height; + bool first_packet; + bool initialized; }; static const char *nvenc_getname(void *unused) @@ -65,8 +65,7 @@ static inline bool valid_format(enum video_format format) { - return format == VIDEO_FORMAT_I420 || - format == VIDEO_FORMAT_NV12 || + return format == VIDEO_FORMAT_I420 || format == VIDEO_FORMAT_NV12 || format == VIDEO_FORMAT_I444; } @@ -78,8 +77,8 @@ pref_format = obs_encoder_get_preferred_video_format(enc->encoder); if (!valid_format(pref_format)) { - pref_format = valid_format(info->format) ? - info->format : VIDEO_FORMAT_NV12; + pref_format = valid_format(info->format) ? info->format + : VIDEO_FORMAT_NV12; } info->format = pref_format; @@ -117,12 +116,7 @@ return true; } -enum RC_MODE { - RC_MODE_CBR, - RC_MODE_VBR, - RC_MODE_CQP, - RC_MODE_LOSSLESS -}; +enum RC_MODE { RC_MODE_CBR, RC_MODE_VBR, RC_MODE_CQP, RC_MODE_LOSSLESS }; static bool nvenc_update(void *data, obs_data_t *settings) { @@ -177,10 +171,10 @@ cqp = 0; bool hp = (astrcmpi(preset, "hp") == 0 || - astrcmpi(preset, "llhp") == 0); + astrcmpi(preset, "llhp") == 0); av_opt_set(enc->context->priv_data, "preset", - hp ? "losslesshp" : "lossless", 0); + hp ? "losslesshp" : "lossless", 0); } else if (astrcmpi(rc, "vbr") != 0) { /* CBR by default */ av_opt_set_int(enc->context->priv_data, "cbr", true, 0); @@ -189,7 +183,6 @@ cqp = 0; } - av_opt_set(enc->context->priv_data, "level", "auto", 0); av_opt_set_int(enc->context->priv_data, "2pass", twopass, 0); av_opt_set_int(enc->context->priv_data, "gpu", gpu, 0); @@ -200,15 +193,17 @@ enc->context->height = obs_encoder_get_height(enc->encoder); enc->context->time_base = (AVRational){voi->fps_den, voi->fps_num}; enc->context->pix_fmt = obs_to_ffmpeg_video_format(info.format); - enc->context->colorspace = info.colorspace == VIDEO_CS_709 ? - AVCOL_SPC_BT709 : AVCOL_SPC_BT470BG; - enc->context->color_range = info.range == VIDEO_RANGE_FULL ? - AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; + enc->context->colorspace = info.colorspace == VIDEO_CS_709 + ? AVCOL_SPC_BT709 + : AVCOL_SPC_BT470BG; + enc->context->color_range = info.range == VIDEO_RANGE_FULL + ? AVCOL_RANGE_JPEG + : AVCOL_RANGE_MPEG; enc->context->max_b_frames = bf; if (keyint_sec) - enc->context->gop_size = keyint_sec * voi->fps_num / - voi->fps_den; + enc->context->gop_size = + keyint_sec * voi->fps_num / voi->fps_den; else enc->context->gop_size = 250; @@ -226,16 +221,30 @@ "\t2-pass: %s\n" "\tb-frames: %d\n" "\tGPU: %d\n", - rc, bitrate, cqp, enc->context->gop_size, - preset, profile, + rc, bitrate, cqp, enc->context->gop_size, preset, profile, enc->context->width, enc->context->height, - twopass ? "true" : "false", - enc->context->max_b_frames, - gpu); + twopass ? "true" : "false", enc->context->max_b_frames, gpu); return nvenc_init_codec(enc); } +static bool nvenc_reconfigure(void *data, obs_data_t *settings) +{ +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 19, 101) + struct nvenc_encoder *enc = data; + + int bitrate = (int)obs_data_get_int(settings, "bitrate"); + const char *rc = obs_data_get_string(settings, "rate_control"); + bool cbr = astrcmpi(rc, "CBR") == 0; + bool vbr = astrcmpi(rc, "VBR") == 0; + if (cbr || vbr) { + enc->context->bit_rate = bitrate * 1000; + enc->context->rc_max_rate = bitrate * 1000; + } +#endif + return true; +} + static void nvenc_destroy(void *data) { struct nvenc_encoder *enc = data; @@ -250,7 +259,7 @@ break; #else if (avcodec_encode_video2(enc->context, &pkt, NULL, - &r_pkt) < 0) + &r_pkt) < 0) break; #endif @@ -273,7 +282,9 @@ { struct nvenc_encoder *enc; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) avcodec_register_all(); +#endif enc = bzalloc(sizeof(*enc)); enc->encoder = encoder; @@ -306,33 +317,33 @@ } static inline void copy_data(AVFrame *pic, const struct encoder_frame *frame, - int height, enum AVPixelFormat format) + int height, enum AVPixelFormat format) { int h_chroma_shift, v_chroma_shift; - av_pix_fmt_get_chroma_sub_sample(format, &h_chroma_shift, &v_chroma_shift); + av_pix_fmt_get_chroma_sub_sample(format, &h_chroma_shift, + &v_chroma_shift); for (int plane = 0; plane < MAX_AV_PLANES; plane++) { if (!frame->data[plane]) continue; int frame_rowsize = (int)frame->linesize[plane]; - int pic_rowsize = pic->linesize[plane]; - int bytes = frame_rowsize < pic_rowsize ? - frame_rowsize : pic_rowsize; + int pic_rowsize = pic->linesize[plane]; + int bytes = frame_rowsize < pic_rowsize ? frame_rowsize + : pic_rowsize; int plane_height = height >> (plane ? v_chroma_shift : 0); for (int y = 0; y < plane_height; y++) { int pos_frame = y * frame_rowsize; - int pos_pic = y * pic_rowsize; + int pos_pic = y * pic_rowsize; memcpy(pic->data[plane] + pos_pic, - frame->data[plane] + pos_frame, - bytes); + frame->data[plane] + pos_frame, bytes); } } } static bool nvenc_encode(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, bool *received_packet) { struct nvenc_encoder *enc = data; AVPacket av_pkt = {0}; @@ -355,7 +366,7 @@ ret = 0; #else ret = avcodec_encode_video2(enc->context, &av_pkt, enc->vframe, - &got_packet); + &got_packet); #endif if (ret < 0) { warn("nvenc_encode: Error encoding: %s", av_err2str(ret)); @@ -369,9 +380,9 @@ enc->first_packet = false; obs_extract_avc_headers(av_pkt.data, av_pkt.size, - &new_packet, &size, - &enc->header, &enc->header_size, - &enc->sei, &enc->sei_size); + &new_packet, &size, + &enc->header, &enc->header_size, + &enc->sei, &enc->sei_size); da_copy_array(enc->buffer, new_packet, size); bfree(new_packet); @@ -409,7 +420,7 @@ } static bool rate_control_modified(obs_properties_t *ppts, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { const char *rc = obs_data_get_string(settings, "rate_control"); bool cqp = astrcmpi(rc, "CQP") == 0; @@ -441,35 +452,39 @@ obs_property_t *p; p = obs_properties_add_list(props, "rate_control", - obs_module_text("RateControl"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_module_text("RateControl"), + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, "CBR", "CBR"); obs_property_list_add_string(p, "CQP", "CQP"); obs_property_list_add_string(p, "VBR", "VBR"); obs_property_list_add_string(p, obs_module_text("Lossless"), - "lossless"); + "lossless"); obs_property_set_modified_callback(p, rate_control_modified); - p = obs_properties_add_int(props, "bitrate", - obs_module_text("Bitrate"), 50, 300000, 50); + p = obs_properties_add_int(props, "bitrate", obs_module_text("Bitrate"), + 50, 300000, 50); obs_property_int_set_suffix(p, " Kbps"); p = obs_properties_add_int(props, "max_bitrate", - obs_module_text("MaxBitrate"), 50, 300000, 50); + obs_module_text("MaxBitrate"), 50, 300000, + 50); obs_property_int_set_suffix(p, " Kbps"); obs_properties_add_int(props, "cqp", obs_module_text("NVENC.CQLevel"), - 1, 30, 1); + 1, 30, 1); obs_properties_add_int(props, "keyint_sec", - obs_module_text("KeyframeIntervalSec"), 0, 10, 1); + obs_module_text("KeyframeIntervalSec"), 0, 10, + 1); p = obs_properties_add_list(props, "preset", obs_module_text("Preset"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); -#define add_preset(val) \ +#define add_preset(val) \ obs_property_list_add_string(p, obs_module_text("NVENC.Preset." val), \ - val) + val) add_preset("mq"); add_preset("hq"); add_preset("default"); @@ -479,11 +494,12 @@ add_preset("llhp"); #undef add_preset - p = obs_properties_add_list(props, "profile", obs_module_text("Profile"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + p = obs_properties_add_list(props, "profile", + obs_module_text("Profile"), + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); -#define add_profile(val) \ - obs_property_list_add_string(p, val, val) +#define add_profile(val) obs_property_list_add_string(p, val, val) add_profile("high"); add_profile("main"); add_profile("baseline"); @@ -491,20 +507,21 @@ if (!ffmpeg) { p = obs_properties_add_bool(props, "lookahead", - obs_module_text("NVENC.LookAhead")); - obs_property_set_long_description(p, - obs_module_text("NVENC.LookAhead.ToolTip")); - - p = obs_properties_add_bool(props, "psycho_aq", - obs_module_text("NVENC.PsychoVisualTuning")); - obs_property_set_long_description(p, - obs_module_text("NVENC.PsychoVisualTuning.ToolTip")); + obs_module_text("NVENC.LookAhead")); + obs_property_set_long_description( + p, obs_module_text("NVENC.LookAhead.ToolTip")); + + p = obs_properties_add_bool( + props, "psycho_aq", + obs_module_text("NVENC.PsychoVisualTuning")); + obs_property_set_long_description( + p, obs_module_text("NVENC.PsychoVisualTuning.ToolTip")); } obs_properties_add_int(props, "gpu", obs_module_text("GPU"), 0, 8, 1); - obs_properties_add_int(props, "bf", obs_module_text("BFrames"), - 0, 4, 1); + obs_properties_add_int(props, "bf", obs_module_text("BFrames"), 0, 4, + 1); return props; } @@ -526,7 +543,7 @@ struct nvenc_encoder *enc = data; *extra_data = enc->header; - *size = enc->header_size; + *size = enc->header_size; return true; } @@ -535,21 +552,23 @@ struct nvenc_encoder *enc = data; *extra_data = enc->sei; - *size = enc->sei_size; + *size = enc->sei_size; return true; } struct obs_encoder_info nvenc_encoder_info = { - .id = "ffmpeg_nvenc", - .type = OBS_ENCODER_VIDEO, - .codec = "h264", - .get_name = nvenc_getname, - .create = nvenc_create, - .destroy = nvenc_destroy, - .encode = nvenc_encode, - .get_defaults = nvenc_defaults, + .id = "ffmpeg_nvenc", + .type = OBS_ENCODER_VIDEO, + .codec = "h264", + .get_name = nvenc_getname, + .create = nvenc_create, + .destroy = nvenc_destroy, + .encode = nvenc_encode, + .update = nvenc_reconfigure, + .get_defaults = nvenc_defaults, .get_properties = nvenc_properties_ffmpeg, .get_extra_data = nvenc_extra_data, - .get_sei_data = nvenc_sei_data, - .get_video_info = nvenc_video_info + .get_sei_data = nvenc_sei_data, + .get_video_info = nvenc_video_info, + .caps = OBS_ENCODER_CAP_DYN_BITRATE, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-output.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-output.c
Changed
@@ -32,92 +32,92 @@ #include "obs-ffmpeg-compat.h" struct ffmpeg_cfg { - const char *url; - const char *format_name; - const char *format_mime_type; - const char *muxer_settings; - int gop_size; - int video_bitrate; - int audio_bitrate; - const char *video_encoder; - int video_encoder_id; - const char *audio_encoder; - int audio_encoder_id; - const char *video_settings; - const char *audio_settings; - int audio_mix_count; - int audio_tracks; + const char *url; + const char *format_name; + const char *format_mime_type; + const char *muxer_settings; + int gop_size; + int video_bitrate; + int audio_bitrate; + const char *video_encoder; + int video_encoder_id; + const char *audio_encoder; + int audio_encoder_id; + const char *video_settings; + const char *audio_settings; + int audio_mix_count; + int audio_tracks; enum AVPixelFormat format; - enum AVColorRange color_range; - enum AVColorSpace color_space; - int scale_width; - int scale_height; - int width; - int height; + enum AVColorRange color_range; + enum AVColorSpace color_space; + int scale_width; + int scale_height; + int width; + int height; }; struct ffmpeg_data { - AVStream *video; - AVStream **audio_streams; - AVCodec *acodec; - AVCodec *vcodec; - AVFormatContext *output; - struct SwsContext *swscale; - - int64_t total_frames; - AVFrame *vframe; - int frame_size; - - uint64_t start_timestamp; - - int64_t total_samples[MAX_AUDIO_MIXES]; - uint32_t audio_samplerate; - enum audio_format audio_format; - size_t audio_planes; - size_t audio_size; - int num_audio_streams; + AVStream *video; + AVStream **audio_streams; + AVCodec *acodec; + AVCodec *vcodec; + AVFormatContext *output; + struct SwsContext *swscale; + + int64_t total_frames; + AVFrame *vframe; + int frame_size; + + uint64_t start_timestamp; + + int64_t total_samples[MAX_AUDIO_MIXES]; + uint32_t audio_samplerate; + enum audio_format audio_format; + size_t audio_planes; + size_t audio_size; + int num_audio_streams; /* audio_tracks is a bitmask storing the indices of the mixes */ - int audio_tracks; - struct circlebuf excess_frames[MAX_AUDIO_MIXES][MAX_AV_PLANES]; - uint8_t *samples[MAX_AUDIO_MIXES][MAX_AV_PLANES]; - AVFrame *aframe[MAX_AUDIO_MIXES]; + int audio_tracks; + struct circlebuf excess_frames[MAX_AUDIO_MIXES][MAX_AV_PLANES]; + uint8_t *samples[MAX_AUDIO_MIXES][MAX_AV_PLANES]; + AVFrame *aframe[MAX_AUDIO_MIXES]; - struct ffmpeg_cfg config; + struct ffmpeg_cfg config; - bool initialized; + bool initialized; - char *last_error; + char *last_error; }; struct ffmpeg_output { - obs_output_t *output; - volatile bool active; + obs_output_t *output; + volatile bool active; struct ffmpeg_data ff_data; - bool connecting; - pthread_t start_thread; + bool connecting; + pthread_t start_thread; - uint64_t total_bytes; + uint64_t total_bytes; - uint64_t audio_start_ts; - uint64_t video_start_ts; - uint64_t stop_ts; - volatile bool stopping; + uint64_t audio_start_ts; + uint64_t video_start_ts; + uint64_t stop_ts; + volatile bool stopping; - bool write_thread_active; - pthread_mutex_t write_mutex; - pthread_t write_thread; - os_sem_t *write_sem; - os_event_t *stop_event; + bool write_thread_active; + pthread_mutex_t write_mutex; + pthread_t write_thread; + os_sem_t *write_sem; + os_event_t *stop_event; - DARRAY(AVPacket) packets; + DARRAY(AVPacket) packets; }; /* ------------------------------------------------------------------------- */ static void ffmpeg_output_set_last_error(struct ffmpeg_data *data, - const char *error) + const char *error) { if (data->last_error) bfree(data->last_error); @@ -126,7 +126,7 @@ } void ffmpeg_log_error(int log_level, struct ffmpeg_data *data, - const char *format, ...) + const char *format, ...) { va_list args; char out[4096]; @@ -141,26 +141,27 @@ } static bool new_stream(struct ffmpeg_data *data, AVStream **stream, - AVCodec **codec, enum AVCodecID id, const char *name) + AVCodec **codec, enum AVCodecID id, const char *name) { - *codec = (!!name && *name) ? - avcodec_find_encoder_by_name(name) : - avcodec_find_encoder(id); + *codec = (!!name && *name) ? avcodec_find_encoder_by_name(name) + : avcodec_find_encoder(id); if (!*codec) { - ffmpeg_log_error(LOG_WARNING, data, "Couldn't find encoder '%s'", - avcodec_get_name(id)); + ffmpeg_log_error(LOG_WARNING, data, + "Couldn't find encoder '%s'", + avcodec_get_name(id)); return false; } *stream = avformat_new_stream(data->output, *codec); if (!*stream) { - ffmpeg_log_error(LOG_WARNING, data, "Couldn't create stream for encoder '%s'", - avcodec_get_name(id)); + ffmpeg_log_error(LOG_WARNING, data, + "Couldn't create stream for encoder '%s'", + avcodec_get_name(id)); return false; } - (*stream)->id = data->output->nb_streams-1; + (*stream)->id = data->output->nb_streams - 1; return true; } @@ -180,10 +181,11 @@ char *value; *assign = 0; - value = assign+1; + value = assign + 1; if (av_opt_set(context->priv_data, name, value, 0)) { - blog(LOG_WARNING, "Failed to set %s=%s", name, value); + blog(LOG_WARNING, "Failed to set %s=%s", name, + value); ret = false; } } @@ -205,34 +207,39 @@ if (opts) { // libav requires x264 parameters in a special format which may be non-obvious - if (!parse_params(context, opts) && strcmp(data->vcodec->name, "libx264") == 0) - blog(LOG_WARNING, "If you're trying to set x264 parameters, use x264-params=name=value:name=value"); + if (!parse_params(context, opts) && + strcmp(data->vcodec->name, "libx264") == 0) + blog(LOG_WARNING, + "If you're trying to set x264 parameters, use x264-params=name=value:name=value"); strlist_free(opts); } ret = avcodec_open2(context, data->vcodec, NULL); if (ret < 0) { - ffmpeg_log_error(LOG_WARNING, data, "Failed to open video codec: %s", - av_err2str(ret)); + ffmpeg_log_error(LOG_WARNING, data, + "Failed to open video codec: %s", + av_err2str(ret)); return false; } data->vframe = av_frame_alloc(); if (!data->vframe) { - ffmpeg_log_error(LOG_WARNING, data, "Failed to allocate video frame"); + ffmpeg_log_error(LOG_WARNING, data, + "Failed to allocate video frame"); return false; } data->vframe->format = context->pix_fmt; - data->vframe->width = context->width; + data->vframe->width = context->width; data->vframe->height = context->height; data->vframe->colorspace = data->config.color_space; data->vframe->color_range = data->config.color_range; ret = av_frame_get_buffer(data->vframe, base_get_alignment()); if (ret < 0) { - ffmpeg_log_error(LOG_WARNING, data, "Failed to allocate vframe: %s", - av_err2str(ret)); + ffmpeg_log_error(LOG_WARNING, data, + "Failed to allocate vframe: %s", + av_err2str(ret)); return false; } @@ -242,14 +249,13 @@ static bool init_swscale(struct ffmpeg_data *data, AVCodecContext *context) { data->swscale = sws_getContext( - data->config.width, data->config.height, - data->config.format, - data->config.scale_width, data->config.scale_height, - context->pix_fmt, - SWS_BICUBIC, NULL, NULL, NULL); + data->config.width, data->config.height, data->config.format, + data->config.scale_width, data->config.scale_height, + context->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL); if (!data->swscale) { - ffmpeg_log_error(LOG_WARNING, data, "Could not initialize swscale"); + ffmpeg_log_error(LOG_WARNING, data, + "Could not initialize swscale"); return false; } @@ -268,23 +274,23 @@ } if (!new_stream(data, &data->video, &data->vcodec, - data->output->oformat->video_codec, - data->config.video_encoder)) + data->output->oformat->video_codec, + data->config.video_encoder)) return false; - closest_format = get_closest_format(data->config.format, - data->vcodec->pix_fmts); + closest_format = + get_closest_format(data->config.format, data->vcodec->pix_fmts); - context = data->video->codec; - context->bit_rate = data->config.video_bitrate * 1000; - context->width = data->config.scale_width; - context->height = data->config.scale_height; - context->time_base = (AVRational){ ovi.fps_den, ovi.fps_num }; - context->gop_size = data->config.gop_size; - context->pix_fmt = closest_format; - context->colorspace = data->config.color_space; - context->color_range = data->config.color_range; - context->thread_count = 0; + context = data->video->codec; + context->bit_rate = data->config.video_bitrate * 1000; + context->width = data->config.scale_width; + context->height = data->config.scale_height; + context->time_base = (AVRational){ovi.fps_den, ovi.fps_num}; + context->gop_size = data->config.gop_size; + context->pix_fmt = closest_format; + context->colorspace = data->config.color_space; + context->color_range = data->config.color_range; + context->thread_count = 0; data->video->time_base = context->time_base; @@ -294,8 +300,8 @@ if (!open_video_codec(data)) return false; - if (context->pix_fmt != data->config.format || - data->config.width != data->config.scale_width || + if (context->pix_fmt != data->config.format || + data->config.width != data->config.scale_width || data->config.height != data->config.scale_height) { if (!init_swscale(data, context)) @@ -318,7 +324,8 @@ data->aframe[idx] = av_frame_alloc(); if (!data->aframe[idx]) { - ffmpeg_log_error(LOG_WARNING, data, "Failed to allocate audio frame"); + ffmpeg_log_error(LOG_WARNING, data, + "Failed to allocate audio frame"); return false; } @@ -331,18 +338,20 @@ ret = avcodec_open2(context, data->acodec, NULL); if (ret < 0) { - ffmpeg_log_error(LOG_WARNING, data, "Failed to open audio codec: %s", - av_err2str(ret)); + ffmpeg_log_error(LOG_WARNING, data, + "Failed to open audio codec: %s", + av_err2str(ret)); return false; } data->frame_size = context->frame_size ? context->frame_size : 1024; ret = av_samples_alloc(data->samples[idx], NULL, context->channels, - data->frame_size, context->sample_fmt, 0); + data->frame_size, context->sample_fmt, 0); if (ret < 0) { - ffmpeg_log_error(LOG_WARNING, data, "Failed to create audio buffer: %s", - av_err2str(ret)); + ffmpeg_log_error(LOG_WARNING, data, + "Failed to create audio buffer: %s", + av_err2str(ret)); return false; } @@ -361,25 +370,26 @@ } if (!new_stream(data, &stream, &data->acodec, - data->output->oformat->audio_codec, - data->config.audio_encoder)) + data->output->oformat->audio_codec, + data->config.audio_encoder)) return false; data->audio_streams[idx] = stream; - context = data->audio_streams[idx]->codec; - context->bit_rate = data->config.audio_bitrate * 1000; - context->time_base = (AVRational){ 1, aoi.samples_per_sec }; - context->channels = get_audio_channels(aoi.speakers); - context->sample_rate = aoi.samples_per_sec; - context->channel_layout = - av_get_default_channel_layout(context->channels); + context = data->audio_streams[idx]->codec; + context->bit_rate = data->config.audio_bitrate * 1000; + context->time_base = (AVRational){1, aoi.samples_per_sec}; + context->channels = get_audio_channels(aoi.speakers); + context->sample_rate = aoi.samples_per_sec; + context->channel_layout = + av_get_default_channel_layout(context->channels); //AVlib default channel layout for 5 channels is 5.0 ; fix for 4.1 if (aoi.speakers == SPEAKERS_4POINT1) context->channel_layout = av_get_channel_layout("4.1"); - context->sample_fmt = data->acodec->sample_fmts ? - data->acodec->sample_fmts[0] : AV_SAMPLE_FMT_FLTP; + context->sample_fmt = data->acodec->sample_fmts + ? data->acodec->sample_fmts[0] + : AV_SAMPLE_FMT_FLTP; data->audio_streams[idx]->time_base = context->time_base; @@ -402,9 +412,10 @@ if (!create_video_stream(data)) return false; - if (format->audio_codec != AV_CODEC_ID_NONE && data->num_audio_streams) { - data->audio_streams = calloc(1, - data->num_audio_streams * sizeof(void*)); + if (format->audio_codec != AV_CODEC_ID_NONE && + data->num_audio_streams) { + data->audio_streams = + calloc(1, data->num_audio_streams * sizeof(void *)); for (int i = 0; i < data->num_audio_streams; i++) { if (!create_audio_stream(data, i)) return false; @@ -420,10 +431,11 @@ int ret; AVDictionary *dict = NULL; - if ((ret = av_dict_parse_string(&dict, data->config.muxer_settings, - "=", " ", 0))) { - ffmpeg_log_error(LOG_WARNING, data, "Failed to parse muxer settings: %s\n%s", - av_err2str(ret), data->config.muxer_settings); + if ((ret = av_dict_parse_string(&dict, data->config.muxer_settings, "=", + " ", 0))) { + ffmpeg_log_error(LOG_WARNING, data, + "Failed to parse muxer settings: %s\n%s", + av_err2str(ret), data->config.muxer_settings); av_dict_free(&dict); return false; @@ -434,7 +446,7 @@ AVDictionaryEntry *entry = NULL; while ((entry = av_dict_get(dict, "", entry, - AV_DICT_IGNORE_SUFFIX))) + AV_DICT_IGNORE_SUFFIX))) dstr_catf(&str, "\n\t%s=%s", entry->key, entry->value); blog(LOG_INFO, "Using muxer settings: %s", str.array); @@ -443,24 +455,24 @@ if ((format->flags & AVFMT_NOFILE) == 0) { ret = avio_open2(&data->output->pb, data->config.url, - AVIO_FLAG_WRITE, NULL, &dict); + AVIO_FLAG_WRITE, NULL, &dict); if (ret < 0) { ffmpeg_log_error(LOG_WARNING, data, - "Couldn't open '%s', %s", data->config.url, - av_err2str(ret)); + "Couldn't open '%s', %s", + data->config.url, av_err2str(ret)); av_dict_free(&dict); return false; } } strncpy(data->output->filename, data->config.url, - sizeof(data->output->filename)); + sizeof(data->output->filename)); data->output->filename[sizeof(data->output->filename) - 1] = 0; ret = avformat_write_header(data->output, &dict); if (ret < 0) { ffmpeg_log_error(LOG_WARNING, data, "Error opening '%s': %s", - data->config.url, av_err2str(ret)); + data->config.url, av_err2str(ret)); return false; } @@ -469,7 +481,7 @@ AVDictionaryEntry *entry = NULL; while ((entry = av_dict_get(dict, "", entry, - AV_DICT_IGNORE_SUFFIX))) + AV_DICT_IGNORE_SUFFIX))) dstr_catf(&str, "\n\t%s=%s", entry->key, entry->value); blog(LOG_INFO, "Invalid muxer settings: %s", str.array); @@ -564,16 +576,14 @@ static void set_encoder_ids(struct ffmpeg_data *data) { data->output->oformat->video_codec = get_codec_id( - data->config.video_encoder, - data->config.video_encoder_id); + data->config.video_encoder, data->config.video_encoder_id); data->output->oformat->audio_codec = get_codec_id( - data->config.audio_encoder, - data->config.audio_encoder_id); + data->config.audio_encoder, data->config.audio_encoder_id); } static bool ffmpeg_data_init(struct ffmpeg_data *data, - struct ffmpeg_cfg *config) + struct ffmpeg_cfg *config) { bool is_rtmp = false; @@ -584,35 +594,36 @@ if (!config->url || !*config->url) return false; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); +#endif avformat_network_init(); is_rtmp = (astrcmpi_n(config->url, "rtmp://", 7) == 0); AVOutputFormat *output_format = av_guess_format( - is_rtmp ? "flv" : data->config.format_name, - data->config.url, - is_rtmp ? NULL : data->config.format_mime_type); + is_rtmp ? "flv" : data->config.format_name, data->config.url, + is_rtmp ? NULL : data->config.format_mime_type); if (output_format == NULL) { - ffmpeg_log_error(LOG_WARNING, data, + ffmpeg_log_error( + LOG_WARNING, data, "Couldn't find matching output format with " "parameters: name=%s, url=%s, mime=%s", - safe_str(is_rtmp ? - "flv" : data->config.format_name), + safe_str(is_rtmp ? "flv" : data->config.format_name), safe_str(data->config.url), - safe_str(is_rtmp ? - NULL : data->config.format_mime_type)); + safe_str(is_rtmp ? NULL + : data->config.format_mime_type)); goto fail; } - avformat_alloc_output_context2(&data->output, output_format, - NULL, NULL); + avformat_alloc_output_context2(&data->output, output_format, NULL, + NULL); if (!data->output) { ffmpeg_log_error(LOG_WARNING, data, - "Couldn't create avformat context"); + "Couldn't create avformat context"); goto fail; } @@ -653,7 +664,7 @@ } static void ffmpeg_log_callback(void *param, int level, const char *format, - va_list args) + va_list args) { if (level <= AV_LOG_INFO) blogva(LOG_DEBUG, format, args); @@ -707,27 +718,27 @@ } static inline void copy_data(AVFrame *pic, const struct video_data *frame, - int height, enum AVPixelFormat format) + int height, enum AVPixelFormat format) { int h_chroma_shift, v_chroma_shift; - av_pix_fmt_get_chroma_sub_sample(format, &h_chroma_shift, &v_chroma_shift); + av_pix_fmt_get_chroma_sub_sample(format, &h_chroma_shift, + &v_chroma_shift); for (int plane = 0; plane < MAX_AV_PLANES; plane++) { if (!frame->data[plane]) continue; int frame_rowsize = (int)frame->linesize[plane]; - int pic_rowsize = pic->linesize[plane]; - int bytes = frame_rowsize < pic_rowsize ? - frame_rowsize : pic_rowsize; + int pic_rowsize = pic->linesize[plane]; + int bytes = frame_rowsize < pic_rowsize ? frame_rowsize + : pic_rowsize; int plane_height = height >> (plane ? v_chroma_shift : 0); for (int y = 0; y < plane_height; y++) { int pos_frame = y * frame_rowsize; - int pos_pic = y * pic_rowsize; + int pos_pic = y * pic_rowsize; memcpy(pic->data[plane] + pos_pic, - frame->data[plane] + pos_frame, - bytes); + frame->data[plane] + pos_frame, bytes); } } } @@ -735,7 +746,7 @@ static void receive_video(void *param, struct video_data *frame) { struct ffmpeg_output *output = param; - struct ffmpeg_data *data = &output->ff_data; + struct ffmpeg_data *data = &output->ff_data; // codec doesn't support video or none configured if (!data->video) @@ -754,17 +765,17 @@ if (!!data->swscale) sws_scale(data->swscale, (const uint8_t *const *)frame->data, - (const int*)frame->linesize, - 0, data->config.height, data->vframe->data, - data->vframe->linesize); + (const int *)frame->linesize, 0, data->config.height, + data->vframe->data, data->vframe->linesize); else - copy_data(data->vframe, frame, context->height, context->pix_fmt); + copy_data(data->vframe, frame, context->height, + context->pix_fmt); #if LIBAVFORMAT_VERSION_MAJOR < 58 if (data->output->flags & AVFMT_RAWPICTURE) { - packet.flags |= AV_PKT_FLAG_KEY; - packet.stream_index = data->video->index; - packet.data = data->vframe->data[0]; - packet.size = sizeof(AVPicture); + packet.flags |= AV_PKT_FLAG_KEY; + packet.stream_index = data->video->index; + packet.data = data->vframe->data[0]; + packet.size = sizeof(AVPicture); pthread_mutex_lock(&output->write_mutex); da_push_back(output->packets, &packet); @@ -784,24 +795,26 @@ if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) ret = 0; #else - ret = avcodec_encode_video2(context, &packet, data->vframe, - &got_packet); + ret = avcodec_encode_video2(context, &packet, data->vframe, + &got_packet); #endif if (ret < 0) { - blog(LOG_WARNING, "receive_video: Error encoding " - "video: %s", av_err2str(ret)); + blog(LOG_WARNING, + "receive_video: Error encoding " + "video: %s", + av_err2str(ret)); //FIXME: stop the encode with an error return; } if (!ret && got_packet && packet.size) { packet.pts = rescale_ts(packet.pts, context, - data->video->time_base); + data->video->time_base); packet.dts = rescale_ts(packet.dts, context, - data->video->time_base); - packet.duration = (int)av_rescale_q(packet.duration, - context->time_base, - data->video->time_base); + data->video->time_base); + packet.duration = (int)av_rescale_q( + packet.duration, context->time_base, + data->video->time_base); pthread_mutex_lock(&output->write_mutex); da_push_back(output->packets, &packet); @@ -815,7 +828,7 @@ #endif if (ret != 0) { blog(LOG_WARNING, "receive_video: Error writing video: %s", - av_err2str(ret)); + av_err2str(ret)); //FIXME: stop the encode with an error } @@ -823,7 +836,7 @@ } static void encode_audio(struct ffmpeg_output *output, int idx, - struct AVCodecContext *context, size_t block_size) + struct AVCodecContext *context, size_t block_size) { struct ffmpeg_data *data = &output->ff_data; @@ -832,16 +845,19 @@ size_t total_size = data->frame_size * block_size * context->channels; data->aframe[idx]->nb_samples = data->frame_size; - data->aframe[idx]->pts = av_rescale_q(data->total_samples[idx], - (AVRational){1, context->sample_rate}, - context->time_base); + data->aframe[idx]->pts = av_rescale_q( + data->total_samples[idx], (AVRational){1, context->sample_rate}, + context->time_base); ret = avcodec_fill_audio_frame(data->aframe[idx], context->channels, - context->sample_fmt, data->samples[idx][0], - (int)total_size, 1); + context->sample_fmt, + data->samples[idx][0], (int)total_size, + 1); if (ret < 0) { - blog(LOG_WARNING, "encode_audio: avcodec_fill_audio_frame " - "failed: %s", av_err2str(ret)); + blog(LOG_WARNING, + "encode_audio: avcodec_fill_audio_frame " + "failed: %s", + av_err2str(ret)); //FIXME: stop the encode with an error return; } @@ -859,11 +875,11 @@ ret = 0; #else ret = avcodec_encode_audio2(context, &packet, data->aframe[idx], - &got_packet); + &got_packet); #endif if (ret < 0) { blog(LOG_WARNING, "encode_audio: Error encoding audio: %s", - av_err2str(ret)); + av_err2str(ret)); //FIXME: stop the encode with an error return; } @@ -872,11 +888,12 @@ return; packet.pts = rescale_ts(packet.pts, context, - data->audio_streams[idx]->time_base); + data->audio_streams[idx]->time_base); packet.dts = rescale_ts(packet.dts, context, - data->audio_streams[idx]->time_base); - packet.duration = (int)av_rescale_q(packet.duration, context->time_base, - data->audio_streams[idx]->time_base); + data->audio_streams[idx]->time_base); + packet.duration = + (int)av_rescale_q(packet.duration, context->time_base, + data->audio_streams[idx]->time_base); packet.stream_index = data->audio_streams[idx]->index; pthread_mutex_lock(&output->write_mutex); @@ -885,34 +902,6 @@ os_sem_post(output->write_sem); } -static bool prepare_audio(struct ffmpeg_data *data, - const struct audio_data *frame, struct audio_data *output) -{ - *output = *frame; - - if (frame->timestamp < data->start_timestamp) { - uint64_t duration = (uint64_t)frame->frames * 1000000000 / - (uint64_t)data->audio_samplerate; - uint64_t end_ts = (frame->timestamp + duration); - uint64_t cutoff; - - if (end_ts <= data->start_timestamp) - return false; - - cutoff = data->start_timestamp - frame->timestamp; - output->timestamp += cutoff; - - cutoff = cutoff * (uint64_t)data->audio_samplerate / - 1000000000; - - for (size_t i = 0; i < data->audio_planes; i++) - output->data[i] += data->audio_size * (uint32_t)cutoff; - output->frames -= (uint32_t)cutoff; - } - - return true; -} - /* Given a bitmask for the selected tracks and the mix index, * this returns the stream index which will be passed to the muxer. */ static int get_track_order(int track_config, size_t mix_index) @@ -928,9 +917,9 @@ static void receive_audio(void *param, size_t mix_idx, struct audio_data *frame) { struct ffmpeg_output *output = param; - struct ffmpeg_data *data = &output->ff_data; + struct ffmpeg_data *data = &output->ff_data; size_t frame_size_bytes; - struct audio_data in; + struct audio_data in = *frame; int track_order; // codec doesn't support audio or none configured @@ -948,8 +937,6 @@ if (!data->start_timestamp) return; - if (!prepare_audio(data, frame, &in)) - return; if (!output->audio_start_ts) output->audio_start_ts = in.timestamp; @@ -958,22 +945,24 @@ for (size_t i = 0; i < data->audio_planes; i++) circlebuf_push_back(&data->excess_frames[track_order][i], - in.data[i], in.frames * data->audio_size); + in.data[i], in.frames * data->audio_size); while (data->excess_frames[track_order][0].size >= frame_size_bytes) { for (size_t i = 0; i < data->audio_planes; i++) - circlebuf_pop_front(&data->excess_frames[track_order][i], - data->samples[track_order][i], - frame_size_bytes); + circlebuf_pop_front( + &data->excess_frames[track_order][i], + data->samples[track_order][i], + frame_size_bytes); encode_audio(output, track_order, context, data->audio_size); } } static uint64_t get_packet_sys_dts(struct ffmpeg_output *output, - AVPacket *packet) + AVPacket *packet) { struct ffmpeg_data *data = &output->ff_data; + uint64_t pause_offset = obs_output_get_pause_offset(output->output); uint64_t start_ts; AVRational time_base; @@ -986,8 +975,9 @@ start_ts = output->audio_start_ts; } - return start_ts + (uint64_t)av_rescale_q(packet->dts, - time_base, (AVRational){1, 1000000000}); + return start_ts + pause_offset + + (uint64_t)av_rescale_q(packet->dts, time_base, + (AVRational){1, 1000000000}); } static int process_packet(struct ffmpeg_output *output) @@ -1026,8 +1016,8 @@ if (ret < 0) { av_free_packet(&packet); ffmpeg_log_error(LOG_WARNING, &output->ff_data, - "receive_audio: Error writing packet: %s", - av_err2str(ret)); + "receive_audio: Error writing packet: %s", + av_err2str(ret)); return ret; } @@ -1064,7 +1054,7 @@ } static inline const char *get_string_or_null(obs_data_t *settings, - const char *name) + const char *name) { const char *value = obs_data_get_string(settings, name); if (!value || !strlen(value)) @@ -1099,34 +1089,36 @@ config.url = obs_data_get_string(settings, "url"); config.format_name = get_string_or_null(settings, "format_name"); - config.format_mime_type = get_string_or_null(settings, - "format_mime_type"); + config.format_mime_type = + get_string_or_null(settings, "format_mime_type"); config.muxer_settings = obs_data_get_string(settings, "muxer_settings"); config.video_bitrate = (int)obs_data_get_int(settings, "video_bitrate"); config.audio_bitrate = (int)obs_data_get_int(settings, "audio_bitrate"); config.gop_size = (int)obs_data_get_int(settings, "gop_size"); config.video_encoder = get_string_or_null(settings, "video_encoder"); - config.video_encoder_id = (int)obs_data_get_int(settings, - "video_encoder_id"); + config.video_encoder_id = + (int)obs_data_get_int(settings, "video_encoder_id"); config.audio_encoder = get_string_or_null(settings, "audio_encoder"); - config.audio_encoder_id = (int)obs_data_get_int(settings, - "audio_encoder_id"); + config.audio_encoder_id = + (int)obs_data_get_int(settings, "audio_encoder_id"); config.video_settings = obs_data_get_string(settings, "video_settings"); config.audio_settings = obs_data_get_string(settings, "audio_settings"); config.scale_width = (int)obs_data_get_int(settings, "scale_width"); config.scale_height = (int)obs_data_get_int(settings, "scale_height"); - config.width = (int)obs_output_get_width(output->output); + config.width = (int)obs_output_get_width(output->output); config.height = (int)obs_output_get_height(output->output); - config.format = obs_to_ffmpeg_video_format( - video_output_get_format(video)); + config.format = + obs_to_ffmpeg_video_format(video_output_get_format(video)); config.audio_tracks = (int)obs_output_get_mixers(output->output); config.audio_mix_count = get_audio_mix_count(config.audio_tracks); if (format_is_yuv(voi->format)) { - config.color_range = voi->range == VIDEO_RANGE_FULL ? - AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; - config.color_space = voi->colorspace == VIDEO_CS_709 ? - AVCOL_SPC_BT709 : AVCOL_SPC_BT470BG; + config.color_range = voi->range == VIDEO_RANGE_FULL + ? AVCOL_RANGE_JPEG + : AVCOL_RANGE_MPEG; + config.color_space = voi->colorspace == VIDEO_CS_709 + ? AVCOL_SPC_BT709 + : AVCOL_SPC_BT470BG; } else { config.color_range = AVCOL_RANGE_UNSPECIFIED; config.color_space = AVCOL_SPC_RGB; @@ -1148,15 +1140,14 @@ if (!success) { if (output->ff_data.last_error) { obs_output_set_last_error(output->output, - output->ff_data.last_error); + output->ff_data.last_error); } ffmpeg_data_free(&output->ff_data); return false; } - struct audio_convert_info aci = { - .format = output->ff_data.audio_format - }; + struct audio_convert_info aci = {.format = + output->ff_data.audio_format}; output->active = true; @@ -1166,8 +1157,8 @@ ret = pthread_create(&output->write_thread, NULL, write_thread, output); if (ret != 0) { ffmpeg_log_error(LOG_WARNING, &output->ff_data, - "ffmpeg_output_start: failed to create write " - "thread."); + "ffmpeg_output_start: failed to create write " + "thread."); ffmpeg_output_full_stop(output); return false; } @@ -1185,7 +1176,7 @@ if (!try_connect(output)) obs_output_signal_stop(output->output, - OBS_OUTPUT_CONNECT_FAILED); + OBS_OUTPUT_CONNECT_FAILED); output->connecting = false; return NULL; @@ -1244,7 +1235,7 @@ pthread_mutex_lock(&output->write_mutex); for (size_t i = 0; i < output->packets.num; i++) - av_free_packet(output->packets.array+i); + av_free_packet(output->packets.array + i); da_free(output->packets); pthread_mutex_unlock(&output->write_mutex); @@ -1259,15 +1250,14 @@ } struct obs_output_info ffmpeg_output = { - .id = "ffmpeg_output", - .flags = OBS_OUTPUT_AUDIO | - OBS_OUTPUT_VIDEO | - OBS_OUTPUT_MULTI_TRACK, - .get_name = ffmpeg_output_getname, - .create = ffmpeg_output_create, - .destroy = ffmpeg_output_destroy, - .start = ffmpeg_output_start, - .stop = ffmpeg_output_stop, + .id = "ffmpeg_output", + .flags = OBS_OUTPUT_AUDIO | OBS_OUTPUT_VIDEO | OBS_OUTPUT_MULTI_TRACK | + OBS_OUTPUT_CAN_PAUSE, + .get_name = ffmpeg_output_getname, + .create = ffmpeg_output_create, + .destroy = ffmpeg_output_destroy, + .start = ffmpeg_output_start, + .stop = ffmpeg_output_stop, .raw_video = receive_video, .raw_audio2 = receive_audio, .get_total_bytes = ffmpeg_output_total_bytes,
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-source.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-source.c
Changed
@@ -25,9 +25,9 @@ #define FF_LOG(level, format, ...) \ blog(level, "[Media Source]: " format, ##__VA_ARGS__) -#define FF_LOG_S(source, level, format, ...) \ +#define FF_LOG_S(source, level, format, ...) \ blog(level, "[Media Source '%s']: " format, \ - obs_source_get_name(source), ##__VA_ARGS__) + obs_source_get_name(source), ##__VA_ARGS__) #define FF_BLOG(level, format, ...) \ FF_LOG_S(s->source, level, format, ##__VA_ARGS__) @@ -60,18 +60,19 @@ }; static bool is_local_file_modified(obs_properties_t *props, - obs_property_t *prop, obs_data_t *settings) + obs_property_t *prop, obs_data_t *settings) { UNUSED_PARAMETER(prop); bool enabled = obs_data_get_bool(settings, "is_local_file"); obs_property_t *input = obs_properties_get(props, "input"); - obs_property_t *input_format =obs_properties_get(props, - "input_format"); + obs_property_t *input_format = + obs_properties_get(props, "input_format"); obs_property_t *local_file = obs_properties_get(props, "local_file"); obs_property_t *looping = obs_properties_get(props, "looping"); obs_property_t *buffering = obs_properties_get(props, "buffering_mb"); - obs_property_t *close = obs_properties_get(props, "close_when_inactive"); + obs_property_t *close = + obs_properties_get(props, "close_when_inactive"); obs_property_t *seekable = obs_properties_get(props, "seekable"); obs_property_t *speed = obs_properties_get(props, "speed_percent"); obs_property_set_visible(input, !enabled); @@ -103,8 +104,7 @@ " (*.mp4 *.ts *.mov *.flv *.mkv *.avi *.mp3 *.ogg *.aac *.wav *.gif *.webm);;"; static const char *video_filter = " (*.mp4 *.ts *.mov *.flv *.mkv *.avi *.gif *.webm);;"; -static const char *audio_filter = - " (*.mp3 *.aac *.ogg *.wav);;"; +static const char *audio_filter = " (*.mp3 *.aac *.ogg *.wav);;"; static obs_properties_t *ffmpeg_source_getproperties(void *data) { @@ -120,7 +120,7 @@ obs_property_t *prop; // use this when obs allows non-readonly paths prop = obs_properties_add_bool(props, "is_local_file", - obs_module_text("LocalFile")); + obs_module_text("LocalFile")); obs_property_set_modified_callback(prop, is_local_file_modified); @@ -144,53 +144,59 @@ } obs_properties_add_path(props, "local_file", - obs_module_text("LocalFile"), OBS_PATH_FILE, - filter.array, path.array); + obs_module_text("LocalFile"), OBS_PATH_FILE, + filter.array, path.array); dstr_free(&filter); dstr_free(&path); prop = obs_properties_add_bool(props, "looping", - obs_module_text("Looping")); + obs_module_text("Looping")); obs_properties_add_bool(props, "restart_on_activate", - obs_module_text("RestartWhenActivated")); + obs_module_text("RestartWhenActivated")); - obs_properties_add_int_slider(props, "buffering_mb", - obs_module_text("BufferingMB"), - 1, 16, 1); + prop = obs_properties_add_int_slider(props, "buffering_mb", + obs_module_text("BufferingMB"), 1, + 16, 1); + obs_property_int_set_suffix(prop, " MB"); - obs_properties_add_text(props, "input", - obs_module_text("Input"), OBS_TEXT_DEFAULT); + obs_properties_add_text(props, "input", obs_module_text("Input"), + OBS_TEXT_DEFAULT); obs_properties_add_text(props, "input_format", - obs_module_text("InputFormat"), OBS_TEXT_DEFAULT); + obs_module_text("InputFormat"), + OBS_TEXT_DEFAULT); #ifndef __APPLE__ obs_properties_add_bool(props, "hw_decode", - obs_module_text("HardwareDecode")); + obs_module_text("HardwareDecode")); #endif obs_properties_add_bool(props, "clear_on_media_end", - obs_module_text("ClearOnMediaEnd")); + obs_module_text("ClearOnMediaEnd")); - prop = obs_properties_add_bool(props, "close_when_inactive", - obs_module_text("CloseFileWhenInactive")); + prop = obs_properties_add_bool( + props, "close_when_inactive", + obs_module_text("CloseFileWhenInactive")); - obs_property_set_long_description(prop, - obs_module_text("CloseFileWhenInactive.ToolTip")); + obs_property_set_long_description( + prop, obs_module_text("CloseFileWhenInactive.ToolTip")); - obs_properties_add_int_slider(props, "speed_percent", - obs_module_text("SpeedPercentage"), 1, 200, 1); + prop = obs_properties_add_int_slider(props, "speed_percent", + obs_module_text("SpeedPercentage"), + 1, 200, 1); + obs_property_int_set_suffix(prop, "%"); prop = obs_properties_add_list(props, "color_range", - obs_module_text("ColorRange"), OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_INT); + obs_module_text("ColorRange"), + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_list_add_int(prop, obs_module_text("ColorRange.Auto"), - VIDEO_RANGE_DEFAULT); + VIDEO_RANGE_DEFAULT); obs_property_list_add_int(prop, obs_module_text("ColorRange.Partial"), - VIDEO_RANGE_PARTIAL); + VIDEO_RANGE_PARTIAL); obs_property_list_add_int(prop, obs_module_text("ColorRange.Full"), - VIDEO_RANGE_FULL); + VIDEO_RANGE_FULL); obs_properties_add_bool(props, "seekable", obs_module_text("Seekable")); @@ -198,26 +204,24 @@ } static void dump_source_info(struct ffmpeg_source *s, const char *input, - const char *input_format) + const char *input_format) { FF_BLOG(LOG_INFO, - "settings:\n" - "\tinput: %s\n" - "\tinput_format: %s\n" - "\tspeed: %d\n" - "\tis_looping: %s\n" - "\tis_hw_decoding: %s\n" - "\tis_clear_on_media_end: %s\n" - "\trestart_on_activate: %s\n" - "\tclose_when_inactive: %s", - input ? input : "(null)", - input_format ? input_format : "(null)", - s->speed_percent, - s->is_looping ? "yes" : "no", - s->is_hw_decoding ? "yes" : "no", - s->is_clear_on_media_end ? "yes" : "no", - s->restart_on_activate ? "yes" : "no", - s->close_when_inactive ? "yes" : "no"); + "settings:\n" + "\tinput: %s\n" + "\tinput_format: %s\n" + "\tspeed: %d\n" + "\tis_looping: %s\n" + "\tis_hw_decoding: %s\n" + "\tis_clear_on_media_end: %s\n" + "\trestart_on_activate: %s\n" + "\tclose_when_inactive: %s", + input ? input : "(null)", + input_format ? input_format : "(null)", s->speed_percent, + s->is_looping ? "yes" : "no", s->is_hw_decoding ? "yes" : "no", + s->is_clear_on_media_end ? "yes" : "no", + s->restart_on_activate ? "yes" : "no", + s->close_when_inactive ? "yes" : "no"); } static void get_frame(void *opaque, struct obs_source_frame *f) @@ -267,8 +271,7 @@ .speed = s->speed_percent, .force_range = s->range, .hardware_decoding = s->is_hw_decoding, - .is_local_file = s->is_local_file || s->seekable - }; + .is_local_file = s->is_local_file || s->seekable}; s->media_valid = mp_media_init(&s->media, &info); } @@ -316,14 +319,14 @@ input = (char *)obs_data_get_string(settings, "local_file"); input_format = NULL; s->is_looping = obs_data_get_bool(settings, "looping"); - s->close_when_inactive = obs_data_get_bool(settings, - "close_when_inactive"); + s->close_when_inactive = + obs_data_get_bool(settings, "close_when_inactive"); obs_source_set_async_unbuffered(s->source, true); } else { input = (char *)obs_data_get_string(settings, "input"); - input_format = (char *)obs_data_get_string(settings, - "input_format"); + input_format = + (char *)obs_data_get_string(settings, "input_format"); s->is_looping = false; s->close_when_inactive = true; @@ -335,12 +338,12 @@ #ifndef __APPLE__ s->is_hw_decoding = obs_data_get_bool(settings, "hw_decode"); #endif - s->is_clear_on_media_end = obs_data_get_bool(settings, - "clear_on_media_end"); - s->restart_on_activate = obs_data_get_bool(settings, - "restart_on_activate"); + s->is_clear_on_media_end = + obs_data_get_bool(settings, "clear_on_media_end"); + s->restart_on_activate = + obs_data_get_bool(settings, "restart_on_activate"); s->range = (enum video_range_type)obs_data_get_int(settings, - "color_range"); + "color_range"); s->buffering_mb = (int)obs_data_get_int(settings, "buffering_mb"); s->speed_percent = (int)obs_data_get_int(settings, "speed_percent"); s->is_local_file = is_local_file; @@ -369,8 +372,8 @@ return obs_module_text("FFMpegSource"); } -static void restart_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) +static void restart_hotkey(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey, + bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -407,12 +410,12 @@ return; } - int video_stream_index = av_find_best_stream(s->media.fmt, - AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0); + int video_stream_index = av_find_best_stream( + s->media.fmt, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0); if (video_stream_index < 0) { FF_BLOG(LOG_WARNING, "Getting number of frames failed: No " - "video stream in media file!"); + "video stream in media file!"); calldata_set_int(cd, "num_frames", frames); return; } @@ -423,12 +426,12 @@ frames = stream->nb_frames; } else { FF_BLOG(LOG_DEBUG, "nb_frames not set, estimating using frame " - "rate and duration"); + "rate and duration"); AVRational avg_frame_rate = stream->avg_frame_rate; frames = (int64_t)ceil((double)s->media.fmt->duration / - (double)AV_TIME_BASE * - (double)avg_frame_rate.num / - (double)avg_frame_rate.den); + (double)AV_TIME_BASE * + (double)avg_frame_rate.num / + (double)avg_frame_rate.den); } calldata_set_int(cd, "num_frames", frames); @@ -441,17 +444,16 @@ struct ffmpeg_source *s = bzalloc(sizeof(struct ffmpeg_source)); s->source = source; - s->hotkey = obs_hotkey_register_source(source, - "MediaSource.Restart", - obs_module_text("RestartMedia"), - restart_hotkey, s); + s->hotkey = obs_hotkey_register_source(source, "MediaSource.Restart", + obs_module_text("RestartMedia"), + restart_hotkey, s); proc_handler_t *ph = obs_source_get_proc_handler(source); proc_handler_add(ph, "void restart()", restart_proc, s); proc_handler_add(ph, "void get_duration(out int duration)", - get_duration, s); + get_duration, s); proc_handler_add(ph, "void get_nb_frames(out int num_frames)", - get_nb_frames, s); + get_nb_frames, s); ffmpeg_source_update(s, settings); return s; @@ -497,17 +499,17 @@ } struct obs_source_info ffmpeg_source = { - .id = "ffmpeg_source", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO | - OBS_SOURCE_DO_NOT_DUPLICATE, - .get_name = ffmpeg_source_getname, - .create = ffmpeg_source_create, - .destroy = ffmpeg_source_destroy, - .get_defaults = ffmpeg_source_defaults, + .id = "ffmpeg_source", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO | + OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = ffmpeg_source_getname, + .create = ffmpeg_source_create, + .destroy = ffmpeg_source_destroy, + .get_defaults = ffmpeg_source_defaults, .get_properties = ffmpeg_source_getproperties, - .activate = ffmpeg_source_activate, - .deactivate = ffmpeg_source_deactivate, - .video_tick = ffmpeg_source_tick, - .update = ffmpeg_source_update + .activate = ffmpeg_source_activate, + .deactivate = ffmpeg_source_deactivate, + .video_tick = ffmpeg_source_tick, + .update = ffmpeg_source_update, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
Changed
@@ -37,9 +37,9 @@ #include "obs-ffmpeg-formats.h" -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[FFMPEG VAAPI encoder: '%s'] " format, \ - obs_encoder_get_name(enc->encoder), ##__VA_ARGS__) + obs_encoder_get_name(enc->encoder), ##__VA_ARGS__) #define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) #define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) @@ -51,7 +51,7 @@ AVBufferRef *vadevice_ref; AVBufferRef *vaframes_ref; - AVCodec * vaapi; + AVCodec *vaapi; AVCodecContext *context; AVFrame *vframe; @@ -59,12 +59,12 @@ DARRAY(uint8_t) buffer; uint8_t *header; - size_t header_size; + size_t header_size; uint8_t *sei; - size_t sei_size; + size_t sei_size; - int height; + int height; bool first_packet; bool initialized; }; @@ -83,7 +83,7 @@ static void vaapi_video_info(void *data, struct video_scale_info *info) { struct vaapi_encoder *enc = data; - enum video_format pref_format; + enum video_format pref_format; pref_format = obs_encoder_get_preferred_video_format(enc->encoder); @@ -100,10 +100,10 @@ int ret; ret = av_hwdevice_ctx_create(&enc->vadevice_ref, AV_HWDEVICE_TYPE_VAAPI, - path, NULL, 0); + path, NULL, 0); if (ret < 0) { warn("Failed to create VAAPI device context: %s", - av_err2str(ret)); + av_err2str(ret)); return false; } @@ -114,11 +114,11 @@ } AVHWFramesContext *frames_ctx = - (AVHWFramesContext *)enc->vaframes_ref->data; - frames_ctx->format = AV_PIX_FMT_VAAPI; - frames_ctx->sw_format = AV_PIX_FMT_NV12; - frames_ctx->width = enc->context->width; - frames_ctx->height = enc->context->height; + (AVHWFramesContext *)enc->vaframes_ref->data; + frames_ctx->format = AV_PIX_FMT_VAAPI; + frames_ctx->sw_format = AV_PIX_FMT_NV12; + frames_ctx->width = enc->context->width; + frames_ctx->height = enc->context->height; frames_ctx->initial_pool_size = 20; ret = av_hwframe_ctx_init(enc->vaframes_ref); @@ -135,9 +135,9 @@ } enc->vframe->format = enc->context->pix_fmt; - enc->vframe->width = enc->context->width; + enc->vframe->width = enc->context->width; enc->vframe->height = enc->context->height; - enc->vframe->colorspace = enc->context->colorspace; + enc->vframe->colorspace = enc->context->colorspace; enc->vframe->color_range = enc->context->color_range; ret = av_frame_get_buffer(enc->vframe, base_get_alignment()); @@ -147,7 +147,7 @@ } /* 3. set up codec */ - enc->context->pix_fmt = AV_PIX_FMT_VAAPI; + enc->context->pix_fmt = AV_PIX_FMT_VAAPI; enc->context->hw_frames_ctx = av_buffer_ref(enc->vaframes_ref); ret = avcodec_open2(enc->context, enc->vaapi, NULL); @@ -167,49 +167,49 @@ const char *device = obs_data_get_string(settings, "vaapi_device"); int profile = (int)obs_data_get_int(settings, "profile"); - int bf = (int)obs_data_get_int(settings, "bf"); + int bf = (int)obs_data_get_int(settings, "bf"); - int level = (int)obs_data_get_int(settings, "level"); - int bitrate = (int)obs_data_get_int(settings, "bitrate"); + int level = (int)obs_data_get_int(settings, "level"); + int bitrate = (int)obs_data_get_int(settings, "bitrate"); int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec"); - int qp = (int)obs_data_get_int(settings, "qp"); + int qp = (int)obs_data_get_int(settings, "qp"); int quality = (int)obs_data_get_int(settings, "quality"); av_opt_set_int(enc->context->priv_data, "qp", qp, 0); av_opt_set_int(enc->context->priv_data, "quality", quality, 0); - video_t * video = obs_encoder_video(enc->encoder); - const struct video_output_info *voi = video_output_get_info(video); - struct video_scale_info info; + video_t *video = obs_encoder_video(enc->encoder); + const struct video_output_info *voi = video_output_get_info(video); + struct video_scale_info info; - info.format = voi->format; + info.format = voi->format; info.colorspace = voi->colorspace; - info.range = voi->range; + info.range = voi->range; vaapi_video_info(enc, &info); - enc->context->profile = profile; + enc->context->profile = profile; enc->context->max_b_frames = bf; - enc->context->level = level; - enc->context->bit_rate = bitrate * 1000; - enc->context->rc_max_rate = bitrate * 1000; + enc->context->level = level; + enc->context->bit_rate = bitrate * 1000; + enc->context->rc_max_rate = bitrate * 1000; - enc->context->width = obs_encoder_get_width(enc->encoder); + enc->context->width = obs_encoder_get_width(enc->encoder); enc->context->height = obs_encoder_get_height(enc->encoder); - enc->context->time_base = (AVRational){voi->fps_den, voi->fps_num}; - enc->context->pix_fmt = obs_to_ffmpeg_video_format(info.format); + enc->context->time_base = (AVRational){voi->fps_den, voi->fps_num}; + enc->context->pix_fmt = obs_to_ffmpeg_video_format(info.format); enc->context->colorspace = info.colorspace == VIDEO_CS_709 - ? AVCOL_SPC_BT709 - : AVCOL_SPC_BT470BG; + ? AVCOL_SPC_BT709 + : AVCOL_SPC_BT470BG; enc->context->color_range = info.range == VIDEO_RANGE_FULL - ? AVCOL_RANGE_JPEG - : AVCOL_RANGE_MPEG; + ? AVCOL_RANGE_JPEG + : AVCOL_RANGE_MPEG; if (keyint_sec > 0) { enc->context->gop_size = - keyint_sec * voi->fps_num / voi->fps_den; + keyint_sec * voi->fps_num / voi->fps_den; } else { enc->context->gop_size = 120; } @@ -227,9 +227,9 @@ "\twidth: %d\n" "\theight: %d\n" "\tb-frames: %d\n", - device, qp, quality, profile, level, bitrate, - enc->context->gop_size, enc->context->width, - enc->context->height, enc->context->max_b_frames); + device, qp, quality, profile, level, bitrate, + enc->context->gop_size, enc->context->width, enc->context->height, + enc->context->max_b_frames); return vaapi_init_codec(enc, device); } @@ -239,8 +239,8 @@ struct vaapi_encoder *enc = data; if (enc->initialized) { - AVPacket pkt = {0}; - int r_pkt = 1; + AVPacket pkt = {0}; + int r_pkt = 1; while (r_pkt) { #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 40, 101) @@ -248,7 +248,7 @@ break; #else if (avcodec_encode_video2(enc->context, &pkt, NULL, - &r_pkt) < 0) + &r_pkt) < 0) break; #endif @@ -272,9 +272,11 @@ static void *vaapi_create(obs_data_t *settings, obs_encoder_t *encoder) { struct vaapi_encoder *enc; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) avcodec_register_all(); +#endif - enc = bzalloc(sizeof(*enc)); + enc = bzalloc(sizeof(*enc)); enc->encoder = encoder; int vaapi_codec = (int)obs_data_get_int(settings, "vaapi_codec"); @@ -309,39 +311,39 @@ } static inline void copy_data(AVFrame *pic, const struct encoder_frame *frame, - int height, enum AVPixelFormat format) + int height, enum AVPixelFormat format) { int h_chroma_shift, v_chroma_shift; - av_pix_fmt_get_chroma_sub_sample( - format, &h_chroma_shift, &v_chroma_shift); + av_pix_fmt_get_chroma_sub_sample(format, &h_chroma_shift, + &v_chroma_shift); for (int plane = 0; plane < MAX_AV_PLANES; plane++) { if (!frame->data[plane]) continue; int frame_rowsize = (int)frame->linesize[plane]; - int pic_rowsize = pic->linesize[plane]; - int bytes = frame_rowsize < pic_rowsize ? frame_rowsize + int pic_rowsize = pic->linesize[plane]; + int bytes = frame_rowsize < pic_rowsize ? frame_rowsize : pic_rowsize; int plane_height = height >> (plane ? v_chroma_shift : 0); for (int y = 0; y < plane_height; y++) { int pos_frame = y * frame_rowsize; - int pos_pic = y * pic_rowsize; + int pos_pic = y * pic_rowsize; memcpy(pic->data[plane] + pos_pic, - frame->data[plane] + pos_frame, bytes); + frame->data[plane] + pos_frame, bytes); } } } static bool vaapi_encode(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, bool *received_packet) { - struct vaapi_encoder *enc = data; - AVFrame * hwframe = NULL; - AVPacket av_pkt; - int got_packet; - int ret; + struct vaapi_encoder *enc = data; + AVFrame *hwframe = NULL; + AVPacket av_pkt; + int got_packet; + int ret; hwframe = av_frame_alloc(); if (!hwframe) { @@ -352,28 +354,28 @@ ret = av_hwframe_get_buffer(enc->vaframes_ref, hwframe, 0); if (ret < 0) { warn("vaapi_encode: failed to get buffer for hw frame: %s", - av_err2str(ret)); + av_err2str(ret)); goto fail; } copy_data(enc->vframe, frame, enc->height, enc->context->pix_fmt); enc->vframe->pts = frame->pts; - hwframe->pts = frame->pts; - hwframe->width = enc->vframe->width; - hwframe->height = enc->vframe->height; + hwframe->pts = frame->pts; + hwframe->width = enc->vframe->width; + hwframe->height = enc->vframe->height; ret = av_hwframe_transfer_data(hwframe, enc->vframe, 0); if (ret < 0) { warn("vaapi_encode: failed to upload hw frame: %s", - av_err2str(ret)); + av_err2str(ret)); goto fail; } ret = av_frame_copy_props(hwframe, enc->vframe); if (ret < 0) { warn("vaapi_encode: failed to copy props to hw frame: %s", - av_err2str(ret)); + av_err2str(ret)); goto fail; } @@ -389,8 +391,8 @@ if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) ret = 0; #else - ret = avcodec_encode_video2( - enc->context, &av_pkt, hwframe, &got_packet); + ret = avcodec_encode_video2(enc->context, &av_pkt, hwframe, + &got_packet); #endif if (ret < 0) { warn("vaapi_encode: Error encoding: %s", av_err2str(ret)); @@ -400,13 +402,13 @@ if (got_packet && av_pkt.size) { if (enc->first_packet) { uint8_t *new_packet; - size_t size; + size_t size; enc->first_packet = false; obs_extract_avc_headers(av_pkt.data, av_pkt.size, - &new_packet, &size, &enc->header, - &enc->header_size, &enc->sei, - &enc->sei_size); + &new_packet, &size, + &enc->header, &enc->header_size, + &enc->sei, &enc->sei_size); da_copy_array(enc->buffer, new_packet, size); bfree(new_packet); @@ -414,11 +416,11 @@ da_copy_array(enc->buffer, av_pkt.data, av_pkt.size); } - packet->pts = av_pkt.pts; - packet->dts = av_pkt.dts; - packet->data = enc->buffer.array; - packet->size = enc->buffer.num; - packet->type = OBS_ENCODER_VIDEO; + packet->pts = av_pkt.pts; + packet->dts = av_pkt.dts; + packet->data = enc->buffer.array; + packet->size = enc->buffer.num; + packet->type = OBS_ENCODER_VIDEO; packet->keyframe = obs_avc_keyframe(packet->data, packet->size); *received_packet = true; } else { @@ -442,11 +444,11 @@ static void vaapi_defaults(obs_data_t *settings) { - obs_data_set_default_string( - settings, "vaapi_device", "/dev/dri/renderD128"); + obs_data_set_default_string(settings, "vaapi_device", + "/dev/dri/renderD128"); obs_data_set_default_int(settings, "vaapi_codec", AV_CODEC_ID_H264); obs_data_set_default_int(settings, "profile", - FF_PROFILE_H264_CONSTRAINED_BASELINE); + FF_PROFILE_H264_CONSTRAINED_BASELINE); obs_data_set_default_int(settings, "level", 40); obs_data_set_default_int(settings, "bitrate", 2500); obs_data_set_default_int(settings, "keyint_sec", 0); @@ -461,10 +463,11 @@ UNUSED_PARAMETER(unused); obs_properties_t *props = obs_properties_create(); - obs_property_t * list; + obs_property_t *list; list = obs_properties_add_list(props, "vaapi_device", "VAAPI Device", - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); char path[32] = "/dev/dri/renderD1"; for (int i = 28;; i++) { sprintf(path, "/dev/dri/renderD1%d", i); @@ -478,27 +481,29 @@ } list = obs_properties_add_list(props, "vaapi_codec", "VAAPI Codec", - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_list_add_int(list, "H.264 (default)", AV_CODEC_ID_H264); list = obs_properties_add_list(props, "level", "Level", - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_list_add_int(list, "480p30 (3.0)", 30); obs_property_list_add_int(list, "720p30/480p60 (3.1)", 31); - obs_property_list_add_int( - list, "Compatibility mode (4.0 default)", 40); + obs_property_list_add_int(list, "Compatibility mode (4.0 default)", + 40); obs_property_list_add_int(list, "720p60/1080p30 (4.1)", 41); obs_property_list_add_int(list, "1080p60 (4.2)", 42); obs_property_t *p; - p = obs_properties_add_int(props, "bitrate", obs_module_text("Bitrate"), 0, - 300000, 50); + p = obs_properties_add_int(props, "bitrate", obs_module_text("Bitrate"), + 0, 300000, 50); obs_property_int_set_suffix(p, " Kbps"); obs_properties_add_int(props, "keyint_sec", - obs_module_text("Keyframe Interval (seconds)"), 0, 20, - 1); + obs_module_text("Keyframe Interval (seconds)"), + 0, 20, 1); return props; } @@ -508,7 +513,7 @@ struct vaapi_encoder *enc = data; *extra_data = enc->header; - *size = enc->header_size; + *size = enc->header_size; return true; } @@ -517,23 +522,23 @@ struct vaapi_encoder *enc = data; *extra_data = enc->sei; - *size = enc->sei_size; + *size = enc->sei_size; return true; } struct obs_encoder_info vaapi_encoder_info = { - .id = "ffmpeg_vaapi", - .type = OBS_ENCODER_VIDEO, - .codec = "h264", - .get_name = vaapi_getname, - .create = vaapi_create, - .destroy = vaapi_destroy, - .encode = vaapi_encode, - .get_defaults = vaapi_defaults, + .id = "ffmpeg_vaapi", + .type = OBS_ENCODER_VIDEO, + .codec = "h264", + .get_name = vaapi_getname, + .create = vaapi_create, + .destroy = vaapi_destroy, + .encode = vaapi_encode, + .get_defaults = vaapi_defaults, .get_properties = vaapi_properties, .get_extra_data = vaapi_extra_data, - .get_sei_data = vaapi_sei_data, - .get_video_info = vaapi_video_info + .get_sei_data = vaapi_sei_data, + .get_video_info = vaapi_video_info, }; #endif
View file
obs-studio-23.2.1.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg.c -> obs-studio-24.0.0.tar.xz/plugins/obs-ffmpeg/obs-ffmpeg.c
Changed
@@ -1,11 +1,10 @@ #include <obs-module.h> -#include <util/darray.h> #include <util/platform.h> -#include <libavutil/log.h> #include <libavutil/avutil.h> #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> -#include <pthread.h> + +#include "obs-ffmpeg-config.h" #ifdef _WIN32 #include <dxgi.h> @@ -20,10 +19,10 @@ return "FFmpeg based sources/outputs/encoders"; } -extern struct obs_source_info ffmpeg_source; -extern struct obs_output_info ffmpeg_output; -extern struct obs_output_info ffmpeg_muxer; -extern struct obs_output_info replay_buffer; +extern struct obs_source_info ffmpeg_source; +extern struct obs_output_info ffmpeg_output; +extern struct obs_output_info ffmpeg_muxer; +extern struct obs_output_info replay_buffer; extern struct obs_encoder_info aac_encoder_info; extern struct obs_encoder_info opus_encoder_info; extern struct obs_encoder_info nvenc_encoder_info; @@ -36,134 +35,16 @@ extern struct obs_encoder_info vaapi_encoder_info; #endif -static DARRAY(struct log_context { - void *context; - char str[4096]; - int print_prefix; -} *) active_log_contexts; -static DARRAY(struct log_context *) cached_log_contexts; -pthread_mutex_t log_contexts_mutex = PTHREAD_MUTEX_INITIALIZER; - -static struct log_context *create_or_fetch_log_context(void *context) -{ - pthread_mutex_lock(&log_contexts_mutex); - for (size_t i = 0; i < active_log_contexts.num; i++) { - if (context == active_log_contexts.array[i]->context) { - pthread_mutex_unlock(&log_contexts_mutex); - return active_log_contexts.array[i]; - } - } - - struct log_context *new_log_context = NULL; - - size_t cnt = cached_log_contexts.num; - if (!!cnt) { - new_log_context = cached_log_contexts.array[cnt - 1]; - da_pop_back(cached_log_contexts); - } - - if (!new_log_context) - new_log_context = bzalloc(sizeof(struct log_context)); - - new_log_context->context = context; - new_log_context->str[0] = '\0'; - new_log_context->print_prefix = 1; - - da_push_back(active_log_contexts, &new_log_context); - - pthread_mutex_unlock(&log_contexts_mutex); - - return new_log_context; -} - -static void destroy_log_context(struct log_context *log_context) -{ - pthread_mutex_lock(&log_contexts_mutex); - da_erase_item(active_log_contexts, &log_context); - da_push_back(cached_log_contexts, &log_context); - pthread_mutex_unlock(&log_contexts_mutex); -} - -static void ffmpeg_log_callback(void* context, int level, const char* format, - va_list args) -{ - if (format == NULL) - return; - - struct log_context *log_context = create_or_fetch_log_context(context); - - char *str = log_context->str; - - av_log_format_line(context, level, format, args, str + strlen(str), - (int)(sizeof(log_context->str) - strlen(str)), - &log_context->print_prefix); - - int obs_level; - switch (level) { - case AV_LOG_PANIC: - case AV_LOG_FATAL: - obs_level = LOG_ERROR; - break; - case AV_LOG_ERROR: - case AV_LOG_WARNING: - obs_level = LOG_WARNING; - break; - case AV_LOG_INFO: - case AV_LOG_VERBOSE: - obs_level = LOG_INFO; - break; - case AV_LOG_DEBUG: - default: - obs_level = LOG_DEBUG; - } - - if (!log_context->print_prefix) - return; - - char *str_end = str + strlen(str) - 1; - while(str < str_end) { - if (*str_end != '\n') - break; - *str_end-- = '\0'; - } - - if (str_end <= str) - goto cleanup; - - blog(obs_level, "[ffmpeg] %s", str); - -cleanup: - destroy_log_context(log_context); -} - #ifndef __APPLE__ static const char *nvenc_check_name = "nvenc_check"; #ifdef _WIN32 static const wchar_t *blacklisted_adapters[] = { - L"720M", - L"730M", - L"740M", - L"745M", - L"820M", - L"830M", - L"840M", - L"845M", - L"920M", - L"930M", - L"940M", - L"945M", - L"1030", - L"MX110", - L"MX130", - L"MX150", - L"MX230", - L"MX250", - L"M520", - L"M500", - L"P500", - L"K620M" + L"720M", L"730M", L"740M", L"745M", L"820M", L"830M", + L"840M", L"845M", L"920M", L"930M", L"940M", L"945M", + L"1030", L"MX110", L"MX130", L"MX150", L"MX230", L"MX250", + L"M520", L"M500", L"P500", L"K620M", }; static const size_t num_blacklisted = @@ -202,7 +83,7 @@ return false; } -typedef HRESULT (WINAPI *create_dxgi_proc)(const IID *, IDXGIFactory1 **); +typedef HRESULT(WINAPI *create_dxgi_proc)(const IID *, IDXGIFactory1 **); static bool nvenc_device_available(void) { @@ -226,7 +107,7 @@ if (!create) { create = (create_dxgi_proc)GetProcAddress(dxgi, - "CreateDXGIFactory1"); + "CreateDXGIFactory1"); if (!create) { return true; } @@ -266,7 +147,9 @@ static bool nvenc_supported(void) { +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); +#endif profile_start(nvenc_check_name); @@ -319,13 +202,13 @@ extern void jim_nvenc_unload(void); #endif +#if ENABLE_FFMPEG_LOGGING +extern void obs_ffmpeg_load_logging(void); +extern void obs_ffmpeg_unload_logging(void); +#endif + bool obs_module_load(void) { - da_init(active_log_contexts); - da_init(cached_log_contexts); - - //av_log_set_callback(ffmpeg_log_callback); - obs_register_source(&ffmpeg_source); obs_register_output(&ffmpeg_output); obs_register_output(&ffmpeg_muxer); @@ -349,27 +232,19 @@ } #endif #endif + +#if ENABLE_FFMPEG_LOGGING + obs_ffmpeg_load_logging(); +#endif return true; } void obs_module_unload(void) { - av_log_set_callback(av_log_default_callback); - -#ifdef _WIN32 - pthread_mutex_destroy(&log_contexts_mutex); +#if ENABLE_FFMPEG_LOGGING + obs_ffmpeg_unload_logging(); #endif - for (size_t i = 0; i < active_log_contexts.num; i++) { - bfree(active_log_contexts.array[i]); - } - for (size_t i = 0; i < cached_log_contexts.num; i++) { - bfree(cached_log_contexts.array[i]); - } - - da_free(active_log_contexts); - da_free(cached_log_contexts); - #ifdef _WIN32 jim_nvenc_unload(); #endif
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/async-delay-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/async-delay-filter.c
Changed
@@ -9,28 +9,28 @@ #define MSEC_TO_NSEC 1000000ULL #endif -#define SETTING_DELAY_MS "delay_ms" +#define SETTING_DELAY_MS "delay_ms" -#define TEXT_DELAY_MS obs_module_text("DelayMs") +#define TEXT_DELAY_MS obs_module_text("DelayMs") struct async_delay_data { - obs_source_t *context; + obs_source_t *context; /* contains struct obs_source_frame* */ - struct circlebuf video_frames; + struct circlebuf video_frames; /* stores the audio data */ - struct circlebuf audio_frames; - struct obs_audio_data audio_output; - - uint64_t last_video_ts; - uint64_t last_audio_ts; - uint64_t interval; - uint64_t samplerate; - bool video_delay_reached; - bool audio_delay_reached; - bool reset_video; - bool reset_audio; + struct circlebuf audio_frames; + struct obs_audio_data audio_output; + + uint64_t last_video_ts; + uint64_t last_audio_ts; + uint64_t interval; + uint64_t samplerate; + bool video_delay_reached; + bool audio_delay_reached; + bool reset_video; + bool reset_audio; }; static const char *async_delay_filter_name(void *unused) @@ -40,13 +40,13 @@ } static void free_video_data(struct async_delay_data *filter, - obs_source_t *parent) + obs_source_t *parent) { while (filter->video_frames.size) { struct obs_source_frame *frame; circlebuf_pop_front(&filter->video_frames, &frame, - sizeof(struct obs_source_frame*)); + sizeof(struct obs_source_frame *)); obs_source_release_frame(parent, frame); } } @@ -64,7 +64,7 @@ struct obs_audio_data audio; circlebuf_pop_front(&filter->audio_frames, &audio, - sizeof(struct obs_audio_data)); + sizeof(struct obs_audio_data)); free_audio_packet(&audio); } } @@ -72,8 +72,9 @@ static void async_delay_filter_update(void *data, obs_data_t *settings) { struct async_delay_data *filter = data; - uint64_t new_interval = (uint64_t)obs_data_get_int(settings, - SETTING_DELAY_MS) * MSEC_TO_NSEC; + uint64_t new_interval = + (uint64_t)obs_data_get_int(settings, SETTING_DELAY_MS) * + MSEC_TO_NSEC; if (new_interval < filter->interval) free_video_data(filter, obs_filter_get_parent(filter->context)); @@ -86,7 +87,7 @@ } static void *async_delay_filter_create(obs_data_t *settings, - obs_source_t *context) + obs_source_t *context) { struct async_delay_data *filter = bzalloc(sizeof(*filter)); struct obs_audio_info oai; @@ -114,8 +115,9 @@ { obs_properties_t *props = obs_properties_create(); - obs_properties_add_int(props, SETTING_DELAY_MS, TEXT_DELAY_MS, - 0, 20000, 1); + obs_property_t *p = obs_properties_add_int(props, SETTING_DELAY_MS, + TEXT_DELAY_MS, 0, 20000, 1); + obs_property_int_set_suffix(p, " ms"); UNUSED_PARAMETER(data); return props; @@ -138,8 +140,8 @@ return ts < prev_ts || (ts - prev_ts) > SEC_TO_NSEC; } -static struct obs_source_frame *async_delay_filter_video(void *data, - struct obs_source_frame *frame) +static struct obs_source_frame * +async_delay_filter_video(void *data, struct obs_source_frame *frame) { struct async_delay_data *filter = data; obs_source_t *parent = obs_filter_get_parent(filter->context); @@ -156,16 +158,16 @@ filter->last_video_ts = frame->timestamp; circlebuf_push_back(&filter->video_frames, &frame, - sizeof(struct obs_source_frame*)); + sizeof(struct obs_source_frame *)); circlebuf_peek_front(&filter->video_frames, &output, - sizeof(struct obs_source_frame*)); + sizeof(struct obs_source_frame *)); cur_interval = frame->timestamp - output->timestamp; if (!filter->video_delay_reached && cur_interval < filter->interval) return NULL; circlebuf_pop_front(&filter->video_frames, NULL, - sizeof(struct obs_source_frame*)); + sizeof(struct obs_source_frame *)); if (!filter->video_delay_reached) filter->video_delay_reached = true; @@ -179,8 +181,8 @@ /* #define DELAY_AUDIO */ #ifdef DELAY_AUDIO -static struct obs_audio_data *async_delay_filter_audio(void *data, - struct obs_audio_data *audio) +static struct obs_audio_data * +async_delay_filter_audio(void *data, struct obs_audio_data *audio) { struct async_delay_data *filter = data; struct obs_audio_data cached = *audio; @@ -204,8 +206,8 @@ if (!audio->data[i]) break; - cached.data[i] = bmemdup(audio->data[i], - audio->frames * sizeof(float)); + cached.data[i] = + bmemdup(audio->data[i], audio->frames * sizeof(float)); } free_audio_packet(&filter->audio_output); @@ -228,17 +230,17 @@ #endif struct obs_source_info async_delay_filter = { - .id = "async_delay_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_ASYNC, - .get_name = async_delay_filter_name, - .create = async_delay_filter_create, - .destroy = async_delay_filter_destroy, - .update = async_delay_filter_update, - .get_properties = async_delay_filter_properties, - .filter_video = async_delay_filter_video, + .id = "async_delay_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_ASYNC, + .get_name = async_delay_filter_name, + .create = async_delay_filter_create, + .destroy = async_delay_filter_destroy, + .update = async_delay_filter_update, + .get_properties = async_delay_filter_properties, + .filter_video = async_delay_filter_video, #ifdef DELAY_AUDIO - .filter_audio = async_delay_filter_audio, + .filter_audio = async_delay_filter_audio, #endif - .filter_remove = async_delay_filter_remove + .filter_remove = async_delay_filter_remove, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/chroma-key-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/chroma-key-filter.c
Changed
@@ -3,6 +3,8 @@ #include <graphics/vec2.h> #include <graphics/vec4.h> +/* clang-format off */ + #define SETTING_OPACITY "opacity" #define SETTING_CONTRAST "contrast" #define SETTING_BRIGHTNESS "brightness" @@ -23,31 +25,33 @@ #define TEXT_SMOOTHNESS obs_module_text("Smoothness") #define TEXT_SPILL obs_module_text("ColorSpillReduction") +/* clang-format on */ + struct chroma_key_filter_data { - obs_source_t *context; - - gs_effect_t *effect; - - gs_eparam_t *color_param; - gs_eparam_t *contrast_param; - gs_eparam_t *brightness_param; - gs_eparam_t *gamma_param; - - gs_eparam_t *pixel_size_param; - gs_eparam_t *chroma_param; - gs_eparam_t *similarity_param; - gs_eparam_t *smoothness_param; - gs_eparam_t *spill_param; - - struct vec4 color; - float contrast; - float brightness; - float gamma; - - struct vec2 chroma; - float similarity; - float smoothness; - float spill; + obs_source_t *context; + + gs_effect_t *effect; + + gs_eparam_t *color_param; + gs_eparam_t *contrast_param; + gs_eparam_t *brightness_param; + gs_eparam_t *gamma_param; + + gs_eparam_t *pixel_size_param; + gs_eparam_t *chroma_param; + gs_eparam_t *similarity_param; + gs_eparam_t *smoothness_param; + gs_eparam_t *spill_param; + + struct vec4 color; + float contrast; + float brightness; + float gamma; + + struct vec2 chroma; + float similarity; + float smoothness; + float spill; }; static const char *chroma_key_name(void *unused) @@ -56,23 +60,23 @@ return obs_module_text("ChromaKeyFilter"); } -static const float yuv_mat[16] = {0.182586f, -0.100644f, 0.439216f, 0.0f, - 0.614231f, -0.338572f, -0.398942f, 0.0f, - 0.062007f, 0.439216f, -0.040274f, 0.0f, - 0.062745f, 0.501961f, 0.501961f, 1.0f}; +static const float yuv_mat[16] = {0.182586f, -0.100644f, 0.439216f, 0.0f, + 0.614231f, -0.338572f, -0.398942f, 0.0f, + 0.062007f, 0.439216f, -0.040274f, 0.0f, + 0.062745f, 0.501961f, 0.501961f, 1.0f}; -static inline void color_settings_update( - struct chroma_key_filter_data *filter, obs_data_t *settings) +static inline void color_settings_update(struct chroma_key_filter_data *filter, + obs_data_t *settings) { - uint32_t opacity = (uint32_t)obs_data_get_int(settings, - SETTING_OPACITY); + uint32_t opacity = + (uint32_t)obs_data_get_int(settings, SETTING_OPACITY); uint32_t color = 0xFFFFFF | (((opacity * 255) / 100) << 24); double contrast = obs_data_get_double(settings, SETTING_CONTRAST); double brightness = obs_data_get_double(settings, SETTING_BRIGHTNESS); double gamma = obs_data_get_double(settings, SETTING_GAMMA); - contrast = (contrast < 0.0) ? - (1.0 / (-contrast + 1.0)) : (contrast + 1.0); + contrast = (contrast < 0.0) ? (1.0 / (-contrast + 1.0)) + : (contrast + 1.0); brightness *= 0.5; @@ -85,16 +89,16 @@ vec4_from_rgba(&filter->color, color); } -static inline void chroma_settings_update( - struct chroma_key_filter_data *filter, obs_data_t *settings) +static inline void chroma_settings_update(struct chroma_key_filter_data *filter, + obs_data_t *settings) { int64_t similarity = obs_data_get_int(settings, SETTING_SIMILARITY); int64_t smoothness = obs_data_get_int(settings, SETTING_SMOOTHNESS); int64_t spill = obs_data_get_int(settings, SETTING_SPILL); - uint32_t key_color = (uint32_t)obs_data_get_int(settings, - SETTING_KEY_COLOR); - const char *key_type = obs_data_get_string(settings, - SETTING_COLOR_TYPE); + uint32_t key_color = + (uint32_t)obs_data_get_int(settings, SETTING_KEY_COLOR); + const char *key_type = + obs_data_get_string(settings, SETTING_COLOR_TYPE); struct vec4 key_rgb; struct vec4 key_color_v4; struct matrix4 yuv_mat_m4; @@ -150,24 +154,24 @@ filter->effect = gs_effect_create_from_file(effect_path, NULL); if (filter->effect) { - filter->color_param = gs_effect_get_param_by_name( - filter->effect, "color"); - filter->contrast_param = gs_effect_get_param_by_name( - filter->effect, "contrast"); + filter->color_param = + gs_effect_get_param_by_name(filter->effect, "color"); + filter->contrast_param = + gs_effect_get_param_by_name(filter->effect, "contrast"); filter->brightness_param = gs_effect_get_param_by_name( - filter->effect, "brightness"); - filter->gamma_param = gs_effect_get_param_by_name( - filter->effect, "gamma"); + filter->effect, "brightness"); + filter->gamma_param = + gs_effect_get_param_by_name(filter->effect, "gamma"); filter->chroma_param = gs_effect_get_param_by_name( - filter->effect, "chroma_key"); + filter->effect, "chroma_key"); filter->pixel_size_param = gs_effect_get_param_by_name( - filter->effect, "pixel_size"); + filter->effect, "pixel_size"); filter->similarity_param = gs_effect_get_param_by_name( - filter->effect, "similarity"); + filter->effect, "similarity"); filter->smoothness_param = gs_effect_get_param_by_name( - filter->effect, "smoothness"); - filter->spill_param = gs_effect_get_param_by_name( - filter->effect, "spill"); + filter->effect, "smoothness"); + filter->spill_param = + gs_effect_get_param_by_name(filter->effect, "spill"); } obs_leave_graphics(); @@ -192,7 +196,7 @@ struct vec2 pixel_size; if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_ALLOW_DIRECT_RENDERING)) + OBS_ALLOW_DIRECT_RENDERING)) return; vec2_set(&pixel_size, 1.0f / (float)width, 1.0f / (float)height); @@ -213,13 +217,13 @@ } static bool key_type_changed(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { const char *type = obs_data_get_string(settings, SETTING_COLOR_TYPE); bool custom = strcmp(type, "custom") == 0; obs_property_set_visible(obs_properties_get(props, SETTING_KEY_COLOR), - custom); + custom); UNUSED_PARAMETER(p); return true; @@ -229,9 +233,10 @@ { obs_properties_t *props = obs_properties_create(); - obs_property_t *p = obs_properties_add_list(props, - SETTING_COLOR_TYPE, TEXT_COLOR_TYPE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_property_t *p = obs_properties_add_list(props, SETTING_COLOR_TYPE, + TEXT_COLOR_TYPE, + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, obs_module_text("Green"), "green"); obs_property_list_add_string(p, obs_module_text("Blue"), "blue"); obs_property_list_add_string(p, obs_module_text("Magenta"), "magenta"); @@ -241,20 +246,20 @@ obs_properties_add_color(props, SETTING_KEY_COLOR, TEXT_KEY_COLOR); obs_properties_add_int_slider(props, SETTING_SIMILARITY, - TEXT_SIMILARITY, 1, 1000, 1); + TEXT_SIMILARITY, 1, 1000, 1); obs_properties_add_int_slider(props, SETTING_SMOOTHNESS, - TEXT_SMOOTHNESS, 1, 1000, 1); - obs_properties_add_int_slider(props, SETTING_SPILL, - TEXT_SPILL, 1, 1000, 1); - - obs_properties_add_int_slider(props, SETTING_OPACITY, TEXT_OPACITY, - 0, 100, 1); - obs_properties_add_float_slider(props, SETTING_CONTRAST, - TEXT_CONTRAST, -1.0, 1.0, 0.01); + TEXT_SMOOTHNESS, 1, 1000, 1); + obs_properties_add_int_slider(props, SETTING_SPILL, TEXT_SPILL, 1, 1000, + 1); + + obs_properties_add_int_slider(props, SETTING_OPACITY, TEXT_OPACITY, 0, + 100, 1); + obs_properties_add_float_slider(props, SETTING_CONTRAST, TEXT_CONTRAST, + -1.0, 1.0, 0.01); obs_properties_add_float_slider(props, SETTING_BRIGHTNESS, - TEXT_BRIGHTNESS, -1.0, 1.0, 0.01); - obs_properties_add_float_slider(props, SETTING_GAMMA, - TEXT_GAMMA, -1.0, 1.0, 0.01); + TEXT_BRIGHTNESS, -1.0, 1.0, 0.01); + obs_properties_add_float_slider(props, SETTING_GAMMA, TEXT_GAMMA, -1.0, + 1.0, 0.01); UNUSED_PARAMETER(data); return props; @@ -274,14 +279,14 @@ } struct obs_source_info chroma_key_filter = { - .id = "chroma_key_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = chroma_key_name, - .create = chroma_key_create, - .destroy = chroma_key_destroy, - .video_render = chroma_key_render, - .update = chroma_key_update, - .get_properties = chroma_key_properties, - .get_defaults = chroma_key_defaults + .id = "chroma_key_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = chroma_key_name, + .create = chroma_key_create, + .destroy = chroma_key_destroy, + .video_render = chroma_key_render, + .update = chroma_key_update, + .get_properties = chroma_key_properties, + .get_defaults = chroma_key_defaults, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/color-correction-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/color-correction-filter.c
Changed
@@ -18,6 +18,7 @@ #include <graphics/matrix4.h> #include <graphics/quat.h> +/* clang-format off */ #define SETTING_GAMMA "gamma" #define SETTING_CONTRAST "contrast" @@ -35,39 +36,41 @@ #define TEXT_OPACITY obs_module_text("Opacity") #define TEXT_COLOR obs_module_text("Color") +/* clang-format on */ + struct color_correction_filter_data { - obs_source_t *context; + obs_source_t *context; - gs_effect_t *effect; + gs_effect_t *effect; - gs_eparam_t *gamma_param; - gs_eparam_t *final_matrix_param; + gs_eparam_t *gamma_param; + gs_eparam_t *final_matrix_param; - struct vec3 gamma; - float contrast; - float brightness; - float saturation; - float hue_shift; - float opacity; - struct vec4 color; + struct vec3 gamma; + float contrast; + float brightness; + float saturation; + float hue_shift; + float opacity; + struct vec4 color; /* Pre-Computes */ - struct matrix4 con_matrix; - struct matrix4 bright_matrix; - struct matrix4 sat_matrix; - struct matrix4 hue_op_matrix; - struct matrix4 color_matrix; - struct matrix4 final_matrix; - - struct vec3 rot_quaternion; - float rot_quaternion_w; - struct vec3 cross; - struct vec3 square; - struct vec3 wimag; - struct vec3 diag; - struct vec3 a_line; - struct vec3 b_line; - struct vec3 half_unit; + struct matrix4 con_matrix; + struct matrix4 bright_matrix; + struct matrix4 sat_matrix; + struct matrix4 hue_op_matrix; + struct matrix4 color_matrix; + struct matrix4 final_matrix; + + struct vec3 rot_quaternion; + float rot_quaternion_w; + struct vec3 cross; + struct vec3 square; + struct vec3 wimag; + struct vec3 diag; + struct vec3 a_line; + struct vec3 b_line; + struct vec3 half_unit; }; static const float root3 = 0.57735f; @@ -101,22 +104,31 @@ vec3_set(&filter->gamma, (float)gamma, (float)gamma, (float)gamma); /* Build our contrast number. */ - filter->contrast = (float)obs_data_get_double(settings, - SETTING_CONTRAST) + 1.0f; + filter->contrast = + (float)obs_data_get_double(settings, SETTING_CONTRAST) + 1.0f; float one_minus_con = (1.0f - filter->contrast) / 2.0f; /* Now let's build our Contrast matrix. */ - filter->con_matrix = (struct matrix4) - { - filter->contrast, 0.0f, 0.0f, 0.0f, - 0.0f, filter->contrast, 0.0f, 0.0f, - 0.0f, 0.0f, filter->contrast, 0.0f, - one_minus_con, one_minus_con, one_minus_con, 1.0f - }; + filter->con_matrix = (struct matrix4){filter->contrast, + 0.0f, + 0.0f, + 0.0f, + 0.0f, + filter->contrast, + 0.0f, + 0.0f, + 0.0f, + 0.0f, + filter->contrast, + 0.0f, + one_minus_con, + one_minus_con, + one_minus_con, + 1.0f}; /* Build our brightness number. */ - filter->brightness = (float)obs_data_get_double(settings, - SETTING_BRIGHTNESS); + filter->brightness = + (float)obs_data_get_double(settings, SETTING_BRIGHTNESS); /* * Now let's build our Brightness matrix. @@ -129,49 +141,57 @@ filter->bright_matrix.t.z = filter->brightness; /* Build our Saturation number. */ - filter->saturation = (float)obs_data_get_double(settings, - SETTING_SATURATION) + 1.0f; + filter->saturation = + (float)obs_data_get_double(settings, SETTING_SATURATION) + 1.0f; /* Factor in the selected color weights. */ float one_minus_sat_red = (1.0f - filter->saturation) * red_weight; float one_minus_sat_green = (1.0f - filter->saturation) * green_weight; float one_minus_sat_blue = (1.0f - filter->saturation) * blue_weight; - float sat_val_red = one_minus_sat_red + filter->saturation; + float sat_val_red = one_minus_sat_red + filter->saturation; float sat_val_green = one_minus_sat_green + filter->saturation; - float sat_val_blue = one_minus_sat_blue + filter->saturation; + float sat_val_blue = one_minus_sat_blue + filter->saturation; /* Now we build our Saturation matrix. */ - filter->sat_matrix = (struct matrix4) - { - sat_val_red, one_minus_sat_red, one_minus_sat_red, 0.0f, - one_minus_sat_green, sat_val_green, one_minus_sat_green, 0.0f, - one_minus_sat_blue, one_minus_sat_blue, sat_val_blue, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - }; + filter->sat_matrix = (struct matrix4){sat_val_red, + one_minus_sat_red, + one_minus_sat_red, + 0.0f, + one_minus_sat_green, + sat_val_green, + one_minus_sat_green, + 0.0f, + one_minus_sat_blue, + one_minus_sat_blue, + sat_val_blue, + 0.0f, + 0.0f, + 0.0f, + 0.0f, + 1.0f}; /* Build our Hue number. */ - filter->hue_shift = (float)obs_data_get_double(settings, - SETTING_HUESHIFT); + filter->hue_shift = + (float)obs_data_get_double(settings, SETTING_HUESHIFT); /* Build our Transparency number. */ - filter->opacity = (float)obs_data_get_int(settings, - SETTING_OPACITY) * 0.01f; + filter->opacity = + (float)obs_data_get_int(settings, SETTING_OPACITY) * 0.01f; /* Hue is the radian of 0 to 360 degrees. */ float half_angle = 0.5f * (float)(filter->hue_shift / (180.0f / M_PI)); /* Pseudo-Quaternion To Matrix. */ float rot_quad1 = root3 * (float)sin(half_angle); - vec3_set(&filter->rot_quaternion, rot_quad1, rot_quad1, - rot_quad1); + vec3_set(&filter->rot_quaternion, rot_quad1, rot_quad1, rot_quad1); filter->rot_quaternion_w = (float)cos(half_angle); vec3_mul(&filter->cross, &filter->rot_quaternion, - &filter->rot_quaternion); + &filter->rot_quaternion); vec3_mul(&filter->square, &filter->rot_quaternion, - &filter->rot_quaternion); + &filter->rot_quaternion); vec3_mulf(&filter->wimag, &filter->rot_quaternion, - filter->rot_quaternion_w); + filter->rot_quaternion_w); vec3_mulf(&filter->square, &filter->square, 2.0f); vec3_sub(&filter->diag, &filter->half_unit, &filter->square); @@ -179,29 +199,28 @@ vec3_sub(&filter->b_line, &filter->cross, &filter->wimag); /* Now we build our Hue and Opacity matrix. */ - filter->hue_op_matrix = (struct matrix4) - { - filter->diag.x * 2.0f, - filter->b_line.z * 2.0f, - filter->a_line.y * 2.0f, - 0.0f, - - filter->a_line.z * 2.0f, - filter->diag.y * 2.0f, - filter->b_line.x * 2.0f, - 0.0f, - - filter->b_line.y * 2.0f, - filter->a_line.x * 2.0f, - filter->diag.z * 2.0f, - 0.0f, - - 0.0f, 0.0f, 0.0f, filter->opacity - }; + filter->hue_op_matrix = (struct matrix4){filter->diag.x * 2.0f, + filter->b_line.z * 2.0f, + filter->a_line.y * 2.0f, + 0.0f, + + filter->a_line.z * 2.0f, + filter->diag.y * 2.0f, + filter->b_line.x * 2.0f, + 0.0f, + + filter->b_line.y * 2.0f, + filter->a_line.x * 2.0f, + filter->diag.z * 2.0f, + 0.0f, + + 0.0f, + 0.0f, + 0.0f, + filter->opacity}; /* Now get the overlay color data. */ - uint32_t color = (uint32_t)obs_data_get_int(settings, - SETTING_COLOR); + uint32_t color = (uint32_t)obs_data_get_int(settings, SETTING_COLOR); vec4_from_rgba(&filter->color, color); /* @@ -214,26 +233,22 @@ filter->color_matrix.y.y = filter->color.y; filter->color_matrix.z.z = filter->color.z; - filter->color_matrix.t.x = filter->color.w * - filter->color.x; - filter->color_matrix.t.y = filter->color.w * - filter->color.y; - filter->color_matrix.t.z = filter->color.w * - filter->color.z; - + filter->color_matrix.t.x = filter->color.w * filter->color.x; + filter->color_matrix.t.y = filter->color.w * filter->color.y; + filter->color_matrix.t.z = filter->color.w * filter->color.z; /* First we apply the Contrast & Brightness matrix. */ matrix4_mul(&filter->final_matrix, &filter->bright_matrix, - &filter->con_matrix); + &filter->con_matrix); /* Now we apply the Saturation matrix. */ matrix4_mul(&filter->final_matrix, &filter->final_matrix, - &filter->sat_matrix); + &filter->sat_matrix); /* Next we apply the Hue+Opacity matrix. */ matrix4_mul(&filter->final_matrix, &filter->final_matrix, - &filter->hue_op_matrix); + &filter->hue_op_matrix); /* Lastly we apply the Color Wash matrix. */ matrix4_mul(&filter->final_matrix, &filter->final_matrix, - &filter->color_matrix); + &filter->color_matrix); } /* @@ -261,7 +276,7 @@ * actual rendering code. */ static void *color_correction_filter_create(obs_data_t *settings, - obs_source_t *context) + obs_source_t *context) { /* * Because of limitations of pre-c99 compilers, you can't create an @@ -294,9 +309,9 @@ /* If the filter is active pass the parameters to the filter. */ if (filter->effect) { filter->gamma_param = gs_effect_get_param_by_name( - filter->effect, SETTING_GAMMA); + filter->effect, SETTING_GAMMA); filter->final_matrix_param = gs_effect_get_param_by_name( - filter->effect, "color_matrix"); + filter->effect, "color_matrix"); } obs_leave_graphics(); @@ -328,12 +343,13 @@ struct color_correction_filter_data *filter = data; if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_ALLOW_DIRECT_RENDERING)) + OBS_ALLOW_DIRECT_RENDERING)) return; /* Now pass the interface variables to the .effect file. */ gs_effect_set_vec3(filter->gamma_param, &filter->gamma); - gs_effect_set_matrix4(filter->final_matrix_param, &filter->final_matrix); + gs_effect_set_matrix4(filter->final_matrix_param, + &filter->final_matrix); obs_source_process_filter_end(filter->context, filter->effect, 0, 0); @@ -350,19 +366,19 @@ { obs_properties_t *props = obs_properties_create(); - obs_properties_add_float_slider(props, SETTING_GAMMA, - TEXT_GAMMA, -3.0, 3.0, 0.01); + obs_properties_add_float_slider(props, SETTING_GAMMA, TEXT_GAMMA, -3.0, + 3.0, 0.01); - obs_properties_add_float_slider(props, SETTING_CONTRAST, - TEXT_CONTRAST, -2.0, 2.0, 0.01); + obs_properties_add_float_slider(props, SETTING_CONTRAST, TEXT_CONTRAST, + -2.0, 2.0, 0.01); obs_properties_add_float_slider(props, SETTING_BRIGHTNESS, - TEXT_BRIGHTNESS, -1.0, 1.0, 0.01); + TEXT_BRIGHTNESS, -1.0, 1.0, 0.01); obs_properties_add_float_slider(props, SETTING_SATURATION, - TEXT_SATURATION, -1.0, 5.0, 0.01); - obs_properties_add_float_slider(props, SETTING_HUESHIFT, - TEXT_HUESHIFT, -180.0, 180.0, 0.01); - obs_properties_add_int_slider(props, SETTING_OPACITY, - TEXT_OPACITY, 0, 100, 1); + TEXT_SATURATION, -1.0, 5.0, 0.01); + obs_properties_add_float_slider(props, SETTING_HUESHIFT, TEXT_HUESHIFT, + -180.0, 180.0, 0.01); + obs_properties_add_int_slider(props, SETTING_OPACITY, TEXT_OPACITY, 0, + 100, 1); obs_properties_add_color(props, SETTING_COLOR, TEXT_COLOR); @@ -382,8 +398,7 @@ obs_data_set_default_double(settings, SETTING_GAMMA, 0.0); obs_data_set_default_double(settings, SETTING_CONTRAST, 0.0); obs_data_set_default_double(settings, SETTING_BRIGHTNESS, 0.0); - obs_data_set_default_double(settings, - SETTING_SATURATION, 0.0); + obs_data_set_default_double(settings, SETTING_SATURATION, 0.0); obs_data_set_default_double(settings, SETTING_HUESHIFT, 0.0); obs_data_set_default_double(settings, SETTING_OPACITY, 100.0); obs_data_set_default_int(settings, SETTING_COLOR, 0xFFFFFF); @@ -409,5 +424,5 @@ .video_render = color_correction_filter_render, .update = color_correction_filter_update, .get_properties = color_correction_filter_properties, - .get_defaults = color_correction_filter_defaults + .get_defaults = color_correction_filter_defaults, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/color-grade-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/color-grade-filter.c
Changed
@@ -2,20 +2,24 @@ #include <graphics/image-file.h> #include <util/dstr.h> +/* clang-format off */ + #define SETTING_IMAGE_PATH "image_path" #define SETTING_CLUT_AMOUNT "clut_amount" #define TEXT_IMAGE_PATH obs_module_text("Path") #define TEXT_AMOUNT obs_module_text("Amount") +/* clang-format on */ + struct lut_filter_data { - obs_source_t *context; - gs_effect_t *effect; - gs_texture_t *target; - gs_image_file_t image; + obs_source_t *context; + gs_effect_t *effect; + gs_texture_t *target; + gs_image_file_t image; - char *file; - float clut_amount; + char *file; + float clut_amount; }; static const char *color_grade_filter_get_name(void *unused) @@ -89,9 +93,9 @@ dstr_resize(&path, slash - path.array + 1); obs_properties_add_path(props, SETTING_IMAGE_PATH, TEXT_IMAGE_PATH, - OBS_PATH_FILE, filter_str.array, path.array); - obs_properties_add_float_slider(props, SETTING_CLUT_AMOUNT, - TEXT_AMOUNT, 0, 1, 0.01); + OBS_PATH_FILE, filter_str.array, path.array); + obs_properties_add_float_slider(props, SETTING_CLUT_AMOUNT, TEXT_AMOUNT, + 0, 1, 0.01); dstr_free(&filter_str); dstr_free(&path); @@ -100,8 +104,8 @@ return props; } -static void *color_grade_filter_create( - obs_data_t *settings, obs_source_t *context) +static void *color_grade_filter_create(obs_data_t *settings, + obs_source_t *context) { struct lut_filter_data *filter = bzalloc(sizeof(struct lut_filter_data)); @@ -136,7 +140,7 @@ } if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_ALLOW_DIRECT_RENDERING)) + OBS_ALLOW_DIRECT_RENDERING)) return; param = gs_effect_get_param_by_name(filter->effect, "clut"); @@ -151,14 +155,14 @@ } struct obs_source_info color_grade_filter = { - .id = "clut_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = color_grade_filter_get_name, - .create = color_grade_filter_create, - .destroy = color_grade_filter_destroy, - .update = color_grade_filter_update, - .get_defaults = color_grade_filter_defaults, - .get_properties = color_grade_filter_properties, - .video_render = color_grade_filter_render + .id = "clut_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = color_grade_filter_get_name, + .create = color_grade_filter_create, + .destroy = color_grade_filter_destroy, + .update = color_grade_filter_update, + .get_defaults = color_grade_filter_defaults, + .get_properties = color_grade_filter_properties, + .video_render = color_grade_filter_render, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/color-key-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/color-key-filter.c
Changed
@@ -3,6 +3,8 @@ #include <graphics/vec2.h> #include <graphics/vec4.h> +/* clang-format off */ + #define SETTING_OPACITY "opacity" #define SETTING_CONTRAST "contrast" #define SETTING_BRIGHTNESS "brightness" @@ -21,28 +23,30 @@ #define TEXT_SIMILARITY obs_module_text("Similarity") #define TEXT_SMOOTHNESS obs_module_text("Smoothness") +/* clang-format on */ + struct color_key_filter_data { - obs_source_t *context; + obs_source_t *context; - gs_effect_t *effect; + gs_effect_t *effect; - gs_eparam_t *color_param; - gs_eparam_t *contrast_param; - gs_eparam_t *brightness_param; - gs_eparam_t *gamma_param; + gs_eparam_t *color_param; + gs_eparam_t *contrast_param; + gs_eparam_t *brightness_param; + gs_eparam_t *gamma_param; - gs_eparam_t *key_color_param; - gs_eparam_t *similarity_param; - gs_eparam_t *smoothness_param; + gs_eparam_t *key_color_param; + gs_eparam_t *similarity_param; + gs_eparam_t *smoothness_param; - struct vec4 color; - float contrast; - float brightness; - float gamma; + struct vec4 color; + float contrast; + float brightness; + float gamma; - struct vec4 key_color; - float similarity; - float smoothness; + struct vec4 key_color; + float similarity; + float smoothness; }; static const char *color_key_name(void *unused) @@ -51,18 +55,18 @@ return obs_module_text("ColorKeyFilter"); } -static inline void color_settings_update( - struct color_key_filter_data *filter, obs_data_t *settings) +static inline void color_settings_update(struct color_key_filter_data *filter, + obs_data_t *settings) { - uint32_t opacity = (uint32_t)obs_data_get_int(settings, - SETTING_OPACITY); + uint32_t opacity = + (uint32_t)obs_data_get_int(settings, SETTING_OPACITY); uint32_t color = 0xFFFFFF | (((opacity * 255) / 100) << 24); double contrast = obs_data_get_double(settings, SETTING_CONTRAST); double brightness = obs_data_get_double(settings, SETTING_BRIGHTNESS); double gamma = obs_data_get_double(settings, SETTING_GAMMA); - contrast = (contrast < 0.0) ? - (1.0 / (-contrast + 1.0)) : (contrast + 1.0); + contrast = (contrast < 0.0) ? (1.0 / (-contrast + 1.0)) + : (contrast + 1.0); brightness *= 0.5; @@ -75,15 +79,15 @@ vec4_from_rgba(&filter->color, color); } -static inline void key_settings_update( - struct color_key_filter_data *filter, obs_data_t *settings) +static inline void key_settings_update(struct color_key_filter_data *filter, + obs_data_t *settings) { int64_t similarity = obs_data_get_int(settings, SETTING_SIMILARITY); int64_t smoothness = obs_data_get_int(settings, SETTING_SMOOTHNESS); - uint32_t key_color = (uint32_t)obs_data_get_int(settings, - SETTING_KEY_COLOR); - const char *key_type = obs_data_get_string(settings, - SETTING_COLOR_TYPE); + uint32_t key_color = + (uint32_t)obs_data_get_int(settings, SETTING_KEY_COLOR); + const char *key_type = + obs_data_get_string(settings, SETTING_COLOR_TYPE); if (strcmp(key_type, "green") == 0) key_color = 0x00FF00; @@ -133,20 +137,20 @@ filter->effect = gs_effect_create_from_file(effect_path, NULL); if (filter->effect) { - filter->color_param = gs_effect_get_param_by_name( - filter->effect, "color"); - filter->contrast_param = gs_effect_get_param_by_name( - filter->effect, "contrast"); + filter->color_param = + gs_effect_get_param_by_name(filter->effect, "color"); + filter->contrast_param = + gs_effect_get_param_by_name(filter->effect, "contrast"); filter->brightness_param = gs_effect_get_param_by_name( - filter->effect, "brightness"); - filter->gamma_param = gs_effect_get_param_by_name( - filter->effect, "gamma"); + filter->effect, "brightness"); + filter->gamma_param = + gs_effect_get_param_by_name(filter->effect, "gamma"); filter->key_color_param = gs_effect_get_param_by_name( - filter->effect, "key_color"); + filter->effect, "key_color"); filter->similarity_param = gs_effect_get_param_by_name( - filter->effect, "similarity"); + filter->effect, "similarity"); filter->smoothness_param = gs_effect_get_param_by_name( - filter->effect, "smoothness"); + filter->effect, "smoothness"); } obs_leave_graphics(); @@ -167,7 +171,7 @@ struct color_key_filter_data *filter = data; if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_ALLOW_DIRECT_RENDERING)) + OBS_ALLOW_DIRECT_RENDERING)) return; gs_effect_set_vec4(filter->color_param, &filter->color); @@ -184,13 +188,13 @@ } static bool key_type_changed(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { const char *type = obs_data_get_string(settings, SETTING_COLOR_TYPE); bool custom = strcmp(type, "custom") == 0; obs_property_set_visible(obs_properties_get(props, SETTING_KEY_COLOR), - custom); + custom); UNUSED_PARAMETER(p); return true; @@ -200,32 +204,33 @@ { obs_properties_t *props = obs_properties_create(); - obs_property_t *p = obs_properties_add_list(props, - SETTING_COLOR_TYPE, TEXT_COLOR_TYPE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_property_t *p = obs_properties_add_list(props, SETTING_COLOR_TYPE, + TEXT_COLOR_TYPE, + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, obs_module_text("Green"), "green"); obs_property_list_add_string(p, obs_module_text("Blue"), "blue"); obs_property_list_add_string(p, obs_module_text("Red"), "red"); obs_property_list_add_string(p, obs_module_text("Magenta"), "magenta"); obs_property_list_add_string(p, obs_module_text("CustomColor"), - "custom"); + "custom"); obs_property_set_modified_callback(p, key_type_changed); obs_properties_add_color(props, SETTING_KEY_COLOR, TEXT_KEY_COLOR); obs_properties_add_int_slider(props, SETTING_SIMILARITY, - TEXT_SIMILARITY, 1, 1000, 1); + TEXT_SIMILARITY, 1, 1000, 1); obs_properties_add_int_slider(props, SETTING_SMOOTHNESS, - TEXT_SMOOTHNESS, 1, 1000, 1); + TEXT_SMOOTHNESS, 1, 1000, 1); - obs_properties_add_int_slider(props, SETTING_OPACITY, TEXT_OPACITY, - 0, 100, 1); - obs_properties_add_float_slider(props, SETTING_CONTRAST, - TEXT_CONTRAST, -1.0, 1.0, 0.01); + obs_properties_add_int_slider(props, SETTING_OPACITY, TEXT_OPACITY, 0, + 100, 1); + obs_properties_add_float_slider(props, SETTING_CONTRAST, TEXT_CONTRAST, + -1.0, 1.0, 0.01); obs_properties_add_float_slider(props, SETTING_BRIGHTNESS, - TEXT_BRIGHTNESS, -1.0, 1.0, 0.01); - obs_properties_add_float_slider(props, SETTING_GAMMA, - TEXT_GAMMA, -1.0, 1.0, 0.01); + TEXT_BRIGHTNESS, -1.0, 1.0, 0.01); + obs_properties_add_float_slider(props, SETTING_GAMMA, TEXT_GAMMA, -1.0, + 1.0, 0.01); UNUSED_PARAMETER(data); return props; @@ -244,14 +249,14 @@ } struct obs_source_info color_key_filter = { - .id = "color_key_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = color_key_name, - .create = color_key_create, - .destroy = color_key_destroy, - .video_render = color_key_render, - .update = color_key_update, - .get_properties = color_key_properties, - .get_defaults = color_key_defaults + .id = "color_key_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = color_key_name, + .create = color_key_create, + .destroy = color_key_destroy, + .video_render = color_key_render, + .update = color_key_update, + .get_properties = color_key_properties, + .get_defaults = color_key_defaults, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/compressor-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/compressor-filter.c
Changed
@@ -10,21 +10,23 @@ /* -------------------------------------------------------- */ -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[compressor: '%s'] " format, \ - obs_source_get_name(cd->context), ##__VA_ARGS__) + obs_source_get_name(cd->context), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) #ifdef _DEBUG -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) #else #define debug(format, ...) #endif /* -------------------------------------------------------- */ +/* clang-format off */ + #define S_RATIO "ratio" #define S_THRESHOLD "threshold" #define S_ATTACK_TIME "attack_time" @@ -54,6 +56,8 @@ #define MS_IN_S 1000 #define MS_IN_S_F ((float)MS_IN_S) +/* clang-format on */ + /* -------------------------------------------------------- */ struct compressor_data { @@ -93,7 +97,7 @@ } static inline void get_sidechain_data(struct compressor_data *cd, - const uint32_t num_samples) + const uint32_t num_samples) { size_t data_size = cd->envelope_buf_len * sizeof(float); if (!data_size) @@ -110,7 +114,7 @@ for (size_t i = 0; i < cd->num_channels; i++) circlebuf_pop_front(&cd->sidechain_data[i], - cd->sidechain_buf[i], data_size); + cd->sidechain_buf[i], data_size); pthread_mutex_unlock(&cd->sidechain_mutex); return; @@ -126,8 +130,8 @@ cd->envelope_buf = brealloc(cd->envelope_buf, len * sizeof(float)); for (size_t i = 0; i < cd->num_channels; i++) - cd->sidechain_buf[i] = brealloc(cd->sidechain_buf[i], - len * sizeof(float)); + cd->sidechain_buf[i] = + brealloc(cd->sidechain_buf[i], len * sizeof(float)); } static inline float gain_coefficient(uint32_t sample_rate, float time) @@ -142,7 +146,7 @@ } static void sidechain_capture(void *param, obs_source_t *source, - const struct audio_data *audio_data, bool muted) + const struct audio_data *audio_data, bool muted) { struct compressor_data *cd = param; @@ -161,20 +165,21 @@ if (cd->sidechain_data[0].size > expected_size * 2) { for (size_t i = 0; i < cd->num_channels; i++) { circlebuf_pop_front(&cd->sidechain_data[i], NULL, - expected_size); + expected_size); } } if (muted) { for (size_t i = 0; i < cd->num_channels; i++) { circlebuf_push_back_zero(&cd->sidechain_data[i], - audio_data->frames * sizeof(float)); + audio_data->frames * + sizeof(float)); } } else { for (size_t i = 0; i < cd->num_channels; i++) { circlebuf_push_back(&cd->sidechain_data[i], - audio_data->data[i], - audio_data->frames * sizeof(float)); + audio_data->data[i], + audio_data->frames * sizeof(float)); } } @@ -188,30 +193,27 @@ const uint32_t sample_rate = audio_output_get_sample_rate(obs_get_audio()); - const size_t num_channels = - audio_output_get_channels(obs_get_audio()); - const float attack_time_ms = - (float)obs_data_get_int(s, S_ATTACK_TIME); + const size_t num_channels = audio_output_get_channels(obs_get_audio()); + const float attack_time_ms = (float)obs_data_get_int(s, S_ATTACK_TIME); const float release_time_ms = (float)obs_data_get_int(s, S_RELEASE_TIME); const float output_gain_db = (float)obs_data_get_double(s, S_OUTPUT_GAIN); - const char *sidechain_name = - obs_data_get_string(s, S_SIDECHAIN_SOURCE); + const char *sidechain_name = obs_data_get_string(s, S_SIDECHAIN_SOURCE); cd->ratio = (float)obs_data_get_double(s, S_RATIO); cd->threshold = (float)obs_data_get_double(s, S_THRESHOLD); - cd->attack_gain = gain_coefficient(sample_rate, - attack_time_ms / MS_IN_S_F); - cd->release_gain = gain_coefficient(sample_rate, - release_time_ms / MS_IN_S_F); + cd->attack_gain = + gain_coefficient(sample_rate, attack_time_ms / MS_IN_S_F); + cd->release_gain = + gain_coefficient(sample_rate, release_time_ms / MS_IN_S_F); cd->output_gain = db_to_mul(output_gain_db); cd->num_channels = num_channels; cd->sample_rate = sample_rate; cd->slope = 1.0f - (1.0f / cd->ratio); - bool valid_sidechain = - *sidechain_name && strcmp(sidechain_name, "none") != 0; + bool valid_sidechain = *sidechain_name && + strcmp(sidechain_name, "none") != 0; obs_weak_source_t *old_weak_sidechain = NULL; pthread_mutex_lock(&cd->sidechain_update_mutex); @@ -246,8 +248,8 @@ obs_weak_source_get_source(old_weak_sidechain); if (old_sidechain) { - obs_source_remove_audio_capture_callback(old_sidechain, - sidechain_capture, cd); + obs_source_remove_audio_capture_callback( + old_sidechain, sidechain_capture, cd); obs_source_release(old_sidechain); } @@ -288,8 +290,8 @@ if (cd->weak_sidechain) { obs_source_t *sidechain = get_sidechain(cd); if (sidechain) { - obs_source_remove_audio_capture_callback(sidechain, - sidechain_capture, cd); + obs_source_remove_audio_capture_callback( + sidechain, sidechain_capture, cd); obs_source_release(sidechain); } @@ -308,8 +310,8 @@ bfree(cd); } -static void analyze_envelope(struct compressor_data *cd, - float **samples, const uint32_t num_samples) +static void analyze_envelope(struct compressor_data *cd, float **samples, + const uint32_t num_samples) { if (cd->envelope_buf_len < num_samples) { resize_env_buffer(cd, num_samples); @@ -339,7 +341,7 @@ } static void analyze_sidechain(struct compressor_data *cd, - const uint32_t num_samples) + const uint32_t num_samples) { if (cd->envelope_buf_len < num_samples) { resize_env_buffer(cd, num_samples); @@ -359,7 +361,7 @@ float *envelope_buf = cd->envelope_buf; float env = cd->envelope; for (uint32_t i = 0; i < num_samples; ++i) { - const float env_in = fabsf(sidechain_buf[chan][i]); + const float env_in = fabsf(sidechain_buf[chan][i]); if (env < env_in) { env = env_in + attack_gain * (env - env_in); @@ -373,7 +375,7 @@ } static inline void process_compression(const struct compressor_data *cd, - float **samples, uint32_t num_samples) + float **samples, uint32_t num_samples) { for (size_t i = 0; i < num_samples; ++i) { const float env_db = mul_to_db(cd->envelope_buf[i]); @@ -407,10 +409,12 @@ pthread_mutex_unlock(&cd->sidechain_update_mutex); if (new_name) { - obs_source_t *sidechain = new_name && *new_name ? - obs_get_source_by_name(new_name) : NULL; - obs_weak_source_t *weak_sidechain = sidechain ? - obs_source_get_weak_source(sidechain) : NULL; + obs_source_t *sidechain = + new_name && *new_name ? obs_get_source_by_name(new_name) + : NULL; + obs_weak_source_t *weak_sidechain = + sidechain ? obs_source_get_weak_source(sidechain) + : NULL; pthread_mutex_lock(&cd->sidechain_update_mutex); @@ -423,8 +427,8 @@ pthread_mutex_unlock(&cd->sidechain_update_mutex); if (sidechain) { - obs_source_add_audio_capture_callback(sidechain, - sidechain_capture, cd); + obs_source_add_audio_capture_callback( + sidechain, sidechain_capture, cd); obs_weak_source_release(weak_sidechain); obs_source_release(sidechain); @@ -436,8 +440,8 @@ UNUSED_PARAMETER(seconds); } -static struct obs_audio_data *compressor_filter_audio(void *data, - struct obs_audio_data *audio) +static struct obs_audio_data * +compressor_filter_audio(void *data, struct obs_audio_data *audio) { struct compressor_data *cd = data; @@ -445,7 +449,7 @@ if (num_samples == 0) return audio; - float **samples = (float**)audio->data; + float **samples = (float **)audio->data; pthread_mutex_lock(&cd->sidechain_update_mutex); obs_weak_source_t *weak_sidechain = cd->weak_sidechain; @@ -495,24 +499,35 @@ struct compressor_data *cd = data; obs_properties_t *props = obs_properties_create(); obs_source_t *parent = NULL; + obs_property_t *p; if (cd) parent = obs_filter_get_parent(cd->context); - obs_properties_add_float_slider(props, S_RATIO, - TEXT_RATIO, MIN_RATIO, MAX_RATIO, 0.5); - obs_properties_add_float_slider(props, S_THRESHOLD, - TEXT_THRESHOLD, MIN_THRESHOLD_DB, MAX_THRESHOLD_DB, 0.1); - obs_properties_add_int_slider(props, S_ATTACK_TIME, - TEXT_ATTACK_TIME, MIN_ATK_RLS_MS, MAX_ATK_MS, 1); - obs_properties_add_int_slider(props, S_RELEASE_TIME, - TEXT_RELEASE_TIME, MIN_ATK_RLS_MS, MAX_RLS_MS, 1); - obs_properties_add_float_slider(props, S_OUTPUT_GAIN, - TEXT_OUTPUT_GAIN, MIN_OUTPUT_GAIN_DB, MAX_OUTPUT_GAIN_DB, 0.1); - - obs_property_t *sources = obs_properties_add_list(props, - S_SIDECHAIN_SOURCE, TEXT_SIDECHAIN_SOURCE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + p = obs_properties_add_float_slider(props, S_RATIO, TEXT_RATIO, + MIN_RATIO, MAX_RATIO, 0.5); + obs_property_float_set_suffix(p, ":1"); + p = obs_properties_add_float_slider(props, S_THRESHOLD, TEXT_THRESHOLD, + MIN_THRESHOLD_DB, MAX_THRESHOLD_DB, + 0.1); + obs_property_float_set_suffix(p, " dB"); + p = obs_properties_add_int_slider(props, S_ATTACK_TIME, + TEXT_ATTACK_TIME, MIN_ATK_RLS_MS, + MAX_ATK_MS, 1); + obs_property_int_set_suffix(p, " ms"); + p = obs_properties_add_int_slider(props, S_RELEASE_TIME, + TEXT_RELEASE_TIME, MIN_ATK_RLS_MS, + MAX_RLS_MS, 1); + obs_property_int_set_suffix(p, " ms"); + p = obs_properties_add_float_slider(props, S_OUTPUT_GAIN, + TEXT_OUTPUT_GAIN, + MIN_OUTPUT_GAIN_DB, + MAX_OUTPUT_GAIN_DB, 0.1); + obs_property_float_set_suffix(p, " dB"); + + obs_property_t *sources = obs_properties_add_list( + props, S_SIDECHAIN_SOURCE, TEXT_SIDECHAIN_SOURCE, + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(sources, obs_module_text("None"), "none");
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/crop-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/crop-filter.c
Changed
@@ -2,24 +2,24 @@ #include <graphics/vec2.h> struct crop_filter_data { - obs_source_t *context; - - gs_effect_t *effect; - gs_eparam_t *param_mul; - gs_eparam_t *param_add; - - int left; - int right; - int top; - int bottom; - int abs_cx; - int abs_cy; - int width; - int height; - bool absolute; - - struct vec2 mul_val; - struct vec2 add_val; + obs_source_t *context; + + gs_effect_t *effect; + gs_eparam_t *param_mul; + gs_eparam_t *param_add; + + int left; + int right; + int top; + int bottom; + int abs_cx; + int abs_cy; + int width; + int height; + bool absolute; + + struct vec2 mul_val; + struct vec2 add_val; }; static const char *crop_filter_get_name(void *unused) @@ -46,10 +46,10 @@ return NULL; } - filter->param_mul = gs_effect_get_param_by_name(filter->effect, - "mul_val"); - filter->param_add = gs_effect_get_param_by_name(filter->effect, - "add_val"); + filter->param_mul = + gs_effect_get_param_by_name(filter->effect, "mul_val"); + filter->param_add = + gs_effect_get_param_by_name(filter->effect, "add_val"); obs_source_update(context, settings); return filter; @@ -80,14 +80,16 @@ } static bool relative_clicked(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { bool relative = obs_data_get_bool(settings, "relative"); obs_property_set_description(obs_properties_get(props, "left"), - relative ? obs_module_text("Crop.Left") : "X"); + relative ? obs_module_text("Crop.Left") + : "X"); obs_property_set_description(obs_properties_get(props, "top"), - relative ? obs_module_text("Crop.Top") : "Y"); + relative ? obs_module_text("Crop.Top") + : "Y"); obs_property_set_visible(obs_properties_get(props, "right"), relative); obs_property_set_visible(obs_properties_get(props, "bottom"), relative); @@ -102,23 +104,23 @@ { obs_properties_t *props = obs_properties_create(); - obs_property_t *p = obs_properties_add_bool(props, "relative", - obs_module_text("Crop.Relative")); + obs_property_t *p = obs_properties_add_bool( + props, "relative", obs_module_text("Crop.Relative")); obs_property_set_modified_callback(p, relative_clicked); obs_properties_add_int(props, "left", obs_module_text("Crop.Left"), - -8192, 8192, 1); - obs_properties_add_int(props, "top", obs_module_text("Crop.Top"), - -8192, 8192, 1); + -8192, 8192, 1); + obs_properties_add_int(props, "top", obs_module_text("Crop.Top"), -8192, + 8192, 1); obs_properties_add_int(props, "right", obs_module_text("Crop.Right"), - -8192, 8192, 1); + -8192, 8192, 1); obs_properties_add_int(props, "bottom", obs_module_text("Crop.Bottom"), - -8192, 8192, 1); - obs_properties_add_int(props, "cx", obs_module_text("Crop.Width"), - 0, 8192, 1); - obs_properties_add_int(props, "cy", obs_module_text("Crop.Height"), - 0, 8192, 1); + -8192, 8192, 1); + obs_properties_add_int(props, "cx", obs_module_text("Crop.Width"), 0, + 8192, 1); + obs_properties_add_int(props, "cy", obs_module_text("Crop.Height"), 0, + 8192, 1); UNUSED_PARAMETER(data); return props; @@ -130,7 +132,7 @@ } static void calc_crop_dimensions(struct crop_filter_data *filter, - struct vec2 *mul_val, struct vec2 *add_val) + struct vec2 *mul_val, struct vec2 *add_val) { obs_source_t *target = obs_filter_get_target(filter->context); uint32_t width; @@ -146,15 +148,17 @@ } if (filter->absolute) { - filter->width = filter->abs_cx; + filter->width = filter->abs_cx; filter->height = filter->abs_cy; } else { - filter->width = (int)width - filter->left - filter->right; + filter->width = (int)width - filter->left - filter->right; filter->height = (int)height - filter->top - filter->bottom; } - if (filter->width < 1) filter->width = 1; - if (filter->height < 1) filter->height = 1; + if (filter->width < 1) + filter->width = 1; + if (filter->height < 1) + filter->height = 1; if (width && filter->width) { mul_val->x = (float)filter->width / (float)width; @@ -183,14 +187,14 @@ struct crop_filter_data *filter = data; if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_NO_DIRECT_RENDERING)) + OBS_NO_DIRECT_RENDERING)) return; gs_effect_set_vec2(filter->param_mul, &filter->mul_val); gs_effect_set_vec2(filter->param_add, &filter->add_val); obs_source_process_filter_end(filter->context, filter->effect, - filter->width, filter->height); + filter->width, filter->height); UNUSED_PARAMETER(effect); } @@ -208,17 +212,17 @@ } struct obs_source_info crop_filter = { - .id = "crop_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = crop_filter_get_name, - .create = crop_filter_create, - .destroy = crop_filter_destroy, - .update = crop_filter_update, - .get_properties = crop_filter_properties, - .get_defaults = crop_filter_defaults, - .video_tick = crop_filter_tick, - .video_render = crop_filter_render, - .get_width = crop_filter_width, - .get_height = crop_filter_height + .id = "crop_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = crop_filter_get_name, + .create = crop_filter_create, + .destroy = crop_filter_destroy, + .update = crop_filter_update, + .get_properties = crop_filter_properties, + .get_defaults = crop_filter_defaults, + .video_tick = crop_filter_tick, + .video_render = crop_filter_render, + .get_width = crop_filter_width, + .get_height = crop_filter_height, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/bg-BG.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/bg-BG.ini
Changed
@@ -1,4 +1,36 @@ +ColorFilter="Корекция на цвета" +AsyncDelayFilter="Забавяне на видеото (асинхронно)" +InvertPolarity="Преобръщане на полярността" +DelayMs="Забавяне (в милисекунди)" +Type="Вид" +Path="Път" +Color="Цвят" +Opacity="Прозиране" +Contrast="Контраст" +Brightness="Яркост" +Gamma="Гама" +BrowsePath.Images="Всички файлове с изображения" +BrowsePath.AllFiles="Всички файлове" +KeyColor="Цвят на ключа" +Similarity="Подобност (1-1000)" +Smoothness="Гладкост (1-1000)" +ScrollFilter.SpeedX="Водоравна бързина" +ScrollFilter.SpeedY="Отвесна бързина" +CustomColor="Подбиране на цвят" +Resolution="Разд. способност" +ScaleFiltering.Point="Точково" +ScaleFiltering.Bilinear="Двулинейно" +ScaleFiltering.Bicubic="Бикубично" +ScaleFiltering.Lanczos="Ланцош" +ScaleFiltering.Area="Област" +Saturation="Наситеност" +Compressor="Компресор" +Compressor.Ratio="Съотношение (X:1)" Limiter="Ограничител" Limiter.Threshold="Праг на отсичане (dB)" Limiter.ReleaseTime="Време за отговор (мс)" +Expander.Ratio="Съотношение (X:1)" +Expander.Presets="Образци" +Expander.Presets.Expander="Експандър" +Expander.Presets.Gate="Порта"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/de-DE.ini
Changed
@@ -1,6 +1,6 @@ ColorFilter="Farbkorrektur" ColorGradeFilter="LUT anwenden" -MaskFilter="Bildmaske/-Vermischung" +MaskFilter="Bildmaske/‐Vermischung" AsyncDelayFilter="Videoverzögerung (Asynchron)" CropFilter="Zuschneiden/Pad" ScrollFilter="Bewegung" @@ -29,11 +29,11 @@ Gamma="Gamma" BrowsePath.Images="Alle Bilddateien" BrowsePath.AllFiles="Alle Dateien" -KeyColorType="Key-Farbtyp" -KeyColor="Key-Farbe" -Similarity="Ähnlichkeit (1 — 1000)" -Smoothness="Glätte (1 — 1000)" -ColorSpillReduction="Key-Farbe-Spill-Reduzierung (1 — 1000)" +KeyColorType="Key‐Farbtyp" +KeyColor="Key‐Farbe" +Similarity="Ähnlichkeit (1–1000)" +Smoothness="Glätte (1–1000)" +ColorSpillReduction="Key‐Farbe‐Spill‐Reduzierung (1–1000)" Crop.Left="Links" Crop.Right="Rechts" Crop.Top="Oben" @@ -50,15 +50,15 @@ Green="Grün" Blue="Blau" Magenta="Magenta" -NoiseGate.OpenThreshold="Öffnen-Schwellenwert (dB)" -NoiseGate.CloseThreshold="Schließen-Schwellenwert (dB)" -NoiseGate.AttackTime="Attack-Zeit (Millisekunden)" -NoiseGate.HoldTime="Hold-Zeit (Millisekunden)" -NoiseGate.ReleaseTime="Release-Zeit (Millisekunden)" +NoiseGate.OpenThreshold="Öffnungs‐Schwellwert (dB)" +NoiseGate.CloseThreshold="Schließungs‐Schwellwert (dB)" +NoiseGate.AttackTime="Attack‐Zeit (Millisekunden)" +NoiseGate.HoldTime="Hold‐Zeit (Millisekunden)" +NoiseGate.ReleaseTime="Release‐Zeit (Millisekunden)" Gain.GainDB="Gain (dB)" StretchImage="Bild strecken (Bildseitenverhältnis verwerfen)" Resolution="Auflösung" -Base.Canvas="Basis-(Leinwand-)Auflösung" +Base.Canvas="Basis‐(Leinwand‐)Auflösung" None="Keine" ScaleFiltering="Skalierungsfilterung" ScaleFiltering.Point="Point" @@ -72,30 +72,30 @@ Amount="Betrag" Compressor="Kompressor" Compressor.Ratio="Verhältnis (X:1)" -Compressor.Threshold="Schwellenwert (dB)" -Compressor.AttackTime="Angriff (ms)" -Compressor.ReleaseTime="Abfallzeit (ms)" +Compressor.Threshold="Schwellwert (dB)" +Compressor.AttackTime="Attack (ms)" +Compressor.ReleaseTime="Release (ms)" Compressor.OutputGain="Ausgangspegel (dB)" -Compressor.SidechainSource="Sidechain-/Ducking-Quelle" +Compressor.SidechainSource="Sidechain‐/Ducking‐Quelle" Limiter="Begrenzer" -Limiter.Threshold="Schwellenwert (dB)" -Limiter.ReleaseTime="Abfallzeit (ms)" +Limiter.Threshold="Schwellwert (dB)" +Limiter.ReleaseTime="Release (ms)" Expander="Expander" Expander.Ratio="Verhältnis (X:1)" -Expander.Threshold="Schwellenwert (dB)" -Expander.AttackTime="Angriff (ms)" -Expander.ReleaseTime="Abfallzeit (ms)" +Expander.Threshold="Schwellwert (dB)" +Expander.AttackTime="Attack (ms)" +Expander.ReleaseTime="Release (ms)" Expander.OutputGain="Ausgangspegel (dB)" Expander.Detector="Erkennung" Expander.RMS="RMS" -Expander.Peak="Spitze" +Expander.Peak="Peak" Expander.None="Keine" Expander.Presets="Voreinstellungen" Expander.Presets.Expander="Expander" Expander.Presets.Gate="Gate" -LumaKeyFilter="Luma-Key" +LumaKeyFilter="Luma Key" Luma.LumaMax="Max. Luma" Luma.LumaMin="Min. Luma" -Luma.LumaMaxSmooth="Max. Luma-Glätte" -Luma.LumaMinSmooth="Min. Luma-Glätte" +Luma.LumaMaxSmooth="Max. Luma‐Glätte" +Luma.LumaMinSmooth="Min. Luma‐Glätte"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/en-US.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/en-US.ini
Changed
@@ -14,7 +14,7 @@ NoiseSuppress="Noise Suppression" InvertPolarity="Invert Polarity" Gain="Gain" -DelayMs="Delay (milliseconds)" +DelayMs="Delay" Type="Type" MaskBlendType.MaskColor="Alpha Mask (Color Channel)" MaskBlendType.MaskAlpha="Alpha Mask (Alpha Channel)" @@ -50,12 +50,12 @@ Green="Green" Blue="Blue" Magenta="Magenta" -NoiseGate.OpenThreshold="Open Threshold (dB)" -NoiseGate.CloseThreshold="Close Threshold (dB)" -NoiseGate.AttackTime="Attack Time (milliseconds)" -NoiseGate.HoldTime="Hold Time (milliseconds)" -NoiseGate.ReleaseTime="Release Time (milliseconds)" -Gain.GainDB="Gain (dB)" +NoiseGate.OpenThreshold="Open Threshold" +NoiseGate.CloseThreshold="Close Threshold" +NoiseGate.AttackTime="Attack Time" +NoiseGate.HoldTime="Hold Time" +NoiseGate.ReleaseTime="Release Time" +Gain.GainDB="Gain" StretchImage="Stretch Image (discard image aspect ratio)" Resolution="Resolution" Base.Canvas="Base (Canvas) Resolution" @@ -66,26 +66,26 @@ ScaleFiltering.Bicubic="Bicubic" ScaleFiltering.Lanczos="Lanczos" ScaleFiltering.Area="Area" -NoiseSuppress.SuppressLevel="Suppression Level (dB)" +NoiseSuppress.SuppressLevel="Suppression Level" Saturation="Saturation" HueShift="Hue Shift" Amount="Amount" Compressor="Compressor" -Compressor.Ratio="Ratio (X:1)" -Compressor.Threshold="Threshold (dB)" -Compressor.AttackTime="Attack (ms)" -Compressor.ReleaseTime="Release (ms)" -Compressor.OutputGain="Output Gain (dB)" +Compressor.Ratio="Ratio" +Compressor.Threshold="Threshold" +Compressor.AttackTime="Attack" +Compressor.ReleaseTime="Release" +Compressor.OutputGain="Output Gain" Compressor.SidechainSource="Sidechain/Ducking Source" Limiter="Limiter" -Limiter.Threshold="Threshold (dB)" -Limiter.ReleaseTime="Release (ms)" +Limiter.Threshold="Threshold" +Limiter.ReleaseTime="Release" Expander="Expander" -Expander.Ratio="Ratio (X:1)" -Expander.Threshold="Threshold (dB)" -Expander.AttackTime="Attack (ms)" -Expander.ReleaseTime="Release (ms)" -Expander.OutputGain="Output Gain (dB)" +Expander.Ratio="Ratio" +Expander.Threshold="Threshold" +Expander.AttackTime="Attack" +Expander.ReleaseTime="Release" +Expander.OutputGain="Output Gain" Expander.Detector="Detection" Expander.RMS="RMS" Expander.Peak="Peak"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/gl-ES.ini
Changed
@@ -1,12 +1,27 @@ ColorFilter="Corrección da cor" +ColorGradeFilter="Aplicar LUT" MaskFilter="Máscara/mestura de imaxes" AsyncDelayFilter="Atraso do vídeo (asíncrono)" +CropFilter="Recorte/Recheo" ScrollFilter="Desprazamento" +ChromaKeyFilter="Chroma Key" +ColorKeyFilter="Clave de cor" +SharpnessFilter="Nídio" +ScaleFilter="Escala/relación de aspecto" +GPUDelayFilter="Demora na xeración" +UndistortCenter="Non distorsionar o centro da imaxe cando se escala dende ultralarga" +NoiseGate="Porta de ruído" +NoiseSuppress="Supresión do ruído" +InvertPolarity="Inverter a polaridade" +Gain="Ganancia" DelayMs="Atraso (milisegundos)" Type="Tipo" MaskBlendType.MaskColor="Máscara alfa (canle de cor)" MaskBlendType.MaskAlpha="Máscara alfa (canle alfa)" -Path="Camiño" +MaskBlendType.BlendMultiply="Mestura (multiplicar)" +MaskBlendType.BlendAddition="Mestura (adición)" +MaskBlendType.BlendSubtraction="Mestura (substracción)" +Path="Ruta" Color="Cor" Opacity="Opacidade" Contrast="Contraste" @@ -14,17 +29,73 @@ Gamma="Gama" BrowsePath.Images="Todo os ficheiros de imaxe" BrowsePath.AllFiles="Todos os ficheiros" +KeyColorType="Tipo de cor da clave" +KeyColor="Cor da clave" Similarity="Similitude (1-1000)" -Crop.Left="Á esquerda" -Crop.Right="Á dereita" +Smoothness="Suavidade (1-1000)" +ColorSpillReduction="Redución da vertedura da cor clave (1-1000)" +Crop.Left="Esquerda" +Crop.Right="Dereita" Crop.Top="Arriba" Crop.Bottom="Abaixo" -Crop.Width="Largura" -Crop.Height="Altura" +Crop.Width="Largo" +Crop.Height="Alto" Crop.Relative="Relativo" -CustomColor="Personalizar cor" +ScrollFilter.SpeedX="Velocidade horizontal" +ScrollFilter.SpeedY="Velocidade vertical" +ScrollFilter.LimitWidth="Limitar o largo" +ScrollFilter.LimitHeight="Limitar o alto" +CustomColor="Cor personalizada" Red="Vermello" Green="Verde" Blue="Azul" Magenta="Maxenta" +NoiseGate.OpenThreshold="Limiar de apertura (dB)" +NoiseGate.CloseThreshold="Limiar de peche (dB)" +NoiseGate.AttackTime="Tempo de ataque (milisegundos)" +NoiseGate.HoldTime="Tempo de espera (milisegundos)" +NoiseGate.ReleaseTime="Tempo de liberación (milisegundos)" +Gain.GainDB="Ganancia (dB)" +StretchImage="Estricar a imaxe (desbotar a relación de aspecto da imaxe)" +Resolution="Resolución" +Base.Canvas="Resolución da base (lenzo)" +None="Ningunha" +ScaleFiltering="Filtrado da escala" +ScaleFiltering.Point="Punto" +ScaleFiltering.Bilinear="Bilineal" +ScaleFiltering.Bicubic="Bicúbico" +ScaleFiltering.Lanczos="Lanczos" +ScaleFiltering.Area="Área" +NoiseSuppress.SuppressLevel="Nivel de supresión (dB)" +Saturation="Saturación" +HueShift="Cambio de tonalidade" +Amount="Cantidade" +Compressor="Compresor" +Compressor.Ratio="Razón (X:1)" +Compressor.Threshold="Limiar (dB)" +Compressor.AttackTime="Ataque (ms)" +Compressor.ReleaseTime="Liberación (ms)" +Compressor.OutputGain="Ganancia da saída (dB)" +Compressor.SidechainSource="Fonte de atenuación/redución" +Limiter="Limitador" +Limiter.Threshold="Limiar (dB)" +Limiter.ReleaseTime="Liberación (ms)" +Expander="Expansor" +Expander.Ratio="Razón (X:1)" +Expander.Threshold="Limiar (dB)" +Expander.AttackTime="Ataque (ms)" +Expander.ReleaseTime="Liberación (ms)" +Expander.OutputGain="Ganancia da saída (dB)" +Expander.Detector="Detección" +Expander.RMS="RMS" +Expander.Peak="Pico" +Expander.None="Ningún" +Expander.Presets="Valores predefinidos" +Expander.Presets.Expander="Expansor" +Expander.Presets.Gate="Porta" +LumaKeyFilter="Clave Luma" +Luma.LumaMax="Máximo Luma" +Luma.LumaMin="Mínimo Luma" +Luma.LumaMaxSmooth="Suavizado máximo Luma" +Luma.LumaMinSmooth="Suavizado mínimo Luma"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/ja-JP.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/ja-JP.ini
Changed
@@ -96,6 +96,6 @@ LumaKeyFilter="ルマキー" Luma.LumaMax="最大輝度" Luma.LumaMin="最小輝度" -Luma.LumaMaxSmooth="ルマ最大スムーズ" -Luma.LumaMinSmooth="ルマ最小スムーズ" +Luma.LumaMaxSmooth="最大輝度グラデーション" +Luma.LumaMinSmooth="最小輝度グラデーション"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/ka-GE.ini
Changed
@@ -65,7 +65,7 @@ ScaleFiltering.Bilinear="ორხაზოვანი" ScaleFiltering.Bicubic="ბიკუბური" ScaleFiltering.Lanczos="Lanczos" -ScaleFiltering.Area="სივრცე" +ScaleFiltering.Area="სივრცითი" NoiseSuppress.SuppressLevel="დახშობის ხარისხი (dB)" Saturation="გაჯერებულობა" HueShift="შეფერილობის შეცვლა"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/nl-NL.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/nl-NL.ini
Changed
@@ -93,4 +93,9 @@ Expander.Presets="Vooraf ingestelde instellingen" Expander.Presets.Expander="Uitbreiding" Expander.Presets.Gate="Hek" +LumaKeyFilter="Luma Key" +Luma.LumaMax="Luma Max" +Luma.LumaMin="Luma Min" +Luma.LumaMaxSmooth="Luma Max Smooth" +Luma.LumaMinSmooth="Luma Min Smooth"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/ro-RO.ini
Changed
@@ -5,7 +5,7 @@ ChromaKeyFilter="Cheie chroma" ColorKeyFilter="Culoare cheie" SharpnessFilter="Accentuare" -ScaleFilter="Scalare/Rație Aspect" +ScaleFilter="Raport de scalare/aspect" NoiseGate="Poartă de zgomot" InvertPolarity="Inversează polaritatea" Gain="Amplificare" @@ -54,10 +54,13 @@ StretchImage="Întinde imaginea (renunță la raportul de aspect al imaginii)" Resolution="Rezoluție" Base.Canvas="Rezoluție (planșă) de bază" -None="Fără" -ScaleFiltering.Bilinear="Biliniar" -ScaleFiltering.Bicubic="Bicubic" +None="Niciuna" +ScaleFiltering="Filtrare scalară" +ScaleFiltering.Point="Punct" +ScaleFiltering.Bilinear="Bilineară" +ScaleFiltering.Bicubic="Bicubică" ScaleFiltering.Lanczos="Lanczos" +ScaleFiltering.Area="Zonă" Saturation="Saturație" Compressor="Compresor" Compressor.Ratio="Raport (X:1)"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/sl-SI.ini
Changed
@@ -1,2 +1,99 @@ ColorFilter="Popravljanje barv" +ColorGradeFilter="Uporabi LUT" +MaskFilter="Maskiranje/Mešanje slike" +AsyncDelayFilter="Zakasnitev slike (asinh.)" +CropFilter="Obreži/Zapolni" +ScrollFilter="Pomikanje" +ChromaKeyFilter="Kromatsko prekrivanje" +ColorKeyFilter="Barvno prekrivanje" +SharpnessFilter="Izostri" +ScaleFilter="Spr. velikosti/Razmerje" +GPUDelayFilter="Zakasnitev izrisa" +UndistortCenter="Odpravi popačenje sredine slike med spremembo velikost iz ultraširoke" +NoiseGate="Vrata šuma" +NoiseSuppress="Dušenje šuma" +InvertPolarity="Obrni polarnost" +Gain="Ojačitev" +DelayMs="Zakasnitev (ms)" +Type="Vrsta" +MaskBlendType.MaskColor="Maska alfa (barvni kanal)" +MaskBlendType.MaskAlpha="Maska alfa (kanal alfa)" +MaskBlendType.BlendMultiply="Premešaj (zmnoži)" +MaskBlendType.BlendAddition="Premešaj (seštej)" +MaskBlendType.BlendSubtraction="Premešaj (odštej)" +Path="Pot" +Color="Barva" +Opacity="Motnost" +Contrast="Kontrast" +Brightness="Svetlost" +Gamma="Gama" +BrowsePath.Images="Vse slikovne datoteke" +BrowsePath.AllFiles="Vse datoteke" +KeyColorType="Vrsta ključne barve" +KeyColor="Ključna barva" +Similarity="Podobnost (1-1000)" +Smoothness="Gladkost (1-1000)" +ColorSpillReduction="Zmanjševanje razlivanja ključne barve (1-1000)" +Crop.Left="Levo" +Crop.Right="Desno" +Crop.Top="Zgoraj" +Crop.Bottom="Spodaj" +Crop.Width="Širina" +Crop.Height="Višina" +Crop.Relative="Relativno" +ScrollFilter.SpeedX="Vodoravna hitrost" +ScrollFilter.SpeedY="Navpična hitrost" +ScrollFilter.LimitWidth="Omeji širino" +ScrollFilter.LimitHeight="Omeji višino" +CustomColor="Barva po meri" +Red="Rdeča" +Green="Zelena" +Blue="Modra" +Magenta="Škrlatna" +NoiseGate.OpenThreshold="Odpri prag (dB)" +NoiseGate.CloseThreshold="Zapri prag (dB)" +NoiseGate.AttackTime="Čas napada (ms)" +NoiseGate.HoldTime="Čas držanja (ms)" +NoiseGate.ReleaseTime="Čas sprostitve (ms)" +Gain.GainDB="Ojačitev (dB)" +StretchImage="Raztegni sliko (zavrzi razmerje slike)" +Resolution="Ločljivost" +Base.Canvas="Osnovna ločljivost" +None="Brez" +ScaleFiltering="Filtriranje sprem. velikosti" +ScaleFiltering.Point="Točkovno" +ScaleFiltering.Bilinear="Dvovrstno" +ScaleFiltering.Bicubic="Dvoprostor." +ScaleFiltering.Lanczos="Lanczos" +ScaleFiltering.Area="Območje" +NoiseSuppress.SuppressLevel="Raven dušenja (dB)" +Saturation="Nasičenost" +HueShift="Zamik odtenka" +Amount="Količina" +Compressor="Stiskalnik" +Compressor.Ratio="Razmerje (x:1)" +Compressor.Threshold="Prag (dB)" +Compressor.AttackTime="Napad (ms)" +Compressor.ReleaseTime="Sprostitev (ms)" +Compressor.OutputGain="Izhodna ojačitev (dB)" +Compressor.SidechainSource="Vir reference/zmanjšanja glasnosti" +Limiter="Omejevalnik" +Limiter.Threshold="Prag (dB)" +Limiter.ReleaseTime="Sprostitev (ms)" +Expander="Razširjevalec" +Expander.Ratio="Razmerje (x:1)" +Expander.Threshold="Prag (dB)" +Expander.AttackTime="Napad (ms)" +Expander.ReleaseTime="Sprostitev (ms)" +Expander.OutputGain="Izhodna ojačitev (dB)" +Expander.Detector="Zaznavanje" +Expander.RMS="Nazivna vrednost" +Expander.Peak="Najvišja točka" +Expander.None="Brez" +Expander.Presets="Prednastavitve" +Expander.Presets.Expander="Razširjevalec" +Expander.Presets.Gate="Vrata" +LumaKeyFilter="Svetlobno prekrivanje" +Luma.LumaMax="Največja svetilnost" +Luma.LumaMin="Najmanjša svetilnost"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/data/locale/sv-SE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/data/locale/sv-SE.ini
Changed
@@ -28,7 +28,7 @@ Brightness="Ljusstyrka" Gamma="Gamma" BrowsePath.Images="Alla bildfiler" -BrowsePath.AllFiles="Alla Filer" +BrowsePath.AllFiles="Alla filer" KeyColorType="Huvudfärg typ" KeyColor="Huvudfärg" Similarity="Likhet (1-1000)"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/expander-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/expander-filter.c
Changed
@@ -10,21 +10,23 @@ /* -------------------------------------------------------- */ -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[expander: '%s'] " format, \ - obs_source_get_name(cd->context), ##__VA_ARGS__) + obs_source_get_name(cd->context), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) #ifdef _DEBUG -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) #else #define debug(format, ...) #endif /* -------------------------------------------------------- */ +/* clang-format off */ + #define S_RATIO "ratio" #define S_THRESHOLD "threshold" #define S_ATTACK_TIME "attack_time" @@ -61,6 +63,8 @@ #define MS_IN_S 1000 #define MS_IN_S_F ((float)MS_IN_S) +/* clang-format on */ + /* -------------------------------------------------------- */ struct expander_data { @@ -78,7 +82,7 @@ size_t sample_rate; float envelope[MAX_AUDIO_CHANNELS]; float slope; - int detector; + int detector; float runave[MAX_AUDIO_CHANNELS]; bool is_gate; float *runaverage[MAX_AUDIO_CHANNELS]; @@ -90,11 +94,10 @@ size_t env_in_len; }; -enum { - RMS_DETECT, - RMS_STILLWELL_DETECT, - PEAK_DETECT, - NO_DETECT, +enum { RMS_DETECT, + RMS_STILLWELL_DETECT, + PEAK_DETECT, + NO_DETECT, }; /* -------------------------------------------------------- */ @@ -102,16 +105,17 @@ { cd->envelope_buf_len = len; for (int i = 0; i < MAX_AUDIO_CHANNELS; i++) - cd->envelope_buf[i] = brealloc(cd->envelope_buf[i], - cd->envelope_buf_len * sizeof(float)); + cd->envelope_buf[i] = + brealloc(cd->envelope_buf[i], + cd->envelope_buf_len * sizeof(float)); } static void resize_runaverage_buffer(struct expander_data *cd, size_t len) { cd->runaverage_len = len; for (int i = 0; i < MAX_AUDIO_CHANNELS; i++) - cd->runaverage[i] = brealloc(cd->runaverage[i], - cd->runaverage_len * sizeof(float)); + cd->runaverage[i] = brealloc( + cd->runaverage[i], cd->runaverage_len * sizeof(float)); } static void resize_env_in_buffer(struct expander_data *cd, size_t len) @@ -124,8 +128,8 @@ { cd->gaindB_len = len; for (int i = 0; i < MAX_AUDIO_CHANNELS; i++) - cd->gaindB[i] = brealloc(cd->gaindB[i], - cd->gaindB_len * sizeof(float)); + cd->gaindB[i] = + brealloc(cd->gaindB[i], cd->gaindB_len * sizeof(float)); } static inline float gain_coefficient(uint32_t sample_rate, float time) @@ -145,14 +149,14 @@ bool is_expander_preset = true; if (strcmp(presets, "gate") == 0) is_expander_preset = false; - obs_data_set_default_string(s, S_PRESETS, is_expander_preset ? - "expander" : "gate"); - obs_data_set_default_double(s, S_RATIO, is_expander_preset ? - 2.0 : 10.0); + obs_data_set_default_string(s, S_PRESETS, + is_expander_preset ? "expander" : "gate"); + obs_data_set_default_double(s, S_RATIO, + is_expander_preset ? 2.0 : 10.0); obs_data_set_default_double(s, S_THRESHOLD, -40.0f); obs_data_set_default_int(s, S_ATTACK_TIME, 10); - obs_data_set_default_int(s, S_RELEASE_TIME, is_expander_preset ? - 50 : 125); + obs_data_set_default_int(s, S_RELEASE_TIME, + is_expander_preset ? 50 : 125); obs_data_set_default_double(s, S_OUTPUT_GAIN, 0.0); obs_data_set_default_string(s, S_DETECTOR, "RMS"); } @@ -175,23 +179,21 @@ } const uint32_t sample_rate = - audio_output_get_sample_rate(obs_get_audio()); - const size_t num_channels = - audio_output_get_channels(obs_get_audio()); - const float attack_time_ms = - (float)obs_data_get_int(s, S_ATTACK_TIME); + audio_output_get_sample_rate(obs_get_audio()); + const size_t num_channels = audio_output_get_channels(obs_get_audio()); + const float attack_time_ms = (float)obs_data_get_int(s, S_ATTACK_TIME); const float release_time_ms = - (float)obs_data_get_int(s, S_RELEASE_TIME); + (float)obs_data_get_int(s, S_RELEASE_TIME); const float output_gain_db = - (float)obs_data_get_double(s, S_OUTPUT_GAIN); + (float)obs_data_get_double(s, S_OUTPUT_GAIN); cd->ratio = (float)obs_data_get_double(s, S_RATIO); cd->threshold = (float)obs_data_get_double(s, S_THRESHOLD); - cd->attack_gain = gain_coefficient(sample_rate, - attack_time_ms / MS_IN_S_F); - cd->release_gain = gain_coefficient(sample_rate, - release_time_ms / MS_IN_S_F); + cd->attack_gain = + gain_coefficient(sample_rate, attack_time_ms / MS_IN_S_F); + cd->release_gain = + gain_coefficient(sample_rate, release_time_ms / MS_IN_S_F); cd->output_gain = db_to_mul(output_gain_db); cd->num_channels = num_channels; cd->sample_rate = sample_rate; @@ -246,8 +248,8 @@ } // detection stage -static void analyze_envelope(struct expander_data *cd, - float **samples, const uint32_t num_samples) +static void analyze_envelope(struct expander_data *cd, float **samples, + const uint32_t num_samples) { if (cd->envelope_buf_len < num_samples) resize_env_buffer(cd, num_samples); @@ -261,9 +263,9 @@ for (int i = 0; i < MAX_AUDIO_CHANNELS; i++) { memset(cd->envelope_buf[i], 0, - num_samples * sizeof(cd->envelope_buf[i][0])); + num_samples * sizeof(cd->envelope_buf[i][0])); memset(cd->runaverage[i], 0, - num_samples * sizeof(cd->runaverage[i][0])); + num_samples * sizeof(cd->runaverage[i][0])); } memset(cd->env_in, 0, num_samples * sizeof(cd->env_in[0])); @@ -276,13 +278,15 @@ float *env_in = cd->env_in; if (cd->detector == RMS_DETECT) { - runave[0] = rmscoef * cd->runave[chan] + + runave[0] = + rmscoef * cd->runave[chan] + (1 - rmscoef) * powf(samples[chan][0], 2.0f); env_in[0] = sqrtf(fmaxf(runave[0], 0)); for (uint32_t i = 1; i < num_samples; ++i) { - runave[i] = rmscoef * runave[i - 1] + + runave[i] = + rmscoef * runave[i - 1] + (1 - rmscoef) * - powf(samples[chan][i], 2.0f); + powf(samples[chan][i], 2.0f); env_in[i] = sqrtf(runave[i]); } } else if (cd->detector == PEAK_DETECT) { @@ -292,7 +296,7 @@ } } - cd->runave[chan] = runave[num_samples-1]; + cd->runave[chan] = runave[num_samples - 1]; for (uint32_t i = 0; i < num_samples; ++i) envelope_buf[i] = fmaxf(envelope_buf[i], env_in[i]); cd->envelope[chan] = cd->envelope_buf[chan][num_samples - 1]; @@ -300,8 +304,8 @@ } // gain stage and ballistics in dB domain -static inline void process_expansion(struct expander_data *cd, - float **samples, uint32_t num_samples) +static inline void process_expansion(struct expander_data *cd, float **samples, + uint32_t num_samples) { const float attack_gain = cd->attack_gain; const float release_gain = cd->release_gain; @@ -309,35 +313,42 @@ if (cd->gaindB_len < num_samples) resize_gaindB_buffer(cd, num_samples); for (int i = 0; i < MAX_AUDIO_CHANNELS; i++) - memset(cd->gaindB[i], 0, num_samples * sizeof(cd->gaindB[i][0])); + memset(cd->gaindB[i], 0, + num_samples * sizeof(cd->gaindB[i][0])); for (size_t chan = 0; chan < cd->num_channels; chan++) { for (size_t i = 0; i < num_samples; ++i) { // gain stage of expansion float env_db = mul_to_db(cd->envelope_buf[chan][i]); - float gain = cd->threshold - env_db > 0.0f ? - fmaxf(cd->slope * - (cd->threshold - env_db), -60.0f) : - 0.0f; + float gain = + cd->threshold - env_db > 0.0f + ? fmaxf(cd->slope * (cd->threshold - + env_db), + -60.0f) + : 0.0f; // ballistics (attack/release) if (i > 0) { if (gain > cd->gaindB[chan][i - 1]) - cd->gaindB[chan][i] = attack_gain * - cd->gaindB[chan][i - 1] + - (1.0f - attack_gain) * gain; + cd->gaindB[chan][i] = + attack_gain * + cd->gaindB[chan][i - 1] + + (1.0f - attack_gain) * gain; else - cd->gaindB[chan][i] = release_gain * - cd->gaindB[chan][i - 1] + - (1.0f - release_gain) * gain; + cd->gaindB[chan][i] = + release_gain * + cd->gaindB[chan][i - 1] + + (1.0f - release_gain) * gain; } else { if (gain > cd->gaindB_buf[chan]) - cd->gaindB[chan][i] = attack_gain * - cd->gaindB_buf[chan] + - (1.0f - attack_gain) * gain; + cd->gaindB[chan][i] = + attack_gain * + cd->gaindB_buf[chan] + + (1.0f - attack_gain) * gain; else - cd->gaindB[chan][i] = release_gain * - cd->gaindB_buf[chan] + - (1.0f - release_gain) * gain; + cd->gaindB[chan][i] = + release_gain * + cd->gaindB_buf[chan] + + (1.0f - release_gain) * gain; } gain = db_to_mul(fminf(0, cd->gaindB[chan][i])); @@ -348,8 +359,8 @@ } } -static struct obs_audio_data *expander_filter_audio(void *data, - struct obs_audio_data *audio) +static struct obs_audio_data * +expander_filter_audio(void *data, struct obs_audio_data *audio) { struct expander_data *cd = data; @@ -357,7 +368,7 @@ if (num_samples == 0) return audio; - float **samples = (float**)audio->data; + float **samples = (float **)audio->data; analyze_envelope(cd, samples, num_samples); process_expansion(cd, samples, num_samples); @@ -365,7 +376,7 @@ } static bool presets_changed(obs_properties_t *props, obs_property_t *prop, - obs_data_t *settings) + obs_data_t *settings) { UNUSED_PARAMETER(props); UNUSED_PARAMETER(prop); @@ -376,28 +387,37 @@ static obs_properties_t *expander_properties(void *data) { obs_properties_t *props = obs_properties_create(); + obs_property_t *p; - obs_property_t *presets = obs_properties_add_list(props, S_PRESETS, - TEXT_PRESETS, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_STRING); + obs_property_t *presets = obs_properties_add_list( + props, S_PRESETS, TEXT_PRESETS, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(presets, TEXT_PRESETS_EXP, "expander"); obs_property_list_add_string(presets, TEXT_PRESETS_GATE, "gate"); obs_property_set_modified_callback(presets, presets_changed); - obs_properties_add_float_slider(props, S_RATIO, - TEXT_RATIO, MIN_RATIO, MAX_RATIO, 0.1); - obs_properties_add_float_slider(props, S_THRESHOLD, - TEXT_THRESHOLD, MIN_THRESHOLD_DB, MAX_THRESHOLD_DB, - 0.1); - obs_properties_add_int_slider(props, S_ATTACK_TIME, - TEXT_ATTACK_TIME, MIN_ATK_RLS_MS, MAX_ATK_MS, 1); - obs_properties_add_int_slider(props, S_RELEASE_TIME, - TEXT_RELEASE_TIME, MIN_ATK_RLS_MS, MAX_RLS_MS, 1); - obs_properties_add_float_slider(props, S_OUTPUT_GAIN, - TEXT_OUTPUT_GAIN, MIN_OUTPUT_GAIN_DB, - MAX_OUTPUT_GAIN_DB, 0.1); - obs_property_t *detect = obs_properties_add_list(props, S_DETECTOR, - TEXT_DETECTOR, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_STRING); + p = obs_properties_add_float_slider(props, S_RATIO, TEXT_RATIO, + MIN_RATIO, MAX_RATIO, 0.1); + obs_property_float_set_suffix(p, ":1"); + p = obs_properties_add_float_slider(props, S_THRESHOLD, TEXT_THRESHOLD, + MIN_THRESHOLD_DB, MAX_THRESHOLD_DB, + 0.1); + obs_property_float_set_suffix(p, " dB"); + p = obs_properties_add_int_slider(props, S_ATTACK_TIME, + TEXT_ATTACK_TIME, MIN_ATK_RLS_MS, + MAX_ATK_MS, 1); + obs_property_int_set_suffix(p, " ms"); + p = obs_properties_add_int_slider(props, S_RELEASE_TIME, + TEXT_RELEASE_TIME, MIN_ATK_RLS_MS, + MAX_RLS_MS, 1); + obs_property_int_set_suffix(p, " ms"); + p = obs_properties_add_float_slider(props, S_OUTPUT_GAIN, + TEXT_OUTPUT_GAIN, + MIN_OUTPUT_GAIN_DB, + MAX_OUTPUT_GAIN_DB, 0.1); + obs_property_float_set_suffix(p, " dB"); + obs_property_t *detect = obs_properties_add_list( + props, S_DETECTOR, TEXT_DETECTOR, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(detect, TEXT_RMS, "RMS"); obs_property_list_add_string(detect, TEXT_PEAK, "peak");
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/gain-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/gain-filter.c
Changed
@@ -2,17 +2,17 @@ #include <media-io/audio-math.h> #include <math.h> -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[gain filter: '%s'] " format, \ - obs_source_get_name(gf->context), ##__VA_ARGS__) + obs_source_get_name(gf->context), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define S_GAIN_DB "db" +#define S_GAIN_DB "db" #define MT_ obs_module_text -#define TEXT_GAIN_DB MT_("Gain.GainDB") +#define TEXT_GAIN_DB MT_("Gain.GainDB") struct gain_data { obs_source_t *context; @@ -49,11 +49,11 @@ } static struct obs_audio_data *gain_filter_audio(void *data, - struct obs_audio_data *audio) + struct obs_audio_data *audio) { struct gain_data *gf = data; const size_t channels = gf->channels; - float **adata = (float**)audio->data; + float **adata = (float **)audio->data; const float multiple = gf->multiple; for (size_t c = 0; c < channels; c++) { @@ -76,8 +76,9 @@ { obs_properties_t *ppts = obs_properties_create(); - obs_properties_add_float_slider(ppts, S_GAIN_DB, TEXT_GAIN_DB, - -30.0, 30.0, 0.1); + obs_property_t *p = obs_properties_add_float_slider( + ppts, S_GAIN_DB, TEXT_GAIN_DB, -30.0, 30.0, 0.1); + obs_property_float_set_suffix(p, " dB"); UNUSED_PARAMETER(data); return ppts;
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/gpu-delay.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/gpu-delay.c
Changed
@@ -1,8 +1,8 @@ #include <obs-module.h> #include <util/circlebuf.h> -#define S_DELAY_MS "delay_ms" -#define T_DELAY_MS obs_module_text("DelayMs") +#define S_DELAY_MS "delay_ms" +#define T_DELAY_MS obs_module_text("DelayMs") struct frame { gs_texrender_t *render; @@ -10,14 +10,14 @@ }; struct gpu_delay_filter_data { - obs_source_t *context; - struct circlebuf frames; - uint64_t delay_ns; - uint64_t interval_ns; - uint32_t cx; - uint32_t cy; - bool target_valid; - bool processed_frame; + obs_source_t *context; + struct circlebuf frames; + uint64_t delay_ns; + uint64_t interval_ns; + uint32_t cx; + uint32_t cy; + bool target_valid; + bool processed_frame; }; static const char *gpu_delay_filter_get_name(void *unused) @@ -44,7 +44,7 @@ } static void update_interval(struct gpu_delay_filter_data *f, - uint64_t new_interval_ns) + uint64_t new_interval_ns) { if (!f->target_valid) { free_textures(f); @@ -62,9 +62,10 @@ circlebuf_upsize(&f->frames, num * sizeof(struct frame)); for (size_t i = prev_num; i < num; i++) { - struct frame *frame = circlebuf_data(&f->frames, - i * sizeof(*frame)); - frame->render = gs_texrender_create(GS_RGBA, GS_ZS_NONE); + struct frame *frame = + circlebuf_data(&f->frames, i * sizeof(*frame)); + frame->render = + gs_texrender_create(GS_RGBA, GS_ZS_NONE); } obs_leave_graphics(); @@ -89,8 +90,8 @@ obs_get_video_info(&ovi); - interval_ns = (uint64_t)ovi.fps_den * 1000000000ULL / - (uint64_t)ovi.fps_num; + interval_ns = + (uint64_t)ovi.fps_den * 1000000000ULL / (uint64_t)ovi.fps_num; if (interval_ns != f->interval_ns) update_interval(f, interval_ns); @@ -147,13 +148,16 @@ { obs_properties_t *props = obs_properties_create(); - obs_properties_add_int(props, S_DELAY_MS, T_DELAY_MS, 0, 500, 1); + obs_property_t *p = obs_properties_add_int(props, S_DELAY_MS, + T_DELAY_MS, 0, 500, 1); + obs_property_int_set_suffix(p, " ms"); UNUSED_PARAMETER(data); return props; } -static void *gpu_delay_filter_create(obs_data_t *settings, obs_source_t *context) +static void *gpu_delay_filter_create(obs_data_t *settings, + obs_source_t *context) { struct gpu_delay_filter_data *f = bzalloc(sizeof(*f)); f->context = context; @@ -232,8 +236,8 @@ vec4_zero(&clear_color); gs_clear(GS_CLEAR_COLOR, &clear_color, 0.0f, 0); - gs_ortho(0.0f, (float)f->cx, 0.0f, (float)f->cy, - -100.0f, 100.0f); + gs_ortho(0.0f, (float)f->cx, 0.0f, (float)f->cy, -100.0f, + 100.0f); if (target == parent && !custom_draw && !async) obs_source_default_render(target); @@ -253,14 +257,14 @@ } struct obs_source_info gpu_delay_filter = { - .id = "gpu_delay", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = gpu_delay_filter_get_name, - .create = gpu_delay_filter_create, - .destroy = gpu_delay_filter_destroy, - .update = gpu_delay_filter_update, - .get_properties = gpu_delay_filter_properties, - .video_tick = gpu_delay_filter_tick, - .video_render = gpu_delay_filter_render + .id = "gpu_delay", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = gpu_delay_filter_get_name, + .create = gpu_delay_filter_create, + .destroy = gpu_delay_filter_destroy, + .update = gpu_delay_filter_update, + .get_properties = gpu_delay_filter_properties, + .video_tick = gpu_delay_filter_tick, + .video_render = gpu_delay_filter_render, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/invert-audio-polarity.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/invert-audio-polarity.c
Changed
@@ -17,10 +17,10 @@ return filter; } -static struct obs_audio_data *invert_polarity_filter_audio(void *unused, - struct obs_audio_data *audio) +static struct obs_audio_data * +invert_polarity_filter_audio(void *unused, struct obs_audio_data *audio) { - float **adata = (float**)audio->data; + float **adata = (float **)audio->data; for (size_t c = 0; c < MAX_AV_PLANES; c++) { register float *channel_data = adata[c];
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/limiter-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/limiter-filter.c
Changed
@@ -8,21 +8,23 @@ /* -------------------------------------------------------- */ -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[limiter: '%s'] " format, \ - obs_source_get_name(cd->context), ##__VA_ARGS__) + obs_source_get_name(cd->context), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) #ifdef _DEBUG -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) #else #define debug(format, ...) #endif /* -------------------------------------------------------- */ +/* clang-format off */ + #define S_THRESHOLD "threshold" #define S_RELEASE_TIME "release_time" @@ -39,6 +41,8 @@ #define MS_IN_S 1000 #define MS_IN_S_F ((float)MS_IN_S) +/* clang-format on */ + /* -------------------------------------------------------- */ struct limiter_data { @@ -82,20 +86,19 @@ const uint32_t sample_rate = audio_output_get_sample_rate(obs_get_audio()); - const size_t num_channels = - audio_output_get_channels(obs_get_audio()); + const size_t num_channels = audio_output_get_channels(obs_get_audio()); float attack_time_ms = ATK_TIME; const float release_time_ms = (float)obs_data_get_int(s, S_RELEASE_TIME); - const float output_gain_db = 0; + const float output_gain_db = 0; cd->threshold = (float)obs_data_get_double(s, S_THRESHOLD); - cd->attack_gain = gain_coefficient(sample_rate, - attack_time_ms / MS_IN_S_F); - cd->release_gain = gain_coefficient(sample_rate, - release_time_ms / MS_IN_S_F); + cd->attack_gain = + gain_coefficient(sample_rate, attack_time_ms / MS_IN_S_F); + cd->release_gain = + gain_coefficient(sample_rate, release_time_ms / MS_IN_S_F); cd->output_gain = db_to_mul(output_gain_db); cd->num_channels = num_channels; cd->sample_rate = sample_rate; @@ -109,7 +112,7 @@ static void *limiter_create(obs_data_t *settings, obs_source_t *filter) { struct limiter_data *cd = bzalloc(sizeof(struct limiter_data)); - cd->context = filter; + cd->context = filter; limiter_update(cd, settings); return cd; @@ -123,8 +126,8 @@ bfree(cd); } -static void analyze_envelope(struct limiter_data *cd, - float **samples, const uint32_t num_samples) +static void analyze_envelope(struct limiter_data *cd, float **samples, + const uint32_t num_samples) { if (cd->envelope_buf_len < num_samples) { resize_env_buffer(cd, num_samples); @@ -154,7 +157,7 @@ } static inline void process_compression(const struct limiter_data *cd, - float **samples, uint32_t num_samples) + float **samples, uint32_t num_samples) { for (size_t i = 0; i < num_samples; ++i) { const float env_db = mul_to_db(cd->envelope_buf[i]); @@ -170,7 +173,7 @@ } static struct obs_audio_data *limiter_filter_audio(void *data, - struct obs_audio_data *audio) + struct obs_audio_data *audio) { struct limiter_data *cd = data; @@ -178,7 +181,7 @@ if (num_samples == 0) return audio; - float **samples = (float**)audio->data; + float **samples = (float **)audio->data; analyze_envelope(cd, samples, num_samples); process_compression(cd, samples, num_samples); return audio; @@ -193,23 +196,30 @@ static obs_properties_t *limiter_properties(void *data) { obs_properties_t *props = obs_properties_create(); + obs_property_t *p; - obs_properties_add_float_slider(props, S_THRESHOLD, TEXT_THRESHOLD, MIN_THRESHOLD_DB, MAX_THRESHOLD_DB, 0.1); - obs_properties_add_int_slider(props, S_RELEASE_TIME, TEXT_RELEASE_TIME, MIN_ATK_RLS_MS, MAX_RLS_MS, 1); + p = obs_properties_add_float_slider(props, S_THRESHOLD, TEXT_THRESHOLD, + MIN_THRESHOLD_DB, MAX_THRESHOLD_DB, + 0.1); + obs_property_float_set_suffix(p, " dB"); + p = obs_properties_add_int_slider(props, S_RELEASE_TIME, + TEXT_RELEASE_TIME, MIN_ATK_RLS_MS, + MAX_RLS_MS, 1); + obs_property_int_set_suffix(p, " ms"); UNUSED_PARAMETER(data); return props; } struct obs_source_info limiter_filter = { - .id = "limiter_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_AUDIO, - .get_name = limiter_name, - .create = limiter_create, - .destroy = limiter_destroy, - .update = limiter_update, - .filter_audio = limiter_filter_audio, - .get_defaults = limiter_defaults, - .get_properties = limiter_properties, + .id = "limiter_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_AUDIO, + .get_name = limiter_name, + .create = limiter_create, + .destroy = limiter_destroy, + .update = limiter_update, + .filter_audio = limiter_filter_audio, + .get_defaults = limiter_defaults, + .get_properties = limiter_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/luma-key-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/luma-key-filter.c
Changed
@@ -1,5 +1,7 @@ #include <obs-module.h> +/* clang-format off */ + #define SETTING_LUMA_MAX "luma_max" #define SETTING_LUMA_MIN "luma_min" #define SETTING_LUMA_MAX_SMOOTH "luma_max_smooth" @@ -10,20 +12,22 @@ #define TEXT_LUMA_MAX_SMOOTH obs_module_text("Luma.LumaMaxSmooth") #define TEXT_LUMA_MIN_SMOOTH obs_module_text("Luma.LumaMinSmooth") +/* clang-format on */ + struct luma_key_filter_data { - obs_source_t *context; + obs_source_t *context; - gs_effect_t *effect; + gs_effect_t *effect; - gs_eparam_t *luma_max_param; - gs_eparam_t *luma_min_param; - gs_eparam_t *luma_max_smooth_param; - gs_eparam_t *luma_min_smooth_param; + gs_eparam_t *luma_max_param; + gs_eparam_t *luma_min_param; + gs_eparam_t *luma_max_smooth_param; + gs_eparam_t *luma_min_smooth_param; - float luma_max; - float luma_min; - float luma_max_smooth; - float luma_min_smooth; + float luma_max; + float luma_min; + float luma_max_smooth; + float luma_min_smooth; }; static const char *luma_key_name(void *unused) @@ -38,8 +42,10 @@ double lumaMax = obs_data_get_double(settings, SETTING_LUMA_MAX); double lumaMin = obs_data_get_double(settings, SETTING_LUMA_MIN); - double lumaMaxSmooth = obs_data_get_double(settings, SETTING_LUMA_MAX_SMOOTH); - double lumaMinSmooth = obs_data_get_double(settings, SETTING_LUMA_MIN_SMOOTH); + double lumaMaxSmooth = + obs_data_get_double(settings, SETTING_LUMA_MAX_SMOOTH); + double lumaMinSmooth = + obs_data_get_double(settings, SETTING_LUMA_MIN_SMOOTH); filter->luma_max = (float)lumaMax; filter->luma_min = (float)lumaMin; @@ -63,7 +69,7 @@ static void *luma_key_create(obs_data_t *settings, obs_source_t *context) { struct luma_key_filter_data *filter = - bzalloc(sizeof(struct luma_key_filter_data)); + bzalloc(sizeof(struct luma_key_filter_data)); char *effect_path = obs_module_file("luma_key_filter.effect"); filter->context = context; @@ -72,14 +78,14 @@ filter->effect = gs_effect_create_from_file(effect_path, NULL); if (filter->effect) { - filter->luma_max_param = gs_effect_get_param_by_name( - filter->effect, "lumaMax"); - filter->luma_min_param = gs_effect_get_param_by_name( - filter->effect, "lumaMin"); + filter->luma_max_param = + gs_effect_get_param_by_name(filter->effect, "lumaMax"); + filter->luma_min_param = + gs_effect_get_param_by_name(filter->effect, "lumaMin"); filter->luma_max_smooth_param = gs_effect_get_param_by_name( - filter->effect, "lumaMaxSmooth"); + filter->effect, "lumaMaxSmooth"); filter->luma_min_smooth_param = gs_effect_get_param_by_name( - filter->effect, "lumaMinSmooth"); + filter->effect, "lumaMinSmooth"); } obs_leave_graphics(); @@ -100,13 +106,15 @@ struct luma_key_filter_data *filter = data; if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_ALLOW_DIRECT_RENDERING)) + OBS_ALLOW_DIRECT_RENDERING)) return; gs_effect_set_float(filter->luma_max_param, filter->luma_max); gs_effect_set_float(filter->luma_min_param, filter->luma_min); - gs_effect_set_float(filter->luma_max_smooth_param, filter->luma_max_smooth); - gs_effect_set_float(filter->luma_min_smooth_param, filter->luma_min_smooth); + gs_effect_set_float(filter->luma_max_smooth_param, + filter->luma_max_smooth); + gs_effect_set_float(filter->luma_min_smooth_param, + filter->luma_min_smooth); obs_source_process_filter_end(filter->context, filter->effect, 0, 0); @@ -117,14 +125,14 @@ { obs_properties_t *props = obs_properties_create(); - obs_properties_add_float_slider(props, SETTING_LUMA_MAX, - TEXT_LUMA_MAX, 0, 1, 0.01); + obs_properties_add_float_slider(props, SETTING_LUMA_MAX, TEXT_LUMA_MAX, + 0, 1, 0.01); obs_properties_add_float_slider(props, SETTING_LUMA_MAX_SMOOTH, - TEXT_LUMA_MAX_SMOOTH, 0, 1, 0.01); - obs_properties_add_float_slider(props, SETTING_LUMA_MIN, - TEXT_LUMA_MIN, 0, 1, 0.01); + TEXT_LUMA_MAX_SMOOTH, 0, 1, 0.01); + obs_properties_add_float_slider(props, SETTING_LUMA_MIN, TEXT_LUMA_MIN, + 0, 1, 0.01); obs_properties_add_float_slider(props, SETTING_LUMA_MIN_SMOOTH, - TEXT_LUMA_MIN_SMOOTH, 0, 1, 0.01); + TEXT_LUMA_MIN_SMOOTH, 0, 1, 0.01); UNUSED_PARAMETER(data); return props; @@ -138,16 +146,15 @@ obs_data_set_default_double(settings, SETTING_LUMA_MIN_SMOOTH, 0.0); } - struct obs_source_info luma_key_filter = { - .id = "luma_key_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = luma_key_name, - .create = luma_key_create, - .destroy = luma_key_destroy, - .video_render = luma_key_render, - .update = luma_key_update, - .get_properties = luma_key_properties, - .get_defaults = luma_key_defaults + .id = "luma_key_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = luma_key_name, + .create = luma_key_create, + .destroy = luma_key_destroy, + .video_render = luma_key_render, + .update = luma_key_update, + .get_properties = luma_key_properties, + .get_defaults = luma_key_defaults, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/mask-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/mask-filter.c
Changed
@@ -4,6 +4,8 @@ #include <graphics/image-file.h> #include <util/dstr.h> +/* clang-format off */ + #define SETTING_TYPE "type" #define SETTING_IMAGE_PATH "image_path" #define SETTING_COLOR "color" @@ -18,16 +20,18 @@ #define TEXT_PATH_IMAGES obs_module_text("BrowsePath.Images") #define TEXT_PATH_ALL_FILES obs_module_text("BrowsePath.AllFiles") +/* clang-format on */ + struct mask_filter_data { - uint64_t last_time; + uint64_t last_time; - obs_source_t *context; - gs_effect_t *effect; + obs_source_t *context; + gs_effect_t *effect; - gs_texture_t *target; - gs_image_file_t image; - struct vec4 color; - bool lock_aspect; + gs_texture_t *target; + gs_image_file_t image; + struct vec4 color; + bool lock_aspect; }; static const char *mask_filter_get_name(void *unused) @@ -75,13 +79,12 @@ static void mask_filter_defaults(obs_data_t *settings) { obs_data_set_default_string(settings, SETTING_TYPE, - "mask_color_filter.effect"); + "mask_color_filter.effect"); obs_data_set_default_int(settings, SETTING_COLOR, 0xFFFFFF); obs_data_set_default_int(settings, SETTING_OPACITY, 100); } -#define IMAGE_FILTER_EXTENSIONS \ - " (*.bmp *.jpg *.jpeg *.tga *.gif *.png)" +#define IMAGE_FILTER_EXTENSIONS " (*.bmp *.jpg *.jpeg *.tga *.gif *.png)" static obs_properties_t *mask_filter_properties(void *data) { @@ -95,29 +98,30 @@ dstr_cat(&filter_str, " (*.*)"); p = obs_properties_add_list(props, SETTING_TYPE, TEXT_TYPE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, - obs_module_text("MaskBlendType.MaskColor"), - "mask_color_filter.effect"); - obs_property_list_add_string(p, - obs_module_text("MaskBlendType.MaskAlpha"), - "mask_alpha_filter.effect"); - obs_property_list_add_string(p, - obs_module_text("MaskBlendType.BlendMultiply"), - "blend_mul_filter.effect"); - obs_property_list_add_string(p, - obs_module_text("MaskBlendType.BlendAddition"), - "blend_add_filter.effect"); + obs_module_text("MaskBlendType.MaskColor"), + "mask_color_filter.effect"); obs_property_list_add_string(p, - obs_module_text("MaskBlendType.BlendSubtraction"), - "blend_sub_filter.effect"); + obs_module_text("MaskBlendType.MaskAlpha"), + "mask_alpha_filter.effect"); + obs_property_list_add_string( + p, obs_module_text("MaskBlendType.BlendMultiply"), + "blend_mul_filter.effect"); + obs_property_list_add_string( + p, obs_module_text("MaskBlendType.BlendAddition"), + "blend_add_filter.effect"); + obs_property_list_add_string( + p, obs_module_text("MaskBlendType.BlendSubtraction"), + "blend_sub_filter.effect"); obs_properties_add_path(props, SETTING_IMAGE_PATH, TEXT_IMAGE_PATH, - OBS_PATH_FILE, filter_str.array, NULL); + OBS_PATH_FILE, filter_str.array, NULL); obs_properties_add_color(props, SETTING_COLOR, TEXT_COLOR); - obs_properties_add_int_slider(props, SETTING_OPACITY, TEXT_OPACITY, - 0, 100, 1); + obs_properties_add_int_slider(props, SETTING_OPACITY, TEXT_OPACITY, 0, + 100, 1); obs_properties_add_bool(props, SETTING_STRETCH, TEXT_STRETCH); dstr_free(&filter_str); @@ -159,7 +163,8 @@ if (!filter->last_time) filter->last_time = cur_time; - gs_image_file_tick(&filter->image, cur_time - filter->last_time); + gs_image_file_tick(&filter->image, + cur_time - filter->last_time); obs_enter_graphics(); gs_image_file_update_texture(&filter->image); obs_leave_graphics(); @@ -199,9 +204,8 @@ mask_aspect = mask_size.x / mask_size.y; size_to_x = (source_aspect < mask_aspect); - fix = size_to_x ? - (source_size.x / mask_size.x) : - (source_size.y / mask_size.y); + fix = size_to_x ? (source_size.x / mask_size.x) + : (source_size.y / mask_size.y); vec2_mulf(&mask_size, &mask_size, fix); vec2_div(&mul_val, &source_size, &mask_size); @@ -213,7 +217,7 @@ } if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_ALLOW_DIRECT_RENDERING)) + OBS_ALLOW_DIRECT_RENDERING)) return; param = gs_effect_get_param_by_name(filter->effect, "target"); @@ -234,15 +238,15 @@ } struct obs_source_info mask_filter = { - .id = "mask_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = mask_filter_get_name, - .create = mask_filter_create, - .destroy = mask_filter_destroy, - .update = mask_filter_update, - .get_defaults = mask_filter_defaults, - .get_properties = mask_filter_properties, - .video_tick = mask_filter_tick, - .video_render = mask_filter_render + .id = "mask_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = mask_filter_get_name, + .create = mask_filter_create, + .destroy = mask_filter_destroy, + .update = mask_filter_update, + .get_defaults = mask_filter_defaults, + .get_properties = mask_filter_properties, + .video_tick = mask_filter_tick, + .video_render = mask_filter_render, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/noise-gate-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/noise-gate-filter.c
Changed
@@ -2,12 +2,14 @@ #include <obs-module.h> #include <math.h> -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[noise gate: '%s'] " format, \ - obs_source_get_name(ng->context), ##__VA_ARGS__) + obs_source_get_name(ng->context), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) + +/* clang-format off */ #define S_OPEN_THRESHOLD "open_threshold" #define S_CLOSE_THRESHOLD "close_threshold" @@ -22,6 +24,8 @@ #define TEXT_HOLD_TIME MT_("NoiseGate.HoldTime") #define TEXT_RELEASE_TIME MT_("NoiseGate.ReleaseTime") +/* clang-format on */ + struct noise_gate_data { obs_source_t *context; @@ -104,12 +108,12 @@ return ng; } -static struct obs_audio_data *noise_gate_filter_audio(void *data, - struct obs_audio_data *audio) +static struct obs_audio_data * +noise_gate_filter_audio(void *data, struct obs_audio_data *audio) { struct noise_gate_data *ng = data; - float **adata = (float**)audio->data; + float **adata = (float **)audio->data; const float close_threshold = ng->close_threshold; const float open_threshold = ng->open_threshold; const float sample_rate_i = ng->sample_rate_i; @@ -136,13 +140,13 @@ ng->level = fmaxf(ng->level, cur_level) - decay_rate; if (ng->is_open) { - ng->attenuation = fminf(1.0f, - ng->attenuation + attack_rate); + ng->attenuation = + fminf(1.0f, ng->attenuation + attack_rate); } else { ng->held_time += sample_rate_i; if (ng->held_time > hold_time) { - ng->attenuation = fmaxf(0.0f, - ng->attenuation - release_rate); + ng->attenuation = fmaxf( + 0.0f, ng->attenuation - release_rate); } } @@ -157,25 +161,33 @@ { obs_data_set_default_double(s, S_OPEN_THRESHOLD, -26.0); obs_data_set_default_double(s, S_CLOSE_THRESHOLD, -32.0); - obs_data_set_default_int (s, S_ATTACK_TIME, 25); - obs_data_set_default_int (s, S_HOLD_TIME, 200); - obs_data_set_default_int (s, S_RELEASE_TIME, 150); + obs_data_set_default_int(s, S_ATTACK_TIME, 25); + obs_data_set_default_int(s, S_HOLD_TIME, 200); + obs_data_set_default_int(s, S_RELEASE_TIME, 150); } static obs_properties_t *noise_gate_properties(void *data) { obs_properties_t *ppts = obs_properties_create(); - - obs_properties_add_float_slider(ppts, S_CLOSE_THRESHOLD, - TEXT_CLOSE_THRESHOLD, VOL_MIN, VOL_MAX, 1.0); - obs_properties_add_float_slider(ppts, S_OPEN_THRESHOLD, - TEXT_OPEN_THRESHOLD, VOL_MIN, VOL_MAX, 1.0); - obs_properties_add_int(ppts, S_ATTACK_TIME, TEXT_ATTACK_TIME, - 0, 10000, 1); - obs_properties_add_int(ppts, S_HOLD_TIME, TEXT_HOLD_TIME, - 0, 10000, 1); - obs_properties_add_int(ppts, S_RELEASE_TIME, TEXT_RELEASE_TIME, - 0, 10000, 1); + obs_property_t *p; + + p = obs_properties_add_float_slider(ppts, S_CLOSE_THRESHOLD, + TEXT_CLOSE_THRESHOLD, VOL_MIN, + VOL_MAX, 1.0); + obs_property_float_set_suffix(p, " dB"); + p = obs_properties_add_float_slider(ppts, S_OPEN_THRESHOLD, + TEXT_OPEN_THRESHOLD, VOL_MIN, + VOL_MAX, 1.0); + obs_property_float_set_suffix(p, " dB"); + p = obs_properties_add_int(ppts, S_ATTACK_TIME, TEXT_ATTACK_TIME, 0, + 10000, 1); + obs_property_int_set_suffix(p, " ms"); + p = obs_properties_add_int(ppts, S_HOLD_TIME, TEXT_HOLD_TIME, 0, 10000, + 1); + obs_property_int_set_suffix(p, " ms"); + p = obs_properties_add_int(ppts, S_RELEASE_TIME, TEXT_RELEASE_TIME, 0, + 10000, 1); + obs_property_int_set_suffix(p, " ms"); UNUSED_PARAMETER(data); return ppts;
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/noise-suppress-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/noise-suppress-filter.c
Changed
@@ -7,27 +7,27 @@ /* -------------------------------------------------------- */ -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[noise suppress: '%s'] " format, \ - obs_source_get_name(ng->context), ##__VA_ARGS__) + obs_source_get_name(ng->context), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) #ifdef _DEBUG -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) #else #define debug(format, ...) #endif /* -------------------------------------------------------- */ -#define S_SUPPRESS_LEVEL "suppress_level" +#define S_SUPPRESS_LEVEL "suppress_level" #define MT_ obs_module_text -#define TEXT_SUPPRESS_LEVEL MT_("NoiseSuppress.SuppressLevel") +#define TEXT_SUPPRESS_LEVEL MT_("NoiseSuppress.SuppressLevel") -#define MAX_PREPROC_CHANNELS 8 +#define MAX_PREPROC_CHANNELS 8 /* -------------------------------------------------------- */ @@ -90,12 +90,13 @@ } static inline void alloc_channel(struct noise_suppress_data *ng, - uint32_t sample_rate, size_t channel, size_t frames) + uint32_t sample_rate, size_t channel, + size_t frames) { - ng->states[channel] = speex_preprocess_state_init((int)frames, - sample_rate); + ng->states[channel] = + speex_preprocess_state_init((int)frames, sample_rate); - circlebuf_reserve(&ng->input_buffers[channel], frames * sizeof(float)); + circlebuf_reserve(&ng->input_buffers[channel], frames * sizeof(float)); circlebuf_reserve(&ng->output_buffers[channel], frames * sizeof(float)); } @@ -119,13 +120,13 @@ /* One speex state for each channel (limit 2) */ ng->copy_buffers[0] = bmalloc(frames * channels * sizeof(float)); - ng->segment_buffers[0] = bmalloc(frames * channels * sizeof(spx_int16_t)); + ng->segment_buffers[0] = + bmalloc(frames * channels * sizeof(spx_int16_t)); for (size_t c = 1; c < channels; ++c) { - ng->copy_buffers[c] = ng->copy_buffers[c-1] + frames; - ng->segment_buffers[c] = ng->segment_buffers[c-1] + frames; + ng->copy_buffers[c] = ng->copy_buffers[c - 1] + frames; + ng->segment_buffers[c] = ng->segment_buffers[c - 1] + frames; } - for (size_t i = 0; i < channels; i++) alloc_channel(ng, sample_rate, i, frames); } @@ -145,22 +146,24 @@ /* Pop from input circlebuf */ for (size_t i = 0; i < ng->channels; i++) circlebuf_pop_front(&ng->input_buffers[i], ng->copy_buffers[i], - ng->frames * sizeof(float)); + ng->frames * sizeof(float)); /* Set args */ for (size_t i = 0; i < ng->channels; i++) speex_preprocess_ctl(ng->states[i], - SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, - &ng->suppress_level); + SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, + &ng->suppress_level); /* Convert to 16bit */ for (size_t i = 0; i < ng->channels; i++) for (size_t j = 0; j < ng->frames; j++) { float s = ng->copy_buffers[i][j]; - if (s > 1.0f) s = 1.0f; - else if (s < -1.0f) s = -1.0f; - ng->segment_buffers[i][j] = (spx_int16_t) - (s * c_32_to_16); + if (s > 1.0f) + s = 1.0f; + else if (s < -1.0f) + s = -1.0f; + ng->segment_buffers[i][j] = + (spx_int16_t)(s * c_32_to_16); } /* Execute */ @@ -176,7 +179,7 @@ /* Push to output circlebuf */ for (size_t i = 0; i < ng->channels; i++) circlebuf_push_back(&ng->output_buffers[i], ng->copy_buffers[i], - ng->frames * sizeof(float)); + ng->frames * sizeof(float)); } struct ng_audio_info { @@ -199,8 +202,8 @@ clear_circlebuf(&ng->info_buffer); } -static struct obs_audio_data *noise_suppress_filter_audio(void *data, - struct obs_audio_data *audio) +static struct obs_audio_data * +noise_suppress_filter_audio(void *data, struct obs_audio_data *audio) { struct noise_suppress_data *ng = data; struct ng_audio_info info; @@ -216,7 +219,7 @@ * from being processed as part of the new data. */ if (ng->last_timestamp) { int64_t diff = llabs((int64_t)ng->last_timestamp - - (int64_t)audio->timestamp); + (int64_t)audio->timestamp); if (diff > 1000000000LL) reset_data(ng); @@ -234,7 +237,7 @@ * push back current audio data to input circlebuf */ for (size_t i = 0; i < ng->channels; i++) circlebuf_push_back(&ng->input_buffers[i], audio->data[i], - audio->frames * sizeof(float)); + audio->frames * sizeof(float)); /* ----------------------------------------------- * pop/process each 10ms segments, push back to output circlebuf */ @@ -259,11 +262,10 @@ for (size_t i = 0; i < ng->channels; i++) { ng->output_audio.data[i] = - (uint8_t*)&ng->output_data.array[i * out_size]; + (uint8_t *)&ng->output_data.array[i * out_size]; circlebuf_pop_front(&ng->output_buffers[i], - ng->output_audio.data[i], - out_size); + ng->output_audio.data[i], out_size); } ng->output_audio.frames = info.frames; @@ -280,8 +282,11 @@ { obs_properties_t *ppts = obs_properties_create(); - obs_properties_add_int_slider(ppts, S_SUPPRESS_LEVEL, - TEXT_SUPPRESS_LEVEL, SUP_MIN, SUP_MAX, 1); + obs_property_t *p = obs_properties_add_int_slider(ppts, + S_SUPPRESS_LEVEL, + TEXT_SUPPRESS_LEVEL, + SUP_MIN, SUP_MAX, 1); + obs_property_int_set_suffix(p, " dB"); UNUSED_PARAMETER(data); return ppts;
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/scale-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/scale-filter.c
Changed
@@ -6,6 +6,8 @@ #include <graphics/vec2.h> #include <graphics/math-defs.h> +/* clang-format off */ + #define S_RESOLUTION "resolution" #define S_SAMPLING "sampling" #define S_UNDISTORT "undistort" @@ -27,25 +29,30 @@ #define S_SAMPLING_LANCZOS "lanczos" #define S_SAMPLING_AREA "area" +/* clang-format on */ + struct scale_filter_data { - obs_source_t *context; - gs_effect_t *effect; - gs_eparam_t *image_param; - gs_eparam_t *dimension_param; - gs_eparam_t *undistort_factor_param; - struct vec2 dimension_i; - double undistort_factor; - int cx_in; - int cy_in; - int cx_out; - int cy_out; - enum obs_scale_type sampling; - gs_samplerstate_t *point_sampler; - bool aspect_ratio_only; - bool target_valid; - bool valid; - bool undistort; - bool base_canvas_resolution; + obs_source_t *context; + gs_effect_t *effect; + gs_eparam_t *image_param; + gs_eparam_t *dimension_param; + gs_eparam_t *dimension_i_param; + gs_eparam_t *undistort_factor_param; + struct vec2 dimension; + struct vec2 dimension_i; + double undistort_factor; + int cx_in; + int cy_in; + int cx_out; + int cy_out; + enum obs_scale_type sampling; + gs_samplerstate_t *point_sampler; + bool aspect_ratio_only; + bool target_valid; + bool valid; + bool undistort; + bool upscale; + bool base_canvas_resolution; }; static const char *scale_filter_name(void *unused) @@ -78,7 +85,7 @@ filter->aspect_ratio_only = false; } else { ret = sscanf(res_str, "%d:%d", &filter->cx_in, - &filter->cy_in); + &filter->cy_in); if (ret != 2) { filter->valid = false; return; @@ -179,8 +186,7 @@ cy_f = (double)cy; double old_aspect = cx_f / cy_f; - double new_aspect = - (double)filter->cx_in / (double)filter->cy_in; + double new_aspect = (double)filter->cx_in / (double)filter->cy_in; if (filter->aspect_ratio_only) { if (fabs(old_aspect - new_aspect) <= EPSILON) { @@ -200,9 +206,8 @@ filter->cy_out = filter->cy_in; } - vec2_set(&filter->dimension_i, - 1.0f / (float)cx, - 1.0f / (float)cy); + vec2_set(&filter->dimension, (float)cx, (float)cy); + vec2_set(&filter->dimension_i, 1.0f / (float)cx, 1.0f / (float)cy); if (filter->undistort) { filter->undistort_factor = new_aspect / old_aspect; @@ -210,6 +215,8 @@ filter->undistort_factor = 1.0; } + filter->upscale = false; + /* ------------------------- */ lower_than_2x = filter->cx_out < cx / 2 || filter->cy_out < cy / 2; @@ -220,29 +227,41 @@ switch (filter->sampling) { default: case OBS_SCALE_POINT: - case OBS_SCALE_BILINEAR: type = OBS_EFFECT_DEFAULT; break; - case OBS_SCALE_BICUBIC: type = OBS_EFFECT_BICUBIC; break; - case OBS_SCALE_LANCZOS: type = OBS_EFFECT_LANCZOS; break; - case OBS_SCALE_AREA: type = OBS_EFFECT_AREA; break; + case OBS_SCALE_BILINEAR: + type = OBS_EFFECT_DEFAULT; + break; + case OBS_SCALE_BICUBIC: + type = OBS_EFFECT_BICUBIC; + break; + case OBS_SCALE_LANCZOS: + type = OBS_EFFECT_LANCZOS; + break; + case OBS_SCALE_AREA: + type = OBS_EFFECT_AREA; + if ((filter->cx_out >= cx) && (filter->cy_out >= cy)) + filter->upscale = true; + break; } } filter->effect = obs_get_base_effect(type); - filter->image_param = gs_effect_get_param_by_name(filter->effect, - "image"); + filter->image_param = + gs_effect_get_param_by_name(filter->effect, "image"); if (type != OBS_EFFECT_DEFAULT) { filter->dimension_param = gs_effect_get_param_by_name( - filter->effect, "base_dimension_i"); + filter->effect, "base_dimension"); + filter->dimension_i_param = gs_effect_get_param_by_name( + filter->effect, "base_dimension_i"); } else { filter->dimension_param = NULL; + filter->dimension_i_param = NULL; } if (type == OBS_EFFECT_BICUBIC || type == OBS_EFFECT_LANCZOS) { filter->undistort_factor_param = gs_effect_get_param_by_name( filter->effect, "undistort_factor"); - } - else { + } else { filter->undistort_factor_param = NULL; } @@ -252,8 +271,9 @@ static void scale_filter_render(void *data, gs_effect_t *effect) { struct scale_filter_data *filter = data; - const char *technique = filter->undistort ? - "DrawUndistort" : "Draw"; + const char *technique = + filter->undistort ? "DrawUndistort" + : (filter->upscale ? "DrawUpscale" : "Draw"); if (!filter->valid || !filter->target_valid) { obs_source_skip_video_filter(filter->context); @@ -261,75 +281,61 @@ } if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_NO_DIRECT_RENDERING)) + OBS_NO_DIRECT_RENDERING)) return; if (filter->dimension_param) - gs_effect_set_vec2(filter->dimension_param, - &filter->dimension_i); + gs_effect_set_vec2(filter->dimension_param, &filter->dimension); + + if (filter->dimension_i_param) + gs_effect_set_vec2(filter->dimension_i_param, + &filter->dimension_i); if (filter->undistort_factor_param) gs_effect_set_float(filter->undistort_factor_param, - (float)filter->undistort_factor); + (float)filter->undistort_factor); if (filter->sampling == OBS_SCALE_POINT) gs_effect_set_next_sampler(filter->image_param, - filter->point_sampler); + filter->point_sampler); obs_source_process_filter_tech_end(filter->context, filter->effect, - filter->cx_out, filter->cy_out, technique); + filter->cx_out, filter->cy_out, + technique); UNUSED_PARAMETER(effect); } -static const double downscale_vals[] = { - 1.0, - 1.25, - (1.0/0.75), - 1.5, - (1.0/0.6), - 1.75, - 2.0, - 2.25, - 2.5, - 2.75, - 3.0 -}; +static const double downscale_vals[] = {1.0, 1.25, (1.0 / 0.75), 1.5, + (1.0 / 0.6), 1.75, 2.0, 2.25, + 2.5, 2.75, 3.0}; #define NUM_DOWNSCALES (sizeof(downscale_vals) / sizeof(double)) -static const char *aspects[] = { - "16:9", - "16:10", - "4:3", - "1:1" -}; +static const char *aspects[] = {"16:9", "16:10", "4:3", "1:1"}; #define NUM_ASPECTS (sizeof(aspects) / sizeof(const char *)) static bool sampling_modified(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { const char *sampling = obs_data_get_string(settings, S_SAMPLING); bool has_undistort; if (astrcmpi(sampling, S_SAMPLING_POINT) == 0) { has_undistort = false; - } - else if (astrcmpi(sampling, S_SAMPLING_BILINEAR) == 0) { + } else if (astrcmpi(sampling, S_SAMPLING_BILINEAR) == 0) { has_undistort = false; - } - else if (astrcmpi(sampling, S_SAMPLING_LANCZOS) == 0) { + } else if (astrcmpi(sampling, S_SAMPLING_LANCZOS) == 0) { has_undistort = true; - } - else if (astrcmpi(sampling, S_SAMPLING_AREA) == 0) { + } else if (astrcmpi(sampling, S_SAMPLING_AREA) == 0) { has_undistort = false; - } - else { /* S_SAMPLING_BICUBIC */ + } else { /* S_SAMPLING_BICUBIC */ has_undistort = true; } - obs_property_set_visible(obs_properties_get(props, S_UNDISTORT), has_undistort); + obs_property_set_visible(obs_properties_get(props, S_UNDISTORT), + has_undistort); UNUSED_PARAMETER(p); return true; @@ -360,18 +366,21 @@ } p = obs_properties_add_list(props, S_SAMPLING, T_SAMPLING, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_set_modified_callback(p, sampling_modified); - obs_property_list_add_string(p, T_SAMPLING_POINT, S_SAMPLING_POINT); - obs_property_list_add_string(p, T_SAMPLING_BILINEAR, S_SAMPLING_BILINEAR); - obs_property_list_add_string(p, T_SAMPLING_BICUBIC, S_SAMPLING_BICUBIC); - obs_property_list_add_string(p, T_SAMPLING_LANCZOS, S_SAMPLING_LANCZOS); - obs_property_list_add_string(p, T_SAMPLING_AREA, S_SAMPLING_AREA); + obs_property_list_add_string(p, T_SAMPLING_POINT, S_SAMPLING_POINT); + obs_property_list_add_string(p, T_SAMPLING_BILINEAR, + S_SAMPLING_BILINEAR); + obs_property_list_add_string(p, T_SAMPLING_BICUBIC, S_SAMPLING_BICUBIC); + obs_property_list_add_string(p, T_SAMPLING_LANCZOS, S_SAMPLING_LANCZOS); + obs_property_list_add_string(p, T_SAMPLING_AREA, S_SAMPLING_AREA); /* ----------------- */ p = obs_properties_add_list(props, S_RESOLUTION, T_RESOLUTION, - OBS_COMBO_TYPE_EDITABLE, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_EDITABLE, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, T_NONE, T_NONE); obs_property_list_add_string(p, T_BASE, T_BASE); @@ -413,17 +422,17 @@ } struct obs_source_info scale_filter = { - .id = "scale_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = scale_filter_name, - .create = scale_filter_create, - .destroy = scale_filter_destroy, - .video_tick = scale_filter_tick, - .video_render = scale_filter_render, - .update = scale_filter_update, - .get_properties = scale_filter_properties, - .get_defaults = scale_filter_defaults, - .get_width = scale_filter_width, - .get_height = scale_filter_height + .id = "scale_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = scale_filter_name, + .create = scale_filter_create, + .destroy = scale_filter_destroy, + .video_tick = scale_filter_tick, + .video_render = scale_filter_render, + .update = scale_filter_update, + .get_properties = scale_filter_properties, + .get_defaults = scale_filter_defaults, + .get_width = scale_filter_width, + .get_height = scale_filter_height, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/scroll-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/scroll-filter.c
Changed
@@ -2,22 +2,22 @@ #include <graphics/vec2.h> struct scroll_filter_data { - obs_source_t *context; - - gs_effect_t *effect; - gs_eparam_t *param_add; - gs_eparam_t *param_mul; - gs_eparam_t *param_image; - - struct vec2 scroll_speed; - gs_samplerstate_t *sampler; - bool limit_cx; - bool limit_cy; - uint32_t cx; - uint32_t cy; - - struct vec2 size_i; - struct vec2 offset; + obs_source_t *context; + + gs_effect_t *effect; + gs_eparam_t *param_add; + gs_eparam_t *param_mul; + gs_eparam_t *param_image; + + struct vec2 scroll_speed; + gs_samplerstate_t *sampler; + bool limit_cx; + bool limit_cy; + uint32_t cx; + uint32_t cy; + + struct vec2 size_i; + struct vec2 offset; }; static const char *scroll_filter_get_name(void *unused) @@ -31,11 +31,9 @@ struct scroll_filter_data *filter = bzalloc(sizeof(*filter)); char *effect_path = obs_module_file("crop_filter.effect"); - struct gs_sampler_info sampler_info = { - .filter = GS_FILTER_LINEAR, - .address_u = GS_ADDRESS_WRAP, - .address_v = GS_ADDRESS_WRAP - }; + struct gs_sampler_info sampler_info = {.filter = GS_FILTER_LINEAR, + .address_u = GS_ADDRESS_WRAP, + .address_v = GS_ADDRESS_WRAP}; filter->context = context; @@ -51,12 +49,12 @@ return NULL; } - filter->param_add = gs_effect_get_param_by_name(filter->effect, - "add_val"); - filter->param_mul = gs_effect_get_param_by_name(filter->effect, - "mul_val"); - filter->param_image = gs_effect_get_param_by_name(filter->effect, - "image"); + filter->param_add = + gs_effect_get_param_by_name(filter->effect, "add_val"); + filter->param_mul = + gs_effect_get_param_by_name(filter->effect, "mul_val"); + filter->param_image = + gs_effect_get_param_by_name(filter->effect, "image"); obs_source_update(context, settings); return filter; @@ -83,10 +81,10 @@ filter->cx = (uint32_t)obs_data_get_int(settings, "cx"); filter->cy = (uint32_t)obs_data_get_int(settings, "cy"); - filter->scroll_speed.x = (float)obs_data_get_double(settings, - "speed_x"); - filter->scroll_speed.y = (float)obs_data_get_double(settings, - "speed_y"); + filter->scroll_speed.x = + (float)obs_data_get_double(settings, "speed_x"); + filter->scroll_speed.y = + (float)obs_data_get_double(settings, "speed_y"); if (filter->scroll_speed.x == 0.0f) filter->offset.x = 0.0f; @@ -95,7 +93,7 @@ } static bool limit_cx_clicked(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { bool limit_size = obs_data_get_bool(settings, "limit_cx"); obs_property_set_visible(obs_properties_get(props, "cx"), limit_size); @@ -105,7 +103,7 @@ } static bool limit_cy_clicked(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { bool limit_size = obs_data_get_bool(settings, "limit_cy"); obs_property_set_visible(obs_properties_get(props, "cy"), limit_size); @@ -120,23 +118,23 @@ obs_property_t *p; obs_properties_add_float_slider(props, "speed_x", - obs_module_text("ScrollFilter.SpeedX"), - -500.0, 500.0, 1.0); + obs_module_text("ScrollFilter.SpeedX"), + -500.0, 500.0, 1.0); obs_properties_add_float_slider(props, "speed_y", - obs_module_text("ScrollFilter.SpeedY"), - -500.0, 500.0, 1.0); + obs_module_text("ScrollFilter.SpeedY"), + -500.0, 500.0, 1.0); p = obs_properties_add_bool(props, "limit_cx", - obs_module_text("ScrollFilter.LimitWidth")); + obs_module_text("ScrollFilter.LimitWidth")); obs_property_set_modified_callback(p, limit_cx_clicked); - obs_properties_add_int(props, "cx", - obs_module_text("Crop.Width"), 1, 8192, 1); + obs_properties_add_int(props, "cx", obs_module_text("Crop.Width"), 1, + 8192, 1); - p = obs_properties_add_bool(props, "limit_cy", - obs_module_text("ScrollFilter.LimitHeight")); + p = obs_properties_add_bool( + props, "limit_cy", obs_module_text("ScrollFilter.LimitHeight")); obs_property_set_modified_callback(p, limit_cy_clicked); - obs_properties_add_int(props, "cy", - obs_module_text("Crop.Height"), 1, 8192, 1); + obs_properties_add_int(props, "cy", obs_module_text("Crop.Height"), 1, + 8192, 1); UNUSED_PARAMETER(data); return props; @@ -179,21 +177,19 @@ cy = filter->limit_cy ? filter->cy : base_cy; if (base_cx && base_cy) { - vec2_set(&filter->size_i, - 1.0f / (float)base_cx, - 1.0f / (float)base_cy); + vec2_set(&filter->size_i, 1.0f / (float)base_cx, + 1.0f / (float)base_cy); } else { vec2_zero(&filter->size_i); obs_source_skip_video_filter(filter->context); return; } - vec2_set(&mul_val, - (float)cx / (float)base_cx, - (float)cy / (float)base_cy); + vec2_set(&mul_val, (float)cx / (float)base_cx, + (float)cy / (float)base_cy); if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_NO_DIRECT_RENDERING)) + OBS_NO_DIRECT_RENDERING)) return; gs_effect_set_vec2(filter->param_add, &filter->offset); @@ -211,8 +207,8 @@ struct scroll_filter_data *filter = data; obs_source_t *target = obs_filter_get_target(filter->context); - return filter->limit_cx ? - filter->cx : obs_source_get_base_width(target); + return filter->limit_cx ? filter->cx + : obs_source_get_base_width(target); } static uint32_t scroll_filter_height(void *data) @@ -220,22 +216,22 @@ struct scroll_filter_data *filter = data; obs_source_t *target = obs_filter_get_target(filter->context); - return filter->limit_cy ? - filter->cy : obs_source_get_base_height(target); + return filter->limit_cy ? filter->cy + : obs_source_get_base_height(target); } struct obs_source_info scroll_filter = { - .id = "scroll_filter", - .type = OBS_SOURCE_TYPE_FILTER, - .output_flags = OBS_SOURCE_VIDEO, - .get_name = scroll_filter_get_name, - .create = scroll_filter_create, - .destroy = scroll_filter_destroy, - .update = scroll_filter_update, - .get_properties = scroll_filter_properties, - .get_defaults = scroll_filter_defaults, - .video_tick = scroll_filter_tick, - .video_render = scroll_filter_render, - .get_width = scroll_filter_width, - .get_height = scroll_filter_height + .id = "scroll_filter", + .type = OBS_SOURCE_TYPE_FILTER, + .output_flags = OBS_SOURCE_VIDEO, + .get_name = scroll_filter_get_name, + .create = scroll_filter_create, + .destroy = scroll_filter_destroy, + .update = scroll_filter_update, + .get_properties = scroll_filter_properties, + .get_defaults = scroll_filter_defaults, + .video_tick = scroll_filter_tick, + .video_render = scroll_filter_render, + .get_width = scroll_filter_width, + .get_height = scroll_filter_height, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-filters/sharpness-filter.c -> obs-studio-24.0.0.tar.xz/plugins/obs-filters/sharpness-filter.c
Changed
@@ -4,14 +4,14 @@ #include <util/platform.h> struct sharpness_data { - obs_source_t *context; + obs_source_t *context; - gs_effect_t *effect; - gs_eparam_t *sharpness_param; - gs_eparam_t *texture_width, *texture_height; + gs_effect_t *effect; + gs_eparam_t *sharpness_param; + gs_eparam_t *texture_width, *texture_height; - float sharpness; - float texwidth, texheight; + float sharpness; + float texwidth, texheight; }; static const char *sharpness_getname(void *unused) @@ -43,8 +43,7 @@ static void *sharpness_create(obs_data_t *settings, obs_source_t *context) { - struct sharpness_data *filter = - bzalloc(sizeof(struct sharpness_data)); + struct sharpness_data *filter = bzalloc(sizeof(struct sharpness_data)); char *effect_path = obs_module_file("sharpness.effect"); filter->context = context; @@ -79,13 +78,13 @@ struct sharpness_data *filter = data; if (!obs_source_process_filter_begin(filter->context, GS_RGBA, - OBS_ALLOW_DIRECT_RENDERING)) + OBS_ALLOW_DIRECT_RENDERING)) return; - filter->texwidth =(float)obs_source_get_width( - obs_filter_get_target(filter->context)); + filter->texwidth = (float)obs_source_get_width( + obs_filter_get_target(filter->context)); filter->texheight = (float)obs_source_get_height( - obs_filter_get_target(filter->context)); + obs_filter_get_target(filter->context)); gs_effect_set_float(filter->sharpness_param, filter->sharpness); gs_effect_set_float(filter->texture_width, filter->texwidth); @@ -100,8 +99,8 @@ { obs_properties_t *props = obs_properties_create(); - obs_properties_add_float_slider(props, "sharpness", - "Sharpness", 0.0, 1.0, 0.01); + obs_properties_add_float_slider(props, "sharpness", "Sharpness", 0.0, + 1.0, 0.01); UNUSED_PARAMETER(data); return props; @@ -122,5 +121,5 @@ .update = sharpness_update, .video_render = sharpness_render, .get_properties = sharpness_properties, - .get_defaults = sharpness_defaults + .get_defaults = sharpness_defaults, };
View file
obs-studio-24.0.0.tar.xz/plugins/obs-libfdk/data/locale/bg-BG.ini
Added
@@ -0,0 +1,4 @@ +LibFDK="кодер AAC (libfdk)" +Bitrate="Битрейт" +Afterburner="Включване на AAC Afterburner" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-libfdk/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-libfdk/data/locale/de-DE.ini
Changed
@@ -1,4 +1,4 @@ -LibFDK="libfdk-AAC-Kodierer" +LibFDK="libfdk‐AAC‐Kodierer" Bitrate="Bitrate" -Afterburner="AAC-Afterburner aktivieren" +Afterburner="AAC‐Afterburner aktivieren"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-libfdk/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-libfdk/data/locale/gl-ES.ini
Changed
@@ -1,4 +1,4 @@ LibFDK="Codificador AAC libfdk" -Bitrate="Velocidade de bits" -Afterburner="Habilitar AAC Afterburner" +Bitrate="Taxa de bits" +Afterburner="Activar AAC Afterburner"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-libfdk/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-libfdk/data/locale/sl-SI.ini
Changed
@@ -1,4 +1,4 @@ -LibFDK="libfdk AAC Encoder" -Bitrate="Bitrate" +LibFDK="Kodirnik AAC libfdk" +Bitrate="Bitna hitrost" Afterburner="Uporabi AAC Afterburner"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-libfdk/obs-libfdk.c -> obs-studio-24.0.0.tar.xz/plugins/obs-libfdk/obs-libfdk.c
Changed
@@ -1,17 +1,17 @@ #include <obs-module.h> #ifdef DEBUG -# ifndef _DEBUG -# define _DEBUG -# endif -# undef DEBUG +#ifndef _DEBUG +#define _DEBUG +#endif +#undef DEBUG #endif #include <fdk-aac/aacenc_lib.h> static const char *libfdk_get_error(AACENC_ERROR err) { - switch(err) { + switch (err) { case AACENC_OK: return "No error"; case AACENC_INVALID_HANDLE: @@ -41,7 +41,6 @@ } } - typedef struct libfdk_encoder { obs_encoder_t *encoder; @@ -70,10 +69,10 @@ obs_properties_t *props = obs_properties_create(); - obs_properties_add_int(props, "bitrate", - obs_module_text("Bitrate"), 32, 1024, 32); + obs_properties_add_int(props, "bitrate", obs_module_text("Bitrate"), 32, + 1024, 32); obs_properties_add_bool(props, "afterburner", - obs_module_text("Afterburner")); + obs_module_text("Afterburner")); return props; } @@ -84,10 +83,10 @@ obs_data_set_default_bool(settings, "afterburner", true); } -#define CHECK_LIBFDK(r) \ - if((err = (r)) != AACENC_OK) { \ +#define CHECK_LIBFDK(r) \ + if ((err = (r)) != AACENC_OK) { \ blog(LOG_ERROR, #r " failed: %s", libfdk_get_error(err)); \ - goto fail; \ + goto fail; \ } static void *libfdk_create(obs_data_t *settings, obs_encoder_t *encoder) @@ -111,7 +110,7 @@ enc->channels = (int)audio_output_get_channels(audio); enc->sample_rate = audio_output_get_sample_rate(audio); - switch(enc->channels) { + switch (enc->channels) { case 1: mode = MODE_1; break; @@ -131,7 +130,7 @@ mode = MODE_1_2_2_1; break; - /* lib_fdk-aac > 1.3 required for 7.1 surround; + /* lib_fdk-aac > 1.3 required for 7.1 surround; * uncomment if available on linux build */ #ifndef __linux__ @@ -149,16 +148,20 @@ hasFdkHandle = true; CHECK_LIBFDK(aacEncoder_SetParam(enc->fdkhandle, AACENC_AOT, - 2)); // MPEG-4 AAC-LC + 2)); // MPEG-4 AAC-LC CHECK_LIBFDK(aacEncoder_SetParam(enc->fdkhandle, AACENC_SAMPLERATE, - enc->sample_rate)); - CHECK_LIBFDK(aacEncoder_SetParam(enc->fdkhandle, AACENC_CHANNELMODE, mode)); - CHECK_LIBFDK(aacEncoder_SetParam(enc->fdkhandle, AACENC_CHANNELORDER, 1)); - CHECK_LIBFDK(aacEncoder_SetParam(enc->fdkhandle, AACENC_BITRATEMODE, 0)); - CHECK_LIBFDK(aacEncoder_SetParam(enc->fdkhandle, AACENC_BITRATE, bitrate)); + enc->sample_rate)); + CHECK_LIBFDK( + aacEncoder_SetParam(enc->fdkhandle, AACENC_CHANNELMODE, mode)); + CHECK_LIBFDK( + aacEncoder_SetParam(enc->fdkhandle, AACENC_CHANNELORDER, 1)); + CHECK_LIBFDK( + aacEncoder_SetParam(enc->fdkhandle, AACENC_BITRATEMODE, 0)); + CHECK_LIBFDK( + aacEncoder_SetParam(enc->fdkhandle, AACENC_BITRATE, bitrate)); CHECK_LIBFDK(aacEncoder_SetParam(enc->fdkhandle, AACENC_TRANSMUX, 0)); CHECK_LIBFDK(aacEncoder_SetParam(enc->fdkhandle, AACENC_AFTERBURNER, - afterburner)); + afterburner)); CHECK_LIBFDK(aacEncEncode(enc->fdkhandle, NULL, NULL, NULL, NULL)); @@ -167,27 +170,27 @@ enc->frame_size_bytes = enc->info.frameLength * 2 * enc->channels; enc->packet_buffer_size = enc->channels * 768; - if(enc->packet_buffer_size < 8192) + if (enc->packet_buffer_size < 8192) enc->packet_buffer_size = 8192; enc->packet_buffer = bmalloc(enc->packet_buffer_size); blog(LOG_INFO, "libfdk_aac encoder created"); - blog(LOG_INFO, "libfdk_aac bitrate: %d, channels: %d", - bitrate / 1000, enc->channels); + blog(LOG_INFO, "libfdk_aac bitrate: %d, channels: %d", bitrate / 1000, + enc->channels); return enc; fail: - if(hasFdkHandle) + if (hasFdkHandle) aacEncClose(&enc->fdkhandle); - if(enc->packet_buffer) + if (enc->packet_buffer) bfree(enc->packet_buffer); - if(enc) + if (enc) bfree(enc); blog(LOG_WARNING, "libfdk_aac encoder creation failed"); @@ -208,14 +211,14 @@ } static bool libfdk_encode(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, bool *received_packet) { libfdk_encoder_t *enc = data; - AACENC_BufDesc in_buf = { 0 }; - AACENC_BufDesc out_buf = { 0 }; - AACENC_InArgs in_args = { 0 }; - AACENC_OutArgs out_args = { 0 }; + AACENC_BufDesc in_buf = {0}; + AACENC_BufDesc out_buf = {0}; + AACENC_InArgs in_args = {0}; + AACENC_OutArgs out_args = {0}; int in_identifier = IN_AUDIO_DATA; int in_size, in_elem_size; int out_identifier = OUT_BITSTREAM_DATA; @@ -246,27 +249,28 @@ out_buf.bufSizes = &out_size; out_buf.bufElSizes = &out_elem_size; - if((err = aacEncEncode(enc->fdkhandle, &in_buf, &out_buf, &in_args, - &out_args)) != AACENC_OK) { - blog(LOG_ERROR, "Failed to encode frame: %s", libfdk_get_error(err)); + if ((err = aacEncEncode(enc->fdkhandle, &in_buf, &out_buf, &in_args, + &out_args)) != AACENC_OK) { + blog(LOG_ERROR, "Failed to encode frame: %s", + libfdk_get_error(err)); return false; } enc->total_samples += enc->info.frameLength; - if(out_args.numOutBytes == 0) { + if (out_args.numOutBytes == 0) { *received_packet = false; return true; } *received_packet = true; #if (AACENCODER_LIB_VL0 >= 4) - encoderDelay= enc->info.nDelay; + encoderDelay = enc->info.nDelay; #else - encoderDelay= enc->info.encoderDelay; + encoderDelay = enc->info.encoderDelay; #endif - packet->pts = enc->total_samples - encoderDelay; - packet->dts = enc->total_samples - encoderDelay; + packet->pts = enc->total_samples - encoderDelay; + packet->dts = enc->total_samples - encoderDelay; packet->data = enc->packet_buffer; packet->size = out_args.numOutBytes; packet->type = OBS_ENCODER_AUDIO; @@ -300,18 +304,18 @@ } struct obs_encoder_info obs_libfdk_encoder = { - .id = "libfdk_aac", - .type = OBS_ENCODER_AUDIO, - .codec = "AAC", - .get_name = libfdk_getname, - .create = libfdk_create, - .destroy = libfdk_destroy, - .encode = libfdk_encode, + .id = "libfdk_aac", + .type = OBS_ENCODER_AUDIO, + .codec = "AAC", + .get_name = libfdk_getname, + .create = libfdk_create, + .destroy = libfdk_destroy, + .encode = libfdk_encode, .get_frame_size = libfdk_frame_size, - .get_defaults = libfdk_defaults, + .get_defaults = libfdk_defaults, .get_properties = libfdk_properties, .get_extra_data = libfdk_extra_data, - .get_audio_info = libfdk_audio_info + .get_audio_info = libfdk_audio_info, }; bool obs_module_load(void)
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/data/locale/de-DE.ini
Changed
@@ -1,15 +1,15 @@ -RTMPStream="RTMP-Stream" -RTMPStream.DropThreshold="Drop-Threshold (Millisekunden)" -FLVOutput="FLV-Dateiausgabe" +RTMPStream="RTMP‐Stream" +RTMPStream.DropThreshold="Drop‐Threshold (Millisekunden)" +FLVOutput="FLV‐Dateiausgabe" FLVOutput.FilePath="Dateipfad" Default="Standard" ConnectionTimedOut="Zeitüberschreitung bei der Verbindung. Stellen Sie sicher, dass Sie einen gültigen Streamingdienst konfiguriert haben und keine Firewall die Verbindung blockiert." -PermissionDenied="Die Verbindung wurde blockiert. Überprüfen Sie Ihre Firewall / Anti-Virus-Einstellungen, um sicherzustellen, dass OBS vollen Internetzugang hat." +PermissionDenied="Die Verbindung wurde blockiert. Überprüfen Sie Ihre Firewall‐/Anti‐Virus‐Einstellungen, um sicherzustellen, dass OBS vollen Internetzugang hat." ConnectionAborted="Die Verbindung wurde abgebrochen. Dies bedeutet in der Regel Probleme mit der Internetverbindung zwischen Ihnen und dem Streamingdienst." ConnectionReset="Die Verbindung wurde durch Kommunikationspartner zurückgesetzt. Dies bedeutet in der Regel Probleme mit der Internetverbindung zwischen Ihnen und dem Streamingdienst." HostNotFound="Hostname nicht gefunden. Stellen Sie sicher, dass Sie einen gültigen Streamingserver eingegeben haben und Ihre Internetverbindung/DNS korrekt arbeiten." -NoData="Hostname gefunden, aber keine Daten des angeforderten Typs vorhanden. Dies kann auftreten, wenn Sie eine IPv6-Adresse verwenden, aber Ihr Streamingdienst nur über IPv4-Adressen verfügt (siehe Einstellungen → Erweitert)." -AddressNotAvailable="Adresse nicht verfügbar. Sie haben möglicherweise eine ungültige IP-Adresse versucht zu verwenden (siehe Einstellungen → Erweitert)." -SSLCertVerifyFailed="Der RTMP-Server hat ein ungültiges SSL-Zertifikat gesendet." +NoData="Hostname gefunden, aber keine Daten des angeforderten Typs vorhanden. Dies kann auftreten, wenn Sie eine IPv6‐Adresse verwenden, aber Ihr Streamingdienst nur über IPv4‐Adressen verfügt (siehe Einstellungen → Erweitert)." +AddressNotAvailable="Adresse nicht verfügbar. Sie haben möglicherweise eine ungültige IP‐Adresse versucht zu verwenden (siehe Einstellungen → Erweitert)." +SSLCertVerifyFailed="Der RTMP‐Server hat ein ungültiges SSL‐Zertifikat gesendet."
View file
obs-studio-24.0.0.tar.xz/plugins/obs-outputs/data/locale/fa-IR.ini
Added
@@ -0,0 +1,4 @@ +FLVOutput.FilePath="مسر پرونده" +Default="پیش فرض" + +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/data/locale/gl-ES.ini
Changed
@@ -1,6 +1,15 @@ -RTMPStream="Retransmisión RTMP" -RTMPStream.DropThreshold="Limiar (milisegundos)" +RTMPStream="Emisión RTMP" +RTMPStream.DropThreshold="Limiar de caída (milisegundos)" FLVOutput="Ficheiro de saída FLV" -FLVOutput.FilePath="Camiño do ficheiro" +FLVOutput.FilePath="Ruta do ficheiro" +Default="Predeterminado" +ConnectionTimedOut="A conexión esgotou o tempo Asegúrese de que configurou un servizo de emisións válido e de que ningunha devasa bloquee a conexión." +PermissionDenied="A conexión bloqueouse. Verifique a súa configuración de devasa / antivirus para asegurarse de que OBS ten acceso total a Internet." +ConnectionAborted="A conexión foi interrompida. Isto xeralmente indica problemas de conexión a Internet entre vostede e o servizo de emisións." +ConnectionReset="A conexión foi restabelecida polo par. Isto xeralmente indica problemas de conexión a Internet entre vostede e o servizo de emisións." +HostNotFound="Non se atopou o nome do servidor. Asegúrese de que introduciu un servidor de emisións válido e que a súa conexión a Internet / DNS funcionan correctamente." +NoData="Atopouse o nome do servidor, mais non hai datos do tipo solicitado. Isto pode ocorrer se está vinculado a un enderezo IPv6 e o seu servizo de emisións só ten enderezos IPv4 (ver Axustes → Avanzado)." +AddressNotAvailable="Enderezo non dispoñíbel. É posíbel que tentase ligar a un enderezo IP non válido (ver Axustes → Avanzado)." +SSLCertVerifyFailed="O servidor RTMP enviou un certificado SSL non válido."
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/data/locale/sl-SI.ini
Changed
@@ -1,6 +1,15 @@ -RTMPStream="RTMP Oddajanje" -RTMPStream.DropThreshold="Raven Padca (milisekunde)" +RTMPStream="Pretok RTMP" +RTMPStream.DropThreshold="Prag padca (ms)" FLVOutput="Izhod datoteke FLV" FLVOutput.FilePath="Pot datoteke" +Default="Privzeto" +ConnectionTimedOut="Povezava je potekla. Prepričajte se, da ste nastavili veljavno storitev za pretakanje in da požarni zid ne blokira povezave." +PermissionDenied="Povezava je bila blokirana. Preverite nastavitve požarnega zidu/protivirusnega programa in se prepričajte, da ima OBS poln dostop do interneta." +ConnectionAborted="Povezava je bila prekinjena. To običajno pomeni, da imate težave z internetno povezavo med vami in storitvijo za pretakanje." +ConnectionReset="Soležnik je ponastavil povezavo. To običajno pomeni, da imate težave z internetno povezavo med vami in storitvijo za pretakanje." +HostNotFound="Imena gostitelja ni bilo mogoče najti. Prepričajte se, da ste vnesli veljaven strežnik za pretakanje in da vaša internetna povezava/DNS pravilno delujeta." +NoData="Ime gostitelja je bilo najdeno, vendar ni podatkov zahtevane vrste. To se lahko zgodi, če ste se vezali na naslov IPv6, vaša storitev za pretakanje pa ima samo naslove IPv4 (glejte Nastavitve → Napredno)." +AddressNotAvailable="Naslov ni na voljo. Morda ste se poizkusili vezati na neveljaven naslov IP (glejte Nastavitve → Napredno)." +SSLCertVerifyFailed="Strežnik RMTP je poslal neveljavno potrdilo SSL."
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/flv-mux.c -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/flv-mux.c
Changed
@@ -56,16 +56,16 @@ fwrite(buf, 1, enc - buf, file); } -static bool build_flv_meta_data(obs_output_t *context, - uint8_t **output, size_t *size, size_t a_idx) +static bool build_flv_meta_data(obs_output_t *context, uint8_t **output, + size_t *size, size_t a_idx) { obs_encoder_t *vencoder = obs_output_get_video_encoder(context); obs_encoder_t *aencoder = obs_output_get_audio_encoder(context, a_idx); - video_t *video = obs_encoder_video(vencoder); - audio_t *audio = obs_encoder_audio(aencoder); + video_t *video = obs_encoder_video(vencoder); + audio_t *audio = obs_encoder_audio(aencoder); char buf[4096]; char *enc = buf; - char *end = enc+sizeof(buf); + char *end = enc + sizeof(buf); struct dstr encoder_name = {0}; if (a_idx > 0 && !aencoder) @@ -74,57 +74,48 @@ enc_str(&enc, end, "onMetaData"); *enc++ = AMF_ECMA_ARRAY; - enc = AMF_EncodeInt32(enc, end, a_idx == 0 ? 20 : 15); + enc = AMF_EncodeInt32(enc, end, a_idx == 0 ? 20 : 15); enc_num_val(&enc, end, "duration", 0.0); enc_num_val(&enc, end, "fileSize", 0.0); if (a_idx == 0) { enc_num_val(&enc, end, "width", - (double)obs_encoder_get_width(vencoder)); + (double)obs_encoder_get_width(vencoder)); enc_num_val(&enc, end, "height", - (double)obs_encoder_get_height(vencoder)); + (double)obs_encoder_get_height(vencoder)); enc_str_val(&enc, end, "videocodecid", "avc1"); enc_num_val(&enc, end, "videodatarate", - encoder_bitrate(vencoder)); + encoder_bitrate(vencoder)); enc_num_val(&enc, end, "framerate", - video_output_get_frame_rate(video)); + video_output_get_frame_rate(video)); } enc_str_val(&enc, end, "audiocodecid", "mp4a"); enc_num_val(&enc, end, "audiodatarate", encoder_bitrate(aencoder)); enc_num_val(&enc, end, "audiosamplerate", - (double)obs_encoder_get_sample_rate(aencoder)); + (double)obs_encoder_get_sample_rate(aencoder)); enc_num_val(&enc, end, "audiosamplesize", 16.0); enc_num_val(&enc, end, "audiochannels", - (double)audio_output_get_channels(audio)); + (double)audio_output_get_channels(audio)); enc_bool_val(&enc, end, "stereo", - audio_output_get_channels(audio) == 2); - enc_bool_val(&enc, end, "2.1", - audio_output_get_channels(audio) == 3); - enc_bool_val(&enc, end, "3.1", - audio_output_get_channels(audio) == 4); - enc_bool_val(&enc, end, "4.0", - audio_output_get_channels(audio) == 4); - enc_bool_val(&enc, end, "4.1", - audio_output_get_channels(audio) == 5); - enc_bool_val(&enc, end, "5.1", - audio_output_get_channels(audio) == 6); - enc_bool_val(&enc, end, "7.1", - audio_output_get_channels(audio) == 8); - - dstr_printf(&encoder_name, "%s (libobs version ", - MODULE_NAME); + audio_output_get_channels(audio) == 2); + enc_bool_val(&enc, end, "2.1", audio_output_get_channels(audio) == 3); + enc_bool_val(&enc, end, "3.1", audio_output_get_channels(audio) == 4); + enc_bool_val(&enc, end, "4.0", audio_output_get_channels(audio) == 4); + enc_bool_val(&enc, end, "4.1", audio_output_get_channels(audio) == 5); + enc_bool_val(&enc, end, "5.1", audio_output_get_channels(audio) == 6); + enc_bool_val(&enc, end, "7.1", audio_output_get_channels(audio) == 8); + + dstr_printf(&encoder_name, "%s (libobs version ", MODULE_NAME); #ifdef HAVE_OBSCONFIG_H dstr_cat(&encoder_name, OBS_VERSION); #else - dstr_catf(&encoder_name, "%d.%d.%d", - LIBOBS_API_MAJOR_VER, - LIBOBS_API_MINOR_VER, - LIBOBS_API_PATCH_VER); + dstr_catf(&encoder_name, "%d.%d.%d", LIBOBS_API_MAJOR_VER, + LIBOBS_API_MINOR_VER, LIBOBS_API_PATCH_VER); #endif dstr_cat(&encoder_name, ")"); @@ -132,28 +123,28 @@ enc_str_val(&enc, end, "encoder", encoder_name.array); dstr_free(&encoder_name); - *enc++ = 0; - *enc++ = 0; - *enc++ = AMF_OBJECT_END; + *enc++ = 0; + *enc++ = 0; + *enc++ = AMF_OBJECT_END; - *size = enc-buf; + *size = enc - buf; *output = bmemdup(buf, *size); return true; } bool flv_meta_data(obs_output_t *context, uint8_t **output, size_t *size, - bool write_header, size_t audio_idx) + bool write_header, size_t audio_idx) { struct array_output_data data; struct serializer s; uint8_t *meta_data = NULL; - size_t meta_data_size; + size_t meta_data_size; uint32_t start_pos; array_output_serializer_init(&s, &data); if (!build_flv_meta_data(context, &meta_data, &meta_data_size, - audio_idx)) { + audio_idx)) { bfree(meta_data); return false; } @@ -179,7 +170,7 @@ s_wb32(&s, (uint32_t)serializer_get_pos(&s) - start_pos - 1); *output = data.bytes.array; - *size = data.bytes.num; + *size = data.bytes.num; bfree(meta_data); return true; @@ -190,9 +181,9 @@ #endif static void flv_video(struct serializer *s, int32_t dts_offset, - struct encoder_packet *packet, bool is_header) + struct encoder_packet *packet, bool is_header) { - int64_t offset = packet->pts - packet->dts; + int64_t offset = packet->pts - packet->dts; int32_t time_ms = get_ms_time(packet, packet->dts) - dts_offset; if (!packet->data || !packet->size) @@ -225,7 +216,7 @@ } static void flv_audio(struct serializer *s, int32_t dts_offset, - struct encoder_packet *packet, bool is_header) + struct encoder_packet *packet, bool is_header) { int32_t time_ms = get_ms_time(packet, packet->dts) - dts_offset; @@ -258,7 +249,7 @@ } void flv_packet_mux(struct encoder_packet *packet, int32_t dts_offset, - uint8_t **output, size_t *size, bool is_header) + uint8_t **output, size_t *size, bool is_header) { struct array_output_data data; struct serializer s; @@ -271,5 +262,5 @@ flv_audio(&s, dts_offset, packet, is_header); *output = data.bytes.array; - *size = data.bytes.num; + *size = data.bytes.num; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/flv-mux.h -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/flv-mux.h
Changed
@@ -19,7 +19,7 @@ #include <obs.h> -#define MILLISECOND_DEN 1000 +#define MILLISECOND_DEN 1000 static int32_t get_ms_time(struct encoder_packet *packet, int64_t val) { @@ -29,6 +29,6 @@ extern void write_file_info(FILE *file, int64_t duration_ms, int64_t size); extern bool flv_meta_data(obs_output_t *context, uint8_t **output, size_t *size, - bool write_header, size_t audio_idx); + bool write_header, size_t audio_idx); extern void flv_packet_mux(struct encoder_packet *packet, int32_t dts_offset, - uint8_t **output, size_t *size, bool is_header); + uint8_t **output, size_t *size, bool is_header);
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/flv-output.c -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/flv-output.c
Changed
@@ -24,27 +24,27 @@ #include <inttypes.h> #include "flv-mux.h" -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[flv output: '%s'] " format, \ - obs_output_get_name(stream->output), ##__VA_ARGS__) + obs_output_get_name(stream->output), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) struct flv_output { - obs_output_t *output; - struct dstr path; - FILE *file; - volatile bool active; - volatile bool stopping; - uint64_t stop_ts; - bool sent_headers; - int64_t last_packet_ts; + obs_output_t *output; + struct dstr path; + FILE *file; + volatile bool active; + volatile bool stopping; + uint64_t stop_ts; + bool sent_headers; + int64_t last_packet_ts; pthread_mutex_t mutex; - bool got_first_video; - int32_t start_dts_offset; + bool got_first_video; + int32_t start_dts_offset; }; static inline bool stopping(struct flv_output *stream) @@ -85,16 +85,16 @@ } static int write_packet(struct flv_output *stream, - struct encoder_packet *packet, bool is_header) + struct encoder_packet *packet, bool is_header) { uint8_t *data; - size_t size; - int ret = 0; + size_t size; + int ret = 0; stream->last_packet_ts = get_ms_time(packet, packet->dts); - flv_packet_mux(packet, is_header ? 0 : stream->start_dts_offset, - &data, &size, is_header); + flv_packet_mux(packet, is_header ? 0 : stream->start_dts_offset, &data, + &size, is_header); fwrite(data, 1, size, stream->file); bfree(data); @@ -104,7 +104,7 @@ static void write_meta_data(struct flv_output *stream) { uint8_t *meta_data; - size_t meta_data_size; + size_t meta_data_size; flv_meta_data(stream->output, &meta_data, &meta_data_size, true, 0); fwrite(meta_data, 1, meta_data_size, stream->file); @@ -113,13 +113,11 @@ static void write_audio_header(struct flv_output *stream) { - obs_output_t *context = stream->output; + obs_output_t *context = stream->output; obs_encoder_t *aencoder = obs_output_get_audio_encoder(context, 0); - struct encoder_packet packet = { - .type = OBS_ENCODER_AUDIO, - .timebase_den = 1 - }; + struct encoder_packet packet = {.type = OBS_ENCODER_AUDIO, + .timebase_den = 1}; obs_encoder_get_extra_data(aencoder, &packet.data, &packet.size); write_packet(stream, &packet, true); @@ -127,16 +125,13 @@ static void write_video_header(struct flv_output *stream) { - obs_output_t *context = stream->output; + obs_output_t *context = stream->output; obs_encoder_t *vencoder = obs_output_get_video_encoder(context); - uint8_t *header; - size_t size; + uint8_t *header; + size_t size; - struct encoder_packet packet = { - .type = OBS_ENCODER_VIDEO, - .timebase_den = 1, - .keyframe = true - }; + struct encoder_packet packet = { + .type = OBS_ENCODER_VIDEO, .timebase_den = 1, .keyframe = true}; obs_encoder_get_extra_data(vencoder, &header, &size); packet.size = obs_parse_avc_header(&packet.data, header, size); @@ -214,7 +209,7 @@ static void flv_output_data(void *data, struct encoder_packet *packet) { - struct flv_output *stream = data; + struct flv_output *stream = data; struct encoder_packet parsed_packet; pthread_mutex_lock(&stream->mutex); @@ -264,21 +259,21 @@ obs_properties_t *props = obs_properties_create(); obs_properties_add_text(props, "path", - obs_module_text("FLVOutput.FilePath"), - OBS_TEXT_DEFAULT); + obs_module_text("FLVOutput.FilePath"), + OBS_TEXT_DEFAULT); return props; } struct obs_output_info flv_output_info = { - .id = "flv_output", - .flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED, + .id = "flv_output", + .flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED, .encoded_video_codecs = "h264", .encoded_audio_codecs = "aac", - .get_name = flv_output_getname, - .create = flv_output_create, - .destroy = flv_output_destroy, - .start = flv_output_start, - .stop = flv_output_stop, - .encoded_packet = flv_output_data, - .get_properties = flv_output_properties + .get_name = flv_output_getname, + .create = flv_output_create, + .destroy = flv_output_destroy, + .start = flv_output_start, + .stop = flv_output_stop, + .encoded_packet = flv_output_data, + .get_properties = flv_output_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/ftl-stream.c -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/ftl-stream.c
Changed
@@ -33,13 +33,13 @@ #define INFINITE 0xFFFFFFFF #endif -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[ftl stream: '%s'] " format, \ - obs_output_get_name(stream->output), ##__VA_ARGS__) + obs_output_get_name(stream->output), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) #define OPT_DROP_THRESHOLD "drop_threshold_ms" #define OPT_MAX_SHUTDOWN_TIME_SEC "max_shutdown_time_sec" @@ -59,56 +59,56 @@ } frame_of_nalus_t; struct ftl_stream { - obs_output_t *output; + obs_output_t *output; - pthread_mutex_t packets_mutex; + pthread_mutex_t packets_mutex; struct circlebuf packets; - bool sent_headers; - int64_t frames_sent; + bool sent_headers; + int64_t frames_sent; - volatile bool connecting; - pthread_t connect_thread; - pthread_t status_thread; + volatile bool connecting; + pthread_t connect_thread; + pthread_t status_thread; - volatile bool active; - volatile bool disconnected; - volatile bool encode_error; - pthread_t send_thread; + volatile bool active; + volatile bool disconnected; + volatile bool encode_error; + pthread_t send_thread; - int max_shutdown_time_sec; + int max_shutdown_time_sec; - os_sem_t *send_sem; - os_event_t *stop_event; - uint64_t stop_ts; - uint64_t shutdown_timeout_ts; + os_sem_t *send_sem; + os_event_t *stop_event; + uint64_t stop_ts; + uint64_t shutdown_timeout_ts; - struct dstr path; - uint32_t channel_id; - struct dstr username, password; - struct dstr encoder_name; - struct dstr bind_ip; + struct dstr path; + uint32_t channel_id; + struct dstr username, password; + struct dstr encoder_name; + struct dstr bind_ip; /* frame drop variables */ - int64_t drop_threshold_usec; - int64_t pframe_drop_threshold_usec; - int min_priority; - float congestion; + int64_t drop_threshold_usec; + int64_t pframe_drop_threshold_usec; + int min_priority; + float congestion; - int64_t last_dts_usec; + int64_t last_dts_usec; - uint64_t total_bytes_sent; - uint64_t dropped_frames; - uint64_t last_nack_count; + uint64_t total_bytes_sent; + uint64_t dropped_frames; + uint64_t last_nack_count; - ftl_handle_t ftl_handle; + ftl_handle_t ftl_handle; ftl_ingest_params_t params; - int peak_kbps; - uint32_t scale_width, scale_height, width, height; - frame_of_nalus_t coded_pic_buffer; + int peak_kbps; + uint32_t scale_width, scale_height, width, height; + frame_of_nalus_t coded_pic_buffer; }; static void log_libftl_messages(ftl_log_severity_t log_level, - const char *message); + const char *message); static int init_connect(struct ftl_stream *stream); static void *connect_thread(void *data); static void *status_thread(void *data); @@ -261,7 +261,8 @@ stream->stop_ts = ts / 1000ULL; if (ts) { - stream->shutdown_timeout_ts = ts + + stream->shutdown_timeout_ts = + ts + (uint64_t)stream->max_shutdown_time_sec * 1000000000ULL; } @@ -275,14 +276,14 @@ } static inline bool get_next_packet(struct ftl_stream *stream, - struct encoder_packet *packet) + struct encoder_packet *packet) { bool new_packet = false; pthread_mutex_lock(&stream->packets_mutex); if (stream->packets.size) { circlebuf_pop_front(&stream->packets, packet, - sizeof(struct encoder_packet)); + sizeof(struct encoder_packet)); new_packet = true; } pthread_mutex_unlock(&stream->packets_mutex); @@ -291,7 +292,7 @@ } static int avc_get_video_frame(struct ftl_stream *stream, - struct encoder_packet *packet, bool is_header) + struct encoder_packet *packet, bool is_header) { int consumed = 0; int len = (int)packet->size; @@ -301,15 +302,15 @@ while ((size_t)consumed < packet->size) { size_t total_max = sizeof(stream->coded_pic_buffer.nalus) / - sizeof(stream->coded_pic_buffer.nalus[0]); + sizeof(stream->coded_pic_buffer.nalus[0]); if ((size_t)stream->coded_pic_buffer.total >= total_max) { warn("ERROR: cannot continue, nalu buffers are full"); return -1; } - nalu = &stream->coded_pic_buffer.nalus - [stream->coded_pic_buffer.total]; + nalu = &stream->coded_pic_buffer + .nalus[stream->coded_pic_buffer.total]; if (is_header) { if (consumed == 0) { @@ -327,16 +328,13 @@ video_stream += 2; consumed += 2; } else { - len = video_stream[0] << 24 | - video_stream[1] << 16 | - video_stream[2] << 8 | - video_stream[3]; + len = video_stream[0] << 24 | video_stream[1] << 16 | + video_stream[2] << 8 | video_stream[3]; if ((size_t)len > (packet->size - (size_t)consumed)) { warn("ERROR: got len of %d but packet only " - "has %d left", - len, - (int)(packet->size - consumed)); + "has %d left", + len, (int)(packet->size - consumed)); } consumed += 4; @@ -367,8 +365,8 @@ return 0; } -static int send_packet(struct ftl_stream *stream, - struct encoder_packet *packet, bool is_header) +static int send_packet(struct ftl_stream *stream, struct encoder_packet *packet, + bool is_header) { int bytes_sent = 0; int ret = 0; @@ -381,12 +379,9 @@ for (i = 0; i < stream->coded_pic_buffer.total; i++) { nalu_t *nalu = &stream->coded_pic_buffer.nalus[i]; bytes_sent += ftl_ingest_send_media_dts( - &stream->ftl_handle, - FTL_VIDEO_DATA, - packet->dts_usec, - nalu->data, - nalu->len, - nalu->send_marker_bit); + &stream->ftl_handle, FTL_VIDEO_DATA, + packet->dts_usec, nalu->data, nalu->len, + nalu->send_marker_bit); if (nalu->send_marker_bit) { stream->frames_sent++; @@ -395,19 +390,15 @@ } else if (packet->type == OBS_ENCODER_AUDIO) { bytes_sent += ftl_ingest_send_media_dts( - &stream->ftl_handle, - FTL_AUDIO_DATA, - packet->dts_usec, - packet->data, - (int)packet->size, 0); + &stream->ftl_handle, FTL_AUDIO_DATA, packet->dts_usec, + packet->data, (int)packet->size, 0); } else { warn("Got packet type %d", packet->type); } if (is_header) { bfree(packet->data); - } - else { + } else { obs_encoder_packet_release(packet); } @@ -422,58 +413,56 @@ speed_test_t results; ftl_status_t status_code; - status_code = ftl_ingest_speed_test_ex( - &stream->ftl_handle, - speedtest_kbps, - speedtest_duration, - &results); + status_code = ftl_ingest_speed_test_ex(&stream->ftl_handle, + speedtest_kbps, + speedtest_duration, &results); float percent_lost = 0; if (status_code == FTL_SUCCESS) { percent_lost = (float)results.lost_pkts * 100.f / - (float)results.pkts_sent; + (float)results.pkts_sent; } else { warn("Speed test failed with: %s", - ftl_status_code_to_string(status_code)); + ftl_status_code_to_string(status_code)); } // Get what the user set the encoding bitrate to. - obs_encoder_t *video_encoder = obs_output_get_video_encoder(stream->output); + obs_encoder_t *video_encoder = + obs_output_get_video_encoder(stream->output); obs_data_t *video_settings = obs_encoder_get_settings(video_encoder); - int user_desired_bitrate = (int)obs_data_get_int(video_settings, "bitrate"); + int user_desired_bitrate = + (int)obs_data_get_int(video_settings, "bitrate"); obs_data_release(video_settings); // Report the results. info("Speed test completed: User desired bitrate %d, Peak kbps %d, " - "initial rtt %d, " - "final rtt %d, %3.2f lost packets", - user_desired_bitrate, - results.peak_kbps, - results.starting_rtt, - results.ending_rtt, - percent_lost); + "initial rtt %d, " + "final rtt %d, %3.2f lost packets", + user_desired_bitrate, results.peak_kbps, results.starting_rtt, + results.ending_rtt, percent_lost); // We still want to set the peak to about 1.2x what the target bitrate is, // even if the speed test reported it should be lower. If we don't, FTL // will queue data on the client and start adding latency. If the internet // connection really can't handle the bitrate the user will see either lost frame // and recovered frame counts go up, which is reflect in the dropped_frames count. - stream->peak_kbps = stream->params.peak_kbps = user_desired_bitrate * 12 / 10; + stream->peak_kbps = stream->params.peak_kbps = + user_desired_bitrate * 12 / 10; ftl_ingest_update_params(&stream->ftl_handle, &stream->params); } static inline bool send_headers(struct ftl_stream *stream, int64_t dts_usec); static inline bool can_shutdown_stream(struct ftl_stream *stream, - struct encoder_packet *packet) + struct encoder_packet *packet) { uint64_t cur_time = os_gettime_ns(); bool timeout = cur_time >= stream->shutdown_timeout_ts; if (timeout) info("Stream shutdown timeout reached (%d second(s))", - stream->max_shutdown_time_sec); + stream->max_shutdown_time_sec); return timeout || packet->sys_dts_usec >= (int64_t)stream->stop_ts; } @@ -552,17 +541,15 @@ static bool send_video_header(struct ftl_stream *stream, int64_t dts_usec) { - obs_output_t *context = stream->output; + obs_output_t *context = stream->output; obs_encoder_t *vencoder = obs_output_get_video_encoder(context); - uint8_t *header; - size_t size; + uint8_t *header; + size_t size; - struct encoder_packet packet = { - .type = OBS_ENCODER_VIDEO, - .timebase_den = 1, - .keyframe = true, - .dts_usec = dts_usec - }; + struct encoder_packet packet = {.type = OBS_ENCODER_VIDEO, + .timebase_den = 1, + .keyframe = true, + .dts_usec = dts_usec}; obs_encoder_get_extra_data(vencoder, &header, &size); packet.size = obs_parse_avc_header(&packet.data, header, size); @@ -626,12 +613,12 @@ if (status_code != FTL_SUCCESS) { if (status_code == FTL_BAD_OR_INVALID_STREAM_KEY) { blog(LOG_ERROR, "Invalid Key (%s)", - ftl_status_code_to_string(status_code)); + ftl_status_code_to_string(status_code)); return OBS_OUTPUT_INVALID_STREAM; } else { warn("Ingest connect failed with: %s (%d)", - ftl_status_code_to_string(status_code), - status_code); + ftl_status_code_to_string(status_code), + status_code); return _ftl_error_to_obs_error(status_code); } } @@ -653,7 +640,8 @@ info("ftl_stream_start"); // Mixer doesn't support bframes. So force them off. - obs_encoder_t *video_encoder = obs_output_get_video_encoder(stream->output); + obs_encoder_t *video_encoder = + obs_output_get_video_encoder(stream->output); obs_data_t *video_settings = obs_encoder_get_settings(video_encoder); obs_data_set_int(video_settings, "bf", 0); obs_data_release(video_settings); @@ -669,14 +657,14 @@ os_atomic_set_bool(&stream->connecting, true); return pthread_create(&stream->connect_thread, NULL, connect_thread, - stream) == 0; + stream) == 0; } static inline bool add_packet(struct ftl_stream *stream, - struct encoder_packet *packet) + struct encoder_packet *packet) { circlebuf_push_back(&stream->packets, packet, - sizeof(struct encoder_packet)); + sizeof(struct encoder_packet)); return true; } @@ -686,12 +674,12 @@ } static void drop_frames(struct ftl_stream *stream, const char *name, - int highest_priority, bool pframes) + int highest_priority, bool pframes) { UNUSED_PARAMETER(pframes); - struct circlebuf new_buf = {0}; - int num_frames_dropped = 0; + struct circlebuf new_buf = {0}; + int num_frames_dropped = 0; #ifdef _DEBUG int start_packets = (int)num_buffered_packets(stream); @@ -706,7 +694,7 @@ circlebuf_pop_front(&stream->packets, &packet, sizeof(packet)); /* do not drop audio data or video keyframes */ - if (packet.type == OBS_ENCODER_AUDIO || + if (packet.type == OBS_ENCODER_AUDIO || packet.drop_priority >= highest_priority) { circlebuf_push_back(&new_buf, &packet, sizeof(packet)); @@ -726,21 +714,19 @@ stream->dropped_frames += num_frames_dropped; #ifdef _DEBUG - debug("Dropped %s, prev packet count: %d, new packet count: %d", - name, - start_packets, - (int)num_buffered_packets(stream)); + debug("Dropped %s, prev packet count: %d, new packet count: %d", name, + start_packets, (int)num_buffered_packets(stream)); #endif } static bool find_first_video_packet(struct ftl_stream *stream, - struct encoder_packet *first) + struct encoder_packet *first) { size_t count = stream->packets.size / sizeof(*first); for (size_t i = 0; i < count; i++) { - struct encoder_packet *cur = circlebuf_data(&stream->packets, - i * sizeof(*first)); + struct encoder_packet *cur = + circlebuf_data(&stream->packets, i * sizeof(*first)); if (cur->type == OBS_ENCODER_VIDEO && !cur->keyframe) { *first = *cur; return true; @@ -756,11 +742,10 @@ int64_t buffer_duration_usec; size_t num_packets = num_buffered_packets(stream); const char *name = pframes ? "p-frames" : "b-frames"; - int priority = pframes ? - OBS_NAL_PRIORITY_HIGHEST : OBS_NAL_PRIORITY_HIGH; - int64_t drop_threshold = pframes ? - stream->pframe_drop_threshold_usec : - stream->drop_threshold_usec; + int priority = pframes ? OBS_NAL_PRIORITY_HIGHEST + : OBS_NAL_PRIORITY_HIGH; + int64_t drop_threshold = pframes ? stream->pframe_drop_threshold_usec + : stream->drop_threshold_usec; if (num_packets < 5) { if (!pframes) @@ -776,8 +761,8 @@ buffer_duration_usec = stream->last_dts_usec - first.dts_usec; if (!pframes) { - stream->congestion = (float)buffer_duration_usec / - (float)drop_threshold; + stream->congestion = + (float)buffer_duration_usec / (float)drop_threshold; } if (buffer_duration_usec > drop_threshold) { @@ -787,7 +772,7 @@ } static bool add_video_packet(struct ftl_stream *stream, - struct encoder_packet *packet) + struct encoder_packet *packet) { check_to_drop_frames(stream, false); check_to_drop_frames(stream, true); @@ -805,13 +790,12 @@ return add_packet(stream, packet); } - static void ftl_stream_data(void *data, struct encoder_packet *packet) { - struct ftl_stream *stream = data; + struct ftl_stream *stream = data; struct encoder_packet new_packet; - bool added_packet = false; + bool added_packet = false; if (disconnected(stream) || !active(stream)) return; @@ -831,9 +815,9 @@ pthread_mutex_lock(&stream->packets_mutex); if (!disconnected(stream)) { - added_packet = (packet->type == OBS_ENCODER_VIDEO) ? - add_video_packet(stream, &new_packet) : - add_packet(stream, &new_packet); + added_packet = (packet->type == OBS_ENCODER_VIDEO) + ? add_video_packet(stream, &new_packet) + : add_packet(stream, &new_packet); } pthread_mutex_unlock(&stream->packets_mutex); @@ -849,20 +833,18 @@ UNUSED_PARAMETER(defaults); } - static obs_properties_t *ftl_stream_properties(void *unused) { UNUSED_PARAMETER(unused); obs_properties_t *props = obs_properties_create(); obs_properties_add_int(props, "peak_bitrate_kbps", - obs_module_text("FTLStream.PeakBitrate"), - 1000, 10000, 500); + obs_module_text("FTLStream.PeakBitrate"), 1000, + 10000, 500); return props; } - static uint64_t ftl_stream_total_bytes_sent(void *data) { struct ftl_stream *stream = data; @@ -889,13 +871,13 @@ }; static enum ret_type ftl_event(struct ftl_stream *stream, - ftl_status_msg_t status) + ftl_status_msg_t status) { if (status.msg.event.type != FTL_STATUS_EVENT_TYPE_DISCONNECTED) return RET_CONTINUE; info("Disconnected from ingest with reason: %s", - ftl_status_code_to_string(status.msg.event.error_code)); + ftl_status_code_to_string(status.msg.event.error_code)); if (status.msg.event.reason == FTL_STATUS_EVENT_REASON_API_REQUEST) { return RET_BREAK; @@ -916,7 +898,7 @@ while (!disconnected(stream)) { status_code = ftl_ingest_get_status(&stream->ftl_handle, - &status, 1000); + &status, 1000); if (status_code == FTL_STATUS_TIMEOUT || status_code == FTL_QUEUE_EMPTY) { @@ -932,24 +914,25 @@ else if (ret_type == RET_BREAK) break; - } else if(status.type == FTL_STATUS_LOG) { + } else if (status.type == FTL_STATUS_LOG) { blog(LOG_INFO, "[%d] %s", status.msg.log.log_level, - status.msg.log.string); + status.msg.log.string); } else if (status.type == FTL_STATUS_VIDEO_PACKETS) { ftl_packet_stats_msg_t *p = &status.msg.pkt_stats; // Report nack requests as dropped frames stream->dropped_frames += - p->nack_reqs -stream->last_nack_count; + p->nack_reqs - stream->last_nack_count; stream->last_nack_count = p->nack_reqs; int log_level = p->nack_reqs > 0 ? LOG_INFO : LOG_DEBUG; - blog(log_level, "Avg packet send per second %3.1f, " - "total nack requests %d", - (float)p->sent * 1000.f / p->period, - (int)p->nack_reqs); + blog(log_level, + "Avg packet send per second %3.1f, " + "total nack requests %d", + (float)p->sent * 1000.f / p->period, + (int)p->nack_reqs); } else if (status.type == FTL_STATUS_VIDEO_PACKETS_INSTANT) { ftl_packet_stats_instant_msg_t *p = @@ -957,34 +940,38 @@ int log_level = p->avg_rtt > 20 ? LOG_INFO : LOG_DEBUG; - blog(log_level, "avg transmit delay %dms " - "(min: %d, max: %d), " - "avg rtt %dms (min: %d, max: %d)", - p->avg_xmit_delay, - p->min_xmit_delay, p->max_xmit_delay, - p->avg_rtt, p->min_rtt, p->max_rtt); + blog(log_level, + "avg transmit delay %dms " + "(min: %d, max: %d), " + "avg rtt %dms (min: %d, max: %d)", + p->avg_xmit_delay, p->min_xmit_delay, + p->max_xmit_delay, p->avg_rtt, p->min_rtt, + p->max_rtt); } else if (status.type == FTL_STATUS_VIDEO) { ftl_video_frame_stats_msg_t *v = &status.msg.video_stats; - int log_level = v->queue_fullness > 0 ? - LOG_INFO : LOG_DEBUG; - - blog(log_level, "Queue an average of %3.2f fps " - "(%3.1f kbps), " - "sent an average of %3.2f fps " - "(%3.1f kbps), " - "queue fullness %d, " - "max frame size %d", - (float)v->frames_queued * 1000.f / v->period, - (float)v->bytes_queued / v->period * 8, - (float)v->frames_sent * 1000.f / v->period, - (float)v->bytes_sent / v->period * 8, - v->queue_fullness, v->max_frame_size); + int log_level = v->queue_fullness > 0 ? LOG_INFO + : LOG_DEBUG; + + blog(log_level, + "Queue an average of %3.2f fps " + "(%3.1f kbps), " + "sent an average of %3.2f fps " + "(%3.1f kbps), " + "queue fullness %d, " + "max frame size %d", + (float)v->frames_queued * 1000.f / v->period, + (float)v->bytes_queued / v->period * 8, + (float)v->frames_sent * 1000.f / v->period, + (float)v->bytes_sent / v->period * 8, + v->queue_fullness, v->max_frame_size); } else { - blog(LOG_DEBUG, "Status: Got Status message of type " - "%d", status.type); + blog(LOG_DEBUG, + "Status: Got Status message of type " + "%d", + status.type); } } @@ -1022,7 +1009,7 @@ } static void log_libftl_messages(ftl_log_severity_t log_level, - const char * message) + const char *message) { UNUSED_PARAMETER(log_level); blog(LOG_WARNING, "[libftl] %s", message); @@ -1049,15 +1036,14 @@ os_atomic_set_bool(&stream->disconnected, false); os_atomic_set_bool(&stream->encode_error, false); - stream->total_bytes_sent = 0; - stream->dropped_frames = 0; - stream->min_priority = 0; + stream->total_bytes_sent = 0; + stream->dropped_frames = 0; + stream->min_priority = 0; settings = obs_output_get_settings(stream->output); obs_encoder_t *video_encoder = obs_output_get_video_encoder(stream->output); - obs_data_t *video_settings = - obs_encoder_get_settings(video_encoder); + obs_data_t *video_settings = obs_encoder_get_settings(video_encoder); dstr_copy(&stream->path, obs_service_get_url(service)); key = obs_service_get_key(service); @@ -1070,14 +1056,14 @@ peak_bitrate = target_bitrate; } - stream->params.stream_key = (char*)key; + stream->params.stream_key = (char *)key; stream->params.video_codec = FTL_VIDEO_H264; stream->params.audio_codec = FTL_AUDIO_OPUS; stream->params.ingest_hostname = stream->path.array; stream->params.vendor_name = "OBS Studio"; stream->params.vendor_version = OBS_VERSION; - stream->params.peak_kbps = - stream->peak_kbps < 0 ? 0 : stream->peak_kbps; + stream->params.peak_kbps = stream->peak_kbps < 0 ? 0 + : stream->peak_kbps; //not required when using ftl_ingest_send_media_dts stream->params.fps_num = 0; @@ -1087,12 +1073,11 @@ if (status_code != FTL_SUCCESS) { if (status_code == FTL_BAD_OR_INVALID_STREAM_KEY) { blog(LOG_ERROR, "Invalid Key (%s)", - ftl_status_code_to_string(status_code)); + ftl_status_code_to_string(status_code)); return OBS_OUTPUT_INVALID_STREAM; - } - else { + } else { blog(LOG_ERROR, "Failed to create ingest handle (%s)", - ftl_status_code_to_string(status_code)); + ftl_status_code_to_string(status_code)); return OBS_OUTPUT_ERROR; } } @@ -1161,21 +1146,19 @@ } struct obs_output_info ftl_output_info = { - .id = "ftl_output", - .flags = OBS_OUTPUT_AV | - OBS_OUTPUT_ENCODED | - OBS_OUTPUT_SERVICE, + .id = "ftl_output", + .flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED | OBS_OUTPUT_SERVICE, .encoded_video_codecs = "h264", .encoded_audio_codecs = "opus", - .get_name = ftl_stream_getname, - .create = ftl_stream_create, - .destroy = ftl_stream_destroy, - .start = ftl_stream_start, - .stop = ftl_stream_stop, - .encoded_packet = ftl_stream_data, - .get_defaults = ftl_stream_defaults, - .get_properties = ftl_stream_properties, - .get_total_bytes = ftl_stream_total_bytes_sent, - .get_congestion = ftl_stream_congestion, - .get_dropped_frames = ftl_stream_dropped_frames + .get_name = ftl_stream_getname, + .create = ftl_stream_create, + .destroy = ftl_stream_destroy, + .start = ftl_stream_start, + .stop = ftl_stream_stop, + .encoded_packet = ftl_stream_data, + .get_defaults = ftl_stream_defaults, + .get_properties = ftl_stream_properties, + .get_total_bytes = ftl_stream_total_bytes_sent, + .get_congestion = ftl_stream_congestion, + .get_dropped_frames = ftl_stream_dropped_frames, };
View file
obs-studio-24.0.0.tar.xz/plugins/obs-outputs/librtmp/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/net-if.c -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/net-if.c
Changed
@@ -24,12 +24,13 @@ #define do_log(level, format, ...) \ blog(level, "[net if] " format, ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) static inline void netif_saddr_data_push_back(struct netif_saddr_data *sd, - const char *ip, const char *adapter) + const char *ip, + const char *adapter) { struct netif_saddr_item item; struct dstr full_name = {0}; @@ -47,32 +48,33 @@ } static void netif_convert_to_string(char *dest, - struct sockaddr_storage *byte_address) + struct sockaddr_storage *byte_address) { int family = byte_address->ss_family; char temp_char[INET6_ADDRSTRLEN] = {0}; #ifndef _WIN32 if (family == AF_INET) - inet_ntop(family, &(((struct sockaddr_in*)byte_address)->sin_addr), - temp_char, INET6_ADDRSTRLEN); + inet_ntop(family, + &(((struct sockaddr_in *)byte_address)->sin_addr), + temp_char, INET6_ADDRSTRLEN); else if (family == AF_INET6) - inet_ntop(family, &(((struct sockaddr_in*)byte_address)->sin_addr), - temp_char, INET6_ADDRSTRLEN); + inet_ntop(family, + &(((struct sockaddr_in *)byte_address)->sin_addr), + temp_char, INET6_ADDRSTRLEN); #else if (family == AF_INET) InetNtopA(family, &(((SOCKADDR_IN *)byte_address)->sin_addr), - temp_char, INET6_ADDRSTRLEN); + temp_char, INET6_ADDRSTRLEN); else if (family == AF_INET6) InetNtopA(family, &(((SOCKADDR_IN6 *)byte_address)->sin6_addr), - temp_char, INET6_ADDRSTRLEN); + temp_char, INET6_ADDRSTRLEN); #endif strncpy(dest, temp_char, INET6_ADDRSTRLEN); } static void netif_push(struct sockaddr *copy_source, - struct netif_saddr_data *saddr_d, - const char *adapter) + struct netif_saddr_data *saddr_d, const char *adapter) { char temp_char[INET6_ADDRSTRLEN] = {0}; struct sockaddr_storage sa = {0}; @@ -88,12 +90,12 @@ void netif_log_saddrs(struct netif_saddr_data *sd) { - for(size_t i = 0; i < sd->addrs.num; i++) + for (size_t i = 0; i < sd->addrs.num; i++) info("\t\t%s", sd->addrs.array[i].name); } bool netif_str_to_addr(struct sockaddr_storage *out, int *addr_len, - const char *addr) + const char *addr) { bool ipv6; @@ -109,16 +111,15 @@ #ifdef _WIN32 int ret = WSAStringToAddressA((LPSTR)addr, out->ss_family, NULL, - (LPSOCKADDR)out, addr_len); + (LPSOCKADDR)out, addr_len); if (ret == SOCKET_ERROR) warn("Could not parse address, error code: %d", GetLastError()); return ret != SOCKET_ERROR; #else struct sockaddr_in *sin = (struct sockaddr_in *)out; if (inet_pton(out->ss_family, addr, &sin->sin_addr)) { - *addr_len = ipv6 ? - sizeof(struct sockaddr_in6) : - sizeof(struct sockaddr_in); + *addr_len = ipv6 ? sizeof(struct sockaddr_in6) + : sizeof(struct sockaddr_in); return true; } @@ -152,13 +153,14 @@ if ((family == AF_INET) || (family == AF_INET6)) { s = getnameinfo(ifa->ifa_addr, - (family == AF_INET) ? - sizeof(struct sockaddr_in) : - sizeof(struct sockaddr_in6), - host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST); + (family == AF_INET) + ? sizeof(struct sockaddr_in) + : sizeof(struct sockaddr_in6), + host, NI_MAXHOST, NULL, 0, + NI_NUMERICHOST); if (s != 0) { warn("getnameinfo() failed: %s", - gai_strerror(s)); + gai_strerror(s)); continue; } @@ -176,20 +178,18 @@ PIP_ADAPTER_ADDRESSES adapter = NULL; unsigned long ret = 0; unsigned long out_buf_len = 16384; - unsigned long flags = - GAA_FLAG_SKIP_ANYCAST | - GAA_FLAG_SKIP_MULTICAST | - GAA_FLAG_SKIP_DNS_SERVER; + unsigned long flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | + GAA_FLAG_SKIP_DNS_SERVER; const int max_tries = 3; int i = 0; do { - adapter = (IP_ADAPTER_ADDRESSES*)bmalloc(out_buf_len); + adapter = (IP_ADAPTER_ADDRESSES *)bmalloc(out_buf_len); if (!adapter) return NULL; ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapter, - &out_buf_len); + &out_buf_len); if (ret == ERROR_BUFFER_OVERFLOW) { bfree(adapter); adapter = NULL; @@ -205,16 +205,15 @@ bfree(adapter); adapter = NULL; - FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, ret, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - msg_buf, 0, NULL); + FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, ret, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&msg_buf, 0, NULL); if (msg_buf) { warn("Call to GetAdaptersAddresses failed: %s (%d)", - msg_buf, ret); + msg_buf, ret); LocalFree(msg_buf); } } @@ -250,7 +249,7 @@ family = socket_addr.lpSockaddr->sa_family; if (family == AF_INET || family == AF_INET6) netif_push(socket_addr.lpSockaddr, ifaddrs, - adap_name); + adap_name); } bfree(adap_name);
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/net-if.h -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/net-if.h
Changed
@@ -20,36 +20,36 @@ #include <util/darray.h> #ifdef _WIN32 -# include <ws2tcpip.h> -# include <winsock2.h> -# include <ws2ipdef.h> -# include <iphlpapi.h> +#include <ws2tcpip.h> +#include <winsock2.h> +#include <ws2ipdef.h> +#include <iphlpapi.h> #else -# ifdef __linux__ -# include <linux/if_link.h> -# elif __FreeBSD__ -# include <netinet/in.h> -# ifndef _GNU_SOURCE -# define _GNU_SOURCE -# define __NET_IF_GNU_SOURCE__ -# endif //_GNU_SOURCE -# endif //__FreeBSD__ +#ifdef __linux__ +#include <linux/if_link.h> +#elif __FreeBSD__ +#include <netinet/in.h> +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#define __NET_IF_GNU_SOURCE__ +#endif //_GNU_SOURCE +#endif //__FreeBSD__ -# include <ifaddrs.h> -# include <netdb.h> -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <arpa/inet.h> -# include <sys/socket.h> +#include <ifaddrs.h> +#include <netdb.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <arpa/inet.h> +#include <sys/socket.h> -# ifdef __FreeBSD__ -# ifdef ___NET_IF_GNU_SOURCE__ -# undef ___NET_IF_GNU_SOURCE__ -# undef _GNU_SOURCE -# endif -# endif +#ifdef __FreeBSD__ +#ifdef ___NET_IF_GNU_SOURCE__ +#undef ___NET_IF_GNU_SOURCE__ +#undef _GNU_SOURCE +#endif +#endif #endif @@ -72,6 +72,6 @@ } extern bool netif_str_to_addr(struct sockaddr_storage *out, int *addr_len, - const char *addr); + const char *addr); extern void netif_get_addrs(struct netif_saddr_data *ifaddrs); extern void netif_log_saddrs(struct netif_saddr_data *sd);
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/null-output.c -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/null-output.c
Changed
@@ -77,7 +77,8 @@ UNUSED_PARAMETER(ts); context->stop_thread_active = pthread_create(&context->stop_thread, - NULL, stop_thread, data) == 0; + NULL, stop_thread, + data) == 0; } static void null_output_data(void *data, struct encoder_packet *packet) @@ -87,13 +88,12 @@ } struct obs_output_info null_output_info = { - .id = "null_output", - .flags = OBS_OUTPUT_AV | - OBS_OUTPUT_ENCODED, - .get_name = null_output_getname, - .create = null_output_create, - .destroy = null_output_destroy, - .start = null_output_start, - .stop = null_output_stop, - .encoded_packet = null_output_data + .id = "null_output", + .flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED, + .get_name = null_output_getname, + .create = null_output_create, + .destroy = null_output_destroy, + .start = null_output_start, + .stop = null_output_stop, + .encoded_packet = null_output_data, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/rtmp-helpers.h -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/rtmp-helpers.h
Changed
@@ -21,32 +21,31 @@ static inline AVal *flv_str(AVal *out, const char *str) { - out->av_val = (char*)str; + out->av_val = (char *)str; out->av_len = (int)strlen(str); return out; } static inline void enc_num_val(char **enc, char *end, const char *name, - double val) + double val) { AVal s; *enc = AMF_EncodeNamedNumber(*enc, end, flv_str(&s, name), val); } static inline void enc_bool_val(char **enc, char *end, const char *name, - bool val) + bool val) { AVal s; *enc = AMF_EncodeNamedBoolean(*enc, end, flv_str(&s, name), val); } static inline void enc_str_val(char **enc, char *end, const char *name, - const char *val) + const char *val) { AVal s1, s2; - *enc = AMF_EncodeNamedString(*enc, end, - flv_str(&s1, name), - flv_str(&s2, val)); + *enc = AMF_EncodeNamedString(*enc, end, flv_str(&s1, name), + flv_str(&s2, val)); } static inline void enc_str(char **enc, char *end, const char *str)
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/rtmp-stream.c -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/rtmp-stream.c
Changed
@@ -17,6 +17,24 @@ #include "rtmp-stream.h" +#ifndef SEC_TO_NSEC +#define SEC_TO_NSEC 1000000000ULL +#endif + +#ifndef MSEC_TO_USEC +#define MSEC_TO_USEC 1000ULL +#endif + +#ifndef MSEC_TO_NSEC +#define MSEC_TO_NSEC 1000000ULL +#endif + +/* dynamic bitrate coefficients */ +#define DBR_INC_TIMER (30ULL * SEC_TO_NSEC) +#define DBR_TRIGGER_USEC (200ULL * MSEC_TO_USEC) +#define MIN_ESTIMATE_DURATION_MS 1000 +#define MAX_ESTIMATE_DURATION_MS 2000 + static const char *rtmp_stream_getname(void *unused) { UNUSED_PARAMETER(unused); @@ -107,6 +125,8 @@ #ifdef TEST_FRAMEDROPS circlebuf_free(&stream->droptest_info); #endif + circlebuf_free(&stream->dbr_frames); + pthread_mutex_destroy(&stream->dbr_mutex); os_event_destroy(stream->buffer_space_available_event); os_event_destroy(stream->buffer_has_data_event); @@ -139,23 +159,28 @@ goto fail; } + if (pthread_mutex_init(&stream->dbr_mutex, NULL) != 0) { + warn("Failed to initialize dbr mutex"); + goto fail; + } + if (os_event_init(&stream->buffer_space_available_event, - OS_EVENT_TYPE_AUTO) != 0) { + OS_EVENT_TYPE_AUTO) != 0) { warn("Failed to initialize write buffer event"); goto fail; } - if (os_event_init(&stream->buffer_has_data_event, - OS_EVENT_TYPE_AUTO) != 0) { + if (os_event_init(&stream->buffer_has_data_event, OS_EVENT_TYPE_AUTO) != + 0) { warn("Failed to initialize data buffer event"); goto fail; } if (os_event_init(&stream->socket_available_event, - OS_EVENT_TYPE_AUTO) != 0) { + OS_EVENT_TYPE_AUTO) != 0) { warn("Failed to initialize socket buffer event"); goto fail; } if (os_event_init(&stream->send_thread_signaled_exit, - OS_EVENT_TYPE_MANUAL) != 0) { + OS_EVENT_TYPE_MANUAL) != 0) { warn("Failed to initialize socket exit event"); goto fail; } @@ -181,7 +206,8 @@ stream->stop_ts = ts / 1000ULL; if (ts) - stream->shutdown_timeout_ts = ts + + stream->shutdown_timeout_ts = + ts + (uint64_t)stream->max_shutdown_time_sec * 1000000000ULL; if (active(stream)) { @@ -195,27 +221,27 @@ static inline void set_rtmp_str(AVal *val, const char *str) { - bool valid = (str && *str); - val->av_val = valid ? (char*)str : NULL; + bool valid = (str && *str); + val->av_val = valid ? (char *)str : NULL; val->av_len = valid ? (int)strlen(str) : 0; } static inline void set_rtmp_dstr(AVal *val, struct dstr *str) { - bool valid = !dstr_is_empty(str); - val->av_val = valid ? str->array : NULL; + bool valid = !dstr_is_empty(str); + val->av_val = valid ? str->array : NULL; val->av_len = valid ? (int)str->len : 0; } static inline bool get_next_packet(struct rtmp_stream *stream, - struct encoder_packet *packet) + struct encoder_packet *packet) { bool new_packet = false; pthread_mutex_lock(&stream->packets_mutex); if (stream->packets.size) { circlebuf_pop_front(&stream->packets, packet, - sizeof(struct encoder_packet)); + sizeof(struct encoder_packet)); new_packet = true; } pthread_mutex_unlock(&stream->packets_mutex); @@ -251,7 +277,7 @@ #endif if (ret < 0) { do_log(LOG_ERROR, "recv error: %d (%d bytes)", - error, (int)size); + error, (int)size); } return false; } @@ -266,6 +292,49 @@ uint64_t ts = os_gettime_ns(); struct droptest_info info; +#if defined(_WIN32) && defined(TEST_FRAMEDROPS_WITH_BITRATE_SHORTCUTS) + uint64_t check_elapsed = ts - stream->droptest_last_key_check; + + if (check_elapsed > (200ULL * MSEC_TO_NSEC)) { + size_t bitrate = 0; + + stream->droptest_last_key_check = ts; + + if (GetAsyncKeyState(VK_NUMPAD0) & 0x8000) { + stream->droptest_max = 0; + } else if (GetAsyncKeyState(VK_NUMPAD1) & 0x8000) { + bitrate = 1000; + } else if (GetAsyncKeyState(VK_NUMPAD2) & 0x8000) { + bitrate = 2000; + } else if (GetAsyncKeyState(VK_NUMPAD3) & 0x8000) { + bitrate = 3000; + } else if (GetAsyncKeyState(VK_NUMPAD4) & 0x8000) { + bitrate = 4000; + } else if (GetAsyncKeyState(VK_NUMPAD5) & 0x8000) { + bitrate = 5000; + } else if (GetAsyncKeyState(VK_NUMPAD6) & 0x8000) { + bitrate = 6000; + } else if (GetAsyncKeyState(VK_NUMPAD7) & 0x8000) { + bitrate = 7000; + } else if (GetAsyncKeyState(VK_NUMPAD8) & 0x8000) { + bitrate = 8000; + } else if (GetAsyncKeyState(VK_NUMPAD9) & 0x8000) { + bitrate = 9000; + } + + if (bitrate) { + stream->droptest_max = (bitrate * 1000 / 8); + } + } + if (!stream->droptest_max) { + return; + } +#else + if (!stream->droptest_max) { + stream->droptest_max = DROPTEST_MAX_BYTES; + } +#endif + info.ts = ts; info.size = size; @@ -273,10 +342,10 @@ stream->droptest_size += size; if (stream->droptest_info.size) { - circlebuf_peek_front(&stream->droptest_info, - &info, sizeof(info)); + circlebuf_peek_front(&stream->droptest_info, &info, + sizeof(info)); - if (stream->droptest_size > DROPTEST_MAX_BYTES) { + if (stream->droptest_size > stream->droptest_max) { uint64_t elapsed = ts - info.ts; if (elapsed < 1000000000ULL) { @@ -284,9 +353,9 @@ os_sleepto_ns(ts + elapsed); } - while (stream->droptest_size > DROPTEST_MAX_BYTES) { + while (stream->droptest_size > stream->droptest_max) { circlebuf_pop_front(&stream->droptest_info, - &info, sizeof(info)); + &info, sizeof(info)); stream->droptest_size -= info.size; } } @@ -294,7 +363,8 @@ } #endif -static int socket_queue_data(RTMPSockBuf *sb, const char *data, int len, void *arg) +static int socket_queue_data(RTMPSockBuf *sb, const char *data, int len, + void *arg) { UNUSED_PARAMETER(sb); @@ -323,23 +393,24 @@ pthread_mutex_unlock(&stream->write_buf_mutex); - os_event_signal (stream->buffer_has_data_event); + os_event_signal(stream->buffer_has_data_event); return len; } static int send_packet(struct rtmp_stream *stream, - struct encoder_packet *packet, bool is_header, size_t idx) + struct encoder_packet *packet, bool is_header, + size_t idx) { uint8_t *data; - size_t size; - int recv_size = 0; - int ret = 0; + size_t size; + int recv_size = 0; + int ret = 0; if (!stream->new_socket_loop) { #ifdef _WIN32 ret = ioctlsocket(stream->rtmp.m_sb.sb_socket, FIONREAD, - (u_long*)&recv_size); + (u_long *)&recv_size); #else ret = ioctl(stream->rtmp.m_sb.sb_socket, FIONREAD, &recv_size); #endif @@ -350,14 +421,14 @@ } } - flv_packet_mux(packet, is_header ? 0 : stream->start_dts_offset, - &data, &size, is_header); + flv_packet_mux(packet, is_header ? 0 : stream->start_dts_offset, &data, + &size, is_header); #ifdef TEST_FRAMEDROPS droptest_cap_data_rate(stream, size); #endif - ret = RTMP_Write(&stream->rtmp, (char*)data, (int)size, (int)idx); + ret = RTMP_Write(&stream->rtmp, (char *)data, (int)size, (int)idx); bfree(data); if (is_header) @@ -372,14 +443,14 @@ static inline bool send_headers(struct rtmp_stream *stream); static inline bool can_shutdown_stream(struct rtmp_stream *stream, - struct encoder_packet *packet) + struct encoder_packet *packet) { uint64_t cur_time = os_gettime_ns(); bool timeout = cur_time >= stream->shutdown_timeout_ts; if (timeout) info("Stream shutdown timeout reached (%d second(s))", - stream->max_shutdown_time_sec); + stream->max_shutdown_time_sec); return timeout || packet->sys_dts_usec >= (int64_t)stream->stop_ts; } @@ -388,8 +459,7 @@ { const char *msg = NULL; #ifdef _WIN32 - switch (stream->rtmp.last_error_code) - { + switch (stream->rtmp.last_error_code) { case WSAETIMEDOUT: msg = obs_module_text("ConnectionTimedOut"); break; @@ -413,8 +483,7 @@ break; } #else - switch (stream->rtmp.last_error_code) - { + switch (stream->rtmp.last_error_code) { case ETIMEDOUT: msg = obs_module_text("ConnectionTimedOut"); break; @@ -451,6 +520,39 @@ obs_output_set_last_error(stream->output, msg); } +static void dbr_add_frame(struct rtmp_stream *stream, struct dbr_frame *back) +{ + struct dbr_frame front; + uint64_t dur; + + circlebuf_push_back(&stream->dbr_frames, back, sizeof(*back)); + circlebuf_peek_front(&stream->dbr_frames, &front, sizeof(front)); + + stream->dbr_data_size += back->size; + + dur = (back->send_end - front.send_beg) / 1000000; + + if (dur >= MAX_ESTIMATE_DURATION_MS) { + stream->dbr_data_size -= front.size; + circlebuf_pop_front(&stream->dbr_frames, NULL, sizeof(front)); + } + + stream->dbr_est_bitrate = + (dur >= MIN_ESTIMATE_DURATION_MS) + ? (long)(stream->dbr_data_size * 1000 / dur) + : 0; + stream->dbr_est_bitrate *= 8; + stream->dbr_est_bitrate /= 1000; + + if (stream->dbr_est_bitrate) { + stream->dbr_est_bitrate -= stream->audio_bitrate; + if (stream->dbr_est_bitrate < 50) + stream->dbr_est_bitrate = 50; + } +} + +static void dbr_set_bitrate(struct rtmp_stream *stream); + static void *send_thread(void *data) { struct rtmp_stream *stream = data; @@ -459,6 +561,7 @@ while (os_sem_wait(stream->send_sem) == 0) { struct encoder_packet packet; + struct dbr_frame dbr_frame; if (stopping(stream) && stream->stop_ts == 0) { break; @@ -481,10 +584,23 @@ } } + if (stream->dbr_enabled) { + dbr_frame.send_beg = os_gettime_ns(); + dbr_frame.size = packet.size; + } + if (send_packet(stream, &packet, false, packet.track_idx) < 0) { os_atomic_set_bool(&stream->disconnected, true); break; } + + if (stream->dbr_enabled) { + dbr_frame.send_end = os_gettime_ns(); + + pthread_mutex_lock(&stream->dbr_mutex); + dbr_add_frame(stream, &dbr_frame); + pthread_mutex_unlock(&stream->dbr_mutex); + } } bool encode_error = os_atomic_load_bool(&stream->encode_error); @@ -521,21 +637,30 @@ os_event_reset(stream->stop_event); os_atomic_set_bool(&stream->active, false); stream->sent_headers = false; + + /* reset bitrate on stop */ + if (stream->dbr_enabled) { + if (stream->dbr_cur_bitrate != stream->dbr_orig_bitrate) { + stream->dbr_cur_bitrate = stream->dbr_orig_bitrate; + dbr_set_bitrate(stream); + } + } + return NULL; } static bool send_meta_data(struct rtmp_stream *stream, size_t idx, bool *next) { uint8_t *meta_data; - size_t meta_data_size; - bool success = true; + size_t meta_data_size; + bool success = true; - *next = flv_meta_data(stream->output, &meta_data, - &meta_data_size, false, idx); + *next = flv_meta_data(stream->output, &meta_data, &meta_data_size, + false, idx); if (*next) { - success = RTMP_Write(&stream->rtmp, (char*)meta_data, - (int)meta_data_size, (int)idx) >= 0; + success = RTMP_Write(&stream->rtmp, (char *)meta_data, + (int)meta_data_size, (int)idx) >= 0; bfree(meta_data); } @@ -543,16 +668,14 @@ } static bool send_audio_header(struct rtmp_stream *stream, size_t idx, - bool *next) + bool *next) { - obs_output_t *context = stream->output; + obs_output_t *context = stream->output; obs_encoder_t *aencoder = obs_output_get_audio_encoder(context, idx); - uint8_t *header; + uint8_t *header; - struct encoder_packet packet = { - .type = OBS_ENCODER_AUDIO, - .timebase_den = 1 - }; + struct encoder_packet packet = {.type = OBS_ENCODER_AUDIO, + .timebase_den = 1}; if (!aencoder) { *next = false; @@ -566,16 +689,13 @@ static bool send_video_header(struct rtmp_stream *stream) { - obs_output_t *context = stream->output; + obs_output_t *context = stream->output; obs_encoder_t *vencoder = obs_output_get_video_encoder(context); - uint8_t *header; - size_t size; + uint8_t *header; + size_t size; - struct encoder_packet packet = { - .type = OBS_ENCODER_VIDEO, - .timebase_den = 1, - .keyframe = true - }; + struct encoder_packet packet = { + .type = OBS_ENCODER_VIDEO, .timebase_den = 1, .keyframe = true}; obs_encoder_get_extra_data(vencoder, &header, &size); packet.size = obs_parse_avc_header(&packet.data, header, size); @@ -619,12 +739,12 @@ socklen_t int_size = sizeof(int); getsockopt(stream->rtmp.m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, - (char*)&cur_sendbuf_size, &int_size); + (char *)&cur_sendbuf_size, &int_size); if (cur_sendbuf_size < new_size) { cur_sendbuf_size = new_size; setsockopt(stream->rtmp.m_sb.sb_socket, SOL_SOCKET, SO_SNDBUF, - (const char*)&cur_sendbuf_size, int_size); + (const char *)&cur_sendbuf_size, int_size); } } @@ -670,18 +790,19 @@ bfree(stream->write_buf); int total_bitrate = 0; - obs_output_t *context = stream->output; + obs_output_t *context = stream->output; obs_encoder_t *vencoder = obs_output_get_video_encoder(context); if (vencoder) { obs_data_t *params = obs_encoder_get_settings(vencoder); if (params) { - int bitrate = obs_data_get_int(params, "bitrate"); + int bitrate = + obs_data_get_int(params, "bitrate"); if (!bitrate) { - warn ("Video encoder didn't return a " - "valid bitrate, new network " - "code may function poorly. " - "Low latency mode disabled."); + warn("Video encoder didn't return a " + "valid bitrate, new network " + "code may function poorly. " + "Low latency mode disabled."); stream->low_latency_mode = false; bitrate = 10000; } @@ -690,11 +811,13 @@ } } - obs_encoder_t *aencoder = obs_output_get_audio_encoder(context, 0); + obs_encoder_t *aencoder = + obs_output_get_audio_encoder(context, 0); if (aencoder) { obs_data_t *params = obs_encoder_get_settings(aencoder); if (params) { - int bitrate = obs_data_get_int(params, "bitrate"); + int bitrate = + obs_data_get_int(params, "bitrate"); if (!bitrate) bitrate = 160; total_bitrate += bitrate; @@ -713,7 +836,7 @@ #ifdef _WIN32 ret = pthread_create(&stream->socket_thread, NULL, - socket_thread_windows, stream); + socket_thread_windows, stream); #else warn("New socket loop not supported on this platform"); return OBS_OUTPUT_ERROR; @@ -764,13 +887,13 @@ if (!h) return; - dest_addr = *(uint32_t*)h->h_addr_list[0]; + dest_addr = *(uint32_t *)h->h_addr_list[0]; if (rtmp->m_bindIP.addrLen == 0) source_addr = 0; else if (rtmp->m_bindIP.addr.ss_family == AF_INET) - source_addr = (*(struct sockaddr_in*)&rtmp->m_bindIP) - .sin_addr.S_un.S_addr; + source_addr = (*(struct sockaddr_in *)&rtmp->m_bindIP.addr) + .sin_addr.S_un.S_addr; else return; @@ -780,7 +903,7 @@ row.dwIndex = route.dwForwardIfIndex; if (!GetIfEntry(&row)) { - uint32_t speed =row.dwSpeed / 1000000; + uint32_t speed = row.dwSpeed / 1000000; char *type; struct dstr other = {0}; @@ -794,7 +917,7 @@ } info("Interface: %s (%s, %lu mbps)", row.bDescr, type, - speed); + speed); dstr_free(&other); } @@ -819,18 +942,19 @@ dstr_copy(&stream->encoder_name, "FMLE/3.0 (compatible; FMSc/1.0)"); - set_rtmp_dstr(&stream->rtmp.Link.pubUser, &stream->username); + set_rtmp_dstr(&stream->rtmp.Link.pubUser, &stream->username); set_rtmp_dstr(&stream->rtmp.Link.pubPasswd, &stream->password); - set_rtmp_dstr(&stream->rtmp.Link.flashVer, &stream->encoder_name); + set_rtmp_dstr(&stream->rtmp.Link.flashVer, &stream->encoder_name); stream->rtmp.Link.swfUrl = stream->rtmp.Link.tcUrl; if (dstr_is_empty(&stream->bind_ip) || dstr_cmp(&stream->bind_ip, "default") == 0) { - memset(&stream->rtmp.m_bindIP, 0, sizeof(stream->rtmp.m_bindIP)); + memset(&stream->rtmp.m_bindIP, 0, + sizeof(stream->rtmp.m_bindIP)); } else { bool success = netif_str_to_addr(&stream->rtmp.m_bindIP.addr, - &stream->rtmp.m_bindIP.addrLen, - stream->bind_ip.array); + &stream->rtmp.m_bindIP.addrLen, + stream->bind_ip.array); if (success) { int len = stream->rtmp.m_bindIP.addrLen; bool ipv6 = len == sizeof(struct sockaddr_in6); @@ -841,8 +965,8 @@ RTMP_AddStream(&stream->rtmp, stream->key.array); for (size_t idx = 1;; idx++) { - obs_encoder_t *encoder = obs_output_get_audio_encoder( - stream->output, idx); + obs_encoder_t *encoder = + obs_output_get_audio_encoder(stream->output, idx); const char *encoder_name; if (!encoder) @@ -852,9 +976,9 @@ RTMP_AddStream(&stream->rtmp, encoder_name); } - stream->rtmp.m_outChunkSize = 4096; + stream->rtmp.m_outChunkSize = 4096; stream->rtmp.m_bSendChunkSizeInfo = true; - stream->rtmp.m_bUseNagle = true; + stream->rtmp.m_bUseNagle = true; #ifdef _WIN32 win32_log_interface_type(stream); @@ -880,6 +1004,7 @@ const char *bind_ip; int64_t drop_p; int64_t drop_b; + uint32_t caps; if (stopping(stream)) { pthread_join(stream->send_thread, NULL); @@ -894,13 +1019,13 @@ os_atomic_set_bool(&stream->disconnected, false); os_atomic_set_bool(&stream->encode_error, false); stream->total_bytes_sent = 0; - stream->dropped_frames = 0; - stream->min_priority = 0; - stream->got_first_video = false; + stream->dropped_frames = 0; + stream->min_priority = 0; + stream->got_first_video = false; settings = obs_output_get_settings(stream->output); - dstr_copy(&stream->path, obs_service_get_url(service)); - dstr_copy(&stream->key, obs_service_get_key(service)); + dstr_copy(&stream->path, obs_service_get_url(service)); + dstr_copy(&stream->key, obs_service_get_key(service)); dstr_copy(&stream->username, obs_service_get_username(service)); dstr_copy(&stream->password, obs_service_get_password(service)); dstr_depad(&stream->path); @@ -910,6 +1035,37 @@ stream->max_shutdown_time_sec = (int)obs_data_get_int(settings, OPT_MAX_SHUTDOWN_TIME_SEC); + obs_encoder_t *venc = obs_output_get_video_encoder(stream->output); + obs_encoder_t *aenc = obs_output_get_audio_encoder(stream->output, 0); + obs_data_t *vsettings = obs_encoder_get_settings(venc); + obs_data_t *asettings = obs_encoder_get_settings(aenc); + + circlebuf_free(&stream->dbr_frames); + stream->audio_bitrate = (long)obs_data_get_int(asettings, "bitrate"); + stream->dbr_data_size = 0; + stream->dbr_orig_bitrate = (long)obs_data_get_int(vsettings, "bitrate"); + stream->dbr_cur_bitrate = stream->dbr_orig_bitrate; + stream->dbr_est_bitrate = 0; + stream->dbr_inc_bitrate = stream->dbr_orig_bitrate / 10; + stream->dbr_inc_timeout = 0; + stream->dbr_enabled = obs_data_get_bool(settings, OPT_DYN_BITRATE); + + caps = obs_encoder_get_caps(venc); + if ((caps & OBS_ENCODER_CAP_DYN_BITRATE) == 0) { + stream->dbr_enabled = false; + } + + if (obs_output_get_delay(stream->output) != 0) { + stream->dbr_enabled = false; + } + + if (stream->dbr_enabled) { + info("Dynamic bitrate enabled. Dropped frames begone!"); + } + + obs_data_release(vsettings); + obs_data_release(asettings); + if (drop_p < (drop_b + 200)) drop_p = drop_b + 200; @@ -919,10 +1075,10 @@ bind_ip = obs_data_get_string(settings, OPT_BIND_IP); dstr_copy(&stream->bind_ip, bind_ip); - stream->new_socket_loop = obs_data_get_bool(settings, - OPT_NEWSOCKETLOOP_ENABLED); - stream->low_latency_mode = obs_data_get_bool(settings, - OPT_LOWLATENCY_ENABLED); + stream->new_socket_loop = + obs_data_get_bool(settings, OPT_NEWSOCKETLOOP_ENABLED); + stream->low_latency_mode = + obs_data_get_bool(settings, OPT_LOWLATENCY_ENABLED); obs_data_release(settings); return true; @@ -965,14 +1121,14 @@ os_atomic_set_bool(&stream->connecting, true); return pthread_create(&stream->connect_thread, NULL, connect_thread, - stream) == 0; + stream) == 0; } static inline bool add_packet(struct rtmp_stream *stream, - struct encoder_packet *packet) + struct encoder_packet *packet) { circlebuf_push_back(&stream->packets, packet, - sizeof(struct encoder_packet)); + sizeof(struct encoder_packet)); return true; } @@ -982,12 +1138,12 @@ } static void drop_frames(struct rtmp_stream *stream, const char *name, - int highest_priority, bool pframes) + int highest_priority, bool pframes) { UNUSED_PARAMETER(pframes); - struct circlebuf new_buf = {0}; - int num_frames_dropped = 0; + struct circlebuf new_buf = {0}; + int num_frames_dropped = 0; #ifdef _DEBUG int start_packets = (int)num_buffered_packets(stream); @@ -1002,7 +1158,7 @@ circlebuf_pop_front(&stream->packets, &packet, sizeof(packet)); /* do not drop audio data or video keyframes */ - if (packet.type == OBS_ENCODER_AUDIO || + if (packet.type == OBS_ENCODER_AUDIO || packet.drop_priority >= highest_priority) { circlebuf_push_back(&new_buf, &packet, sizeof(packet)); @@ -1022,21 +1178,19 @@ stream->dropped_frames += num_frames_dropped; #ifdef _DEBUG - debug("Dropped %s, prev packet count: %d, new packet count: %d", - name, - start_packets, - (int)num_buffered_packets(stream)); + debug("Dropped %s, prev packet count: %d, new packet count: %d", name, + start_packets, (int)num_buffered_packets(stream)); #endif } static bool find_first_video_packet(struct rtmp_stream *stream, - struct encoder_packet *first) + struct encoder_packet *first) { size_t count = stream->packets.size / sizeof(*first); for (size_t i = 0; i < count; i++) { - struct encoder_packet *cur = circlebuf_data(&stream->packets, - i * sizeof(*first)); + struct encoder_packet *cur = + circlebuf_data(&stream->packets, i * sizeof(*first)); if (cur->type == OBS_ENCODER_VIDEO && !cur->keyframe) { *first = *cur; return true; @@ -1046,17 +1200,118 @@ return false; } +static bool dbr_bitrate_lowered(struct rtmp_stream *stream) +{ + long prev_bitrate = stream->dbr_prev_bitrate; + long est_bitrate = 0; + long new_bitrate; + + if (stream->dbr_est_bitrate && + stream->dbr_est_bitrate < stream->dbr_cur_bitrate) { + stream->dbr_data_size = 0; + circlebuf_pop_front(&stream->dbr_frames, NULL, + stream->dbr_frames.size); + est_bitrate = stream->dbr_est_bitrate / 100 * 100; + if (est_bitrate < 50) { + est_bitrate = 50; + } + } + +#if 0 + if (prev_bitrate && est_bitrate) { + if (prev_bitrate < est_bitrate) { + blog(LOG_INFO, "going back to prev bitrate: " + "prev_bitrate (%d) < est_bitrate (%d)", + prev_bitrate, + est_bitrate); + new_bitrate = prev_bitrate; + } else { + new_bitrate = est_bitrate; + } + new_bitrate = est_bitrate; + } else if (prev_bitrate) { + new_bitrate = prev_bitrate; + info("going back to prev bitrate"); + + } else if (est_bitrate) { + new_bitrate = est_bitrate; + + } else { + return false; + } +#else + if (est_bitrate) { + new_bitrate = est_bitrate; + + } else if (prev_bitrate) { + new_bitrate = prev_bitrate; + info("going back to prev bitrate"); + + } else { + return false; + } + + if (new_bitrate == stream->dbr_cur_bitrate) { + return false; + } +#endif + + stream->dbr_prev_bitrate = 0; + stream->dbr_cur_bitrate = new_bitrate; + stream->dbr_inc_timeout = os_gettime_ns() + DBR_INC_TIMER; + info("bitrate decreased to: %ld", stream->dbr_cur_bitrate); + return true; +} + +static void dbr_set_bitrate(struct rtmp_stream *stream) +{ + obs_encoder_t *vencoder = obs_output_get_video_encoder(stream->output); + obs_data_t *settings = obs_encoder_get_settings(vencoder); + + obs_data_set_int(settings, "bitrate", stream->dbr_cur_bitrate); + obs_encoder_update(vencoder, settings); + + obs_data_release(settings); +} + +static void dbr_inc_bitrate(struct rtmp_stream *stream) +{ + stream->dbr_prev_bitrate = stream->dbr_cur_bitrate; + stream->dbr_cur_bitrate += stream->dbr_inc_bitrate; + + if (stream->dbr_cur_bitrate >= stream->dbr_orig_bitrate) { + stream->dbr_cur_bitrate = stream->dbr_orig_bitrate; + info("bitrate increased to: %ld, done", + stream->dbr_cur_bitrate); + } else if (stream->dbr_cur_bitrate < stream->dbr_orig_bitrate) { + stream->dbr_inc_timeout = os_gettime_ns() + DBR_INC_TIMER; + info("bitrate increased to: %ld, waiting", + stream->dbr_cur_bitrate); + } +} + static void check_to_drop_frames(struct rtmp_stream *stream, bool pframes) { struct encoder_packet first; int64_t buffer_duration_usec; size_t num_packets = num_buffered_packets(stream); const char *name = pframes ? "p-frames" : "b-frames"; - int priority = pframes ? - OBS_NAL_PRIORITY_HIGHEST : OBS_NAL_PRIORITY_HIGH; - int64_t drop_threshold = pframes ? - stream->pframe_drop_threshold_usec : - stream->drop_threshold_usec; + int priority = pframes ? OBS_NAL_PRIORITY_HIGHEST + : OBS_NAL_PRIORITY_HIGH; + int64_t drop_threshold = pframes ? stream->pframe_drop_threshold_usec + : stream->drop_threshold_usec; + + if (!pframes && stream->dbr_enabled) { + if (stream->dbr_inc_timeout) { + uint64_t t = os_gettime_ns(); + + if (t >= stream->dbr_inc_timeout) { + stream->dbr_inc_timeout = 0; + dbr_inc_bitrate(stream); + dbr_set_bitrate(stream); + } + } + } if (num_packets < 5) { if (!pframes) @@ -1072,8 +1327,33 @@ buffer_duration_usec = stream->last_dts_usec - first.dts_usec; if (!pframes) { - stream->congestion = (float)buffer_duration_usec / - (float)drop_threshold; + stream->congestion = + (float)buffer_duration_usec / (float)drop_threshold; + } + + /* alternatively, drop only pframes: + * (!pframes && stream->dbr_enabled) + * but let's test without dropping frames + * at all first */ + if (stream->dbr_enabled) { + bool bitrate_changed = false; + + if (pframes) { + return; + } + + if (buffer_duration_usec >= DBR_TRIGGER_USEC) { + pthread_mutex_lock(&stream->dbr_mutex); + bitrate_changed = dbr_bitrate_lowered(stream); + pthread_mutex_unlock(&stream->dbr_mutex); + } + + if (bitrate_changed) { + debug("buffer_duration_msec: %" PRId64, + buffer_duration_usec / 1000); + dbr_set_bitrate(stream); + } + return; } if (buffer_duration_usec > drop_threshold) { @@ -1083,7 +1363,7 @@ } static bool add_video_packet(struct rtmp_stream *stream, - struct encoder_packet *packet) + struct encoder_packet *packet) { check_to_drop_frames(stream, false); check_to_drop_frames(stream, true); @@ -1103,9 +1383,9 @@ static void rtmp_stream_data(void *data, struct encoder_packet *packet) { - struct rtmp_stream *stream = data; + struct rtmp_stream *stream = data; struct encoder_packet new_packet; - bool added_packet = false; + bool added_packet = false; if (disconnected(stream) || !active(stream)) return; @@ -1132,9 +1412,9 @@ pthread_mutex_lock(&stream->packets_mutex); if (!disconnected(stream)) { - added_packet = (packet->type == OBS_ENCODER_VIDEO) ? - add_video_packet(stream, &new_packet) : - add_packet(stream, &new_packet); + added_packet = (packet->type == OBS_ENCODER_VIDEO) + ? add_video_packet(stream, &new_packet) + : add_packet(stream, &new_packet); } pthread_mutex_unlock(&stream->packets_mutex); @@ -1164,12 +1444,13 @@ obs_property_t *p; obs_properties_add_int(props, OPT_DROP_THRESHOLD, - obs_module_text("RTMPStream.DropThreshold"), - 200, 10000, 100); + obs_module_text("RTMPStream.DropThreshold"), 200, + 10000, 100); p = obs_properties_add_list(props, OPT_BIND_IP, - obs_module_text("RTMPStream.BindIP"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_module_text("RTMPStream.BindIP"), + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, obs_module_text("Default"), "default"); @@ -1181,9 +1462,9 @@ netif_saddr_data_free(&addrs); obs_properties_add_bool(props, OPT_NEWSOCKETLOOP_ENABLED, - obs_module_text("RTMPStream.NewSocketLoop")); + obs_module_text("RTMPStream.NewSocketLoop")); obs_properties_add_bool(props, OPT_LOWLATENCY_ENABLED, - obs_module_text("RTMPStream.LowLatencyMode")); + obs_module_text("RTMPStream.LowLatencyMode")); return props; } @@ -1206,7 +1487,7 @@ if (stream->new_socket_loop) return (float)stream->write_buf_len / - (float)stream->write_buf_size; + (float)stream->write_buf_size; else return stream->min_priority > 0 ? 1.0f : stream->congestion; } @@ -1218,23 +1499,21 @@ } struct obs_output_info rtmp_output_info = { - .id = "rtmp_output", - .flags = OBS_OUTPUT_AV | - OBS_OUTPUT_ENCODED | - OBS_OUTPUT_SERVICE | - OBS_OUTPUT_MULTI_TRACK, + .id = "rtmp_output", + .flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED | OBS_OUTPUT_SERVICE | + OBS_OUTPUT_MULTI_TRACK, .encoded_video_codecs = "h264", .encoded_audio_codecs = "aac", - .get_name = rtmp_stream_getname, - .create = rtmp_stream_create, - .destroy = rtmp_stream_destroy, - .start = rtmp_stream_start, - .stop = rtmp_stream_stop, - .encoded_packet = rtmp_stream_data, - .get_defaults = rtmp_stream_defaults, - .get_properties = rtmp_stream_properties, - .get_total_bytes = rtmp_stream_total_bytes_sent, - .get_congestion = rtmp_stream_congestion, - .get_connect_time_ms = rtmp_stream_connect_time, - .get_dropped_frames = rtmp_stream_dropped_frames + .get_name = rtmp_stream_getname, + .create = rtmp_stream_create, + .destroy = rtmp_stream_destroy, + .start = rtmp_stream_start, + .stop = rtmp_stream_stop, + .encoded_packet = rtmp_stream_data, + .get_defaults = rtmp_stream_defaults, + .get_properties = rtmp_stream_properties, + .get_total_bytes = rtmp_stream_total_bytes_sent, + .get_congestion = rtmp_stream_congestion, + .get_connect_time_ms = rtmp_stream_connect_time, + .get_dropped_frames = rtmp_stream_dropped_frames, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/rtmp-stream.h -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/rtmp-stream.h
Changed
@@ -16,14 +16,15 @@ #include <sys/ioctl.h> #endif -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[rtmp stream: '%s'] " format, \ - obs_output_get_name(stream->output), ##__VA_ARGS__) + obs_output_get_name(stream->output), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define OPT_DYN_BITRATE "dyn_bitrate" #define OPT_DROP_THRESHOLD "drop_threshold_ms" #define OPT_PFRAME_DROP_THRESHOLD "pframe_drop_threshold_ms" #define OPT_MAX_SHUTDOWN_TIME_SEC "max_shutdown_time_sec" @@ -32,6 +33,7 @@ #define OPT_LOWLATENCY_ENABLED "low_latency_mode_enabled" //#define TEST_FRAMEDROPS +//#define TEST_FRAMEDROPS_WITH_BITRATE_SHORTCUTS #ifdef TEST_FRAMEDROPS @@ -44,67 +46,87 @@ }; #endif +struct dbr_frame { + uint64_t send_beg; + uint64_t send_end; + size_t size; +}; + struct rtmp_stream { - obs_output_t *output; + obs_output_t *output; - pthread_mutex_t packets_mutex; + pthread_mutex_t packets_mutex; struct circlebuf packets; - bool sent_headers; + bool sent_headers; - bool got_first_video; - int64_t start_dts_offset; + bool got_first_video; + int64_t start_dts_offset; - volatile bool connecting; - pthread_t connect_thread; + volatile bool connecting; + pthread_t connect_thread; - volatile bool active; - volatile bool disconnected; - volatile bool encode_error; - pthread_t send_thread; + volatile bool active; + volatile bool disconnected; + volatile bool encode_error; + pthread_t send_thread; - int max_shutdown_time_sec; + int max_shutdown_time_sec; - os_sem_t *send_sem; - os_event_t *stop_event; - uint64_t stop_ts; - uint64_t shutdown_timeout_ts; + os_sem_t *send_sem; + os_event_t *stop_event; + uint64_t stop_ts; + uint64_t shutdown_timeout_ts; - struct dstr path, key; - struct dstr username, password; - struct dstr encoder_name; - struct dstr bind_ip; + struct dstr path, key; + struct dstr username, password; + struct dstr encoder_name; + struct dstr bind_ip; /* frame drop variables */ - int64_t drop_threshold_usec; - int64_t pframe_drop_threshold_usec; - int min_priority; - float congestion; + int64_t drop_threshold_usec; + int64_t pframe_drop_threshold_usec; + int min_priority; + float congestion; - int64_t last_dts_usec; + int64_t last_dts_usec; - uint64_t total_bytes_sent; - int dropped_frames; + uint64_t total_bytes_sent; + int dropped_frames; #ifdef TEST_FRAMEDROPS struct circlebuf droptest_info; - size_t droptest_size; + uint64_t droptest_last_key_check; + size_t droptest_max; + size_t droptest_size; #endif - RTMP rtmp; - - bool new_socket_loop; - bool low_latency_mode; - bool disable_send_window_optimization; - bool socket_thread_active; - pthread_t socket_thread; - uint8_t *write_buf; - size_t write_buf_len; - size_t write_buf_size; - pthread_mutex_t write_buf_mutex; - os_event_t *buffer_space_available_event; - os_event_t *buffer_has_data_event; - os_event_t *socket_available_event; - os_event_t *send_thread_signaled_exit; + pthread_mutex_t dbr_mutex; + struct circlebuf dbr_frames; + size_t dbr_data_size; + uint64_t dbr_inc_timeout; + long audio_bitrate; + long dbr_est_bitrate; + long dbr_orig_bitrate; + long dbr_prev_bitrate; + long dbr_cur_bitrate; + long dbr_inc_bitrate; + bool dbr_enabled; + + RTMP rtmp; + + bool new_socket_loop; + bool low_latency_mode; + bool disable_send_window_optimization; + bool socket_thread_active; + pthread_t socket_thread; + uint8_t *write_buf; + size_t write_buf_len; + size_t write_buf_size; + pthread_mutex_t write_buf_mutex; + os_event_t *buffer_space_available_event; + os_event_t *buffer_has_data_event; + os_event_t *socket_available_event; + os_event_t *send_thread_signaled_exit; }; #ifdef _WIN32
View file
obs-studio-23.2.1.tar.xz/plugins/obs-outputs/rtmp-windows.c -> obs-studio-24.0.0.tar.xz/plugins/obs-outputs/rtmp-windows.c
Changed
@@ -11,17 +11,18 @@ } static bool socket_event(struct rtmp_stream *stream, bool *can_write, - uint64_t last_send_time) + uint64_t last_send_time) { WSANETWORKEVENTS net_events; bool success; success = !WSAEnumNetworkEvents(stream->rtmp.m_sb.sb_socket, NULL, - &net_events); + &net_events); if (!success) { - blog(LOG_ERROR, "socket_thread_windows: Aborting due to " - "WSAEnumNetworkEvents failure, %d", - WSAGetLastError()); + blog(LOG_ERROR, + "socket_thread_windows: Aborting due to " + "WSAEnumNetworkEvents failure, %d", + WSAGetLastError()); fatal_sock_shutdown(stream); return false; } @@ -34,24 +35,26 @@ uint32_t diff = (os_gettime_ns() / 1000000) - last_send_time; - blog(LOG_ERROR, "socket_thread_windows: Received " - "FD_CLOSE, %u ms since last send " - "(buffer: %d / %d)", - diff, - stream->write_buf_len, - stream->write_buf_size); + blog(LOG_ERROR, + "socket_thread_windows: Received " + "FD_CLOSE, %u ms since last send " + "(buffer: %d / %d)", + diff, stream->write_buf_len, + stream->write_buf_size); } if (os_event_try(stream->stop_event) != EAGAIN) - blog(LOG_ERROR, "socket_thread_windows: Aborting due " - "to FD_CLOSE during shutdown, " - "%d bytes lost, error %d", - stream->write_buf_len, - net_events.iErrorCode[FD_CLOSE_BIT]); + blog(LOG_ERROR, + "socket_thread_windows: Aborting due " + "to FD_CLOSE during shutdown, " + "%d bytes lost, error %d", + stream->write_buf_len, + net_events.iErrorCode[FD_CLOSE_BIT]); else - blog(LOG_ERROR, "socket_thread_windows: Aborting due " - "to FD_CLOSE, error %d", - net_events.iErrorCode[FD_CLOSE_BIT]); + blog(LOG_ERROR, + "socket_thread_windows: Aborting due " + "to FD_CLOSE, error %d", + net_events.iErrorCode[FD_CLOSE_BIT]); fatal_sock_shutdown(stream); return false; @@ -63,8 +66,8 @@ bool fatal = false; for (;;) { - int ret = recv(stream->rtmp.m_sb.sb_socket, - discard, sizeof(discard), 0); + int ret = recv(stream->rtmp.m_sb.sb_socket, discard, + sizeof(discard), 0); if (ret == -1) { err_code = WSAGetLastError(); if (err_code == WSAEWOULDBLOCK) @@ -77,10 +80,11 @@ } if (fatal) { - blog(LOG_ERROR, "socket_thread_windows: " - "Socket error, recv() returned " - "%d, GetLastError() %d", - ret, err_code); + blog(LOG_ERROR, + "socket_thread_windows: " + "Socket error, recv() returned " + "%d, GetLastError() %d", + ret, err_code); stream->rtmp.last_error_code = err_code; fatal_sock_shutdown(stream); return false; @@ -92,62 +96,55 @@ } static void ideal_send_backlog_event(struct rtmp_stream *stream, - bool *can_write) + bool *can_write) { ULONG ideal_send_backlog; int ret; - ret = idealsendbacklogquery( - stream->rtmp.m_sb.sb_socket, - &ideal_send_backlog); + ret = idealsendbacklogquery(stream->rtmp.m_sb.sb_socket, + &ideal_send_backlog); if (ret == 0) { int cur_tcp_bufsize; int size = sizeof(cur_tcp_bufsize); - ret = getsockopt(stream->rtmp.m_sb.sb_socket, - SOL_SOCKET, - SO_SNDBUF, - (char *)&cur_tcp_bufsize, - &size); + ret = getsockopt(stream->rtmp.m_sb.sb_socket, SOL_SOCKET, + SO_SNDBUF, (char *)&cur_tcp_bufsize, &size); if (ret == 0) { if (cur_tcp_bufsize < (int)ideal_send_backlog) { int bufsize = (int)ideal_send_backlog; setsockopt(stream->rtmp.m_sb.sb_socket, - SOL_SOCKET, - SO_SNDBUF, - (const char *)&bufsize, - sizeof(bufsize)); - - blog(LOG_INFO, "socket_thread_windows: " - "Increasing send buffer to " - "ISB %d (buffer: %d / %d)", - ideal_send_backlog, - stream->write_buf_len, - stream->write_buf_size); + SOL_SOCKET, SO_SNDBUF, + (const char *)&bufsize, + sizeof(bufsize)); + + blog(LOG_INFO, + "socket_thread_windows: " + "Increasing send buffer to " + "ISB %d (buffer: %d / %d)", + ideal_send_backlog, stream->write_buf_len, + stream->write_buf_size); } } else { - blog(LOG_ERROR, "socket_thread_windows: Got " - "send_backlog_event but " - "getsockopt() returned %d", - WSAGetLastError()); + blog(LOG_ERROR, + "socket_thread_windows: Got " + "send_backlog_event but " + "getsockopt() returned %d", + WSAGetLastError()); } } else { - blog(LOG_ERROR, "socket_thread_windows: Got " - "send_backlog_event but WSAIoctl() " - "returned %d", - WSAGetLastError()); + blog(LOG_ERROR, + "socket_thread_windows: Got " + "send_backlog_event but WSAIoctl() " + "returned %d", + WSAGetLastError()); } } -enum data_ret { - RET_BREAK, - RET_FATAL, - RET_CONTINUE -}; +enum data_ret { RET_BREAK, RET_FATAL, RET_CONTINUE }; static enum data_ret write_data(struct rtmp_stream *stream, bool *can_write, - uint64_t *last_send_time, size_t latency_packet_size, - int delay_time) + uint64_t *last_send_time, + size_t latency_packet_size, int delay_time) { bool exit_loop = false; @@ -170,19 +167,18 @@ min(latency_packet_size, stream->write_buf_len); ret = RTMPSockBuf_Send(&stream->rtmp.m_sb, - (const char *)stream->write_buf, - (int)send_len); + (const char *)stream->write_buf, + (int)send_len); } else { ret = RTMPSockBuf_Send(&stream->rtmp.m_sb, - (const char *)stream->write_buf, - (int)stream->write_buf_len); + (const char *)stream->write_buf, + (int)stream->write_buf_len); } if (ret > 0) { if (stream->write_buf_len - ret) - memmove(stream->write_buf, - stream->write_buf + ret, - stream->write_buf_len - ret); + memmove(stream->write_buf, stream->write_buf + ret, + stream->write_buf_len - ret); stream->write_buf_len -= ret; *last_send_time = os_gettime_ns() / 1000000; @@ -210,10 +206,11 @@ if (fatal_err) { /* connection closed, or connection was aborted / * socket closed / etc, that's a fatal error. */ - blog(LOG_ERROR, "socket_thread_windows: " - "Socket error, send() returned %d, " - "GetLastError() %d", - ret, err_code); + blog(LOG_ERROR, + "socket_thread_windows: " + "Socket error, send() returned %d, " + "GetLastError() %d", + ret, err_code); pthread_mutex_unlock(&stream->write_buf_mutex); stream->rtmp.last_error_code = err_code; @@ -250,14 +247,15 @@ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); WSAEventSelect(stream->rtmp.m_sb.sb_socket, - stream->socket_available_event, - FD_READ|FD_WRITE|FD_CLOSE); + stream->socket_available_event, + FD_READ | FD_WRITE | FD_CLOSE); send_backlog_event = CreateEvent(NULL, true, false, NULL); if (stream->low_latency_mode) { delay_time = 1000 / LATENCY_FACTOR; - latency_packet_size = stream->write_buf_size / (LATENCY_FACTOR - 2); + latency_packet_size = + stream->write_buf_size / (LATENCY_FACTOR - 2); } else { latency_packet_size = stream->write_buf_size; delay_time = 0; @@ -265,13 +263,13 @@ if (!stream->disable_send_window_optimization) { memset(&send_backlog_overlapped, 0, - sizeof(send_backlog_overlapped)); + sizeof(send_backlog_overlapped)); send_backlog_overlapped.hEvent = send_backlog_event; idealsendbacklognotify(stream->rtmp.m_sb.sb_socket, - &send_backlog_overlapped, NULL); + &send_backlog_overlapped, NULL); } else { blog(LOG_INFO, "socket_thread_windows: Send window " - "optimization disabled by user."); + "optimization disabled by user."); } HANDLE objs[3]; @@ -286,7 +284,8 @@ if (stream->write_buf_len == 0) { //blog(LOG_DEBUG, "Exiting on empty buffer"); pthread_mutex_unlock(&stream->write_buf_mutex); - os_event_reset(stream->send_thread_signaled_exit); + os_event_reset( + stream->send_thread_signaled_exit); break; } @@ -312,18 +311,15 @@ ResetEvent(send_backlog_event); idealsendbacklognotify(stream->rtmp.m_sb.sb_socket, - &send_backlog_overlapped, NULL); + &send_backlog_overlapped, NULL); continue; } if (can_write) { for (;;) { enum data_ret ret = write_data( - stream, - &can_write, - &last_send_time, - latency_packet_size, - delay_time); + stream, &can_write, &last_send_time, + latency_packet_size, delay_time); switch (ret) { case RET_BREAK: @@ -334,12 +330,12 @@ } } } - exit_write_loop:; + exit_write_loop:; } if (stream->rtmp.m_sb.sb_socket != INVALID_SOCKET) WSAEventSelect(stream->rtmp.m_sb.sb_socket, - stream->socket_available_event, 0); + stream->socket_available_event, 0); blog(LOG_INFO, "socket_thread_windows: Normal exit"); }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/QSV_Encoder.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/QSV_Encoder.cpp
Changed
@@ -65,12 +65,11 @@ #include <intrin.h> #define do_log(level, format, ...) \ - blog(level, "[qsv encoder: '%s'] " format, \ - "msdk_impl", ##__VA_ARGS__) + blog(level, "[qsv encoder: '%s'] " format, "msdk_impl", ##__VA_ARGS__) -mfxIMPL impl = MFX_IMPL_HARDWARE_ANY; -mfxVersion ver = {{0, 1}}; // for backward compatibility -std::atomic<bool> is_active{false}; +mfxIMPL impl = MFX_IMPL_HARDWARE_ANY; +mfxVersion ver = {{0, 1}}; // for backward compatibility +std::atomic<bool> is_active{false}; void qsv_encoder_version(unsigned short *major, unsigned short *minor) { @@ -80,68 +79,81 @@ qsv_t *qsv_encoder_open(qsv_param_t *pParams) { - bool false_value = false; - QSV_Encoder_Internal *pEncoder = new QSV_Encoder_Internal(impl, ver); mfxStatus sts = pEncoder->Open(pParams); if (sts != MFX_ERR_NONE) { -#define WARN_ERR_IMPL(err, str, err_name) case err: \ - do_log(LOG_WARNING, str " (" err_name ")"); break; +#define WARN_ERR_IMPL(err, str, err_name) \ + case err: \ + do_log(LOG_WARNING, str " (" err_name ")"); \ + break; #define WARN_ERR(err, str) WARN_ERR_IMPL(err, str, #err) switch (sts) { - WARN_ERR(MFX_ERR_UNKNOWN, "Unknown QSV error"); - WARN_ERR(MFX_ERR_NOT_INITIALIZED, - "Member functions called without initialization"); - WARN_ERR(MFX_ERR_INVALID_HANDLE, - "Invalid session or MemId handle"); - WARN_ERR(MFX_ERR_NULL_PTR, - "NULL pointer in the input or output arguments"); - WARN_ERR(MFX_ERR_UNDEFINED_BEHAVIOR, "Undefined behavior"); - WARN_ERR(MFX_ERR_NOT_ENOUGH_BUFFER, - "Insufficient buffer for input or output."); - WARN_ERR(MFX_ERR_NOT_FOUND, - "Specified object/item/sync point not found."); - WARN_ERR(MFX_ERR_MEMORY_ALLOC, "Gailed to allocate memory"); - WARN_ERR(MFX_ERR_LOCK_MEMORY, - "failed to lock the memory block " - "(external allocator)."); - WARN_ERR(MFX_ERR_UNSUPPORTED, - "Unsupported configurations, parameters, or features"); - WARN_ERR(MFX_ERR_INVALID_VIDEO_PARAM, - "Incompatible video parameters detected"); - WARN_ERR(MFX_WRN_VIDEO_PARAM_CHANGED, - "The decoder detected a new sequence header in the " - "bitstream. Video parameters may have changed."); - WARN_ERR(MFX_WRN_VALUE_NOT_CHANGED, - "The parameter has been clipped to its value range"); - WARN_ERR(MFX_WRN_OUT_OF_RANGE, - "The parameter is out of valid value range"); - WARN_ERR(MFX_WRN_INCOMPATIBLE_VIDEO_PARAM, - "Incompatible video parameters detected"); - WARN_ERR(MFX_WRN_FILTER_SKIPPED, - "The SDK VPP has skipped one or more optional filters " - "requested by the application"); - WARN_ERR(MFX_ERR_ABORTED, "The asynchronous operation aborted"); - WARN_ERR(MFX_ERR_MORE_DATA, - "Need more bitstream at decoding input, encoding " - "input, or video processing input frames"); - WARN_ERR(MFX_ERR_MORE_SURFACE, "Need more frame surfaces at " - "decoding or video processing output"); - WARN_ERR(MFX_ERR_MORE_BITSTREAM, - "Need more bitstream buffers at the encoding output"); - WARN_ERR(MFX_WRN_IN_EXECUTION, - "Synchronous operation still running"); - WARN_ERR(MFX_ERR_DEVICE_FAILED, - "Hardware device returned unexpected errors"); - WARN_ERR(MFX_ERR_DEVICE_LOST,"Hardware device was lost"); - WARN_ERR(MFX_WRN_DEVICE_BUSY, - "Hardware device is currently busy"); - WARN_ERR(MFX_WRN_PARTIAL_ACCELERATION, - "The hardware does not support the specified " - "configuration. Encoding, decoding, or video " - "processing may be partially accelerated"); + WARN_ERR(MFX_ERR_UNKNOWN, "Unknown QSV error"); + WARN_ERR( + MFX_ERR_NOT_INITIALIZED, + "Member functions called without initialization"); + WARN_ERR(MFX_ERR_INVALID_HANDLE, + "Invalid session or MemId handle"); + WARN_ERR( + MFX_ERR_NULL_PTR, + "NULL pointer in the input or output arguments"); + WARN_ERR(MFX_ERR_UNDEFINED_BEHAVIOR, + "Undefined behavior"); + WARN_ERR(MFX_ERR_NOT_ENOUGH_BUFFER, + "Insufficient buffer for input or output."); + WARN_ERR(MFX_ERR_NOT_FOUND, + "Specified object/item/sync point not found."); + WARN_ERR(MFX_ERR_MEMORY_ALLOC, + "Gailed to allocate memory"); + WARN_ERR(MFX_ERR_LOCK_MEMORY, + "failed to lock the memory block " + "(external allocator)."); + WARN_ERR( + MFX_ERR_UNSUPPORTED, + "Unsupported configurations, parameters, or features"); + WARN_ERR(MFX_ERR_INVALID_VIDEO_PARAM, + "Incompatible video parameters detected"); + WARN_ERR( + MFX_WRN_VIDEO_PARAM_CHANGED, + "The decoder detected a new sequence header in the " + "bitstream. Video parameters may have changed."); + WARN_ERR( + MFX_WRN_VALUE_NOT_CHANGED, + "The parameter has been clipped to its value range"); + WARN_ERR(MFX_WRN_OUT_OF_RANGE, + "The parameter is out of valid value range"); + WARN_ERR(MFX_WRN_INCOMPATIBLE_VIDEO_PARAM, + "Incompatible video parameters detected"); + WARN_ERR( + MFX_WRN_FILTER_SKIPPED, + "The SDK VPP has skipped one or more optional filters " + "requested by the application"); + WARN_ERR(MFX_ERR_ABORTED, + "The asynchronous operation aborted"); + WARN_ERR( + MFX_ERR_MORE_DATA, + "Need more bitstream at decoding input, encoding " + "input, or video processing input frames"); + WARN_ERR(MFX_ERR_MORE_SURFACE, + "Need more frame surfaces at " + "decoding or video processing output"); + WARN_ERR( + MFX_ERR_MORE_BITSTREAM, + "Need more bitstream buffers at the encoding output"); + WARN_ERR(MFX_WRN_IN_EXECUTION, + "Synchronous operation still running"); + WARN_ERR(MFX_ERR_DEVICE_FAILED, + "Hardware device returned unexpected errors"); + WARN_ERR(MFX_ERR_DEVICE_LOST, + "Hardware device was lost"); + WARN_ERR(MFX_WRN_DEVICE_BUSY, + "Hardware device is currently busy"); + WARN_ERR(MFX_WRN_PARTIAL_ACCELERATION, + "The hardware does not support the specified " + "configuration. Encoding, decoding, or video " + "processing may be partially accelerated"); } #undef WARN_ERR @@ -153,11 +165,11 @@ return NULL; } - return (qsv_t *) pEncoder; + return (qsv_t *)pEncoder; } int qsv_encoder_headers(qsv_t *pContext, uint8_t **pSPS, uint8_t **pPPS, - uint16_t *pnSPS, uint16_t *pnPPS) + uint16_t *pnSPS, uint16_t *pnPPS) { QSV_Encoder_Internal *pEncoder = (QSV_Encoder_Internal *)pContext; pEncoder->GetSPSPPS(pSPS, pPPS, pnSPS, pnPPS); @@ -165,16 +177,16 @@ return 0; } -int qsv_encoder_encode(qsv_t * pContext, uint64_t ts, uint8_t *pDataY, - uint8_t *pDataUV, uint32_t strideY, uint32_t strideUV, - mfxBitstream **pBS) +int qsv_encoder_encode(qsv_t *pContext, uint64_t ts, uint8_t *pDataY, + uint8_t *pDataUV, uint32_t strideY, uint32_t strideUV, + mfxBitstream **pBS) { QSV_Encoder_Internal *pEncoder = (QSV_Encoder_Internal *)pContext; mfxStatus sts = MFX_ERR_NONE; if (pDataY != NULL && pDataUV != NULL) sts = pEncoder->Encode(ts, pDataY, pDataUV, strideY, strideUV, - pBS); + pBS); if (sts == MFX_ERR_NONE) return 0; @@ -232,9 +244,9 @@ __cpuid(cpuInfo, 0); string vendor; - vendor += string((char*)&cpuInfo[1], 4); - vendor += string((char*)&cpuInfo[3], 4); - vendor += string((char*)&cpuInfo[2], 4); + vendor += string((char *)&cpuInfo[1], 4); + vendor += string((char *)&cpuInfo[3], 4); + vendor += string((char *)&cpuInfo[2], 4); if (vendor != "GenuineIntel") return QSV_CPU_PLATFORM_UNKNOWN; @@ -248,8 +260,7 @@ if (family != 6) return QSV_CPU_PLATFORM_UNKNOWN; - switch (model) - { + switch (model) { case 0x1C: case 0x26: case 0x27: @@ -280,6 +291,15 @@ case 0x45: case 0x46: return QSV_CPU_PLATFORM_HSW; + case 0x3d: + case 0x47: + case 0x4f: + case 0x56: + return QSV_CPU_PLATFORM_BDW; + + case 0x4e: + case 0x5e: + return QSV_CPU_PLATFORM_SKL; } //assume newer revisions are at least as capable as Haswell
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/QSV_Encoder.h -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/QSV_Encoder.h
Changed
@@ -70,33 +70,16 @@ }; static const struct qsv_rate_control_info qsv_ratecontrols[] = { - {"CBR", false}, - {"VBR", false}, - {"VCM", true}, - {"CQP", false}, - {"AVBR", false}, - {"ICQ", true}, - {"LA_ICQ", true}, - {"LA", true}, - {0, false} -}; -static const char * const qsv_profile_names[] = { - "high", - "main", - "baseline", - 0 -}; -static const char * const qsv_usage_names[] = { - "quality", - "balanced", - "speed", - 0 -}; + {"CBR", false}, {"VBR", false}, {"VCM", true}, {"CQP", false}, + {"AVBR", false}, {"ICQ", true}, {"LA_ICQ", true}, {"LA_CBR", true}, + {"LA_VBR", true}, {0, false}}; +static const char *const qsv_profile_names[] = {"high", "main", "baseline", 0}; +static const char *const qsv_usage_names[] = {"quality", "balanced", "speed", + 0}; typedef struct qsv_t qsv_t; -typedef struct -{ +typedef struct { mfxU16 nTargetUsage; /* 1 through 7, 1 being best quality and 7 being the best speed */ mfxU16 nWidth; /* source picture width */ @@ -117,6 +100,7 @@ mfxU16 nKeyIntSec; mfxU16 nbFrames; mfxU16 nICQQuality; + bool bMBBRC; } qsv_param_t; enum qsv_cpu_platform { @@ -127,6 +111,8 @@ QSV_CPU_PLATFORM_SLM, QSV_CPU_PLATFORM_CHT, QSV_CPU_PLATFORM_HSW, + QSV_CPU_PLATFORM_BDW, + QSV_CPU_PLATFORM_SKL, QSV_CPU_PLATFORM_INTEL }; @@ -134,14 +120,14 @@ int qsv_param_parse(qsv_param_t *, const char *name, const char *value); int qsv_param_apply_profile(qsv_param_t *, const char *profile); int qsv_param_default_preset(qsv_param_t *, const char *preset, - const char *tune); + const char *tune); int qsv_encoder_reconfig(qsv_t *, qsv_param_t *); void qsv_encoder_version(unsigned short *major, unsigned short *minor); -qsv_t *qsv_encoder_open( qsv_param_t * ); +qsv_t *qsv_encoder_open(qsv_param_t *); int qsv_encoder_encode(qsv_t *, uint64_t, uint8_t *, uint8_t *, uint32_t, - uint32_t, mfxBitstream **pBS); + uint32_t, mfxBitstream **pBS); int qsv_encoder_headers(qsv_t *, uint8_t **pSPS, uint8_t **pPPS, - uint16_t *pnSPS, uint16_t *pnPPS); + uint16_t *pnSPS, uint16_t *pnPPS); enum qsv_cpu_platform qsv_get_cpu_platform(); #ifdef __cplusplus
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/QSV_Encoder_Internal.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/QSV_Encoder_Internal.cpp
Changed
@@ -62,26 +62,25 @@ #include <obs-module.h> #define do_log(level, format, ...) \ - blog(level, "[qsv encoder: '%s'] " format, \ - "msdk_impl", ##__VA_ARGS__) + blog(level, "[qsv encoder: '%s'] " format, "msdk_impl", ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) mfxHDL QSV_Encoder_Internal::g_DX_Handle = NULL; mfxU16 QSV_Encoder_Internal::g_numEncodersOpen = 0; -QSV_Encoder_Internal::QSV_Encoder_Internal(mfxIMPL& impl, mfxVersion& version) : - m_pmfxSurfaces(NULL), - m_pmfxENC(NULL), - m_nSPSBufferSize(100), - m_nPPSBufferSize(100), - m_nTaskPool(0), - m_pTaskPool(NULL), - m_nTaskIdx(0), - m_nFirstSyncTask(0), - m_outBitstream() +QSV_Encoder_Internal::QSV_Encoder_Internal(mfxIMPL &impl, mfxVersion &version) + : m_pmfxSurfaces(NULL), + m_pmfxENC(NULL), + m_nSPSBufferSize(100), + m_nPPSBufferSize(100), + m_nTaskPool(0), + m_pTaskPool(NULL), + m_nTaskIdx(0), + m_nFirstSyncTask(0), + m_outBitstream() { mfxIMPL tempImpl; mfxStatus sts; @@ -103,17 +102,16 @@ m_bUseD3D11 = true; if (m_bUseD3D11) blog(LOG_INFO, "\timpl: D3D11\n" - "\tsurf: D3D11"); + "\tsurf: D3D11"); else blog(LOG_INFO, "\timpl: D3D11\n" - "\tsurf: SysMem"); + "\tsurf: SysMem"); m_impl = tempImpl; m_ver = version; return; } - } - else if (m_bD3D9HACK) { + } else if (m_bD3D9HACK) { tempImpl = impl | MFX_IMPL_VIA_D3D9; sts = m_session.Init(tempImpl, &version); if (sts == MFX_ERR_NONE) { @@ -137,12 +135,11 @@ m_session.Close(); blog(LOG_INFO, "\timpl: D3D09\n" - "\tsurf: SysMem"); + "\tsurf: SysMem"); m_impl = tempImpl; m_ver = version; } - } QSV_Encoder_Internal::~QSV_Encoder_Internal() @@ -151,20 +148,21 @@ ClearData(); } -mfxStatus QSV_Encoder_Internal::Open(qsv_param_t * pParams) +mfxStatus QSV_Encoder_Internal::Open(qsv_param_t *pParams) { mfxStatus sts = MFX_ERR_NONE; if (m_bUseD3D11) // Use D3D11 surface - sts = Initialize(m_impl, m_ver, &m_session, &m_mfxAllocator, &g_DX_Handle, false, false); + sts = Initialize(m_impl, m_ver, &m_session, &m_mfxAllocator, + &g_DX_Handle, false, false); else if (m_bD3D9HACK) // Use hack - sts = Initialize(m_impl, m_ver, &m_session, &m_mfxAllocator, &g_DX_Handle, false, true); + sts = Initialize(m_impl, m_ver, &m_session, &m_mfxAllocator, + &g_DX_Handle, false, true); else sts = Initialize(m_impl, m_ver, &m_session, NULL); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); m_pmfxENC = new MFXVideoENCODE(m_session); @@ -193,8 +191,7 @@ return sts; } - -bool QSV_Encoder_Internal::InitParams(qsv_param_t * pParams) +bool QSV_Encoder_Internal::InitParams(qsv_param_t *pParams) { memset(&m_mfxEncParams, 0, sizeof(m_mfxEncParams)); @@ -212,6 +209,7 @@ m_mfxEncParams.mfx.FrameInfo.CropY = 0; m_mfxEncParams.mfx.FrameInfo.CropW = pParams->nWidth; m_mfxEncParams.mfx.FrameInfo.CropH = pParams->nHeight; + m_mfxEncParams.mfx.GopRefDist = pParams->nbFrames + 1; m_mfxEncParams.mfx.RateControlMethod = pParams->nRateControl; @@ -242,38 +240,34 @@ break; case MFX_RATECONTROL_LA_ICQ: m_mfxEncParams.mfx.ICQQuality = pParams->nICQQuality; + case MFX_RATECONTROL_LA_HRD: + m_mfxEncParams.mfx.TargetKbps = pParams->nTargetBitRate; + m_mfxEncParams.mfx.MaxKbps = pParams->nTargetBitRate; break; default: break; } m_mfxEncParams.AsyncDepth = pParams->nAsyncDepth; - m_mfxEncParams.mfx.GopPicSize = (mfxU16)(pParams->nKeyIntSec * - pParams->nFpsNum / (float)pParams->nFpsDen); + m_mfxEncParams.mfx.GopPicSize = + (mfxU16)(pParams->nKeyIntSec * pParams->nFpsNum / + (float)pParams->nFpsDen); - static mfxExtBuffer* extendedBuffers[2]; + static mfxExtBuffer *extendedBuffers[2]; int iBuffers = 0; - if (pParams->nAsyncDepth == 1) { - m_mfxEncParams.mfx.NumRefFrame = 1; - // low latency, I and P frames only - m_mfxEncParams.mfx.GopRefDist = 1; - memset(&m_co, 0, sizeof(mfxExtCodingOption)); - m_co.Header.BufferId = MFX_EXTBUFF_CODING_OPTION; - m_co.Header.BufferSz = sizeof(mfxExtCodingOption); - m_co.MaxDecFrameBuffering = 1; - extendedBuffers[iBuffers++] = (mfxExtBuffer*)&m_co; - } - else - m_mfxEncParams.mfx.GopRefDist = pParams->nbFrames + 1; - - if (pParams->nRateControl == MFX_RATECONTROL_LA_ICQ || - pParams->nRateControl == MFX_RATECONTROL_LA) { + if (m_ver.Major == 1 && m_ver.Minor >= 8) { memset(&m_co2, 0, sizeof(mfxExtCodingOption2)); - m_co2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION; + m_co2.Header.BufferId = MFX_EXTBUFF_CODING_OPTION2; m_co2.Header.BufferSz = sizeof(m_co2); - m_co2.LookAheadDepth = pParams->nLADEPTH; - extendedBuffers[iBuffers++] = (mfxExtBuffer*)& m_co2; + if (pParams->nRateControl == MFX_RATECONTROL_LA_ICQ || + pParams->nRateControl == MFX_RATECONTROL_LA) + m_co2.LookAheadDepth = pParams->nLADEPTH; + if (pParams->bMBBRC) + m_co2.MBBRC = MFX_CODINGOPTION_ON; + if (pParams->nbFrames > 1) + m_co2.BRefType = MFX_B_REF_PYRAMID; + extendedBuffers[iBuffers++] = (mfxExtBuffer *)&m_co2; } if (iBuffers > 0) { @@ -311,7 +305,7 @@ // Allocate required surfaces if (m_bUseD3D11 || m_bD3D9HACK) { sts = m_mfxAllocator.Alloc(m_mfxAllocator.pthis, &EncRequest, - &m_mfxResponse); + &m_mfxResponse); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); m_nSurfNum = m_mfxResponse.NumFrameActual; @@ -323,15 +317,14 @@ m_pmfxSurfaces[i] = new mfxFrameSurface1; memset(m_pmfxSurfaces[i], 0, sizeof(mfxFrameSurface1)); memcpy(&(m_pmfxSurfaces[i]->Info), - &(m_mfxEncParams.mfx.FrameInfo), - sizeof(mfxFrameInfo)); + &(m_mfxEncParams.mfx.FrameInfo), + sizeof(mfxFrameInfo)); m_pmfxSurfaces[i]->Data.MemId = m_mfxResponse.mids[i]; } - } - else { + } else { mfxU16 width = (mfxU16)MSDK_ALIGN32(EncRequest.Info.Width); mfxU16 height = (mfxU16)MSDK_ALIGN32(EncRequest.Info.Height); - mfxU8 bitsPerPixel = 12; + mfxU8 bitsPerPixel = 12; mfxU32 surfaceSize = width * height * bitsPerPixel / 8; m_nSurfNum = EncRequest.NumFrameSuggested; @@ -340,13 +333,14 @@ m_pmfxSurfaces[i] = new mfxFrameSurface1; memset(m_pmfxSurfaces[i], 0, sizeof(mfxFrameSurface1)); memcpy(&(m_pmfxSurfaces[i]->Info), - &(m_mfxEncParams.mfx.FrameInfo), - sizeof(mfxFrameInfo)); + &(m_mfxEncParams.mfx.FrameInfo), + sizeof(mfxFrameInfo)); - mfxU8* pSurface = (mfxU8*) new mfxU8[surfaceSize]; + mfxU8 *pSurface = (mfxU8 *)new mfxU8[surfaceSize]; m_pmfxSurfaces[i]->Data.Y = pSurface; m_pmfxSurfaces[i]->Data.U = pSurface + width * height; - m_pmfxSurfaces[i]->Data.V = pSurface + width * height + 1; + m_pmfxSurfaces[i]->Data.V = + pSurface + width * height + 1; m_pmfxSurfaces[i]->Data.Pitch = width; } } @@ -364,8 +358,8 @@ opt.Header.BufferId = MFX_EXTBUFF_CODING_OPTION_SPSPPS; opt.Header.BufferSz = sizeof(mfxExtCodingOptionSPSPPS); - static mfxExtBuffer* extendedBuffers[1]; - extendedBuffers[0] = (mfxExtBuffer*)& opt; + static mfxExtBuffer *extendedBuffers[1]; + extendedBuffers[0] = (mfxExtBuffer *)&opt; m_parameter.ExtParam = extendedBuffers; m_parameter.NumExtParam = 1; @@ -384,7 +378,7 @@ } void QSV_Encoder_Internal::GetSPSPPS(mfxU8 **pSPSBuf, mfxU8 **pPPSBuf, - mfxU16 *pnSPSBuf, mfxU16 *pnPPSBuf) + mfxU16 *pnSPSBuf, mfxU16 *pnPPSBuf) { *pSPSBuf = m_SPSBuffer; *pPPSBuf = m_PPSBuffer; @@ -409,7 +403,7 @@ m_pTaskPool[i].mfxBS.DataLength = 0; MSDK_CHECK_POINTER(m_pTaskPool[i].mfxBS.Data, - MFX_ERR_MEMORY_ALLOC); + MFX_ERR_MEMORY_ALLOC); } memset(&m_outBitstream, 0, sizeof(mfxBitstream)); @@ -424,21 +418,18 @@ } mfxStatus QSV_Encoder_Internal::LoadNV12(mfxFrameSurface1 *pSurface, - uint8_t *pDataY, uint8_t *pDataUV, uint32_t strideY, - uint32_t strideUV) + uint8_t *pDataY, uint8_t *pDataUV, + uint32_t strideY, uint32_t strideUV) { mfxU16 w, h, i, pitch; - mfxU8* ptr; - mfxFrameInfo* pInfo = &pSurface->Info; - mfxFrameData* pData = &pSurface->Data; + mfxU8 *ptr; + mfxFrameInfo *pInfo = &pSurface->Info; + mfxFrameData *pData = &pSurface->Data; - if (pInfo->CropH > 0 && pInfo->CropW > 0) - { + if (pInfo->CropH > 0 && pInfo->CropW > 0) { w = pInfo->CropW; h = pInfo->CropH; - } - else - { + } else { w = pInfo->Width; h = pInfo->Height; } @@ -460,7 +451,7 @@ return MFX_ERR_NONE; } -int QSV_Encoder_Internal::GetFreeTaskIndex(Task* pTaskPool, mfxU16 nPoolSize) +int QSV_Encoder_Internal::GetFreeTaskIndex(Task *pTaskPool, mfxU16 nPoolSize) { if (pTaskPool) for (int i = 0; i < nPoolSize; i++) @@ -470,8 +461,8 @@ } mfxStatus QSV_Encoder_Internal::Encode(uint64_t ts, uint8_t *pDataY, - uint8_t *pDataUV, uint32_t strideY, uint32_t strideUV, - mfxBitstream **pBS) + uint8_t *pDataUV, uint32_t strideY, + uint32_t strideUV, mfxBitstream **pBS) { mfxStatus sts = MFX_ERR_NONE; *pBS = NULL; @@ -492,13 +483,13 @@ while (MFX_ERR_NOT_FOUND == nTaskIdx || MFX_ERR_NOT_FOUND == nSurfIdx) { // No more free tasks or surfaces, need to sync - sts = m_session.SyncOperation(m_pTaskPool[m_nFirstSyncTask].syncp, - 60000); + sts = m_session.SyncOperation( + m_pTaskPool[m_nFirstSyncTask].syncp, 60000); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); mfxU8 *pTemp = m_outBitstream.Data; memcpy(&m_outBitstream, &m_pTaskPool[m_nFirstSyncTask].mfxBS, - sizeof(mfxBitstream)); + sizeof(mfxBitstream)); m_pTaskPool[m_nFirstSyncTask].mfxBS.Data = pTemp; m_pTaskPool[m_nFirstSyncTask].mfxBS.DataLength = 0; @@ -527,7 +518,8 @@ mfxFrameSurface1 *pSurface = m_pmfxSurfaces[nSurfIdx]; if (m_bUseD3D11 || m_bD3D9HACK) { sts = m_mfxAllocator.Lock(m_mfxAllocator.pthis, - pSurface->Data.MemId, &(pSurface->Data)); + pSurface->Data.MemId, + &(pSurface->Data)); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); } @@ -537,22 +529,24 @@ if (m_bUseD3D11 || m_bD3D9HACK) { sts = m_mfxAllocator.Unlock(m_mfxAllocator.pthis, - pSurface->Data.MemId, &(pSurface->Data)); + pSurface->Data.MemId, + &(pSurface->Data)); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); } for (;;) { // Encode a frame asynchronously (returns immediately) sts = m_pmfxENC->EncodeFrameAsync(NULL, pSurface, - &m_pTaskPool[nTaskIdx].mfxBS, - &m_pTaskPool[nTaskIdx].syncp); + &m_pTaskPool[nTaskIdx].mfxBS, + &m_pTaskPool[nTaskIdx].syncp); if (MFX_ERR_NONE < sts && !m_pTaskPool[nTaskIdx].syncp) { // Repeat the call if warning and no output if (MFX_WRN_DEVICE_BUSY == sts) - MSDK_SLEEP(1); // Wait if device is busy, then repeat the same call + MSDK_SLEEP( + 1); // Wait if device is busy, then repeat the same call } else if (MFX_ERR_NONE < sts && m_pTaskPool[nTaskIdx].syncp) { - sts = MFX_ERR_NONE; // Ignore warnings if output is available + sts = MFX_ERR_NONE; // Ignore warnings if output is available break; } else if (MFX_ERR_NOT_ENOUGH_BUFFER == sts) { // Allocate more bitstream buffer memory here if needed... @@ -569,7 +563,8 @@ mfxStatus sts = MFX_ERR_NONE; while (m_pTaskPool && m_pTaskPool[m_nFirstSyncTask].syncp) { - sts = m_session.SyncOperation(m_pTaskPool[m_nFirstSyncTask].syncp, 60000); + sts = m_session.SyncOperation( + m_pTaskPool[m_nFirstSyncTask].syncp, 60000); MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); m_pTaskPool[m_nFirstSyncTask].syncp = NULL; @@ -584,8 +579,7 @@ mfxStatus sts = MFX_ERR_NONE; sts = Drain(); - if (m_pmfxENC) - { + if (m_pmfxENC) { sts = m_pmfxENC->Close(); delete m_pmfxENC; m_pmfxENC = NULL; @@ -610,8 +604,7 @@ MSDK_SAFE_DELETE_ARRAY(m_pTaskPool); } - if (m_outBitstream.Data) - { + if (m_outBitstream.Data) { delete m_outBitstream.Data; m_outBitstream.Data = NULL; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/QSV_Encoder_Internal.h -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/QSV_Encoder_Internal.h
Changed
@@ -59,57 +59,57 @@ #include "QSV_Encoder.h" #include "common_utils.h" -class QSV_Encoder_Internal -{ +class QSV_Encoder_Internal { public: - QSV_Encoder_Internal(mfxIMPL& impl, mfxVersion& version); + QSV_Encoder_Internal(mfxIMPL &impl, mfxVersion &version); ~QSV_Encoder_Internal(); - mfxStatus Open(qsv_param_t * pParams); - void GetSPSPPS(mfxU8 **pSPSBuf, mfxU8 **pPPSBuf, - mfxU16 *pnSPSBuf, mfxU16 *pnPPSBuf); - mfxStatus Encode(uint64_t ts, uint8_t *pDataY, uint8_t *pDataUV, - uint32_t strideY, uint32_t strideUV, mfxBitstream - **pBS); - mfxStatus ClearData(); - mfxStatus Reset(qsv_param_t *pParams); + mfxStatus Open(qsv_param_t *pParams); + void GetSPSPPS(mfxU8 **pSPSBuf, mfxU8 **pPPSBuf, mfxU16 *pnSPSBuf, + mfxU16 *pnPPSBuf); + mfxStatus Encode(uint64_t ts, uint8_t *pDataY, uint8_t *pDataUV, + uint32_t strideY, uint32_t strideUV, + mfxBitstream **pBS); + mfxStatus ClearData(); + mfxStatus Reset(qsv_param_t *pParams); protected: - bool InitParams(qsv_param_t * pParams); - mfxStatus AllocateSurfaces(); - mfxStatus GetVideoParam(); - mfxStatus InitBitstream(); - mfxStatus LoadNV12(mfxFrameSurface1 *pSurface, uint8_t *pDataY, - uint8_t *pDataUV, uint32_t strideY, uint32_t strideUV); - mfxStatus Drain(); - int GetFreeTaskIndex(Task* pTaskPool, mfxU16 nPoolSize); + bool InitParams(qsv_param_t *pParams); + mfxStatus AllocateSurfaces(); + mfxStatus GetVideoParam(); + mfxStatus InitBitstream(); + mfxStatus LoadNV12(mfxFrameSurface1 *pSurface, uint8_t *pDataY, + uint8_t *pDataUV, uint32_t strideY, + uint32_t strideUV); + mfxStatus Drain(); + int GetFreeTaskIndex(Task *pTaskPool, mfxU16 nPoolSize); private: - mfxIMPL m_impl; - mfxVersion m_ver; - MFXVideoSession m_session; - mfxFrameAllocator m_mfxAllocator; - mfxVideoParam m_mfxEncParams; - mfxFrameAllocResponse m_mfxResponse; - mfxFrameSurface1** m_pmfxSurfaces; - mfxU16 m_nSurfNum; - MFXVideoENCODE* m_pmfxENC; - mfxU8 m_SPSBuffer[100]; - mfxU8 m_PPSBuffer[100]; - mfxU16 m_nSPSBufferSize; - mfxU16 m_nPPSBufferSize; - mfxVideoParam m_parameter; - mfxExtCodingOption2 m_co2; - mfxExtCodingOption m_co; - mfxU16 m_nTaskPool; - Task* m_pTaskPool; - int m_nTaskIdx; - int m_nFirstSyncTask; - mfxBitstream m_outBitstream; - bool m_bIsWindows8OrGreater; - bool m_bUseD3D11; - bool m_bD3D9HACK; - static mfxU16 g_numEncodersOpen; - static mfxHDL g_DX_Handle; // we only want one handle for all instances to use; + mfxIMPL m_impl; + mfxVersion m_ver; + MFXVideoSession m_session; + mfxFrameAllocator m_mfxAllocator; + mfxVideoParam m_mfxEncParams; + mfxFrameAllocResponse m_mfxResponse; + mfxFrameSurface1 **m_pmfxSurfaces; + mfxU16 m_nSurfNum; + MFXVideoENCODE *m_pmfxENC; + mfxU8 m_SPSBuffer[100]; + mfxU8 m_PPSBuffer[100]; + mfxU16 m_nSPSBufferSize; + mfxU16 m_nPPSBufferSize; + mfxVideoParam m_parameter; + mfxExtCodingOption2 m_co2; + mfxExtCodingOption m_co; + mfxU16 m_nTaskPool; + Task *m_pTaskPool; + int m_nTaskIdx; + int m_nFirstSyncTask; + mfxBitstream m_outBitstream; + bool m_bIsWindows8OrGreater; + bool m_bUseD3D11; + bool m_bD3D9HACK; + static mfxU16 g_numEncodersOpen; + static mfxHDL + g_DX_Handle; // we only want one handle for all instances to use; }; -
View file
obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/bits/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/common_directx11.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/common_directx11.cpp
Changed
@@ -10,140 +10,132 @@ #include "common_directx11.h" -#include<map> +#include <map> -ID3D11Device* g_pD3D11Device; -ID3D11DeviceContext* g_pD3D11Ctx; -IDXGIFactory2* g_pDXGIFactory; -IDXGIAdapter* g_pAdapter; +ID3D11Device *g_pD3D11Device; +ID3D11DeviceContext *g_pD3D11Ctx; +IDXGIFactory2 *g_pDXGIFactory; +IDXGIAdapter *g_pAdapter; -std::map<mfxMemId*, mfxHDL> allocResponses; +std::map<mfxMemId *, mfxHDL> allocResponses; std::map<mfxHDL, mfxFrameAllocResponse> allocDecodeResponses; -std::map<mfxHDL, int> allocDecodeRefCount; +std::map<mfxHDL, int> allocDecodeRefCount; typedef struct { - mfxMemId memId; - mfxMemId memIdStage; - mfxU16 rw; + mfxMemId memId; + mfxMemId memIdStage; + mfxU16 rw; } CustomMemId; const struct { - mfxIMPL impl; // actual implementation - mfxU32 adapterID; // device adapter number -} implTypes[] = { - {MFX_IMPL_HARDWARE, 0}, - {MFX_IMPL_HARDWARE2, 1}, - {MFX_IMPL_HARDWARE3, 2}, - {MFX_IMPL_HARDWARE4, 3} -}; + mfxIMPL impl; // actual implementation + mfxU32 adapterID; // device adapter number +} implTypes[] = {{MFX_IMPL_HARDWARE, 0}, + {MFX_IMPL_HARDWARE2, 1}, + {MFX_IMPL_HARDWARE3, 2}, + {MFX_IMPL_HARDWARE4, 3}}; // ================================================================= // DirectX functionality required to manage DX11 device and surfaces // -IDXGIAdapter* GetIntelDeviceAdapterHandle(mfxSession session) +IDXGIAdapter *GetIntelDeviceAdapterHandle(mfxSession session) { - mfxU32 adapterNum = 0; - mfxIMPL impl; + mfxU32 adapterNum = 0; + mfxIMPL impl; - MFXQueryIMPL(session, &impl); + MFXQueryIMPL(session, &impl); - mfxIMPL baseImpl = MFX_IMPL_BASETYPE(impl); // Extract Media SDK base implementation type + mfxIMPL baseImpl = MFX_IMPL_BASETYPE( + impl); // Extract Media SDK base implementation type - // get corresponding adapter number - for (mfxU8 i = 0; i < sizeof(implTypes)/sizeof(implTypes[0]); i++) { - if (implTypes[i].impl == baseImpl) { - adapterNum = implTypes[i].adapterID; - break; - } - } + // get corresponding adapter number + for (mfxU8 i = 0; i < sizeof(implTypes) / sizeof(implTypes[0]); i++) { + if (implTypes[i].impl == baseImpl) { + adapterNum = implTypes[i].adapterID; + break; + } + } - HRESULT hres = CreateDXGIFactory(__uuidof(IDXGIFactory2), (void**)(&g_pDXGIFactory) ); - if (FAILED(hres)) return NULL; + HRESULT hres = CreateDXGIFactory(__uuidof(IDXGIFactory2), + (void **)(&g_pDXGIFactory)); + if (FAILED(hres)) + return NULL; - IDXGIAdapter* adapter; - hres = g_pDXGIFactory->EnumAdapters(adapterNum, &adapter); - if (FAILED(hres)) return NULL; + IDXGIAdapter *adapter; + hres = g_pDXGIFactory->EnumAdapters(adapterNum, &adapter); + if (FAILED(hres)) + return NULL; - return adapter; + return adapter; } // Create HW device context -mfxStatus CreateHWDevice(mfxSession session, mfxHDL* deviceHandle, HWND hWnd, bool bCreateSharedHandles) +mfxStatus CreateHWDevice(mfxSession session, mfxHDL *deviceHandle, HWND hWnd, + bool bCreateSharedHandles) { - //Note: not using bCreateSharedHandles for DX11 -- for API consistency only - hWnd; // Window handle not required by DX11 since we do not showcase rendering. - bCreateSharedHandles; // For rendering, not used here. Just for consistencies sake. - - HRESULT hres = S_OK; - - static D3D_FEATURE_LEVEL FeatureLevels[] = { - D3D_FEATURE_LEVEL_11_1, - D3D_FEATURE_LEVEL_11_0, - D3D_FEATURE_LEVEL_10_1, - D3D_FEATURE_LEVEL_10_0 - }; - D3D_FEATURE_LEVEL pFeatureLevelsOut; - - g_pAdapter = GetIntelDeviceAdapterHandle(session); - if (NULL == g_pAdapter) - return MFX_ERR_DEVICE_FAILED; - - UINT dxFlags = 0; - //UINT dxFlags = D3D11_CREATE_DEVICE_DEBUG; - - hres = D3D11CreateDevice( g_pAdapter, - D3D_DRIVER_TYPE_UNKNOWN, - NULL, - dxFlags, - FeatureLevels, - (sizeof(FeatureLevels) / sizeof(FeatureLevels[0])), - D3D11_SDK_VERSION, - &g_pD3D11Device, - &pFeatureLevelsOut, - &g_pD3D11Ctx); - if (FAILED(hres)) - return MFX_ERR_DEVICE_FAILED; - - // turn on multithreading for the DX11 context - CComQIPtr<ID3D10Multithread> p_mt(g_pD3D11Ctx); - if (p_mt) - p_mt->SetMultithreadProtected(true); - else - return MFX_ERR_DEVICE_FAILED; - - *deviceHandle = (mfxHDL)g_pD3D11Device; - - return MFX_ERR_NONE; + //Note: not using bCreateSharedHandles for DX11 -- for API consistency only + hWnd; // Window handle not required by DX11 since we do not showcase rendering. + bCreateSharedHandles; // For rendering, not used here. Just for consistencies sake. + + HRESULT hres = S_OK; + + static D3D_FEATURE_LEVEL FeatureLevels[] = {D3D_FEATURE_LEVEL_11_1, + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0}; + D3D_FEATURE_LEVEL pFeatureLevelsOut; + + g_pAdapter = GetIntelDeviceAdapterHandle(session); + if (NULL == g_pAdapter) + return MFX_ERR_DEVICE_FAILED; + + UINT dxFlags = 0; + //UINT dxFlags = D3D11_CREATE_DEVICE_DEBUG; + + hres = D3D11CreateDevice( + g_pAdapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, dxFlags, + FeatureLevels, + (sizeof(FeatureLevels) / sizeof(FeatureLevels[0])), + D3D11_SDK_VERSION, &g_pD3D11Device, &pFeatureLevelsOut, + &g_pD3D11Ctx); + if (FAILED(hres)) + return MFX_ERR_DEVICE_FAILED; + + // turn on multithreading for the DX11 context + CComQIPtr<ID3D10Multithread> p_mt(g_pD3D11Ctx); + if (p_mt) + p_mt->SetMultithreadProtected(true); + else + return MFX_ERR_DEVICE_FAILED; + + *deviceHandle = (mfxHDL)g_pD3D11Device; + + return MFX_ERR_NONE; } - void SetHWDeviceContext(CComPtr<ID3D11DeviceContext> devCtx) { - g_pD3D11Ctx = devCtx; - devCtx->GetDevice(&g_pD3D11Device); + g_pD3D11Ctx = devCtx; + devCtx->GetDevice(&g_pD3D11Device); } // Free HW device context void CleanupHWDevice() { - if (g_pAdapter) - { + if (g_pAdapter) { g_pAdapter->Release(); g_pAdapter = NULL; } - if (g_pD3D11Device) - { + if (g_pD3D11Device) { g_pD3D11Device->Release(); g_pD3D11Device = NULL; } - if (g_pD3D11Ctx) - { + if (g_pD3D11Ctx) { g_pD3D11Ctx->Release(); g_pD3D11Ctx = NULL; } - if (g_pDXGIFactory) - { + if (g_pDXGIFactory) { g_pDXGIFactory->Release(); g_pDXGIFactory = NULL; } @@ -151,7 +143,7 @@ CComPtr<ID3D11DeviceContext> GetHWDeviceContext() { - return g_pD3D11Ctx; + return g_pD3D11Ctx; } /* (Hugh) Functions currently unused */ @@ -170,318 +162,337 @@ // // Intel Media SDK memory allocator entrypoints.... // -mfxStatus _simple_alloc(mfxFrameAllocRequest* request, mfxFrameAllocResponse* response) +mfxStatus _simple_alloc(mfxFrameAllocRequest *request, + mfxFrameAllocResponse *response) { - HRESULT hRes; - - // Determine surface format - DXGI_FORMAT format; - if (MFX_FOURCC_NV12 == request->Info.FourCC) - format = DXGI_FORMAT_NV12; - else if (MFX_FOURCC_RGB4 == request->Info.FourCC) - format = DXGI_FORMAT_B8G8R8A8_UNORM; - else if (MFX_FOURCC_YUY2== request->Info.FourCC) - format = DXGI_FORMAT_YUY2; - else if (MFX_FOURCC_P8 == request->Info.FourCC ) //|| MFX_FOURCC_P8_TEXTURE == request->Info.FourCC - format = DXGI_FORMAT_P8; - else - format = DXGI_FORMAT_UNKNOWN; - - if (DXGI_FORMAT_UNKNOWN == format) - return MFX_ERR_UNSUPPORTED; - - - // Allocate custom container to keep texture and stage buffers for each surface - // Container also stores the intended read and/or write operation. - CustomMemId** mids = (CustomMemId**)calloc(request->NumFrameSuggested, sizeof(CustomMemId*)); - if (!mids) return MFX_ERR_MEMORY_ALLOC; - - for (int i=0; i<request->NumFrameSuggested; i++) { - mids[i] = (CustomMemId*)calloc(1, sizeof(CustomMemId)); - if (!mids[i]) { - return MFX_ERR_MEMORY_ALLOC; - } - mids[i]->rw = request->Type & 0xF000; // Set intended read/write operation - } - - request->Type = request->Type & 0x0FFF; - - // because P8 data (bitstream) for h264 encoder should be allocated by CreateBuffer() - // but P8 data (MBData) for MPEG2 encoder should be allocated by CreateTexture2D() - if (request->Info.FourCC == MFX_FOURCC_P8) { - D3D11_BUFFER_DESC desc = { 0 }; - - if (!request->NumFrameSuggested) return MFX_ERR_MEMORY_ALLOC; - - desc.ByteWidth = request->Info.Width * request->Info.Height; - desc.Usage = D3D11_USAGE_STAGING; - desc.BindFlags = 0; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; - desc.MiscFlags = 0; - desc.StructureByteStride = 0; - - ID3D11Buffer* buffer = 0; - hRes = g_pD3D11Device->CreateBuffer(&desc, 0, &buffer); - if (FAILED(hRes)) - return MFX_ERR_MEMORY_ALLOC; - - mids[0]->memId = reinterpret_cast<ID3D11Texture2D*>(buffer); - } else { - D3D11_TEXTURE2D_DESC desc = {0}; - - desc.Width = request->Info.Width; - desc.Height = request->Info.Height; - desc.MipLevels = 1; - desc.ArraySize = 1; // number of subresources is 1 in this case - desc.Format = format; - desc.SampleDesc.Count = 1; - desc.Usage = D3D11_USAGE_DEFAULT; - desc.BindFlags = D3D11_BIND_DECODER; - desc.MiscFlags = 0; - //desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; - - if ( (MFX_MEMTYPE_FROM_VPPIN & request->Type) && - (DXGI_FORMAT_B8G8R8A8_UNORM == desc.Format) ) { - desc.BindFlags = D3D11_BIND_RENDER_TARGET; - if (desc.ArraySize > 2) - return MFX_ERR_MEMORY_ALLOC; - } - - if ( (MFX_MEMTYPE_FROM_VPPOUT & request->Type) || - (MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET & request->Type)) { - desc.BindFlags = D3D11_BIND_RENDER_TARGET; - if (desc.ArraySize > 2) - return MFX_ERR_MEMORY_ALLOC; - } - - if ( DXGI_FORMAT_P8 == desc.Format ) - desc.BindFlags = 0; - - ID3D11Texture2D* pTexture2D; - - // Create surface textures - for (size_t i = 0; i < request->NumFrameSuggested / desc.ArraySize; i++) { - hRes = g_pD3D11Device->CreateTexture2D(&desc, NULL, &pTexture2D); - - if (FAILED(hRes)) - return MFX_ERR_MEMORY_ALLOC; - - mids[i]->memId = pTexture2D; - } - - desc.ArraySize = 1; - desc.Usage = D3D11_USAGE_STAGING; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;// | D3D11_CPU_ACCESS_WRITE; - desc.BindFlags = 0; - desc.MiscFlags = 0; - //desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; - - // Create surface staging textures - for (size_t i = 0; i < request->NumFrameSuggested; i++) { - hRes = g_pD3D11Device->CreateTexture2D(&desc, NULL, &pTexture2D); - - if (FAILED(hRes)) - return MFX_ERR_MEMORY_ALLOC; - - mids[i]->memIdStage = pTexture2D; - } - } - - - response->mids = (mfxMemId*)mids; - response->NumFrameActual = request->NumFrameSuggested; - - return MFX_ERR_NONE; + HRESULT hRes; + + // Determine surface format + DXGI_FORMAT format; + if (MFX_FOURCC_NV12 == request->Info.FourCC) + format = DXGI_FORMAT_NV12; + else if (MFX_FOURCC_RGB4 == request->Info.FourCC) + format = DXGI_FORMAT_B8G8R8A8_UNORM; + else if (MFX_FOURCC_YUY2 == request->Info.FourCC) + format = DXGI_FORMAT_YUY2; + else if (MFX_FOURCC_P8 == + request->Info + .FourCC) //|| MFX_FOURCC_P8_TEXTURE == request->Info.FourCC + format = DXGI_FORMAT_P8; + else + format = DXGI_FORMAT_UNKNOWN; + + if (DXGI_FORMAT_UNKNOWN == format) + return MFX_ERR_UNSUPPORTED; + + // Allocate custom container to keep texture and stage buffers for each surface + // Container also stores the intended read and/or write operation. + CustomMemId **mids = (CustomMemId **)calloc(request->NumFrameSuggested, + sizeof(CustomMemId *)); + if (!mids) + return MFX_ERR_MEMORY_ALLOC; + + for (int i = 0; i < request->NumFrameSuggested; i++) { + mids[i] = (CustomMemId *)calloc(1, sizeof(CustomMemId)); + if (!mids[i]) { + return MFX_ERR_MEMORY_ALLOC; + } + mids[i]->rw = request->Type & + 0xF000; // Set intended read/write operation + } + + request->Type = request->Type & 0x0FFF; + + // because P8 data (bitstream) for h264 encoder should be allocated by CreateBuffer() + // but P8 data (MBData) for MPEG2 encoder should be allocated by CreateTexture2D() + if (request->Info.FourCC == MFX_FOURCC_P8) { + D3D11_BUFFER_DESC desc = {0}; + + if (!request->NumFrameSuggested) + return MFX_ERR_MEMORY_ALLOC; + + desc.ByteWidth = request->Info.Width * request->Info.Height; + desc.Usage = D3D11_USAGE_STAGING; + desc.BindFlags = 0; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; + desc.MiscFlags = 0; + desc.StructureByteStride = 0; + + ID3D11Buffer *buffer = 0; + hRes = g_pD3D11Device->CreateBuffer(&desc, 0, &buffer); + if (FAILED(hRes)) + return MFX_ERR_MEMORY_ALLOC; + + mids[0]->memId = reinterpret_cast<ID3D11Texture2D *>(buffer); + } else { + D3D11_TEXTURE2D_DESC desc = {0}; + + desc.Width = request->Info.Width; + desc.Height = request->Info.Height; + desc.MipLevels = 1; + desc.ArraySize = 1; // number of subresources is 1 in this case + desc.Format = format; + desc.SampleDesc.Count = 1; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.BindFlags = D3D11_BIND_DECODER; + desc.MiscFlags = 0; + //desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; + + if ((MFX_MEMTYPE_FROM_VPPIN & request->Type) && + (DXGI_FORMAT_B8G8R8A8_UNORM == desc.Format)) { + desc.BindFlags = D3D11_BIND_RENDER_TARGET; + if (desc.ArraySize > 2) + return MFX_ERR_MEMORY_ALLOC; + } + + if ((MFX_MEMTYPE_FROM_VPPOUT & request->Type) || + (MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET & + request->Type)) { + desc.BindFlags = D3D11_BIND_RENDER_TARGET; + if (desc.ArraySize > 2) + return MFX_ERR_MEMORY_ALLOC; + } + + if (DXGI_FORMAT_P8 == desc.Format) + desc.BindFlags = 0; + + ID3D11Texture2D *pTexture2D; + + // Create surface textures + for (size_t i = 0; + i < request->NumFrameSuggested / desc.ArraySize; i++) { + hRes = g_pD3D11Device->CreateTexture2D(&desc, NULL, + &pTexture2D); + + if (FAILED(hRes)) + return MFX_ERR_MEMORY_ALLOC; + + mids[i]->memId = pTexture2D; + } + + desc.ArraySize = 1; + desc.Usage = D3D11_USAGE_STAGING; + desc.CPUAccessFlags = + D3D11_CPU_ACCESS_READ; // | D3D11_CPU_ACCESS_WRITE; + desc.BindFlags = 0; + desc.MiscFlags = 0; + //desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; + + // Create surface staging textures + for (size_t i = 0; i < request->NumFrameSuggested; i++) { + hRes = g_pD3D11Device->CreateTexture2D(&desc, NULL, + &pTexture2D); + + if (FAILED(hRes)) + return MFX_ERR_MEMORY_ALLOC; + + mids[i]->memIdStage = pTexture2D; + } + } + + response->mids = (mfxMemId *)mids; + response->NumFrameActual = request->NumFrameSuggested; + + return MFX_ERR_NONE; } -mfxStatus simple_alloc(mfxHDL pthis, mfxFrameAllocRequest* request, mfxFrameAllocResponse* response) +mfxStatus simple_alloc(mfxHDL pthis, mfxFrameAllocRequest *request, + mfxFrameAllocResponse *response) { - mfxStatus sts = MFX_ERR_NONE; - - if (request->Type & MFX_MEMTYPE_SYSTEM_MEMORY) - return MFX_ERR_UNSUPPORTED; - - if (allocDecodeResponses.find(pthis) != allocDecodeResponses.end() && - MFX_MEMTYPE_EXTERNAL_FRAME & request->Type && - MFX_MEMTYPE_FROM_DECODE & request->Type) { - // Memory for this request was already allocated during manual allocation stage. Return saved response - // When decode acceleration device (DXVA) is created it requires a list of d3d surfaces to be passed. - // Therefore Media SDK will ask for the surface info/mids again at Init() stage, thus requiring us to return the saved response - // (No such restriction applies to Encode or VPP) - *response = allocDecodeResponses[pthis]; - allocDecodeRefCount[pthis]++; - } else { - sts = _simple_alloc(request, response); - - if (MFX_ERR_NONE == sts) { - if ( MFX_MEMTYPE_EXTERNAL_FRAME & request->Type && - MFX_MEMTYPE_FROM_DECODE & request->Type) { - // Decode alloc response handling - allocDecodeResponses[pthis] = *response; - allocDecodeRefCount[pthis]++; - } else { - // Encode and VPP alloc response handling - allocResponses[response->mids] = pthis; - } - } - } - - return sts; + mfxStatus sts = MFX_ERR_NONE; + + if (request->Type & MFX_MEMTYPE_SYSTEM_MEMORY) + return MFX_ERR_UNSUPPORTED; + + if (allocDecodeResponses.find(pthis) != allocDecodeResponses.end() && + MFX_MEMTYPE_EXTERNAL_FRAME & request->Type && + MFX_MEMTYPE_FROM_DECODE & request->Type) { + // Memory for this request was already allocated during manual allocation stage. Return saved response + // When decode acceleration device (DXVA) is created it requires a list of d3d surfaces to be passed. + // Therefore Media SDK will ask for the surface info/mids again at Init() stage, thus requiring us to return the saved response + // (No such restriction applies to Encode or VPP) + *response = allocDecodeResponses[pthis]; + allocDecodeRefCount[pthis]++; + } else { + sts = _simple_alloc(request, response); + + if (MFX_ERR_NONE == sts) { + if (MFX_MEMTYPE_EXTERNAL_FRAME & request->Type && + MFX_MEMTYPE_FROM_DECODE & request->Type) { + // Decode alloc response handling + allocDecodeResponses[pthis] = *response; + allocDecodeRefCount[pthis]++; + } else { + // Encode and VPP alloc response handling + allocResponses[response->mids] = pthis; + } + } + } + + return sts; } -mfxStatus simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData* ptr) +mfxStatus simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) { - pthis; // To suppress warning for this unused parameter - - HRESULT hRes = S_OK; - - D3D11_TEXTURE2D_DESC desc = {0}; - D3D11_MAPPED_SUBRESOURCE lockedRect = {0}; - - CustomMemId* memId = (CustomMemId*)mid; - ID3D11Texture2D* pSurface = (ID3D11Texture2D*)memId->memId; - ID3D11Texture2D* pStage = (ID3D11Texture2D*)memId->memIdStage; - - D3D11_MAP mapType = D3D11_MAP_READ; - UINT mapFlags = D3D11_MAP_FLAG_DO_NOT_WAIT; - - if (NULL == pStage) { - hRes = g_pD3D11Ctx->Map(pSurface, 0, mapType, mapFlags, &lockedRect); - desc.Format = DXGI_FORMAT_P8; - } else { - pSurface->GetDesc(&desc); - - // copy data only in case of user wants to read from stored surface - if (memId->rw & WILL_READ) - g_pD3D11Ctx->CopySubresourceRegion(pStage, 0, 0, 0, 0, pSurface, 0, NULL); - - do { - hRes = g_pD3D11Ctx->Map(pStage, 0, mapType, mapFlags, &lockedRect); - if (S_OK != hRes && DXGI_ERROR_WAS_STILL_DRAWING != hRes) - return MFX_ERR_LOCK_MEMORY; - } while (DXGI_ERROR_WAS_STILL_DRAWING == hRes); - } - - if (FAILED(hRes)) - return MFX_ERR_LOCK_MEMORY; - - switch (desc.Format) { - case DXGI_FORMAT_NV12: - ptr->Pitch = (mfxU16)lockedRect.RowPitch; - ptr->Y = (mfxU8*)lockedRect.pData; - ptr->U = (mfxU8*)lockedRect.pData + desc.Height * lockedRect.RowPitch; - ptr->V = ptr->U + 1; - break; - case DXGI_FORMAT_B8G8R8A8_UNORM : - ptr->Pitch = (mfxU16)lockedRect.RowPitch; - ptr->B = (mfxU8*)lockedRect.pData; - ptr->G = ptr->B + 1; - ptr->R = ptr->B + 2; - ptr->A = ptr->B + 3; - break; - case DXGI_FORMAT_YUY2: - ptr->Pitch = (mfxU16)lockedRect.RowPitch; - ptr->Y = (mfxU8*)lockedRect.pData; - ptr->U = ptr->Y + 1; - ptr->V = ptr->Y + 3; - break; - case DXGI_FORMAT_P8 : - ptr->Pitch = (mfxU16)lockedRect.RowPitch; - ptr->Y = (mfxU8*)lockedRect.pData; - ptr->U = 0; - ptr->V = 0; - break; - default: - return MFX_ERR_LOCK_MEMORY; - } - - return MFX_ERR_NONE; + pthis; // To suppress warning for this unused parameter + + HRESULT hRes = S_OK; + + D3D11_TEXTURE2D_DESC desc = {0}; + D3D11_MAPPED_SUBRESOURCE lockedRect = {0}; + + CustomMemId *memId = (CustomMemId *)mid; + ID3D11Texture2D *pSurface = (ID3D11Texture2D *)memId->memId; + ID3D11Texture2D *pStage = (ID3D11Texture2D *)memId->memIdStage; + + D3D11_MAP mapType = D3D11_MAP_READ; + UINT mapFlags = D3D11_MAP_FLAG_DO_NOT_WAIT; + + if (NULL == pStage) { + hRes = g_pD3D11Ctx->Map(pSurface, 0, mapType, mapFlags, + &lockedRect); + desc.Format = DXGI_FORMAT_P8; + } else { + pSurface->GetDesc(&desc); + + // copy data only in case of user wants to read from stored surface + if (memId->rw & WILL_READ) + g_pD3D11Ctx->CopySubresourceRegion(pStage, 0, 0, 0, 0, + pSurface, 0, NULL); + + do { + hRes = g_pD3D11Ctx->Map(pStage, 0, mapType, mapFlags, + &lockedRect); + if (S_OK != hRes && + DXGI_ERROR_WAS_STILL_DRAWING != hRes) + return MFX_ERR_LOCK_MEMORY; + } while (DXGI_ERROR_WAS_STILL_DRAWING == hRes); + } + + if (FAILED(hRes)) + return MFX_ERR_LOCK_MEMORY; + + switch (desc.Format) { + case DXGI_FORMAT_NV12: + ptr->Pitch = (mfxU16)lockedRect.RowPitch; + ptr->Y = (mfxU8 *)lockedRect.pData; + ptr->U = (mfxU8 *)lockedRect.pData + + desc.Height * lockedRect.RowPitch; + ptr->V = ptr->U + 1; + break; + case DXGI_FORMAT_B8G8R8A8_UNORM: + ptr->Pitch = (mfxU16)lockedRect.RowPitch; + ptr->B = (mfxU8 *)lockedRect.pData; + ptr->G = ptr->B + 1; + ptr->R = ptr->B + 2; + ptr->A = ptr->B + 3; + break; + case DXGI_FORMAT_YUY2: + ptr->Pitch = (mfxU16)lockedRect.RowPitch; + ptr->Y = (mfxU8 *)lockedRect.pData; + ptr->U = ptr->Y + 1; + ptr->V = ptr->Y + 3; + break; + case DXGI_FORMAT_P8: + ptr->Pitch = (mfxU16)lockedRect.RowPitch; + ptr->Y = (mfxU8 *)lockedRect.pData; + ptr->U = 0; + ptr->V = 0; + break; + default: + return MFX_ERR_LOCK_MEMORY; + } + + return MFX_ERR_NONE; } -mfxStatus simple_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData* ptr) +mfxStatus simple_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) { - pthis; // To suppress warning for this unused parameter - - CustomMemId* memId = (CustomMemId*)mid; - ID3D11Texture2D* pSurface = (ID3D11Texture2D*)memId->memId; - ID3D11Texture2D* pStage = (ID3D11Texture2D*)memId->memIdStage; - - if (NULL == pStage) { - g_pD3D11Ctx->Unmap(pSurface, 0); - } else { - g_pD3D11Ctx->Unmap(pStage, 0); - // copy data only in case of user wants to write to stored surface - if (memId->rw & WILL_WRITE) - g_pD3D11Ctx->CopySubresourceRegion(pSurface, 0, 0, 0, 0, pStage, 0, NULL); - } - - if (ptr) { - ptr->Pitch=0; - ptr->U=ptr->V=ptr->Y=0; - ptr->A=ptr->R=ptr->G=ptr->B=0; - } - - return MFX_ERR_NONE; + pthis; // To suppress warning for this unused parameter + + CustomMemId *memId = (CustomMemId *)mid; + ID3D11Texture2D *pSurface = (ID3D11Texture2D *)memId->memId; + ID3D11Texture2D *pStage = (ID3D11Texture2D *)memId->memIdStage; + + if (NULL == pStage) { + g_pD3D11Ctx->Unmap(pSurface, 0); + } else { + g_pD3D11Ctx->Unmap(pStage, 0); + // copy data only in case of user wants to write to stored surface + if (memId->rw & WILL_WRITE) + g_pD3D11Ctx->CopySubresourceRegion(pSurface, 0, 0, 0, 0, + pStage, 0, NULL); + } + + if (ptr) { + ptr->Pitch = 0; + ptr->U = ptr->V = ptr->Y = 0; + ptr->A = ptr->R = ptr->G = ptr->B = 0; + } + + return MFX_ERR_NONE; } -mfxStatus simple_gethdl(mfxHDL pthis, mfxMemId mid, mfxHDL* handle) +mfxStatus simple_gethdl(mfxHDL pthis, mfxMemId mid, mfxHDL *handle) { - pthis; // To suppress warning for this unused parameter + pthis; // To suppress warning for this unused parameter - if (NULL == handle) - return MFX_ERR_INVALID_HANDLE; + if (NULL == handle) + return MFX_ERR_INVALID_HANDLE; - mfxHDLPair* pPair = (mfxHDLPair*)handle; - CustomMemId* memId = (CustomMemId*)mid; + mfxHDLPair *pPair = (mfxHDLPair *)handle; + CustomMemId *memId = (CustomMemId *)mid; - pPair->first = memId->memId; // surface texture - pPair->second = 0; + pPair->first = memId->memId; // surface texture + pPair->second = 0; - return MFX_ERR_NONE; + return MFX_ERR_NONE; } - -mfxStatus _simple_free(mfxFrameAllocResponse* response) +mfxStatus _simple_free(mfxFrameAllocResponse *response) { - if (response->mids) { - for (mfxU32 i = 0; i < response->NumFrameActual; i++) { - if (response->mids[i]) { - CustomMemId* mid = (CustomMemId*)response->mids[i]; - ID3D11Texture2D* pSurface = (ID3D11Texture2D*)mid->memId; - ID3D11Texture2D* pStage = (ID3D11Texture2D*)mid->memIdStage; - - if (pSurface) - pSurface->Release(); - if (pStage) - pStage->Release(); - - free(mid); - } - } - free(response->mids); - response->mids = NULL; - } - - return MFX_ERR_NONE; + if (response->mids) { + for (mfxU32 i = 0; i < response->NumFrameActual; i++) { + if (response->mids[i]) { + CustomMemId *mid = + (CustomMemId *)response->mids[i]; + ID3D11Texture2D *pSurface = + (ID3D11Texture2D *)mid->memId; + ID3D11Texture2D *pStage = + (ID3D11Texture2D *)mid->memIdStage; + + if (pSurface) + pSurface->Release(); + if (pStage) + pStage->Release(); + + free(mid); + } + } + free(response->mids); + response->mids = NULL; + } + + return MFX_ERR_NONE; } -mfxStatus simple_free(mfxHDL pthis, mfxFrameAllocResponse* response) +mfxStatus simple_free(mfxHDL pthis, mfxFrameAllocResponse *response) { - if (NULL == response) - return MFX_ERR_NULL_PTR; - - if (allocResponses.find(response->mids) == allocResponses.end()) { - // Decode free response handling - if (--allocDecodeRefCount[pthis] == 0) { - _simple_free(response); - allocDecodeResponses.erase(pthis); - allocDecodeRefCount.erase(pthis); - } - } else { - // Encode and VPP free response handling - allocResponses.erase(response->mids); - _simple_free(response); - } - - return MFX_ERR_NONE; + if (NULL == response) + return MFX_ERR_NULL_PTR; + + if (allocResponses.find(response->mids) == allocResponses.end()) { + // Decode free response handling + if (--allocDecodeRefCount[pthis] == 0) { + _simple_free(response); + allocDecodeResponses.erase(pthis); + allocDecodeRefCount.erase(pthis); + } + } else { + // Encode and VPP free response handling + allocResponses.erase(response->mids); + _simple_free(response); + } + + return MFX_ERR_NONE; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/common_directx11.h -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/common_directx11.h
Changed
@@ -31,7 +31,8 @@ // - Device must be active (but monitor does NOT have to be attached) // - Device must be enabled in BIOS. Required for the case when used together with a discrete graphics card // - For switchable graphics solutions (mobile) make sure that Intel device is the active device -mfxStatus CreateHWDevice(mfxSession session, mfxHDL* deviceHandle, HWND hWnd, bool bCreateSharedHandles); +mfxStatus CreateHWDevice(mfxSession session, mfxHDL *deviceHandle, HWND hWnd, + bool bCreateSharedHandles); void CleanupHWDevice(); void SetHWDeviceContext(CComPtr<ID3D11DeviceContext> devCtx); CComPtr<ID3D11DeviceContext> GetHWDeviceContext();
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/common_directx9.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/common_directx9.cpp
Changed
@@ -7,15 +7,20 @@ #include <map> #include <atlbase.h> +#define D3DFMT_NV12 (D3DFORMAT) MAKEFOURCC('N', 'V', '1', '2') +#define D3DFMT_YV12 (D3DFORMAT) MAKEFOURCC('Y', 'V', '1', '2') +#define D3DFMT_P010 (D3DFORMAT) MAKEFOURCC('P', '0', '1', '0') +#define MSDK_SAFE_FREE(X) \ + { \ + if (X) { \ + free(X); \ + X = NULL; \ + } \ + } -#define D3DFMT_NV12 (D3DFORMAT)MAKEFOURCC('N','V','1','2') -#define D3DFMT_YV12 (D3DFORMAT)MAKEFOURCC('Y','V','1','2') -#define D3DFMT_P010 (D3DFORMAT)MAKEFOURCC('P','0','1','0') -#define MSDK_SAFE_FREE(X) {if (X) { free(X); X = NULL; }} - -std::map<mfxMemId*, mfxHDL> dx9_allocResponses; +std::map<mfxMemId *, mfxHDL> dx9_allocResponses; std::map<mfxHDL, mfxFrameAllocResponse> dx9_allocDecodeResponses; -std::map<mfxHDL, int> dx9_allocDecodeRefCount; +std::map<mfxHDL, int> dx9_allocDecodeRefCount; CComPtr<IDirect3DDeviceManager9> m_manager; CComPtr<IDirectXVideoDecoderService> m_decoderService; @@ -24,61 +29,55 @@ HANDLE m_hProcessor; DWORD m_surfaceUsage; -CD3D9Device* g_hwdevice; +CD3D9Device *g_hwdevice; const struct { - mfxIMPL impl; // actual implementation - mfxU32 adapterID; // device adapter number -} implTypes[] = { - { MFX_IMPL_HARDWARE, 0 }, - { MFX_IMPL_HARDWARE2, 1 }, - { MFX_IMPL_HARDWARE3, 2 }, - { MFX_IMPL_HARDWARE4, 3 } + mfxIMPL impl; // actual implementation + mfxU32 adapterID; // device adapter number +} implTypes[] = {{MFX_IMPL_HARDWARE, 0}, + {MFX_IMPL_HARDWARE2, 1}, + {MFX_IMPL_HARDWARE3, 2}, + {MFX_IMPL_HARDWARE4, 3}}; + +struct mfxAllocatorParams { + virtual ~mfxAllocatorParams(){}; }; -struct mfxAllocatorParams -{ - virtual ~mfxAllocatorParams(){}; -}; +struct D3DAllocatorParams : mfxAllocatorParams { + IDirect3DDeviceManager9 *pManager; + DWORD surfaceUsage; -struct D3DAllocatorParams : mfxAllocatorParams -{ - IDirect3DDeviceManager9 *pManager; - DWORD surfaceUsage; - - D3DAllocatorParams() - : pManager() - , surfaceUsage() - { - } + D3DAllocatorParams() : pManager(), surfaceUsage() {} }; mfxStatus DX9_Alloc_Init(D3DAllocatorParams *pParams) { - D3DAllocatorParams *pd3dParams = 0; - pd3dParams = dynamic_cast<D3DAllocatorParams *>(pParams); - if (!pd3dParams) - return MFX_ERR_NOT_INITIALIZED; + D3DAllocatorParams *pd3dParams = 0; + pd3dParams = dynamic_cast<D3DAllocatorParams *>(pParams); + if (!pd3dParams) + return MFX_ERR_NOT_INITIALIZED; - m_manager = pd3dParams->pManager; - m_surfaceUsage = pd3dParams->surfaceUsage; + m_manager = pd3dParams->pManager; + m_surfaceUsage = pd3dParams->surfaceUsage; - return MFX_ERR_NONE; + return MFX_ERR_NONE; } -mfxStatus DX9_CreateHWDevice(mfxSession session, mfxHDL* deviceHandle, HWND, bool) +mfxStatus DX9_CreateHWDevice(mfxSession session, mfxHDL *deviceHandle, HWND, + bool) { mfxStatus result; g_hwdevice = new CD3D9Device; - mfxU32 adapterNum = 0; + mfxU32 adapterNum = 0; mfxIMPL impl; MFXQueryIMPL(session, &impl); - mfxIMPL baseImpl = MFX_IMPL_BASETYPE(impl); // Extract Media SDK base implementation type + mfxIMPL baseImpl = MFX_IMPL_BASETYPE( + impl); // Extract Media SDK base implementation type - // get corresponding adapter number + // get corresponding adapter number for (mfxU8 i = 0; i < sizeof(implTypes) / sizeof(implTypes[0]); i++) { if (implTypes[i].impl == baseImpl) { adapterNum = implTypes[i].adapterID; @@ -86,7 +85,7 @@ } } - POINT point = { 0, 0 }; + POINT point = {0, 0}; HWND window = WindowFromPoint(point); result = g_hwdevice->Init(window, 0, adapterNum); @@ -96,9 +95,9 @@ g_hwdevice->GetHandle(MFX_HANDLE_D3D9_DEVICE_MANAGER, deviceHandle); - D3DAllocatorParams dx9_allocParam; - dx9_allocParam.pManager = reinterpret_cast<IDirect3DDeviceManager9 *>(*deviceHandle); + dx9_allocParam.pManager = + reinterpret_cast<IDirect3DDeviceManager9 *>(*deviceHandle); DX9_Alloc_Init(&dx9_allocParam); return MFX_ERR_NONE; } @@ -135,8 +134,7 @@ D3DFORMAT ConvertMfxFourccToD3dFormat(mfxU32 fourcc) { - switch (fourcc) - { + switch (fourcc) { case MFX_FOURCC_NV12: return D3DFMT_NV12; case MFX_FOURCC_YV12: @@ -158,15 +156,16 @@ } } -mfxStatus dx9_simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData* ptr) +mfxStatus dx9_simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) { pthis; // To suppress warning for this unused parameter if (!ptr || !mid) return MFX_ERR_NULL_PTR; - mfxHDLPair *dxmid = (mfxHDLPair*)mid; - IDirect3DSurface9 *pSurface = static_cast<IDirect3DSurface9*>(dxmid->first); + mfxHDLPair *dxmid = (mfxHDLPair *)mid; + IDirect3DSurface9 *pSurface = + static_cast<IDirect3DSurface9 *>(dxmid->first); if (pSurface == 0) return MFX_ERR_INVALID_HANDLE; @@ -175,14 +174,10 @@ if (FAILED(hr)) return MFX_ERR_LOCK_MEMORY; - if (desc.Format != D3DFMT_NV12 && - desc.Format != D3DFMT_YV12 && - desc.Format != D3DFMT_YUY2 && - desc.Format != D3DFMT_R8G8B8 && - desc.Format != D3DFMT_A8R8G8B8 && - desc.Format != D3DFMT_P8 && - desc.Format != D3DFMT_P010 && - desc.Format != D3DFMT_A2R10G10B10) + if (desc.Format != D3DFMT_NV12 && desc.Format != D3DFMT_YV12 && + desc.Format != D3DFMT_YUY2 && desc.Format != D3DFMT_R8G8B8 && + desc.Format != D3DFMT_A8R8G8B8 && desc.Format != D3DFMT_P8 && + desc.Format != D3DFMT_P010 && desc.Format != D3DFMT_A2R10G10B10) return MFX_ERR_LOCK_MEMORY; D3DLOCKED_RECT locked; @@ -191,8 +186,7 @@ if (FAILED(hr)) return MFX_ERR_LOCK_MEMORY; - switch ((DWORD)desc.Format) - { + switch ((DWORD)desc.Format) { case D3DFMT_NV12: ptr->Pitch = (mfxU16)locked.Pitch; ptr->Y = (mfxU8 *)locked.pBits; @@ -243,20 +237,20 @@ return MFX_ERR_NONE; } -mfxStatus dx9_simple_unlock(mfxHDL, mfxMemId mid, mfxFrameData* ptr) +mfxStatus dx9_simple_unlock(mfxHDL, mfxMemId mid, mfxFrameData *ptr) { if (!mid) return MFX_ERR_NULL_PTR; - mfxHDLPair *dxmid = (mfxHDLPair*)mid; - IDirect3DSurface9 *pSurface = static_cast<IDirect3DSurface9*>(dxmid->first); + mfxHDLPair *dxmid = (mfxHDLPair *)mid; + IDirect3DSurface9 *pSurface = + static_cast<IDirect3DSurface9 *>(dxmid->first); if (pSurface == 0) return MFX_ERR_INVALID_HANDLE; pSurface->UnlockRect(); - if (NULL != ptr) - { + if (NULL != ptr) { ptr->Pitch = 0; ptr->Y = 0; ptr->U = 0; @@ -266,17 +260,17 @@ return MFX_ERR_NONE; } -mfxStatus dx9_simple_gethdl(mfxHDL, mfxMemId mid, mfxHDL* handle) +mfxStatus dx9_simple_gethdl(mfxHDL, mfxMemId mid, mfxHDL *handle) { if (!mid || !handle) return MFX_ERR_NULL_PTR; - mfxHDLPair *dxMid = (mfxHDLPair*)mid; + mfxHDLPair *dxMid = (mfxHDLPair *)mid; *handle = dxMid->first; return MFX_ERR_NONE; } -mfxStatus _dx9_simple_free(mfxFrameAllocResponse* response) +mfxStatus _dx9_simple_free(mfxFrameAllocResponse *response) { if (!response) return MFX_ERR_NULL_PTR; @@ -286,8 +280,10 @@ if (response->mids) { for (mfxU32 i = 0; i < response->NumFrameActual; i++) { if (response->mids[i]) { - mfxHDLPair *dxMids = (mfxHDLPair*)response->mids[i]; - static_cast<IDirect3DSurface9*>(dxMids->first)->Release(); + mfxHDLPair *dxMids = + (mfxHDLPair *)response->mids[i]; + static_cast<IDirect3DSurface9 *>(dxMids->first) + ->Release(); } } MSDK_SAFE_FREE(response->mids[0]); @@ -297,28 +293,30 @@ return sts; } -mfxStatus dx9_simple_free(mfxHDL pthis, mfxFrameAllocResponse* response) +mfxStatus dx9_simple_free(mfxHDL pthis, mfxFrameAllocResponse *response) { - if (NULL == response) - return MFX_ERR_NULL_PTR; - - if (dx9_allocResponses.find(response->mids) == dx9_allocResponses.end()) { - // Decode free response handling - if (--dx9_allocDecodeRefCount[pthis] == 0) { - _dx9_simple_free(response); - dx9_allocDecodeResponses.erase(pthis); - dx9_allocDecodeRefCount.erase(pthis); - } - } else { - // Encode and VPP free response handling - dx9_allocResponses.erase(response->mids); - _dx9_simple_free(response); - } - - return MFX_ERR_NONE; + if (NULL == response) + return MFX_ERR_NULL_PTR; + + if (dx9_allocResponses.find(response->mids) == + dx9_allocResponses.end()) { + // Decode free response handling + if (--dx9_allocDecodeRefCount[pthis] == 0) { + _dx9_simple_free(response); + dx9_allocDecodeResponses.erase(pthis); + dx9_allocDecodeRefCount.erase(pthis); + } + } else { + // Encode and VPP free response handling + dx9_allocResponses.erase(response->mids); + _dx9_simple_free(response); + } + + return MFX_ERR_NONE; } -mfxStatus _dx9_simple_alloc(mfxFrameAllocRequest* request, mfxFrameAllocResponse* response) +mfxStatus _dx9_simple_alloc(mfxFrameAllocRequest *request, + mfxFrameAllocResponse *response) { HRESULT hr; @@ -331,20 +329,16 @@ if (format == D3DFMT_UNKNOWN) return MFX_ERR_UNSUPPORTED; - DWORD target; + DWORD target; - if (MFX_MEMTYPE_DXVA2_DECODER_TARGET & request->Type) - { + if (MFX_MEMTYPE_DXVA2_DECODER_TARGET & request->Type) { target = DXVA2_VideoDecoderRenderTarget; - } - else if (MFX_MEMTYPE_DXVA2_PROCESSOR_TARGET & request->Type) - { + } else if (MFX_MEMTYPE_DXVA2_PROCESSOR_TARGET & request->Type) { target = DXVA2_VideoProcessorRenderTarget; - } - else + } else return MFX_ERR_UNSUPPORTED; - IDirectXVideoAccelerationService* videoService = NULL; + IDirectXVideoAccelerationService *videoService = NULL; if (target == DXVA2_VideoProcessorRenderTarget) { if (!m_hProcessor) { @@ -352,20 +346,22 @@ if (FAILED(hr)) return MFX_ERR_MEMORY_ALLOC; - hr = m_manager->GetVideoService(m_hProcessor, IID_IDirectXVideoProcessorService, (void**)&m_processorService); + hr = m_manager->GetVideoService( + m_hProcessor, IID_IDirectXVideoProcessorService, + (void **)&m_processorService); if (FAILED(hr)) return MFX_ERR_MEMORY_ALLOC; } videoService = m_processorService; - } - else { - if (!m_hDecoder) - { + } else { + if (!m_hDecoder) { hr = m_manager->OpenDeviceHandle(&m_hDecoder); if (FAILED(hr)) return MFX_ERR_MEMORY_ALLOC; - hr = m_manager->GetVideoService(m_hDecoder, IID_IDirectXVideoDecoderService, (void**)&m_decoderService); + hr = m_manager->GetVideoService( + m_hDecoder, IID_IDirectXVideoDecoderService, + (void **)&m_decoderService); if (FAILED(hr)) return MFX_ERR_MEMORY_ALLOC; } @@ -373,8 +369,10 @@ } mfxHDLPair *dxMids = NULL, **dxMidPtrs = NULL; - dxMids = (mfxHDLPair*)calloc(request->NumFrameSuggested, sizeof(mfxHDLPair)); - dxMidPtrs = (mfxHDLPair**)calloc(request->NumFrameSuggested, sizeof(mfxHDLPair*)); + dxMids = (mfxHDLPair *)calloc(request->NumFrameSuggested, + sizeof(mfxHDLPair)); + dxMidPtrs = (mfxHDLPair **)calloc(request->NumFrameSuggested, + sizeof(mfxHDLPair *)); if (!dxMids || !dxMidPtrs) { MSDK_SAFE_FREE(dxMids); @@ -382,13 +380,16 @@ return MFX_ERR_MEMORY_ALLOC; } - response->mids = (mfxMemId*)dxMidPtrs; + response->mids = (mfxMemId *)dxMidPtrs; response->NumFrameActual = request->NumFrameSuggested; if (request->Type & MFX_MEMTYPE_EXTERNAL_FRAME) { for (int i = 0; i < request->NumFrameSuggested; i++) { - hr = videoService->CreateSurface(request->Info.Width, request->Info.Height, 0, format, - D3DPOOL_DEFAULT, m_surfaceUsage, target, (IDirect3DSurface9**)&dxMids[i].first, &dxMids[i].second); + hr = videoService->CreateSurface( + request->Info.Width, request->Info.Height, 0, + format, D3DPOOL_DEFAULT, m_surfaceUsage, target, + (IDirect3DSurface9 **)&dxMids[i].first, + &dxMids[i].second); if (FAILED(hr)) { _dx9_simple_free(response); MSDK_SAFE_FREE(dxMids); @@ -396,23 +397,22 @@ } dxMidPtrs[i] = &dxMids[i]; } - } - else { - safe_array<IDirect3DSurface9*> dxSrf(new IDirect3DSurface9*[request->NumFrameSuggested]); - if (!dxSrf.get()) - { + } else { + safe_array<IDirect3DSurface9 *> dxSrf( + new IDirect3DSurface9 *[request->NumFrameSuggested]); + if (!dxSrf.get()) { MSDK_SAFE_FREE(dxMids); return MFX_ERR_MEMORY_ALLOC; } - hr = videoService->CreateSurface(request->Info.Width, request->Info.Height, request->NumFrameSuggested - 1, format, - D3DPOOL_DEFAULT, m_surfaceUsage, target, dxSrf.get(), NULL); - if (FAILED(hr)) - { + hr = videoService->CreateSurface( + request->Info.Width, request->Info.Height, + request->NumFrameSuggested - 1, format, D3DPOOL_DEFAULT, + m_surfaceUsage, target, dxSrf.get(), NULL); + if (FAILED(hr)) { MSDK_SAFE_FREE(dxMids); return MFX_ERR_MEMORY_ALLOC; } - for (int i = 0; i < request->NumFrameSuggested; i++) { dxMids[i].first = dxSrf.get()[i]; dxMidPtrs[i] = &dxMids[i]; @@ -421,37 +421,39 @@ return MFX_ERR_NONE; } -mfxStatus dx9_simple_alloc(mfxHDL pthis, mfxFrameAllocRequest* request, mfxFrameAllocResponse* response) +mfxStatus dx9_simple_alloc(mfxHDL pthis, mfxFrameAllocRequest *request, + mfxFrameAllocResponse *response) { - mfxStatus sts = MFX_ERR_NONE; - - if (request->Type & MFX_MEMTYPE_SYSTEM_MEMORY) - return MFX_ERR_UNSUPPORTED; - - if (dx9_allocDecodeResponses.find(pthis) != dx9_allocDecodeResponses.end() && - MFX_MEMTYPE_EXTERNAL_FRAME & request->Type && - MFX_MEMTYPE_FROM_DECODE & request->Type) { - // Memory for this request was already allocated during manual allocation stage. Return saved response - // When decode acceleration device (DXVA) is created it requires a list of d3d surfaces to be passed. - // Therefore Media SDK will ask for the surface info/mids again at Init() stage, thus requiring us to return the saved response - // (No such restriction applies to Encode or VPP) - *response = dx9_allocDecodeResponses[pthis]; - dx9_allocDecodeRefCount[pthis]++; - } else { - sts = _dx9_simple_alloc(request, response); - - if (MFX_ERR_NONE == sts) { - if ( MFX_MEMTYPE_EXTERNAL_FRAME & request->Type && - MFX_MEMTYPE_FROM_DECODE & request->Type) { - // Decode alloc response handling - dx9_allocDecodeResponses[pthis] = *response; - dx9_allocDecodeRefCount[pthis]++; - } else { - // Encode and VPP alloc response handling - dx9_allocResponses[response->mids] = pthis; - } - } - } - - return sts; + mfxStatus sts = MFX_ERR_NONE; + + if (request->Type & MFX_MEMTYPE_SYSTEM_MEMORY) + return MFX_ERR_UNSUPPORTED; + + if (dx9_allocDecodeResponses.find(pthis) != + dx9_allocDecodeResponses.end() && + MFX_MEMTYPE_EXTERNAL_FRAME & request->Type && + MFX_MEMTYPE_FROM_DECODE & request->Type) { + // Memory for this request was already allocated during manual allocation stage. Return saved response + // When decode acceleration device (DXVA) is created it requires a list of d3d surfaces to be passed. + // Therefore Media SDK will ask for the surface info/mids again at Init() stage, thus requiring us to return the saved response + // (No such restriction applies to Encode or VPP) + *response = dx9_allocDecodeResponses[pthis]; + dx9_allocDecodeRefCount[pthis]++; + } else { + sts = _dx9_simple_alloc(request, response); + + if (MFX_ERR_NONE == sts) { + if (MFX_MEMTYPE_EXTERNAL_FRAME & request->Type && + MFX_MEMTYPE_FROM_DECODE & request->Type) { + // Decode alloc response handling + dx9_allocDecodeResponses[pthis] = *response; + dx9_allocDecodeRefCount[pthis]++; + } else { + // Encode and VPP alloc response handling + dx9_allocResponses[response->mids] = pthis; + } + } + } + + return sts; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/common_directx9.h -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/common_directx9.h
Changed
@@ -27,44 +27,42 @@ @note Device always set D3DPRESENT_PARAMETERS::Windowed to TRUE. */ - template <class T> - class safe_array - { - public: - safe_array(T *ptr = 0):m_ptr(ptr) - { // construct from object pointer - }; - ~safe_array() - { - reset(0); - } - T* get() - { // return wrapped pointer - return m_ptr; - } - T* release() - { // return wrapped pointer and give up ownership - T* ptr = m_ptr; - m_ptr = 0; - return ptr; - } - void reset(T* ptr) - { // destroy designated object and store new pointer - if (m_ptr) - { - delete[] m_ptr; - } - m_ptr = ptr; - } - protected: - T* m_ptr; // the wrapped object pointer - }; +template<class T> class safe_array { +public: + safe_array(T *ptr = 0) + : m_ptr(ptr){ + // construct from object pointer + }; + ~safe_array() { reset(0); } + T *get() + { // return wrapped pointer + return m_ptr; + } + T *release() + { // return wrapped pointer and give up ownership + T *ptr = m_ptr; + m_ptr = 0; + return ptr; + } + void reset(T *ptr) + { // destroy designated object and store new pointer + if (m_ptr) { + delete[] m_ptr; + } + m_ptr = ptr; + } -mfxStatus dx9_simple_alloc(mfxHDL pthis, mfxFrameAllocRequest* request, mfxFrameAllocResponse* response); -mfxStatus dx9_simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData* ptr); -mfxStatus dx9_simple_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData* ptr); -mfxStatus dx9_simple_gethdl(mfxHDL pthis, mfxMemId mid, mfxHDL* handle); -mfxStatus dx9_simple_free(mfxHDL pthis, mfxFrameAllocResponse* response); +protected: + T *m_ptr; // the wrapped object pointer +}; -mfxStatus DX9_CreateHWDevice(mfxSession session, mfxHDL* deviceHandle, HWND hWnd, bool bCreateSharedHandles); +mfxStatus dx9_simple_alloc(mfxHDL pthis, mfxFrameAllocRequest *request, + mfxFrameAllocResponse *response); +mfxStatus dx9_simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr); +mfxStatus dx9_simple_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr); +mfxStatus dx9_simple_gethdl(mfxHDL pthis, mfxMemId mid, mfxHDL *handle); +mfxStatus dx9_simple_free(mfxHDL pthis, mfxFrameAllocResponse *response); + +mfxStatus DX9_CreateHWDevice(mfxSession session, mfxHDL *deviceHandle, + HWND hWnd, bool bCreateSharedHandles); void DX9_CleanupHWDevice();
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/common_utils.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/common_utils.cpp
Changed
@@ -14,293 +14,296 @@ // Utility functions, not directly tied to Intel Media SDK functionality // - -void PrintErrString(int err,const char* filestr,int line) +void PrintErrString(int err, const char *filestr, int line) { - switch (err) { - case 0: - printf("\n No error.\n"); - break; - case -1: - printf("\n Unknown error: %s %d\n",filestr,line); - break; - case -2: - printf("\n Null pointer. Check filename/path + permissions? %s %d\n",filestr,line); - break; - case -3: - printf("\n Unsupported feature/library load error. %s %d\n",filestr,line); - break; - case -4: - printf("\n Could not allocate memory. %s %d\n",filestr,line); - break; - case -5: - printf("\n Insufficient IO buffers. %s %d\n",filestr,line); - break; - case -6: - printf("\n Invalid handle. %s %d\n",filestr,line); - break; - case -7: - printf("\n Memory lock failure. %s %d\n",filestr,line); - break; - case -8: - printf("\n Function called before initialization. %s %d\n",filestr,line); - break; - case -9: - printf("\n Specified object not found. %s %d\n",filestr,line); - break; - case -10: - printf("\n More input data expected. %s %d\n",filestr,line); - break; - case -11: - printf("\n More output surfaces expected. %s %d\n",filestr,line); - break; - case -12: - printf("\n Operation aborted. %s %d\n",filestr,line); - break; - case -13: - printf("\n HW device lost. %s %d\n",filestr,line); - break; - case -14: - printf("\n Incompatible video parameters. %s %d\n",filestr,line); - break; - case -15: - printf("\n Invalid video parameters. %s %d\n",filestr,line); - break; - case -16: - printf("\n Undefined behavior. %s %d\n",filestr,line); - break; - case -17: - printf("\n Device operation failure. %s %d\n",filestr,line); - break; - case -18: - printf("\n More bitstream data expected. %s %d\n",filestr,line); - break; - case -19: - printf("\n Incompatible audio parameters. %s %d\n",filestr,line); - break; - case -20: - printf("\n Invalid audio parameters. %s %d\n",filestr,line); - break; - default: - printf("\nError code %d,\t%s\t%d\n\n", err, filestr, line); - } + switch (err) { + case 0: + printf("\n No error.\n"); + break; + case -1: + printf("\n Unknown error: %s %d\n", filestr, line); + break; + case -2: + printf("\n Null pointer. Check filename/path + permissions? %s %d\n", + filestr, line); + break; + case -3: + printf("\n Unsupported feature/library load error. %s %d\n", + filestr, line); + break; + case -4: + printf("\n Could not allocate memory. %s %d\n", filestr, line); + break; + case -5: + printf("\n Insufficient IO buffers. %s %d\n", filestr, line); + break; + case -6: + printf("\n Invalid handle. %s %d\n", filestr, line); + break; + case -7: + printf("\n Memory lock failure. %s %d\n", filestr, line); + break; + case -8: + printf("\n Function called before initialization. %s %d\n", + filestr, line); + break; + case -9: + printf("\n Specified object not found. %s %d\n", filestr, line); + break; + case -10: + printf("\n More input data expected. %s %d\n", filestr, line); + break; + case -11: + printf("\n More output surfaces expected. %s %d\n", filestr, + line); + break; + case -12: + printf("\n Operation aborted. %s %d\n", filestr, line); + break; + case -13: + printf("\n HW device lost. %s %d\n", filestr, line); + break; + case -14: + printf("\n Incompatible video parameters. %s %d\n", filestr, + line); + break; + case -15: + printf("\n Invalid video parameters. %s %d\n", filestr, line); + break; + case -16: + printf("\n Undefined behavior. %s %d\n", filestr, line); + break; + case -17: + printf("\n Device operation failure. %s %d\n", filestr, line); + break; + case -18: + printf("\n More bitstream data expected. %s %d\n", filestr, + line); + break; + case -19: + printf("\n Incompatible audio parameters. %s %d\n", filestr, + line); + break; + case -20: + printf("\n Invalid audio parameters. %s %d\n", filestr, line); + break; + default: + printf("\nError code %d,\t%s\t%d\n\n", err, filestr, line); + } } -mfxStatus ReadPlaneData(mfxU16 w, mfxU16 h, mfxU8* buf, mfxU8* ptr, - mfxU16 pitch, mfxU16 offset, FILE* fSource) +mfxStatus ReadPlaneData(mfxU16 w, mfxU16 h, mfxU8 *buf, mfxU8 *ptr, + mfxU16 pitch, mfxU16 offset, FILE *fSource) { - mfxU32 nBytesRead; - for (mfxU16 i = 0; i < h; i++) { - nBytesRead = (mfxU32) fread(buf, 1, w, fSource); - if (w != nBytesRead) - return MFX_ERR_MORE_DATA; - for (mfxU16 j = 0; j < w; j++) - ptr[i * pitch + j * 2 + offset] = buf[j]; - } - return MFX_ERR_NONE; + mfxU32 nBytesRead; + for (mfxU16 i = 0; i < h; i++) { + nBytesRead = (mfxU32)fread(buf, 1, w, fSource); + if (w != nBytesRead) + return MFX_ERR_MORE_DATA; + for (mfxU16 j = 0; j < w; j++) + ptr[i * pitch + j * 2 + offset] = buf[j]; + } + return MFX_ERR_NONE; } -mfxStatus LoadRawFrame(mfxFrameSurface1* pSurface, FILE* fSource) +mfxStatus LoadRawFrame(mfxFrameSurface1 *pSurface, FILE *fSource) { - if (!fSource) { - // Simulate instantaneous access to 1000 "empty" frames. - static int frameCount = 0; - if (1000 == frameCount++) - return MFX_ERR_MORE_DATA; - else - return MFX_ERR_NONE; - } - - mfxStatus sts = MFX_ERR_NONE; - mfxU32 nBytesRead; - mfxU16 w, h, i, pitch; - mfxU8* ptr; - mfxFrameInfo* pInfo = &pSurface->Info; - mfxFrameData* pData = &pSurface->Data; - - if (pInfo->CropH > 0 && pInfo->CropW > 0) { - w = pInfo->CropW; - h = pInfo->CropH; - } else { - w = pInfo->Width; - h = pInfo->Height; - } - - pitch = pData->Pitch; - ptr = pData->Y + pInfo->CropX + pInfo->CropY * pData->Pitch; - - // read luminance plane - for (i = 0; i < h; i++) { - nBytesRead = (mfxU32) fread(ptr + i * pitch, 1, w, fSource); - if (w != nBytesRead) - return MFX_ERR_MORE_DATA; - } - - mfxU8 buf[2048]; // maximum supported chroma width for nv12 - w /= 2; - h /= 2; - ptr = pData->UV + pInfo->CropX + (pInfo->CropY / 2) * pitch; - if (w > 2048) - return MFX_ERR_UNSUPPORTED; - - // load U - sts = ReadPlaneData(w, h, buf, ptr, pitch, 0, fSource); - if (MFX_ERR_NONE != sts) - return sts; - // load V - sts = ReadPlaneData(w, h, buf, ptr, pitch, 1, fSource); - if (MFX_ERR_NONE != sts) - return sts; - - return MFX_ERR_NONE; + if (!fSource) { + // Simulate instantaneous access to 1000 "empty" frames. + static int frameCount = 0; + if (1000 == frameCount++) + return MFX_ERR_MORE_DATA; + else + return MFX_ERR_NONE; + } + + mfxStatus sts = MFX_ERR_NONE; + mfxU32 nBytesRead; + mfxU16 w, h, i, pitch; + mfxU8 *ptr; + mfxFrameInfo *pInfo = &pSurface->Info; + mfxFrameData *pData = &pSurface->Data; + + if (pInfo->CropH > 0 && pInfo->CropW > 0) { + w = pInfo->CropW; + h = pInfo->CropH; + } else { + w = pInfo->Width; + h = pInfo->Height; + } + + pitch = pData->Pitch; + ptr = pData->Y + pInfo->CropX + pInfo->CropY * pData->Pitch; + + // read luminance plane + for (i = 0; i < h; i++) { + nBytesRead = (mfxU32)fread(ptr + i * pitch, 1, w, fSource); + if (w != nBytesRead) + return MFX_ERR_MORE_DATA; + } + + mfxU8 buf[2048]; // maximum supported chroma width for nv12 + w /= 2; + h /= 2; + ptr = pData->UV + pInfo->CropX + (pInfo->CropY / 2) * pitch; + if (w > 2048) + return MFX_ERR_UNSUPPORTED; + + // load U + sts = ReadPlaneData(w, h, buf, ptr, pitch, 0, fSource); + if (MFX_ERR_NONE != sts) + return sts; + // load V + sts = ReadPlaneData(w, h, buf, ptr, pitch, 1, fSource); + if (MFX_ERR_NONE != sts) + return sts; + + return MFX_ERR_NONE; } -mfxStatus LoadRawRGBFrame(mfxFrameSurface1* pSurface, FILE* fSource) +mfxStatus LoadRawRGBFrame(mfxFrameSurface1 *pSurface, FILE *fSource) { - if (!fSource) { - // Simulate instantaneous access to 1000 "empty" frames. - static int frameCount = 0; - if (1000 == frameCount++) - return MFX_ERR_MORE_DATA; - else - return MFX_ERR_NONE; - } - - size_t nBytesRead; - mfxU16 w, h; - mfxFrameInfo* pInfo = &pSurface->Info; - - if (pInfo->CropH > 0 && pInfo->CropW > 0) { - w = pInfo->CropW; - h = pInfo->CropH; - } else { - w = pInfo->Width; - h = pInfo->Height; - } - - for (mfxU16 i = 0; i < h; i++) { - nBytesRead = fread(pSurface->Data.B + i * pSurface->Data.Pitch, - 1, w * 4, fSource); - if ((size_t)(w * 4) != nBytesRead) - return MFX_ERR_MORE_DATA; - } - - return MFX_ERR_NONE; + if (!fSource) { + // Simulate instantaneous access to 1000 "empty" frames. + static int frameCount = 0; + if (1000 == frameCount++) + return MFX_ERR_MORE_DATA; + else + return MFX_ERR_NONE; + } + + size_t nBytesRead; + mfxU16 w, h; + mfxFrameInfo *pInfo = &pSurface->Info; + + if (pInfo->CropH > 0 && pInfo->CropW > 0) { + w = pInfo->CropW; + h = pInfo->CropH; + } else { + w = pInfo->Width; + h = pInfo->Height; + } + + for (mfxU16 i = 0; i < h; i++) { + nBytesRead = fread(pSurface->Data.B + i * pSurface->Data.Pitch, + 1, w * 4, fSource); + if ((size_t)(w * 4) != nBytesRead) + return MFX_ERR_MORE_DATA; + } + + return MFX_ERR_NONE; } -mfxStatus WriteBitStreamFrame(mfxBitstream* pMfxBitstream, FILE* fSink) +mfxStatus WriteBitStreamFrame(mfxBitstream *pMfxBitstream, FILE *fSink) { - mfxU32 nBytesWritten = - (mfxU32) fwrite(pMfxBitstream->Data + pMfxBitstream->DataOffset, 1, - pMfxBitstream->DataLength, fSink); - if (nBytesWritten != pMfxBitstream->DataLength) - return MFX_ERR_UNDEFINED_BEHAVIOR; + mfxU32 nBytesWritten = + (mfxU32)fwrite(pMfxBitstream->Data + pMfxBitstream->DataOffset, + 1, pMfxBitstream->DataLength, fSink); + if (nBytesWritten != pMfxBitstream->DataLength) + return MFX_ERR_UNDEFINED_BEHAVIOR; - pMfxBitstream->DataLength = 0; + pMfxBitstream->DataLength = 0; - return MFX_ERR_NONE; + return MFX_ERR_NONE; } -mfxStatus ReadBitStreamData(mfxBitstream* pBS, FILE* fSource) +mfxStatus ReadBitStreamData(mfxBitstream *pBS, FILE *fSource) { - memmove(pBS->Data, pBS->Data + pBS->DataOffset, pBS->DataLength); - pBS->DataOffset = 0; + memmove(pBS->Data, pBS->Data + pBS->DataOffset, pBS->DataLength); + pBS->DataOffset = 0; - mfxU32 nBytesRead = (mfxU32) fread(pBS->Data + pBS->DataLength, 1, - pBS->MaxLength - pBS->DataLength, - fSource); + mfxU32 nBytesRead = (mfxU32)fread(pBS->Data + pBS->DataLength, 1, + pBS->MaxLength - pBS->DataLength, + fSource); - if (0 == nBytesRead) - return MFX_ERR_MORE_DATA; + if (0 == nBytesRead) + return MFX_ERR_MORE_DATA; - pBS->DataLength += nBytesRead; + pBS->DataLength += nBytesRead; - return MFX_ERR_NONE; + return MFX_ERR_NONE; } -mfxStatus WriteSection(mfxU8* plane, mfxU16 factor, mfxU16 chunksize, - mfxFrameInfo* pInfo, mfxFrameData* pData, mfxU32 i, - mfxU32 j, FILE* fSink) +mfxStatus WriteSection(mfxU8 *plane, mfxU16 factor, mfxU16 chunksize, + mfxFrameInfo *pInfo, mfxFrameData *pData, mfxU32 i, + mfxU32 j, FILE *fSink) { - if (chunksize != - fwrite(plane + - (pInfo->CropY * pData->Pitch / factor + pInfo->CropX) + - i * pData->Pitch + j, 1, chunksize, fSink)) - return MFX_ERR_UNDEFINED_BEHAVIOR; - return MFX_ERR_NONE; + if (chunksize != fwrite(plane + + (pInfo->CropY * pData->Pitch / factor + + pInfo->CropX) + + i * pData->Pitch + j, + 1, chunksize, fSink)) + return MFX_ERR_UNDEFINED_BEHAVIOR; + return MFX_ERR_NONE; } -mfxStatus WriteRawFrame(mfxFrameSurface1* pSurface, FILE* fSink) +mfxStatus WriteRawFrame(mfxFrameSurface1 *pSurface, FILE *fSink) { - mfxFrameInfo* pInfo = &pSurface->Info; - mfxFrameData* pData = &pSurface->Data; - mfxU32 i, j, h, w; - mfxStatus sts = MFX_ERR_NONE; - - for (i = 0; i < pInfo->CropH; i++) - sts = - WriteSection(pData->Y, 1, pInfo->CropW, pInfo, pData, i, 0, - fSink); - - h = pInfo->CropH / 2; - w = pInfo->CropW; - for (i = 0; i < h; i++) - for (j = 0; j < w; j += 2) - sts = - WriteSection(pData->UV, 2, 1, pInfo, pData, i, j, - fSink); - for (i = 0; i < h; i++) - for (j = 1; j < w; j += 2) - sts = - WriteSection(pData->UV, 2, 1, pInfo, pData, i, j, - fSink); - - return sts; + mfxFrameInfo *pInfo = &pSurface->Info; + mfxFrameData *pData = &pSurface->Data; + mfxU32 i, j, h, w; + mfxStatus sts = MFX_ERR_NONE; + + for (i = 0; i < pInfo->CropH; i++) + sts = WriteSection(pData->Y, 1, pInfo->CropW, pInfo, pData, i, + 0, fSink); + + h = pInfo->CropH / 2; + w = pInfo->CropW; + for (i = 0; i < h; i++) + for (j = 0; j < w; j += 2) + sts = WriteSection(pData->UV, 2, 1, pInfo, pData, i, j, + fSink); + for (i = 0; i < h; i++) + for (j = 1; j < w; j += 2) + sts = WriteSection(pData->UV, 2, 1, pInfo, pData, i, j, + fSink); + + return sts; } -int GetFreeTaskIndex(Task* pTaskPool, mfxU16 nPoolSize) +int GetFreeTaskIndex(Task *pTaskPool, mfxU16 nPoolSize) { - if (pTaskPool) - for (int i = 0; i < nPoolSize; i++) - if (!pTaskPool[i].syncp) - return i; - return MFX_ERR_NOT_FOUND; + if (pTaskPool) + for (int i = 0; i < nPoolSize; i++) + if (!pTaskPool[i].syncp) + return i; + return MFX_ERR_NOT_FOUND; } -void ClearYUVSurfaceSysMem(mfxFrameSurface1* pSfc, mfxU16 width, mfxU16 height) +void ClearYUVSurfaceSysMem(mfxFrameSurface1 *pSfc, mfxU16 width, mfxU16 height) { - // In case simulating direct access to frames we initialize the allocated surfaces with default pattern - memset(pSfc->Data.Y, 100, width * height); // Y plane - memset(pSfc->Data.U, 50, (width * height)/2); // UV plane + // In case simulating direct access to frames we initialize the allocated surfaces with default pattern + memset(pSfc->Data.Y, 100, width * height); // Y plane + memset(pSfc->Data.U, 50, (width * height) / 2); // UV plane } - // Get free raw frame surface -int GetFreeSurfaceIndex(mfxFrameSurface1** pSurfacesPool, mfxU16 nPoolSize) +int GetFreeSurfaceIndex(mfxFrameSurface1 **pSurfacesPool, mfxU16 nPoolSize) { - if (pSurfacesPool) - for (mfxU16 i = 0; i < nPoolSize; i++) - if (0 == pSurfacesPool[i]->Data.Locked) - return i; - return MFX_ERR_NOT_FOUND; + if (pSurfacesPool) + for (mfxU16 i = 0; i < nPoolSize; i++) + if (0 == pSurfacesPool[i]->Data.Locked) + return i; + return MFX_ERR_NOT_FOUND; } char mfxFrameTypeString(mfxU16 FrameType) { - mfxU8 FrameTmp = FrameType & 0xF; - char FrameTypeOut; - switch (FrameTmp) { - case MFX_FRAMETYPE_I: - FrameTypeOut = 'I'; - break; - case MFX_FRAMETYPE_P: - FrameTypeOut = 'P'; - break; - case MFX_FRAMETYPE_B: - FrameTypeOut = 'B'; - break; - default: - FrameTypeOut = '*'; - } - return FrameTypeOut; + mfxU8 FrameTmp = FrameType & 0xF; + char FrameTypeOut; + switch (FrameTmp) { + case MFX_FRAMETYPE_I: + FrameTypeOut = 'I'; + break; + case MFX_FRAMETYPE_P: + FrameTypeOut = 'P'; + break; + case MFX_FRAMETYPE_B: + FrameTypeOut = 'B'; + break; + default: + FrameTypeOut = '*'; + } + return FrameTypeOut; }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/common_utils.h -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/common_utils.h
Changed
@@ -28,38 +28,79 @@ // ================================================================= // Helper macro definitions... -#define MSDK_PRINT_RET_MSG(ERR) {PrintErrString(ERR, __FILE__, __LINE__);} -#define MSDK_CHECK_RESULT(P, X, ERR) {if ((X) > (P)) {MSDK_PRINT_RET_MSG(ERR); return ERR;}} -#define MSDK_CHECK_POINTER(P, ERR) {if (!(P)) {MSDK_PRINT_RET_MSG(ERR); return ERR;}} -#define MSDK_CHECK_ERROR(P, X, ERR) {if ((X) == (P)) {MSDK_PRINT_RET_MSG(ERR); return ERR;}} -#define MSDK_IGNORE_MFX_STS(P, X) {if ((X) == (P)) {P = MFX_ERR_NONE;}} -#define MSDK_BREAK_ON_ERROR(P) {if (MFX_ERR_NONE != (P)) break;} -#define MSDK_SAFE_DELETE_ARRAY(P) {if (P) {delete[] P; P = NULL;}} -#define MSDK_ALIGN32(X) (((mfxU32)((X)+31)) & (~ (mfxU32)31)) -#define MSDK_ALIGN16(value) (((value + 15) >> 4) << 4) -#define MSDK_SAFE_RELEASE(X) {if (X) { X->Release(); X = NULL; }} -#define MSDK_MAX(A, B) (((A) > (B)) ? (A) : (B)) +#define MSDK_PRINT_RET_MSG(ERR) \ + { \ + PrintErrString(ERR, __FILE__, __LINE__); \ + } +#define MSDK_CHECK_RESULT(P, X, ERR) \ + { \ + if ((X) > (P)) { \ + MSDK_PRINT_RET_MSG(ERR); \ + return ERR; \ + } \ + } +#define MSDK_CHECK_POINTER(P, ERR) \ + { \ + if (!(P)) { \ + MSDK_PRINT_RET_MSG(ERR); \ + return ERR; \ + } \ + } +#define MSDK_CHECK_ERROR(P, X, ERR) \ + { \ + if ((X) == (P)) { \ + MSDK_PRINT_RET_MSG(ERR); \ + return ERR; \ + } \ + } +#define MSDK_IGNORE_MFX_STS(P, X) \ + { \ + if ((X) == (P)) { \ + P = MFX_ERR_NONE; \ + } \ + } +#define MSDK_BREAK_ON_ERROR(P) \ + { \ + if (MFX_ERR_NONE != (P)) \ + break; \ + } +#define MSDK_SAFE_DELETE_ARRAY(P) \ + { \ + if (P) { \ + delete[] P; \ + P = NULL; \ + } \ + } +#define MSDK_ALIGN32(X) (((mfxU32)((X) + 31)) & (~(mfxU32)31)) +#define MSDK_ALIGN16(value) (((value + 15) >> 4) << 4) +#define MSDK_SAFE_RELEASE(X) \ + { \ + if (X) { \ + X->Release(); \ + X = NULL; \ + } \ + } +#define MSDK_MAX(A, B) (((A) > (B)) ? (A) : (B)) // Usage of the following two macros are only required for certain Windows DirectX11 use cases -#define WILL_READ 0x1000 +#define WILL_READ 0x1000 #define WILL_WRITE 0x2000 // ================================================================= // Intel Media SDK memory allocator entrypoints.... // Implementation of this functions is OS/Memory type specific. -mfxStatus simple_alloc(mfxHDL pthis, mfxFrameAllocRequest* request, mfxFrameAllocResponse* response); -mfxStatus simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData* ptr); -mfxStatus simple_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData* ptr); -mfxStatus simple_gethdl(mfxHDL pthis, mfxMemId mid, mfxHDL* handle); -mfxStatus simple_free(mfxHDL pthis, mfxFrameAllocResponse* response); - - +mfxStatus simple_alloc(mfxHDL pthis, mfxFrameAllocRequest *request, + mfxFrameAllocResponse *response); +mfxStatus simple_lock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr); +mfxStatus simple_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr); +mfxStatus simple_gethdl(mfxHDL pthis, mfxMemId mid, mfxHDL *handle); +mfxStatus simple_free(mfxHDL pthis, mfxFrameAllocResponse *response); // ================================================================= // Utility functions, not directly tied to Media SDK functionality // -void PrintErrString(int err,const char* filestr,int line); +void PrintErrString(int err, const char *filestr, int line); // LoadRawFrame: Reads raw frame from YUV file (YV12) into NV12 surface // - YV12 is a more common format for YUV files than NV12 (therefore the conversion during read and write) @@ -67,35 +108,38 @@ // LoadRawRGBFrame: Reads raw RGB32 frames from file into RGB32 surface // - For the simulation case (fSource = NULL), the surface is filled with default image data -mfxStatus LoadRawFrame(mfxFrameSurface1* pSurface, FILE* fSource); -mfxStatus LoadRawRGBFrame(mfxFrameSurface1* pSurface, FILE* fSource); +mfxStatus LoadRawFrame(mfxFrameSurface1 *pSurface, FILE *fSource); +mfxStatus LoadRawRGBFrame(mfxFrameSurface1 *pSurface, FILE *fSource); // Write raw YUV (NV12) surface to YUV (YV12) file -mfxStatus WriteRawFrame(mfxFrameSurface1* pSurface, FILE* fSink); +mfxStatus WriteRawFrame(mfxFrameSurface1 *pSurface, FILE *fSink); // Write bit stream data for frame to file -mfxStatus WriteBitStreamFrame(mfxBitstream* pMfxBitstream, FILE* fSink); +mfxStatus WriteBitStreamFrame(mfxBitstream *pMfxBitstream, FILE *fSink); // Read bit stream data from file. Stream is read as large chunks (= many frames) -mfxStatus ReadBitStreamData(mfxBitstream* pBS, FILE* fSource); +mfxStatus ReadBitStreamData(mfxBitstream *pBS, FILE *fSource); -void ClearYUVSurfaceSysMem(mfxFrameSurface1* pSfc, mfxU16 width, mfxU16 height); +void ClearYUVSurfaceSysMem(mfxFrameSurface1 *pSfc, mfxU16 width, mfxU16 height); void ClearYUVSurfaceVMem(mfxMemId memId); void ClearRGBSurfaceVMem(mfxMemId memId); // Get free raw frame surface -int GetFreeSurfaceIndex(mfxFrameSurface1** pSurfacesPool, mfxU16 nPoolSize); +int GetFreeSurfaceIndex(mfxFrameSurface1 **pSurfacesPool, mfxU16 nPoolSize); // For use with asynchronous task management typedef struct { - mfxBitstream mfxBS; - mfxSyncPoint syncp; + mfxBitstream mfxBS; + mfxSyncPoint syncp; } Task; // Get free task -int GetFreeTaskIndex(Task* pTaskPool, mfxU16 nPoolSize); +int GetFreeTaskIndex(Task *pTaskPool, mfxU16 nPoolSize); // Initialize Intel Media SDK Session, device/display and memory manager -mfxStatus Initialize(mfxIMPL impl, mfxVersion ver, MFXVideoSession* pSession, mfxFrameAllocator* pmfxAllocator, mfxHDL *deviceHandle = NULL, bool bCreateSharedHandles = false, bool dx9hack = false); +mfxStatus Initialize(mfxIMPL impl, mfxVersion ver, MFXVideoSession *pSession, + mfxFrameAllocator *pmfxAllocator, + mfxHDL *deviceHandle = NULL, + bool bCreateSharedHandles = false, bool dx9hack = false); // Release resources (device/display) void Release(); @@ -103,7 +147,7 @@ // Convert frame type to string char mfxFrameTypeString(mfxU16 FrameType); -void mfxGetTime(mfxTime* timestamp); +void mfxGetTime(mfxTime *timestamp); //void mfxInitTime(); might need this for Windows double TimeDiffMsec(mfxTime tfinish, mfxTime tstart);
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/common_utils_windows.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/common_utils_windows.cpp
Changed
@@ -23,98 +23,109 @@ * Windows implementation of OS-specific utility functions */ -mfxStatus Initialize(mfxIMPL impl, mfxVersion ver, MFXVideoSession* pSession, mfxFrameAllocator* pmfxAllocator, mfxHDL *deviceHandle, bool bCreateSharedHandles, bool dx9hack) +mfxStatus Initialize(mfxIMPL impl, mfxVersion ver, MFXVideoSession *pSession, + mfxFrameAllocator *pmfxAllocator, mfxHDL *deviceHandle, + bool bCreateSharedHandles, bool dx9hack) { - bCreateSharedHandles; // (Hugh) Currently unused - pmfxAllocator; // (Hugh) Currently unused - - mfxStatus sts = MFX_ERR_NONE; - - // If mfxFrameAllocator is provided it means we need to setup DirectX device and memory allocator - if (pmfxAllocator && !dx9hack) { - // Initialize Intel Media SDK Session - sts = pSession->Init(impl, &ver); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - - // Create DirectX device context - if (deviceHandle == NULL || *deviceHandle == NULL) { - sts = CreateHWDevice(*pSession, deviceHandle, NULL, bCreateSharedHandles); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - } - - if (deviceHandle == NULL || *deviceHandle == NULL) return MFX_ERR_DEVICE_FAILED; - - // Provide device manager to Media SDK - sts = pSession->SetHandle(DEVICE_MGR_TYPE, *deviceHandle); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - - pmfxAllocator->pthis = *pSession; // We use Media SDK session ID as the allocation identifier - pmfxAllocator->Alloc = simple_alloc; - pmfxAllocator->Free = simple_free; - pmfxAllocator->Lock = simple_lock; - pmfxAllocator->Unlock = simple_unlock; - pmfxAllocator->GetHDL = simple_gethdl; - - // Since we are using video memory we must provide Media SDK with an external allocator - sts = pSession->SetFrameAllocator(pmfxAllocator); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - - } else if (pmfxAllocator && dx9hack) { - // Initialize Intel Media SDK Session - sts = pSession->Init(impl, &ver); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - - // Create DirectX device context - if (deviceHandle == NULL || *deviceHandle == NULL ) { - sts = DX9_CreateHWDevice(*pSession, deviceHandle, NULL, false); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - } - if (*deviceHandle == NULL) return MFX_ERR_DEVICE_FAILED; - - // Provide device manager to Media SDK - sts = pSession->SetHandle(MFX_HANDLE_D3D9_DEVICE_MANAGER, *deviceHandle); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - - pmfxAllocator->pthis = *pSession; // We use Media SDK session ID as the allocation identifier - pmfxAllocator->Alloc = dx9_simple_alloc; - pmfxAllocator->Free = dx9_simple_free; - pmfxAllocator->Lock = dx9_simple_lock; - pmfxAllocator->Unlock = dx9_simple_unlock; - pmfxAllocator->GetHDL = dx9_simple_gethdl; - - // Since we are using video memory we must provide Media SDK with an external allocator - sts = pSession->SetFrameAllocator(pmfxAllocator); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - - } else { - // Initialize Intel Media SDK Session - sts = pSession->Init(impl, &ver); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - } - return sts; + bCreateSharedHandles; // (Hugh) Currently unused + pmfxAllocator; // (Hugh) Currently unused + + mfxStatus sts = MFX_ERR_NONE; + + // If mfxFrameAllocator is provided it means we need to setup DirectX device and memory allocator + if (pmfxAllocator && !dx9hack) { + // Initialize Intel Media SDK Session + sts = pSession->Init(impl, &ver); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + + // Create DirectX device context + if (deviceHandle == NULL || *deviceHandle == NULL) { + sts = CreateHWDevice(*pSession, deviceHandle, NULL, + bCreateSharedHandles); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + } + + if (deviceHandle == NULL || *deviceHandle == NULL) + return MFX_ERR_DEVICE_FAILED; + + // Provide device manager to Media SDK + sts = pSession->SetHandle(DEVICE_MGR_TYPE, *deviceHandle); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + + pmfxAllocator->pthis = + *pSession; // We use Media SDK session ID as the allocation identifier + pmfxAllocator->Alloc = simple_alloc; + pmfxAllocator->Free = simple_free; + pmfxAllocator->Lock = simple_lock; + pmfxAllocator->Unlock = simple_unlock; + pmfxAllocator->GetHDL = simple_gethdl; + + // Since we are using video memory we must provide Media SDK with an external allocator + sts = pSession->SetFrameAllocator(pmfxAllocator); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + + } else if (pmfxAllocator && dx9hack) { + // Initialize Intel Media SDK Session + sts = pSession->Init(impl, &ver); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + + // Create DirectX device context + if (deviceHandle == NULL || *deviceHandle == NULL) { + sts = DX9_CreateHWDevice(*pSession, deviceHandle, NULL, + false); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + } + if (*deviceHandle == NULL) + return MFX_ERR_DEVICE_FAILED; + + // Provide device manager to Media SDK + sts = pSession->SetHandle(MFX_HANDLE_D3D9_DEVICE_MANAGER, + *deviceHandle); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + + pmfxAllocator->pthis = + *pSession; // We use Media SDK session ID as the allocation identifier + pmfxAllocator->Alloc = dx9_simple_alloc; + pmfxAllocator->Free = dx9_simple_free; + pmfxAllocator->Lock = dx9_simple_lock; + pmfxAllocator->Unlock = dx9_simple_unlock; + pmfxAllocator->GetHDL = dx9_simple_gethdl; + + // Since we are using video memory we must provide Media SDK with an external allocator + sts = pSession->SetFrameAllocator(pmfxAllocator); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + + } else { + // Initialize Intel Media SDK Session + sts = pSession->Init(impl, &ver); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + } + return sts; } void Release() { #if defined(DX9_D3D) || defined(DX11_D3D) - CleanupHWDevice(); - DX9_CleanupHWDevice(); + CleanupHWDevice(); + DX9_CleanupHWDevice(); #endif } -void mfxGetTime(mfxTime* timestamp) +void mfxGetTime(mfxTime *timestamp) { - QueryPerformanceCounter(timestamp); + QueryPerformanceCounter(timestamp); } double TimeDiffMsec(mfxTime tfinish, mfxTime tstart) { - static LARGE_INTEGER tFreq = { 0 }; + static LARGE_INTEGER tFreq = {0}; - if (!tFreq.QuadPart) QueryPerformanceFrequency(&tFreq); + if (!tFreq.QuadPart) + QueryPerformanceFrequency(&tFreq); - double freq = (double)tFreq.QuadPart; - return 1000.0 * ((double)tfinish.QuadPart - (double)tstart.QuadPart) / freq; + double freq = (double)tFreq.QuadPart; + return 1000.0 * ((double)tfinish.QuadPart - (double)tstart.QuadPart) / + freq; } /* (Hugh) Functions currently unused */
View file
obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/data/locale/bg-BG.ini
Added
@@ -0,0 +1,12 @@ +TargetUsage="Целева употреба" +Bitrate="Битрейт" +MaxBitrate="Максимален битрейт" +RateControl="Управление на битрейта" +KeyframeIntervalSec="Интервал на ключови кадри (секунди, 0=автоматично)" +Profile="Профил" +AsyncDepth="Дълбочина на асинхронизирането" +Accuracy="Прецизност" +Convergence="Конвергенция" +ICQQuality="Качество на ICQ" +LookAheadDepth="Дълбочина при гледане напред" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/data/locale/de-DE.ini
Changed
@@ -2,11 +2,11 @@ Bitrate="Bitrate" MaxBitrate="Max. Bitrate" RateControl="Qualitäts Regulierungsmethode" -KeyframeIntervalSec="Keyframeintervall (Sekunden, 0 = auto)" +KeyframeIntervalSec="Keyframeintervall in Sek. (0 = automatisch)" Profile="Profil" AsyncDepth="Async Depth" Accuracy="Genauigkeit" Convergence="Konvergenz" -ICQQuality="ICQ-Qualität" +ICQQuality="ICQ‐Qualität" LookAheadDepth="Lookahead Depth"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/data/locale/fa-IR.ini
Added
@@ -0,0 +1,9 @@ +TargetUsage="هدف استفاده" +Bitrate="نرخ بیت" +MaxBitrate="حداکثر میزان نرخ بیت" +RateControl="کنترل نرخ" +KeyframeIntervalSec="فاصله Keyframe (ثانیه 0 = خودکار)" +Profile="پروفایل" +Convergence="همگرایی" +ICQQuality="کیفیت ICQ" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/data/locale/gl-ES.ini
Changed
@@ -1,2 +1,12 @@ +TargetUsage="Uso de destino" +Bitrate="Taxa de bits" +MaxBitrate="Taxa de bits máxima" +RateControl="Control da taxa" +KeyframeIntervalSec="Intervalo de fotogramas clave (segundos, 0=auto)" Profile="Perfil" +AsyncDepth="Profundidade asíncrona" +Accuracy="Precisión" +Convergence="Converxencia" +ICQQuality="Calidade ICQ" +LookAheadDepth="Profundidade da busca anticipada"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/data/locale/sl-SI.ini
Added
@@ -0,0 +1,12 @@ +TargetUsage="Ciljna uporaba" +Bitrate="Bitna hitrost" +MaxBitrate="Največja bitna hitrost" +RateControl="Nadzor hitrosti" +KeyframeIntervalSec="Razmik med ključnimi sličicami (s, 0=samodejno)" +Profile="Profil" +AsyncDepth="Globina asinhrone obdelave" +Accuracy="Natančnost" +Convergence="Zbliževanje" +ICQQuality="Kakovost ICQ" +LookAheadDepth="Globina predvidevanja" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/device_directx9.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/device_directx9.cpp
Changed
@@ -14,7 +14,7 @@ //prefast signature used in combaseapi.h #ifndef _PREFAST_ - #pragma warning(disable:4068) +#pragma warning(disable : 4068) #endif #include "device_directx9.h" @@ -23,356 +23,343 @@ #include "atlbase.h" // Macros -#define MSDK_ZERO_MEMORY(VAR) {memset(&VAR, 0, sizeof(VAR));} -#define MSDK_MEMCPY_VAR(dstVarName, src, count) memcpy_s(&(dstVarName), sizeof(dstVarName), (src), (count)) +#define MSDK_ZERO_MEMORY(VAR) \ + { \ + memset(&VAR, 0, sizeof(VAR)); \ + } +#define MSDK_MEMCPY_VAR(dstVarName, src, count) \ + memcpy_s(&(dstVarName), sizeof(dstVarName), (src), (count)) CD3D9Device::CD3D9Device() { - m_pD3D9 = NULL; - m_pD3DD9 = NULL; - m_pDeviceManager9 = NULL; - MSDK_ZERO_MEMORY(m_D3DPP); - m_resetToken = 0; - - m_nViews = 0; - m_pS3DControl = NULL; - - MSDK_ZERO_MEMORY(m_backBufferDesc); - m_pDXVAVPS = NULL; - m_pDXVAVP_Left = NULL; - m_pDXVAVP_Right = NULL; - - MSDK_ZERO_MEMORY(m_targetRect); - - MSDK_ZERO_MEMORY(m_VideoDesc); - MSDK_ZERO_MEMORY(m_BltParams); - MSDK_ZERO_MEMORY(m_Sample); - - // Initialize DXVA structures - - DXVA2_AYUVSample16 color = { - 0x8000, // Cr - 0x8000, // Cb - 0x1000, // Y - 0xffff // Alpha - }; - - DXVA2_ExtendedFormat format = { // DestFormat - DXVA2_SampleProgressiveFrame, // SampleFormat - DXVA2_VideoChromaSubsampling_MPEG2, // VideoChromaSubsampling - DXVA_NominalRange_0_255, // NominalRange - DXVA2_VideoTransferMatrix_BT709, // VideoTransferMatrix - DXVA2_VideoLighting_bright, // VideoLighting - DXVA2_VideoPrimaries_BT709, // VideoPrimaries - DXVA2_VideoTransFunc_709 // VideoTransferFunction - }; - - // init m_VideoDesc structure - MSDK_MEMCPY_VAR(m_VideoDesc.SampleFormat, &format, sizeof(DXVA2_ExtendedFormat)); - m_VideoDesc.SampleWidth = 0; - m_VideoDesc.SampleHeight = 0; - m_VideoDesc.InputSampleFreq.Numerator = 60; - m_VideoDesc.InputSampleFreq.Denominator = 1; - m_VideoDesc.OutputFrameFreq.Numerator = 60; - m_VideoDesc.OutputFrameFreq.Denominator = 1; - - // init m_BltParams structure - MSDK_MEMCPY_VAR(m_BltParams.DestFormat, &format, sizeof(DXVA2_ExtendedFormat)); - MSDK_MEMCPY_VAR(m_BltParams.BackgroundColor, &color, sizeof(DXVA2_AYUVSample16)); - - // init m_Sample structure - m_Sample.Start = 0; - m_Sample.End = 1; - m_Sample.SampleFormat = format; - m_Sample.PlanarAlpha.Fraction = 0; - m_Sample.PlanarAlpha.Value = 1; - - m_bIsA2rgb10 = FALSE; + m_pD3D9 = NULL; + m_pD3DD9 = NULL; + m_pDeviceManager9 = NULL; + MSDK_ZERO_MEMORY(m_D3DPP); + m_resetToken = 0; + + m_nViews = 0; + m_pS3DControl = NULL; + + MSDK_ZERO_MEMORY(m_backBufferDesc); + m_pDXVAVPS = NULL; + m_pDXVAVP_Left = NULL; + m_pDXVAVP_Right = NULL; + + MSDK_ZERO_MEMORY(m_targetRect); + + MSDK_ZERO_MEMORY(m_VideoDesc); + MSDK_ZERO_MEMORY(m_BltParams); + MSDK_ZERO_MEMORY(m_Sample); + + // Initialize DXVA structures + + DXVA2_AYUVSample16 color = { + 0x8000, // Cr + 0x8000, // Cb + 0x1000, // Y + 0xffff // Alpha + }; + + DXVA2_ExtendedFormat format = { + // DestFormat + DXVA2_SampleProgressiveFrame, // SampleFormat + DXVA2_VideoChromaSubsampling_MPEG2, // VideoChromaSubsampling + DXVA_NominalRange_0_255, // NominalRange + DXVA2_VideoTransferMatrix_BT709, // VideoTransferMatrix + DXVA2_VideoLighting_bright, // VideoLighting + DXVA2_VideoPrimaries_BT709, // VideoPrimaries + DXVA2_VideoTransFunc_709 // VideoTransferFunction + }; + + // init m_VideoDesc structure + MSDK_MEMCPY_VAR(m_VideoDesc.SampleFormat, &format, + sizeof(DXVA2_ExtendedFormat)); + m_VideoDesc.SampleWidth = 0; + m_VideoDesc.SampleHeight = 0; + m_VideoDesc.InputSampleFreq.Numerator = 60; + m_VideoDesc.InputSampleFreq.Denominator = 1; + m_VideoDesc.OutputFrameFreq.Numerator = 60; + m_VideoDesc.OutputFrameFreq.Denominator = 1; + + // init m_BltParams structure + MSDK_MEMCPY_VAR(m_BltParams.DestFormat, &format, + sizeof(DXVA2_ExtendedFormat)); + MSDK_MEMCPY_VAR(m_BltParams.BackgroundColor, &color, + sizeof(DXVA2_AYUVSample16)); + + // init m_Sample structure + m_Sample.Start = 0; + m_Sample.End = 1; + m_Sample.SampleFormat = format; + m_Sample.PlanarAlpha.Fraction = 0; + m_Sample.PlanarAlpha.Value = 1; + + m_bIsA2rgb10 = FALSE; } bool CD3D9Device::CheckOverlaySupport() { - D3DCAPS9 d3d9caps; - D3DOVERLAYCAPS d3doverlaycaps = {0}; - IDirect3D9ExOverlayExtension *d3d9overlay = NULL; - bool overlaySupported = false; - - memset(&d3d9caps, 0, sizeof(d3d9caps)); - HRESULT hr = m_pD3D9->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3d9caps); - if (FAILED(hr) || !(d3d9caps.Caps & D3DCAPS_OVERLAY)) - { - overlaySupported = false; - } - else - { - hr = m_pD3D9->QueryInterface(IID_PPV_ARGS(&d3d9overlay)); - if (FAILED(hr) || (d3d9overlay == NULL)) - { - overlaySupported = false; - } - else - { - hr = d3d9overlay->CheckDeviceOverlayType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - m_D3DPP.BackBufferWidth, - m_D3DPP.BackBufferHeight, - m_D3DPP.BackBufferFormat, NULL, - D3DDISPLAYROTATION_IDENTITY, &d3doverlaycaps); - MSDK_SAFE_RELEASE(d3d9overlay); - - if (FAILED(hr)) - { - overlaySupported = false; - } - else - { - overlaySupported = true; - } - } - } - - return overlaySupported; + D3DCAPS9 d3d9caps; + D3DOVERLAYCAPS d3doverlaycaps = {0}; + IDirect3D9ExOverlayExtension *d3d9overlay = NULL; + bool overlaySupported = false; + + memset(&d3d9caps, 0, sizeof(d3d9caps)); + HRESULT hr = m_pD3D9->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + &d3d9caps); + if (FAILED(hr) || !(d3d9caps.Caps & D3DCAPS_OVERLAY)) { + overlaySupported = false; + } else { + hr = m_pD3D9->QueryInterface(IID_PPV_ARGS(&d3d9overlay)); + if (FAILED(hr) || (d3d9overlay == NULL)) { + overlaySupported = false; + } else { + hr = d3d9overlay->CheckDeviceOverlayType( + D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + m_D3DPP.BackBufferWidth, + m_D3DPP.BackBufferHeight, + m_D3DPP.BackBufferFormat, NULL, + D3DDISPLAYROTATION_IDENTITY, &d3doverlaycaps); + MSDK_SAFE_RELEASE(d3d9overlay); + + if (FAILED(hr)) { + overlaySupported = false; + } else { + overlaySupported = true; + } + } + } + + return overlaySupported; } -mfxStatus CD3D9Device::FillD3DPP(mfxHDL hWindow, mfxU16 nViews, D3DPRESENT_PARAMETERS &D3DPP) +mfxStatus CD3D9Device::FillD3DPP(mfxHDL hWindow, mfxU16 nViews, + D3DPRESENT_PARAMETERS &D3DPP) { - mfxStatus sts = MFX_ERR_NONE; - - D3DPP.Windowed = true; - D3DPP.hDeviceWindow = (HWND)hWindow; - - D3DPP.Flags = D3DPRESENTFLAG_VIDEO; - D3DPP.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; - D3DPP.PresentationInterval = D3DPRESENT_INTERVAL_ONE; // note that this setting leads to an implicit timeBeginPeriod call - D3DPP.BackBufferCount = 1; - D3DPP.BackBufferFormat = (m_bIsA2rgb10) ? D3DFMT_A2R10G10B10 : D3DFMT_X8R8G8B8; - - if (hWindow) - { - RECT r; - GetClientRect((HWND)hWindow, &r); - int x = GetSystemMetrics(SM_CXSCREEN); - int y = GetSystemMetrics(SM_CYSCREEN); - D3DPP.BackBufferWidth = min(r.right - r.left, x); - D3DPP.BackBufferHeight = min(r.bottom - r.top, y); - } - else - { - D3DPP.BackBufferWidth = GetSystemMetrics(SM_CYSCREEN); - D3DPP.BackBufferHeight = GetSystemMetrics(SM_CYSCREEN); - } - // - // Mark the back buffer lockable if software DXVA2 could be used. - // This is because software DXVA2 device requires a lockable render target - // for the optimal performance. - // - { - D3DPP.Flags |= D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; - } - - bool isOverlaySupported = CheckOverlaySupport(); - if (2 == nViews && !isOverlaySupported) - return MFX_ERR_UNSUPPORTED; - - bool needOverlay = (2 == nViews) ? true : false; - - D3DPP.SwapEffect = needOverlay ? D3DSWAPEFFECT_OVERLAY : D3DSWAPEFFECT_DISCARD; - - return sts; + mfxStatus sts = MFX_ERR_NONE; + + D3DPP.Windowed = true; + D3DPP.hDeviceWindow = (HWND)hWindow; + + D3DPP.Flags = D3DPRESENTFLAG_VIDEO; + D3DPP.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT; + D3DPP.PresentationInterval = + D3DPRESENT_INTERVAL_ONE; // note that this setting leads to an implicit timeBeginPeriod call + D3DPP.BackBufferCount = 1; + D3DPP.BackBufferFormat = (m_bIsA2rgb10) ? D3DFMT_A2R10G10B10 + : D3DFMT_X8R8G8B8; + + if (hWindow) { + RECT r; + GetClientRect((HWND)hWindow, &r); + int x = GetSystemMetrics(SM_CXSCREEN); + int y = GetSystemMetrics(SM_CYSCREEN); + D3DPP.BackBufferWidth = min(r.right - r.left, x); + D3DPP.BackBufferHeight = min(r.bottom - r.top, y); + } else { + D3DPP.BackBufferWidth = GetSystemMetrics(SM_CYSCREEN); + D3DPP.BackBufferHeight = GetSystemMetrics(SM_CYSCREEN); + } + // + // Mark the back buffer lockable if software DXVA2 could be used. + // This is because software DXVA2 device requires a lockable render target + // for the optimal performance. + // + { + D3DPP.Flags |= D3DPRESENTFLAG_LOCKABLE_BACKBUFFER; + } + + bool isOverlaySupported = CheckOverlaySupport(); + if (2 == nViews && !isOverlaySupported) + return MFX_ERR_UNSUPPORTED; + + bool needOverlay = (2 == nViews) ? true : false; + + D3DPP.SwapEffect = needOverlay ? D3DSWAPEFFECT_OVERLAY + : D3DSWAPEFFECT_DISCARD; + + return sts; } -mfxStatus CD3D9Device::Init( - mfxHDL hWindow, - mfxU16 nViews, - mfxU32 nAdapterNum) +mfxStatus CD3D9Device::Init(mfxHDL hWindow, mfxU16 nViews, mfxU32 nAdapterNum) { - mfxStatus sts = MFX_ERR_NONE; - - if (2 < nViews) - return MFX_ERR_UNSUPPORTED; - - m_nViews = nViews; - - HRESULT hr = Direct3DCreate9Ex(D3D_SDK_VERSION, &m_pD3D9); - if (!m_pD3D9 || FAILED(hr)) - return MFX_ERR_DEVICE_FAILED; - - ZeroMemory(&m_D3DPP, sizeof(m_D3DPP)); - sts = FillD3DPP(hWindow, nViews, m_D3DPP); - MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); - - hr = m_pD3D9->CreateDeviceEx( - nAdapterNum, - D3DDEVTYPE_HAL, - (HWND)hWindow, - D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE, - &m_D3DPP, - NULL, - &m_pD3DD9); - if (FAILED(hr)) - return MFX_ERR_NULL_PTR; - - if(hWindow) - { - hr = m_pD3DD9->ResetEx(&m_D3DPP, NULL); - if (FAILED(hr)) - return MFX_ERR_UNDEFINED_BEHAVIOR; - hr = m_pD3DD9->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); - if (FAILED(hr)) - return MFX_ERR_UNDEFINED_BEHAVIOR; - } - UINT resetToken = 0; - - hr = DXVA2CreateDirect3DDeviceManager9(&resetToken, &m_pDeviceManager9); - if (FAILED(hr)) - return MFX_ERR_NULL_PTR; - - hr = m_pDeviceManager9->ResetDevice(m_pD3DD9, resetToken); - if (FAILED(hr)) - return MFX_ERR_UNDEFINED_BEHAVIOR; - - m_resetToken = resetToken; - - return sts; + mfxStatus sts = MFX_ERR_NONE; + + if (2 < nViews) + return MFX_ERR_UNSUPPORTED; + + m_nViews = nViews; + + HRESULT hr = Direct3DCreate9Ex(D3D_SDK_VERSION, &m_pD3D9); + if (!m_pD3D9 || FAILED(hr)) + return MFX_ERR_DEVICE_FAILED; + + ZeroMemory(&m_D3DPP, sizeof(m_D3DPP)); + sts = FillD3DPP(hWindow, nViews, m_D3DPP); + MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts); + + hr = m_pD3D9->CreateDeviceEx(nAdapterNum, D3DDEVTYPE_HAL, (HWND)hWindow, + D3DCREATE_SOFTWARE_VERTEXPROCESSING | + D3DCREATE_MULTITHREADED | + D3DCREATE_FPU_PRESERVE, + &m_D3DPP, NULL, &m_pD3DD9); + if (FAILED(hr)) + return MFX_ERR_NULL_PTR; + + if (hWindow) { + hr = m_pD3DD9->ResetEx(&m_D3DPP, NULL); + if (FAILED(hr)) + return MFX_ERR_UNDEFINED_BEHAVIOR; + hr = m_pD3DD9->Clear(0, NULL, D3DCLEAR_TARGET, + D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); + if (FAILED(hr)) + return MFX_ERR_UNDEFINED_BEHAVIOR; + } + UINT resetToken = 0; + + hr = DXVA2CreateDirect3DDeviceManager9(&resetToken, &m_pDeviceManager9); + if (FAILED(hr)) + return MFX_ERR_NULL_PTR; + + hr = m_pDeviceManager9->ResetDevice(m_pD3DD9, resetToken); + if (FAILED(hr)) + return MFX_ERR_UNDEFINED_BEHAVIOR; + + m_resetToken = resetToken; + + return sts; } mfxStatus CD3D9Device::Reset() { - HRESULT hr = NO_ERROR; - MSDK_CHECK_POINTER(m_pD3DD9, MFX_ERR_NULL_PTR); - - if (m_D3DPP.Windowed) - { - RECT r; - GetClientRect((HWND)m_D3DPP.hDeviceWindow, &r); - int x = GetSystemMetrics(SM_CXSCREEN); - int y = GetSystemMetrics(SM_CYSCREEN); - m_D3DPP.BackBufferWidth = min(r.right - r.left, x); - m_D3DPP.BackBufferHeight = min(r.bottom - r.top, y); - } - else - { - m_D3DPP.BackBufferWidth = GetSystemMetrics(SM_CXSCREEN); - m_D3DPP.BackBufferHeight = GetSystemMetrics(SM_CYSCREEN); - } - - // Reset will change the parameters, so use a copy instead. - D3DPRESENT_PARAMETERS d3dpp = m_D3DPP; - hr = m_pD3DD9->ResetEx(&d3dpp, NULL); - - if (FAILED(hr)) - return MFX_ERR_UNDEFINED_BEHAVIOR; - - hr = m_pDeviceManager9->ResetDevice(m_pD3DD9, m_resetToken); - if (FAILED(hr)) - return MFX_ERR_UNDEFINED_BEHAVIOR; - - return MFX_ERR_NONE; + HRESULT hr = NO_ERROR; + MSDK_CHECK_POINTER(m_pD3DD9, MFX_ERR_NULL_PTR); + + if (m_D3DPP.Windowed) { + RECT r; + GetClientRect((HWND)m_D3DPP.hDeviceWindow, &r); + int x = GetSystemMetrics(SM_CXSCREEN); + int y = GetSystemMetrics(SM_CYSCREEN); + m_D3DPP.BackBufferWidth = min(r.right - r.left, x); + m_D3DPP.BackBufferHeight = min(r.bottom - r.top, y); + } else { + m_D3DPP.BackBufferWidth = GetSystemMetrics(SM_CXSCREEN); + m_D3DPP.BackBufferHeight = GetSystemMetrics(SM_CYSCREEN); + } + + // Reset will change the parameters, so use a copy instead. + D3DPRESENT_PARAMETERS d3dpp = m_D3DPP; + hr = m_pD3DD9->ResetEx(&d3dpp, NULL); + + if (FAILED(hr)) + return MFX_ERR_UNDEFINED_BEHAVIOR; + + hr = m_pDeviceManager9->ResetDevice(m_pD3DD9, m_resetToken); + if (FAILED(hr)) + return MFX_ERR_UNDEFINED_BEHAVIOR; + + return MFX_ERR_NONE; } void CD3D9Device::Close() { - MSDK_SAFE_RELEASE(m_pDXVAVP_Left); - MSDK_SAFE_RELEASE(m_pDXVAVP_Right); - MSDK_SAFE_RELEASE(m_pDXVAVPS); - - MSDK_SAFE_RELEASE(m_pDeviceManager9); - MSDK_SAFE_RELEASE(m_pD3DD9); - MSDK_SAFE_RELEASE(m_pD3D9); - m_pS3DControl = NULL; + MSDK_SAFE_RELEASE(m_pDXVAVP_Left); + MSDK_SAFE_RELEASE(m_pDXVAVP_Right); + MSDK_SAFE_RELEASE(m_pDXVAVPS); + + MSDK_SAFE_RELEASE(m_pDeviceManager9); + MSDK_SAFE_RELEASE(m_pD3DD9); + MSDK_SAFE_RELEASE(m_pD3D9); + m_pS3DControl = NULL; } CD3D9Device::~CD3D9Device() { - Close(); + Close(); } mfxStatus CD3D9Device::GetHandle(mfxHandleType type, mfxHDL *pHdl) { - if (MFX_HANDLE_DIRECT3D_DEVICE_MANAGER9 == type && pHdl != NULL) - { - *pHdl = m_pDeviceManager9; - - return MFX_ERR_NONE; - } - else if (MFX_HANDLE_GFXS3DCONTROL == type && pHdl != NULL) - { - *pHdl = m_pS3DControl; - - return MFX_ERR_NONE; - } - return MFX_ERR_UNSUPPORTED; + if (MFX_HANDLE_DIRECT3D_DEVICE_MANAGER9 == type && pHdl != NULL) { + *pHdl = m_pDeviceManager9; + + return MFX_ERR_NONE; + } else if (MFX_HANDLE_GFXS3DCONTROL == type && pHdl != NULL) { + *pHdl = m_pS3DControl; + + return MFX_ERR_NONE; + } + return MFX_ERR_UNSUPPORTED; } mfxStatus CD3D9Device::SetHandle(mfxHandleType type, mfxHDL hdl) { - if (MFX_HANDLE_GFXS3DCONTROL == type && hdl != NULL) - { - m_pS3DControl = (IGFXS3DControl*)hdl; - return MFX_ERR_NONE; - } - else if (MFX_HANDLE_DEVICEWINDOW == type && hdl != NULL) //for render window handle - { - m_D3DPP.hDeviceWindow = (HWND)hdl; - return MFX_ERR_NONE; - } - return MFX_ERR_UNSUPPORTED; + if (MFX_HANDLE_GFXS3DCONTROL == type && hdl != NULL) { + m_pS3DControl = (IGFXS3DControl *)hdl; + return MFX_ERR_NONE; + } else if (MFX_HANDLE_DEVICEWINDOW == type && + hdl != NULL) //for render window handle + { + m_D3DPP.hDeviceWindow = (HWND)hdl; + return MFX_ERR_NONE; + } + return MFX_ERR_UNSUPPORTED; } -mfxStatus CD3D9Device::RenderFrame(mfxFrameSurface1 * pSurface, mfxFrameAllocator * pmfxAlloc) +mfxStatus CD3D9Device::RenderFrame(mfxFrameSurface1 *pSurface, + mfxFrameAllocator *pmfxAlloc) { - HRESULT hr = S_OK; + HRESULT hr = S_OK; - if (!(1 == m_nViews || (2 == m_nViews && NULL != m_pS3DControl))) - return MFX_ERR_UNDEFINED_BEHAVIOR; + if (!(1 == m_nViews || (2 == m_nViews && NULL != m_pS3DControl))) + return MFX_ERR_UNDEFINED_BEHAVIOR; - MSDK_CHECK_POINTER(pSurface, MFX_ERR_NULL_PTR); - MSDK_CHECK_POINTER(m_pDeviceManager9, MFX_ERR_NOT_INITIALIZED); - MSDK_CHECK_POINTER(pmfxAlloc, MFX_ERR_NULL_PTR); + MSDK_CHECK_POINTER(pSurface, MFX_ERR_NULL_PTR); + MSDK_CHECK_POINTER(m_pDeviceManager9, MFX_ERR_NOT_INITIALIZED); + MSDK_CHECK_POINTER(pmfxAlloc, MFX_ERR_NULL_PTR); - // don't try to render second view if output rect changed since first view - if (2 == m_nViews && (0 != pSurface->Info.FrameId.ViewId)) - return MFX_ERR_NONE; + // don't try to render second view if output rect changed since first view + if (2 == m_nViews && (0 != pSurface->Info.FrameId.ViewId)) + return MFX_ERR_NONE; - hr = m_pD3DD9->TestCooperativeLevel(); + hr = m_pD3DD9->TestCooperativeLevel(); - switch (hr) - { - case D3D_OK : - break; + switch (hr) { + case D3D_OK: + break; - case D3DERR_DEVICELOST : - { - return MFX_ERR_DEVICE_LOST; - } + case D3DERR_DEVICELOST: { + return MFX_ERR_DEVICE_LOST; + } - case D3DERR_DEVICENOTRESET : - { - return MFX_ERR_UNKNOWN; - } + case D3DERR_DEVICENOTRESET: { + return MFX_ERR_UNKNOWN; + } - default : - { - return MFX_ERR_UNKNOWN; - } - } + default: { + return MFX_ERR_UNKNOWN; + } + } - CComPtr<IDirect3DSurface9> pBackBuffer; - hr = m_pD3DD9->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer); + CComPtr<IDirect3DSurface9> pBackBuffer; + hr = m_pD3DD9->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, + &pBackBuffer); - mfxHDLPair* dxMemId = (mfxHDLPair*)pSurface->Data.MemId; + mfxHDLPair *dxMemId = (mfxHDLPair *)pSurface->Data.MemId; - hr = m_pD3DD9->StretchRect((IDirect3DSurface9*)dxMemId->first, NULL, pBackBuffer, NULL, D3DTEXF_LINEAR); - if (FAILED(hr)) - { - return MFX_ERR_UNKNOWN; - } + hr = m_pD3DD9->StretchRect((IDirect3DSurface9 *)dxMemId->first, NULL, + pBackBuffer, NULL, D3DTEXF_LINEAR); + if (FAILED(hr)) { + return MFX_ERR_UNKNOWN; + } - if (SUCCEEDED(hr)&& (1 == m_nViews || pSurface->Info.FrameId.ViewId == 1)) - { - hr = m_pD3DD9->Present(NULL, NULL, NULL, NULL); - } + if (SUCCEEDED(hr) && + (1 == m_nViews || pSurface->Info.FrameId.ViewId == 1)) { + hr = m_pD3DD9->Present(NULL, NULL, NULL, NULL); + } - return SUCCEEDED(hr) ? MFX_ERR_NONE : MFX_ERR_DEVICE_FAILED; + return SUCCEEDED(hr) ? MFX_ERR_NONE : MFX_ERR_DEVICE_FAILED; } /*
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/device_directx9.h -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/device_directx9.h
Changed
@@ -10,7 +10,7 @@ #pragma once -#if defined( _WIN32 ) || defined ( _WIN64 ) +#if defined(_WIN32) || defined(_WIN64) #include "common_utils.h" @@ -25,37 +25,34 @@ class IGFXS3DControl; - /// Base class for hw device -class CHWDevice -{ +class CHWDevice { public: - virtual ~CHWDevice(){} - /** Initializes device for requested processing. + virtual ~CHWDevice() {} + /** Initializes device for requested processing. @param[in] hWindow Window handle to bundle device to. @param[in] nViews Number of views to process. @param[in] nAdapterNum Number of adapter to use */ - virtual mfxStatus Init( - mfxHDL hWindow, - mfxU16 nViews, - mfxU32 nAdapterNum) = 0; - /// Reset device. - virtual mfxStatus Reset() = 0; - /// Get handle can be used for MFX session SetHandle calls - virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *pHdl) = 0; - /** Set handle. + virtual mfxStatus Init(mfxHDL hWindow, mfxU16 nViews, + mfxU32 nAdapterNum) = 0; + /// Reset device. + virtual mfxStatus Reset() = 0; + /// Get handle can be used for MFX session SetHandle calls + virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *pHdl) = 0; + /** Set handle. Particular device implementation may require other objects to operate. */ - virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) = 0; - virtual mfxStatus RenderFrame(mfxFrameSurface1 * pSurface, mfxFrameAllocator * pmfxAlloc) = 0; - virtual void Close() = 0; + virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) = 0; + virtual mfxStatus RenderFrame(mfxFrameSurface1 *pSurface, + mfxFrameAllocator *pmfxAlloc) = 0; + virtual void Close() = 0; }; -enum { - MFX_HANDLE_GFXS3DCONTROL = 0x100, /* A handle to the IGFXS3DControl instance */ - MFX_HANDLE_DEVICEWINDOW = 0x101 /* A handle to the render window */ -}; //mfxHandleType +enum { MFX_HANDLE_GFXS3DCONTROL = + 0x100, /* A handle to the IGFXS3DControl instance */ + MFX_HANDLE_DEVICEWINDOW = 0x101 /* A handle to the render window */ +}; //mfxHandleType /** Direct3D 9 device implementation. @note Can be initialized for only 1 or two 2 views. Handle to @@ -63,56 +60,59 @@ @note Device always set D3DPRESENT_PARAMETERS::Windowed to TRUE. */ -class CD3D9Device : public CHWDevice -{ +class CD3D9Device : public CHWDevice { public: - CD3D9Device(); - virtual ~CD3D9Device(); - - virtual mfxStatus Init( - mfxHDL hWindow, - mfxU16 nViews, - mfxU32 nAdapterNum); - virtual mfxStatus Reset(); - virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *pHdl); - virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl); - virtual mfxStatus RenderFrame(mfxFrameSurface1 * pSurface, mfxFrameAllocator * pmfxAlloc); - virtual void UpdateTitle(double /*fps*/) { } - virtual void Close() ; - void DefineFormat(bool isA2rgb10) { m_bIsA2rgb10 = (isA2rgb10) ? TRUE : FALSE; } + CD3D9Device(); + virtual ~CD3D9Device(); + + virtual mfxStatus Init(mfxHDL hWindow, mfxU16 nViews, + mfxU32 nAdapterNum); + virtual mfxStatus Reset(); + virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *pHdl); + virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl); + virtual mfxStatus RenderFrame(mfxFrameSurface1 *pSurface, + mfxFrameAllocator *pmfxAlloc); + virtual void UpdateTitle(double /*fps*/) {} + virtual void Close(); + void DefineFormat(bool isA2rgb10) + { + m_bIsA2rgb10 = (isA2rgb10) ? TRUE : FALSE; + } + protected: - mfxStatus CreateVideoProcessors(); - bool CheckOverlaySupport(); - virtual mfxStatus FillD3DPP(mfxHDL hWindow, mfxU16 nViews, D3DPRESENT_PARAMETERS &D3DPP); -private: - IDirect3D9Ex* m_pD3D9; - IDirect3DDevice9Ex* m_pD3DD9; - IDirect3DDeviceManager9* m_pDeviceManager9; - D3DPRESENT_PARAMETERS m_D3DPP; - UINT m_resetToken; + mfxStatus CreateVideoProcessors(); + bool CheckOverlaySupport(); + virtual mfxStatus FillD3DPP(mfxHDL hWindow, mfxU16 nViews, + D3DPRESENT_PARAMETERS &D3DPP); - mfxU16 m_nViews; - IGFXS3DControl* m_pS3DControl; +private: + IDirect3D9Ex *m_pD3D9; + IDirect3DDevice9Ex *m_pD3DD9; + IDirect3DDeviceManager9 *m_pDeviceManager9; + D3DPRESENT_PARAMETERS m_D3DPP; + UINT m_resetToken; + mfxU16 m_nViews; + IGFXS3DControl *m_pS3DControl; - D3DSURFACE_DESC m_backBufferDesc; + D3DSURFACE_DESC m_backBufferDesc; - // service required to create video processors - IDirectXVideoProcessorService* m_pDXVAVPS; - //left channel processor - IDirectXVideoProcessor* m_pDXVAVP_Left; - // right channel processor - IDirectXVideoProcessor* m_pDXVAVP_Right; + // service required to create video processors + IDirectXVideoProcessorService *m_pDXVAVPS; + //left channel processor + IDirectXVideoProcessor *m_pDXVAVP_Left; + // right channel processor + IDirectXVideoProcessor *m_pDXVAVP_Right; - // target rectangle - RECT m_targetRect; + // target rectangle + RECT m_targetRect; - // various structures for DXVA2 calls - DXVA2_VideoDesc m_VideoDesc; - DXVA2_VideoProcessBltParams m_BltParams; - DXVA2_VideoSample m_Sample; + // various structures for DXVA2 calls + DXVA2_VideoDesc m_VideoDesc; + DXVA2_VideoProcessBltParams m_BltParams; + DXVA2_VideoSample m_Sample; - BOOL m_bIsA2rgb10; + BOOL m_bIsA2rgb10; }; #endif // #if defined( _WIN32 ) || defined ( _WIN64 ) \ No newline at end of file
View file
obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/libmfx/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/obs-qsv11-plugin-main.c -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/obs-qsv11-plugin-main.c
Changed
@@ -68,7 +68,7 @@ bool obs_module_load(void) { mfxIMPL impl = MFX_IMPL_HARDWARE_ANY | MFX_IMPL_VIA_D3D11; - mfxVersion ver = {{0 , 1}}; + mfxVersion ver = {{0, 1}}; mfxSession session; mfxStatus sts;
View file
obs-studio-23.2.1.tar.xz/plugins/obs-qsv11/obs-qsv11.c -> obs-studio-24.0.0.tar.xz/plugins/obs-qsv11/obs-qsv11.c
Changed
@@ -68,29 +68,29 @@ #include "QSV_Encoder.h" #include <Windows.h> -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[qsv encoder: '%s'] " format, \ - obs_encoder_get_name(obsqsv->encoder), ##__VA_ARGS__) + obs_encoder_get_name(obsqsv->encoder), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) /* ------------------------------------------------------------------------- */ struct obs_qsv { - obs_encoder_t *encoder; + obs_encoder_t *encoder; - qsv_param_t params; - qsv_t *context; + qsv_param_t params; + qsv_t *context; - DARRAY(uint8_t) packet_data; + DARRAY(uint8_t) packet_data; - uint8_t *extra_data; - uint8_t *sei; + uint8_t *extra_data; + uint8_t *sei; - size_t extra_data_size; - size_t sei_size; + size_t extra_data_size; + size_t sei_size; os_performance_token_t *performance_token; }; @@ -98,12 +98,11 @@ /* ------------------------------------------------------------------------- */ static CRITICAL_SECTION g_QsvCs; -static unsigned short g_verMajor; -static unsigned short g_verMinor; -static int64_t g_pts2dtsShift; -static int64_t g_prevDts; -static bool g_bFirst; - +static unsigned short g_verMajor; +static unsigned short g_verMinor; +static int64_t g_pts2dtsShift; +static int64_t g_prevDts; +static bool g_bFirst; static const char *obs_qsv_getname(void *type_data) { @@ -146,7 +145,7 @@ obs_data_set_default_string(settings, "target_usage", "balanced"); obs_data_set_default_int(settings, "bitrate", 2500); obs_data_set_default_int(settings, "max_bitrate", 3000); - obs_data_set_default_string(settings, "profile", "main"); + obs_data_set_default_string(settings, "profile", "high"); obs_data_set_default_int(settings, "async_depth", 4); obs_data_set_default_string(settings, "rate_control", "CBR"); @@ -156,9 +155,11 @@ obs_data_set_default_int(settings, "qpp", 23); obs_data_set_default_int(settings, "qpb", 23); obs_data_set_default_int(settings, "icq_quality", 23); - obs_data_set_default_int(settings, "la_depth", 40); + obs_data_set_default_int(settings, "la_depth", 15); obs_data_set_default_int(settings, "keyint_sec", 3); + obs_data_set_default_int(settings, "bframes", 3); + obs_data_set_default_bool(settings, "mbbrc", true); } static inline void add_strings(obs_property_t *list, const char *const *strings) @@ -169,33 +170,39 @@ } } -#define TEXT_SPEED obs_module_text("TargetUsage") -#define TEXT_TARGET_BITRATE obs_module_text("Bitrate") -#define TEXT_MAX_BITRATE obs_module_text("MaxBitrate") -#define TEXT_PROFILE obs_module_text("Profile") -#define TEXT_ASYNC_DEPTH obs_module_text("AsyncDepth") -#define TEXT_RATE_CONTROL obs_module_text("RateControl") -#define TEXT_ACCURACY obs_module_text("Accuracy") -#define TEXT_CONVERGENCE obs_module_text("Convergence") -#define TEXT_ICQ_QUALITY obs_module_text("ICQQuality") -#define TEXT_LA_DEPTH obs_module_text("LookAheadDepth") -#define TEXT_KEYINT_SEC obs_module_text("KeyframeIntervalSec") - +#define TEXT_SPEED obs_module_text("TargetUsage") +#define TEXT_TARGET_BITRATE obs_module_text("Bitrate") +#define TEXT_MAX_BITRATE obs_module_text("MaxBitrate") +#define TEXT_PROFILE obs_module_text("Profile") +#define TEXT_ASYNC_DEPTH obs_module_text("AsyncDepth") +#define TEXT_RATE_CONTROL obs_module_text("RateControl") +#define TEXT_ACCURACY obs_module_text("Accuracy") +#define TEXT_CONVERGENCE obs_module_text("Convergence") +#define TEXT_ICQ_QUALITY obs_module_text("ICQQuality") +#define TEXT_LA_DEPTH obs_module_text("LookAheadDepth") +#define TEXT_KEYINT_SEC obs_module_text("KeyframeIntervalSec") +#define TEXT_BFRAMES obs_module_text("B Frames") +#define TEXT_MBBRC obs_module_text("Content Adaptive Quantization") + +static inline bool is_skl_or_greater_platform() +{ + enum qsv_cpu_platform plat = qsv_get_cpu_platform(); + return (plat >= QSV_CPU_PLATFORM_SKL); +} static bool rate_control_modified(obs_properties_t *ppts, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { - const char *rate_control = obs_data_get_string(settings, "rate_control"); + const char *rate_control = + obs_data_get_string(settings, "rate_control"); - bool bVisible = - astrcmpi(rate_control, "VCM") == 0 || - astrcmpi(rate_control, "VBR") == 0; + bool bVisible = astrcmpi(rate_control, "VCM") == 0 || + astrcmpi(rate_control, "VBR") == 0; p = obs_properties_get(ppts, "max_bitrate"); obs_property_set_visible(p, bVisible); - bVisible = - astrcmpi(rate_control, "CQP") == 0 || - astrcmpi(rate_control, "LA_ICQ") == 0 || - astrcmpi(rate_control, "ICQ") == 0; + bVisible = astrcmpi(rate_control, "CQP") == 0 || + astrcmpi(rate_control, "LA_ICQ") == 0 || + astrcmpi(rate_control, "ICQ") == 0; p = obs_properties_get(ppts, "bitrate"); obs_property_set_visible(p, !bVisible); @@ -214,20 +221,27 @@ obs_property_set_visible(p, bVisible); bVisible = astrcmpi(rate_control, "ICQ") == 0 || - astrcmpi(rate_control, "LA_ICQ") == 0; + astrcmpi(rate_control, "LA_ICQ") == 0; p = obs_properties_get(ppts, "icq_quality"); obs_property_set_visible(p, bVisible); bVisible = astrcmpi(rate_control, "LA_ICQ") == 0 || - astrcmpi(rate_control, "LA") == 0; + astrcmpi(rate_control, "LA_CBR") == 0 || + astrcmpi(rate_control, "LA_VBR") == 0; p = obs_properties_get(ppts, "la_depth"); obs_property_set_visible(p, bVisible); + bVisible = astrcmpi(rate_control, "CBR") == 0 || + astrcmpi(rate_control, "VBR") == 0 || + astrcmpi(rate_control, "AVBR") == 0; + p = obs_properties_get(ppts, "mbbrc"); + obs_property_set_visible(p, bVisible); + return true; } static inline void add_rate_controls(obs_property_t *list, - const struct qsv_rate_control_info *rc) + const struct qsv_rate_control_info *rc) { enum qsv_cpu_platform plat = qsv_get_cpu_platform(); while (rc->name) { @@ -245,37 +259,46 @@ obs_property_t *list; list = obs_properties_add_list(props, "target_usage", TEXT_SPEED, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); add_strings(list, qsv_usage_names); list = obs_properties_add_list(props, "profile", TEXT_PROFILE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); add_strings(list, qsv_profile_names); obs_properties_add_int(props, "keyint_sec", TEXT_KEYINT_SEC, 1, 20, 1); obs_properties_add_int(props, "async_depth", TEXT_ASYNC_DEPTH, 1, 7, 1); list = obs_properties_add_list(props, "rate_control", TEXT_RATE_CONTROL, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); add_rate_controls(list, qsv_ratecontrols); obs_property_set_modified_callback(list, rate_control_modified); obs_property_t *p; p = obs_properties_add_int(props, "bitrate", TEXT_TARGET_BITRATE, 50, - 10000000, 50); + 10000000, 50); obs_property_int_set_suffix(p, " Kbps"); p = obs_properties_add_int(props, "max_bitrate", TEXT_MAX_BITRATE, 50, - 10000000, 50); + 10000000, 50); obs_property_int_set_suffix(p, " Kbps"); obs_properties_add_int(props, "accuracy", TEXT_ACCURACY, 0, 10000, 1); - obs_properties_add_int(props, "convergence", TEXT_CONVERGENCE, 0, 10, 1); + obs_properties_add_int(props, "convergence", TEXT_CONVERGENCE, 0, 10, + 1); obs_properties_add_int(props, "qpi", "QPI", 1, 51, 1); obs_properties_add_int(props, "qpp", "QPP", 1, 51, 1); obs_properties_add_int(props, "qpb", "QPB", 1, 51, 1); - obs_properties_add_int(props, "icq_quality", TEXT_ICQ_QUALITY, 1, 51, 1); + obs_properties_add_int(props, "icq_quality", TEXT_ICQ_QUALITY, 1, 51, + 1); obs_properties_add_int(props, "la_depth", TEXT_LA_DEPTH, 10, 100, 1); + obs_properties_add_int(props, "bframes", TEXT_BFRAMES, 0, 3, 1); + + if (is_skl_or_greater_platform()) + obs_properties_add_bool(props, "mbbrc", TEXT_MBBRC); return props; } @@ -285,9 +308,11 @@ video_t *video = obs_encoder_video(obsqsv->encoder); const struct video_output_info *voi = video_output_get_info(video); - const char *target_usage = obs_data_get_string(settings, "target_usage"); + const char *target_usage = + obs_data_get_string(settings, "target_usage"); const char *profile = obs_data_get_string(settings, "profile"); - const char *rate_control = obs_data_get_string(settings, "rate_control"); + const char *rate_control = + obs_data_get_string(settings, "rate_control"); int async_depth = (int)obs_data_get_int(settings, "async_depth"); int target_bitrate = (int)obs_data_get_int(settings, "bitrate"); int max_bitrate = (int)obs_data_get_int(settings, "max_bitrate"); @@ -300,11 +325,16 @@ int la_depth = (int)obs_data_get_int(settings, "la_depth"); int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec"); bool cbr_override = obs_data_get_bool(settings, "cbr"); - int bFrames = 7; + int bFrames = (int)obs_data_get_int(settings, "bframes"); + bool mbbrc = obs_data_get_bool(settings, "mbbrc"); if (obs_data_has_user_value(settings, "bf")) bFrames = (int)obs_data_get_int(settings, "bf"); + enum qsv_cpu_platform plat = qsv_get_cpu_platform(); + if (plat == QSV_CPU_PLATFORM_IVB || plat == QSV_CPU_PLATFORM_SNB) + bFrames = 0; + int width = (int)obs_encoder_get_width(obsqsv->encoder); int height = (int)obs_encoder_get_height(obsqsv->encoder); if (astrcmpi(target_usage, "quality") == 0) @@ -346,8 +376,10 @@ obsqsv->params.nRateControl = MFX_RATECONTROL_ICQ; else if (astrcmpi(rate_control, "LA_ICQ") == 0) obsqsv->params.nRateControl = MFX_RATECONTROL_LA_ICQ; - else if (astrcmpi(rate_control, "LA") == 0) + else if (astrcmpi(rate_control, "LA_VBR") == 0) obsqsv->params.nRateControl = MFX_RATECONTROL_LA; + else if (astrcmpi(rate_control, "LA_CBR") == 0) + obsqsv->params.nRateControl = MFX_RATECONTROL_LA_HRD; obsqsv->params.nAsyncDepth = (mfxU16)async_depth; obsqsv->params.nAccuracy = (mfxU16)accuracy; @@ -365,48 +397,45 @@ obsqsv->params.nbFrames = (mfxU16)bFrames; obsqsv->params.nKeyIntSec = (mfxU16)keyint_sec; obsqsv->params.nICQQuality = (mfxU16)icq_quality; + obsqsv->params.bMBBRC = mbbrc; info("settings:\n\trate_control: %s", rate_control); if (obsqsv->params.nRateControl != MFX_RATECONTROL_LA_ICQ && - obsqsv->params.nRateControl != MFX_RATECONTROL_ICQ && + obsqsv->params.nRateControl != MFX_RATECONTROL_ICQ && obsqsv->params.nRateControl != MFX_RATECONTROL_CQP) - blog(LOG_INFO, - "\ttarget_bitrate: %d", - (int)obsqsv->params.nTargetBitRate); + blog(LOG_INFO, "\ttarget_bitrate: %d", + (int)obsqsv->params.nTargetBitRate); if (obsqsv->params.nRateControl == MFX_RATECONTROL_VBR || obsqsv->params.nRateControl == MFX_RATECONTROL_VCM) - blog(LOG_INFO, - "\tmax_bitrate: %d", - (int)obsqsv->params.nMaxBitRate); + blog(LOG_INFO, "\tmax_bitrate: %d", + (int)obsqsv->params.nMaxBitRate); if (obsqsv->params.nRateControl == MFX_RATECONTROL_LA_ICQ || obsqsv->params.nRateControl == MFX_RATECONTROL_ICQ) - blog(LOG_INFO, - "\tICQ Quality: %d", - (int)obsqsv->params.nICQQuality); + blog(LOG_INFO, "\tICQ Quality: %d", + (int)obsqsv->params.nICQQuality); if (obsqsv->params.nRateControl == MFX_RATECONTROL_LA_ICQ || - obsqsv->params.nRateControl == MFX_RATECONTROL_LA) - blog(LOG_INFO, - "\tLookahead Depth:%d", - (int)obsqsv->params.nLADEPTH); + obsqsv->params.nRateControl == MFX_RATECONTROL_LA || + obsqsv->params.nRateControl == MFX_RATECONTROL_LA_HRD) + blog(LOG_INFO, "\tLookahead Depth:%d", + (int)obsqsv->params.nLADEPTH); if (obsqsv->params.nRateControl == MFX_RATECONTROL_CQP) blog(LOG_INFO, - "\tqpi: %d\n" - "\tqpb: %d\n" - "\tqpp: %d", - qpi, qpb, qpp); + "\tqpi: %d\n" + "\tqpb: %d\n" + "\tqpp: %d", + qpi, qpb, qpp); blog(LOG_INFO, - "\tfps_num: %d\n" - "\tfps_den: %d\n" - "\twidth: %d\n" - "\theight: %d", - voi->fps_num, voi->fps_den, - width, height); + "\tfps_num: %d\n" + "\tfps_den: %d\n" + "\twidth: %d\n" + "\theight: %d", + voi->fps_num, voi->fps_den, width, height); info("debug info:"); } @@ -448,7 +477,6 @@ bool success = update_settings(obsqsv, settings); int ret; - if (success) { EnterCriticalSection(&g_QsvCs); @@ -486,9 +514,10 @@ qsv_encoder_version(&g_verMajor, &g_verMinor); - blog(LOG_INFO, "\tmajor: %d\n" - "\tminor: %d", - g_verMajor, g_verMinor); + blog(LOG_INFO, + "\tmajor: %d\n" + "\tminor: %d", + g_verMajor, g_verMinor); // MSDK 1.6 or less doesn't have automatic DTS calculation // including early SandyBridge. @@ -496,17 +525,17 @@ if (g_verMajor == 1 && g_verMinor < 7) { int64_t interval = obsqsv->params.nbFrames + 1; int64_t GopPicSize = (int64_t)(obsqsv->params.nKeyIntSec * - obsqsv->params.nFpsNum / - (float)obsqsv->params.nFpsDen); - g_pts2dtsShift = GopPicSize - (GopPicSize / interval) * - interval; - - blog(LOG_INFO, "\tinterval: %d\n" - "\tGopPictSize: %d\n" - "\tg_pts2dtsShift: %d", - interval, GopPicSize, g_pts2dtsShift); - } - else + obsqsv->params.nFpsNum / + (float)obsqsv->params.nFpsDen); + g_pts2dtsShift = + GopPicSize - (GopPicSize / interval) * interval; + + blog(LOG_INFO, + "\tinterval: %d\n" + "\tGopPictSize: %d\n" + "\tg_pts2dtsShift: %d", + interval, GopPicSize, g_pts2dtsShift); + } else g_pts2dtsShift = -1; if (!obsqsv->context) { @@ -514,8 +543,7 @@ return NULL; } - obsqsv->performance_token = - os_request_high_performance("qsv encoding"); + obsqsv->performance_token = os_request_high_performance("qsv encoding"); g_bFirst = true; @@ -534,7 +562,7 @@ return true; } -static bool obs_qsv_sei(void *data, uint8_t **sei,size_t *size) +static bool obs_qsv_sei(void *data, uint8_t **sei, size_t *size) { struct obs_qsv *obsqsv = data; @@ -556,7 +584,7 @@ } static inline void cap_resolution(obs_encoder_t *encoder, - struct video_scale_info *info) + struct video_scale_info *info) { enum qsv_cpu_platform qsv_platform = qsv_get_cpu_platform(); uint32_t width = obs_encoder_get_width(encoder); @@ -584,15 +612,17 @@ pref_format = obs_encoder_get_preferred_video_format(obsqsv->encoder); if (!valid_format(pref_format)) { - pref_format = valid_format(info->format) ? - info->format : VIDEO_FORMAT_NV12; + pref_format = valid_format(info->format) ? info->format + : VIDEO_FORMAT_NV12; } info->format = pref_format; cap_resolution(obsqsv->encoder, info); } -static void parse_packet(struct obs_qsv *obsqsv, struct encoder_packet *packet, mfxBitstream *pBS, uint32_t fps_num, bool *received_packet) +static void parse_packet(struct obs_qsv *obsqsv, struct encoder_packet *packet, + mfxBitstream *pBS, uint32_t fps_num, + bool *received_packet) { uint8_t *start, *end; int type; @@ -604,41 +634,49 @@ da_resize(obsqsv->packet_data, 0); da_push_back_array(obsqsv->packet_data, &pBS->Data[pBS->DataOffset], - pBS->DataLength); + pBS->DataLength); packet->data = obsqsv->packet_data.array; packet->size = obsqsv->packet_data.num; packet->type = OBS_ENCODER_VIDEO; packet->pts = pBS->TimeStamp * fps_num / 90000; - packet->keyframe = (pBS->FrameType & - (MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF)); + packet->keyframe = (pBS->FrameType & MFX_FRAMETYPE_IDR); + + uint16_t frameType = pBS->FrameType; + uint8_t priority; + + if (frameType & MFX_FRAMETYPE_I) + priority = OBS_NAL_PRIORITY_HIGHEST; + else if ((frameType & MFX_FRAMETYPE_P) || + (frameType & MFX_FRAMETYPE_REF)) + priority = OBS_NAL_PRIORITY_HIGH; + else + priority = 0; + + packet->priority = priority; /* ------------------------------------ */ start = obsqsv->packet_data.array; end = start + obsqsv->packet_data.num; - start = (uint8_t*)obs_avc_find_startcode(start, end); + start = (uint8_t *)obs_avc_find_startcode(start, end); while (true) { - while (start < end && !*(start++)); + while (start < end && !*(start++)) + ; if (start == end) break; type = start[0] & 0x1F; if (type == OBS_NAL_SLICE_IDR || type == OBS_NAL_SLICE) { - uint8_t prev_type = (start[0] >> 5) & 0x3; start[0] &= ~(3 << 5); - - if (pBS->FrameType & MFX_FRAMETYPE_I) - start[0] |= OBS_NAL_PRIORITY_HIGHEST << 5; - else if (pBS->FrameType & MFX_FRAMETYPE_P) - start[0] |= OBS_NAL_PRIORITY_HIGH << 5; - else - start[0] |= prev_type << 5; + start[0] |= + priority + << 5; //0 for non-ref frames and not equal to 0 for ref frames } - start = (uint8_t*)obs_avc_find_startcode(start, end); + start = (uint8_t *)obs_avc_find_startcode(start, end); } /* ------------------------------------ */ @@ -651,8 +689,7 @@ // In case MSDK doesn't support automatic DecodeTimeStamp, do manual // calculation - if (g_pts2dtsShift >= 0) - { + if (g_pts2dtsShift >= 0) { if (g_bFirst) { packet->dts = packet->pts - 3 * obsqsv->params.nFpsDen; } else if (pFrame) { @@ -681,7 +718,7 @@ } static bool obs_qsv_encode(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, bool *received_packet) { struct obs_qsv *obsqsv = data; @@ -690,7 +727,6 @@ EnterCriticalSection(&g_QsvCs); - video_t *video = obs_encoder_video(obsqsv->encoder); const struct video_output_info *voi = video_output_get_info(video); @@ -703,17 +739,13 @@ // FIXME: remove null check from the top of this function // if we actually do expect null frames to complete output. if (frame) - ret = qsv_encoder_encode( - obsqsv->context, - qsvPTS, - frame->data[0], frame->data[1], frame->linesize[0], - frame->linesize[1], - &pBS); + ret = qsv_encoder_encode(obsqsv->context, qsvPTS, + frame->data[0], frame->data[1], + frame->linesize[0], frame->linesize[1], + &pBS); else - ret = qsv_encoder_encode( - obsqsv->context, - qsvPTS, - NULL, NULL, 0, 0, &pBS); + ret = qsv_encoder_encode(obsqsv->context, qsvPTS, NULL, NULL, 0, + 0, &pBS); if (ret < 0) { warn("encode failed"); @@ -741,5 +773,6 @@ .get_defaults = obs_qsv_defaults, .get_extra_data = obs_qsv_extra_data, .get_sei_data = obs_qsv_sei, - .get_video_info = obs_qsv_video_info + .get_video_info = obs_qsv_video_info, + .caps = OBS_ENCODER_CAP_DYN_BITRATE, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-text/data/locale/ar-SA.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-text/data/locale/ar-SA.ini
Changed
@@ -31,4 +31,8 @@ UseCustomExtents.Wrap="التفاف النص" Width="العرض" Height="الارتفاع" +Transform="تحويل النص" +Transform.None="بلا" +Transform.Uppercase="أحرف كبيرة" +Transform.Lowercase="أحرف صغيرة"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-text/data/locale/bg-BG.ini
Added
@@ -0,0 +1,35 @@ +TextGDIPlus="Текст (GDI+)" +Font="Шрифт" +Text="Текст" +ReadFromFile="Четене от файл" +TextFile="Текстов файл (UTF-8)" +Filter.TextFiles="Текстови файлове" +Filter.AllFiles="Всички файлове" +Color="Цвят" +Opacity="Прозиране" +Gradient="Преливка (градиент)" +Gradient.Color="Цвят на преливката" +Gradient.Opacity="Непрозрачност на преливката" +Gradient.Direction="Посока на преливката" +BkColor="Цвят на фона" +BkOpacity="Непрозрачност на фона" +Alignment="Подравняване" +Alignment.Left="Вляво" +Alignment.Center="Центриране" +Alignment.Right="Вдясно" +Vertical="Отвесно" +VerticalAlignment="Вертикално подравняване" +VerticalAlignment.Top="От горе" +VerticalAlignment.Bottom="От долу" +Outline="Контур" +Outline.Size="Големина на контура" +Outline.Color="Цвят на контура" +Outline.Opacity="Прозрачност на контура" +UseCustomExtents.Wrap="Сбиване в опаковката" +Width="Ширина" +Height="Височина" +Transform="Преобразуване на текста" +Transform.None="Няма" +Transform.Uppercase="Главни букви" +Transform.Lowercase="Малки букви" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-text/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-text/data/locale/de-DE.ini
Changed
@@ -2,7 +2,7 @@ Font="Schriftart" Text="Text" ReadFromFile="Aus Datei lesen" -TextFile="Textdatei (UTF-8)" +TextFile="Textdatei (UTF‐8)" Filter.TextFiles="Textdateien" Filter.AllFiles="Alle Dateien" Color="Farbe" @@ -18,13 +18,13 @@ Alignment.Center="Zentriert" Alignment.Right="Rechtsbündig" Vertical="Vertikal" -VerticalAlignment="Vertikal ausrichten" +VerticalAlignment="Vertikale Ausrichtung" VerticalAlignment.Top="Oben" VerticalAlignment.Bottom="Unten" Outline="Kontur" Outline.Size="Konturgröße" Outline.Color="Konturfarbe" -Outline.Opacity="Deckkraft der Kontur" +Outline.Opacity="Konturdeckkraft" ChatlogMode="Chatprotokollmodus" ChatlogMode.Lines="Chatprotokollzeilenlimit" UseCustomExtents="Benutzerdefinierten Textbereich benutzen"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-text/data/locale/gl-ES.ini
Added
@@ -0,0 +1,38 @@ +TextGDIPlus="Texto (GDI+)" +Font="Tipo de letra" +Text="Texto" +ReadFromFile="Ler a partir dun ficheiro" +TextFile="Ficheiro de texto (UTF-8)" +Filter.TextFiles="Ficheiros de texto" +Filter.AllFiles="Todos os ficheiros" +Color="Cor" +Opacity="Opacidade" +Gradient="Degradado" +Gradient.Color="Cor do degradado" +Gradient.Opacity="Opacidade do degradado" +Gradient.Direction="Dirección do degradado" +BkColor="Cor de fondo" +BkOpacity="Opacidade do fondo" +Alignment="Aliñamento" +Alignment.Left="Esquerda" +Alignment.Center="Centro" +Alignment.Right="Dereita" +Vertical="Vertical" +VerticalAlignment="Aliñamento vertical" +VerticalAlignment.Top="Arriba" +VerticalAlignment.Bottom="Abaixo" +Outline="Contorno" +Outline.Size="Tamaño do contorno" +Outline.Color="Cor de contorno" +Outline.Opacity="Opacidade do contorno" +ChatlogMode="Modo de rexistro da conversa" +ChatlogMode.Lines="Límite das liñas de rexistro da conversa" +UseCustomExtents="Usar extensións de texto personalizadas" +UseCustomExtents.Wrap="Axustar" +Width="Largo" +Height="Alto" +Transform="Transformación do texto" +Transform.None="Ningunha" +Transform.Uppercase="Maiúsculas" +Transform.Lowercase="Minúsculas" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-text/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-text/data/locale/ro-RO.ini
Changed
@@ -3,21 +3,21 @@ Text="Text" ReadFromFile="Citește din fișier" TextFile="Fișier text (UTF-8)" -Filter.TextFiles="Fișiere Text" +Filter.TextFiles="Fișiere text" Filter.AllFiles="Toate fișierele" Color="Culoare" Opacity="Opacitate" -BkColor="Culoare Fundal" -BkOpacity="Opacitate Fundal" +BkColor="Culoarea fundalului" +BkOpacity="Opacitatea fundalului" Alignment="Aliniere" Alignment.Left="Stânga" Alignment.Center="Centru" Alignment.Right="Dreapta" Vertical="Vertical" Outline="Contur" -Outline.Size="Dimensiune Contur" -Outline.Color="Culoare Contur" -Outline.Opacity="Opacitate Contur" +Outline.Size="Dimensiunea conturului" +Outline.Color="Culoarea conturului" +Outline.Opacity="Opacitatea conturului" Width="Lățime" Height="Înălțime"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-text/data/locale/sl-SI.ini
Added
@@ -0,0 +1,38 @@ +TextGDIPlus="Besedilo (GDI+)" +Font="Pisava" +Text="Besedilo" +ReadFromFile="Preberi iz datoteke" +TextFile="Besedilna datoteka (UTF-8)" +Filter.TextFiles="Besedilne datoteke" +Filter.AllFiles="Vse datoteke" +Color="Barva" +Opacity="Motnost" +Gradient="Preliv" +Gradient.Color="Barva preliva" +Gradient.Opacity="Motnost preliva" +Gradient.Direction="Smer preliva" +BkColor="Barva ozadja" +BkOpacity="Motnost ozadja" +Alignment="Poravnava" +Alignment.Left="Levo" +Alignment.Center="Sredina" +Alignment.Right="Desno" +Vertical="Navpično" +VerticalAlignment="Navpična poravnava" +VerticalAlignment.Top="Zgoraj" +VerticalAlignment.Bottom="Spodaj" +Outline="Oris" +Outline.Size="Velikost orisa" +Outline.Color="Barva orisa" +Outline.Opacity="Motnost orisa" +ChatlogMode="Način dnevnika klepeta" +ChatlogMode.Lines="Omejitev vrstic dnevnika klepeta" +UseCustomExtents="Uporabi polje besedila po meri" +UseCustomExtents.Wrap="Prelomi" +Width="Širina" +Height="Višina" +Transform="Preoblika besedila" +Transform.None="Brez" +Transform.Uppercase="Velike črke" +Transform.Lowercase="Male črke" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-text/gdiplus/obs-text.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-text/gdiplus/obs-text.cpp
Changed
@@ -12,20 +12,23 @@ using namespace std; using namespace Gdiplus; -#define warning(format, ...) blog(LOG_WARNING, "[%s] " format, \ - obs_source_get_name(source), ##__VA_ARGS__) +#define warning(format, ...) \ + blog(LOG_WARNING, "[%s] " format, obs_source_get_name(source), \ + ##__VA_ARGS__) -#define warn_stat(call) \ - do { \ - if (stat != Ok) \ +#define warn_stat(call) \ + do { \ + if (stat != Ok) \ warning("%s: %s failed (%d)", __FUNCTION__, call, \ - (int)stat); \ + (int)stat); \ } while (false) #ifndef clamp #define clamp(val, min_val, max_val) \ - if (val < min_val) val = min_val; \ - else if (val > max_val) val = max_val; + if (val < min_val) \ + val = min_val; \ + else if (val > max_val) \ + val = max_val; #endif #define MIN_SIZE_CX 2 @@ -37,6 +40,8 @@ /* ------------------------------------------------------------------------- */ +/* clang-format off */ + #define S_FONT "font" #define S_USE_FILE "read_from_file" #define S_FILE "file" @@ -119,6 +124,8 @@ #define T_TRANSFORM_UPPERCASE T_("Transform.Uppercase") #define T_TRANSFORM_LOWERCASE T_("Transform.Lowercase") +/* clang-format on */ + /* ------------------------------------------------------------------------- */ static inline DWORD get_alpha_val(uint32_t opacity) @@ -155,7 +162,8 @@ inline GDIObj &Replace(T obj_) { - if (obj) deleter(obj); + if (obj) + deleter(obj); obj = obj_; return *this; } @@ -163,14 +171,18 @@ public: inline GDIObj() {} inline GDIObj(T obj_) : obj(obj_) {} - inline ~GDIObj() {deleter(obj);} + inline ~GDIObj() { deleter(obj); } - inline T operator=(T obj_) {Replace(obj_); return obj;} + inline T operator=(T obj_) + { + Replace(obj_); + return obj; + } - inline operator T() const {return obj;} + inline operator T() const { return obj; } - inline bool operator==(T obj_) const {return obj == obj_;} - inline bool operator!=(T obj_) const {return obj != obj_;} + inline bool operator==(T obj_) const { return obj == obj_; } + inline bool operator!=(T obj_) const { return obj != obj_; } }; using HDCObj = GDIObj<HDC, HDC, DeleteDC>; @@ -182,13 +194,13 @@ enum class Align { Left, Center, - Right + Right, }; enum class VAlign { Top, Center, - Bottom + Bottom, }; struct TextSource { @@ -246,10 +258,10 @@ /* --------------------------- */ - inline TextSource(obs_source_t *source_, obs_data_t *settings) : - source (source_), - hdc (CreateCompatibleDC(nullptr)), - graphics (hdc) + inline TextSource(obs_source_t *source_, obs_data_t *settings) + : source(source_), + hdc(CreateCompatibleDC(nullptr)), + graphics(hdc) { obs_source_update(source, settings); } @@ -266,13 +278,13 @@ void UpdateFont(); void GetStringFormat(StringFormat &format); void RemoveNewlinePadding(const StringFormat &format, RectF &box); - void CalculateTextSizes(const StringFormat &format, - RectF &bounding_box, SIZE &text_size); - void RenderOutlineText(Graphics &graphics, - const GraphicsPath &path, - const Brush &brush); + void CalculateTextSizes(const StringFormat &format, RectF &bounding_box, + SIZE &text_size); + void RenderOutlineText(Graphics &graphics, const GraphicsPath &path, + const Brush &brush); void RenderText(); void LoadFileText(); + void TransformText(); const char *GetMainString(const char *str); @@ -320,11 +332,11 @@ void TextSource::GetStringFormat(StringFormat &format) { UINT flags = StringFormatFlagsNoFitBlackBox | - StringFormatFlagsMeasureTrailingSpaces; + StringFormatFlagsMeasureTrailingSpaces; if (vertical) flags |= StringFormatFlagsDirectionVertical | - StringFormatFlagsDirectionRightToLeft; + StringFormatFlagsDirectionRightToLeft; format.SetFormatFlags(flags); format.SetTrimming(StringTrimmingWord); @@ -381,11 +393,11 @@ Status stat; stat = graphics.MeasureString(L"W", 2, font.get(), PointF(0.0f, 0.0f), - &format, &before); + &format, &before); warn_stat("MeasureString (without newline)"); stat = graphics.MeasureString(L"W\n", 3, font.get(), PointF(0.0f, 0.0f), - &format, &after); + &format, &after); warn_stat("MeasureString (with newline)"); float offset_cx = after.Width - before.Width; @@ -409,12 +421,12 @@ box.X -= offset_cx; } - box.Width -= offset_cx; + box.Width -= offset_cx; box.Height -= offset_cy; } void TextSource::CalculateTextSizes(const StringFormat &format, - RectF &bounding_box, SIZE &text_size) + RectF &bounding_box, SIZE &text_size) { RectF layout_box; RectF temp_box; @@ -423,26 +435,25 @@ if (!text.empty()) { if (use_extents && wrap) { layout_box.X = layout_box.Y = 0; - layout_box.Width = float(extents_cx); + layout_box.Width = float(extents_cx); layout_box.Height = float(extents_cy); if (use_outline) { - layout_box.Width -= outline_size; + layout_box.Width -= outline_size; layout_box.Height -= outline_size; } stat = graphics.MeasureString(text.c_str(), - (int)text.size() + 1, font.get(), - layout_box, &format, - &bounding_box); + (int)text.size() + 1, + font.get(), layout_box, + &format, &bounding_box); warn_stat("MeasureString (wrapped)"); temp_box = bounding_box; } else { - stat = graphics.MeasureString(text.c_str(), - (int)text.size() + 1, font.get(), - PointF(0.0f, 0.0f), &format, - &bounding_box); + stat = graphics.MeasureString( + text.c_str(), (int)text.size() + 1, font.get(), + PointF(0.0f, 0.0f), &format, &bounding_box); warn_stat("MeasureString (non-wrapped)"); temp_box = bounding_box; @@ -453,7 +464,7 @@ RemoveNewlinePadding(format, bounding_box); if (use_outline) { - bounding_box.Width += outline_size; + bounding_box.Width += outline_size; bounding_box.Height += outline_size; } } @@ -503,13 +514,12 @@ /* the internal text-rendering bounding box for is reset to * its internal value in case the texture gets cut off */ - bounding_box.Width = temp_box.Width; + bounding_box.Width = temp_box.Width; bounding_box.Height = temp_box.Height; } -void TextSource::RenderOutlineText(Graphics &graphics, - const GraphicsPath &path, - const Brush &brush) +void TextSource::RenderOutlineText(Graphics &graphics, const GraphicsPath &path, + const Brush &brush) { DWORD outline_rgba = calc_color(outline_color, outline_opacity); Status stat; @@ -536,15 +546,15 @@ GetStringFormat(format); CalculateTextSizes(format, box, size); - unique_ptr<uint8_t> bits(new uint8_t[size.cx * size.cy * 4]); + unique_ptr<uint8_t[]> bits(new uint8_t[size.cx * size.cy * 4]); Bitmap bitmap(size.cx, size.cy, 4 * size.cx, PixelFormat32bppARGB, - bits.get()); + bits.get()); Graphics graphics_bitmap(&bitmap); LinearGradientBrush brush(RectF(0, 0, (float)size.cx, (float)size.cy), - Color(calc_color(color, opacity)), - Color(calc_color(color2, opacity2)), - gradient_dir, 1); + Color(calc_color(color, opacity)), + Color(calc_color(color2, opacity2)), + gradient_dir, 1); DWORD full_bk_color = bk_color & 0xFFFFFF; if (!text.empty() || use_extents) @@ -575,15 +585,16 @@ font->GetFamily(&family); stat = path.AddString(text.c_str(), (int)text.size(), - &family, font->GetStyle(), - font->GetSize(), box, &format); + &family, font->GetStyle(), + font->GetSize(), box, &format); warn_stat("path.AddString"); RenderOutlineText(graphics_bitmap, path, brush); } else { stat = graphics_bitmap.DrawString(text.c_str(), - (int)text.size(), font.get(), - box, &format, &brush); + (int)text.size(), + font.get(), box, + &format, &brush); warn_stat("graphics_bitmap.DrawString"); } } @@ -593,9 +604,9 @@ if (tex) gs_texture_destroy(tex); - const uint8_t *data = (uint8_t*)bits.get(); + const uint8_t *data = (uint8_t *)bits.get(); tex = gs_texture_create(size.cx, size.cy, GS_BGRA, 1, &data, - GS_DYNAMIC); + GS_DYNAMIC); obs_leave_graphics(); @@ -623,7 +634,7 @@ const char *temp = str + len; - while(temp != str) { + while (temp != str) { temp--; if (temp[0] == '\n' && temp[1] != 0) { @@ -644,55 +655,60 @@ text.push_back('\n'); } -#define obs_data_get_uint32 (uint32_t)obs_data_get_int +void TextSource::TransformText() +{ + if (text_transform == S_TRANSFORM_UPPERCASE) + transform(text.begin(), text.end(), text.begin(), towupper); + else if (text_transform == S_TRANSFORM_LOWERCASE) + transform(text.begin(), text.end(), text.begin(), towlower); +} + +#define obs_data_get_uint32 (uint32_t) obs_data_get_int inline void TextSource::Update(obs_data_t *s) { - const char *new_text = obs_data_get_string(s, S_TEXT); - obs_data_t *font_obj = obs_data_get_obj(s, S_FONT); - const char *align_str = obs_data_get_string(s, S_ALIGN); + const char *new_text = obs_data_get_string(s, S_TEXT); + obs_data_t *font_obj = obs_data_get_obj(s, S_FONT); + const char *align_str = obs_data_get_string(s, S_ALIGN); const char *valign_str = obs_data_get_string(s, S_VALIGN); - uint32_t new_color = obs_data_get_uint32(s, S_COLOR); - uint32_t new_opacity = obs_data_get_uint32(s, S_OPACITY); - bool gradient = obs_data_get_bool(s, S_GRADIENT); - uint32_t new_color2 = obs_data_get_uint32(s, S_GRADIENT_COLOR); - uint32_t new_opacity2 = obs_data_get_uint32(s, S_GRADIENT_OPACITY); - float new_grad_dir = (float)obs_data_get_double(s, S_GRADIENT_DIR); - bool new_vertical = obs_data_get_bool(s, S_VERTICAL); - bool new_outline = obs_data_get_bool(s, S_OUTLINE); - uint32_t new_o_color = obs_data_get_uint32(s, S_OUTLINE_COLOR); + uint32_t new_color = obs_data_get_uint32(s, S_COLOR); + uint32_t new_opacity = obs_data_get_uint32(s, S_OPACITY); + bool gradient = obs_data_get_bool(s, S_GRADIENT); + uint32_t new_color2 = obs_data_get_uint32(s, S_GRADIENT_COLOR); + uint32_t new_opacity2 = obs_data_get_uint32(s, S_GRADIENT_OPACITY); + float new_grad_dir = (float)obs_data_get_double(s, S_GRADIENT_DIR); + bool new_vertical = obs_data_get_bool(s, S_VERTICAL); + bool new_outline = obs_data_get_bool(s, S_OUTLINE); + uint32_t new_o_color = obs_data_get_uint32(s, S_OUTLINE_COLOR); uint32_t new_o_opacity = obs_data_get_uint32(s, S_OUTLINE_OPACITY); - uint32_t new_o_size = obs_data_get_uint32(s, S_OUTLINE_SIZE); - bool new_use_file = obs_data_get_bool(s, S_USE_FILE); - const char *new_file = obs_data_get_string(s, S_FILE); - bool new_chat_mode = obs_data_get_bool(s, S_CHATLOG_MODE); - int new_chat_lines = (int)obs_data_get_int(s, S_CHATLOG_LINES); - bool new_extents = obs_data_get_bool(s, S_EXTENTS); - bool new_extents_wrap = obs_data_get_bool(s, S_EXTENTS_WRAP); - uint32_t n_extents_cx = obs_data_get_uint32(s, S_EXTENTS_CX); - uint32_t n_extents_cy = obs_data_get_uint32(s, S_EXTENTS_CY); + uint32_t new_o_size = obs_data_get_uint32(s, S_OUTLINE_SIZE); + bool new_use_file = obs_data_get_bool(s, S_USE_FILE); + const char *new_file = obs_data_get_string(s, S_FILE); + bool new_chat_mode = obs_data_get_bool(s, S_CHATLOG_MODE); + int new_chat_lines = (int)obs_data_get_int(s, S_CHATLOG_LINES); + bool new_extents = obs_data_get_bool(s, S_EXTENTS); + bool new_extents_wrap = obs_data_get_bool(s, S_EXTENTS_WRAP); + uint32_t n_extents_cx = obs_data_get_uint32(s, S_EXTENTS_CX); + uint32_t n_extents_cy = obs_data_get_uint32(s, S_EXTENTS_CY); int new_text_transform = (int)obs_data_get_int(s, S_TRANSFORM); - const char *font_face = obs_data_get_string(font_obj, "face"); - int font_size = (int)obs_data_get_int(font_obj, "size"); - int64_t font_flags = obs_data_get_int(font_obj, "flags"); - bool new_bold = (font_flags & OBS_FONT_BOLD) != 0; - bool new_italic = (font_flags & OBS_FONT_ITALIC) != 0; - bool new_underline = (font_flags & OBS_FONT_UNDERLINE) != 0; - bool new_strikeout = (font_flags & OBS_FONT_STRIKEOUT) != 0; + const char *font_face = obs_data_get_string(font_obj, "face"); + int font_size = (int)obs_data_get_int(font_obj, "size"); + int64_t font_flags = obs_data_get_int(font_obj, "flags"); + bool new_bold = (font_flags & OBS_FONT_BOLD) != 0; + bool new_italic = (font_flags & OBS_FONT_ITALIC) != 0; + bool new_underline = (font_flags & OBS_FONT_UNDERLINE) != 0; + bool new_strikeout = (font_flags & OBS_FONT_STRIKEOUT) != 0; - uint32_t new_bk_color = obs_data_get_uint32(s, S_BKCOLOR); + uint32_t new_bk_color = obs_data_get_uint32(s, S_BKCOLOR); uint32_t new_bk_opacity = obs_data_get_uint32(s, S_BKOPACITY); /* ----------------------------- */ wstring new_face = to_wide(font_face); - if (new_face != face || - face_size != font_size || - new_bold != bold || - new_italic != italic || - new_underline != underline || + if (new_face != face || face_size != font_size || new_bold != bold || + new_italic != italic || new_underline != underline || new_strikeout != strikeout) { face = new_face; @@ -751,10 +767,7 @@ if (!text.empty()) text.push_back('\n'); } - if(text_transform == S_TRANSFORM_UPPERCASE) - transform(text.begin(), text.end(), text.begin(), towupper); - else if(text_transform == S_TRANSFORM_LOWERCASE) - transform(text.begin(), text.end(), text.begin(), towlower); + TransformText(); use_outline = new_outline; outline_color = new_o_color; @@ -796,6 +809,7 @@ if (update_file) { LoadFileText(); + TransformText(); RenderText(); update_file = false; } @@ -813,12 +827,13 @@ return; gs_effect_t *effect = obs_get_base_effect(OBS_EFFECT_DEFAULT); - gs_technique_t *tech = gs_effect_get_technique(effect, "Draw"); + gs_technique_t *tech = gs_effect_get_technique(effect, "Draw"); gs_technique_begin(tech); gs_technique_begin_pass(tech, 0); - gs_effect_set_texture(gs_effect_get_param_by_name(effect, "image"), tex); + gs_effect_set_texture(gs_effect_get_param_by_name(effect, "image"), + tex); gs_draw_sprite(tex, 0, cx, cy); gs_technique_end_pass(tech); @@ -836,14 +851,14 @@ return "Windows GDI+ text source"; } -#define set_vis(var, val, show) \ - do { \ - p = obs_properties_get(props, val); \ +#define set_vis(var, val, show) \ + do { \ + p = obs_properties_get(props, val); \ obs_property_set_visible(p, var == show); \ } while (false) static bool use_file_changed(obs_properties_t *props, obs_property_t *p, - obs_data_t *s) + obs_data_t *s) { bool use_file = obs_data_get_bool(s, S_USE_FILE); @@ -853,7 +868,7 @@ } static bool outline_changed(obs_properties_t *props, obs_property_t *p, - obs_data_t *s) + obs_data_t *s) { bool outline = obs_data_get_bool(s, S_OUTLINE); @@ -864,7 +879,7 @@ } static bool chatlog_mode_changed(obs_properties_t *props, obs_property_t *p, - obs_data_t *s) + obs_data_t *s) { bool chatlog_mode = obs_data_get_bool(s, S_CHATLOG_MODE); @@ -873,7 +888,7 @@ } static bool gradient_changed(obs_properties_t *props, obs_property_t *p, - obs_data_t *s) + obs_data_t *s) { bool gradient = obs_data_get_bool(s, S_GRADIENT); @@ -884,7 +899,7 @@ } static bool extents_modified(obs_properties_t *props, obs_property_t *p, - obs_data_t *s) + obs_data_t *s) { bool use_extents = obs_data_get_bool(s, S_EXTENTS); @@ -898,7 +913,7 @@ static obs_properties_t *get_properties(void *data) { - TextSource *s = reinterpret_cast<TextSource*>(data); + TextSource *s = reinterpret_cast<TextSource *>(data); string path; obs_properties_t *props = obs_properties_create(); @@ -927,41 +942,48 @@ obs_properties_add_text(props, S_TEXT, T_TEXT, OBS_TEXT_MULTILINE); obs_properties_add_path(props, S_FILE, T_FILE, OBS_PATH_FILE, - filter.c_str(), path.c_str()); + filter.c_str(), path.c_str()); p = obs_properties_add_list(props, S_TRANSFORM, T_TRANSFORM, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_list_add_int(p, T_TRANSFORM_NONE, S_TRANSFORM_NONE); - obs_property_list_add_int(p, T_TRANSFORM_UPPERCASE, S_TRANSFORM_UPPERCASE); - obs_property_list_add_int(p, T_TRANSFORM_LOWERCASE, S_TRANSFORM_LOWERCASE); - + obs_property_list_add_int(p, T_TRANSFORM_UPPERCASE, + S_TRANSFORM_UPPERCASE); + obs_property_list_add_int(p, T_TRANSFORM_LOWERCASE, + S_TRANSFORM_LOWERCASE); obs_properties_add_bool(props, S_VERTICAL, T_VERTICAL); obs_properties_add_color(props, S_COLOR, T_COLOR); - obs_properties_add_int_slider(props, S_OPACITY, T_OPACITY, 0, 100, 1); + p = obs_properties_add_int_slider(props, S_OPACITY, T_OPACITY, 0, 100, + 1); + obs_property_int_set_suffix(p, "%"); p = obs_properties_add_bool(props, S_GRADIENT, T_GRADIENT); obs_property_set_modified_callback(p, gradient_changed); obs_properties_add_color(props, S_GRADIENT_COLOR, T_GRADIENT_COLOR); - obs_properties_add_int_slider(props, S_GRADIENT_OPACITY, - T_GRADIENT_OPACITY, 0, 100, 1); - obs_properties_add_float_slider(props, S_GRADIENT_DIR, - T_GRADIENT_DIR, 0, 360, 0.1); + p = obs_properties_add_int_slider(props, S_GRADIENT_OPACITY, + T_GRADIENT_OPACITY, 0, 100, 1); + obs_property_int_set_suffix(p, "%"); + obs_properties_add_float_slider(props, S_GRADIENT_DIR, T_GRADIENT_DIR, + 0, 360, 0.1); obs_properties_add_color(props, S_BKCOLOR, T_BKCOLOR); - obs_properties_add_int_slider(props, S_BKOPACITY, T_BKOPACITY, - 0, 100, 1); + p = obs_properties_add_int_slider(props, S_BKOPACITY, T_BKOPACITY, 0, + 100, 1); + obs_property_int_set_suffix(p, "%"); p = obs_properties_add_list(props, S_ALIGN, T_ALIGN, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); - obs_property_list_add_string(p, T_ALIGN_LEFT, S_ALIGN_LEFT); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); + obs_property_list_add_string(p, T_ALIGN_LEFT, S_ALIGN_LEFT); obs_property_list_add_string(p, T_ALIGN_CENTER, S_ALIGN_CENTER); - obs_property_list_add_string(p, T_ALIGN_RIGHT, S_ALIGN_RIGHT); + obs_property_list_add_string(p, T_ALIGN_RIGHT, S_ALIGN_RIGHT); p = obs_properties_add_list(props, S_VALIGN, T_VALIGN, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); - obs_property_list_add_string(p, T_VALIGN_TOP, S_VALIGN_TOP); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); + obs_property_list_add_string(p, T_VALIGN_TOP, S_VALIGN_TOP); obs_property_list_add_string(p, T_VALIGN_CENTER, S_VALIGN_CENTER); obs_property_list_add_string(p, T_VALIGN_BOTTOM, S_VALIGN_BOTTOM); @@ -970,14 +992,15 @@ obs_properties_add_int(props, S_OUTLINE_SIZE, T_OUTLINE_SIZE, 1, 20, 1); obs_properties_add_color(props, S_OUTLINE_COLOR, T_OUTLINE_COLOR); - obs_properties_add_int_slider(props, S_OUTLINE_OPACITY, - T_OUTLINE_OPACITY, 0, 100, 1); + p = obs_properties_add_int_slider(props, S_OUTLINE_OPACITY, + T_OUTLINE_OPACITY, 0, 100, 1); + obs_property_int_set_suffix(p, "%"); p = obs_properties_add_bool(props, S_CHATLOG_MODE, T_CHATLOG_MODE); obs_property_set_modified_callback(p, chatlog_mode_changed); - obs_properties_add_int(props, S_CHATLOG_LINES, T_CHATLOG_LINES, - 1, 1000, 1); + obs_properties_add_int(props, S_CHATLOG_LINES, T_CHATLOG_LINES, 1, 1000, + 1); p = obs_properties_add_bool(props, S_EXTENTS, T_EXTENTS); obs_property_set_modified_callback(p, extents_modified); @@ -997,28 +1020,20 @@ si.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW; si.get_properties = get_properties; - si.get_name = [] (void*) - { - return obs_module_text("TextGDIPlus"); + si.get_name = [](void *) { return obs_module_text("TextGDIPlus"); }; + si.create = [](obs_data_t *settings, obs_source_t *source) { + return (void *)new TextSource(source, settings); }; - si.create = [] (obs_data_t *settings, obs_source_t *source) - { - return (void*)new TextSource(source, settings); - }; - si.destroy = [] (void *data) - { - delete reinterpret_cast<TextSource*>(data); + si.destroy = [](void *data) { + delete reinterpret_cast<TextSource *>(data); }; - si.get_width = [] (void *data) - { - return reinterpret_cast<TextSource*>(data)->cx; + si.get_width = [](void *data) { + return reinterpret_cast<TextSource *>(data)->cx; }; - si.get_height = [] (void *data) - { - return reinterpret_cast<TextSource*>(data)->cy; + si.get_height = [](void *data) { + return reinterpret_cast<TextSource *>(data)->cy; }; - si.get_defaults = [] (obs_data_t *settings) - { + si.get_defaults = [](obs_data_t *settings) { obs_data_t *font_obj = obs_data_create(); obs_data_set_default_string(font_obj, "face", "Arial"); obs_data_set_default_int(font_obj, "size", 36); @@ -1040,21 +1055,19 @@ obs_data_set_default_bool(settings, S_EXTENTS_WRAP, true); obs_data_set_default_int(settings, S_EXTENTS_CX, 100); obs_data_set_default_int(settings, S_EXTENTS_CY, 100); - obs_data_set_default_int(settings, S_TRANSFORM, S_TRANSFORM_NONE); + obs_data_set_default_int(settings, S_TRANSFORM, + S_TRANSFORM_NONE); obs_data_release(font_obj); }; - si.update = [] (void *data, obs_data_t *settings) - { - reinterpret_cast<TextSource*>(data)->Update(settings); + si.update = [](void *data, obs_data_t *settings) { + reinterpret_cast<TextSource *>(data)->Update(settings); }; - si.video_tick = [] (void *data, float seconds) - { - reinterpret_cast<TextSource*>(data)->Tick(seconds); + si.video_tick = [](void *data, float seconds) { + reinterpret_cast<TextSource *>(data)->Tick(seconds); }; - si.video_render = [] (void *data, gs_effect_t*) - { - reinterpret_cast<TextSource*>(data)->Render(); + si.video_render = [](void *data, gs_effect_t *) { + reinterpret_cast<TextSource *>(data)->Render(); }; obs_register_source(&si);
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/ca-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/ca-ES.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Lliscament" Color="Color" VideoFile="Arxiu de vídeo" -TransitionPoint="Punt de la transició (mil·lisegons)" +TransitionPoint="Punt de transició" TransitionPointFrame="Punt de transició (fotograma)" TransitionPointType="Tipus de punt de transició" TransitionPointTypeFrame="Fotograma" @@ -20,7 +20,7 @@ AudioFadeStyle="Estil de fos d'àudio" AudioFadeStyle.FadeOutFadeIn="Es descolora al punt de transició i després s'esvaeix" AudioFadeStyle.CrossFade="Transició" -SwitchPoint="Punt de Color màxim (percentatge)" +SwitchPoint="Punt de color àlgid" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Imatge" LumaWipe.Invert="Invertir"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/cs-CZ.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/cs-CZ.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Vtáhnout" Color="Barva" VideoFile="Video soubor" -TransitionPoint="Bod přechodu (ms)" +TransitionPoint="Bod přechodu" TransitionPointFrame="Bod přechodu (snímky)" TransitionPointType="Typ bodu přechodu" TransitionPointTypeFrame="Snímek" @@ -20,7 +20,7 @@ AudioFadeStyle="Styl přechodů" AudioFadeStyle.FadeOutFadeIn="Zeslabovat do bodu přechodu, poté zesilovat" AudioFadeStyle.CrossFade="Prolínání" -SwitchPoint="Špičkový bod barvy (%)" +SwitchPoint="Špičkový bod barev" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Obrázek" LumaWipe.Invert="Invert"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/da-DK.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/da-DK.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Stryg ind" Color="Farve" VideoFile="Videofil" -TransitionPoint="Overgangspunkt (millisek.)" +TransitionPoint="Overgangspunkt" TransitionPointFrame="Overgangspunkt (billede)" TransitionPointType="Overgangspunkttype" TransitionPointTypeFrame="Billede" @@ -20,7 +20,7 @@ AudioFadeStyle="Lydudtoningsstil" AudioFadeStyle.FadeOutFadeIn="Udtone til overgangspunkt, dernæst indtone" AudioFadeStyle.CrossFade="Krydstoning (crossfade)" -SwitchPoint="Farvespidspunkt (procent)" +SwitchPoint="Spidsudslagsfarve" LumaWipeTransition="Luma-overgang" LumaWipe.Image="Billede" LumaWipe.Invert="Invertér"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/de-DE.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Swipe In" Color="Farbe" VideoFile="Videodatei" -TransitionPoint="Übergangspunkt (Millisekunden)" +TransitionPoint="Übergangspunkt" TransitionPointFrame="Übergangspunkt (Frame)" TransitionPointType="Übergangspunkttyp" TransitionPointTypeFrame="Frame" @@ -20,7 +20,7 @@ AudioFadeStyle="Audioüberblendstil" AudioFadeStyle.FadeOutFadeIn="Zu Übergangspunkt ausblenden und dann einblenden" AudioFadeStyle.CrossFade="Überblendung" -SwitchPoint="Spitzenfarbpunkt (in Prozent)" +SwitchPoint="Farbhöhepunkt" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Bild" LumaWipe.Invert="Umkehren" @@ -47,8 +47,8 @@ LumaWipe.Type.LinearTopLeft="Linear oben links" LumaWipe.Type.LinearTopRight="Linear oben rechts" LumaWipe.Type.LinearVertical="Linear vertikal" -LumaWipe.Type.ParallelZigzagHorizontal="Parallel Zick-Zack horizontal" -LumaWipe.Type.ParallelZigzagVertical="Parallel Zick-Zack vertikal" +LumaWipe.Type.ParallelZigzagHorizontal="Parallel Zick‐Zack horizontal" +LumaWipe.Type.ParallelZigzagVertical="Parallel Zick‐Zack vertikal" LumaWipe.Type.Sinus9="Sinus 9" LumaWipe.Type.Spiral="Spirale" LumaWipe.Type.Square="Quadrat"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/el-GR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/el-GR.ini
Changed
@@ -12,7 +12,6 @@ SwipeIn="Σύρετε προς τα επάνω" Color="Χρώμα" VideoFile="Αρχείο Βίντεο" -TransitionPoint="Ταχύτητα μετάβασης (χιλιοστά δευτερολέπτου)" TransitionPointFrame="Σημείο μετάβασης (πλαίσιο)" TransitionPointType="Τύπος σημείου μετάβασης" TransitionPointTypeFrame="Καρέ" @@ -20,7 +19,6 @@ AudioFadeStyle="Στυλ ήχου Fade" AudioFadeStyle.FadeOutFadeIn="Fade out στο σημείο μετάβασης στη συνέχεια, fade in" AudioFadeStyle.CrossFade="Σταδιακή Εξασθένιση" -SwitchPoint="Peak Χρώμα Σημείου (ποσοστό)" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Εικόνα" LumaWipe.Invert="Αντιστροφή"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/en-US.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/en-US.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Swipe In" Color="Color" VideoFile="Video File" -TransitionPoint="Transition Point (milliseconds)" +TransitionPoint="Transition Point" TransitionPointFrame="Transition Point (frame)" TransitionPointType="Transition Point Type" TransitionPointTypeFrame="Frame" @@ -20,7 +20,7 @@ AudioFadeStyle="Audio Fade Style" AudioFadeStyle.FadeOutFadeIn="Fade out to transition point then fade in" AudioFadeStyle.CrossFade="Crossfade" -SwitchPoint="Peak Color Point (percentage)" +SwitchPoint="Peak Color Point" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Image" LumaWipe.Invert="Invert"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/es-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/es-ES.ini
Changed
@@ -1,7 +1,7 @@ FadeTransition="Desvanecimiento" CutTransition="Corte" SwipeTransition="Deslizar" -SlideTransition="Deslizar" +SlideTransition="Diapositiva" StingerTransition="Stinger" FadeToColorTransition="Desvanecer a Color" Direction="Dirección" @@ -9,10 +9,10 @@ Direction.Right="Derecha" Direction.Up="Arriba" Direction.Down="Abajo" -SwipeIn="Deslizamiento" +SwipeIn="Deslizar hacia adentro" Color="Color" VideoFile="Archivo de vídeo" -TransitionPoint="Punto de transición (milisegundos)" +TransitionPoint="Punto de transición" TransitionPointFrame="Punto de transición (fotograma)" TransitionPointType="Tipo de punto de transición" TransitionPointTypeFrame="Fotograma" @@ -20,7 +20,7 @@ AudioFadeStyle="Estilo de fundido de audio" AudioFadeStyle.FadeOutFadeIn="Se descolora al punto de transición y luego se desvanece" AudioFadeStyle.CrossFade="Transición suave" -SwitchPoint="Punto de Color máximo (porcentaje)" +SwitchPoint="Pico de color" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Imagen" LumaWipe.Invert="Invertir"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/eu-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/eu-ES.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Korritu bertan" Color="Kolorea" VideoFile="Bideo-fitxategia" -TransitionPoint="Trantsizio-puntua (milisegundo)" +TransitionPoint="Trantsizio-puntua" TransitionPointFrame="Trantsizio-puntua (fotograma)" TransitionPointType="Trantsizio-puntu mota" TransitionPointTypeFrame="Fotograma" @@ -20,7 +20,7 @@ AudioFadeStyle="Audio desagertze estiloa" AudioFadeStyle.FadeOutFadeIn="Desagertu trantsizio puntura eta orduan agertu" AudioFadeStyle.CrossFade="Kateatua" -SwitchPoint="Kolorearen gailur puntua (ehunekoa)" +SwitchPoint="Gailurraren kolorezko puntua" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Irudia" LumaWipe.Invert="Irauli"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/fi-FI.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/fi-FI.ini
Changed
@@ -12,7 +12,6 @@ SwipeIn="Pyyhkäise yli" Color="Väri" VideoFile="Videotiedosto" -TransitionPoint="Siirtymäkohta (millisekuntia)" TransitionPointFrame="Siirtymäpisteen tyyppi (frame)" TransitionPointType="Siirtymäpisteen tyyppi" TransitionPointTypeFrame="Kehys" @@ -20,7 +19,6 @@ AudioFadeStyle="Äänen häivytyksen tyyli" AudioFadeStyle.FadeOutFadeIn="Häivytä ulos siirtymäpisteeseen asti ja sitten häivytä sisään" AudioFadeStyle.CrossFade="Ristiinhäivytys" -SwitchPoint="Korkein väripiste (prosentti)" LumaWipeTransition="Luma-pyyhkäisy" LumaWipe.Image="Kuva" LumaWipe.Invert="Käänteinen"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/fil-PH.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/fil-PH.ini
Changed
@@ -12,7 +12,6 @@ SwipeIn="Mag-swipe In" Color="Kulay" VideoFile="Bidyo File" -TransitionPoint="Paglipat ng tuldok (milsegundo)" TransitionPointFrame="Paglipat ng Punto (preym)" TransitionPointType="Paglipat ng Uri ng Punto" TransitionPointTypeFrame="Preym" @@ -20,7 +19,6 @@ AudioFadeStyle="Lumabo ang Estilo ng Awdiyo" AudioFadeStyle.FadeOutFadeIn="Lumalabo sa paglipat ng punto pagkatapos maglabo" AudioFadeStyle.CrossFade="Kruspeyd" -SwitchPoint="Tugatok ng Kulay ng Punto (porsyento)" LumaWipeTransition="Pamunas na Luma" LumaWipe.Image="Larawan" LumaWipe.Invert="Baliktarin"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/fr-FR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/fr-FR.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Recouvrement" Color="Couleur" VideoFile="Fichier vidéo" -TransitionPoint="Point de transition (millisecondes)" +TransitionPoint="Point de transition" TransitionPointFrame="Point de transition (image)" TransitionPointType="Type de transition" TransitionPointTypeFrame="Image" @@ -20,7 +20,7 @@ AudioFadeStyle="Style de fondu audio" AudioFadeStyle.FadeOutFadeIn="Fondu en fermeture jusqu'au point de transition puis fondu en ouverture" AudioFadeStyle.CrossFade="Fondu enchaîné" -SwitchPoint="Point de couleur maximal (pourcentage)" +SwitchPoint="Point de transition par couleur crête" LumaWipeTransition="Balayage Luma" LumaWipe.Image="Image" LumaWipe.Invert="Inverser"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/gl-ES.ini
Changed
@@ -1,8 +1,66 @@ +FadeTransition="Esvaecer" CutTransition="Cortar" +SwipeTransition="Esvarar" +SlideTransition="Diapositiva" +StingerTransition="Púa" +FadeToColorTransition="Esvaecer a cor" Direction="Dirección" Direction.Left="Esquerda" Direction.Right="Dereita" Direction.Up="Arriba" Direction.Down="Abaixo" +SwipeIn="Esvarar cara dentro" Color="Cor" +VideoFile="Ficheiro de vídeo" +TransitionPoint="Punto de transición" +TransitionPointFrame="Punto de transición (fotograma)" +TransitionPointType="Tipo de punto de transición" +TransitionPointTypeFrame="Fotograma" +TransitionPointTypeTime="Tempo (milisegundos)" +AudioFadeStyle="Estilo de esvaecemento do son" +AudioFadeStyle.FadeOutFadeIn="Esvaece ao punto de transición e desaparece" +AudioFadeStyle.CrossFade="Transición cruzada" +SwitchPoint="Punto de pico de cor" +LumaWipeTransition="Escaneado luma" +LumaWipe.Image="Imaxe" +LumaWipe.Invert="Inverter" +LumaWipe.Softness="Suavizado" +LumaWipe.Type.BarndoorBottomLeft="Porta esvaradía inferior á esquerda" +LumaWipe.Type.BarndoorHorizontal="Porta esvaradía horizontal" +LumaWipe.Type.BarndoorTopLeft="Porta esvaradía superior á esquerda" +LumaWipe.Type.BarndoorVertical="Porta esvaradía vertical" +LumaWipe.Type.BlindsHorizontal="Persiana horizontal" +LumaWipe.Type.BoxBottomLeft="Caixa inferior á esquerda" +LumaWipe.Type.BoxBottomRight="Caixa inferior á dereita" +LumaWipe.Type.BoxTopLeft="Caixa superior á dereita" +LumaWipe.Type.BoxTopRight="Caixa superior á dereita" +LumaWipe.Type.Burst="Refacho" +LumaWipe.Type.CheckerboardSmall="Pequeno taboleiro de xadrez" +LumaWipe.Type.Circles="Círculos" +LumaWipe.Type.Clock="Reloxo" +LumaWipe.Type.Cloud="Nube" +LumaWipe.Type.Curtain="Cortina" +LumaWipe.Type.Fan="Ventilador" +LumaWipe.Type.Fractal="Fractal" +LumaWipe.Type.Iris="Iris" +LumaWipe.Type.LinearHorizontal="Lineal horizontal" +LumaWipe.Type.LinearTopLeft="Lineal superior á esquerda" +LumaWipe.Type.LinearTopRight="Linear superior á dereita" +LumaWipe.Type.LinearVertical="Lineal vertical" +LumaWipe.Type.ParallelZigzagHorizontal="Zigzag paralelo horizontal" +LumaWipe.Type.ParallelZigzagVertical="Zigzag paralelo vertical" +LumaWipe.Type.Sinus9="Seno 9" +LumaWipe.Type.Spiral="Espiral" +LumaWipe.Type.Square="Cadrado" +LumaWipe.Type.Squares="Cadrados" +LumaWipe.Type.Stripes="Bandas" +LumaWipe.Type.StripsHorizontal="Bandas horizontais" +LumaWipe.Type.StripsVertical="Bandas verticais" +LumaWipe.Type.Watercolor="Acuarela" +LumaWipe.Type.ZigzagHorizontal="Zigzag horizontal" +LumaWipe.Type.ZigzagVertical="Zigzag vertical" +AudioMonitoring="Monitorización do son" +AudioMonitoring.None="Monitor apagado" +AudioMonitoring.MonitorOnly="Só o monitor (silenciar a saída)" +AudioMonitoring.Both="Monitor e saída"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/he-IL.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/he-IL.ini
Changed
@@ -10,5 +10,4 @@ Direction.Down="למטה" SwipeIn="החלקה פנימה" Color="צבע" -SwitchPoint="נקודת שיא צבע (באחוזים)"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/hr-HR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/hr-HR.ini
Changed
@@ -10,7 +10,6 @@ Direction.Down="Dole" SwipeIn="Uvlačenje" Color="Boja" -SwitchPoint="Tačka vrhunca boje (procenat)" LumaWipeTransition="Luma brisanje" LumaWipe.Image="Slika" LumaWipe.Invert="Obrnuto"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/hu-HU.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/hu-HU.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Belapozás" Color="Szín" VideoFile="Videofájl" -TransitionPoint="Átmenetpont (ezredmásodperc)" +TransitionPoint="Átmenetpont" TransitionPointFrame="Átmenetpont (Képkocka)" TransitionPointType="Átmenetpont típus" TransitionPointTypeFrame="Képkocka" @@ -20,7 +20,7 @@ AudioFadeStyle="Hangáttűnés stílusa" AudioFadeStyle.FadeOutFadeIn="Átmenetponthoz halkítás és visszahangosítás" AudioFadeStyle.CrossFade="Átkeverés" -SwitchPoint="Színpont csúcs (százalék)" +SwitchPoint="Csúcs színpont" LumaWipeTransition="Luma törlés" LumaWipe.Image="Kép" LumaWipe.Invert="Megfordítás"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/it-IT.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/it-IT.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Inverti l'effetto" Color="Colore" VideoFile="File video" -TransitionPoint="Punto di transizione (in millisecondi)" +TransitionPoint="Punto di transizione" TransitionPointFrame="Punto di transizione (in fotogrammi)" TransitionPointType="Tipo del punto di transizione" TransitionPointTypeFrame="In fotogrammi" @@ -20,7 +20,7 @@ AudioFadeStyle="Stile della dissolvenza audio" AudioFadeStyle.FadeOutFadeIn="Dissolvenza fino al punto di transizione, poi dissolvenza in entrata" AudioFadeStyle.CrossFade="Dissolvenza incrociata" -SwitchPoint="Picco del colore (in percentuale)" +SwitchPoint="Punto Colore di Picco" LumaWipeTransition="Scansione Luma" LumaWipe.Image="Immagine" LumaWipe.Invert="Inverti"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/ja-JP.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/ja-JP.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="スワイプイン" Color="色" VideoFile="動画ファイル" -TransitionPoint="トランジションポイント (ミリ秒)" +TransitionPoint="トランジションポイント" TransitionPointFrame="トランジションポイント (フレーム)" TransitionPointType="トランジションポイントの種類" TransitionPointTypeFrame="フレーム" @@ -20,7 +20,7 @@ AudioFadeStyle="オーディオフェードスタイル" AudioFadeStyle.FadeOutFadeIn="トランジションポイントまでフェードアウトしてからフェードイン" AudioFadeStyle.CrossFade="クロスフェード" -SwitchPoint="ピークカラーポイント (割合)" +SwitchPoint="ピークカラーポイント" LumaWipeTransition="輝度ワイプ" LumaWipe.Image="画像" LumaWipe.Invert="反転"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/ka-GE.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="უძრავად შენაცვლება" Color="ფერი" VideoFile="ვიდეოფაილი" -TransitionPoint="გადასვლის წერტილი (მილიწამი)" +TransitionPoint="გადასვლის წერტილი" TransitionPointFrame="გადასვლის წერტილი (კადრი)" TransitionPointType="გადასვლის წერტილის სახეობა" TransitionPointTypeFrame="კადრი" @@ -20,7 +20,7 @@ AudioFadeStyle="ხმის მილევის ნაირსახეობა" AudioFadeStyle.FadeOutFadeIn="თანდათან მილევა გადასვლის წერტილში და შემდეგ მომატება" AudioFadeStyle.CrossFade="ჯვარედინი გადასვლა" -SwitchPoint="ფერის უმაღლესი წერტილი (პროცენტი)" +SwitchPoint="ფერის უმაღლესი წერტილი" LumaWipeTransition="Luma Wipe" LumaWipe.Image="გამოსახულება" LumaWipe.Invert="შებრუნება"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/ko-KR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/ko-KR.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="덮기" Color="색상" VideoFile="비디오 파일" -TransitionPoint="전환 지점 (밀리초)" +TransitionPoint="전환 지점" TransitionPointFrame="전환 지점 (프레임)" TransitionPointType="전환 지점 형식" TransitionPointTypeFrame="프레임" @@ -20,7 +20,7 @@ AudioFadeStyle="소리 점감 형식" AudioFadeStyle.FadeOutFadeIn="전환 지점까지 서서히 작아졌다가 다시 커지기" AudioFadeStyle.CrossFade="천천히 작아지기와 커지기 동시" -SwitchPoint="최고조 색상 지점 (백분율)" +SwitchPoint="최고조 색상 지점" LumaWipeTransition="루마 지우기" LumaWipe.Image="이미지 파일" LumaWipe.Invert="반전"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/nb-NO.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/nb-NO.ini
Changed
@@ -12,7 +12,6 @@ SwipeIn="Sveip inn" Color="Farge" VideoFile="Videofil" -TransitionPoint="Overgangspunkt (millisekunder)" TransitionPointFrame="Overgangspunkt (ramme)" TransitionPointType="Overgangspunkttype" TransitionPointTypeFrame="Ramme" @@ -20,7 +19,6 @@ AudioFadeStyle="Lyduttoningsstil" AudioFadeStyle.FadeOutFadeIn="Ton ut til overgangspunktet, og så ton inn igjen" AudioFadeStyle.CrossFade="Kryssuttoning" -SwitchPoint="Farge ved høydepunkt (prosent)" LumaWipeTransition="Luminansfjerning" LumaWipe.Image="Bilde" LumaWipe.Invert="Inverter"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/nl-NL.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/nl-NL.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Naar binnen vegen" Color="Kleur" VideoFile="Videobestand" -TransitionPoint="Overgangspunt (milliseconden)" +TransitionPoint="Transitiepunt" TransitionPointFrame="Transitiepunt (frame)" TransitionPointType="Transitiepunt-type" TransitionPointTypeFrame="Frame" @@ -20,7 +20,7 @@ AudioFadeStyle="Audio Fade stijl" AudioFadeStyle.FadeOutFadeIn="Overgang van punt dan fade-in uitfaden" AudioFadeStyle.CrossFade="Crossfading" -SwitchPoint="Wisselpunt (percentage)" +SwitchPoint="Piek Kleurenpunt" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Afbeelding" LumaWipe.Invert="Omkeren"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/pl-PL.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/pl-PL.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Przesuwaj do środka" Color="Kolor" VideoFile="Plik wideo" -TransitionPoint="Punkt przejścia (w milisekundach)" +TransitionPoint="Punkt przejścia" TransitionPointFrame="Punkt przejścia (ramka)" TransitionPointType="Typ punktu przejścia" TransitionPointTypeFrame="Ramka" @@ -20,7 +20,7 @@ AudioFadeStyle="Styl przejścia dźwięku" AudioFadeStyle.FadeOutFadeIn="Stopniowe wyciszenie do punktu przejścia a następnie stopniowe wzmocnienie" AudioFadeStyle.CrossFade="Płynne przejście" -SwitchPoint="Punkt szczytowy koloru (procent)" +SwitchPoint="Szczytowy punkt koloru" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Obraz" LumaWipe.Invert="Odwróć"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/pt-BR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/pt-BR.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Deslizar para" Color="Cor" VideoFile="Arquivo de Vídeo" -TransitionPoint="Ponto de Transição (milissegundos)" +TransitionPoint="Ponto de transição" TransitionPointFrame="Ponto de transição (quadro)" TransitionPointType="Tipo de Ponto de Transição" TransitionPointTypeFrame="Quadro" @@ -20,7 +20,7 @@ AudioFadeStyle="Estilo de Esmaecimento de Áudio" AudioFadeStyle.FadeOutFadeIn="Esmaecer imagem até o ponto de transição e depois aparecer" AudioFadeStyle.CrossFade="Transição Suave" -SwitchPoint="Ponto de Pico de Cor (porcentagem)" +SwitchPoint="Ponto de cor do pico" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Imagem" LumaWipe.Invert="Inverso"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/pt-PT.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/pt-PT.ini
Changed
@@ -12,9 +12,7 @@ SwipeIn="Deslizar para dentro" Color="Cor" VideoFile="Ficheiro Vídeo" -TransitionPoint="Ponto de Transição (milissegundos)" TransitionPointFrame="Ponto de transição (quadro)" TransitionPointType="Tipo de Ponto de Transição" TransitionPointTypeTime="Tempo (milissegundos)" -SwitchPoint="Ponto de pico de Cor (percentagem)"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/ro-RO.ini
Changed
@@ -11,12 +11,10 @@ Direction.Down="Jos" SwipeIn="Glisează peste" Color="Culoare" -TransitionPoint="Punct de tranziție (milisecunde)" TransitionPointFrame="Punct de tranziție (fotogramă)" TransitionPointType="Tipul punctului de tranziție" TransitionPointTypeFrame="Fotogramă" TransitionPointTypeTime="Timp (milisecunde)" -SwitchPoint="Punctul de vârf al culorii (procent)" LumaWipe.Image="Imagine" LumaWipe.Invert="Inversează" LumaWipe.Softness="Moliciune"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/ru-RU.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/ru-RU.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Перемещение внутрь" Color="Цвет" VideoFile="Файл видео" -TransitionPoint="Точка перехода (миллисекунды)" +TransitionPoint="Точка перехода" TransitionPointFrame="Точка перехода (кадр)" TransitionPointType="Тип точки перехода" TransitionPointTypeFrame="Кадр" @@ -20,7 +20,7 @@ AudioFadeStyle="Стиль затухания аудио" AudioFadeStyle.FadeOutFadeIn="Затухание в точку перехода с последующим появлением" AudioFadeStyle.CrossFade="Переход" -SwitchPoint="Точка цветового пика (в процентах)" +SwitchPoint="Точка цветового пика" LumaWipeTransition="Выцветание" LumaWipe.Image="Изображение" LumaWipe.Invert="Инвертировать"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/sk-SK.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/sk-SK.ini
Changed
@@ -11,7 +11,6 @@ Direction.Down="Nadol" Color="Farba" VideoFile="Video súbor" -TransitionPoint="Bod prechodu (v milisekundách)" TransitionPointFrame="Bod prechodu (v snímkoch)" TransitionPointType="Typ bodu prechodu" TransitionPointTypeFrame="Snímok"
View file
obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/sl-SI.ini
Added
@@ -0,0 +1,66 @@ +FadeTransition="Pojemaj" +CutTransition="Izreži" +SwipeTransition="Potegni" +SlideTransition="Podrsaj" +StingerTransition="Stinger" +FadeToColorTransition="Pojemaj v barvo" +Direction="Smer" +Direction.Left="Levo" +Direction.Right="Desno" +Direction.Up="Gor" +Direction.Down="Dol" +SwipeIn="Potegni navznoter" +Color="Barva" +VideoFile="Videodatoteka" +TransitionPoint="Točka prehoda" +TransitionPointFrame="Točka prehoda (sličica)" +TransitionPointType="Vrsta točke prehoda" +TransitionPointTypeFrame="Sličica" +TransitionPointTypeTime="Čas (ms)" +AudioFadeStyle="Slog pojemanja zvoka" +AudioFadeStyle.FadeOutFadeIn="Pojemaj do točke prehoda in nato povračaj" +AudioFadeStyle.CrossFade="Navzkrižno pojemanje" +SwitchPoint="Najvišja točka barve" +LumaWipeTransition="Svetlobno brisanje" +LumaWipe.Image="Slika" +LumaWipe.Invert="Obrni" +LumaWipe.Softness="Mehkost" +LumaWipe.Type.BarndoorBottomLeft="Vrata spodaj levo" +LumaWipe.Type.BarndoorHorizontal="Vodoravna vrata" +LumaWipe.Type.BarndoorTopLeft="Vrata zgoraj levo" +LumaWipe.Type.BarndoorVertical="Navpična vrata" +LumaWipe.Type.BlindsHorizontal="Vodoravne žaluzije" +LumaWipe.Type.BoxBottomLeft="Kvader spodaj levo" +LumaWipe.Type.BoxBottomRight="Kvader spodaj desno" +LumaWipe.Type.BoxTopLeft="Kvader zgoraj levo" +LumaWipe.Type.BoxTopRight="Kvader zgoraj desno" +LumaWipe.Type.Burst="Pok" +LumaWipe.Type.CheckerboardSmall="Majhna šahovnica" +LumaWipe.Type.Circles="Krogi" +LumaWipe.Type.Clock="Ura" +LumaWipe.Type.Cloud="Oblak" +LumaWipe.Type.Curtain="Zavesa" +LumaWipe.Type.Fan="Ventilator" +LumaWipe.Type.Fractal="Fraktal" +LumaWipe.Type.Iris="Zaslonka" +LumaWipe.Type.LinearHorizontal="Premočrtno vodoravno" +LumaWipe.Type.LinearTopLeft="Premočrtno zgoraj levo" +LumaWipe.Type.LinearTopRight="Premočrtno zgoraj desno" +LumaWipe.Type.LinearVertical="Premočrtno navpično" +LumaWipe.Type.ParallelZigzagHorizontal="Vzporedno cikcak vodoravno" +LumaWipe.Type.ParallelZigzagVertical="Vzporedno cikcak navpično" +LumaWipe.Type.Sinus9="Sinus 9" +LumaWipe.Type.Spiral="Spirala" +LumaWipe.Type.Square="Kvadrat" +LumaWipe.Type.Squares="Kvadrati" +LumaWipe.Type.Stripes="Črte" +LumaWipe.Type.StripsHorizontal="Vodoravne črte" +LumaWipe.Type.StripsVertical="Navpične črte" +LumaWipe.Type.Watercolor="Vodna barva" +LumaWipe.Type.ZigzagHorizontal="Cikcak vodoravno" +LumaWipe.Type.ZigzagVertical="Cikcak navpično" +AudioMonitoring="Nadzor zvoka" +AudioMonitoring.None="Nadzor je izklopljen" +AudioMonitoring.MonitorOnly="Samo nadziraj (utišaj izhod)" +AudioMonitoring.Both="Nadzor in izhod" +
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/sr-CS.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/sr-CS.ini
Changed
@@ -12,7 +12,6 @@ SwipeIn="Uvlačenje" Color="Boja" VideoFile="Video fajl" -TransitionPoint="Početak prelaza (milisekunde)" TransitionPointFrame="Početak prelaza (frejm)" TransitionPointType="Tip početka prelaza" TransitionPointTypeFrame="Frejm" @@ -20,7 +19,6 @@ AudioFadeStyle="Način na koji zvuk nestaje" AudioFadeStyle.FadeOutFadeIn="Nestaje do tačke prelaza a zatim se ponovo vraća" AudioFadeStyle.CrossFade="Nestaje unakrsno" -SwitchPoint="Tačka vrhunca boje (procenat)" LumaWipeTransition="Luma brisanje" LumaWipe.Image="Slika" LumaWipe.Invert="Obrnuto"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/sr-SP.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/sr-SP.ini
Changed
@@ -12,7 +12,6 @@ SwipeIn="Увлачење" Color="Боја" VideoFile="Видео фајл" -TransitionPoint="Почетак прелаза (милисекунде)" TransitionPointFrame="Почетак прелаза (фрејм)" TransitionPointType="Тип почетка прелаза" TransitionPointTypeFrame="Фрејм" @@ -20,7 +19,6 @@ AudioFadeStyle="Начин на који звук нестаје" AudioFadeStyle.FadeOutFadeIn="Нестаје до тачке прелаза а затим се поново враћа" AudioFadeStyle.CrossFade="Нестаје унакрсно" -SwitchPoint="Тачка врхунца боје (проценат)" LumaWipeTransition="Лума брисање" LumaWipe.Image="Слика" LumaWipe.Invert="Обрнуто"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/sv-SE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/sv-SE.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="Svep in" Color="Färg" VideoFile="Videofil" -TransitionPoint="Övergångspunkt (millisekunder)" +TransitionPoint="Övergångspunkt" TransitionPointFrame="Övergångspunkt (bildruta)" TransitionPointType="Typ av övergångspunkt" TransitionPointTypeFrame="Bildruta" @@ -20,7 +20,7 @@ AudioFadeStyle="Stil för ljuduttoning" AudioFadeStyle.FadeOutFadeIn="Tona ut till övergångspunkten och sedan tona in" AudioFadeStyle.CrossFade="Övertoning" -SwitchPoint="Maxpunkt för färg (procent)" +SwitchPoint="Färgmaxpunkt" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Bild" LumaWipe.Invert="Invertera"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/tl-PH.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/tl-PH.ini
Changed
@@ -12,7 +12,6 @@ SwipeIn="Mag-swipe papasok" Color="Kulay" VideoFile="File ng mga video" -TransitionPoint="Pinagmulan ng Pagbabago (millisegundos)" TransitionPointFrame="Pinagmulan ng Pagbabago (Frame)" TransitionPointType="Pinagmulan ng Pagbabago ng Tipo" TransitionPointTypeFrame="Ang frame" @@ -20,7 +19,6 @@ AudioFadeStyle="Palabo ang istilo ng Audio" AudioFadeStyle.FadeOutFadeIn="Palabo ang palabas sa pinagmulan ng pagbabago tapos palabo papasok" AudioFadeStyle.CrossFade="Crossfade" -SwitchPoint="Peak Color Point (porsyento)" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Imahe" LumaWipe.Invert="Ibaliktad"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/tr-TR.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/tr-TR.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="İçeri Kaydır" Color="Renk" VideoFile="Video Dosyası" -TransitionPoint="Geçiş Noktası (milisaniye)" +TransitionPoint="Geçiş Noktası" TransitionPointFrame="Geçiş Noktası (kare)" TransitionPointType="Geçiş Noktası Türü" TransitionPointTypeFrame="Kare" @@ -20,7 +20,6 @@ AudioFadeStyle="Ses Geçiş Stili" AudioFadeStyle.FadeOutFadeIn="Geçiş noktasına doğru azalt sonra artır" AudioFadeStyle.CrossFade="Çapraz Geçiş" -SwitchPoint="En yüksek Renk Noktası (yüzde)" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Görüntü" LumaWipe.Invert="Ters Çevir"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/uk-UA.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/uk-UA.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="В кадр" Color="Колір" VideoFile="Файл відео" -TransitionPoint="Точка відео-переходу (мілісекунд)" +TransitionPoint="Точка відео-переходу" TransitionPointFrame="Точка відео-переходу (кадр)" TransitionPointType="Тип точки відео-переходу" TransitionPointTypeFrame="Кадр" @@ -20,7 +20,7 @@ AudioFadeStyle="Стиль затухання Аудіо" AudioFadeStyle.FadeOutFadeIn="Затухання до точки відео-переходу, потім гучність наростає" AudioFadeStyle.CrossFade="Плавний перехід (з початку)" -SwitchPoint="Найвища точка для кольору (відсоток)" +SwitchPoint="Точка кольору, відстань" LumaWipeTransition="Luma Wipe" LumaWipe.Image="Зображення" LumaWipe.Invert="Інвертувати"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/zh-CN.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/zh-CN.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="滑入" Color="色彩" VideoFile="视频文件" -TransitionPoint="转换点(毫秒)" +TransitionPoint="转换点" TransitionPointFrame="转换点(帧)" TransitionPointType="转换点类型" TransitionPointTypeFrame="帧" @@ -20,7 +20,7 @@ AudioFadeStyle="音频淡入淡出样式" AudioFadeStyle.FadeOutFadeIn="淡出到过渡点然后淡入" AudioFadeStyle.CrossFade="交叉淡入淡出" -SwitchPoint="峰值颜色点(百分比)" +SwitchPoint="峰值颜色点" LumaWipeTransition="亮度擦除" LumaWipe.Image="图像" LumaWipe.Invert="反转"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/data/locale/zh-TW.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/data/locale/zh-TW.ini
Changed
@@ -12,7 +12,7 @@ SwipeIn="滑入" Color="顏色" VideoFile="影片檔" -TransitionPoint="轉換點 (毫秒)" +TransitionPoint="轉換點" TransitionPointFrame="轉換點 (訊框)" TransitionPointType="轉換點類型" TransitionPointTypeFrame="訊框" @@ -20,7 +20,7 @@ AudioFadeStyle="音訊淡入淡出風格" AudioFadeStyle.FadeOutFadeIn="淡出至轉換點再淡入" AudioFadeStyle.CrossFade="交叉式淡入淡出" -SwitchPoint="顏色峰值點 (百分比)" +SwitchPoint="峰值色點" LumaWipeTransition="Luma Wipe" LumaWipe.Image="影像" LumaWipe.Invert="倒置"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/transition-cut.c -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/transition-cut.c
Changed
@@ -48,12 +48,13 @@ } static bool cut_audio_render(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio, uint32_t mixers, - size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio, + uint32_t mixers, size_t channels, + size_t sample_rate) { struct cut_info *cut = data; - return obs_transition_audio_render(cut->source, ts_out, - audio, mixers, channels, sample_rate, mix_a, mix_b); + return obs_transition_audio_render(cut->source, ts_out, audio, mixers, + channels, sample_rate, mix_a, mix_b); } struct obs_source_info cut_transition = {
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/transition-fade-to-color.c -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/transition-fade-to-color.c
Changed
@@ -35,7 +35,7 @@ static inline float smoothstep(float min, float max, float x) { x = clamp((x - min) / (max - min), 0.0f, 1.0f); - return x*x*(3 - 2 * x); + return x * x * (3 - 2 * x); } static const char *fade_to_color_get_name(void *type_data) @@ -48,7 +48,7 @@ { struct fade_to_color_info *fade_to_color = data; uint32_t color = (uint32_t)obs_data_get_int(settings, S_COLOR); - uint32_t swp = (uint32_t)obs_data_get_int(settings, S_SWITCH_POINT); + uint32_t swp = (uint32_t)obs_data_get_int(settings, S_SWITCH_POINT); color |= 0xFF000000; @@ -70,7 +70,8 @@ bfree(file); if (!effect) { - blog(LOG_ERROR, "Could not find fade_to_color_transition.effect"); + blog(LOG_ERROR, + "Could not find fade_to_color_transition.effect"); return NULL; } @@ -79,8 +80,8 @@ fade_to_color->source = source; fade_to_color->effect = effect; - fade_to_color->ep_tex = gs_effect_get_param_by_name(effect, "tex"); - fade_to_color->ep_swp = gs_effect_get_param_by_name(effect, "swp"); + fade_to_color->ep_tex = gs_effect_get_param_by_name(effect, "tex"); + fade_to_color->ep_swp = gs_effect_get_param_by_name(effect, "swp"); fade_to_color->ep_color = gs_effect_get_param_by_name(effect, "color"); obs_source_update(source, settings); @@ -95,7 +96,7 @@ } static void fade_to_color_callback(void *data, gs_texture_t *a, gs_texture_t *b, - float t, uint32_t cx, uint32_t cy) + float t, uint32_t cx, uint32_t cy) { struct fade_to_color_info *fade_to_color = data; @@ -117,7 +118,7 @@ { struct fade_to_color_info *fade_to_color = data; obs_transition_video_render(fade_to_color->source, - fade_to_color_callback); + fade_to_color_callback); UNUSED_PARAMETER(effect); } @@ -126,7 +127,7 @@ struct fade_to_color_info *fade_to_color = data; float sp = fade_to_color->switch_point; - return lerp(1.0f - t , 0.0f, smoothstep(0.0f, sp, t)); + return lerp(1.0f - t, 0.0f, smoothstep(0.0f, sp, t)); } static float mix_b(void *data, float t) @@ -138,12 +139,14 @@ } static bool fade_to_color_audio_render(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio, uint32_t mixers, - size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio, + uint32_t mixers, size_t channels, + size_t sample_rate) { struct fade_to_color_info *fade_to_color = data; - return obs_transition_audio_render(fade_to_color->source, ts_out, - audio, mixers, channels, sample_rate, mix_a, mix_b); + return obs_transition_audio_render(fade_to_color->source, ts_out, audio, + mixers, channels, sample_rate, mix_a, + mix_b); } static obs_properties_t *fade_to_color_properties(void *data) @@ -151,8 +154,9 @@ obs_properties_t *props = obs_properties_create(); obs_properties_add_color(props, S_COLOR, S_COLOR_TEXT); - obs_properties_add_int_slider(props, S_SWITCH_POINT, - S_SWITCH_POINT_TEXT, 0, 100, 1); + obs_property_t *p = obs_properties_add_int_slider( + props, S_SWITCH_POINT, S_SWITCH_POINT_TEXT, 0, 100, 1); + obs_property_int_set_suffix(p, "%"); UNUSED_PARAMETER(data); return props; @@ -165,14 +169,14 @@ } struct obs_source_info fade_to_color_transition = { - .id = "fade_to_color_transition", - .type = OBS_SOURCE_TYPE_TRANSITION, - .get_name = fade_to_color_get_name, - .create = fade_to_color_create, - .destroy = fade_to_color_destroy, - .update = fade_to_color_update, - .video_render = fade_to_color_video_render, - .audio_render = fade_to_color_audio_render, + .id = "fade_to_color_transition", + .type = OBS_SOURCE_TYPE_TRANSITION, + .get_name = fade_to_color_get_name, + .create = fade_to_color_create, + .destroy = fade_to_color_destroy, + .update = fade_to_color_update, + .video_render = fade_to_color_video_render, + .audio_render = fade_to_color_audio_render, .get_properties = fade_to_color_properties, - .get_defaults = fade_to_color_defaults + .get_defaults = fade_to_color_defaults, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/transition-fade.c -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/transition-fade.c
Changed
@@ -49,7 +49,7 @@ } static void fade_callback(void *data, gs_texture_t *a, gs_texture_t *b, float t, - uint32_t cx, uint32_t cy) + uint32_t cx, uint32_t cy) { struct fade_info *fade = data; @@ -81,12 +81,13 @@ } static bool fade_audio_render(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio, uint32_t mixers, - size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio, + uint32_t mixers, size_t channels, + size_t sample_rate) { struct fade_info *fade = data; - return obs_transition_audio_render(fade->source, ts_out, - audio, mixers, channels, sample_rate, mix_a, mix_b); + return obs_transition_audio_render(fade->source, ts_out, audio, mixers, + channels, sample_rate, mix_a, mix_b); } struct obs_source_info fade_transition = { @@ -96,5 +97,5 @@ .create = fade_create, .destroy = fade_destroy, .video_render = fade_video_render, - .audio_render = fade_audio_render + .audio_render = fade_audio_render, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/transition-luma-wipe.c -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/transition-luma-wipe.c
Changed
@@ -2,6 +2,8 @@ #include <graphics/image-file.h> #include <util/dstr.h> +/* clang-format off */ + #define S_LUMA_IMG "luma_image" #define S_LUMA_INV "luma_invert" #define S_LUMA_SOFT "luma_softness" @@ -10,6 +12,8 @@ #define T_LUMA_INV obs_module_text("LumaWipe.Invert") #define T_LUMA_SOFT obs_module_text("LumaWipe.Softness") +/* clang-format on */ + struct luma_wipe_info { obs_source_t *source; @@ -22,7 +26,7 @@ gs_eparam_t *ep_softness; gs_image_file_t luma_image; - bool invert_luma; + bool invert_luma; float softness; obs_data_t *wipes_list; }; @@ -94,14 +98,14 @@ lwipe = bzalloc(sizeof(*lwipe)); - lwipe->effect = effect; - lwipe->ep_a_tex = gs_effect_get_param_by_name(effect, "a_tex"); - lwipe->ep_b_tex = gs_effect_get_param_by_name(effect, "b_tex"); - lwipe->ep_l_tex = gs_effect_get_param_by_name(effect, "l_tex"); + lwipe->effect = effect; + lwipe->ep_a_tex = gs_effect_get_param_by_name(effect, "a_tex"); + lwipe->ep_b_tex = gs_effect_get_param_by_name(effect, "b_tex"); + lwipe->ep_l_tex = gs_effect_get_param_by_name(effect, "l_tex"); lwipe->ep_progress = gs_effect_get_param_by_name(effect, "progress"); - lwipe->ep_invert = gs_effect_get_param_by_name(effect, "invert"); + lwipe->ep_invert = gs_effect_get_param_by_name(effect, "invert"); lwipe->ep_softness = gs_effect_get_param_by_name(effect, "softness"); - lwipe->source = source; + lwipe->source = source; luma_wipe_get_list(lwipe); @@ -131,7 +135,8 @@ obs_property_t *p; p = obs_properties_add_list(props, S_LUMA_IMG, T_LUMA_IMG, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_data_item_t *item = obs_data_first(lwipe->wipes_list); @@ -141,7 +146,8 @@ obs_property_list_add_string(p, obs_module_text(name), path); } - obs_properties_add_float(props, S_LUMA_SOFT, T_LUMA_SOFT, 0.0, 1.0, 0.05); + obs_properties_add_float(props, S_LUMA_SOFT, T_LUMA_SOFT, 0.0, 1.0, + 0.05); obs_properties_add_bool(props, S_LUMA_INV, T_LUMA_INV); return props; @@ -191,23 +197,23 @@ } bool luma_wipe_audio_render(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio, uint32_t mixers, - size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio, uint32_t mixers, + size_t channels, size_t sample_rate) { struct luma_wipe_info *lwipe = data; return obs_transition_audio_render(lwipe->source, ts_out, audio, mixers, - channels, sample_rate, mix_a, mix_b); + channels, sample_rate, mix_a, mix_b); } struct obs_source_info luma_wipe_transition = { - .id = "wipe_transition", - .type = OBS_SOURCE_TYPE_TRANSITION, - .get_name = luma_wipe_get_name, - .create = luma_wipe_create, - .destroy = luma_wipe_destroy, - .update = luma_wipe_update, - .video_render = luma_wipe_video_render, - .audio_render = luma_wipe_audio_render, - .get_properties = luma_wipe_properties, - .get_defaults = luma_wipe_defaults + .id = "wipe_transition", + .type = OBS_SOURCE_TYPE_TRANSITION, + .get_name = luma_wipe_get_name, + .create = luma_wipe_create, + .destroy = luma_wipe_destroy, + .update = luma_wipe_update, + .video_render = luma_wipe_video_render, + .audio_render = luma_wipe_audio_render, + .get_properties = luma_wipe_properties, + .get_defaults = luma_wipe_defaults, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/transition-slide.c -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/transition-slide.c
Changed
@@ -29,13 +29,13 @@ const char *dir = obs_data_get_string(settings, S_DIRECTION); if (strcmp(dir, "right") == 0) - slide->dir = (struct vec2){ -1.0f, 0.0f }; + slide->dir = (struct vec2){-1.0f, 0.0f}; else if (strcmp(dir, "up") == 0) - slide->dir = (struct vec2){ 0.0f, 1.0f }; + slide->dir = (struct vec2){0.0f, 1.0f}; else if (strcmp(dir, "down") == 0) - slide->dir = (struct vec2){ 0.0f, -1.0f }; + slide->dir = (struct vec2){0.0f, -1.0f}; else /* left */ - slide->dir = (struct vec2){ 1.0f, 0.0f }; + slide->dir = (struct vec2){1.0f, 0.0f}; } void *slide_create(obs_data_t *settings, obs_source_t *source) @@ -123,12 +123,12 @@ } bool slide_audio_render(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio, uint32_t mixers, - size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio, uint32_t mixers, + size_t channels, size_t sample_rate) { struct slide_info *slide = data; - return obs_transition_audio_render(slide->source, ts_out, - audio, mixers, channels, sample_rate, mix_a, mix_b); + return obs_transition_audio_render(slide->source, ts_out, audio, mixers, + channels, sample_rate, mix_a, mix_b); } static obs_properties_t *slide_properties(void *data) @@ -137,16 +137,16 @@ obs_property_t *p; p = obs_properties_add_list(ppts, S_DIRECTION, - obs_module_text("Direction"), OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_STRING); + obs_module_text("Direction"), + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, obs_module_text("Direction.Left"), - "left"); + "left"); obs_property_list_add_string(p, obs_module_text("Direction.Right"), - "right"); - obs_property_list_add_string(p, obs_module_text("Direction.Up"), - "up"); + "right"); + obs_property_list_add_string(p, obs_module_text("Direction.Up"), "up"); obs_property_list_add_string(p, obs_module_text("Direction.Down"), - "down"); + "down"); UNUSED_PARAMETER(data); return ppts; @@ -161,5 +161,5 @@ .update = slide_update, .video_render = slide_video_render, .audio_render = slide_audio_render, - .get_properties = slide_properties + .get_properties = slide_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/transition-stinger.c -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/transition-stinger.c
Changed
@@ -1,12 +1,9 @@ #include <obs-module.h> -#define TIMING_TIME 0 +#define TIMING_TIME 0 #define TIMING_FRAME 1 -enum fade_style { - FADE_STYLE_FADE_OUT_FADE_IN, - FADE_STYLE_CROSS_FADE -}; +enum fade_style { FADE_STYLE_FADE_OUT_FADE_IN, FADE_STYLE_CROSS_FADE }; struct stinger_info { obs_source_t *source; @@ -50,24 +47,25 @@ obs_source_release(s->media_source); s->media_source = obs_source_create_private("ffmpeg_source", NULL, - media_settings); + media_settings); obs_data_release(media_settings); int64_t point = obs_data_get_int(settings, "transition_point"); - s->transition_point_is_frame = - obs_data_get_int(settings, "tp_type") == TIMING_FRAME; + s->transition_point_is_frame = obs_data_get_int(settings, "tp_type") == + TIMING_FRAME; if (s->transition_point_is_frame) s->transition_point_frame = (uint64_t)point; else s->transition_point_ns = (uint64_t)(point * 1000000LL); - s->monitoring_type = (int)obs_data_get_int(settings,"audio_monitoring"); + s->monitoring_type = + (int)obs_data_get_int(settings, "audio_monitoring"); obs_source_set_monitoring_type(s->media_source, s->monitoring_type); - s->fade_style = (enum fade_style)obs_data_get_int(settings, - "audio_fade_style"); + s->fade_style = + (enum fade_style)obs_data_get_int(settings, "audio_fade_style"); switch (s->fade_style) { default: @@ -109,9 +107,8 @@ float t = obs_transition_get_time(s->source); bool use_a = t < s->transition_point; - enum obs_transition_target target = use_a - ? OBS_TRANSITION_SOURCE_A - : OBS_TRANSITION_SOURCE_B; + enum obs_transition_target target = use_a ? OBS_TRANSITION_SOURCE_A + : OBS_TRANSITION_SOURCE_B; if (!obs_transition_video_render_direct(s->source, target)) return; @@ -168,8 +165,9 @@ } static bool stinger_audio_render(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio, uint32_t mixers, - size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio, + uint32_t mixers, size_t channels, + size_t sample_rate) { struct stinger_info *s = data; uint64_t ts = 0; @@ -180,8 +178,10 @@ return false; } - bool success = obs_transition_audio_render(s->source, ts_out, - audio, mixers, channels, sample_rate, s->mix_a, s->mix_b); + bool success = obs_transition_audio_render(s->source, ts_out, audio, + mixers, channels, + sample_rate, s->mix_a, + s->mix_b); if (!ts) return success; @@ -229,13 +229,13 @@ s->duration_frames = (uint64_t)calldata_int(&cd, "num_frames"); if (s->transition_point_is_frame) - s->transition_point = (float)( - (long double)s->transition_point_frame / - (long double)s->duration_frames); + s->transition_point = + (float)((long double)s->transition_point_frame / + (long double)s->duration_frames); else - s->transition_point = (float)( - (long double)s->transition_point_ns / - (long double)s->duration_ns); + s->transition_point = + (float)((long double)s->transition_point_ns / + (long double)s->duration_ns); if (s->transition_point > 0.999f) s->transition_point = 0.999f; @@ -245,8 +245,8 @@ s->transition_a_mul = (1.0f / s->transition_point); s->transition_b_mul = (1.0f / (1.0f - s->transition_point)); - obs_transition_enable_fixed(s->source, true, - (uint32_t)(s->duration_ns / 1000000)); + obs_transition_enable_fixed( + s->source, true, (uint32_t)(s->duration_ns / 1000000)); calldata_free(&cd); @@ -267,7 +267,8 @@ } static void stinger_enum_active_sources(void *data, - obs_source_enum_proc_t enum_callback, void *param) + obs_source_enum_proc_t enum_callback, + void *param) { struct stinger_info *s = data; if (s->media_source && s->transitioning) @@ -275,7 +276,8 @@ } static void stinger_enum_all_sources(void *data, - obs_source_enum_proc_t enum_callback, void *param) + obs_source_enum_proc_t enum_callback, + void *param) { struct stinger_info *s = data; if (s->media_source) @@ -286,17 +288,20 @@ "Video Files (*.mp4 *.ts *.mov *.wmv *.flv *.mkv *.avi *.gif *.webm);;" static bool transition_point_type_modified(obs_properties_t *ppts, - obs_property_t *p, obs_data_t *s) + obs_property_t *p, obs_data_t *s) { int64_t type = obs_data_get_int(s, "tp_type"); p = obs_properties_get(ppts, "transition_point"); - if (type == TIMING_TIME) - obs_property_set_description(p, - obs_module_text("TransitionPoint")); - else - obs_property_set_description(p, - obs_module_text("TransitionPointFrame")); + if (type == TIMING_TIME) { + obs_property_set_description( + p, obs_module_text("TransitionPoint")); + obs_property_int_set_suffix(p, " ms"); + } else { + obs_property_set_description( + p, obs_module_text("TransitionPointFrame")); + obs_property_int_set_suffix(p, ""); + } return true; } @@ -306,48 +311,45 @@ obs_properties_set_flags(ppts, OBS_PROPERTIES_DEFER_UPDATE); - obs_properties_add_path(ppts, "path", - obs_module_text("VideoFile"), - OBS_PATH_FILE, - FILE_FILTER, NULL); - obs_property_t *list = obs_properties_add_list(ppts, "tp_type", - obs_module_text("TransitionPointType"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); - obs_property_list_add_int(list, - obs_module_text("TransitionPointTypeTime"), - TIMING_TIME); - obs_property_list_add_int(list, - obs_module_text("TransitionPointTypeFrame"), - TIMING_FRAME); - - obs_property_set_modified_callback(list, transition_point_type_modified); + obs_properties_add_path(ppts, "path", obs_module_text("VideoFile"), + OBS_PATH_FILE, FILE_FILTER, NULL); + obs_property_t *p = obs_properties_add_list( + ppts, "tp_type", obs_module_text("TransitionPointType"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_list_add_int(p, obs_module_text("TransitionPointTypeTime"), + TIMING_TIME); + obs_property_list_add_int( + p, obs_module_text("TransitionPointTypeFrame"), TIMING_FRAME); + + obs_property_set_modified_callback(p, transition_point_type_modified); obs_properties_add_int(ppts, "transition_point", - obs_module_text("TransitionPoint"), - 0, 120000, 1); + obs_module_text("TransitionPoint"), 0, 120000, + 1); - obs_property_t *monitor_list = obs_properties_add_list(ppts, - "audio_monitoring", obs_module_text("AudioMonitoring"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *monitor_list = obs_properties_add_list( + ppts, "audio_monitoring", obs_module_text("AudioMonitoring"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_list_add_int(monitor_list, - obs_module_text("AudioMonitoring.None"), - OBS_MONITORING_TYPE_NONE); + obs_module_text("AudioMonitoring.None"), + OBS_MONITORING_TYPE_NONE); + obs_property_list_add_int( + monitor_list, obs_module_text("AudioMonitoring.MonitorOnly"), + OBS_MONITORING_TYPE_MONITOR_ONLY); obs_property_list_add_int(monitor_list, - obs_module_text("AudioMonitoring.MonitorOnly"), - OBS_MONITORING_TYPE_MONITOR_ONLY); - obs_property_list_add_int(monitor_list, - obs_module_text("AudioMonitoring.Both"), - OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT); - - obs_property_t *audio_fade_style = obs_properties_add_list(ppts, - "audio_fade_style", obs_module_text("AudioFadeStyle"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); - obs_property_list_add_int(audio_fade_style, - obs_module_text("AudioFadeStyle.FadeOutFadeIn"), - FADE_STYLE_FADE_OUT_FADE_IN); + obs_module_text("AudioMonitoring.Both"), + OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT); + + obs_property_t *audio_fade_style = obs_properties_add_list( + ppts, "audio_fade_style", obs_module_text("AudioFadeStyle"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_list_add_int( + audio_fade_style, + obs_module_text("AudioFadeStyle.FadeOutFadeIn"), + FADE_STYLE_FADE_OUT_FADE_IN); obs_property_list_add_int(audio_fade_style, - obs_module_text("AudioFadeStyle.CrossFade"), - FADE_STYLE_CROSS_FADE); + obs_module_text("AudioFadeStyle.CrossFade"), + FADE_STYLE_CROSS_FADE); UNUSED_PARAMETER(data); return ppts; @@ -366,5 +368,5 @@ .enum_active_sources = stinger_enum_active_sources, .enum_all_sources = stinger_enum_all_sources, .transition_start = stinger_transition_start, - .transition_stop = stinger_transition_stop + .transition_stop = stinger_transition_stop, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-transitions/transition-swipe.c -> obs-studio-24.0.0.tar.xz/plugins/obs-transitions/transition-swipe.c
Changed
@@ -15,7 +15,7 @@ }; #define S_DIRECTION "direction" -#define S_SWIPE_IN "swipe_in" +#define S_SWIPE_IN "swipe_in" static const char *swipe_get_name(void *type_data) { @@ -76,7 +76,7 @@ } static void swipe_callback(void *data, gs_texture_t *a, gs_texture_t *b, - float t, uint32_t cx, uint32_t cy) + float t, uint32_t cx, uint32_t cy) { struct swipe_info *swipe = data; struct vec2 swipe_val = swipe->dir; @@ -116,12 +116,13 @@ } static bool swipe_audio_render(void *data, uint64_t *ts_out, - struct obs_source_audio_mix *audio, uint32_t mixers, - size_t channels, size_t sample_rate) + struct obs_source_audio_mix *audio, + uint32_t mixers, size_t channels, + size_t sample_rate) { struct swipe_info *swipe = data; - return obs_transition_audio_render(swipe->source, ts_out, - audio, mixers, channels, sample_rate, mix_a, mix_b); + return obs_transition_audio_render(swipe->source, ts_out, audio, mixers, + channels, sample_rate, mix_a, mix_b); } static obs_properties_t *swipe_properties(void *data) @@ -130,16 +131,16 @@ obs_property_t *p; p = obs_properties_add_list(ppts, S_DIRECTION, - obs_module_text("Direction"), OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_STRING); + obs_module_text("Direction"), + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, obs_module_text("Direction.Left"), - "left"); + "left"); obs_property_list_add_string(p, obs_module_text("Direction.Right"), - "right"); - obs_property_list_add_string(p, obs_module_text("Direction.Up"), - "up"); + "right"); + obs_property_list_add_string(p, obs_module_text("Direction.Up"), "up"); obs_property_list_add_string(p, obs_module_text("Direction.Down"), - "down"); + "down"); obs_properties_add_bool(ppts, S_SWIPE_IN, obs_module_text("SwipeIn")); @@ -156,5 +157,5 @@ .update = swipe_update, .video_render = swipe_video_render, .audio_render = swipe_audio_render, - .get_properties = swipe_properties + .get_properties = swipe_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/obs-vst/VSTPlugin.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-vst/VSTPlugin.cpp
Changed
@@ -34,26 +34,26 @@ VSTPlugin::~VSTPlugin() { - int numChannels = VST_MAX_CHANNELS; - - for (int channel = 0; channel < numChannels; channel++) { - if (inputs[channel]) { - free(inputs[channel]); - inputs[channel] = NULL; - } - if (outputs[channel]) { - free(outputs[channel]); - outputs[channel] = NULL; - } - } - if (inputs) { - free(inputs); - inputs = NULL; - } - if (outputs) { - free(outputs); - outputs = NULL; - } + int numChannels = VST_MAX_CHANNELS; + + for (int channel = 0; channel < numChannels; channel++) { + if (inputs[channel]) { + free(inputs[channel]); + inputs[channel] = NULL; + } + if (outputs[channel]) { + free(outputs[channel]); + outputs[channel] = NULL; + } + } + if (inputs) { + free(inputs); + inputs = NULL; + } + if (outputs) { + free(outputs); + outputs = NULL; + } } void VSTPlugin::loadEffectFromPath(std::string path) @@ -167,11 +167,10 @@ } if (filterName.empty()) { - editorWidget->setWindowTitle(QString("%1 - %2").arg(sourceName.c_str(), - effectName)); + editorWidget->setWindowTitle(QString("%1 - %2").arg(sourceName.c_str(), effectName)); } else { - editorWidget->setWindowTitle(QString("%1:%2 - %3").arg(sourceName.c_str(), - filterName.c_str(), effectName)); + editorWidget->setWindowTitle( + QString("%1:%2 - %3").arg(sourceName.c_str(), filterName.c_str(), effectName)); } editorWidget->show(); }
View file
obs-studio-23.2.1.tar.xz/plugins/obs-vst/headers/VSTPlugin.h -> obs-studio-24.0.0.tar.xz/plugins/obs-vst/headers/VSTPlugin.h
Changed
@@ -49,13 +49,12 @@ bool effectReady = false; - std::string sourceName; - std::string filterName; - char effectName[64]; + std::string sourceName; + std::string filterName; + char effectName[64]; // Remove below... or comment out char vendorString[64]; - #ifdef __APPLE__ CFBundleRef bundle = NULL; #elif WIN32 @@ -88,17 +87,17 @@ public: VSTPlugin(obs_source_t *sourceContext); ~VSTPlugin(); - void loadEffectFromPath(std::string path); - void unloadEffect(); - void openEditor(); - void closeEditor(); - std::string getChunk(); - void setChunk(std::string data); - void setProgram(const int programNumber); - int getProgram(); - void getSourceNames(); + void loadEffectFromPath(std::string path); + void unloadEffect(); + void openEditor(); + void closeEditor(); + std::string getChunk(); + void setChunk(std::string data); + void setProgram(const int programNumber); + int getProgram(); + void getSourceNames(); obs_audio_data *process(struct obs_audio_data *audio); - bool openInterfaceWhenActive = false; + bool openInterfaceWhenActive = false; }; #endif // OBS_STUDIO_VSTPLUGIN_H
View file
obs-studio-23.2.1.tar.xz/plugins/obs-vst/linux/EditorWidget-linux.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-vst/linux/EditorWidget-linux.cpp
Changed
@@ -52,7 +52,7 @@ screen->root_visual, /* visual */ 0, NULL /* masks, not used yet */ - ); + ); /* Map the window on the screen */ xcb_map_window(connection, window);
View file
obs-studio-23.2.1.tar.xz/plugins/obs-vst/obs-vst.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-vst/obs-vst.cpp
Changed
@@ -232,7 +232,7 @@ { obs_properties_t *props = obs_properties_create(); obs_property_t * list = obs_properties_add_list( - props, "plugin_path", PLUG_IN_NAME, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + props, "plugin_path", PLUG_IN_NAME, OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); fill_out_plugins(list);
View file
obs-studio-24.0.0.tar.xz/plugins/obs-vst/vst_header/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/plugins/obs-vst/win/EditorWidget-win.cpp -> obs-studio-24.0.0.tar.xz/plugins/obs-vst/win/EditorWidget-win.cpp
Changed
@@ -74,10 +74,7 @@ PluginRc.top = rec->top; // set rect to our window - AdjustWindowRectEx(&PluginRc, - WS_CAPTION | WS_THICKFRAME | WS_OVERLAPPEDWINDOW, - FALSE, - 0); + AdjustWindowRectEx(&PluginRc, WS_CAPTION | WS_THICKFRAME | WS_OVERLAPPEDWINDOW, FALSE, 0); // move window to apply pos MoveWindow(windowHandle,
View file
obs-studio-23.2.1.tar.xz/plugins/obs-x264/data/locale/ar-SA.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-x264/data/locale/ar-SA.ini
Changed
@@ -1,6 +1,8 @@ Bitrate="معدل النقل" CustomBufsize="استخدام حجم Buffer مخصص" -BufferSize="حجم المخزن المؤقت" +BufferSize="حجم المخزون المؤقت" +RateControl="التحكم بمعدل النقل" +CRF="CRF" KeyframeIntervalSec="الفاصل الزمني لـKeyframe (ثانية, 0=تلقائي)" CPUPreset="إعداد مسبق لاستخدام CPU (الأعلى = CPU أقل)" Profile="الملف الشخصي"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-x264/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-x264/data/locale/de-DE.ini
Changed
@@ -1,13 +1,13 @@ Bitrate="Bitrate" -CustomBufsize="Verwende benutzerdefinierte Puffergröße" +CustomBufsize="Benutzerdefinierte Puffergröße verwenden" BufferSize="Puffergröße" RateControl="Qualitäts Regulierungsmethode" CRF="CRF" -KeyframeIntervalSec="Keyframeintervall (Sekunden, 0=auto)" -CPUPreset="Prozessorauslastung-Voreinstellung (höher = weniger CPU Auslastung)" +KeyframeIntervalSec="Keyframeintervall in Sek. (0 = automatisch)" +CPUPreset="Prozessorauslastungsvoreinstellung (höher = weniger CPU‐Auslastung)" Profile="Profil" Tune="Tune" None="(Nichts)" -EncoderOptions="x264-Optionen (durch Leerzeichen getrennt)" +EncoderOptions="x264‐Optionen (durch Leerzeichen getrennt)" VFR="Variable Framerate (VFR)"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-x264/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-x264/data/locale/gl-ES.ini
Changed
@@ -1,12 +1,13 @@ -Bitrate="Velocidade de bits" -CustomBufsize="Utilizar tamaño da caché personalizado" -BufferSize="Tamaño do búfer" +Bitrate="Taxa de bits" +CustomBufsize="Utilizar tamaño personalizado da memoria temporal" +BufferSize="Tamaño da memoria temporal" +RateControl="Control da taxa" CRF="CRF" -KeyframeIntervalSec="Intervalo de fotogramas chave (segundos, 0 = auto)" +KeyframeIntervalSec="Intervalo de fotogramas clave (segundos, 0=auto)" CPUPreset="Uso predefinido da CPU (superior = menos CPU)" Profile="Perfil" Tune="Sintonizar" None="(Ningún)" EncoderOptions="Opcións x264 (separadas por un espazo)" -VFR="Velocidade de fotogramas variable (VFR)" +VFR="Taxa variábel de fotogramas (VFR)"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-x264/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/obs-x264/data/locale/sl-SI.ini
Changed
@@ -1,6 +1,13 @@ -Bitrate="Bitrate" -BufferSize="Velikost medpolnilnika" -KeyframeIntervalSec="Okvirni Interval(sekunde, 0=avtomatsko)" +Bitrate="Bitna hitrost" +CustomBufsize="Uporabi velikost medpomnilnika po meri" +BufferSize="Velikost medpomnilnika" +RateControl="Nadzor hitrosti" +CRF="CRF" +KeyframeIntervalSec="Razmik med ključnimi sličicami (s, 0=samodejno)" +CPUPreset="Prednastavitev porabe CPE-ja (višja = manj CPE-ja)" Profile="Profil" -Tune="Tune" +Tune="Uglasi" +None="(brez)" +EncoderOptions="Možnosti x264 (ločene s presledkom)" +VFR="Spremenljiva hitrost sličic"
View file
obs-studio-23.2.1.tar.xz/plugins/obs-x264/obs-x264.c -> obs-studio-24.0.0.tar.xz/plugins/obs-x264/obs-x264.c
Changed
@@ -27,31 +27,31 @@ #include <x264.h> -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[x264 encoder: '%s'] " format, \ - obs_encoder_get_name(obsx264->encoder), ##__VA_ARGS__) + obs_encoder_get_name(obsx264->encoder), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) //#define ENABLE_VFR /* ------------------------------------------------------------------------- */ struct obs_x264 { - obs_encoder_t *encoder; + obs_encoder_t *encoder; - x264_param_t params; - x264_t *context; + x264_param_t params; + x264_t *context; - DARRAY(uint8_t) packet_data; + DARRAY(uint8_t) packet_data; - uint8_t *extra_data; - uint8_t *sei; + uint8_t *extra_data; + uint8_t *sei; - size_t extra_data_size; - size_t sei_size; + size_t extra_data_size; + size_t sei_size; os_performance_token_t *performance_token; }; @@ -73,8 +73,8 @@ bfree(obsx264->sei); bfree(obsx264->extra_data); - obsx264->context = NULL; - obsx264->sei = NULL; + obsx264->context = NULL; + obsx264->sei = NULL; obsx264->extra_data = NULL; } } @@ -93,20 +93,20 @@ static void obs_x264_defaults(obs_data_t *settings) { - obs_data_set_default_int (settings, "bitrate", 2500); - obs_data_set_default_bool (settings, "use_bufsize", false); - obs_data_set_default_int (settings, "buffer_size", 2500); - obs_data_set_default_int (settings, "keyint_sec", 0); - obs_data_set_default_int (settings, "crf", 23); + obs_data_set_default_int(settings, "bitrate", 2500); + obs_data_set_default_bool(settings, "use_bufsize", false); + obs_data_set_default_int(settings, "buffer_size", 2500); + obs_data_set_default_int(settings, "keyint_sec", 0); + obs_data_set_default_int(settings, "crf", 23); #ifdef ENABLE_VFR - obs_data_set_default_bool (settings, "vfr", false); + obs_data_set_default_bool(settings, "vfr", false); #endif - obs_data_set_default_string(settings, "rate_control","CBR"); + obs_data_set_default_string(settings, "rate_control", "CBR"); - obs_data_set_default_string(settings, "preset", "veryfast"); - obs_data_set_default_string(settings, "profile", ""); - obs_data_set_default_string(settings, "tune", ""); - obs_data_set_default_string(settings, "x264opts", ""); + obs_data_set_default_string(settings, "preset", "veryfast"); + obs_data_set_default_string(settings, "profile", ""); + obs_data_set_default_string(settings, "tune", ""); + obs_data_set_default_string(settings, "x264opts", ""); } static inline void add_strings(obs_property_t *list, const char *const *strings) @@ -118,20 +118,20 @@ } #define TEXT_RATE_CONTROL obs_module_text("RateControl") -#define TEXT_BITRATE obs_module_text("Bitrate") +#define TEXT_BITRATE obs_module_text("Bitrate") #define TEXT_CUSTOM_BUF obs_module_text("CustomBufsize") -#define TEXT_BUF_SIZE obs_module_text("BufferSize") -#define TEXT_VFR obs_module_text("VFR") -#define TEXT_CRF obs_module_text("CRF") +#define TEXT_BUF_SIZE obs_module_text("BufferSize") +#define TEXT_VFR obs_module_text("VFR") +#define TEXT_CRF obs_module_text("CRF") #define TEXT_KEYINT_SEC obs_module_text("KeyframeIntervalSec") -#define TEXT_PRESET obs_module_text("CPUPreset") -#define TEXT_PROFILE obs_module_text("Profile") -#define TEXT_TUNE obs_module_text("Tune") -#define TEXT_NONE obs_module_text("None") -#define TEXT_X264_OPTS obs_module_text("EncoderOptions") +#define TEXT_PRESET obs_module_text("CPUPreset") +#define TEXT_PROFILE obs_module_text("Profile") +#define TEXT_TUNE obs_module_text("Tune") +#define TEXT_NONE obs_module_text("None") +#define TEXT_X264_OPTS obs_module_text("EncoderOptions") static bool use_bufsize_modified(obs_properties_t *ppts, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { bool use_bufsize = obs_data_get_bool(settings, "use_bufsize"); const char *rc = obs_data_get_string(settings, "rate_control"); @@ -143,7 +143,7 @@ } static bool rate_control_modified(obs_properties_t *ppts, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { const char *rc = obs_data_get_string(settings, "rate_control"); bool use_bufsize = obs_data_get_bool(settings, "use_bufsize"); @@ -171,7 +171,8 @@ obs_property_t *p; list = obs_properties_add_list(props, "rate_control", TEXT_RATE_CONTROL, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(list, "CBR", "CBR"); obs_property_list_add_string(list, "ABR", "ABR"); obs_property_list_add_string(list, "VBR", "VBR"); @@ -179,32 +180,35 @@ obs_property_set_modified_callback(list, rate_control_modified); - p = obs_properties_add_int(props, "bitrate", - TEXT_BITRATE, 50, 10000000, 50); + p = obs_properties_add_int(props, "bitrate", TEXT_BITRATE, 50, 10000000, + 50); obs_property_int_set_suffix(p, " Kbps"); p = obs_properties_add_bool(props, "use_bufsize", TEXT_CUSTOM_BUF); obs_property_set_modified_callback(p, use_bufsize_modified); - obs_properties_add_int(props, "buffer_size", TEXT_BUF_SIZE, 0, - 10000000, 1); + obs_properties_add_int(props, "buffer_size", TEXT_BUF_SIZE, 0, 10000000, + 1); obs_properties_add_int(props, "crf", TEXT_CRF, 0, 51, 1); obs_properties_add_int(props, "keyint_sec", TEXT_KEYINT_SEC, 0, 20, 1); list = obs_properties_add_list(props, "preset", TEXT_PRESET, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); add_strings(list, x264_preset_names); list = obs_properties_add_list(props, "profile", TEXT_PROFILE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(list, TEXT_NONE, ""); obs_property_list_add_string(list, "baseline", "baseline"); obs_property_list_add_string(list, "main", "main"); obs_property_list_add_string(list, "high", "high"); list = obs_properties_add_list(props, "tune", TEXT_TUNE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(list, TEXT_NONE, ""); add_strings(list, x264_tune_names); @@ -213,7 +217,7 @@ #endif obs_properties_add_text(props, "x264opts", TEXT_X264_OPTS, - OBS_TEXT_DEFAULT); + OBS_TEXT_DEFAULT); return props; } @@ -226,17 +230,16 @@ return false; assign = strchr(param, '='); - if (!assign || !*assign || !*(assign+1)) + if (!assign || !*assign || !*(assign + 1)) return false; - *name = bstrdup_n(param, assign-param); - *value = assign+1; + *name = bstrdup_n(param, assign - param); + *value = assign + 1; return true; } -static const char *validate(struct obs_x264 *obsx264, - const char *val, const char *name, - const char *const *list) +static const char *validate(struct obs_x264 *obsx264, const char *val, + const char *name, const char *const *list) { if (!val || !*val) return val; @@ -253,31 +256,31 @@ } static void override_base_param(struct obs_x264 *obsx264, const char *param, - char **preset, char **profile, char **tune) + char **preset, char **profile, char **tune) { - char *name; + char *name; const char *val; if (getparam(param, &name, &val)) { if (astrcmpi(name, "preset") == 0) { - const char *valid_name = validate(obsx264, val, - "preset", x264_preset_names); + const char *valid_name = validate( + obsx264, val, "preset", x264_preset_names); if (valid_name) { bfree(*preset); *preset = bstrdup(val); } } else if (astrcmpi(name, "profile") == 0) { - const char *valid_name = validate(obsx264, val, - "profile", x264_profile_names); + const char *valid_name = validate( + obsx264, val, "profile", x264_profile_names); if (valid_name) { bfree(*profile); *profile = bstrdup(val); } } else if (astrcmpi(name, "tune") == 0) { - const char *valid_name = validate(obsx264, val, - "tune", x264_tune_names); + const char *valid_name = + validate(obsx264, val, "tune", x264_tune_names); if (valid_name) { bfree(*tune); *tune = bstrdup(val); @@ -289,29 +292,28 @@ } static inline void override_base_params(struct obs_x264 *obsx264, char **params, - char **preset, char **profile, char **tune) + char **preset, char **profile, + char **tune) { while (*params) - override_base_param(obsx264, *(params++), - preset, profile, tune); + override_base_param(obsx264, *(params++), preset, profile, + tune); } #define OPENCL_ALIAS "opencl_is_experimental_and_potentially_unstable" static inline void set_param(struct obs_x264 *obsx264, const char *param) { - char *name; + char *name; const char *val; if (getparam(param, &name, &val)) { - if (strcmp(name, "preset") != 0 && - strcmp(name, "profile") != 0 && - strcmp(name, "tune") != 0 && - strcmp(name, "fps") != 0 && + if (strcmp(name, "preset") != 0 && + strcmp(name, "profile") != 0 && strcmp(name, "tune") != 0 && + strcmp(name, "fps") != 0 && strcmp(name, "force-cfr") != 0 && - strcmp(name, "width") != 0 && - strcmp(name, "height") != 0 && - strcmp(name, "opencl") != 0) { + strcmp(name, "width") != 0 && strcmp(name, "height") != 0 && + strcmp(name, "opencl") != 0) { if (strcmp(name, OPENCL_ALIAS) == 0) strcpy(name, "opencl"); if (x264_param_parse(&obsx264->params, name, val) != 0) @@ -323,7 +325,7 @@ } static inline void apply_x264_profile(struct obs_x264 *obsx264, - const char *profile) + const char *profile) { if (!obsx264->context && profile && *profile) { int ret = x264_param_apply_profile(&obsx264->params, profile); @@ -333,19 +335,19 @@ } static inline const char *validate_preset(struct obs_x264 *obsx264, - const char *preset) + const char *preset) { - const char *new_preset = validate(obsx264, preset, "preset", - x264_preset_names); + const char *new_preset = + validate(obsx264, preset, "preset", x264_preset_names); return new_preset ? new_preset : "veryfast"; } -static bool reset_x264_params(struct obs_x264 *obsx264, - const char *preset, const char *tune) +static bool reset_x264_params(struct obs_x264 *obsx264, const char *preset, + const char *tune) { - int ret = x264_param_default_preset(&obsx264->params, - validate_preset(obsx264, preset), - validate(obsx264, tune, "tune", x264_tune_names)); + int ret = x264_param_default_preset( + &obsx264->params, validate_preset(obsx264, preset), + validate(obsx264, tune, "tune", x264_tune_names)); return ret == 0; } @@ -373,7 +375,7 @@ } static inline int get_x264_cs_val(enum video_colorspace cs, - const char *const names[]) + const char *const names[]) { const char *name = get_x264_colorspace_name(cs); int idx = 0; @@ -395,7 +397,7 @@ }; static void update_params(struct obs_x264 *obsx264, obs_data_t *settings, - char **params) + char **params, bool update) { video_t *video = obs_encoder_video(obsx264->encoder); const struct video_output_info *voi = video_output_get_info(video); @@ -407,21 +409,22 @@ obs_x264_video_info(obsx264, &info); - const char *rate_control = obs_data_get_string(settings, "rate_control"); + const char *rate_control = + obs_data_get_string(settings, "rate_control"); - int bitrate = (int)obs_data_get_int(settings, "bitrate"); - int buffer_size = (int)obs_data_get_int(settings, "buffer_size"); - int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec"); - int crf = (int)obs_data_get_int(settings, "crf"); - int width = (int)obs_encoder_get_width(obsx264->encoder); - int height = (int)obs_encoder_get_height(obsx264->encoder); - int bf = (int)obs_data_get_int(settings, "bf"); + int bitrate = (int)obs_data_get_int(settings, "bitrate"); + int buffer_size = (int)obs_data_get_int(settings, "buffer_size"); + int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec"); + int crf = (int)obs_data_get_int(settings, "crf"); + int width = (int)obs_encoder_get_width(obsx264->encoder); + int height = (int)obs_encoder_get_height(obsx264->encoder); + int bf = (int)obs_data_get_int(settings, "bf"); bool use_bufsize = obs_data_get_bool(settings, "use_bufsize"); - bool cbr_override= obs_data_get_bool(settings, "cbr"); + bool cbr_override = obs_data_get_bool(settings, "cbr"); enum rate_control rc; #ifdef ENABLE_VFR - bool vfr = obs_data_get_bool(settings, "vfr"); + bool vfr = obs_data_get_bool(settings, "vfr"); #endif /* XXX: "cbr" setting has been deprecated */ @@ -459,20 +462,20 @@ buffer_size = bitrate; #ifdef ENABLE_VFR - obsx264->params.b_vfr_input = vfr; + obsx264->params.b_vfr_input = vfr; #else - obsx264->params.b_vfr_input = false; + obsx264->params.b_vfr_input = false; #endif obsx264->params.rc.i_vbv_max_bitrate = bitrate; obsx264->params.rc.i_vbv_buffer_size = buffer_size; - obsx264->params.rc.i_bitrate = bitrate; - obsx264->params.i_width = width; - obsx264->params.i_height = height; - obsx264->params.i_fps_num = voi->fps_num; - obsx264->params.i_fps_den = voi->fps_den; - obsx264->params.pf_log = log_x264; - obsx264->params.p_log_private = obsx264; - obsx264->params.i_log_level = X264_LOG_WARNING; + obsx264->params.rc.i_bitrate = bitrate; + obsx264->params.i_width = width; + obsx264->params.i_height = height; + obsx264->params.i_fps_num = voi->fps_num; + obsx264->params.i_fps_den = voi->fps_den; + obsx264->params.pf_log = log_x264; + obsx264->params.p_log_private = obsx264; + obsx264->params.i_log_level = X264_LOG_WARNING; if (obs_data_has_user_value(settings, "bf")) obsx264->params.i_bframe = bf; @@ -483,13 +486,12 @@ get_x264_cs_val(info.colorspace, x264_colmatrix_names); obsx264->params.vui.i_colorprim = get_x264_cs_val(info.colorspace, x264_colorprim_names); - obsx264->params.vui.b_fullrange = - info.range == VIDEO_RANGE_FULL; + obsx264->params.vui.b_fullrange = info.range == VIDEO_RANGE_FULL; /* use the new filler method for CBR to allow real-time adjusting of * the bitrate */ if (rc == RATE_CONTROL_CBR || rc == RATE_CONTROL_ABR) { - obsx264->params.rc.i_rc_method = X264_RC_ABR; + obsx264->params.rc.i_rc_method = X264_RC_ABR; if (rc == RATE_CONTROL_CBR) { #if X264_BUILD >= 139 @@ -499,7 +501,7 @@ #endif } } else { - obsx264->params.rc.i_rc_method = X264_RC_CRF; + obsx264->params.rc.i_rc_method = X264_RC_CRF; } obsx264->params.rc.f_rf_constant = (float)crf; @@ -516,30 +518,30 @@ while (*params) set_param(obsx264, *(params++)); - info("settings:\n" - "\trate_control: %s\n" - "\tbitrate: %d\n" - "\tbuffer size: %d\n" - "\tcrf: %d\n" - "\tfps_num: %d\n" - "\tfps_den: %d\n" - "\twidth: %d\n" - "\theight: %d\n" - "\tkeyint: %d\n", - rate_control, - obsx264->params.rc.i_vbv_max_bitrate, - obsx264->params.rc.i_vbv_buffer_size, - (int)obsx264->params.rc.f_rf_constant, - voi->fps_num, voi->fps_den, - width, height, - obsx264->params.i_keyint_max); + if (!update) { + info("settings:\n" + "\trate_control: %s\n" + "\tbitrate: %d\n" + "\tbuffer size: %d\n" + "\tcrf: %d\n" + "\tfps_num: %d\n" + "\tfps_den: %d\n" + "\twidth: %d\n" + "\theight: %d\n" + "\tkeyint: %d\n", + rate_control, obsx264->params.rc.i_vbv_max_bitrate, + obsx264->params.rc.i_vbv_buffer_size, + (int)obsx264->params.rc.f_rf_constant, voi->fps_num, + voi->fps_den, width, height, obsx264->params.i_keyint_max); + } } -static bool update_settings(struct obs_x264 *obsx264, obs_data_t *settings) +static bool update_settings(struct obs_x264 *obsx264, obs_data_t *settings, + bool update) { - char *preset = bstrdup(obs_data_get_string(settings, "preset")); - char *profile = bstrdup(obs_data_get_string(settings, "profile")); - char *tune = bstrdup(obs_data_get_string(settings, "tune")); + char *preset = bstrdup(obs_data_get_string(settings, "preset")); + char *profile = bstrdup(obs_data_get_string(settings, "profile")); + char *tune = bstrdup(obs_data_get_string(settings, "tune")); const char *opts = obs_data_get_string(settings, "x264opts"); char **paramlist; @@ -547,22 +549,26 @@ paramlist = strlist_split(opts, ' ', false); - blog(LOG_INFO, "---------------------------------"); + if (!update) + blog(LOG_INFO, "---------------------------------"); if (!obsx264->context) { - override_base_params(obsx264, paramlist, - &preset, &profile, &tune); + override_base_params(obsx264, paramlist, &preset, &profile, + &tune); - if (preset && *preset) info("preset: %s", preset); - if (profile && *profile) info("profile: %s", profile); - if (tune && *tune) info("tune: %s", tune); + if (preset && *preset) + info("preset: %s", preset); + if (profile && *profile) + info("profile: %s", profile); + if (tune && *tune) + info("tune: %s", tune); success = reset_x264_params(obsx264, preset, tune); } if (success) { - update_params(obsx264, settings, paramlist); - if (opts && *opts) + update_params(obsx264, settings, paramlist, update); + if (opts && *opts && !update) info("custom settings: %s", opts); if (!obsx264->context) @@ -582,7 +588,7 @@ static bool obs_x264_update(void *data, obs_data_t *settings) { struct obs_x264 *obsx264 = data; - bool success = update_settings(obsx264, settings); + bool success = update_settings(obsx264, settings, true); int ret; if (success) { @@ -597,8 +603,8 @@ static void load_headers(struct obs_x264 *obsx264) { - x264_nal_t *nals; - int nal_count; + x264_nal_t *nals; + int nal_count; DARRAY(uint8_t) header; DARRAY(uint8_t) sei; @@ -608,19 +614,19 @@ x264_encoder_headers(obsx264->context, &nals, &nal_count); for (int i = 0; i < nal_count; i++) { - x264_nal_t *nal = nals+i; + x264_nal_t *nal = nals + i; if (nal->i_type == NAL_SEI) da_push_back_array(sei, nal->p_payload, nal->i_payload); else da_push_back_array(header, nal->p_payload, - nal->i_payload); + nal->i_payload); } - obsx264->extra_data = header.array; + obsx264->extra_data = header.array; obsx264->extra_data_size = header.num; - obsx264->sei = sei.array; - obsx264->sei_size = sei.num; + obsx264->sei = sei.array; + obsx264->sei_size = sei.num; } static void *obs_x264_create(obs_data_t *settings, obs_encoder_t *encoder) @@ -628,7 +634,7 @@ struct obs_x264 *obsx264 = bzalloc(sizeof(struct obs_x264)); obsx264->encoder = encoder; - if (update_settings(obsx264, settings)) { + if (update_settings(obsx264, settings, false)) { obsx264->context = x264_encoder_open(&obsx264->params); if (obsx264->context == NULL) @@ -651,29 +657,30 @@ } static void parse_packet(struct obs_x264 *obsx264, - struct encoder_packet *packet, x264_nal_t *nals, - int nal_count, x264_picture_t *pic_out) + struct encoder_packet *packet, x264_nal_t *nals, + int nal_count, x264_picture_t *pic_out) { - if (!nal_count) return; + if (!nal_count) + return; da_resize(obsx264->packet_data, 0); for (int i = 0; i < nal_count; i++) { - x264_nal_t *nal = nals+i; + x264_nal_t *nal = nals + i; da_push_back_array(obsx264->packet_data, nal->p_payload, - nal->i_payload); + nal->i_payload); } - packet->data = obsx264->packet_data.array; - packet->size = obsx264->packet_data.num; - packet->type = OBS_ENCODER_VIDEO; - packet->pts = pic_out->i_pts; - packet->dts = pic_out->i_dts; - packet->keyframe = pic_out->b_keyframe != 0; + packet->data = obsx264->packet_data.array; + packet->size = obsx264->packet_data.num; + packet->type = OBS_ENCODER_VIDEO; + packet->pts = pic_out->i_pts; + packet->dts = pic_out->i_dts; + packet->keyframe = pic_out->b_keyframe != 0; } static inline void init_pic_data(struct obs_x264 *obsx264, x264_picture_t *pic, - struct encoder_frame *frame) + struct encoder_frame *frame) { x264_picture_init(pic); @@ -689,18 +696,19 @@ for (int i = 0; i < pic->img.i_plane; i++) { pic->img.i_stride[i] = (int)frame->linesize[i]; - pic->img.plane[i] = frame->data[i]; + pic->img.plane[i] = frame->data[i]; } } static bool obs_x264_encode(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, + bool *received_packet) { struct obs_x264 *obsx264 = data; - x264_nal_t *nals; - int nal_count; - int ret; - x264_picture_t pic, pic_out; + x264_nal_t *nals; + int nal_count; + int ret; + x264_picture_t pic, pic_out; if (!frame || !packet || !received_packet) return false; @@ -709,7 +717,7 @@ init_pic_data(obsx264, &pic, frame); ret = x264_encoder_encode(obsx264->context, &nals, &nal_count, - (frame ? &pic : NULL), &pic_out); + (frame ? &pic : NULL), &pic_out); if (ret < 0) { warn("encode failed"); return false; @@ -729,7 +737,7 @@ return false; *extra_data = obsx264->extra_data; - *size = obsx264->extra_data_size; + *size = obsx264->extra_data_size; return true; } @@ -740,15 +748,14 @@ if (!obsx264->context) return false; - *sei = obsx264->sei; + *sei = obsx264->sei; *size = obsx264->sei_size; return true; } static inline bool valid_format(enum video_format format) { - return format == VIDEO_FORMAT_I420 || - format == VIDEO_FORMAT_NV12 || + return format == VIDEO_FORMAT_I420 || format == VIDEO_FORMAT_NV12 || format == VIDEO_FORMAT_I444; } @@ -760,25 +767,26 @@ pref_format = obs_encoder_get_preferred_video_format(obsx264->encoder); if (!valid_format(pref_format)) { - pref_format = valid_format(info->format) ? - info->format : VIDEO_FORMAT_NV12; + pref_format = valid_format(info->format) ? info->format + : VIDEO_FORMAT_NV12; } info->format = pref_format; } struct obs_encoder_info obs_x264_encoder = { - .id = "obs_x264", - .type = OBS_ENCODER_VIDEO, - .codec = "h264", - .get_name = obs_x264_getname, - .create = obs_x264_create, - .destroy = obs_x264_destroy, - .encode = obs_x264_encode, - .update = obs_x264_update, + .id = "obs_x264", + .type = OBS_ENCODER_VIDEO, + .codec = "h264", + .get_name = obs_x264_getname, + .create = obs_x264_create, + .destroy = obs_x264_destroy, + .encode = obs_x264_encode, + .update = obs_x264_update, .get_properties = obs_x264_props, - .get_defaults = obs_x264_defaults, + .get_defaults = obs_x264_defaults, .get_extra_data = obs_x264_extra_data, - .get_sei_data = obs_x264_sei, - .get_video_info = obs_x264_video_info + .get_sei_data = obs_x264_sei, + .get_video_info = obs_x264_video_info, + .caps = OBS_ENCODER_CAP_DYN_BITRATE, };
View file
obs-studio-24.0.0.tar.xz/plugins/rtmp-services/data/locale/bg-BG.ini
Added
@@ -0,0 +1,9 @@ +Service="Услуга" +Server="Сървър" +Server.Auto="Автоматично (препоръчва се)" +StreamKey="Ключ за поточно излъчване" +UseAuth="Използване на удостоверение" +Username="Потребителско име" +Password="Парола" +ShowAll="Показване на всички услуги" +
View file
obs-studio-23.2.1.tar.xz/plugins/rtmp-services/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/rtmp-services/data/locale/de-DE.ini
Changed
@@ -1,4 +1,4 @@ -StreamingServices="Streaming-Plattformen" +StreamingServices="Streaming‐Plattformen" CustomStreamingServer="Benutzerdefinierter Streamingserver" Service="Plattform" Server="Server"
View file
obs-studio-24.0.0.tar.xz/plugins/rtmp-services/data/locale/fa-IR.ini
Added
@@ -0,0 +1,11 @@ +StreamingServices="سرویس پخش زنده" +CustomStreamingServer="سرویس پخش زنده جریانی" +Service="سرویس" +Server="سرور" +Server.Auto="خودکار (پیشنهاد شده)" +StreamKey="کلید پخش زنده" +UseAuth="استفاده از تایید اعتبار" +Username="نام کاربری" +Password="رمزعبور" +ShowAll="همه سرویس ها را نمایش بده" +
View file
obs-studio-23.2.1.tar.xz/plugins/rtmp-services/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/rtmp-services/data/locale/gl-ES.ini
Changed
@@ -1,8 +1,9 @@ -StreamingServices="Servizos de retransmisión" -CustomStreamingServer="Presonalizar o servidor de retranmisión" +StreamingServices="Servizos de emisións" +CustomStreamingServer="Personalizar o servidor de emisións" Service="Servizo" Server="Servidor" -StreamKey="Chave de retransmisión" +Server.Auto="Automático (recomendado)" +StreamKey="Clave da emisión" UseAuth="Usar a autenticación" Username="Nome de usuario" Password="Contrasinal"
View file
obs-studio-23.2.1.tar.xz/plugins/rtmp-services/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/rtmp-services/data/locale/sl-SI.ini
Changed
@@ -1,6 +1,11 @@ -StreamingServices="Storitev oddajanja" -CustomStreamingServer="Streming Server po želji" +StreamingServices="Storitve pretakanja" +CustomStreamingServer="Strežnik pretakanja po meri" Service="Storitev" Server="Strežnik" +Server.Auto="Samodejno (priporočeno)" StreamKey="Ključ pretoka" +UseAuth="Uporabi overitev" +Username="Uporabniško ime" +Password="Geslo" +ShowAll="Prikaži vse storitve"
View file
obs-studio-23.2.1.tar.xz/plugins/rtmp-services/data/package.json -> obs-studio-24.0.0.tar.xz/plugins/rtmp-services/data/package.json
Changed
@@ -1,10 +1,10 @@ { "url": "https://obsproject.com/obs2_update/rtmp-services", - "version": 107, + "version": 112, "files": [ { "name": "services.json", - "version": 107 + "version": 112 } ] }
View file
obs-studio-23.2.1.tar.xz/plugins/rtmp-services/data/services.json -> obs-studio-24.0.0.tar.xz/plugins/rtmp-services/data/services.json
Changed
@@ -70,6 +70,10 @@ "url": "rtmp://live-mil.twitch.tv/app" }, { + "name": "EU: Norway, Oslo", + "url": "rtmp://live-osl.twitch.tv/app" + }, + { "name": "EU: Paris, FR", "url": "rtmp://live-cdg.twitch.tv/app" }, @@ -214,7 +218,6 @@ }, { "name": "Smashcast", - "common": true, "servers": [ { "name": "Default", @@ -462,21 +465,6 @@ } }, { - "name": "GamePlank", - "servers": [ - { - "name": "Primary", - "url": "rtmp://live.gameplank.tv/go" - } - ], - "recommended": { - "keyint": 1, - "profile": "main", - "max video bitrate": 2500, - "max audio bitrate": 160 - } - }, - { "name": "Web.TV", "servers": [ { @@ -574,21 +562,6 @@ ] }, { - "name": "DJlive.pl", - "servers": [ - { - "name": "Default", - "url": "rtmp://live.djlive.pl/live" - } - ], - "recommended": { - "keyint": 1, - "profile": "high", - "max video bitrate": 1300, - "max audio bitrate": 320 - } - }, - { "name": "Facebook Live", "common": true, "servers": [ @@ -617,63 +590,83 @@ }, { "name": "EU-West (London, GB)", - "url": "rtmp://eu-london.restream.io/live" + "url": "rtmp://london.restream.io/live" }, { "name": "EU-West (Amsterdam, NL)", - "url": "rtmp://eu-ams.restream.io/live" + "url": "rtmp://amsterdam.restream.io/live" }, { "name": "EU-West (Luxembourg)", - "url": "rtmp://eu-luxembourg.restream.io/live" + "url": "rtmp://luxembourg.restream.io/live" }, { "name": "EU-West (Paris, FR)", - "url": "rtmp://eu-paris.restream.io/live" + "url": "rtmp://paris.restream.io/live" + }, + { + "name": "EU-West (Milan, IT)", + "url": "rtmp://milan.restream.io/live" }, { "name": "EU-Central (Frankfurt, DE)", - "url": "rtmp://eu-central.restream.io/live" + "url": "rtmp://frankfurt.restream.io/live" }, { "name": "EU-East (Falkenstein, DE)", - "url": "rtmp://eu-east.restream.io/live" + "url": "rtmp://falkenstein.restream.io/live" }, { "name": "EU-South (Madrid, Spain)", - "url": "rtmp://eu-madrid.restream.io/live" + "url": "rtmp://madrid.restream.io/live" }, { "name": "Russia (Moscow)", - "url": "rtmp://ru.restream.io/live" + "url": "rtmp://moscow.restream.io/live" + }, + { + "name": "Turkey (Istanbul)", + "url": "rtmp://istanbul.restream.io/live" + }, + { + "name": "Israel (Tel Aviv)", + "url": "rtmp://telaviv.restream.io/live" }, { "name": "US-West (Seattle, WA)", - "url": "rtmp://us-seattle.restream.io/live" + "url": "rtmp://seattle.restream.io/live" }, { "name": "US-West (San Jose, CA)", - "url": "rtmp://us-west.restream.io/live" + "url": "rtmp://sanjose.restream.io/live" }, { "name": "US-Central (Dallas, TX)", - "url": "rtmp://us-central.restream.io/live" + "url": "rtmp://dallas.restream.io/live" }, { "name": "US-East (Washington, DC)", - "url": "rtmp://us-east.restream.io/live" + "url": "rtmp://washington.restream.io/live" }, { "name": "US-East (Miami, FL)", - "url": "rtmp://us-miami.restream.io/live" + "url": "rtmp://miami.restream.io/live" + }, + { + "name": "US-East (Chicago, IL)", + "url": "rtmp://chicago.restream.io/live" }, { "name": "NA-East (Toronto, Canada)", - "url": "rtmp://na-toronto.restream.io/live" + "url": "rtmp://toronto.restream.io/live" }, { "name": "SA (Saint Paul, Brazil)", - "url": "rtmp://sa.restream.io/live" + "url": "rtmp://saopaulo.restream.io/live" + }, + { + "name": "India (Bangalore)", + "url": "rtmp://bangalore.restream.io/live" }, { "name": "Asia (Singapore)", @@ -688,12 +681,8 @@ "url": "rtmp://tokyo.restream.io/live" }, { - "name": "India (Bangalore)", - "url": "rtmp://india.restream.io/live" - }, - { "name": "Australia (Sydney)", - "url": "rtmp://au.restream.io/live" + "url": "rtmp://sydney.restream.io/live" } ], "recommended": { @@ -710,63 +699,83 @@ }, { "name": "EU-West (London, GB)", - "url": "eu-london.restream.io" + "url": "london.restream.io" }, { "name": "EU-West (Amsterdam, NL)", - "url": "eu-ams.restream.io" + "url": "amsterdam.restream.io" }, { "name": "EU-West (Luxembourg)", - "url": "eu-luxembourg.restream.io" + "url": "luxembourg.restream.io" }, { "name": "EU-West (Paris, FR)", - "url": "eu-paris.restream.io" + "url": "paris.restream.io" + }, + { + "name": "EU-West (Milan, IT)", + "url": "milan.restream.io" }, { "name": "EU-Central (Frankfurt, DE)", - "url": "eu-central.restream.io" + "url": "frankfurt.restream.io" }, { "name": "EU-East (Falkenstein, DE)", - "url": "eu-east.restream.io" + "url": "falkenstein.restream.io" }, { "name": "EU-South (Madrid, Spain)", - "url": "eu-madrid.restream.io" + "url": "madrid.restream.io" }, { "name": "Russia (Moscow)", - "url": "ru.restream.io" + "url": "moscow.restream.io" + }, + { + "name": "Turkey (Istanbul)", + "url": "istanbul.restream.io" + }, + { + "name": "Israel (Tel Aviv)", + "url": "telaviv.restream.io" }, { "name": "US-West (Seattle, WA)", - "url": "us-seattle.restream.io" + "url": "seattle.restream.io" }, { "name": "US-West (San Jose, CA)", - "url": "us-west.restream.io" + "url": "sanjose.restream.io" }, { "name": "US-Central (Dallas, TX)", - "url": "us-central.restream.io" + "url": "dallas.restream.io" }, { "name": "US-East (Washington, DC)", - "url": "us-east.restream.io" + "url": "washington.restream.io" }, { "name": "US-East (Miami, FL)", - "url": "us-miami.restream.io" + "url": "miami.restream.io" + }, + { + "name": "US-East (Chicago, IL)", + "url": "chicago.restream.io" }, { "name": "NA-East (Toronto, Canada)", - "url": "na-toronto.restream.io" + "url": "toronto.restream.io" }, { "name": "SA (Saint Paul, Brazil)", - "url": "sa.restream.io" + "url": "saopaulo.restream.io" + }, + { + "name": "India (Bangalore)", + "url": "bangalore.restream.io" }, { "name": "Asia (Singapore)", @@ -782,7 +791,7 @@ }, { "name": "Australia (Sydney)", - "url": "au.restream.io" + "url": "sydney.restream.io" } ], "recommended": { @@ -798,8 +807,12 @@ "name": "GameTips.TV", "servers": [ { - "name": "Server Iran", + "name": "Iran - Rasht", "url": "rtmp://rtmp.cdn.server1.gametips.tv:1935/hls" + }, + { + "name": "Germany - Falkenstein/Vogtland", + "url": "rtmp://rtmp.cdn.server2.gametips.tv:1935/hls" } ] }, @@ -1084,6 +1097,23 @@ ] }, { + "name": "Stripchat", + "servers": [ + { + "name": "Auto", + "url": "rtmp://s-sd.stripcdn.com/ext" + } + ], + "recommended": { + "keyint": 2, + "profile": "main", + "bframes": 0, + "max video bitrate": 6000, + "max audio bitrate": 128, + "x264opts": "tune=zerolatency" + } + }, + { "name": "Chaturbate", "servers": [ { @@ -1230,10 +1260,6 @@ { "name": "Australia East", "url": "rtmp://ingest-au-east.a.switchboard.zone/live" - }, - { - "name": "Asia Central", - "url": "rtmp://ingest-as-central.a.switchboard.zone/live" } ] }, @@ -1254,38 +1280,6 @@ } }, { - "name": "Stream.me", - "common": false, - "servers": [ - { - "name": "US, Central", - "url": "rtmp://uc-origin.stream.me/origin" - }, - { - "name": "US, East", - "url": "rtmp://ue-origin.stream.me/origin" - }, - { - "name": "US, West", - "url": "rtmp://uw-origin.stream.me/origin" - }, - { - "name": "Europe, West", - "url": "rtmp://ew-origin.stream.me/origin" - }, - { - "name": "Asia, East", - "url": "rtmp://ae-origin.stream.me/origin" - } - ], - "recommended": { - "keyint": 2, - "profile": "main", - "max video bitrate": 20000, - "max audio bitrate": 192 - } - }, - { "name": "Eventials", "servers": [ { @@ -1505,6 +1499,66 @@ "bframes": 0, "x264opts": "tune=zerolatency" } + }, + { + "name": "Steam", + "common": false, + "servers": [ + { + "name": "Chicago, US", + "url": "rtmp://ingest-any-ord1.broadcast.steamcontent.com/app" + }, + { + "name": "Seattle, US", + "url": "rtmp://ingest-any-sea1.broadcast.steamcontent.com/app" + }, + { + "name": "Los Angeles, US", + "url": "rtmp://ingest-any-lax1.broadcast.steamcontent.com/app" + }, + { + "name": "Washington DC, US", + "url": "rtmp://ingest-any-iad1.broadcast.steamcontent.com/app" + }, + { + "name": "Frankfurt, DE", + "url": "rtmp://ingest-any-fra1.broadcast.steamcontent.com/app" + }, + { + "name": "London, UK", + "url": "rtmp://ingest-any-lhr1.broadcast.steamcontent.com/app" + }, + { + "name": "Stockholm, SE", + "url": "rtmp://ingest-any-sto1.broadcast.steamcontent.com/app" + }, + { + "name": "Tokyo, JP", + "url": "rtmp://ingest-any-tyo1.broadcast.steamcontent.com/app" + }, + { + "name": "Hong Kong, HK", + "url": "rtmp://ingest-any-hkg1.broadcast.steamcontent.com/app" + }, + { + "name": "Singapore, SG", + "url": "rtmp://ingest-any-sgp1.broadcast.steamcontent.com/app" + }, + { + "name": "Sydney, AU", + "url": "rtmp://ingest-any-syd1.broadcast.steamcontent.com/app" + }, + { + "name": "São Paulo, BR", + "url": "rtmp://ingest-any-gru1.broadcast.steamcontent.com/app" + } + ], + "recommended": { + "keyint": 2, + "profile": "high", + "max video bitrate": 7000, + "max audio bitrate": 128 + } } ] }
View file
obs-studio-23.2.1.tar.xz/plugins/rtmp-services/rtmp-common.c -> obs-studio-24.0.0.tar.xz/plugins/rtmp-services/rtmp-common.c
Changed
@@ -22,13 +22,13 @@ static json_t *open_services_file(void); static inline json_t *find_service(json_t *root, const char *name, - const char **p_new_name); + const char **p_new_name); static inline const char *get_string_val(json_t *service, const char *key); extern void twitch_ingests_refresh(int seconds); static void ensure_valid_url(struct rtmp_common *service, json_t *json, - obs_data_t *settings) + obs_data_t *settings) { json_t *servers = json_object_get(json, "servers"); const char *top_url = NULL; @@ -70,9 +70,9 @@ bfree(service->key); service->service = bstrdup(obs_data_get_string(settings, "service")); - service->server = bstrdup(obs_data_get_string(settings, "server")); - service->key = bstrdup(obs_data_get_string(settings, "key")); - service->output = NULL; + service->server = bstrdup(obs_data_get_string(settings, "server")); + service->key = bstrdup(obs_data_get_string(settings, "key")); + service->output = NULL; json_t *root = open_services_file(); if (root) { @@ -86,7 +86,7 @@ if (serv) { json_t *rec = json_object_get(serv, "recommended"); - if (rec && json_is_object(rec)) { + if (json_is_object(rec)) { const char *out = get_string_val(rec, "output"); if (out) service->output = bstrdup(out); @@ -149,7 +149,7 @@ } static void add_service(obs_property_t *list, json_t *service, bool show_all, - const char *cur_service) + const char *cur_service) { json_t *servers; const char *name; @@ -157,14 +157,14 @@ if (!json_is_object(service)) { blog(LOG_WARNING, "rtmp-common.c: [add_service] service " - "is not an object"); + "is not an object"); return; } name = get_string_val(service, "name"); if (!name) { blog(LOG_WARNING, "rtmp-common.c: [add_service] service " - "has no name"); + "has no name"); return; } @@ -175,8 +175,10 @@ servers = json_object_get(service, "servers"); if (!servers || !json_is_array(servers)) { - blog(LOG_WARNING, "rtmp-common.c: [add_service] service " - "'%s' has no servers", name); + blog(LOG_WARNING, + "rtmp-common.c: [add_service] service " + "'%s' has no servers", + name); return; } @@ -184,14 +186,14 @@ } static void add_services(obs_property_t *list, json_t *root, bool show_all, - const char *cur_service) + const char *cur_service) { json_t *service; size_t index; if (!json_is_array(root)) { blog(LOG_WARNING, "rtmp-common.c: [add_services] JSON file " - "root is not an array"); + "root is not an array"); return; } @@ -202,18 +204,18 @@ service = find_service(root, cur_service, NULL); if (!service && cur_service && *cur_service) { obs_property_list_insert_string(list, 0, cur_service, - cur_service); + cur_service); obs_property_list_item_disable(list, 0, true); } } static json_t *open_json_file(const char *file) { - char *file_data = os_quick_read_utf8_file(file); + char *file_data = os_quick_read_utf8_file(file); json_error_t error; - json_t *root; - json_t *list; - int format_ver; + json_t *root; + json_t *list; + int format_ver; if (!file_data) return NULL; @@ -222,18 +224,20 @@ bfree(file_data); if (!root) { - blog(LOG_WARNING, "rtmp-common.c: [open_json_file] " - "Error reading JSON file (%d): %s", - error.line, error.text); + blog(LOG_WARNING, + "rtmp-common.c: [open_json_file] " + "Error reading JSON file (%d): %s", + error.line, error.text); return NULL; } format_ver = get_int_val(root, "format_version"); if (format_ver != RTMP_SERVICES_FORMAT_VERSION) { - blog(LOG_DEBUG, "rtmp-common.c: [open_json_file] " - "Wrong format version (%d), expected %d", - format_ver, RTMP_SERVICES_FORMAT_VERSION); + blog(LOG_DEBUG, + "rtmp-common.c: [open_json_file] " + "Wrong format version (%d), expected %d", + format_ver, RTMP_SERVICES_FORMAT_VERSION); json_decref(root); return NULL; } @@ -245,7 +249,7 @@ if (!list) { blog(LOG_WARNING, "rtmp-common.c: [open_json_file] " - "No services list"); + "No services list"); return NULL; } @@ -275,7 +279,7 @@ } static void build_service_list(obs_property_t *list, json_t *root, - bool show_all, const char *cur_service) + bool show_all, const char *cur_service) { obs_property_list_clear(list); add_services(list, root, show_all, cur_service); @@ -293,7 +297,7 @@ size_t count = twitch_ingest_count(); obs_property_list_add_string(servers_prop, - obs_module_text("Server.Auto"), "auto"); + obs_module_text("Server.Auto"), "auto"); if (count <= 1) return false; @@ -318,7 +322,7 @@ } static void fill_servers(obs_property_t *servers_prop, json_t *service, - const char *name) + const char *name) { json_t *servers, *server; size_t index; @@ -328,15 +332,16 @@ servers = json_object_get(service, "servers"); if (!json_is_array(servers)) { - blog(LOG_WARNING, "rtmp-common.c: [fill_servers] " - "Servers for service '%s' not a valid object", - name); + blog(LOG_WARNING, + "rtmp-common.c: [fill_servers] " + "Servers for service '%s' not a valid object", + name); return; } if (strcmp(name, "Mixer.com - FTL") == 0) { - obs_property_list_add_string(servers_prop, - obs_module_text("Server.Auto"), "auto"); + obs_property_list_add_string( + servers_prop, obs_module_text("Server.Auto"), "auto"); } if (strcmp(name, "Twitch") == 0) { if (fill_twitch_servers(servers_prop)) @@ -345,7 +350,7 @@ json_array_foreach (servers, index, server) { const char *server_name = get_string_val(server, "name"); - const char *url = get_string_val(server, "url"); + const char *url = get_string_val(server, "url"); if (!server_name || !url) continue; @@ -355,12 +360,13 @@ } static inline json_t *find_service(json_t *root, const char *name, - const char **p_new_name) + const char **p_new_name) { size_t index; json_t *service; - if (p_new_name) *p_new_name = NULL; + if (p_new_name) + *p_new_name = NULL; json_array_foreach (root, index, service) { const char *cur_name = get_string_val(service, "name"); @@ -376,7 +382,8 @@ json_array_foreach (alt_names, alt_name_idx, alt_name_obj) { const char *alt_name = json_string_value(alt_name_obj); if (alt_name && strcmp(name, alt_name) == 0) { - if (p_new_name) *p_new_name = cur_name; + if (p_new_name) + *p_new_name = cur_name; return service; } } @@ -386,10 +393,10 @@ } static bool service_selected(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { const char *name = obs_data_get_string(settings, "service"); - json_t *root = obs_properties_get_param(props); + json_t *root = obs_properties_get_param(props); json_t *service; const char *new_name; @@ -418,8 +425,8 @@ return true; } -static bool show_all_services_toggled(obs_properties_t *ppts, - obs_property_t *p, obs_data_t *settings) +static bool show_all_services_toggled(obs_properties_t *ppts, obs_property_t *p, + obs_data_t *settings) { const char *cur_service = obs_data_get_string(settings, "service"); bool show_all = obs_data_get_bool(settings, "show_all"); @@ -429,7 +436,7 @@ return false; build_service_list(obs_properties_get(ppts, "service"), root, show_all, - cur_service); + cur_service); UNUSED_PARAMETER(p); return true; @@ -440,37 +447,37 @@ UNUSED_PARAMETER(unused); obs_properties_t *ppts = obs_properties_create(); - obs_property_t *p; - json_t *root; + obs_property_t *p; + json_t *root; root = open_services_file(); if (root) obs_properties_set_param(ppts, root, properties_data_destroy); - p = obs_properties_add_list(ppts, "service", - obs_module_text("Service"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + p = obs_properties_add_list(ppts, "service", obs_module_text("Service"), + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_set_modified_callback(p, service_selected); p = obs_properties_add_bool(ppts, "show_all", - obs_module_text("ShowAll")); + obs_module_text("ShowAll")); obs_property_set_modified_callback(p, show_all_services_toggled); obs_properties_add_list(ppts, "server", obs_module_text("Server"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); obs_properties_add_text(ppts, "key", obs_module_text("StreamKey"), - OBS_TEXT_PASSWORD); + OBS_TEXT_PASSWORD); return ppts; } static void apply_video_encoder_settings(obs_data_t *settings, - json_t *recommended) + json_t *recommended) { json_t *item = json_object_get(recommended, "keyint"); - if (item && json_is_integer(item)) { + if (json_is_integer(item)) { int keyint = (int)json_integer_value(item); obs_data_set_int(settings, "keyint_sec", keyint); } @@ -478,13 +485,13 @@ obs_data_set_string(settings, "rate_control", "CBR"); item = json_object_get(recommended, "profile"); - if (item && json_is_string(item)) { + if (json_is_string(item)) { const char *profile = json_string_value(item); obs_data_set_string(settings, "profile", profile); } item = json_object_get(recommended, "max video bitrate"); - if (item && json_is_integer(item)) { + if (json_is_integer(item)) { int max_bitrate = (int)json_integer_value(item); if (obs_data_get_int(settings, "bitrate") > max_bitrate) { obs_data_set_int(settings, "bitrate", max_bitrate); @@ -493,11 +500,11 @@ } item = json_object_get(recommended, "bframes"); - if (item && json_is_integer(item)) + if (json_is_integer(item)) obs_data_set_int(settings, "bf", 0); item = json_object_get(recommended, "x264opts"); - if (item && json_is_string(item)) { + if (json_is_string(item)) { const char *x264_settings = json_string_value(item); const char *cur_settings = obs_data_get_string(settings, "x264opts"); @@ -514,10 +521,10 @@ } static void apply_audio_encoder_settings(obs_data_t *settings, - json_t *recommended) + json_t *recommended) { json_t *item = json_object_get(recommended, "max audio bitrate"); - if (item && json_is_integer(item)) { + if (json_is_integer(item)) { int max_bitrate = (int)json_integer_value(item); if (obs_data_get_int(settings, "bitrate") > max_bitrate) obs_data_set_int(settings, "bitrate", max_bitrate); @@ -525,16 +532,18 @@ } static void initialize_output(struct rtmp_common *service, json_t *root, - obs_data_t *video_settings, obs_data_t *audio_settings) + obs_data_t *video_settings, + obs_data_t *audio_settings) { - json_t *json_service = find_service(root, service->service, NULL); - json_t *recommended; + json_t *json_service = find_service(root, service->service, NULL); + json_t *recommended; if (!json_service) { if (service->service && *service->service) - blog(LOG_WARNING, "rtmp-common.c: [initialize_output] " - "Could not find service '%s'", - service->service); + blog(LOG_WARNING, + "rtmp-common.c: [initialize_output] " + "Could not find service '%s'", + service->service); return; } @@ -548,15 +557,15 @@ apply_audio_encoder_settings(audio_settings, recommended); } -static void rtmp_common_apply_settings(void *data, - obs_data_t *video_settings, obs_data_t *audio_settings) +static void rtmp_common_apply_settings(void *data, obs_data_t *video_settings, + obs_data_t *audio_settings) { struct rtmp_common *service = data; - json_t *root = open_services_file(); + json_t *root = open_services_file(); if (root) { initialize_output(service, root, video_settings, - audio_settings); + audio_settings); json_decref(root); } } @@ -595,14 +604,14 @@ } struct obs_service_info rtmp_common_service = { - .id = "rtmp_common", - .get_name = rtmp_common_getname, - .create = rtmp_common_create, - .destroy = rtmp_common_destroy, - .update = rtmp_common_update, + .id = "rtmp_common", + .get_name = rtmp_common_getname, + .create = rtmp_common_create, + .destroy = rtmp_common_destroy, + .update = rtmp_common_update, .get_properties = rtmp_common_properties, - .get_url = rtmp_common_url, - .get_key = rtmp_common_key, + .get_url = rtmp_common_url, + .get_key = rtmp_common_key, .apply_encoder_settings = rtmp_common_apply_settings, .get_output_type = rtmp_common_get_output_type, };
View file
obs-studio-23.2.1.tar.xz/plugins/rtmp-services/rtmp-custom.c -> obs-studio-24.0.0.tar.xz/plugins/rtmp-services/rtmp-custom.c
Changed
@@ -20,7 +20,7 @@ bfree(service->key); service->server = bstrdup(obs_data_get_string(settings, "server")); - service->key = bstrdup(obs_data_get_string(settings, "key")); + service->key = bstrdup(obs_data_get_string(settings, "key")); service->use_auth = obs_data_get_bool(settings, "use_auth"); service->username = bstrdup(obs_data_get_string(settings, "username")); service->password = bstrdup(obs_data_get_string(settings, "password")); @@ -47,7 +47,7 @@ } static bool use_auth_modified(obs_properties_t *ppts, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { bool use_auth = obs_data_get_bool(settings, "use_auth"); p = obs_properties_get(ppts, "username"); @@ -67,13 +67,14 @@ obs_properties_add_text(ppts, "server", "URL", OBS_TEXT_DEFAULT); obs_properties_add_text(ppts, "key", obs_module_text("StreamKey"), - OBS_TEXT_PASSWORD); + OBS_TEXT_PASSWORD); - p = obs_properties_add_bool(ppts, "use_auth", obs_module_text("UseAuth")); + p = obs_properties_add_bool(ppts, "use_auth", + obs_module_text("UseAuth")); obs_properties_add_text(ppts, "username", obs_module_text("Username"), - OBS_TEXT_DEFAULT); + OBS_TEXT_DEFAULT); obs_properties_add_text(ppts, "password", obs_module_text("Password"), - OBS_TEXT_PASSWORD); + OBS_TEXT_PASSWORD); obs_property_set_modified_callback(p, use_auth_modified); return ppts; } @@ -107,14 +108,14 @@ } struct obs_service_info rtmp_custom_service = { - .id = "rtmp_custom", - .get_name = rtmp_custom_name, - .create = rtmp_custom_create, - .destroy = rtmp_custom_destroy, - .update = rtmp_custom_update, + .id = "rtmp_custom", + .get_name = rtmp_custom_name, + .create = rtmp_custom_create, + .destroy = rtmp_custom_destroy, + .update = rtmp_custom_update, .get_properties = rtmp_custom_properties, - .get_url = rtmp_custom_url, - .get_key = rtmp_custom_key, - .get_username = rtmp_custom_username, - .get_password = rtmp_custom_password + .get_url = rtmp_custom_url, + .get_key = rtmp_custom_key, + .get_username = rtmp_custom_username, + .get_password = rtmp_custom_password, };
View file
obs-studio-23.2.1.tar.xz/plugins/rtmp-services/rtmp-services-main.c -> obs-studio-24.0.0.tar.xz/plugins/rtmp-services/rtmp-services-main.c
Changed
@@ -35,7 +35,7 @@ obs_data_t *data; int format_version; - data = obs_data_create_from_json((char*)file->buffer.array); + data = obs_data_create_from_json((char *)file->buffer.array); if (!data) return false; @@ -78,20 +78,18 @@ proc_handler_t *ph = obs_get_proc_handler(); proc_handler_add(ph, "void twitch_ingests_refresh(int seconds)", - refresh_callback, NULL); + refresh_callback, NULL); #if !defined(_WIN32) || CHECK_FOR_SERVICE_UPDATES char *local_dir = obs_module_file(""); char *cache_dir = obs_module_config_path(""); if (cache_dir) { - update_info = update_info_create( - RTMP_SERVICES_LOG_STR, - module_name.array, - RTMP_SERVICES_URL, - local_dir, - cache_dir, - confirm_service_file, NULL); + update_info = update_info_create(RTMP_SERVICES_LOG_STR, + module_name.array, + RTMP_SERVICES_URL, local_dir, + cache_dir, + confirm_service_file, NULL); } load_twitch_data();
View file
obs-studio-23.2.1.tar.xz/plugins/rtmp-services/twitch.c -> obs-studio-24.0.0.tar.xz/plugins/rtmp-services/twitch.c
Changed
@@ -145,7 +145,7 @@ ingest.name = NULL; ingest.url = NULL; } else { - ingest = *(struct twitch_ingest*)(cur_ingests.array + idx); + ingest = *(struct twitch_ingest *)(cur_ingests.array + idx); } return ingest; @@ -168,10 +168,9 @@ os_atomic_set_bool(&ingests_refreshing, true); twitch_update_info = update_info_create_single( - "[twitch ingest update] ", - get_module_name(), - "https://ingest.twitch.tv/api/v2/ingests", - twitch_ingest_update, NULL); + "[twitch ingest update] ", get_module_name(), + "https://ingest.twitch.tv/api/v2/ingests", + twitch_ingest_update, NULL); } /* wait five seconds max when loading ingests for the first time */ @@ -189,10 +188,8 @@ { char *twitch_cache = obs_module_config_path("twitch_ingests.json"); - struct ingest def = { - .name = bstrdup("Default"), - .url = bstrdup("rtmp://live.twitch.tv/app") - }; + struct ingest def = {.name = bstrdup("Default"), + .url = bstrdup("rtmp://live.twitch.tv/app")}; pthread_mutex_lock(&mutex); da_push_back(cur_ingests, &def);
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/data/locale/de-DE.ini
Changed
@@ -1,7 +1,7 @@ TextFreetype2="Text (FreeType 2)" Font="Schriftart" Text="Text" -TextFile="Textdatei (UTF-8 oder UTF-16)" +TextFile="Textdatei (UTF‐8 oder UTF‐16)" TextFileFilter="Textdateien (*.txt);;" ChatLogMode="Chatprotokollmodus" ChatLogLines="Chatprotokollzeilen"
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/data/locale/gl-ES.ini
Changed
@@ -1,8 +1,10 @@ TextFreetype2="Texto (FreeType 2)" -Font="Fonte" +Font="Tipo de letra" Text="Texto" TextFile="Ficheiro de texto (UTF-8 ou UTF-16)" TextFileFilter="Ficheiros de texto (*.txt);;" +ChatLogMode="Modo de rexistro da conversa" +ChatLogLines="Liñas de rexistro da conversa" Color1="Cor 1" Color2="Cor 2" Outline="Contorno"
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/data/locale/sl-SI.ini
Changed
@@ -1,12 +1,15 @@ +TextFreetype2="Besedilo (FreeType 2)" Font="Pisava" -Text="Tekst" -TextFile="Besedilna datoteka (UTF-8 or UTF-16)" -TextFileFilter="Besedilne Datoteke (*.txt);;" -Color1="Barva 1" -Color2="Barva 2" +Text="Besedilo" +TextFile="Besedilna datoteka (UTF-8 ali UTF-16)" +TextFileFilter="Besedilne datoteke (*.txt);;" +ChatLogMode="Način dnevnika klepeta" +ChatLogLines="Št. vrstic dnevnika klepeta" +Color1="1. barva" +Color2="2. barva" Outline="Oris" DropShadow="Odajaj senco" -ReadFromFile="Preberi iz datoteka" -CustomWidth="Širina poljubnega besedila" -WordWrap="Prelom besedila" +ReadFromFile="Preberi iz datoteke" +CustomWidth="Širina besedila po meri" +WordWrap="Prelomi besedilo"
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/find-font-cocoa.m -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/find-font-cocoa.m
Changed
@@ -30,12 +30,12 @@ files = [file_manager contentsOfDirectoryAtPath:path error:nil]; for (NSString *file in files) { - NSString *full_path = [path stringByAppendingPathComponent:file]; + NSString *full_path = + [path stringByAppendingPathComponent:file]; BOOL is_dir = FALSE; - bool folder_exists = [file_manager - fileExistsAtPath:full_path - isDirectory:&is_dir]; + bool folder_exists = [file_manager fileExistsAtPath:full_path + isDirectory:&is_dir]; if (folder_exists && is_dir) { add_path_fonts(file_manager, full_path); @@ -50,7 +50,7 @@ @autoreleasepool { BOOL is_dir; NSArray *paths = NSSearchPathForDirectoriesInDomains( - NSLibraryDirectory, NSAllDomainsMask, true); + NSLibraryDirectory, NSAllDomainsMask, true); for (NSString *path in paths) { NSFileManager *file_manager = @@ -59,8 +59,8 @@ [path stringByAppendingPathComponent:@"Fonts"]; bool folder_exists = [file_manager - fileExistsAtPath:font_path - isDirectory:&is_dir]; + fileExistsAtPath:font_path + isDirectory:&is_dir]; if (folder_exists && is_dir) add_path_fonts(file_manager, font_path); @@ -78,17 +78,19 @@ } static uint32_t add_font_checksum_path(uint32_t checksum, - NSFileManager *file_manager, NSString *path) + NSFileManager *file_manager, + NSString *path) { NSArray *files = NULL; files = [file_manager contentsOfDirectoryAtPath:path error:nil]; for (NSString *file in files) { - NSString *full_path = [path stringByAppendingPathComponent:file]; + NSString *full_path = + [path stringByAppendingPathComponent:file]; - checksum = add_font_checksum(checksum, - full_path.fileSystemRepresentation); + checksum = add_font_checksum( + checksum, full_path.fileSystemRepresentation); } return checksum; @@ -101,7 +103,7 @@ @autoreleasepool { BOOL is_dir; NSArray *paths = NSSearchPathForDirectoriesInDomains( - NSLibraryDirectory, NSAllDomainsMask, true); + NSLibraryDirectory, NSAllDomainsMask, true); for (NSString *path in paths) { NSFileManager *file_manager = @@ -110,12 +112,12 @@ [path stringByAppendingPathComponent:@"Fonts"]; bool folder_exists = [file_manager - fileExistsAtPath:font_path - isDirectory:&is_dir]; + fileExistsAtPath:font_path + isDirectory:&is_dir]; if (folder_exists && is_dir) - checksum = add_font_checksum_path(checksum, - file_manager, font_path); + checksum = add_font_checksum_path( + checksum, file_manager, font_path); } }
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/find-font-iconv.c -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/find-font-iconv.c
Changed
@@ -5,80 +5,51 @@ struct mac_font_mapping { unsigned short encoding_id; unsigned short language_id; - const char *code_page; + const char *code_page; }; #define TT_MAC_LANGID_ANY 0xFFFF static const struct mac_font_mapping mac_codes[] = { - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ENGLISH, "macintosh"}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ICELANDIC,"x-mac-icelandic"}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_TURKISH, "x-mac-ce"}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_POLISH, "x-mac-ce"}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ROMANIAN, "x-mac-romanian"}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_CZECH, "x-mac-ce"}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_SLOVAK, "x-mac-ce"}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ANY, "macintosh"}, - {TT_MAC_ID_JAPANESE, TT_MAC_LANGID_JAPANESE, "Shift_JIS"}, - {TT_MAC_ID_JAPANESE, TT_MAC_LANGID_ANY, "Shift_JIS"}, - {TT_MAC_ID_KOREAN, TT_MAC_LANGID_KOREAN, "EUC-KR"}, - {TT_MAC_ID_KOREAN, TT_MAC_LANGID_ANY, "EUC-KR"}, - {TT_MAC_ID_ARABIC, TT_MAC_LANGID_ARABIC, "x-mac-arabic"}, - {TT_MAC_ID_ARABIC, TT_MAC_LANGID_URDU, "x-mac-farsi"}, - {TT_MAC_ID_ARABIC, TT_MAC_LANGID_FARSI, "x-mac-farsi"}, - {TT_MAC_ID_ARABIC, TT_MAC_LANGID_ANY, "x-mac-arabic"}, - {TT_MAC_ID_HEBREW, TT_MAC_LANGID_HEBREW, "x-mac-hebrew"}, - {TT_MAC_ID_HEBREW, TT_MAC_LANGID_ANY, "x-mac-hebrew"}, - {TT_MAC_ID_GREEK, TT_MAC_LANGID_ANY, "x-mac-greek"}, - {TT_MAC_ID_RUSSIAN, TT_MAC_LANGID_ANY, "x-mac-cyrillic"}, - {TT_MAC_ID_DEVANAGARI, TT_MAC_LANGID_ANY, "x-mac-devanagari"}, - {TT_MAC_ID_GURMUKHI, TT_MAC_LANGID_ANY, "x-mac-gurmukhi"}, - {TT_MAC_ID_GUJARATI, TT_MAC_LANGID_ANY, "x-mac-gujarati"}, - { - TT_MAC_ID_TRADITIONAL_CHINESE, - TT_MAC_LANGID_CHINESE_SIMPLIFIED, - "Big5" - }, - { - TT_MAC_ID_TRADITIONAL_CHINESE, - TT_MAC_LANGID_ANY, - "Big5" - }, - { - TT_MAC_ID_SIMPLIFIED_CHINESE, - TT_MAC_LANGID_CHINESE_SIMPLIFIED, - "GB2312" - }, - { - TT_MAC_ID_SIMPLIFIED_CHINESE, - TT_MAC_LANGID_ANY, - "GB2312" - } -}; - -const char *iso_codes[] = { - "us-ascii", - NULL, - "iso-8859-1" -}; - -const char *ms_codes[] = { - "UTF-16BE", - "UTF-16BE", - "Shift_JIS", - NULL, - "Big5", - NULL, - NULL, - NULL, - NULL, - NULL, - "UTF-16BE" -}; + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ENGLISH, "macintosh"}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ICELANDIC, "x-mac-icelandic"}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_TURKISH, "x-mac-ce"}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_POLISH, "x-mac-ce"}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ROMANIAN, "x-mac-romanian"}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_CZECH, "x-mac-ce"}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_SLOVAK, "x-mac-ce"}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ANY, "macintosh"}, + {TT_MAC_ID_JAPANESE, TT_MAC_LANGID_JAPANESE, "Shift_JIS"}, + {TT_MAC_ID_JAPANESE, TT_MAC_LANGID_ANY, "Shift_JIS"}, + {TT_MAC_ID_KOREAN, TT_MAC_LANGID_KOREAN, "EUC-KR"}, + {TT_MAC_ID_KOREAN, TT_MAC_LANGID_ANY, "EUC-KR"}, + {TT_MAC_ID_ARABIC, TT_MAC_LANGID_ARABIC, "x-mac-arabic"}, + {TT_MAC_ID_ARABIC, TT_MAC_LANGID_URDU, "x-mac-farsi"}, + {TT_MAC_ID_ARABIC, TT_MAC_LANGID_FARSI, "x-mac-farsi"}, + {TT_MAC_ID_ARABIC, TT_MAC_LANGID_ANY, "x-mac-arabic"}, + {TT_MAC_ID_HEBREW, TT_MAC_LANGID_HEBREW, "x-mac-hebrew"}, + {TT_MAC_ID_HEBREW, TT_MAC_LANGID_ANY, "x-mac-hebrew"}, + {TT_MAC_ID_GREEK, TT_MAC_LANGID_ANY, "x-mac-greek"}, + {TT_MAC_ID_RUSSIAN, TT_MAC_LANGID_ANY, "x-mac-cyrillic"}, + {TT_MAC_ID_DEVANAGARI, TT_MAC_LANGID_ANY, "x-mac-devanagari"}, + {TT_MAC_ID_GURMUKHI, TT_MAC_LANGID_ANY, "x-mac-gurmukhi"}, + {TT_MAC_ID_GUJARATI, TT_MAC_LANGID_ANY, "x-mac-gujarati"}, + {TT_MAC_ID_TRADITIONAL_CHINESE, TT_MAC_LANGID_CHINESE_SIMPLIFIED, + "Big5"}, + {TT_MAC_ID_TRADITIONAL_CHINESE, TT_MAC_LANGID_ANY, "Big5"}, + {TT_MAC_ID_SIMPLIFIED_CHINESE, TT_MAC_LANGID_CHINESE_SIMPLIFIED, + "GB2312"}, + {TT_MAC_ID_SIMPLIFIED_CHINESE, TT_MAC_LANGID_ANY, "GB2312"}}; + +const char *iso_codes[] = {"us-ascii", NULL, "iso-8859-1"}; + +const char *ms_codes[] = {"UTF-16BE", "UTF-16BE", "Shift_JIS", NULL, + "Big5", NULL, NULL, NULL, + NULL, NULL, "UTF-16BE"}; static const size_t mac_code_count = sizeof(mac_codes) / sizeof(mac_codes[0]); static const size_t iso_code_count = sizeof(iso_codes) / sizeof(iso_codes[0]); -static const size_t ms_code_count = sizeof(ms_codes) / sizeof(ms_codes[0]); +static const size_t ms_code_count = sizeof(ms_codes) / sizeof(ms_codes[0]); static const char *get_mac_code(uint16_t encoding_id, uint16_t language_id) { @@ -94,7 +65,8 @@ } static const char *get_code_page_for_font(uint16_t platform_id, - uint16_t encoding_id, uint16_t language_id) + uint16_t encoding_id, + uint16_t language_id) { const char *ret; @@ -122,38 +94,40 @@ char *sfnt_name_to_utf8(FT_SfntName *sfnt_name) { const char *charset = get_code_page_for_font(sfnt_name->platform_id, - sfnt_name->encoding_id, sfnt_name->language_id); + sfnt_name->encoding_id, + sfnt_name->language_id); char utf8[256]; char *conv_in, *conv_out; size_t in_len, out_len; if (!charset) { - blog(LOG_DEBUG, "invalid character set found, " - "platform_id: %d, encoding_id: %d, " - "language_id: %d", - sfnt_name->platform_id, - sfnt_name->encoding_id, - sfnt_name->language_id); + blog(LOG_DEBUG, + "invalid character set found, " + "platform_id: %d, encoding_id: %d, " + "language_id: %d", + sfnt_name->platform_id, sfnt_name->encoding_id, + sfnt_name->language_id); return NULL; } iconv_t ic = iconv_open("UTF-8", charset); if (ic == (iconv_t)-1) { - blog(LOG_DEBUG, "couldn't intialize font code page " - "conversion: '%s' to 'utf-8': errno = %d", - charset, (int)errno); + blog(LOG_DEBUG, + "couldn't intialize font code page " + "conversion: '%s' to 'utf-8': errno = %d", + charset, (int)errno); return NULL; } - conv_in = (char*)sfnt_name->string; + conv_in = (char *)sfnt_name->string; conv_out = utf8; - in_len = sfnt_name->string_len; - out_len = 256; + in_len = sfnt_name->string_len; + out_len = 256; size_t n = iconv(ic, &conv_in, &in_len, &conv_out, &out_len); if (n == (size_t)-1) { blog(LOG_WARNING, "couldn't convert font name text: errno = %d", - (int)errno); + (int)errno); iconv_close(ic); return NULL; }
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/find-font-unix.c -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/find-font-unix.c
Changed
@@ -22,38 +22,34 @@ #include "find-font.h" #include "text-freetype2.h" -void free_os_font_list(void) -{ -} +void free_os_font_list(void) {} bool load_cached_os_font_list(void) { return true; } -void load_os_font_list(void) -{ -} +void load_os_font_list(void) {} const char *get_font_path(const char *family, uint16_t size, const char *style, - uint32_t flags, FT_Long *idx) + uint32_t flags, FT_Long *idx) { - bool bold = !!(flags & OBS_FONT_BOLD); - bool italic = !!(flags & OBS_FONT_ITALIC); + bool bold = !!(flags & OBS_FONT_BOLD); + bool italic = !!(flags & OBS_FONT_ITALIC); FcPattern *pattern = FcPatternCreate(); - FcPattern *match = NULL; - bool success = false; - FcResult match_result; + FcPattern *match = NULL; + bool success = false; + FcResult match_result; /* somewhat of a cheap hack */ static __thread char result[512]; - FcPatternAddString(pattern, FC_FAMILY, (const FcChar8*)family); - FcPatternAddString(pattern, FC_STYLE, (const FcChar8*)style); + FcPatternAddString(pattern, FC_FAMILY, (const FcChar8 *)family); + FcPatternAddString(pattern, FC_STYLE, (const FcChar8 *)style); FcPatternAddInteger(pattern, FC_WEIGHT, - bold ? FC_WEIGHT_BOLD : FC_WEIGHT_REGULAR); + bold ? FC_WEIGHT_BOLD : FC_WEIGHT_REGULAR); FcPatternAddInteger(pattern, FC_SLANT, - italic ? FC_SLANT_ITALIC : FC_SLANT_ROMAN); + italic ? FC_SLANT_ITALIC : FC_SLANT_ROMAN); FcPatternAddDouble(pattern, FC_SIZE, (double)size); FcConfigSubstitute(NULL, pattern, FcMatchPattern); @@ -61,9 +57,9 @@ match = FcFontMatch(NULL, pattern, &match_result); if (match) { - FcChar8 *path = FcPatternFormat(match, - (const FcChar8*)"%{file}"); - strncpy(result, (char*)path, 511); + FcChar8 *path = + FcPatternFormat(match, (const FcChar8 *)"%{file}"); + strncpy(result, (char *)path, 511); FcStrFree(path); int fc_index = 0; @@ -73,8 +69,7 @@ FcPatternDestroy(match); success = true; } else { - blog(LOG_WARNING, "no matching font for '%s' found", - family); + blog(LOG_WARNING, "no matching font for '%s' found", family); } FcPatternDestroy(pattern);
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/find-font-windows.c -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/find-font-windows.c
Changed
@@ -15,64 +15,47 @@ struct mac_font_mapping { unsigned short encoding_id; unsigned short language_id; - unsigned int code_page; + unsigned int code_page; }; #define TT_MAC_LANGID_ANY 0xFFFF static const struct mac_font_mapping mac_codes[] = { - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ENGLISH, 10000}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ICELANDIC, 10079}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_TURKISH, 10081}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_POLISH, 10029}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ROMANIAN, 10010}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_CZECH, 10029}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_SLOVAK, 10029}, - {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ANY, 10000}, - {TT_MAC_ID_JAPANESE, TT_MAC_LANGID_JAPANESE, 932}, - {TT_MAC_ID_JAPANESE, TT_MAC_LANGID_ANY, 932}, - {TT_MAC_ID_TRADITIONAL_CHINESE,TT_MAC_LANGID_CHINESE_SIMPLIFIED, 950}, - {TT_MAC_ID_TRADITIONAL_CHINESE,TT_MAC_LANGID_ANY, 950}, - {TT_MAC_ID_KOREAN, TT_MAC_LANGID_KOREAN, 51949}, - {TT_MAC_ID_KOREAN, TT_MAC_LANGID_ANY, 51949}, - {TT_MAC_ID_ARABIC, TT_MAC_LANGID_ARABIC, 10004}, - {TT_MAC_ID_ARABIC, TT_MAC_LANGID_URDU, 0}, - {TT_MAC_ID_ARABIC, TT_MAC_LANGID_FARSI, 0}, - {TT_MAC_ID_ARABIC, TT_MAC_LANGID_ANY, 10004}, - {TT_MAC_ID_HEBREW, TT_MAC_LANGID_HEBREW, 10005}, - {TT_MAC_ID_HEBREW, TT_MAC_LANGID_ANY, 10005}, - {TT_MAC_ID_GREEK, TT_MAC_LANGID_ANY, 10006}, - {TT_MAC_ID_RUSSIAN, TT_MAC_LANGID_ANY, 10007}, - {TT_MAC_ID_DEVANAGARI, TT_MAC_LANGID_ANY, 0}, - {TT_MAC_ID_GURMUKHI, TT_MAC_LANGID_ANY, 0}, - {TT_MAC_ID_GUJARATI, TT_MAC_LANGID_ANY, 0}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ENGLISH, 10000}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ICELANDIC, 10079}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_TURKISH, 10081}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_POLISH, 10029}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ROMANIAN, 10010}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_CZECH, 10029}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_SLOVAK, 10029}, + {TT_MAC_ID_ROMAN, TT_MAC_LANGID_ANY, 10000}, + {TT_MAC_ID_JAPANESE, TT_MAC_LANGID_JAPANESE, 932}, + {TT_MAC_ID_JAPANESE, TT_MAC_LANGID_ANY, 932}, + {TT_MAC_ID_TRADITIONAL_CHINESE, TT_MAC_LANGID_CHINESE_SIMPLIFIED, 950}, + {TT_MAC_ID_TRADITIONAL_CHINESE, TT_MAC_LANGID_ANY, 950}, + {TT_MAC_ID_KOREAN, TT_MAC_LANGID_KOREAN, 51949}, + {TT_MAC_ID_KOREAN, TT_MAC_LANGID_ANY, 51949}, + {TT_MAC_ID_ARABIC, TT_MAC_LANGID_ARABIC, 10004}, + {TT_MAC_ID_ARABIC, TT_MAC_LANGID_URDU, 0}, + {TT_MAC_ID_ARABIC, TT_MAC_LANGID_FARSI, 0}, + {TT_MAC_ID_ARABIC, TT_MAC_LANGID_ANY, 10004}, + {TT_MAC_ID_HEBREW, TT_MAC_LANGID_HEBREW, 10005}, + {TT_MAC_ID_HEBREW, TT_MAC_LANGID_ANY, 10005}, + {TT_MAC_ID_GREEK, TT_MAC_LANGID_ANY, 10006}, + {TT_MAC_ID_RUSSIAN, TT_MAC_LANGID_ANY, 10007}, + {TT_MAC_ID_DEVANAGARI, TT_MAC_LANGID_ANY, 0}, + {TT_MAC_ID_GURMUKHI, TT_MAC_LANGID_ANY, 0}, + {TT_MAC_ID_GUJARATI, TT_MAC_LANGID_ANY, 0}, {TT_MAC_ID_SIMPLIFIED_CHINESE, TT_MAC_LANGID_CHINESE_SIMPLIFIED, 936}, - {TT_MAC_ID_SIMPLIFIED_CHINESE, TT_MAC_LANGID_ANY, 936} -}; + {TT_MAC_ID_SIMPLIFIED_CHINESE, TT_MAC_LANGID_ANY, 936}}; -unsigned int iso_codes[] = { - 20127, - 0, - 28591 -}; +unsigned int iso_codes[] = {20127, 0, 28591}; -unsigned int ms_codes[] = { - 1201, - 1201, - 932, - 0, - 950, - 0, - 0, - 0, - 0, - 0, - 1201 -}; +unsigned int ms_codes[] = {1201, 1201, 932, 0, 950, 0, 0, 0, 0, 0, 1201}; static const size_t mac_code_count = sizeof(mac_codes) / sizeof(mac_codes[0]); static const size_t iso_code_count = sizeof(iso_codes) / sizeof(iso_codes[0]); -static const size_t ms_code_count = sizeof(ms_codes) / sizeof(ms_codes[0]); +static const size_t ms_code_count = sizeof(ms_codes) / sizeof(ms_codes[0]); static unsigned int get_mac_code(uint16_t encoding_id, uint16_t language_id) { @@ -88,7 +71,8 @@ } static unsigned int get_code_page_for_font(uint16_t platform_id, - uint16_t encoding_id, uint16_t language_id) + uint16_t encoding_id, + uint16_t language_id) { unsigned int ret; @@ -116,15 +100,16 @@ static char *wide_to_utf8(const wchar_t *str, size_t len) { size_t utf8_len; - char *utf8_str = NULL; + char *utf8_str = NULL; - utf8_len = (size_t)WideCharToMultiByte(CP_UTF8, 0, str, (int)len, - NULL, 0, NULL, false); + utf8_len = (size_t)WideCharToMultiByte(CP_UTF8, 0, str, (int)len, NULL, + 0, NULL, false); if (utf8_len) { utf8_str = bzalloc(utf8_len + 1); - utf8_len = (size_t)WideCharToMultiByte(CP_UTF8, 0, - str, (int)len, - utf8_str, (int)utf8_len + 1, NULL, false); + utf8_len = (size_t)WideCharToMultiByte(CP_UTF8, 0, str, + (int)len, utf8_str, + (int)utf8_len + 1, NULL, + false); if (!utf8_len) { bfree(utf8_str); @@ -137,16 +122,16 @@ static char *convert_utf16_be_to_utf8(FT_SfntName *sfnt_name) { - size_t utf16_len = sfnt_name->string_len / 2; + size_t utf16_len = sfnt_name->string_len / 2; wchar_t *utf16_str = malloc((utf16_len + 1) * sizeof(wchar_t)); - char *utf8_str = NULL; + char *utf8_str = NULL; utf16_str[utf16_len] = 0; /* convert to little endian */ for (size_t i = 0; i < utf16_len; i++) { - size_t pos = i * 2; - wchar_t ch = *(wchar_t *)&sfnt_name->string[pos]; + size_t pos = i * 2; + wchar_t ch = *(wchar_t *)&sfnt_name->string[pos]; utf16_str[i] = ((ch >> 8) & 0xFF) | ((ch << 8) & 0xFF00); } @@ -159,28 +144,27 @@ char *sfnt_name_to_utf8(FT_SfntName *sfnt_name) { - unsigned int code_page = get_code_page_for_font( - sfnt_name->platform_id, - sfnt_name->encoding_id, - sfnt_name->language_id); + unsigned int code_page = get_code_page_for_font(sfnt_name->platform_id, + sfnt_name->encoding_id, + sfnt_name->language_id); - char *utf8_str = NULL; + char *utf8_str = NULL; wchar_t *utf16_str; - size_t utf16_len; + size_t utf16_len; if (code_page == 1201) return convert_utf16_be_to_utf8(sfnt_name); else if (code_page == 0) return NULL; - utf16_len = MultiByteToWideChar(code_page, 0, - (char*)sfnt_name->string, sfnt_name->string_len, - NULL, 0); + utf16_len = MultiByteToWideChar(code_page, 0, (char *)sfnt_name->string, + sfnt_name->string_len, NULL, 0); if (utf16_len) { utf16_str = malloc((utf16_len + 1) * sizeof(wchar_t)); utf16_len = MultiByteToWideChar(code_page, 0, - (char*)sfnt_name->string, sfnt_name->string_len, - utf16_str, (int)utf16_len); + (char *)sfnt_name->string, + sfnt_name->string_len, + utf16_str, (int)utf16_len); if (utf16_len) { utf16_str[utf16_len] = 0; @@ -195,15 +179,15 @@ uint32_t get_font_checksum(void) { - uint32_t checksum = 0; - struct dstr path = {0}; - HANDLE handle; + uint32_t checksum = 0; + struct dstr path = {0}; + HANDLE handle; WIN32_FIND_DATAA wfd; dstr_reserve(&path, MAX_PATH); HRESULT res = SHGetFolderPathA(NULL, CSIDL_FONTS, NULL, - SHGFP_TYPE_CURRENT, path.array); + SHGFP_TYPE_CURRENT, path.array); if (res != S_OK) { blog(LOG_WARNING, "Error finding windows font folder"); return 0; @@ -220,9 +204,9 @@ do { checksum = calc_crc32(checksum, &wfd.ftLastWriteTime, - sizeof(FILETIME)); + sizeof(FILETIME)); checksum = calc_crc32(checksum, wfd.cFileName, - strlen(wfd.cFileName)); + strlen(wfd.cFileName)); } while (FindNextFileA(handle, &wfd)); FindClose(handle); @@ -234,14 +218,14 @@ void load_os_font_list(void) { - struct dstr path = {0}; - HANDLE handle; + struct dstr path = {0}; + HANDLE handle; WIN32_FIND_DATAA wfd; dstr_reserve(&path, MAX_PATH); HRESULT res = SHGetFolderPathA(NULL, CSIDL_FONTS, NULL, - SHGFP_TYPE_CURRENT, path.array); + SHGFP_TYPE_CURRENT, path.array); if (res != S_OK) { blog(LOG_WARNING, "Error finding windows font folder"); return; @@ -271,7 +255,7 @@ while (idx < max_faces) { FT_Error ret = FT_New_Face(ft2_lib, full_path.array, - idx, &face); + idx, &face); if (ret != 0) break;
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/find-font.c -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/find-font.c
Changed
@@ -12,7 +12,7 @@ } static inline bool write_data(struct serializer *s, const void *data, - size_t size) + size_t size) { return s_write(s, data, size) == size; } @@ -56,20 +56,23 @@ int count; success = read_var(s, count); - if (!success) return false; + if (!success) + return false; da_init(font_list); da_resize(font_list, count); -#define do_read(var) \ +#define do_read(var) \ success = read_var(s, var); \ - if (!success) break + if (!success) \ + break for (int i = 0; i < count; i++) { struct font_path_info *info = &font_list.array[i]; success = read_str(s, &info->face_and_style); - if (!success) break; + if (!success) + break; do_read(info->full_len); do_read(info->face_len); @@ -78,13 +81,15 @@ info->sizes = bmalloc(sizeof(int) * info->num_sizes); success = read_data(s, info->sizes, - sizeof(int) * info->num_sizes); - if (!success) break; + sizeof(int) * info->num_sizes); + if (!success) + break; do_read(info->bold); success = read_str(s, &info->path); - if (!success) break; + if (!success) + break; do_read(info->italic); do_read(info->index); @@ -149,29 +154,34 @@ bool success = false; if (font_checksum) - success = file_output_serializer_init_safe(&s, file_name, - "tmp"); + success = + file_output_serializer_init_safe(&s, file_name, "tmp"); bfree(file_name); if (!success) return; success = write_var(&s, font_cache_ver); - if (!success) return; + if (!success) + return; success = write_var(&s, font_checksum); - if (!success) return; + if (!success) + return; success = write_var(&s, font_count); - if (!success) return; + if (!success) + return; -#define do_write(var) \ +#define do_write(var) \ success = write_var(&s, var); \ - if (!success) break + if (!success) \ + break for (size_t i = 0; i < font_list.num; i++) { struct font_path_info *info = &font_list.array[i]; success = write_str(&s, info->face_and_style); - if (!success) break; + if (!success) + break; do_write(info->full_len); do_write(info->face_len); @@ -179,13 +189,15 @@ do_write(info->num_sizes); success = write_data(&s, info->sizes, - sizeof(int) * info->num_sizes); - if (!success) break; + sizeof(int) * info->num_sizes); + if (!success) + break; do_write(info->bold); success = write_str(&s, info->path); - if (!success) break; + if (!success) + break; do_write(info->italic); do_write(info->index); @@ -202,7 +214,7 @@ if (!info->is_bitmap) { info->num_sizes = 0; - info->sizes = NULL; + info->sizes = NULL; return; } @@ -214,15 +226,12 @@ da_push_back(sizes, &val); } - info->sizes = sizes.array; + info->sizes = sizes.array; info->num_sizes = (uint32_t)face->num_fixed_sizes; } -static void add_font_path(FT_Face face, - FT_Long idx, - const char *family_in, - const char *style_in, - const char *path) +static void add_font_path(FT_Face face, FT_Long idx, const char *family_in, + const char *style_in, const char *path) { struct dstr face_and_style = {0}; struct font_path_info info; @@ -249,15 +258,15 @@ } info.face_and_style = face_and_style.array; - info.full_len = (uint32_t)face_and_style.len; - info.face_len = (uint32_t)strlen(family_in); + info.full_len = (uint32_t)face_and_style.len; + info.face_len = (uint32_t)strlen(family_in); - info.is_bitmap = !!(face->face_flags & FT_FACE_FLAG_FIXED_SIZES); - info.bold = !!(face->style_flags & FT_STYLE_FLAG_BOLD); - info.italic = !!(face->style_flags & FT_STYLE_FLAG_ITALIC); - info.index = idx; + info.is_bitmap = !!(face->face_flags & FT_FACE_FLAG_FIXED_SIZES); + info.bold = !!(face->style_flags & FT_STYLE_FLAG_BOLD); + info.italic = !!(face->style_flags & FT_STYLE_FLAG_ITALIC); + info.index = idx; - info.path = bstrdup(path); + info.path = bstrdup(path); create_bitmap_sizes(&info, face); da_push_back(font_list, &info); @@ -271,15 +280,15 @@ void build_font_path_info(FT_Face face, FT_Long idx, const char *path) { FT_UInt num_names = FT_Get_Sfnt_Name_Count(face); - DARRAY(char*) family_names; + DARRAY(char *) family_names; da_init(family_names); da_push_back(family_names, &face->family_name); for (FT_UInt i = 0; i < num_names; i++) { FT_SfntName name; - char *family; - FT_Error ret = FT_Get_Sfnt_Name(face, i, &name); + char *family; + FT_Error ret = FT_Get_Sfnt_Name(face, i, &name); if (ret != 0 || name.name_id != TT_NAME_ID_FONT_FAMILY) continue; @@ -302,7 +311,7 @@ for (size_t i = 0; i < family_names.num; i++) { add_font_path(face, idx, family_names.array[i], - face->style_name, path); + face->style_name, path); /* first item isn't our allocation */ if (i > 0) @@ -339,14 +348,14 @@ } const char *get_font_path(const char *family, uint16_t size, const char *style, - uint32_t flags, FT_Long *idx) + uint32_t flags, FT_Long *idx) { - const char *best_path = NULL; - double best_rating = 0.0; + const char *best_path = NULL; + double best_rating = 0.0; struct dstr face_and_style = {0}; - struct dstr style_str = {0}; - bool bold = !!(flags & OBS_FONT_BOLD); - bool italic = !!(flags & OBS_FONT_ITALIC); + struct dstr style_str = {0}; + bool bold = !!(flags & OBS_FONT_BOLD); + bool italic = !!(flags & OBS_FONT_ITALIC); if (!family || !*family) return NULL; @@ -383,12 +392,14 @@ rating /= (double)(best_diff + 1.0); } - if (info->bold == bold) rating += 1.0; - if (info->italic == italic) rating += 1.0; + if (info->bold == bold) + rating += 1.0; + if (info->italic == italic) + rating += 1.0; if (rating > best_rating) { - best_path = info->path; - *idx = info->index; + best_path = info->path; + *idx = info->index; best_rating = rating; } }
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/find-font.h -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/find-font.h
Changed
@@ -9,19 +9,19 @@ #include <util/darray.h> struct font_path_info { - char *face_and_style; + char *face_and_style; uint32_t full_len; uint32_t face_len; - bool is_bitmap; + bool is_bitmap; uint32_t num_sizes; - int *sizes; + int *sizes; - bool bold; - bool italic; + bool bold; + bool italic; - char *path; - FT_Long index; + char *path; + FT_Long index; }; static inline void font_path_info_free(struct font_path_info *info) @@ -38,4 +38,5 @@ extern void load_os_font_list(void); extern void free_os_font_list(void); extern const char *get_font_path(const char *family, uint16_t size, - const char *style, uint32_t flags, FT_Long *idx); + const char *style, uint32_t flags, + FT_Long *idx);
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/obs-convenience.c -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/obs-convenience.c
Changed
@@ -21,7 +21,8 @@ #include <graphics/vec4.h> #include "obs-convenience.h" -gs_vertbuffer_t *create_uv_vbuffer(uint32_t num_verts, bool add_color) { +gs_vertbuffer_t *create_uv_vbuffer(uint32_t num_verts, bool add_color) +{ obs_enter_graphics(); gs_vertbuffer_t *tmp = NULL; @@ -36,13 +37,13 @@ vrect->tvarray[0].width = 2; vrect->tvarray[0].array = bmalloc(sizeof(struct vec2) * num_verts); if (add_color) - vrect->colors = (uint32_t *)bmalloc - (sizeof(uint32_t)* num_verts); + vrect->colors = + (uint32_t *)bmalloc(sizeof(uint32_t) * num_verts); memset(vrect->points, 0, sizeof(struct vec3) * num_verts); memset(vrect->tvarray[0].array, 0, sizeof(struct vec2) * num_verts); if (add_color) - memset(vrect->colors, 0, sizeof(uint32_t)* num_verts); + memset(vrect->colors, 0, sizeof(uint32_t) * num_verts); tmp = gs_vertexbuffer_create(vrect, GS_DYNAMIC); @@ -56,14 +57,15 @@ } void draw_uv_vbuffer(gs_vertbuffer_t *vbuf, gs_texture_t *tex, - gs_effect_t *effect, uint32_t num_verts) + gs_effect_t *effect, uint32_t num_verts) { - gs_texture_t *texture = tex; + gs_texture_t *texture = tex; gs_technique_t *tech = gs_effect_get_technique(effect, "Draw"); - gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); - size_t passes; + gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); + size_t passes; - if (vbuf == NULL || tex == NULL) return; + if (vbuf == NULL || tex == NULL) + return; gs_vertexbuffer_flush(vbuf); gs_load_vertexbuffer(vbuf);
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/obs-convenience.h -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/obs-convenience.h
Changed
@@ -21,10 +21,10 @@ gs_vertbuffer_t *create_uv_vbuffer(uint32_t num_verts, bool add_color); void draw_uv_vbuffer(gs_vertbuffer_t *vbuf, gs_texture_t *tex, - gs_effect_t *effect, uint32_t num_verts); + gs_effect_t *effect, uint32_t num_verts); -#define set_v3_rect(a, x, y, w, h) \ - vec3_set(a, x, y, 0.0f); \ +#define set_v3_rect(a, x, y, w, h) \ + vec3_set(a, x, y, 0.0f); \ vec3_set(a + 1, x + w, y, 0.0f); \ vec3_set(a + 2, x, y + h, 0.0f); \ vec3_set(a + 3, x, y + h, 0.0f); \ @@ -32,14 +32,14 @@ vec3_set(a + 5, x + w, y + h, 0.0f); #define set_v2_uv(a, u, v, u2, v2) \ - vec2_set(a, u, v); \ - vec2_set(a + 1, u2, v); \ - vec2_set(a + 2, u, v2); \ - vec2_set(a + 3, u, v2); \ - vec2_set(a + 4, u2, v); \ + vec2_set(a, u, v); \ + vec2_set(a + 1, u2, v); \ + vec2_set(a + 2, u, v2); \ + vec2_set(a + 3, u, v2); \ + vec2_set(a + 4, u2, v); \ vec2_set(a + 5, u2, v2); #define set_rect_colors2(a, c1, c2) \ - uint32_t *b = a; \ - b[0] = b[1] = b[4] = c1; \ + uint32_t *b = a; \ + b[0] = b[1] = b[4] = c1; \ b[2] = b[3] = b[5] = c2;
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/text-freetype2.c -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/text-freetype2.c
Changed
@@ -40,9 +40,9 @@ .type = OBS_SOURCE_TYPE_INPUT, .output_flags = OBS_SOURCE_VIDEO | #ifdef _WIN32 - OBS_SOURCE_DEPRECATED | + OBS_SOURCE_DEPRECATED | #endif - OBS_SOURCE_CUSTOM_DRAW, + OBS_SOURCE_CUSTOM_DRAW, .get_name = ft2_source_get_name, .create = ft2_source_create, .destroy = ft2_source_destroy, @@ -128,42 +128,38 @@ // Better/pixel shader outline/drop shadow // Some way to pull text files from network, I dunno - obs_properties_add_font(props, "font", - obs_module_text("Font")); + obs_properties_add_font(props, "font", obs_module_text("Font")); - obs_properties_add_text(props, "text", - obs_module_text("Text"), OBS_TEXT_MULTILINE); + obs_properties_add_text(props, "text", obs_module_text("Text"), + OBS_TEXT_MULTILINE); obs_properties_add_bool(props, "from_file", - obs_module_text("ReadFromFile")); + obs_module_text("ReadFromFile")); obs_properties_add_bool(props, "log_mode", - obs_module_text("ChatLogMode")); + obs_module_text("ChatLogMode")); obs_properties_add_int(props, "log_lines", - obs_module_text("ChatLogLines"), 1, 1000, 1); + obs_module_text("ChatLogLines"), 1, 1000, 1); - obs_properties_add_path(props, - "text_file", obs_module_text("TextFile"), - OBS_PATH_FILE, obs_module_text("TextFileFilter"), NULL); + obs_properties_add_path(props, "text_file", obs_module_text("TextFile"), + OBS_PATH_FILE, + obs_module_text("TextFileFilter"), NULL); - obs_properties_add_color(props, "color1", - obs_module_text("Color1")); + obs_properties_add_color(props, "color1", obs_module_text("Color1")); - obs_properties_add_color(props, "color2", - obs_module_text("Color2")); + obs_properties_add_color(props, "color2", obs_module_text("Color2")); - obs_properties_add_bool(props, "outline", - obs_module_text("Outline")); + obs_properties_add_bool(props, "outline", obs_module_text("Outline")); obs_properties_add_bool(props, "drop_shadow", - obs_module_text("DropShadow")); + obs_module_text("DropShadow")); obs_properties_add_int(props, "custom_width", - obs_module_text("CustomWidth"), 0, 4096, 1); + obs_module_text("CustomWidth"), 0, 4096, 1); obs_properties_add_bool(props, "word_wrap", - obs_module_text("WordWrap")); + obs_module_text("WordWrap")); return props; } @@ -220,17 +216,22 @@ static void ft2_source_render(void *data, gs_effect_t *effect) { struct ft2_source *srcdata = data; - if (srcdata == NULL) return; + if (srcdata == NULL) + return; - if (srcdata->tex == NULL || srcdata->vbuf == NULL) return; - if (srcdata->text == NULL || *srcdata->text == 0) return; + if (srcdata->tex == NULL || srcdata->vbuf == NULL) + return; + if (srcdata->text == NULL || *srcdata->text == 0) + return; gs_reset_blend_state(); - if (srcdata->outline_text) draw_outlines(srcdata); - if (srcdata->drop_shadow) draw_drop_shadow(srcdata); + if (srcdata->outline_text) + draw_outlines(srcdata); + if (srcdata->drop_shadow) + draw_drop_shadow(srcdata); - draw_uv_vbuffer(srcdata->vbuf, srcdata->tex, - srcdata->draw_effect, (uint32_t)wcslen(srcdata->text) * 6); + draw_uv_vbuffer(srcdata->vbuf, srcdata->tex, srcdata->draw_effect, + (uint32_t)wcslen(srcdata->text) * 6); UNUSED_PARAMETER(effect); } @@ -238,8 +239,10 @@ static void ft2_video_tick(void *data, float seconds) { struct ft2_source *srcdata = data; - if (srcdata == NULL) return; - if (!srcdata->from_file || !srcdata->text_file) return; + if (srcdata == NULL) + return; + if (!srcdata->from_file || !srcdata->text_file) + return; if (os_gettime_ns() - srcdata->last_checked >= 1000000000) { time_t t = get_modified_timestamp(srcdata->text_file); @@ -250,7 +253,7 @@ read_from_end(srcdata, srcdata->text_file); else load_text_from_file(srcdata, - srcdata->text_file); + srcdata->text_file); cache_glyphs(srcdata, srcdata->text); set_up_vertex_buffer(srcdata); srcdata->update_file = false; @@ -269,7 +272,8 @@ { FT_Long index; const char *path = get_font_path(srcdata->font_name, srcdata->font_size, - srcdata->font_style, srcdata->font_flags, &index); + srcdata->font_style, + srcdata->font_flags, &index); if (!path) return false; @@ -290,10 +294,10 @@ uint32_t color[2]; uint32_t custom_width = 0; - const char *font_name = obs_data_get_string(font_obj, "face"); + const char *font_name = obs_data_get_string(font_obj, "face"); const char *font_style = obs_data_get_string(font_obj, "style"); - uint16_t font_size = (uint16_t)obs_data_get_int(font_obj, "size"); - uint32_t font_flags = (uint32_t)obs_data_get_int(font_obj, "flags"); + uint16_t font_size = (uint16_t)obs_data_get_int(font_obj, "size"); + uint32_t font_flags = (uint32_t)obs_data_get_int(font_obj, "flags"); if (!font_obj) return; @@ -311,8 +315,7 @@ srcdata->custom_width = custom_width; vbuf_needs_update = true; } - } - else { + } else { if (srcdata->custom_width >= 100) vbuf_needs_update = true; srcdata->custom_width = 0; @@ -339,14 +342,14 @@ } srcdata->log_mode = chat_log_mode; - if (ft2_lib == NULL) goto error; + if (ft2_lib == NULL) + goto error; if (srcdata->draw_effect == NULL) { char *effect_file = NULL; char *error_string = NULL; - effect_file = - obs_module_file("text_default.effect"); + effect_file = obs_module_file("text_default.effect"); if (effect_file) { obs_enter_graphics(); @@ -360,18 +363,17 @@ } } - if (srcdata->font_size != font_size || - srcdata->from_file != from_file) + if (srcdata->font_size != font_size || srcdata->from_file != from_file) vbuf_needs_update = true; srcdata->file_load_failed = false; srcdata->from_file = from_file; if (srcdata->font_name != NULL) { - if (strcmp(font_name, srcdata->font_name) == 0 && + if (strcmp(font_name, srcdata->font_name) == 0 && strcmp(font_style, srcdata->font_style) == 0 && font_flags == srcdata->font_flags && - font_size == srcdata->font_size) + font_size == srcdata->font_size) goto skip_font_load; bfree(srcdata->font_name); @@ -382,17 +384,16 @@ vbuf_needs_update = true; } - srcdata->font_name = bstrdup(font_name); + srcdata->font_name = bstrdup(font_name); srcdata->font_style = bstrdup(font_style); - srcdata->font_size = font_size; + srcdata->font_size = font_size; srcdata->font_flags = font_flags; if (!init_font(srcdata) || srcdata->font_face == NULL) { blog(LOG_WARNING, "FT2-text: Failed to load font %s", - srcdata->font_name); + srcdata->font_name); goto error; - } - else { + } else { FT_Set_Pixel_Sizes(srcdata->font_face, 0, srcdata->font_size); FT_Select_Charmap(srcdata->font_face, FT_ENCODING_UNICODE); } @@ -417,14 +418,15 @@ srcdata->text = NULL; os_utf8_to_wcs_ptr(emptystr, strlen(emptystr), - &srcdata->text); - blog(LOG_WARNING, "FT2-text: Failed to open %s for " - "reading", tmp); - } - else { + &srcdata->text); + blog(LOG_WARNING, + "FT2-text: Failed to open %s for " + "reading", + tmp); + } else { if (srcdata->text_file != NULL && - strcmp(srcdata->text_file, tmp) == 0 && - !vbuf_needs_update) + strcmp(srcdata->text_file, tmp) == 0 && + !vbuf_needs_update) goto error; bfree(srcdata->text_file); @@ -436,10 +438,10 @@ load_text_from_file(srcdata, tmp); srcdata->last_checked = os_gettime_ns(); } - } - else { + } else { const char *tmp = obs_data_get_string(settings, "text"); - if (!tmp || !*tmp) goto error; + if (!tmp || !*tmp) + goto error; if (srcdata->text != NULL) { bfree(srcdata->text);
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/text-freetype2.h -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/text-freetype2.h
Changed
@@ -30,8 +30,8 @@ }; struct ft2_source { - char *font_name; - char *font_style; + char *font_name; + char *font_style; uint16_t font_size; uint32_t font_flags; @@ -54,7 +54,7 @@ struct glyph_info *cacheglyphs[num_cache_slots]; - FT_Face font_face; + FT_Face font_face; uint8_t *texbuf; gs_vertbuffer_t *vbuf;
View file
obs-studio-23.2.1.tar.xz/plugins/text-freetype2/text-functionality.c -> obs-studio-24.0.0.tar.xz/plugins/text-freetype2/text-functionality.c
Changed
@@ -23,8 +23,8 @@ #include "text-freetype2.h" #include "obs-convenience.h" -float offsets[16] = { -2.0f, 0.0f, 0.0f, -2.0f, 2.0f, 0.0f, 2.0f, 0.0f, - 0.0f, 2.0f, 0.0f, 2.0f, -2.0f, 0.0f, -2.0f, 0.0f }; +float offsets[16] = {-2.0f, 0.0f, 0.0f, -2.0f, 2.0f, 0.0f, 2.0f, 0.0f, + 0.0f, 2.0f, 0.0f, 2.0f, -2.0f, 0.0f, -2.0f, 0.0f}; extern uint32_t texbuf_w, texbuf_h; @@ -44,10 +44,10 @@ gs_matrix_push(); for (int32_t i = 0; i < 8; i++) { gs_matrix_translate3f(offsets[i * 2], offsets[(i * 2) + 1], - 0.0f); + 0.0f); draw_uv_vbuffer(srcdata->vbuf, srcdata->tex, - srcdata->draw_effect, - (uint32_t)wcslen(srcdata->text) * 6); + srcdata->draw_effect, + (uint32_t)wcslen(srcdata->text) * 6); } gs_matrix_identity(); gs_matrix_pop(); @@ -70,8 +70,8 @@ gs_matrix_push(); gs_matrix_translate3f(4.0f, 4.0f, 0.0f); - draw_uv_vbuffer(srcdata->vbuf, srcdata->tex, - srcdata->draw_effect, (uint32_t)wcslen(srcdata->text) * 6); + draw_uv_vbuffer(srcdata->vbuf, srcdata->tex, srcdata->draw_effect, + (uint32_t)wcslen(srcdata->text) * 6); gs_matrix_identity(); gs_matrix_pop(); @@ -105,16 +105,19 @@ return; } - srcdata->vbuf = create_uv_vbuffer((uint32_t)wcslen(srcdata->text) * 6, - true); + srcdata->vbuf = + create_uv_vbuffer((uint32_t)wcslen(srcdata->text) * 6, true); - if (srcdata->custom_width <= 100) goto skip_word_wrap; - if (!srcdata->word_wrap) goto skip_word_wrap; + if (srcdata->custom_width <= 100) + goto skip_word_wrap; + if (!srcdata->word_wrap) + goto skip_word_wrap; len = wcslen(srcdata->text); for (uint32_t i = 0; i <= len; i++) { - if (i == wcslen(srcdata->text)) goto eos_check; + if (i == wcslen(srcdata->text)) + goto eos_check; if (srcdata->text[i] != L' ' && srcdata->text[i] != L'\n') goto next_char; @@ -125,7 +128,8 @@ srcdata->text[space_pos] = L'\n'; x = 0; } - if (i == wcslen(srcdata->text)) goto eos_skip; + if (i == wcslen(srcdata->text)) + goto eos_skip; x += word_width; word_width = 0; @@ -134,8 +138,8 @@ if (srcdata->text[i] == L' ') space_pos = i; next_char:; - glyph_index = FT_Get_Char_Index(srcdata->font_face, - srcdata->text[i]); + glyph_index = + FT_Get_Char_Index(srcdata->font_face, srcdata->text[i]); word_width += src_glyph->xadv; eos_skip:; } @@ -148,7 +152,8 @@ void fill_vertex_buffer(struct ft2_source *srcdata) { struct gs_vb_data *vdata = gs_vertexbuffer_get_data(srcdata->vbuf); - if (vdata == NULL || !srcdata->text) return; + if (vdata == NULL || !srcdata->text) + return; struct vec2 *tvarray = (struct vec2 *)vdata->tvarray[0].array; uint32_t *col = (uint32_t *)vdata->colors; @@ -163,28 +168,35 @@ bfree(srcdata->colorbuf); srcdata->colorbuf = NULL; } - srcdata->colorbuf = bzalloc(sizeof(uint32_t)*wcslen(srcdata->text) * 6); + srcdata->colorbuf = + bzalloc(sizeof(uint32_t) * wcslen(srcdata->text) * 6); for (size_t i = 0; i < len * 6; i++) { srcdata->colorbuf[i] = 0xFF000000; } for (size_t i = 0; i < len; i++) { add_linebreak:; - if (srcdata->text[i] != L'\n') goto draw_glyph; - dx = 0; i++; + if (srcdata->text[i] != L'\n') + goto draw_glyph; + dx = 0; + i++; dy += srcdata->max_h + 4; - if (i == wcslen(srcdata->text)) goto skip_glyph; - if (srcdata->text[i] == L'\n') goto add_linebreak; + if (i == wcslen(srcdata->text)) + goto skip_glyph; + if (srcdata->text[i] == L'\n') + goto add_linebreak; draw_glyph:; // Skip filthy dual byte Windows line breaks - if (srcdata->text[i] == L'\r') goto skip_glyph; + if (srcdata->text[i] == L'\r') + goto skip_glyph; - glyph_index = FT_Get_Char_Index(srcdata->font_face, - srcdata->text[i]); + glyph_index = + FT_Get_Char_Index(srcdata->font_face, srcdata->text[i]); if (src_glyph == NULL) goto skip_glyph; - if (srcdata->custom_width < 100) goto skip_custom_width; + if (srcdata->custom_width < 100) + goto skip_custom_width; if (dx + src_glyph->xadv > srcdata->custom_width) { dx = 0; @@ -194,18 +206,13 @@ skip_custom_width:; set_v3_rect(vdata->points + (cur_glyph * 6), - (float)dx + (float)src_glyph->xoff, - (float)dy - (float)src_glyph->yoff, - (float)src_glyph->w, - (float)src_glyph->h); - set_v2_uv(tvarray + (cur_glyph * 6), - src_glyph->u, - src_glyph->v, - src_glyph->u2, - src_glyph->v2); - set_rect_colors2(col + (cur_glyph * 6), - srcdata->color[0], - srcdata->color[1]); + (float)dx + (float)src_glyph->xoff, + (float)dy - (float)src_glyph->yoff, + (float)src_glyph->w, (float)src_glyph->h); + set_v2_uv(tvarray + (cur_glyph * 6), src_glyph->u, src_glyph->v, + src_glyph->u2, src_glyph->v2); + set_rect_colors2(col + (cur_glyph * 6), srcdata->color[0], + srcdata->color[1]); dx += src_glyph->xadv; if (dy - (float)src_glyph->yoff + src_glyph->h > max_y) max_y = dy - src_glyph->yoff + src_glyph->h; @@ -228,12 +235,12 @@ srcdata->texbuf_x = 0; srcdata->texbuf_y = 0; - cache_glyphs(srcdata, L"abcdefghijklmnopqrstuvwxyz" \ - L"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" \ - L"!@#$%^&*()-_=+,<.>/?\\|[]{}`~ \'\"\0"); + cache_glyphs(srcdata, L"abcdefghijklmnopqrstuvwxyz" + L"ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" + L"!@#$%^&*()-_=+,<.>/?\\|[]{}`~ \'\"\0"); } -#define glyph_pos x + (y*slot->bitmap.pitch) +#define glyph_pos x + (y * slot->bitmap.pitch) #define buf_pos (dx + x) + ((dy + y) * texbuf_w) void cache_glyphs(struct ft2_source *srcdata, wchar_t *cache_glyphs) @@ -252,8 +259,8 @@ size_t len = wcslen(cache_glyphs); for (size_t i = 0; i < len; i++) { - glyph_index = FT_Get_Char_Index(srcdata->font_face, - cache_glyphs[i]); + glyph_index = + FT_Get_Char_Index(srcdata->font_face, cache_glyphs[i]); if (src_glyph != NULL) goto skip_glyph; @@ -264,7 +271,8 @@ uint32_t g_w = slot->bitmap.width; uint32_t g_h = slot->bitmap.rows; - if (srcdata->max_h < g_h) srcdata->max_h = g_h; + if (srcdata->max_h < g_h) + srcdata->max_h = g_h; if (dx + g_w >= texbuf_w) { dx = 0; @@ -272,7 +280,8 @@ } if (dy + g_h >= texbuf_h) { - blog(LOG_WARNING, "Out of space trying to render glyphs"); + blog(LOG_WARNING, + "Out of space trying to render glyphs"); break; } @@ -317,8 +326,9 @@ gs_texture_destroy(tmp_texture); } - srcdata->tex = gs_texture_create(texbuf_w, texbuf_h, - GS_A8, 1, (const uint8_t **)&srcdata->texbuf, 0); + srcdata->tex = gs_texture_create( + texbuf_w, texbuf_h, GS_A8, 1, + (const uint8_t **)&srcdata->texbuf, 0); obs_leave_graphics(); } @@ -336,7 +346,7 @@ return stats.st_mtime; } -static void remove_cr(wchar_t* source) +static void remove_cr(wchar_t *source) { int j = 0; for (int i = 0; source[i] != '\0'; ++i) { @@ -393,9 +403,9 @@ bfree(srcdata->text); srcdata->text = NULL; } - srcdata->text = bzalloc((strlen(tmp_read) + 1)*sizeof(wchar_t)); - os_utf8_to_wcs(tmp_read, strlen(tmp_read), - srcdata->text, (strlen(tmp_read) + 1)); + srcdata->text = bzalloc((strlen(tmp_read) + 1) * sizeof(wchar_t)); + os_utf8_to_wcs(tmp_read, strlen(tmp_read), srcdata->text, + (strlen(tmp_read) + 1)); remove_cr(srcdata->text); bfree(tmp_read); @@ -431,16 +441,17 @@ log_lines = srcdata->log_lines; while (line_breaks <= log_lines && cur_pos != 0) { - if (!utf16) cur_pos--; - else cur_pos -= 2; + if (!utf16) + cur_pos--; + else + cur_pos -= 2; fseek(tmp_file, cur_pos, SEEK_SET); if (!utf16) { bytes_read = fread(&bvalue, 1, 1, tmp_file); if (bytes_read == 1 && bvalue == '\n') line_breaks++; - } - else { + } else { bytes_read = fread(&value, 2, 1, tmp_file); if (bytes_read == 2 && value == L'\n') line_breaks++; @@ -458,8 +469,8 @@ srcdata->text = NULL; } srcdata->text = bzalloc(filesize - cur_pos); - bytes_read = fread(srcdata->text, (filesize - cur_pos), 1, - tmp_file); + bytes_read = + fread(srcdata->text, (filesize - cur_pos), 1, tmp_file); remove_cr(srcdata->text); bfree(tmp_read); @@ -476,9 +487,9 @@ bfree(srcdata->text); srcdata->text = NULL; } - srcdata->text = bzalloc((strlen(tmp_read) + 1)*sizeof(wchar_t)); - os_utf8_to_wcs(tmp_read, strlen(tmp_read), - srcdata->text, (strlen(tmp_read) + 1)); + srcdata->text = bzalloc((strlen(tmp_read) + 1) * sizeof(wchar_t)); + os_utf8_to_wcs(tmp_read, strlen(tmp_read), srcdata->text, + (strlen(tmp_read) + 1)); remove_cr(srcdata->text); bfree(tmp_read); @@ -499,10 +510,12 @@ glyph_index = FT_Get_Char_Index(srcdata->font_face, text[i]); FT_Load_Glyph(srcdata->font_face, glyph_index, FT_LOAD_DEFAULT); - if (text[i] == L'\n') w = 0; + if (text[i] == L'\n') + w = 0; else { w += slot->advance.x >> 6; - if (w > max_w) max_w = w; + if (w > max_w) + max_w = w; } }
View file
obs-studio-23.2.1.tar.xz/plugins/vlc-video/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/vlc-video/data/locale/de-DE.ini
Changed
@@ -1,4 +1,4 @@ -VLCSource="VLC-Videoquelle" +VLCSource="VLC‐Videoquelle" Playlist="Wiedergabeliste" LoopPlaylist="Wiedergabeliste wiederholen" Shuffle="Wiedergabeliste zufällig wiedergeben"
View file
obs-studio-23.2.1.tar.xz/plugins/vlc-video/data/locale/es-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/vlc-video/data/locale/es-ES.ini
Changed
@@ -13,6 +13,6 @@ PlaylistNext="Siguiente" PlaylistPrev="Anterior" AudioTrack="Pista de audio" -SubtitleTrack="Rastreador de subtítulos" +SubtitleTrack="Pista de subtítulos" SubtitleEnable="Subtítulos activados"
View file
obs-studio-24.0.0.tar.xz/plugins/vlc-video/data/locale/gl-ES.ini
Added
@@ -0,0 +1,18 @@ +VLCSource="Fonte de vídeo VLC" +Playlist="Lista de reprodución" +LoopPlaylist="Lista de reprodución en bucle" +Shuffle="Barallar a lista de reprodución" +PlaybackBehavior="Comportamento da visibilidade" +PlaybackBehavior.StopRestart="Parar cando non é visíbel, reiniciar cando sexa visíbel" +PlaybackBehavior.PauseUnpause="Pór en pausa cando non é visíbel, reiniciar cando sexa visíbel" +PlaybackBehavior.AlwaysPlay="Reproducir sempre cando non estea visíbel" +NetworkCaching="Caché de rede (ms)" +PlayPause="Reproducir/Pór en pausa" +Restart="Reiniciar" +Stop="Parar" +PlaylistNext="Seguinte" +PlaylistPrev="Anterior" +AudioTrack="Pista de son" +SubtitleTrack="Pista de subtítulos" +SubtitleEnable="Subtítulos activados" +
View file
obs-studio-23.2.1.tar.xz/plugins/vlc-video/data/locale/ko-KR.ini -> obs-studio-24.0.0.tar.xz/plugins/vlc-video/data/locale/ko-KR.ini
Changed
@@ -4,7 +4,7 @@ Shuffle="재생목록 섞기" PlaybackBehavior="표시 동작 설정" PlaybackBehavior.StopRestart="보이지 않을 때 중단, 보이면 재시작" -PlaybackBehavior.PauseUnpause="보이지 않을 때 일시 중지, 보이면 일시 중지 해제" +PlaybackBehavior.PauseUnpause="보이지 않을 때 일시 정지, 보이면 일시 정지 해제" PlaybackBehavior.AlwaysPlay="보이지 않더라도 항상 재생" NetworkCaching="네트워크 캐싱 (ms)" PlayPause="재생/일시정지"
View file
obs-studio-23.2.1.tar.xz/plugins/vlc-video/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/vlc-video/data/locale/ro-RO.ini
Changed
@@ -1,8 +1,8 @@ -VLCSource="Sursă Video VLC" +VLCSource="Sursă video VLC" Playlist="Listă de redare" LoopPlaylist="Repetă lista de redare" Shuffle="Amestecă lista de redare" -PlaybackBehavior="Comportament vizibilitate" +PlaybackBehavior="Comportamentul vizibilității" PlaybackBehavior.StopRestart="Oprește cand nu este vizibil, repornește cand este vizibil" PlaybackBehavior.PauseUnpause="Pauză cand nu este vizibil, continuă cand este vizibil" PlaybackBehavior.AlwaysPlay="Redă întotdeauna chiar si când nu este vizibil"
View file
obs-studio-24.0.0.tar.xz/plugins/vlc-video/data/locale/sl-SI.ini
Added
@@ -0,0 +1,18 @@ +VLCSource="Vir videoposnetkov VLC" +Playlist="Seznam predvajanja" +LoopPlaylist="Ponavljaj seznam predvajanja" +Shuffle="Premešaj seznam predvajanja" +PlaybackBehavior="Vedenje vidnosti" +PlaybackBehavior.StopRestart="Ustavi, ko ni vidno; ponovno zaženi, ko je vidno" +PlaybackBehavior.PauseUnpause="Premor, ko ni vidno; nadaljuj, ko je vidno" +PlaybackBehavior.AlwaysPlay="Vedno predvajaj, tudi ko ni vidno" +NetworkCaching="Omrežno medpomnenje (ms)" +PlayPause="Predvajaj/Premor" +Restart="Ponovno zaženi" +Stop="Ustavi" +PlaylistNext="Naslednja" +PlaylistPrev="Prejšnja" +AudioTrack="Zvočna sled" +SubtitleTrack="Sled podnapisov" +SubtitleEnable="Omogoči podnapise" +
View file
obs-studio-23.2.1.tar.xz/plugins/vlc-video/vlc-video-plugin.c -> obs-studio-24.0.0.tar.xz/plugins/vlc-video/vlc-video-plugin.c
Changed
@@ -53,10 +53,12 @@ LIBVLC_MEDIA_LIST_PLAYER_PLAY libvlc_media_list_player_play_; LIBVLC_MEDIA_LIST_PLAYER_PAUSE libvlc_media_list_player_pause_; LIBVLC_MEDIA_LIST_PLAYER_STOP libvlc_media_list_player_stop_; -LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_PLAYER libvlc_media_list_player_set_media_player_; +LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_PLAYER +libvlc_media_list_player_set_media_player_; LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_LIST libvlc_media_list_player_set_media_list_; LIBVLC_MEDIA_LIST_PLAYER_EVENT_MANAGER libvlc_media_list_player_event_manager_; -LIBVLC_MEDIA_LIST_PLAYER_SET_PLAYBACK_MODE libvlc_media_list_player_set_playback_mode_; +LIBVLC_MEDIA_LIST_PLAYER_SET_PLAYBACK_MODE +libvlc_media_list_player_set_playback_mode_; LIBVLC_MEDIA_LIST_PLAYER_NEXT libvlc_media_list_player_next_; LIBVLC_MEDIA_LIST_PLAYER_PREVIOUS libvlc_media_list_player_previous_; @@ -70,14 +72,16 @@ static bool load_vlc_funcs(void) { -#define LOAD_VLC_FUNC(func) \ - do { \ - func ## _ = os_dlsym(libvlc_module, #func); \ - if (!func ## _) { \ - blog(LOG_WARNING, "Could not func VLC function %s, " \ - "VLC loading failed", #func); \ - return false; \ - } \ +#define LOAD_VLC_FUNC(func) \ + do { \ + func##_ = os_dlsym(libvlc_module, #func); \ + if (!func##_) { \ + blog(LOG_WARNING, \ + "Could not func VLC function %s, " \ + "VLC loading failed", \ + #func); \ + return false; \ + } \ } while (false) /* libvlc core */ @@ -133,23 +137,22 @@ static bool load_libvlc_module(void) { #ifdef _WIN32 - char *path_utf8 = NULL; + char *path_utf8 = NULL; wchar_t path[1024]; LSTATUS status; - DWORD size; - HKEY key; + DWORD size; + HKEY key; memset(path, 0, 1024 * sizeof(wchar_t)); - status = RegOpenKeyW(HKEY_LOCAL_MACHINE, - L"SOFTWARE\\VideoLAN\\VLC", - &key); + status = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\VideoLAN\\VLC", + &key); if (status != ERROR_SUCCESS) return false; size = 1024; - status = RegQueryValueExW(key, L"InstallDir", NULL, NULL, - (LPBYTE)path, &size); + status = RegQueryValueExW(key, L"InstallDir", NULL, NULL, (LPBYTE)path, + &size); if (status == ERROR_SUCCESS) { wcscat(path, L"\\libvlc.dll"); os_wcs_to_utf8_ptr(path, 0, &path_utf8); @@ -201,7 +204,7 @@ { if (!load_libvlc_module()) { blog(LOG_INFO, "Couldn't find VLC installation, VLC video " - "source disabled"); + "source disabled"); return true; }
View file
obs-studio-23.2.1.tar.xz/plugins/vlc-video/vlc-video-plugin.h -> obs-studio-24.0.0.tar.xz/plugins/vlc-video/vlc-video-plugin.h
Changed
@@ -22,99 +22,81 @@ typedef void (*LIBVLC_RELEASE)(libvlc_instance_t *p_instance); typedef int64_t (*LIBVLC_CLOCK)(void); typedef int (*LIBVLC_EVENT_ATTACH)(libvlc_event_manager_t *p_event_manager, - libvlc_event_type_t i_event_type, - libvlc_callback_t f_callback, - void *user_data); + libvlc_event_type_t i_event_type, + libvlc_callback_t f_callback, + void *user_data); /* libvlc media */ -typedef libvlc_media_t *(*LIBVLC_MEDIA_NEW_PATH)( - libvlc_instance_t *p_instance, const char *path); +typedef libvlc_media_t *(*LIBVLC_MEDIA_NEW_PATH)(libvlc_instance_t *p_instance, + const char *path); typedef libvlc_media_t *(*LIBVLC_MEDIA_NEW_LOCATION)( - libvlc_instance_t *p_instance, const char *location); -typedef void (*LIBVLC_MEDIA_ADD_OPTION)(libvlc_media_t *p_md, const char *options); + libvlc_instance_t *p_instance, const char *location); +typedef void (*LIBVLC_MEDIA_ADD_OPTION)(libvlc_media_t *p_md, + const char *options); typedef void (*LIBVLC_MEDIA_RETAIN)(libvlc_media_t *p_md); typedef void (*LIBVLC_MEDIA_RELEASE)(libvlc_media_t *p_md); /* libvlc media player */ typedef libvlc_media_player_t *(*LIBVLC_MEDIA_PLAYER_NEW)( - libvlc_instance_t *p_libvlc); + libvlc_instance_t *p_libvlc); typedef libvlc_media_player_t *(*LIBVLC_MEDIA_PLAYER_NEW_FROM_MEDIA)( - libvlc_media_t *p_md); -typedef void (*LIBVLC_MEDIA_PLAYER_RELEASE)( - libvlc_media_player_t *p_mi); -typedef void (*LIBVLC_VIDEO_SET_CALLBACKS)( - libvlc_media_player_t *mp, - libvlc_video_lock_cb lock, - libvlc_video_unlock_cb unlock, - libvlc_video_display_cb display, - void *opaque); + libvlc_media_t *p_md); +typedef void (*LIBVLC_MEDIA_PLAYER_RELEASE)(libvlc_media_player_t *p_mi); +typedef void (*LIBVLC_VIDEO_SET_CALLBACKS)(libvlc_media_player_t *mp, + libvlc_video_lock_cb lock, + libvlc_video_unlock_cb unlock, + libvlc_video_display_cb display, + void *opaque); typedef void (*LIBVLC_VIDEO_SET_FORMAT_CALLBACKS)( - libvlc_media_player_t *mp, - libvlc_video_format_cb setup, - libvlc_video_cleanup_cb cleanup); + libvlc_media_player_t *mp, libvlc_video_format_cb setup, + libvlc_video_cleanup_cb cleanup); typedef void (*LIBVLC_AUDIO_SET_CALLBACKS)( - libvlc_media_player_t *mp, - libvlc_audio_play_cb play, - libvlc_audio_pause_cb pause, - libvlc_audio_resume_cb resume, - libvlc_audio_flush_cb flush, - libvlc_audio_drain_cb drain, - void *opaque); + libvlc_media_player_t *mp, libvlc_audio_play_cb play, + libvlc_audio_pause_cb pause, libvlc_audio_resume_cb resume, + libvlc_audio_flush_cb flush, libvlc_audio_drain_cb drain, void *opaque); typedef void (*LIBVLC_AUDIO_SET_FORMAT_CALLBACKS)( - libvlc_media_player_t *mp, - libvlc_audio_setup_cb setup, - libvlc_audio_cleanup_cb cleanup); -typedef int (*LIBVLC_MEDIA_PLAYER_PLAY)( - libvlc_media_player_t *p_mi); -typedef void (*LIBVLC_MEDIA_PLAYER_STOP)( - libvlc_media_player_t *p_mi); + libvlc_media_player_t *mp, libvlc_audio_setup_cb setup, + libvlc_audio_cleanup_cb cleanup); +typedef int (*LIBVLC_MEDIA_PLAYER_PLAY)(libvlc_media_player_t *p_mi); +typedef void (*LIBVLC_MEDIA_PLAYER_STOP)(libvlc_media_player_t *p_mi); typedef libvlc_time_t (*LIBVLC_MEDIA_PLAYER_GET_TIME)( - libvlc_media_player_t *p_mi); -typedef int (*LIBVLC_VIDEO_GET_SIZE)( - libvlc_media_player_t *p_mi, - unsigned num, - unsigned *px, - unsigned *py); + libvlc_media_player_t *p_mi); +typedef int (*LIBVLC_VIDEO_GET_SIZE)(libvlc_media_player_t *p_mi, unsigned num, + unsigned *px, unsigned *py); typedef libvlc_event_manager_t *(*LIBVLC_MEDIA_PLAYER_EVENT_MANAGER)( - libvlc_media_player_t *p_mp); + libvlc_media_player_t *p_mp); /* libvlc media list */ typedef libvlc_media_list_t *(*LIBVLC_MEDIA_LIST_NEW)( - libvlc_instance_t *p_instance); + libvlc_instance_t *p_instance); typedef void (*LIBVLC_MEDIA_LIST_RELEASE)(libvlc_media_list_t *p_ml); typedef int (*LIBVLC_MEDIA_LIST_ADD_MEDIA)(libvlc_media_list_t *p_ml, - libvlc_media_t *p_md); + libvlc_media_t *p_md); typedef void (*LIBVLC_MEDIA_LIST_LOCK)(libvlc_media_list_t *p_ml); typedef void (*LIBVLC_MEDIA_LIST_UNLOCK)(libvlc_media_list_t *p_ml); typedef libvlc_event_manager_t *(*LIBVLC_MEDIA_LIST_EVENT_MANAGER)( - libvlc_media_list_t *p_ml); + libvlc_media_list_t *p_ml); /* libvlc media list player */ typedef libvlc_media_list_player_t *(*LIBVLC_MEDIA_LIST_PLAYER_NEW)( - libvlc_instance_t * p_instance); + libvlc_instance_t *p_instance); typedef void (*LIBVLC_MEDIA_LIST_PLAYER_RELEASE)( - libvlc_media_list_player_t *p_mlp); -typedef void (*LIBVLC_MEDIA_LIST_PLAYER_PLAY)( - libvlc_media_list_player_t *p_mlp); + libvlc_media_list_player_t *p_mlp); +typedef void (*LIBVLC_MEDIA_LIST_PLAYER_PLAY)(libvlc_media_list_player_t *p_mlp); typedef void (*LIBVLC_MEDIA_LIST_PLAYER_PAUSE)( - libvlc_media_list_player_t *p_mlp); -typedef void (*LIBVLC_MEDIA_LIST_PLAYER_STOP)( - libvlc_media_list_player_t *p_mlp); + libvlc_media_list_player_t *p_mlp); +typedef void (*LIBVLC_MEDIA_LIST_PLAYER_STOP)(libvlc_media_list_player_t *p_mlp); typedef void (*LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_PLAYER)( - libvlc_media_list_player_t *p_mlp, - libvlc_media_player_t *p_mp); + libvlc_media_list_player_t *p_mlp, libvlc_media_player_t *p_mp); typedef void (*LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_LIST)( - libvlc_media_list_player_t *p_mlp, - libvlc_media_list_t *p_mlist); + libvlc_media_list_player_t *p_mlp, libvlc_media_list_t *p_mlist); typedef libvlc_event_manager_t *(*LIBVLC_MEDIA_LIST_PLAYER_EVENT_MANAGER)( - libvlc_media_list_player_t *p_mlp); + libvlc_media_list_player_t *p_mlp); typedef void (*LIBVLC_MEDIA_LIST_PLAYER_SET_PLAYBACK_MODE)( - libvlc_media_list_player_t *p_mlp, - libvlc_playback_mode_t e_mode); -typedef int (*LIBVLC_MEDIA_LIST_PLAYER_NEXT)( - libvlc_media_list_player_t *p_mlp); + libvlc_media_list_player_t *p_mlp, libvlc_playback_mode_t e_mode); +typedef int (*LIBVLC_MEDIA_LIST_PLAYER_NEXT)(libvlc_media_list_player_t *p_mlp); typedef int (*LIBVLC_MEDIA_LIST_PLAYER_PREVIOUS)( - libvlc_media_list_player_t *p_mlp); + libvlc_media_list_player_t *p_mlp); /* -------------------------------------------------------------------- */ @@ -159,82 +141,88 @@ extern LIBVLC_MEDIA_LIST_PLAYER_PLAY libvlc_media_list_player_play_; extern LIBVLC_MEDIA_LIST_PLAYER_PAUSE libvlc_media_list_player_pause_; extern LIBVLC_MEDIA_LIST_PLAYER_STOP libvlc_media_list_player_stop_; -extern LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_PLAYER libvlc_media_list_player_set_media_player_; -extern LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_LIST libvlc_media_list_player_set_media_list_; -extern LIBVLC_MEDIA_LIST_PLAYER_EVENT_MANAGER libvlc_media_list_player_event_manager_; -extern LIBVLC_MEDIA_LIST_PLAYER_SET_PLAYBACK_MODE libvlc_media_list_player_set_playback_mode_; +extern LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_PLAYER + libvlc_media_list_player_set_media_player_; +extern LIBVLC_MEDIA_LIST_PLAYER_SET_MEDIA_LIST + libvlc_media_list_player_set_media_list_; +extern LIBVLC_MEDIA_LIST_PLAYER_EVENT_MANAGER + libvlc_media_list_player_event_manager_; +extern LIBVLC_MEDIA_LIST_PLAYER_SET_PLAYBACK_MODE + libvlc_media_list_player_set_playback_mode_; extern LIBVLC_MEDIA_LIST_PLAYER_NEXT libvlc_media_list_player_next_; extern LIBVLC_MEDIA_LIST_PLAYER_PREVIOUS libvlc_media_list_player_previous_; #define EXTENSIONS_AUDIO \ - "*.3ga;" \ - "*.669;" \ - "*.a52;" \ - "*.aac;" \ - "*.ac3;" \ - "*.adt;" \ - "*.adts;" \ - "*.aif;"\ - "*.aifc;"\ - "*.aiff;"\ - "*.amb;" \ - "*.amr;" \ - "*.aob;" \ - "*.ape;" \ - "*.au;" \ - "*.awb;" \ - "*.caf;" \ - "*.dts;" \ - "*.flac;"\ - "*.it;" \ - "*.kar;" \ - "*.m4a;" \ - "*.m4b;" \ - "*.m4p;" \ - "*.m5p;" \ - "*.mid;" \ - "*.mka;" \ - "*.mlp;" \ - "*.mod;" \ - "*.mpa;" \ - "*.mp1;" \ - "*.mp2;" \ - "*.mp3;" \ - "*.mpc;" \ - "*.mpga;" \ - "*.mus;" \ - "*.oga;" \ - "*.ogg;" \ - "*.oma;" \ - "*.opus;" \ - "*.qcp;" \ - "*.ra;" \ - "*.rmi;" \ - "*.s3m;" \ - "*.sid;" \ - "*.spx;" \ - "*.tak;" \ - "*.thd;" \ - "*.tta;" \ - "*.voc;" \ - "*.vqf;" \ - "*.w64;" \ - "*.wav;" \ - "*.wma;" \ - "*.wv;" \ - "*.xa;" \ + "*.3ga;" \ + "*.669;" \ + "*.a52;" \ + "*.aac;" \ + "*.ac3;" \ + "*.adt;" \ + "*.adts;" \ + "*.aif;" \ + "*.aifc;" \ + "*.aiff;" \ + "*.amb;" \ + "*.amr;" \ + "*.aob;" \ + "*.ape;" \ + "*.au;" \ + "*.awb;" \ + "*.caf;" \ + "*.dts;" \ + "*.flac;" \ + "*.it;" \ + "*.kar;" \ + "*.m4a;" \ + "*.m4b;" \ + "*.m4p;" \ + "*.m5p;" \ + "*.mid;" \ + "*.mka;" \ + "*.mlp;" \ + "*.mod;" \ + "*.mpa;" \ + "*.mp1;" \ + "*.mp2;" \ + "*.mp3;" \ + "*.mpc;" \ + "*.mpga;" \ + "*.mus;" \ + "*.oga;" \ + "*.ogg;" \ + "*.oma;" \ + "*.opus;" \ + "*.qcp;" \ + "*.ra;" \ + "*.rmi;" \ + "*.s3m;" \ + "*.sid;" \ + "*.spx;" \ + "*.tak;" \ + "*.thd;" \ + "*.tta;" \ + "*.voc;" \ + "*.vqf;" \ + "*.w64;" \ + "*.wav;" \ + "*.wma;" \ + "*.wv;" \ + "*.xa;" \ "*.xm" -#define EXTENSIONS_VIDEO "*.3g2;*.3gp;*.3gp2;*.3gpp;*.amv;*.asf;*.avi;" \ - "*.bik;*.bin;*.crf;*.divx;*.drc;*.dv;*.evo;*.f4v;*.flv;*.gvi;*.gxf;" \ +#define EXTENSIONS_VIDEO \ + "*.3g2;*.3gp;*.3gp2;*.3gpp;*.amv;*.asf;*.avi;" \ + "*.bik;*.bin;*.crf;*.divx;*.drc;*.dv;*.evo;*.f4v;*.flv;*.gvi;*.gxf;" \ "*.iso;*.m1v;*.m2v;*.m2t;*.m2ts;*.m4v;*.mkv;*.mov;*.mp2;*.mp2v;*.mp4;" \ - "*.mp4v;*.mpe;*.mpeg;*.mpeg1;*.mpeg2;*.mpeg4;*.mpg;*.mpv2;*.mts;" \ - "*.mtv;*.mxf;*.mxg;*.nsv;*.nuv;*.ogg;*.ogm;*.ogv;*.ogx;*.ps;*.rec;" \ - "*.rm;*.rmvb;*.rpl;*.thp;*.tod;*.ts;*.tts;*.txd;*.vob;*.vro;*.webm;" \ + "*.mp4v;*.mpe;*.mpeg;*.mpeg1;*.mpeg2;*.mpeg4;*.mpg;*.mpv2;*.mts;" \ + "*.mtv;*.mxf;*.mxg;*.nsv;*.nuv;*.ogg;*.ogm;*.ogv;*.ogx;*.ps;*.rec;" \ + "*.rm;*.rmvb;*.rpl;*.thp;*.tod;*.ts;*.tts;*.txd;*.vob;*.vro;*.webm;" \ "*.wm;*.wmv;*.wtv;*.xesc" -#define EXTENSIONS_PLAYLIST "*.asx;*.b4s;*.cue;*.ifo;*.m3u;*.m3u8;*.pls;" \ +#define EXTENSIONS_PLAYLIST \ + "*.asx;*.b4s;*.cue;*.ifo;*.m3u;*.m3u8;*.pls;" \ "*.ram;*.rar;*.sdp;*.vlc;*.xspf;*.wax;*.wvx;*.zip;*.conf" -#define EXTENSIONS_MEDIA EXTENSIONS_VIDEO ";" EXTENSIONS_AUDIO ";" \ - EXTENSIONS_PLAYLIST +#define EXTENSIONS_MEDIA \ + EXTENSIONS_VIDEO ";" EXTENSIONS_AUDIO ";" EXTENSIONS_PLAYLIST
View file
obs-studio-23.2.1.tar.xz/plugins/vlc-video/vlc-video-source.c -> obs-studio-24.0.0.tar.xz/plugins/vlc-video/vlc-video-source.c
Changed
@@ -4,11 +4,13 @@ #include <util/platform.h> #include <util/dstr.h> -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[vlc_source: '%s'] " format, \ - obs_source_get_name(ss->source), ##__VA_ARGS__) + obs_source_get_name(ss->source), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) + +/* clang-format off */ #define S_PLAYLIST "playlist" #define S_LOOP "loop" @@ -35,6 +37,8 @@ #define T_SUBTITLE_ENABLE T_("SubtitleEnable") #define T_SUBTITLE_TRACK T_("SubtitleTrack") +/* clang-format on */ + /* ------------------------------------------------------------------------- */ struct media_file_data { @@ -94,8 +98,8 @@ static inline libvlc_media_t *create_media_from_file(const char *file) { return (file && strstr(file, "://") != NULL) - ? libvlc_media_new_location_(libvlc, file) - : libvlc_media_new_path_(libvlc, file); + ? libvlc_media_new_location_(libvlc, file) + : libvlc_media_new_path_(libvlc, file); } static void free_files(struct darray *array) @@ -113,25 +117,26 @@ static inline bool chroma_is(const char *chroma, const char *val) { - return *(uint32_t*)chroma == *(uint32_t*)val; + return *(uint32_t *)chroma == *(uint32_t *)val; } static enum video_format convert_vlc_video_format(char *chroma, bool *full) { *full = false; -#define CHROMA_TEST(val, ret) \ - if (chroma_is(chroma, val)) return ret -#define CHROMA_CONV(val, new_val, ret) \ - do { \ - if (chroma_is(chroma, val)) { \ - *(uint32_t*)chroma = *(uint32_t*)new_val; \ - return ret; \ - } \ +#define CHROMA_TEST(val, ret) \ + if (chroma_is(chroma, val)) \ + return ret +#define CHROMA_CONV(val, new_val, ret) \ + do { \ + if (chroma_is(chroma, val)) { \ + *(uint32_t *)chroma = *(uint32_t *)new_val; \ + return ret; \ + } \ } while (false) -#define CHROMA_CONV_FULL(val, new_val, ret) \ - do { \ - *full = true; \ +#define CHROMA_CONV_FULL(val, new_val, ret) \ + do { \ + *full = true; \ CHROMA_CONV(val, new_val, ret); \ } while (false) @@ -205,12 +210,12 @@ #undef CHROMA_CONV #undef CHROMA_TEST - *(uint32_t*)chroma = *(uint32_t*)"BGRA"; + *(uint32_t *)chroma = *(uint32_t *)"BGRA"; return VIDEO_FORMAT_BGRA; } static inline unsigned get_format_lines(enum video_format format, - unsigned height, size_t plane) + unsigned height, size_t plane) { switch (format) { case VIDEO_FORMAT_I420: @@ -225,7 +230,9 @@ case VIDEO_FORMAT_BGRX: case VIDEO_FORMAT_Y800: return height; - case VIDEO_FORMAT_NONE:; + case VIDEO_FORMAT_NONE: + default: + break; } return 0; @@ -233,14 +240,15 @@ static enum audio_format convert_vlc_audio_format(char *format) { -#define AUDIO_TEST(val, ret) \ - if (chroma_is(format, val)) return ret -#define AUDIO_CONV(val, new_val, ret) \ - do { \ - if (chroma_is(format, val)) { \ - *(uint32_t*)format = *(uint32_t*)new_val; \ - return ret; \ - } \ +#define AUDIO_TEST(val, ret) \ + if (chroma_is(format, val)) \ + return ret +#define AUDIO_CONV(val, new_val, ret) \ + do { \ + if (chroma_is(format, val)) { \ + *(uint32_t *)format = *(uint32_t *)new_val; \ + return ret; \ + } \ } while (false) AUDIO_TEST("S16N", AUDIO_FORMAT_16BIT); @@ -262,7 +270,7 @@ #undef AUDIO_CONV #undef AUDIO_TEST - *(uint32_t*)format = *(uint32_t*)"FL32"; + *(uint32_t *)format = *(uint32_t *)"FL32"; return AUDIO_FORMAT_FLOAT; } @@ -286,7 +294,7 @@ libvlc_media_player_release_(c->media_player); } - bfree((void*)c->audio.data[0]); + bfree((void *)c->audio.data[0]); obs_source_frame_free(&c->frame); free_files(&c->files.da); @@ -312,7 +320,8 @@ } static unsigned vlcs_video_format(void **p_data, char *chroma, unsigned *width, - unsigned *height, unsigned *pitches, unsigned *lines) + unsigned *height, unsigned *pitches, + unsigned *lines) { struct vlc_source *c = *p_data; enum video_format new_format; @@ -334,25 +343,24 @@ libvlc_video_get_size_(c->media_player, 0, &new_width, &new_height); if (new_width && new_height) { - *width = new_width; + *width = new_width; *height = new_height; } /* don't allocate a new frame if format/width/height hasn't changed */ - if (c->frame.format != new_format || - c->frame.width != *width || + if (c->frame.format != new_format || c->frame.width != *width || c->frame.height != *height) { obs_source_frame_free(&c->frame); obs_source_frame_init(&c->frame, new_format, *width, *height); c->frame.format = new_format; c->frame.full_range = new_range; - range = c->frame.full_range ? - VIDEO_RANGE_FULL : VIDEO_RANGE_PARTIAL; + range = c->frame.full_range ? VIDEO_RANGE_FULL + : VIDEO_RANGE_PARTIAL; video_format_get_parameters(VIDEO_CS_DEFAULT, range, - c->frame.color_matrix, - c->frame.color_range_min, - c->frame.color_range_max); + c->frame.color_matrix, + c->frame.color_range_min, + c->frame.color_range_max); } while (c->frame.data[i]) { @@ -365,17 +373,17 @@ } static void vlcs_audio_play(void *data, const void *samples, unsigned count, - int64_t pts) + int64_t pts) { struct vlc_source *c = data; size_t size = get_audio_size(c->audio.format, c->audio.speakers, count); if (c->audio_capacity < count) { - c->audio.data[0] = brealloc((void*)c->audio.data[0], size); + c->audio.data[0] = brealloc((void *)c->audio.data[0], size); c->audio_capacity = count; } - memcpy((void*)c->audio.data[0], samples, size); + memcpy((void *)c->audio.data[0], samples, size); c->audio.timestamp = (uint64_t)pts * 1000ULL - time_start; c->audio.frames = count; @@ -383,7 +391,7 @@ } static int vlcs_audio_setup(void **p_data, char *format, unsigned *rate, - unsigned *channels) + unsigned *channels) { struct vlc_source *c = *p_data; enum audio_format new_audio_format; @@ -395,22 +403,22 @@ /* don't free audio data if the data is the same format */ if (c->audio.format == new_audio_format && c->audio.samples_per_sec == *rate && - c->audio.speakers == (enum speaker_layout)*channels) + c->audio.speakers == (enum speaker_layout) * channels) return 0; c->audio_capacity = 0; - bfree((void*)c->audio.data[0]); + bfree((void *)c->audio.data[0]); memset(&c->audio, 0, sizeof(c->audio)); - c->audio.speakers = (enum speaker_layout)*channels; + c->audio.speakers = (enum speaker_layout) * channels; c->audio.samples_per_sec = *rate; c->audio.format = new_audio_format; return 0; } static void add_file(struct vlc_source *c, struct darray *array, - const char *path, int network_caching, int track_index, - int subtitle_index, bool subtitle_enable) + const char *path, int network_caching, int track_index, + int subtitle_index, bool subtitle_enable) { DARRAY(struct media_file_data) new_files; struct media_file_data data; @@ -438,21 +446,20 @@ if (is_url) { struct dstr network_caching_option = {0}; dstr_catf(&network_caching_option, - ":network-caching=%d", network_caching); + ":network-caching=%d", network_caching); libvlc_media_add_option_(new_media, - network_caching_option.array); + network_caching_option.array); dstr_free(&network_caching_option); } - struct dstr track_option = { 0 }; - dstr_catf(&track_option, - ":audio-track=%d", track_index - 1); + struct dstr track_option = {0}; + dstr_catf(&track_option, ":audio-track=%d", track_index - 1); libvlc_media_add_option_(new_media, track_option.array); dstr_free(&track_option); struct dstr sub_option = {0}; if (subtitle_enable) { - dstr_catf(&sub_option, - ":sub-track=%d", subtitle_index - 1); + dstr_catf(&sub_option, ":sub-track=%d", + subtitle_index - 1); } libvlc_media_add_option_(new_media, sub_option.array); dstr_free(&sub_option); @@ -481,8 +488,10 @@ e = strchr(b, ';'); for (;;) { - if (e) dstr_ncopy(&test, b, e - b); - else dstr_copy(&test, b); + if (e) + dstr_ncopy(&test, b, e - b); + else + dstr_copy(&test, b); if (dstr_cmp(&test, ext) == 0) { valid = true; @@ -569,17 +578,15 @@ dstr_cat_ch(&dir_path, '/'); dstr_cat(&dir_path, ent->d_name); add_file(c, &new_files.da, dir_path.array, - network_caching, track_index, - subtitle_index, - subtitle_enable); + network_caching, track_index, + subtitle_index, subtitle_enable); } dstr_free(&dir_path); os_closedir(dir); } else { add_file(c, &new_files.da, path, network_caching, - track_index, subtitle_index, - subtitle_enable); + track_index, subtitle_index, subtitle_enable); } obs_data_release(item); @@ -634,19 +641,19 @@ libvlc_media_list_lock_(media_list); for (size_t i = 0; i < c->files.num; i++) libvlc_media_list_add_media_(media_list, - c->files.array[i].media); + c->files.array[i].media); libvlc_media_list_unlock_(media_list); libvlc_media_list_player_set_media_list_(c->media_list_player, - media_list); + media_list); libvlc_media_list_release_(media_list); - libvlc_media_list_player_set_playback_mode_(c->media_list_player, - c->loop ? libvlc_playback_mode_loop : - libvlc_playback_mode_default); + libvlc_media_list_player_set_playback_mode_( + c->media_list_player, c->loop ? libvlc_playback_mode_loop + : libvlc_playback_mode_default); - if (c->files.num && - (c->behavior == BEHAVIOR_ALWAYS_PLAY || obs_source_active(c->source))) + if (c->files.num && (c->behavior == BEHAVIOR_ALWAYS_PLAY || + obs_source_active(c->source))) libvlc_media_list_player_play_(c->media_list_player); else obs_source_output_video(c->source, NULL); @@ -701,7 +708,7 @@ } static void vlcs_play_pause_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -713,7 +720,7 @@ } static void vlcs_restart_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -724,8 +731,8 @@ vlcs_restart(c); } -static void vlcs_stop_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) +static void vlcs_stop_hotkey(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey, + bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -737,7 +744,7 @@ } static void vlcs_playlist_next_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -749,7 +756,7 @@ } static void vlcs_playlist_prev_hotkey(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { UNUSED_PARAMETER(id); UNUSED_PARAMETER(hotkey); @@ -765,30 +772,25 @@ struct vlc_source *c = bzalloc(sizeof(*c)); c->source = source; - c->play_pause_hotkey = obs_hotkey_register_source(source, - "VLCSource.PlayPause", - obs_module_text("PlayPause"), - vlcs_play_pause_hotkey, c); + c->play_pause_hotkey = obs_hotkey_register_source( + source, "VLCSource.PlayPause", obs_module_text("PlayPause"), + vlcs_play_pause_hotkey, c); - c->restart_hotkey = obs_hotkey_register_source(source, - "VLCSource.Restart", - obs_module_text("Restart"), - vlcs_restart_hotkey, c); + c->restart_hotkey = obs_hotkey_register_source( + source, "VLCSource.Restart", obs_module_text("Restart"), + vlcs_restart_hotkey, c); - c->stop_hotkey = obs_hotkey_register_source(source, - "VLCSource.Stop", - obs_module_text("Stop"), - vlcs_stop_hotkey, c); + c->stop_hotkey = obs_hotkey_register_source(source, "VLCSource.Stop", + obs_module_text("Stop"), + vlcs_stop_hotkey, c); - c->playlist_next_hotkey = obs_hotkey_register_source(source, - "VLCSource.PlaylistNext", - obs_module_text("PlaylistNext"), - vlcs_playlist_next_hotkey, c); + c->playlist_next_hotkey = obs_hotkey_register_source( + source, "VLCSource.PlaylistNext", + obs_module_text("PlaylistNext"), vlcs_playlist_next_hotkey, c); - c->playlist_prev_hotkey = obs_hotkey_register_source(source, - "VLCSource.PlaylistPrev", - obs_module_text("PlaylistPrev"), - vlcs_playlist_prev_hotkey, c); + c->playlist_prev_hotkey = obs_hotkey_register_source( + source, "VLCSource.PlaylistPrev", + obs_module_text("PlaylistPrev"), vlcs_playlist_prev_hotkey, c); pthread_mutex_init_value(&c->mutex); if (pthread_mutex_init(&c->mutex, NULL) != 0) @@ -806,23 +808,22 @@ goto error; libvlc_media_list_player_set_media_player_(c->media_list_player, - c->media_player); + c->media_player); - libvlc_video_set_callbacks_(c->media_player, - vlcs_video_lock, NULL, vlcs_video_display, - c); - libvlc_video_set_format_callbacks_(c->media_player, - vlcs_video_format, NULL); + libvlc_video_set_callbacks_(c->media_player, vlcs_video_lock, NULL, + vlcs_video_display, c); + libvlc_video_set_format_callbacks_(c->media_player, vlcs_video_format, + NULL); - libvlc_audio_set_callbacks_(c->media_player, - vlcs_audio_play, NULL, NULL, NULL, NULL, c); - libvlc_audio_set_format_callbacks_(c->media_player, - vlcs_audio_setup, NULL); + libvlc_audio_set_callbacks_(c->media_player, vlcs_audio_play, NULL, + NULL, NULL, NULL, c); + libvlc_audio_set_format_callbacks_(c->media_player, vlcs_audio_setup, + NULL); libvlc_event_manager_t *event_manager; event_manager = libvlc_media_player_event_manager_(c->media_player); libvlc_event_attach_(event_manager, libvlc_MediaPlayerEndReached, - vlcs_stopped, c); + vlcs_stopped, c); obs_source_update(source, NULL); @@ -864,7 +865,7 @@ obs_data_set_default_bool(settings, S_LOOP, true); obs_data_set_default_bool(settings, S_SHUFFLE, false); obs_data_set_default_string(settings, S_BEHAVIOR, - S_BEHAVIOR_STOP_RESTART); + S_BEHAVIOR_STOP_RESTART); obs_data_set_default_int(settings, S_NETWORK_CACHING, 400); obs_data_set_default_int(settings, S_TRACK, 1); obs_data_set_default_bool(settings, S_SUBTITLE_ENABLE, false); @@ -900,13 +901,14 @@ } p = obs_properties_add_list(ppts, S_BEHAVIOR, T_BEHAVIOR, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, T_BEHAVIOR_STOP_RESTART, - S_BEHAVIOR_STOP_RESTART); + S_BEHAVIOR_STOP_RESTART); obs_property_list_add_string(p, T_BEHAVIOR_PAUSE_UNPAUSE, - S_BEHAVIOR_PAUSE_UNPAUSE); + S_BEHAVIOR_PAUSE_UNPAUSE); obs_property_list_add_string(p, T_BEHAVIOR_ALWAYS_PLAY, - S_BEHAVIOR_ALWAYS_PLAY); + S_BEHAVIOR_ALWAYS_PLAY); dstr_cat(&filter, "Media Files ("); dstr_copy(&exts, EXTENSIONS_MEDIA); @@ -930,18 +932,18 @@ dstr_cat(&filter, ")"); obs_properties_add_editable_list(ppts, S_PLAYLIST, T_PLAYLIST, - OBS_EDITABLE_LIST_TYPE_FILES_AND_URLS, - filter.array, path.array); + OBS_EDITABLE_LIST_TYPE_FILES_AND_URLS, + filter.array, path.array); dstr_free(&path); dstr_free(&filter); dstr_free(&exts); - obs_properties_add_int(ppts, S_NETWORK_CACHING, T_NETWORK_CACHING, - 100, 60000, 10); + obs_properties_add_int(ppts, S_NETWORK_CACHING, T_NETWORK_CACHING, 100, + 60000, 10); obs_properties_add_int(ppts, S_TRACK, T_TRACK, 1, 10, 1); obs_properties_add_bool(ppts, S_SUBTITLE_ENABLE, T_SUBTITLE_ENABLE); - obs_properties_add_int(ppts, S_SUBTITLE_TRACK, T_SUBTITLE_TRACK, - 1, 10, 1); + obs_properties_add_int(ppts, S_SUBTITLE_TRACK, T_SUBTITLE_TRACK, 1, 10, + 1); return ppts; } @@ -949,9 +951,8 @@ struct obs_source_info vlc_source_info = { .id = "vlc_source", .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_ASYNC_VIDEO | - OBS_SOURCE_AUDIO | - OBS_SOURCE_DO_NOT_DUPLICATE, + .output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO | + OBS_SOURCE_DO_NOT_DUPLICATE, .get_name = vlcs_get_name, .create = vlcs_create, .destroy = vlcs_destroy, @@ -959,5 +960,5 @@ .get_defaults = vlcs_defaults, .get_properties = vlcs_properties, .activate = vlcs_activate, - .deactivate = vlcs_deactivate + .deactivate = vlcs_deactivate, };
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/app-helpers.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/app-helpers.c
Changed
@@ -13,7 +13,8 @@ if (OpenProcessToken(process, TOKEN_QUERY, &token)) { BOOL success = GetTokenInformation(token, TokenIsAppContainer, - &ret, sizeof(ret), &size_ret); + &ret, sizeof(ret), + &size_ret); if (!success) { DWORD error = GetLastError(); int test = 0; @@ -33,12 +34,12 @@ if (OpenProcessToken(process, TOKEN_QUERY, &token)) { DWORD info_len = GetSidLengthRequired(12) + - sizeof(TOKEN_APPCONTAINER_INFORMATION); + sizeof(TOKEN_APPCONTAINER_INFORMATION); PTOKEN_APPCONTAINER_INFORMATION info = malloc(info_len); - success = GetTokenInformation(token, TokenAppContainerSid, - info, info_len, &size_ret); + success = GetTokenInformation(token, TokenAppContainerSid, info, + info_len, &size_ret); if (success) ConvertSidToStringSidW(info->TokenAppContainer, &ret);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/cursor-capture.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/cursor-capture.c
Changed
@@ -47,7 +47,7 @@ } static inline uint8_t *copy_from_color(ICONINFO *ii, uint32_t *width, - uint32_t *height) + uint32_t *height) { BITMAP bmp_color; BITMAP bmp_mask; @@ -80,7 +80,7 @@ } static inline uint8_t *copy_from_mask(ICONINFO *ii, uint32_t *width, - uint32_t *height) + uint32_t *height) { uint8_t *output; uint8_t *mask; @@ -107,8 +107,8 @@ if (!alpha) { output[i * 4 + 3] = color; } else { - *(uint32_t*)&output[i * 4] = !!color ? - 0xFFFFFFFF : 0xFF000000; + *(uint32_t *)&output[i * 4] = !!color ? 0xFFFFFFFF + : 0xFF000000; } } @@ -119,8 +119,8 @@ return output; } -static inline uint8_t *cursor_capture_icon_bitmap(ICONINFO *ii, - uint32_t *width, uint32_t *height) +static inline uint8_t *cursor_capture_icon_bitmap(ICONINFO *ii, uint32_t *width, + uint32_t *height) { uint8_t *output; @@ -131,8 +131,8 @@ return output; } -static gs_texture_t *get_cached_texture(struct cursor_data *data, - uint32_t cx, uint32_t cy) +static gs_texture_t *get_cached_texture(struct cursor_data *data, uint32_t cx, + uint32_t cy) { struct cached_cursor cc; @@ -210,7 +210,7 @@ } void cursor_draw(struct cursor_data *data, long x_offset, long y_offset, - float x_scale, float y_scale, long width, long height) + float x_scale, float y_scale, long width, long height) { long x = data->cursor_pos.x + x_offset; long y = data->cursor_pos.y + y_offset;
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/cursor-capture.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/cursor-capture.h
Changed
@@ -9,20 +9,20 @@ }; struct cursor_data { - gs_texture_t *texture; - HCURSOR current_cursor; - POINT cursor_pos; - long x_hotspot; - long y_hotspot; - bool visible; + gs_texture_t *texture; + HCURSOR current_cursor; + POINT cursor_pos; + long x_hotspot; + long y_hotspot; + bool visible; - uint32_t last_cx; - uint32_t last_cy; + uint32_t last_cx; + uint32_t last_cy; - DARRAY(struct cached_cursor) cached_textures; + DARRAY(struct cached_cursor) cached_textures; }; extern void cursor_capture(struct cursor_data *data); extern void cursor_draw(struct cursor_data *data, long x_offset, long y_offset, - float x_scale, float y_scale, long width, long height); + float x_scale, float y_scale, long width, long height); extern void cursor_data_free(struct cursor_data *data);
View file
obs-studio-24.0.0.tar.xz/plugins/win-capture/d3d8-api/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/data/locale/ar-SA.ini -> obs-studio-24.0.0.tar.xz/plugins/win-capture/data/locale/ar-SA.ini
Changed
@@ -2,6 +2,9 @@ WindowCapture="التقاط النافذة" WindowCapture.Window="نافذة" WindowCapture.Priority="أولوية النوافذ المختارة" +WindowCapture.Priority.Title="يجب أن يتطابق مع عنوان النافذة" +WindowCapture.Priority.Class="تطابق العنوان, عدا ذلك إيجاد نافذة أخرى من نفس النوع" +WindowCapture.Priority.Exe="تطابق العنوان, عدا ذلك إيجاد نافذة أخرى من نفس التطبيق" CaptureCursor="مؤشر الالتقاط" Compatibility="توافق محول متعدد" AllowTransparency="السماح بالشفافية" @@ -11,4 +14,9 @@ GameCapture.AnyFullscreen="التقاط أي تطبيق في وضع ملء الشاشة" GameCapture.ForceScaling="إجبار التمدد" GameCapture.ScaleRes="دقة التمدد" +GameCapture.HookRate.Slow="بطيء" +GameCapture.HookRate.Normal="عادي (مسحتسن)" +GameCapture.HookRate.Fast="سريع" +GameCapture.HookRate.Fastest="الأسرع" +Mode="الوضع"
View file
obs-studio-24.0.0.tar.xz/plugins/win-capture/data/locale/bg-BG.ini
Added
@@ -0,0 +1,26 @@ +MonitorCapture="Заснемане на екрана" +WindowCapture="Заснемане на прозореца" +WindowCapture.Window="Прозорец" +WindowCapture.Priority="Приоритет на прозореца" +WindowCapture.Priority.Title="Заглавие на прозорец, което трябва да съвпада" +CaptureCursor="Заснемане на показалеца на мишката" +Compatibility="Мултиадаптерна съвместимост" +SLIFix="Режим на заснемане SLI/Crossfire (бавно)" +AllowTransparency="Позволяване на прозиране" +Monitor="Екран" +PrimaryMonitor="Главен монитор" +GameCapture="Заснемане на игра" +GameCapture.AnyFullscreen="Заснемане на всяко приложение на цял екран" +GameCapture.CaptureWindow="Заснемане на определен прозорец" +GameCapture.UseHotkey="Заснемане на прозорец на преден план с горещ клавиш" +GameCapture.ForceScaling="Принудително налагане на скалата" +GameCapture.ScaleRes="Скала на разделителна способност" +GameCapture.LimitFramerate="Ограничаване на честотата на кадрите на заснемане" +GameCapture.HotkeyStart="Заснемане на прозорец на преден план" +GameCapture.HotkeyStop="Изключване на заснемането" +GameCapture.HookRate.Slow="Бавен" +GameCapture.HookRate.Normal="Нормален (препоръчително)" +GameCapture.HookRate.Fast="Бързо" +GameCapture.HookRate.Fastest="Най-бързо" +Mode="Режим" +
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/win-capture/data/locale/de-DE.ini
Changed
@@ -6,8 +6,8 @@ WindowCapture.Priority.Class="Fenstertitel soll übereinstimmen, ansonsten Fenster des gleichen Typs finden" WindowCapture.Priority.Exe="Fenstertitel soll übereinstimmen, ansonsten Fenster des gleichen Programms finden" CaptureCursor="Mauszeiger aufnehmen" -Compatibility="Multi-Adapter-Kompatibilität" -SLIFix="SLI-/Crossfire-Aufnahmemodus (Langsam)" +Compatibility="Multi‐Adapter‐Kompatibilität" +SLIFix="SLI‐/Crossfire‐Aufnahmemodus (langsam)" AllowTransparency="Erlaube Transparenz" Monitor="Bildschirm" PrimaryMonitor="Hauptmonitor" @@ -18,8 +18,8 @@ GameCapture.ForceScaling="Erzwinge Skalierung" GameCapture.ScaleRes="Skaliere Auflösung" GameCapture.LimitFramerate="Limitiere FPS der Aufnahme" -GameCapture.CaptureOverlays="Aufnahme von Drittanbieter Overlays (z. B. Steam)" -GameCapture.AntiCheatHook="Verwende Anti-Cheat-Kompatibilität Hook" +GameCapture.CaptureOverlays="Aufnahme von Drittanbieter‐Overlays (z. B. Steam)" +GameCapture.AntiCheatHook="Anti‐Cheat‐Kompatibilitäts‐Hook verwenden" GameCapture.HotkeyStart="Fenster im Vordergrund erfassen" GameCapture.HotkeyStop="Erfassen deaktivieren" GameCapture.HookRate="Hook Rate"
View file
obs-studio-24.0.0.tar.xz/plugins/win-capture/data/locale/fa-IR.ini
Added
@@ -0,0 +1,11 @@ +MonitorCapture="کپچر نمایش" +WindowCapture="ویندوز کپچر" +WindowCapture.Window="ویندوز" +AllowTransparency="اجازه شفافیت" +Monitor="نمایش" +GameCapture.HookRate.Slow="آهسته" +GameCapture.HookRate.Normal="معمولی (پیشنهاد شده)" +GameCapture.HookRate.Fast="سریع" +GameCapture.HookRate.Fastest="سریع ترین" +Mode="نوع" +
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/win-capture/data/locale/gl-ES.ini
Changed
@@ -1,16 +1,31 @@ MonitorCapture="Captura de pantalla" -WindowCapture="Capturar xanela" +WindowCapture="Captura da xanela" WindowCapture.Window="Xanela" WindowCapture.Priority="Prioridade de captura da xanela" -CaptureCursor="Captura de cursor" +WindowCapture.Priority.Title="O título da xanela debe coincidir" +WindowCapture.Priority.Class="Que coincida co título, en caso contrario atopar unha xanela do mesmo tipo" +WindowCapture.Priority.Exe="Que coincida co título, en caso contrario atopar unha xanela do mesmo executábel" +CaptureCursor="Capturar o cursor" Compatibility="Compatibilidade do multiadaptador" +SLIFix="Modo de captura SLI/Crossfire (Lenta)" AllowTransparency="Permitir transparencia" Monitor="Pantalla" PrimaryMonitor="Monitor principal" -GameCapture="Capturar xogo" +GameCapture="Captura de xogo" GameCapture.AnyFullscreen="Capturar calquera aplicativo a pantalla completa" -GameCapture.ForceScaling="Forzar dimensionamento" +GameCapture.CaptureWindow="Capturar unha xanela específica" +GameCapture.UseHotkey="Capturar a xanela do primeiro plano coa tecla rápida" +GameCapture.ForceScaling="Forzar o escalado" GameCapture.ScaleRes="Resolución da escala" -GameCapture.LimitFramerate="Limitar a ratio da captura" +GameCapture.LimitFramerate="Limitar taxa de captura de fotogramas" GameCapture.CaptureOverlays="Capturar capas de aplicativos externos (tales como Steam)" +GameCapture.AntiCheatHook="Utilizar a compatibilidade anti-trampas" +GameCapture.HotkeyStart="Capturar a xanela do primeiro plano" +GameCapture.HotkeyStop="Desactivar a captura" +GameCapture.HookRate="Taxa de captura" +GameCapture.HookRate.Slow="Lenta" +GameCapture.HookRate.Normal="Normal (recomendada)" +GameCapture.HookRate.Fast="Rápida" +GameCapture.HookRate.Fastest="Moi rápida" +Mode="Modo"
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/win-capture/data/locale/ro-RO.ini
Changed
@@ -2,18 +2,26 @@ WindowCapture="Captură de fereastră" WindowCapture.Window="Fereastră" WindowCapture.Priority="Prioritate de potrivire a ferestrelor" +WindowCapture.Priority.Title="Titlul ferestrei trebuie să se potrivească" +WindowCapture.Priority.Class="Titlul să se potrivească, altminteri găsește o fereastră de același tip" +WindowCapture.Priority.Exe="Titlul să se potrivească, altminteri găsește o fereastră a aceluiași executabil" CaptureCursor="Capturează cursorul" Compatibility="Compatibilitate pentru multiadaptoare" +SLIFix="Mod de captură SLI/Crossfire (Lent)" AllowTransparency="Permite transparență" Monitor="Display" PrimaryMonitor="Monitor principal" GameCapture="Captură de joc" GameCapture.AnyFullscreen="Capturează orice aplicație în ecran complet" +GameCapture.CaptureWindow="Capturează o fereastră specifică" +GameCapture.UseHotkey="Capturează fereastra din prim-plan cu o tastă rapidă" GameCapture.ForceScaling="Forțează scalarea" GameCapture.ScaleRes="Scalează rezoluția" GameCapture.LimitFramerate="Limitează frecvența de cadre a capturii" GameCapture.CaptureOverlays="Capturează overlay-uri terțe (precum Steam)" GameCapture.AntiCheatHook="Folosește hook pentru compatibilitate anticheat" +GameCapture.HotkeyStart="Capturează fereastra din prim-plan" GameCapture.HotkeyStop="Dezactivează captura" -Mode="Tip" +GameCapture.HookRate="Rată de hook" +Mode="Mod"
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/win-capture/data/locale/sl-SI.ini
Changed
@@ -1,6 +1,31 @@ -WindowCapture="Zajem Okna" +MonitorCapture="Zajemanje zaslona" +WindowCapture="Zajemanje okna" WindowCapture.Window="Okno" -WindowCapture.Priority="Prednost oken" +WindowCapture.Priority="Prednost ujemanja okna" +WindowCapture.Priority.Title="Ujemati se mora naziv okna" +WindowCapture.Priority.Class="Ujemati se mora naziv, drugače poišči okno iste vrste" +WindowCapture.Priority.Exe="Ujemati se mora naziv, drugače poišči okno z istim opravilom" CaptureCursor="Zajemaj kazalec" -Compatibility="Multi-kartična združljivost" +Compatibility="Združljivo z več karticami" +SLIFix="Način zajemanja SLI/Crossfire (počasno)" +AllowTransparency="Omogoči prozornost" +Monitor="Zaslon" +PrimaryMonitor="Glavni monitor" +GameCapture="Zajemanje igre" +GameCapture.AnyFullscreen="Zajemaj katerikoli celozaslonski program" +GameCapture.CaptureWindow="Zajemaj določeno okno" +GameCapture.UseHotkey="Zajemaj okno v ospredju s hitro tipko" +GameCapture.ForceScaling="Vsili sprem. velikosti" +GameCapture.ScaleRes="Spremenjena ločljivost" +GameCapture.LimitFramerate="Omeji hitrost sličic zajema" +GameCapture.CaptureOverlays="Zajemaj prekrivne plast tretjih oseb (kot je npr. Steam)" +GameCapture.AntiCheatHook="Uporabi priključek, združljiv s sistemom proti goljufanju" +GameCapture.HotkeyStart="Zajemaj okno v ospredju" +GameCapture.HotkeyStop="Onemogoči zajem" +GameCapture.HookRate="Hitrost priključ." +GameCapture.HookRate.Slow="Počasna" +GameCapture.HookRate.Normal="Običajna (priporočljivo)" +GameCapture.HookRate.Fast="Hitra" +GameCapture.HookRate.Fastest="Najhitrejša" +Mode="Način"
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/dc-capture.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/dc-capture.c
Changed
@@ -6,12 +6,12 @@ static inline void init_textures(struct dc_capture *capture) { if (capture->compatibility) - capture->texture = gs_texture_create( - capture->width, capture->height, - GS_BGRA, 1, NULL, GS_DYNAMIC); + capture->texture = gs_texture_create(capture->width, + capture->height, GS_BGRA, + 1, NULL, GS_DYNAMIC); else - capture->texture = gs_texture_create_gdi( - capture->width, capture->height); + capture->texture = + gs_texture_create_gdi(capture->width, capture->height); if (!capture->texture) { blog(LOG_WARNING, "[dc_capture_init] Failed to " @@ -22,16 +22,15 @@ capture->valid = true; } -void dc_capture_init(struct dc_capture *capture, int x, int y, - uint32_t width, uint32_t height, bool cursor, - bool compatibility) +void dc_capture_init(struct dc_capture *capture, int x, int y, uint32_t width, + uint32_t height, bool cursor, bool compatibility) { memset(capture, 0, sizeof(struct dc_capture)); - capture->x = x; - capture->y = y; - capture->width = width; - capture->height = height; + capture->x = x; + capture->y = y; + capture->width = width; + capture->height = height; capture->capture_cursor = cursor; obs_enter_graphics(); @@ -51,16 +50,16 @@ if (compatibility) { BITMAPINFO bi = {0}; BITMAPINFOHEADER *bih = &bi.bmiHeader; - bih->biSize = sizeof(BITMAPINFOHEADER); + bih->biSize = sizeof(BITMAPINFOHEADER); bih->biBitCount = 32; - bih->biWidth = width; - bih->biHeight = height; - bih->biPlanes = 1; + bih->biWidth = width; + bih->biHeight = height; + bih->biPlanes = 1; capture->hdc = CreateCompatibleDC(NULL); - capture->bmp = CreateDIBSection(capture->hdc, &bi, - DIB_RGB_COLORS, (void**)&capture->bits, - NULL, 0); + capture->bmp = + CreateDIBSection(capture->hdc, &bi, DIB_RGB_COLORS, + (void **)&capture->bits, NULL, 0); capture->old_bmp = SelectObject(capture->hdc, capture->bmp); } } @@ -82,10 +81,10 @@ static void draw_cursor(struct dc_capture *capture, HDC hdc, HWND window) { - HICON icon; - ICONINFO ii; + HICON icon; + ICONINFO ii; CURSORINFO *ci = &capture->ci; - POINT win_pos = {capture->x, capture->y}; + POINT win_pos = {capture->x, capture->y}; if (!(capture->ci.flags & CURSOR_SHOWING)) return; @@ -103,8 +102,7 @@ pos.x = ci->ptScreenPos.x - (int)ii.xHotspot - win_pos.x; pos.y = ci->ptScreenPos.y - (int)ii.yHotspot - win_pos.y; - DrawIconEx(hdc, pos.x, pos.y, icon, 0, 0, 0, NULL, - DI_NORMAL); + DrawIconEx(hdc, pos.x, pos.y, icon, 0, 0, 0, NULL, DI_NORMAL); DeleteObject(ii.hbmColor); DeleteObject(ii.hbmMask); @@ -127,8 +125,8 @@ static inline void dc_capture_release_dc(struct dc_capture *capture) { if (capture->compatibility) { - gs_texture_set_image(capture->texture, - capture->bits, capture->width*4, false); + gs_texture_set_image(capture->texture, capture->bits, + capture->width * 4, false); } else { gs_texture_release_dc(capture->texture); } @@ -148,14 +146,14 @@ hdc = dc_capture_get_dc(capture); if (!hdc) { blog(LOG_WARNING, "[capture_screen] Failed to get " - "texture DC"); + "texture DC"); return; } hdc_target = GetDC(window); - BitBlt(hdc, 0, 0, capture->width, capture->height, - hdc_target, capture->x, capture->y, SRCCOPY); + BitBlt(hdc, 0, 0, capture->width, capture->height, hdc_target, + capture->x, capture->y, SRCCOPY); ReleaseDC(NULL, hdc_target); @@ -169,10 +167,10 @@ static void draw_texture(struct dc_capture *capture, gs_effect_t *effect) { - gs_texture_t *texture = capture->texture; - gs_technique_t *tech = gs_effect_get_technique(effect, "Draw"); - gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); - size_t passes; + gs_texture_t *texture = capture->texture; + gs_technique_t *tech = gs_effect_get_technique(effect, "Draw"); + gs_eparam_t *image = gs_effect_get_param_by_name(effect, "image"); + size_t passes; gs_effect_set_texture(image, texture);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/dc-capture.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/dc-capture.h
Changed
@@ -7,27 +7,27 @@ struct dc_capture { gs_texture_t *texture; - bool texture_written; - int x, y; - uint32_t width; - uint32_t height; - - bool compatibility; - HDC hdc; - HBITMAP bmp, old_bmp; - BYTE *bits; - - bool capture_cursor; - bool cursor_captured; - bool cursor_hidden; - CURSORINFO ci; - - bool valid; + bool texture_written; + int x, y; + uint32_t width; + uint32_t height; + + bool compatibility; + HDC hdc; + HBITMAP bmp, old_bmp; + BYTE *bits; + + bool capture_cursor; + bool cursor_captured; + bool cursor_hidden; + CURSORINFO ci; + + bool valid; }; extern void dc_capture_init(struct dc_capture *capture, int x, int y, - uint32_t width, uint32_t height, bool cursor, - bool compatibility); + uint32_t width, uint32_t height, bool cursor, + bool compatibility); extern void dc_capture_free(struct dc_capture *capture); extern void dc_capture_capture(struct dc_capture *capture, HWND window);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/duplicator-monitor-capture.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/duplicator-monitor-capture.c
Changed
@@ -5,13 +5,15 @@ #include "cursor-capture.h" -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[duplicator-monitor-capture: '%s'] " format, \ - obs_source_get_name(capture->source), ##__VA_ARGS__) + obs_source_get_name(capture->source), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) + +/* clang-format off */ #define TEXT_MONITOR_CAPTURE obs_module_text("MonitorCapture") #define TEXT_CAPTURE_CURSOR obs_module_text("CaptureCursor") @@ -19,30 +21,32 @@ #define TEXT_MONITOR obs_module_text("Monitor") #define TEXT_PRIMARY_MONITOR obs_module_text("PrimaryMonitor") +/* clang-format on */ + #define RESET_INTERVAL_SEC 3.0f struct duplicator_capture { - obs_source_t *source; - int monitor; - bool capture_cursor; - bool showing; - - long x; - long y; - int rot; - uint32_t width; - uint32_t height; - gs_duplicator_t *duplicator; - float reset_timeout; - struct cursor_data cursor_data; + obs_source_t *source; + int monitor; + bool capture_cursor; + bool showing; + + long x; + long y; + int rot; + uint32_t width; + uint32_t height; + gs_duplicator_t *duplicator; + float reset_timeout; + struct cursor_data cursor_data; }; /* ------------------------------------------------------------------------- */ static inline void update_settings(struct duplicator_capture *capture, - obs_data_t *settings) + obs_data_t *settings) { - capture->monitor = (int)obs_data_get_int(settings, "monitor"); + capture->monitor = (int)obs_data_get_int(settings, "monitor"); capture->capture_cursor = obs_data_get_bool(settings, "capture_cursor"); obs_enter_graphics(); @@ -94,7 +98,7 @@ } static void *duplicator_capture_create(obs_data_t *settings, - obs_source_t *source) + obs_source_t *source) { struct duplicator_capture *capture; @@ -148,7 +152,7 @@ } return; - /* always try to load the capture immediately when the source is first + /* always try to load the capture immediately when the source is first * shown */ } else if (!capture->showing) { capture->reset_timeout = RESET_INTERVAL_SEC; @@ -201,10 +205,9 @@ static void draw_cursor(struct duplicator_capture *capture) { - cursor_draw(&capture->cursor_data, -capture->x, -capture->y, - 1.0f, 1.0f, - capture->rot % 180 == 0 ? capture->width : capture->height, - capture->rot % 180 == 0 ? capture->height : capture->width); + cursor_draw(&capture->cursor_data, -capture->x, -capture->y, 1.0f, 1.0f, + capture->rot % 180 == 0 ? capture->width : capture->height, + capture->rot % 180 == 0 ? capture->height : capture->width); } static void duplicator_capture_render(void *data, gs_effect_t *effect) @@ -270,12 +273,11 @@ if (!gs_get_duplicator_monitor_info(monitor_idx, &info)) return false; - dstr_catf(&monitor_desc, "%s %d: %ldx%ld @ %ld,%ld", - TEXT_MONITOR, monitor_idx + 1, - info.cx, info.cy, info.x, info.y); + dstr_catf(&monitor_desc, "%s %d: %ldx%ld @ %ld,%ld", TEXT_MONITOR, + monitor_idx + 1, info.cx, info.cy, info.x, info.y); obs_property_list_add_int(monitor_list, monitor_desc.array, - monitor_idx); + monitor_idx); dstr_free(&monitor_desc); @@ -290,15 +292,16 @@ obs_properties_t *props = obs_properties_create(); - obs_property_t *monitors = obs_properties_add_list(props, - "monitor", TEXT_MONITOR, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *monitors = obs_properties_add_list( + props, "monitor", TEXT_MONITOR, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_properties_add_bool(props, "capture_cursor", TEXT_CAPTURE_CURSOR); obs_enter_graphics(); - while (get_monitor_props(monitors, monitor_idx++)); + while (get_monitor_props(monitors, monitor_idx++)) + ; obs_leave_graphics(); @@ -306,18 +309,18 @@ } struct obs_source_info duplicator_capture_info = { - .id = "monitor_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_DO_NOT_DUPLICATE, - .get_name = duplicator_capture_getname, - .create = duplicator_capture_create, - .destroy = duplicator_capture_destroy, - .video_render = duplicator_capture_render, - .video_tick = duplicator_capture_tick, - .update = duplicator_capture_update, - .get_width = duplicator_capture_width, - .get_height = duplicator_capture_height, - .get_defaults = duplicator_capture_defaults, - .get_properties = duplicator_capture_properties + .id = "monitor_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | + OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = duplicator_capture_getname, + .create = duplicator_capture_create, + .destroy = duplicator_capture_destroy, + .video_render = duplicator_capture_render, + .video_tick = duplicator_capture_tick, + .update = duplicator_capture_update, + .get_width = duplicator_capture_width, + .get_height = duplicator_capture_height, + .get_defaults = duplicator_capture_defaults, + .get_properties = duplicator_capture_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/funchook.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/funchook.c
Changed
@@ -2,11 +2,11 @@ #include <stdlib.h> #include "funchook.h" -#define JMP_64_SIZE 14 -#define JMP_32_SIZE 5 +#define JMP_64_SIZE 14 +#define JMP_32_SIZE 5 -#define X86_NOP 0x90 -#define X86_JMP_NEG_5 0xF9EB +#define X86_NOP 0x90 +#define X86_JMP_NEG_5 0xF9EB static inline void fix_permissions(void *addr, size_t size) { @@ -14,8 +14,8 @@ VirtualProtect(addr, size, PAGE_EXECUTE_READWRITE, &protect_val); } -void hook_init(struct func_hook *hook, - void *func_addr, void *hook_addr, const char *name) +void hook_init(struct func_hook *hook, void *func_addr, void *hook_addr, + const char *name) { memset(hook, 0, sizeof(*hook)); @@ -23,7 +23,7 @@ hook->hook_addr = (uintptr_t)hook_addr; hook->name = name; - fix_permissions((void*)(hook->func_addr - JMP_32_SIZE), + fix_permissions((void *)(hook->func_addr - JMP_32_SIZE), JMP_64_SIZE + JMP_32_SIZE); memcpy(hook->unhook_data, func_addr, JMP_64_SIZE); @@ -39,30 +39,30 @@ static inline void rehook64(struct func_hook *hook) { uint8_t data[JMP_64_SIZE]; - uintptr_t *ptr_loc = (uintptr_t*)((uint8_t*)data + sizeof(longjmp64)); + uintptr_t *ptr_loc = (uintptr_t *)((uint8_t *)data + sizeof(longjmp64)); - fix_permissions((void*)hook->func_addr, JMP_64_SIZE); + fix_permissions((void *)hook->func_addr, JMP_64_SIZE); - memcpy(data, (void*)hook->func_addr, JMP_64_SIZE); + memcpy(data, (void *)hook->func_addr, JMP_64_SIZE); memcpy(data, longjmp64, sizeof(longjmp64)); *ptr_loc = hook->hook_addr; - hook->call_addr = (void*)hook->func_addr; + hook->call_addr = (void *)hook->func_addr; hook->type = HOOKTYPE_FORWARD_OVERWRITE; hook->hooked = true; - memcpy((void*)hook->func_addr, data, JMP_64_SIZE); + memcpy((void *)hook->func_addr, data, JMP_64_SIZE); } static inline void hook_reverse_new(struct func_hook *hook, uint8_t *p) { - hook->call_addr = (void*)(hook->func_addr + 2); + hook->call_addr = (void *)(hook->func_addr + 2); hook->type = HOOKTYPE_REVERSE_CHAIN; hook->hooked = true; p[0] = 0xE9; - *((uint32_t*)&p[1]) = (uint32_t)(hook->hook_addr - hook->func_addr); - *((uint16_t*)&p[5]) = X86_JMP_NEG_5; + *((uint32_t *)&p[1]) = (uint32_t)(hook->hook_addr - hook->func_addr); + *((uint16_t *)&p[5]) = X86_JMP_NEG_5; } static inline void hook_reverse_chain(struct func_hook *hook, uint8_t *p) @@ -70,49 +70,49 @@ if (hook->type != HOOKTYPE_FORWARD_OVERWRITE) return; - hook->call_addr = (void*)(hook->func_addr + *((int32_t*)&p[1])); + hook->call_addr = (void *)(hook->func_addr + *((int32_t *)&p[1])); hook->type = HOOKTYPE_REVERSE_CHAIN; hook->hooked = true; - *((uint32_t*)&p[1]) = (uint32_t)(hook->hook_addr - hook->func_addr); + *((uint32_t *)&p[1]) = (uint32_t)(hook->hook_addr - hook->func_addr); } static inline void hook_forward_chain(struct func_hook *hook, uint8_t *p, - intptr_t offset) + intptr_t offset) { - int32_t cur_offset = *(int32_t*)&p[6]; + int32_t cur_offset = *(int32_t *)&p[6]; if (hook->type != HOOKTYPE_FORWARD_OVERWRITE) return; - hook->call_addr = (void*)(hook->func_addr + JMP_32_SIZE + cur_offset); + hook->call_addr = (void *)(hook->func_addr + JMP_32_SIZE + cur_offset); hook->type = HOOKTYPE_FORWARD_CHAIN; hook->hooked = true; - *((int32_t*)&p[6]) = (int32_t)offset; + *((int32_t *)&p[6]) = (int32_t)offset; } static inline void hook_forward_overwrite(struct func_hook *hook, - intptr_t offset) + intptr_t offset) { - uint8_t *ptr = (uint8_t*)hook->func_addr; + uint8_t *ptr = (uint8_t *)hook->func_addr; - hook->call_addr = (void*)hook->func_addr; + hook->call_addr = (void *)hook->func_addr; hook->type = HOOKTYPE_FORWARD_OVERWRITE; hook->hooked = true; *(ptr++) = 0xE9; - *((int32_t*)ptr) = (int32_t)offset; + *((int32_t *)ptr) = (int32_t)offset; } static inline void rehook32(struct func_hook *hook, bool force, intptr_t offset) { - fix_permissions((void*)(hook->func_addr - JMP_32_SIZE), + fix_permissions((void *)(hook->func_addr - JMP_32_SIZE), JMP_32_SIZE * 2); if (force || !hook->started) { - uint8_t *p = (uint8_t*)hook->func_addr - JMP_32_SIZE; - size_t nop_count = 0; + uint8_t *p = (uint8_t *)hook->func_addr - JMP_32_SIZE; + size_t nop_count = 0; /* check for reverse chain hook availability */ for (size_t i = 0; i < JMP_32_SIZE; i++) { @@ -123,7 +123,8 @@ if (nop_count == JMP_32_SIZE && p[5] == 0x8B && p[6] == 0xFF) { hook_reverse_new(hook, p); - } else if (p[0] == 0xE9 && *(uint16_t*)&p[5] == X86_JMP_NEG_5) { + } else if (p[0] == 0xE9 && + *(uint16_t *)&p[5] == X86_JMP_NEG_5) { hook_reverse_chain(hook, p); } else if (p[5] == 0xE9) { @@ -157,7 +158,8 @@ int i; success = VirtualQueryEx(GetCurrentProcess(), - (const void*)hook->func_addr, &mbi, sizeof(mbi)); + (const void *)hook->func_addr, &mbi, + sizeof(mbi)); if (!success) return; @@ -167,19 +169,20 @@ address = (uintptr_t)mbi.AllocationBase - pagesize; for (i = 0; i < 256; i++, address -= pagesize) { hook->bounce_addr = VirtualAlloc((LPVOID)address, pagesize, - MEM_RESERVE | MEM_COMMIT, - PAGE_EXECUTE_READWRITE); + MEM_RESERVE | MEM_COMMIT, + PAGE_EXECUTE_READWRITE); if (hook->bounce_addr) break; } if (!hook->bounce_addr) { address = (uintptr_t)mbi.AllocationBase + mbi.RegionSize + - pagesize; + pagesize; for (i = 0; i < 256; i++, address += pagesize) { - hook->bounce_addr = VirtualAlloc((LPVOID)address, - pagesize, MEM_RESERVE | MEM_COMMIT, - PAGE_EXECUTE_READWRITE); + hook->bounce_addr = + VirtualAlloc((LPVOID)address, pagesize, + MEM_RESERVE | MEM_COMMIT, + PAGE_EXECUTE_READWRITE); if (hook->bounce_addr) break; } @@ -194,14 +197,14 @@ newdiff = (uintptr_t)hook->bounce_addr - hook->func_addr + 5; if (newdiff <= 0x7ffffff0) { - uint8_t *addr = (uint8_t*)hook->bounce_addr; + uint8_t *addr = (uint8_t *)hook->bounce_addr; FillMemory(hook->bounce_addr, pagesize, 0xCC); *(addr++) = 0xFF; *(addr++) = 0x25; - *((uint32_t*)addr) = 0; - *((uint64_t*)(addr + 4)) = hook->hook_addr; + *((uint32_t *)addr) = 0; + *((uint64_t *)(addr + 4)) = hook->hook_addr; hook->hook_addr = (uint64_t)hook->bounce_addr; *offset = hook->hook_addr - hook->func_addr - JMP_32_SIZE; @@ -230,7 +233,7 @@ size = patch_size(hook); } - memcpy((void*)addr, hook->rehook_data, size); + memcpy((void *)addr, hook->rehook_data, size); hook->hooked = true; return; } @@ -272,11 +275,11 @@ addr = hook->func_addr; } - fix_permissions((void*)addr, size); - memcpy(hook->rehook_data, (void*)addr, size); + fix_permissions((void *)addr, size); + memcpy(hook->rehook_data, (void *)addr, size); if (hook->type == HOOKTYPE_FORWARD_OVERWRITE) - memcpy((void*)hook->func_addr, hook->unhook_data, size); + memcpy((void *)hook->func_addr, hook->unhook_data, size); hook->hooked = false; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/funchook.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/funchook.h
Changed
@@ -18,23 +18,23 @@ }; struct func_hook { - void *call_addr; - - uintptr_t func_addr; /* function being hooked to */ - uintptr_t hook_addr; /* hook function itself */ - void *bounce_addr; - const char *name; - enum hook_type type; - bool is_64bit_jump; - bool hooked; - bool started; - bool attempted_bounce; - uint8_t unhook_data[14]; - uint8_t rehook_data[14]; + void *call_addr; + + uintptr_t func_addr; /* function being hooked to */ + uintptr_t hook_addr; /* hook function itself */ + void *bounce_addr; + const char *name; + enum hook_type type; + bool is_64bit_jump; + bool hooked; + bool started; + bool attempted_bounce; + uint8_t unhook_data[14]; + uint8_t rehook_data[14]; }; -extern void hook_init(struct func_hook *hook, - void *func_addr, void *hook_addr, const char *name); +extern void hook_init(struct func_hook *hook, void *func_addr, void *hook_addr, + const char *name); extern void hook_start(struct func_hook *hook); extern void do_hook(struct func_hook *hook, bool force); extern void unhook(struct func_hook *hook);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/game-capture.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/game-capture.c
Changed
@@ -15,13 +15,15 @@ #include "app-helpers.h" #include "nt-stuff.h" -#define do_log(level, format, ...) \ +#define do_log(level, format, ...) \ blog(level, "[game-capture: '%s'] " format, \ - obs_source_get_name(gc->source), ##__VA_ARGS__) + obs_source_get_name(gc->source), ##__VA_ARGS__) -#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) -#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) -#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) +#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__) +#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__) +#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__) + +/* clang-format off */ #define SETTING_MODE "capture_mode" #define SETTING_CAPTURE_WINDOW "window" @@ -76,6 +78,8 @@ #define TEXT_HOTKEY_START obs_module_text("GameCapture.HotkeyStart") #define TEXT_HOTKEY_STOP obs_module_text("GameCapture.HotkeyStop") +/* clang-format on */ + #define DEFAULT_RETRY_INTERVAL 2.0f #define ERROR_RETRY_INTERVAL 4.0f @@ -93,77 +97,77 @@ }; struct game_capture_config { - char *title; - char *class; - char *executable; - enum window_priority priority; - enum capture_mode mode; - uint32_t scale_cx; - uint32_t scale_cy; - bool cursor; - bool force_shmem; - bool force_scaling; - bool allow_transparency; - bool limit_framerate; - bool capture_overlays; - bool anticheat_hook; - enum hook_rate hook_rate; + char *title; + char *class; + char *executable; + enum window_priority priority; + enum capture_mode mode; + uint32_t scale_cx; + uint32_t scale_cy; + bool cursor; + bool force_shmem; + bool force_scaling; + bool allow_transparency; + bool limit_framerate; + bool capture_overlays; + bool anticheat_hook; + enum hook_rate hook_rate; }; struct game_capture { - obs_source_t *source; - - struct cursor_data cursor_data; - HANDLE injector_process; - uint32_t cx; - uint32_t cy; - uint32_t pitch; - DWORD process_id; - DWORD thread_id; - HWND next_window; - HWND window; - float retry_time; - float fps_reset_time; - float retry_interval; - struct dstr title; - struct dstr class; - struct dstr executable; - enum window_priority priority; - obs_hotkey_pair_id hotkey_pair; - volatile long hotkey_window; - volatile bool deactivate_hook; - volatile bool activate_hook_now; - bool wait_for_target_startup; - bool showing; - bool active; - bool capturing; - bool activate_hook; - bool process_is_64bit; - bool error_acquiring; - bool dwm_capture; - bool initial_config; - bool convert_16bit; - bool is_app; - bool cursor_hidden; - - struct game_capture_config config; - - ipc_pipe_server_t pipe; - gs_texture_t *texture; - struct hook_info *global_hook_info; - HANDLE keepalive_mutex; - HANDLE hook_init; - HANDLE hook_restart; - HANDLE hook_stop; - HANDLE hook_ready; - HANDLE hook_exit; - HANDLE hook_data_map; - HANDLE global_hook_info_map; - HANDLE target_process; - HANDLE texture_mutexes[2]; - wchar_t *app_sid; - int retrying; - float cursor_check_time; + obs_source_t *source; + + struct cursor_data cursor_data; + HANDLE injector_process; + uint32_t cx; + uint32_t cy; + uint32_t pitch; + DWORD process_id; + DWORD thread_id; + HWND next_window; + HWND window; + float retry_time; + float fps_reset_time; + float retry_interval; + struct dstr title; + struct dstr class; + struct dstr executable; + enum window_priority priority; + obs_hotkey_pair_id hotkey_pair; + volatile long hotkey_window; + volatile bool deactivate_hook; + volatile bool activate_hook_now; + bool wait_for_target_startup; + bool showing; + bool active; + bool capturing; + bool activate_hook; + bool process_is_64bit; + bool error_acquiring; + bool dwm_capture; + bool initial_config; + bool convert_16bit; + bool is_app; + bool cursor_hidden; + + struct game_capture_config config; + + ipc_pipe_server_t pipe; + gs_texture_t *texture; + struct hook_info *global_hook_info; + HANDLE keepalive_mutex; + HANDLE hook_init; + HANDLE hook_restart; + HANDLE hook_stop; + HANDLE hook_ready; + HANDLE hook_exit; + HANDLE hook_data_map; + HANDLE global_hook_info_map; + HANDLE target_process; + HANDLE texture_mutexes[2]; + wchar_t *app_sid; + int retrying; + float cursor_check_time; union { struct { @@ -175,7 +179,7 @@ void *data; }; - void (*copy_texture)(struct game_capture*); + void (*copy_texture)(struct game_capture *); }; struct graphics_offsets offsets32 = {0}; @@ -187,48 +191,43 @@ } static inline HANDLE open_mutex_plus_id(struct game_capture *gc, - const wchar_t *name, DWORD id) + const wchar_t *name, DWORD id) { wchar_t new_name[64]; _snwprintf(new_name, 64, L"%s%lu", name, id); - return gc->is_app - ? open_app_mutex(gc->app_sid, new_name) - : open_mutex(new_name); + return gc->is_app ? open_app_mutex(gc->app_sid, new_name) + : open_mutex(new_name); } -static inline HANDLE open_mutex_gc(struct game_capture *gc, - const wchar_t *name) +static inline HANDLE open_mutex_gc(struct game_capture *gc, const wchar_t *name) { return open_mutex_plus_id(gc, name, gc->process_id); } static inline HANDLE open_event_plus_id(struct game_capture *gc, - const wchar_t *name, DWORD id) + const wchar_t *name, DWORD id) { wchar_t new_name[64]; _snwprintf(new_name, 64, L"%s%lu", name, id); - return gc->is_app - ? open_app_event(gc->app_sid, new_name) - : open_event(new_name); + return gc->is_app ? open_app_event(gc->app_sid, new_name) + : open_event(new_name); } -static inline HANDLE open_event_gc(struct game_capture *gc, - const wchar_t *name) +static inline HANDLE open_event_gc(struct game_capture *gc, const wchar_t *name) { return open_event_plus_id(gc, name, gc->process_id); } static inline HANDLE open_map_plus_id(struct game_capture *gc, - const wchar_t *name, DWORD id) + const wchar_t *name, DWORD id) { wchar_t new_name[64]; _snwprintf(new_name, 64, L"%s%lu", name, id); debug("map id: %S", new_name); - return gc->is_app - ? open_app_map(gc->app_sid, new_name) - : OpenFileMappingW(GC_MAPPING_FLAGS, false, new_name); + return gc->is_app ? open_app_map(gc->app_sid, new_name) + : OpenFileMappingW(GC_MAPPING_FLAGS, false, new_name); } static inline HANDLE open_hook_info(struct game_capture *gc) @@ -239,13 +238,20 @@ static inline enum gs_color_format convert_format(uint32_t format) { switch (format) { - case DXGI_FORMAT_R8G8B8A8_UNORM: return GS_RGBA; - case DXGI_FORMAT_B8G8R8X8_UNORM: return GS_BGRX; - case DXGI_FORMAT_B8G8R8A8_UNORM: return GS_BGRA; - case DXGI_FORMAT_R10G10B10A2_UNORM: return GS_R10G10B10A2; - case DXGI_FORMAT_R16G16B16A16_UNORM: return GS_RGBA16; - case DXGI_FORMAT_R16G16B16A16_FLOAT: return GS_RGBA16F; - case DXGI_FORMAT_R32G32B32A32_FLOAT: return GS_RGBA32F; + case DXGI_FORMAT_R8G8B8A8_UNORM: + return GS_RGBA; + case DXGI_FORMAT_B8G8R8X8_UNORM: + return GS_BGRX; + case DXGI_FORMAT_B8G8R8A8_UNORM: + return GS_BGRA; + case DXGI_FORMAT_R10G10B10A2_UNORM: + return GS_R10G10B10A2; + case DXGI_FORMAT_R16G16B16A16_UNORM: + return GS_RGBA16; + case DXGI_FORMAT_R16G16B16A16_FLOAT: + return GS_RGBA16F; + case DXGI_FORMAT_R32G32B32A32_FLOAT: + return GS_RGBA32F; } return GS_UNKNOWN; @@ -270,12 +276,12 @@ } static inline HANDLE open_process(DWORD desired_access, bool inherit_handle, - DWORD process_id) + DWORD process_id) { - static HANDLE (WINAPI *open_process_proc)(DWORD, BOOL, DWORD) = NULL; + static HANDLE(WINAPI * open_process_proc)(DWORD, BOOL, DWORD) = NULL; if (!open_process_proc) - open_process_proc = get_obfuscated_func(kernel32(), - "NuagUykjcxr", 0x1B694B59451ULL); + open_process_proc = get_obfuscated_func( + kernel32(), "NuagUykjcxr", 0x1B694B59451ULL); return open_process_proc(desired_access, inherit_handle, process_id); } @@ -378,18 +384,18 @@ static inline bool using_older_non_mode_format(obs_data_t *settings) { return obs_data_has_user_value(settings, SETTING_ANY_FULLSCREEN) && - !obs_data_has_user_value(settings, SETTING_MODE); + !obs_data_has_user_value(settings, SETTING_MODE); } static inline void get_config(struct game_capture_config *cfg, - obs_data_t *settings, const char *window) + obs_data_t *settings, const char *window) { int ret; const char *scale_str; const char *mode_str = NULL; build_window_strings(window, &cfg->class, &cfg->title, - &cfg->executable); + &cfg->executable); if (using_older_non_mode_format(settings)) { bool any = obs_data_get_bool(settings, SETTING_ANY_FULLSCREEN); @@ -405,27 +411,25 @@ else cfg->mode = CAPTURE_MODE_ANY; - cfg->priority = (enum window_priority)obs_data_get_int(settings, - SETTING_WINDOW_PRIORITY); - cfg->force_shmem = obs_data_get_bool(settings, - SETTING_COMPATIBILITY); + cfg->priority = (enum window_priority)obs_data_get_int( + settings, SETTING_WINDOW_PRIORITY); + cfg->force_shmem = obs_data_get_bool(settings, SETTING_COMPATIBILITY); cfg->cursor = obs_data_get_bool(settings, SETTING_CURSOR); - cfg->allow_transparency = obs_data_get_bool(settings, - SETTING_TRANSPARENCY); - cfg->force_scaling = obs_data_get_bool(settings, - SETTING_FORCE_SCALING); - cfg->limit_framerate = obs_data_get_bool(settings, - SETTING_LIMIT_FRAMERATE); - cfg->capture_overlays = obs_data_get_bool(settings, - SETTING_CAPTURE_OVERLAYS); - cfg->anticheat_hook = obs_data_get_bool(settings, - SETTING_ANTI_CHEAT_HOOK); - cfg->hook_rate = (enum hook_rate)obs_data_get_int(settings, - SETTING_HOOK_RATE); + cfg->allow_transparency = + obs_data_get_bool(settings, SETTING_TRANSPARENCY); + cfg->force_scaling = obs_data_get_bool(settings, SETTING_FORCE_SCALING); + cfg->limit_framerate = + obs_data_get_bool(settings, SETTING_LIMIT_FRAMERATE); + cfg->capture_overlays = + obs_data_get_bool(settings, SETTING_CAPTURE_OVERLAYS); + cfg->anticheat_hook = + obs_data_get_bool(settings, SETTING_ANTI_CHEAT_HOOK); + cfg->hook_rate = + (enum hook_rate)obs_data_get_int(settings, SETTING_HOOK_RATE); scale_str = obs_data_get_string(settings, SETTING_SCALE_RES); - ret = sscanf(scale_str, "%"PRIu32"x%"PRIu32, - &cfg->scale_cx, &cfg->scale_cy); + ret = sscanf(scale_str, "%" PRIu32 "x%" PRIu32, &cfg->scale_cx, + &cfg->scale_cy); cfg->scale_cx &= ~2; cfg->scale_cy &= ~2; @@ -447,24 +451,23 @@ } static inline bool capture_needs_reset(struct game_capture_config *cfg1, - struct game_capture_config *cfg2) + struct game_capture_config *cfg2) { if (cfg1->mode != cfg2->mode) { return true; } else if (cfg1->mode == CAPTURE_MODE_WINDOW && - (s_cmp(cfg1->class, cfg2->class) != 0 || - s_cmp(cfg1->title, cfg2->title) != 0 || - s_cmp(cfg1->executable, cfg2->executable) != 0 || - cfg1->priority != cfg2->priority)) { + (s_cmp(cfg1->class, cfg2->class) != 0 || + s_cmp(cfg1->title, cfg2->title) != 0 || + s_cmp(cfg1->executable, cfg2->executable) != 0 || + cfg1->priority != cfg2->priority)) { return true; } else if (cfg1->force_scaling != cfg2->force_scaling) { return true; - } else if (cfg1->force_scaling && - (cfg1->scale_cx != cfg2->scale_cx || - cfg1->scale_cy != cfg2->scale_cy)) { + } else if (cfg1->force_scaling && (cfg1->scale_cx != cfg2->scale_cx || + cfg1->scale_cy != cfg2->scale_cy)) { return true; } else if (cfg1->force_shmem != cfg2->force_shmem) { @@ -481,14 +484,14 @@ } static bool hotkey_start(void *data, obs_hotkey_pair_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { struct game_capture *gc = data; if (pressed && gc->config.mode == CAPTURE_MODE_HOTKEY) { info("Activate hotkey pressed"); os_atomic_set_long(&gc->hotkey_window, - (long)(uintptr_t)GetForegroundWindow()); + (long)(uintptr_t)GetForegroundWindow()); os_atomic_set_bool(&gc->deactivate_hook, true); os_atomic_set_bool(&gc->activate_hook_now, true); } @@ -496,8 +499,8 @@ return true; } -static bool hotkey_stop(void *data, obs_hotkey_pair_id id, - obs_hotkey_t *hotkey, bool pressed) +static bool hotkey_stop(void *data, obs_hotkey_pair_id id, obs_hotkey_t *hotkey, + bool pressed) { struct game_capture *gc = data; @@ -514,8 +517,8 @@ struct game_capture *gc = data; struct game_capture_config cfg; bool reset_capture = false; - const char *window = obs_data_get_string(settings, - SETTING_CAPTURE_WINDOW); + const char *window = + obs_data_get_string(settings, SETTING_CAPTURE_WINDOW); get_config(&cfg, settings, window); reset_capture = capture_needs_reset(&cfg, &gc->config); @@ -537,7 +540,7 @@ free_config(&gc->config); gc->config = cfg; gc->retry_interval = DEFAULT_RETRY_INTERVAL * - hook_rate_to_float(gc->config.hook_rate); + hook_rate_to_float(gc->config.hook_rate); gc->wait_for_target_startup = false; dstr_free(&gc->title); @@ -571,24 +574,22 @@ gc->source = source; gc->initial_config = true; gc->retry_interval = DEFAULT_RETRY_INTERVAL * - hook_rate_to_float(gc->config.hook_rate); + hook_rate_to_float(gc->config.hook_rate); gc->hotkey_pair = obs_hotkey_pair_register_source( - gc->source, - HOTKEY_START, TEXT_HOTKEY_START, - HOTKEY_STOP, TEXT_HOTKEY_STOP, - hotkey_start, hotkey_stop, gc, gc); + gc->source, HOTKEY_START, TEXT_HOTKEY_START, HOTKEY_STOP, + TEXT_HOTKEY_STOP, hotkey_start, hotkey_stop, gc, gc); game_capture_update(gc, settings); return gc; } -#define STOP_BEING_BAD \ +#define STOP_BEING_BAD \ " This is most likely due to security software. Please make sure " \ - "that the OBS installation folder is excluded/ignored in the " \ - "settings of the security software you are using." + "that the OBS installation folder is excluded/ignored in the " \ + "settings of the security software you are using." static bool check_file_integrity(struct game_capture *gc, const char *file, - const char *name) + const char *name) { DWORD error; HANDLE handle; @@ -605,7 +606,7 @@ } handle = CreateFileW(w_file, GENERIC_READ | GENERIC_EXECUTE, - FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); bfree(w_file); @@ -616,14 +617,13 @@ error = GetLastError(); if (error == ERROR_FILE_NOT_FOUND) { - warn("Game capture file '%s' not found." - STOP_BEING_BAD, file); + warn("Game capture file '%s' not found." STOP_BEING_BAD, file); } else if (error == ERROR_ACCESS_DENIED) { - warn("Game capture file '%s' could not be loaded." - STOP_BEING_BAD, file); + warn("Game capture file '%s' could not be loaded." STOP_BEING_BAD, + file); } else { - warn("Game capture file '%s' could not be loaded: %lu." - STOP_BEING_BAD, file, error); + warn("Game capture file '%s' could not be loaded: %lu." STOP_BEING_BAD, + file, error); } return false; @@ -656,8 +656,7 @@ static inline bool open_target_process(struct game_capture *gc) { gc->target_process = open_process( - PROCESS_QUERY_INFORMATION | SYNCHRONIZE, - false, gc->process_id); + PROCESS_QUERY_INFORMATION | SYNCHRONIZE, false, gc->process_id); if (!gc->target_process) { warn("could not open process: %s", gc->config.executable); return false; @@ -675,7 +674,7 @@ { wchar_t new_name[64]; _snwprintf(new_name, 64, L"%s%lu", WINDOW_HOOK_KEEPALIVE, - gc->process_id); + gc->process_id); gc->keepalive_mutex = CreateMutexW(NULL, false, new_name); if (!gc->keepalive_mutex) { @@ -700,7 +699,7 @@ } } else { warn("failed to open texture mutexes: %lu", - GetLastError()); + GetLastError()); } return false; } @@ -714,7 +713,7 @@ gc->hook_restart = open_event_gc(gc, EVENT_CAPTURE_RESTART); if (gc->hook_restart) { debug("existing hook found, signaling process: %s", - gc->config.executable); + gc->config.executable); SetEvent(gc->hook_restart); return true; } @@ -746,26 +745,26 @@ gc->global_hook_info_map = open_hook_info(gc); if (!gc->global_hook_info_map) { warn("init_hook_info: get_hook_info failed: %lu", - GetLastError()); + GetLastError()); return false; } gc->global_hook_info = MapViewOfFile(gc->global_hook_info_map, - FILE_MAP_ALL_ACCESS, 0, 0, - sizeof(*gc->global_hook_info)); + FILE_MAP_ALL_ACCESS, 0, 0, + sizeof(*gc->global_hook_info)); if (!gc->global_hook_info) { warn("init_hook_info: failed to map data view: %lu", - GetLastError()); + GetLastError()); return false; } if (gc->config.force_shmem) { warn("init_hook_info: user is forcing shared memory " - "(multi-adapter compatibility mode)"); + "(multi-adapter compatibility mode)"); } - gc->global_hook_info->offsets = gc->process_is_64bit ? - offsets64 : offsets32; + gc->global_hook_info->offsets = gc->process_is_64bit ? offsets64 + : offsets32; gc->global_hook_info->capture_overlay = gc->config.capture_overlays; gc->global_hook_info->force_shmem = gc->config.force_shmem; gc->global_hook_info->use_scale = gc->config.force_scaling; @@ -807,16 +806,16 @@ static inline int inject_library(HANDLE process, const wchar_t *dll) { - return inject_library_obf(process, dll, - "D|hkqkW`kl{k\\osofj", 0xa178ef3655e5ade7, - "[uawaRzbhh{tIdkj~~", 0x561478dbd824387c, - "[fr}pboIe`dlN}", 0x395bfbc9833590fd, - "\\`zs}gmOzhhBq", 0x12897dd89168789a, - "GbfkDaezbp~X", 0x76aff7238788f7db); + return inject_library_obf(process, dll, "D|hkqkW`kl{k\\osofj", + 0xa178ef3655e5ade7, "[uawaRzbhh{tIdkj~~", + 0x561478dbd824387c, "[fr}pboIe`dlN}", + 0x395bfbc9833590fd, "\\`zs}gmOzhhBq", + 0x12897dd89168789a, "GbfkDaezbp~X", + 0x76aff7238788f7db); } static inline bool hook_direct(struct game_capture *gc, - const char *hook_path_rel) + const char *hook_path_rel) { wchar_t hook_path_abs_w[MAX_PATH]; wchar_t *hook_path_rel_w; @@ -841,7 +840,7 @@ process = open_process(PROCESS_ALL_ACCESS, false, gc->process_id); if (!process) { warn("hook_direct: could not open process: %s (%lu)", - gc->config.executable, GetLastError()); + gc->config.executable, GetLastError()); return false; } @@ -857,7 +856,8 @@ } static inline bool create_inject_process(struct game_capture *gc, - const char *inject_path, const char *hook_dll) + const char *inject_path, + const char *hook_dll) { wchar_t *command_line_w = malloc(4096 * sizeof(wchar_t)); wchar_t *inject_path_w; @@ -872,19 +872,19 @@ si.cb = sizeof(si); - swprintf(command_line_w, 4096, L"\"%s\" \"%s\" %lu %lu", - inject_path_w, hook_dll_w, - (unsigned long)anti_cheat, - anti_cheat ? gc->thread_id : gc->process_id); + swprintf(command_line_w, 4096, L"\"%s\" \"%s\" %lu %lu", inject_path_w, + hook_dll_w, (unsigned long)anti_cheat, + anti_cheat ? gc->thread_id : gc->process_id); success = !!CreateProcessW(inject_path_w, command_line_w, NULL, NULL, - false, CREATE_NO_WINDOW, NULL, NULL, &si, &pi); + false, CREATE_NO_WINDOW, NULL, NULL, &si, + &pi); if (success) { CloseHandle(pi.hThread); gc->injector_process = pi.hProcess; } else { warn("Failed to create inject helper process: %lu", - GetLastError()); + GetLastError()); } free(command_line_w); @@ -928,8 +928,8 @@ info("using direct hook"); success = hook_direct(gc, hook_path); } else { - info("using helper (%s hook)", use_anticheat(gc) ? - "compatibility" : "direct"); + info("using helper (%s hook)", + use_anticheat(gc) ? "compatibility" : "direct"); success = create_inject_process(gc, inject_path, hook_dll); } @@ -960,7 +960,7 @@ "searchui", "lockapp", "windowsinternal.composableshell.experiences.textinput.inputapp", - NULL + NULL, }; static bool is_blacklisted_exe(const char *exe) @@ -996,7 +996,7 @@ if (gc->config.mode == CAPTURE_MODE_ANY) { if (get_window_exe(&exe, gc->next_window)) { info("attempting to hook fullscreen process: %s", - exe.array); + exe.array); } } else { if (get_window_exe(&exe, gc->next_window)) { @@ -1055,8 +1055,8 @@ GetWindowThreadProcessId(window, &gc->process_id); if (gc->process_id) { - process = open_process(PROCESS_QUERY_INFORMATION, - false, gc->process_id); + process = open_process(PROCESS_QUERY_INFORMATION, false, + gc->process_id); if (process) { gc->is_app = is_app(process); if (gc->is_app) { @@ -1079,8 +1079,8 @@ * (such as steam) need a little bit of time to load. ultimately this * helps prevent crashes */ if (gc->wait_for_target_startup) { - gc->retry_interval = 3.0f * - hook_rate_to_float(gc->config.hook_rate); + gc->retry_interval = + 3.0f * hook_rate_to_float(gc->config.hook_rate); gc->wait_for_target_startup = false; } else { gc->next_window = window; @@ -1120,10 +1120,10 @@ return; } - if (rect.left == mi.rcMonitor.left && - rect.right == mi.rcMonitor.right && + if (rect.left == mi.rcMonitor.left && + rect.right == mi.rcMonitor.right && rect.bottom == mi.rcMonitor.bottom && - rect.top == mi.rcMonitor.top) { + rect.top == mi.rcMonitor.top) { setup_window(gc, window); } else { gc->wait_for_target_startup = true; @@ -1139,11 +1139,9 @@ os_utf8_to_wcs(gc->class.array, 0, class_w, 512); window = FindWindowW(class_w, NULL); } else { - window = find_window(INCLUDE_MINIMIZED, - gc->priority, - gc->class.array, - gc->title.array, - gc->executable.array); + window = find_window(INCLUDE_MINIMIZED, gc->priority, + gc->class.array, gc->title.array, + gc->executable.array); } if (window) { @@ -1163,7 +1161,7 @@ if (gc->next_window) { gc->thread_id = GetWindowThreadProcessId(gc->next_window, - &gc->process_id); + &gc->process_id); // Make sure we never try to hook ourselves (projector) if (gc->process_id == GetCurrentProcessId()) @@ -1173,8 +1171,8 @@ return; if (!gc->process_id) { warn("error acquiring, failed to get window " - "thread/process ids: %lu", - GetLastError()); + "thread/process ids: %lu", + GetLastError()); gc->error_acquiring = true; return; } @@ -1193,7 +1191,8 @@ gc->hook_restart = open_event_gc(gc, EVENT_CAPTURE_RESTART); if (!gc->hook_restart) { warn("init_events: failed to get hook_restart " - "event: %lu", GetLastError()); + "event: %lu", + GetLastError()); return false; } } @@ -1202,7 +1201,7 @@ gc->hook_stop = open_event_gc(gc, EVENT_CAPTURE_STOP); if (!gc->hook_stop) { warn("init_events: failed to get hook_stop event: %lu", - GetLastError()); + GetLastError()); return false; } } @@ -1211,7 +1210,7 @@ gc->hook_init = open_event_gc(gc, EVENT_HOOK_INIT); if (!gc->hook_init) { warn("init_events: failed to get hook_init event: %lu", - GetLastError()); + GetLastError()); return false; } } @@ -1220,7 +1219,7 @@ gc->hook_ready = open_event_gc(gc, EVENT_HOOK_READY); if (!gc->hook_ready) { warn("init_events: failed to get hook_ready event: %lu", - GetLastError()); + GetLastError()); return false; } } @@ -1229,7 +1228,7 @@ gc->hook_exit = open_event_gc(gc, EVENT_HOOK_EXIT); if (!gc->hook_exit) { warn("init_events: failed to get hook_exit event: %lu", - GetLastError()); + GetLastError()); return false; } } @@ -1237,11 +1236,7 @@ return true; } -enum capture_result { - CAPTURE_FAIL, - CAPTURE_RETRY, - CAPTURE_SUCCESS -}; +enum capture_result { CAPTURE_FAIL, CAPTURE_RETRY, CAPTURE_SUCCESS }; static inline enum capture_result init_capture_data(struct game_capture *gc) { @@ -1257,23 +1252,24 @@ CloseHandle(gc->hook_data_map); gc->hook_data_map = open_map_plus_id(gc, SHMEM_TEXTURE, - gc->global_hook_info->map_id); + gc->global_hook_info->map_id); if (!gc->hook_data_map) { DWORD error = GetLastError(); if (error == 2) { return CAPTURE_RETRY; } else { warn("init_capture_data: failed to open file " - "mapping: %lu", error); + "mapping: %lu", + error); } return CAPTURE_FAIL; } gc->data = MapViewOfFile(gc->hook_data_map, FILE_MAP_ALL_ACCESS, 0, 0, - gc->global_hook_info->map_size); + gc->global_hook_info->map_size); if (!gc->data) { warn("init_capture_data: failed to map data view: %lu", - GetLastError()); + GetLastError()); return CAPTURE_FAIL; } @@ -1285,16 +1281,16 @@ static inline uint32_t convert_5_to_8bit(uint16_t val) { - return (uint32_t)((double)(val & 0x1F) * (255.0/31.0)); + return (uint32_t)((double)(val & 0x1F) * (255.0 / 31.0)); } static inline uint32_t convert_6_to_8bit(uint16_t val) { - return (uint32_t)((double)(val & 0x3F) * (255.0/63.0)); + return (uint32_t)((double)(val & 0x3F) * (255.0 / 63.0)); } static void copy_b5g6r5_tex(struct game_capture *gc, int cur_texture, - uint8_t *data, uint32_t pitch) + uint8_t *data, uint32_t pitch) { uint8_t *input = gc->texture_buffers[cur_texture]; uint32_t gc_cx = gc->cx; @@ -1310,7 +1306,8 @@ __m128i pixels_result; __m128i *pixels_dest; - __m128i *pixels_src = (__m128i*)(row + x * sizeof(uint16_t)); + __m128i *pixels_src = + (__m128i *)(row + x * sizeof(uint16_t)); __m128i pixels = _mm_load_si128(pixels_src); __m128i zero = _mm_setzero_si128(); @@ -1324,51 +1321,64 @@ __m128i red_channel_mask = _mm_set1_epi32(0x0000F800); __m128i red_offset = _mm_set1_epi32(0x00000300); - pixels_blue = _mm_and_si128(pixels_low, blue_channel_mask); + pixels_blue = + _mm_and_si128(pixels_low, blue_channel_mask); pixels_blue = _mm_slli_epi32(pixels_blue, 3); pixels_blue = _mm_add_epi32(pixels_blue, blue_offset); - pixels_green = _mm_and_si128(pixels_low, green_channel_mask); - pixels_green = _mm_add_epi32(pixels_green, green_offset); + pixels_green = + _mm_and_si128(pixels_low, green_channel_mask); + pixels_green = + _mm_add_epi32(pixels_green, green_offset); pixels_green = _mm_slli_epi32(pixels_green, 5); - pixels_red = _mm_and_si128(pixels_low, red_channel_mask); + pixels_red = + _mm_and_si128(pixels_low, red_channel_mask); pixels_red = _mm_add_epi32(pixels_red, red_offset); pixels_red = _mm_slli_epi32(pixels_red, 8); pixels_result = _mm_set1_epi32(0xFF000000); - pixels_result = _mm_or_si128(pixels_result, pixels_blue); - pixels_result = _mm_or_si128(pixels_result, pixels_green); + pixels_result = + _mm_or_si128(pixels_result, pixels_blue); + pixels_result = + _mm_or_si128(pixels_result, pixels_green); pixels_result = _mm_or_si128(pixels_result, pixels_red); - pixels_dest = (__m128i*)(out + x * sizeof(uint32_t)); + pixels_dest = (__m128i *)(out + x * sizeof(uint32_t)); _mm_store_si128(pixels_dest, pixels_result); - pixels_blue = _mm_and_si128(pixels_high, blue_channel_mask); + pixels_blue = + _mm_and_si128(pixels_high, blue_channel_mask); pixels_blue = _mm_slli_epi32(pixels_blue, 3); pixels_blue = _mm_add_epi32(pixels_blue, blue_offset); - pixels_green = _mm_and_si128(pixels_high, green_channel_mask); - pixels_green = _mm_add_epi32(pixels_green, green_offset); + pixels_green = + _mm_and_si128(pixels_high, green_channel_mask); + pixels_green = + _mm_add_epi32(pixels_green, green_offset); pixels_green = _mm_slli_epi32(pixels_green, 5); - pixels_red = _mm_and_si128(pixels_high, red_channel_mask); + pixels_red = + _mm_and_si128(pixels_high, red_channel_mask); pixels_red = _mm_add_epi32(pixels_red, red_offset); pixels_red = _mm_slli_epi32(pixels_red, 8); pixels_result = _mm_set1_epi32(0xFF000000); - pixels_result = _mm_or_si128(pixels_result, pixels_blue); - pixels_result = _mm_or_si128(pixels_result, pixels_green); + pixels_result = + _mm_or_si128(pixels_result, pixels_blue); + pixels_result = + _mm_or_si128(pixels_result, pixels_green); pixels_result = _mm_or_si128(pixels_result, pixels_red); - pixels_dest = (__m128i*)(out + (x + 4) * sizeof(uint32_t)); + pixels_dest = + (__m128i *)(out + (x + 4) * sizeof(uint32_t)); _mm_store_si128(pixels_dest, pixels_result); } } } static void copy_b5g5r5a1_tex(struct game_capture *gc, int cur_texture, - uint8_t *data, uint32_t pitch) + uint8_t *data, uint32_t pitch) { uint8_t *input = gc->texture_buffers[cur_texture]; uint32_t gc_cx = gc->cx; @@ -1380,11 +1390,13 @@ uint8_t *out = data + (pitch * y); for (uint32_t x = 0; x < gc_cx; x += 8) { - __m128i pixels_blue, pixels_green, pixels_red, pixels_alpha; + __m128i pixels_blue, pixels_green, pixels_red, + pixels_alpha; __m128i pixels_result; __m128i *pixels_dest; - __m128i *pixels_src = (__m128i*)(row + x * sizeof(uint16_t)); + __m128i *pixels_src = + (__m128i *)(row + x * sizeof(uint16_t)); __m128i pixels = _mm_load_si128(pixels_src); __m128i zero = _mm_setzero_si128(); @@ -1401,61 +1413,82 @@ __m128i alpha_offset = _mm_set1_epi32(0x00000001); __m128i alpha_mask32 = _mm_set1_epi32(0xFF000000); - pixels_blue = _mm_and_si128(pixels_low, blue_channel_mask); + pixels_blue = + _mm_and_si128(pixels_low, blue_channel_mask); pixels_blue = _mm_slli_epi32(pixels_blue, 3); pixels_blue = _mm_add_epi32(pixels_blue, blue_offset); - pixels_green = _mm_and_si128(pixels_low, green_channel_mask); - pixels_green = _mm_add_epi32(pixels_green, green_offset); + pixels_green = + _mm_and_si128(pixels_low, green_channel_mask); + pixels_green = + _mm_add_epi32(pixels_green, green_offset); pixels_green = _mm_slli_epi32(pixels_green, 6); - pixels_red = _mm_and_si128(pixels_low, red_channel_mask); + pixels_red = + _mm_and_si128(pixels_low, red_channel_mask); pixels_red = _mm_add_epi32(pixels_red, red_offset); pixels_red = _mm_slli_epi32(pixels_red, 9); - pixels_alpha = _mm_and_si128(pixels_low, alpha_channel_mask); + pixels_alpha = + _mm_and_si128(pixels_low, alpha_channel_mask); pixels_alpha = _mm_srli_epi32(pixels_alpha, 15); - pixels_alpha = _mm_sub_epi32(pixels_alpha, alpha_offset); - pixels_alpha = _mm_andnot_si128(pixels_alpha, alpha_mask32); + pixels_alpha = + _mm_sub_epi32(pixels_alpha, alpha_offset); + pixels_alpha = + _mm_andnot_si128(pixels_alpha, alpha_mask32); pixels_result = pixels_red; - pixels_result = _mm_or_si128(pixels_result, pixels_alpha); - pixels_result = _mm_or_si128(pixels_result, pixels_blue); - pixels_result = _mm_or_si128(pixels_result, pixels_green); - - pixels_dest = (__m128i*)(out + x * sizeof(uint32_t)); + pixels_result = + _mm_or_si128(pixels_result, pixels_alpha); + pixels_result = + _mm_or_si128(pixels_result, pixels_blue); + pixels_result = + _mm_or_si128(pixels_result, pixels_green); + + pixels_dest = (__m128i *)(out + x * sizeof(uint32_t)); _mm_store_si128(pixels_dest, pixels_result); - pixels_blue = _mm_and_si128(pixels_high, blue_channel_mask); + pixels_blue = + _mm_and_si128(pixels_high, blue_channel_mask); pixels_blue = _mm_slli_epi32(pixels_blue, 3); pixels_blue = _mm_add_epi32(pixels_blue, blue_offset); - pixels_green = _mm_and_si128(pixels_high, green_channel_mask); - pixels_green = _mm_add_epi32(pixels_green, green_offset); + pixels_green = + _mm_and_si128(pixels_high, green_channel_mask); + pixels_green = + _mm_add_epi32(pixels_green, green_offset); pixels_green = _mm_slli_epi32(pixels_green, 6); - pixels_red = _mm_and_si128(pixels_high, red_channel_mask); + pixels_red = + _mm_and_si128(pixels_high, red_channel_mask); pixels_red = _mm_add_epi32(pixels_red, red_offset); pixels_red = _mm_slli_epi32(pixels_red, 9); - pixels_alpha = _mm_and_si128(pixels_high, alpha_channel_mask); + pixels_alpha = + _mm_and_si128(pixels_high, alpha_channel_mask); pixels_alpha = _mm_srli_epi32(pixels_alpha, 15); - pixels_alpha = _mm_sub_epi32(pixels_alpha, alpha_offset); - pixels_alpha = _mm_andnot_si128(pixels_alpha, alpha_mask32); + pixels_alpha = + _mm_sub_epi32(pixels_alpha, alpha_offset); + pixels_alpha = + _mm_andnot_si128(pixels_alpha, alpha_mask32); pixels_result = pixels_red; - pixels_result = _mm_or_si128(pixels_result, pixels_alpha); - pixels_result = _mm_or_si128(pixels_result, pixels_blue); - pixels_result = _mm_or_si128(pixels_result, pixels_green); - - pixels_dest = (__m128i*)(out + (x + 4) * sizeof(uint32_t)); + pixels_result = + _mm_or_si128(pixels_result, pixels_alpha); + pixels_result = + _mm_or_si128(pixels_result, pixels_blue); + pixels_result = + _mm_or_si128(pixels_result, pixels_green); + + pixels_dest = + (__m128i *)(out + (x + 4) * sizeof(uint32_t)); _mm_store_si128(pixels_dest, pixels_result); } } } static inline void copy_16bit_tex(struct game_capture *gc, int cur_texture, - uint8_t *data, uint32_t pitch) + uint8_t *data, uint32_t pitch) { if (gc->global_hook_info->format == DXGI_FORMAT_B5G5R5A1_UNORM) { copy_b5g5r5a1_tex(gc, cur_texture, data, pitch); @@ -1500,11 +1533,11 @@ } else if (pitch == gc->pitch) { memcpy(data, gc->texture_buffers[cur_texture], - pitch * gc->cy); + pitch * gc->cy); } else { uint8_t *input = gc->texture_buffers[cur_texture]; - uint32_t best_pitch = - pitch < gc->pitch ? pitch : gc->pitch; + uint32_t best_pitch = pitch < gc->pitch ? pitch + : gc->pitch; for (uint32_t y = 0; y < gc->cy; y++) { uint8_t *line_in = input + gc->pitch * y; @@ -1530,18 +1563,19 @@ enum gs_color_format format; gc->texture_buffers[0] = - (uint8_t*)gc->data + gc->shmem_data->tex1_offset; + (uint8_t *)gc->data + gc->shmem_data->tex1_offset; gc->texture_buffers[1] = - (uint8_t*)gc->data + gc->shmem_data->tex2_offset; + (uint8_t *)gc->data + gc->shmem_data->tex2_offset; gc->convert_16bit = is_16bit_format(gc->global_hook_info->format); - format = gc->convert_16bit ? - GS_BGRA : convert_format(gc->global_hook_info->format); + format = gc->convert_16bit + ? GS_BGRA + : convert_format(gc->global_hook_info->format); obs_enter_graphics(); gs_texture_destroy(gc->texture); - gc->texture = gs_texture_create(gc->cx, gc->cy, format, 1, NULL, - GS_DYNAMIC); + gc->texture = + gs_texture_create(gc->cx, gc->cy, format, 1, NULL, GS_DYNAMIC); obs_leave_graphics(); if (!gc->texture) { @@ -1592,7 +1626,7 @@ static inline bool capture_valid(struct game_capture *gc) { if (!gc->dwm_capture && !IsWindow(gc->window)) - return false; + return false; return !object_signalled(gc->target_process); } @@ -1604,7 +1638,7 @@ if (gc->cursor_check_time >= 0.1f) { DWORD foreground_process_id; GetWindowThreadProcessId(GetForegroundWindow(), - &foreground_process_id); + &foreground_process_id); if (gc->process_id != foreground_process_id) gc->cursor_hidden = true; else @@ -1621,7 +1655,7 @@ if (activate_now) { HWND hwnd = (HWND)(uintptr_t)os_atomic_load_long( - &gc->hotkey_window); + &gc->hotkey_window); if (is_uwp_window(hwnd)) hwnd = get_uwp_actual_window(hwnd); @@ -1631,7 +1665,8 @@ get_window_class(&gc->class, hwnd); gc->priority = WINDOW_PRIORITY_CLASS; - gc->retry_time = 10.0f * hook_rate_to_float(gc->config.hook_rate); + gc->retry_time = 10.0f * hook_rate_to_float( + gc->config.hook_rate); gc->activate_hook = true; } else { deactivate = false; @@ -1650,7 +1685,8 @@ return; } else if (!gc->showing) { - gc->retry_time = 10.0f * hook_rate_to_float(gc->config.hook_rate); + gc->retry_time = + 10.0f * hook_rate_to_float(gc->config.hook_rate); } if (gc->hook_stop && object_signalled(gc->hook_stop)) { @@ -1676,8 +1712,9 @@ gc->error_acquiring = true; } else if (!gc->capturing) { - gc->retry_interval = ERROR_RETRY_INTERVAL * - hook_rate_to_float(gc->config.hook_rate); + gc->retry_interval = + ERROR_RETRY_INTERVAL * + hook_rate_to_float(gc->config.hook_rate); stop_capture(gc); } } @@ -1692,8 +1729,9 @@ debug("init_capture_data failed"); if (result != CAPTURE_RETRY && !gc->capturing) { - gc->retry_interval = ERROR_RETRY_INTERVAL * - hook_rate_to_float(gc->config.hook_rate); + gc->retry_interval = + ERROR_RETRY_INTERVAL * + hook_rate_to_float(gc->config.hook_rate); stop_capture(gc); } } @@ -1745,24 +1783,23 @@ POINT p = {0}; HWND window; - if (!gc->global_hook_info->base_cx || - !gc->global_hook_info->base_cy) + if (!gc->global_hook_info->base_cx || !gc->global_hook_info->base_cy) return; window = !!gc->global_hook_info->window - ? (HWND)(uintptr_t)gc->global_hook_info->window - : gc->window; + ? (HWND)(uintptr_t)gc->global_hook_info->window + : gc->window; ClientToScreen(window, &p); float x_scale = (float)gc->global_hook_info->cx / - (float)gc->global_hook_info->base_cx; + (float)gc->global_hook_info->base_cx; float y_scale = (float)gc->global_hook_info->cy / - (float)gc->global_hook_info->base_cy; + (float)gc->global_hook_info->base_cy; cursor_draw(&gc->cursor_data, -p.x, -p.y, x_scale, y_scale, - gc->global_hook_info->base_cx, - gc->global_hook_info->base_cy); + gc->global_hook_info->base_cx, + gc->global_hook_info->base_cy); } static void game_capture_render(void *data, gs_effect_t *effect) @@ -1771,21 +1808,22 @@ if (!gc->texture || !gc->active) return; - effect = obs_get_base_effect(gc->config.allow_transparency ? - OBS_EFFECT_DEFAULT : OBS_EFFECT_OPAQUE); + effect = obs_get_base_effect(gc->config.allow_transparency + ? OBS_EFFECT_DEFAULT + : OBS_EFFECT_OPAQUE); while (gs_effect_loop(effect, "Draw")) { obs_source_draw(gc->texture, 0, 0, 0, 0, gc->global_hook_info->flip); if (gc->config.allow_transparency && gc->config.cursor && - !gc->cursor_hidden) { + !gc->cursor_hidden) { game_capture_render_cursor(gc); } } if (!gc->config.allow_transparency && gc->config.cursor && - !gc->cursor_hidden) { + !gc->cursor_hidden) { effect = obs_get_base_effect(OBS_EFFECT_DEFAULT); while (gs_effect_loop(effect, "Draw")) { @@ -1816,7 +1854,7 @@ { obs_data_set_default_string(settings, SETTING_MODE, SETTING_MODE_ANY); obs_data_set_default_int(settings, SETTING_WINDOW_PRIORITY, - (int)WINDOW_PRIORITY_EXE); + (int)WINDOW_PRIORITY_EXE); obs_data_set_default_bool(settings, SETTING_COMPATIBILITY, false); obs_data_set_default_bool(settings, SETTING_FORCE_SCALING, false); obs_data_set_default_bool(settings, SETTING_CURSOR, true); @@ -1826,17 +1864,17 @@ obs_data_set_default_bool(settings, SETTING_CAPTURE_OVERLAYS, false); obs_data_set_default_bool(settings, SETTING_ANTI_CHEAT_HOOK, true); obs_data_set_default_int(settings, SETTING_HOOK_RATE, - (int)HOOK_RATE_NORMAL); + (int)HOOK_RATE_NORMAL); } -static bool mode_callback(obs_properties_t *ppts, - obs_property_t *p, obs_data_t *settings) +static bool mode_callback(obs_properties_t *ppts, obs_property_t *p, + obs_data_t *settings) { bool capture_window; if (using_older_non_mode_format(settings)) { - capture_window = !obs_data_get_bool(settings, - SETTING_ANY_FULLSCREEN); + capture_window = + !obs_data_get_bool(settings, SETTING_ANY_FULLSCREEN); } else { const char *mode = obs_data_get_string(settings, SETTING_MODE); capture_window = strcmp(mode, SETTING_MODE_WINDOW) == 0; @@ -1852,7 +1890,7 @@ } static bool use_scaling_callback(obs_properties_t *ppts, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { bool use_scale = obs_data_get_bool(settings, SETTING_FORCE_SCALING); @@ -1881,7 +1919,7 @@ } static bool window_changed_callback(obs_properties_t *ppts, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { const char *cur_val; bool match = false; @@ -1912,21 +1950,15 @@ return false; } -static const double default_scale_vals[] = { - 1.25, - 1.5, - 2.0, - 2.5, - 3.0 -}; +static const double default_scale_vals[] = {1.25, 1.5, 2.0, 2.5, 3.0}; #define NUM_DEFAULT_SCALE_VALS \ (sizeof(default_scale_vals) / sizeof(default_scale_vals[0])) -static BOOL CALLBACK EnumFirstMonitor(HMONITOR monitor, HDC hdc, - LPRECT rc, LPARAM data) +static BOOL CALLBACK EnumFirstMonitor(HMONITOR monitor, HDC hdc, LPRECT rc, + LPARAM data) { - *(HMONITOR*)data = monitor; + *(HMONITOR *)data = monitor; UNUSED_PARAMETER(hdc); UNUSED_PARAMETER(rc); @@ -1934,7 +1966,7 @@ } static bool window_not_blacklisted(const char *title, const char *class, - const char *exe) + const char *exe) { UNUSED_PARAMETER(title); UNUSED_PARAMETER(class); @@ -1951,7 +1983,7 @@ /* scaling is free form, this is mostly just to provide some common * values */ bool success = !!EnumDisplayMonitors(NULL, NULL, EnumFirstMonitor, - (LPARAM)&monitor); + (LPARAM)&monitor); if (success) { MONITORINFO mi = {0}; mi.cbSize = sizeof(mi); @@ -1968,9 +2000,9 @@ obs_data_t *settings = obs_source_get_settings(gc->source); if (using_older_non_mode_format(settings)) { bool any = obs_data_get_bool(settings, - SETTING_ANY_FULLSCREEN); - const char *mode = any ? - SETTING_MODE_ANY : SETTING_MODE_WINDOW; + SETTING_ANY_FULLSCREEN); + const char *mode = any ? SETTING_MODE_ANY + : SETTING_MODE_WINDOW; obs_data_set_string(settings, SETTING_MODE, mode); } @@ -1981,38 +2013,41 @@ obs_property_t *p; p = obs_properties_add_list(ppts, SETTING_MODE, TEXT_MODE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); - obs_property_list_add_string(p, TEXT_MODE_ANY, SETTING_MODE_ANY); + obs_property_list_add_string(p, TEXT_MODE_ANY, SETTING_MODE_ANY); obs_property_list_add_string(p, TEXT_MODE_WINDOW, SETTING_MODE_WINDOW); obs_property_list_add_string(p, TEXT_MODE_HOTKEY, SETTING_MODE_HOTKEY); obs_property_set_modified_callback(p, mode_callback); p = obs_properties_add_list(ppts, SETTING_CAPTURE_WINDOW, TEXT_WINDOW, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, "", ""); fill_window_list(p, INCLUDE_MINIMIZED, window_not_blacklisted); obs_property_set_modified_callback(p, window_changed_callback); p = obs_properties_add_list(ppts, SETTING_WINDOW_PRIORITY, - TEXT_MATCH_PRIORITY, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_INT); + TEXT_MATCH_PRIORITY, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_property_list_add_int(p, TEXT_MATCH_TITLE, WINDOW_PRIORITY_TITLE); obs_property_list_add_int(p, TEXT_MATCH_CLASS, WINDOW_PRIORITY_CLASS); - obs_property_list_add_int(p, TEXT_MATCH_EXE, WINDOW_PRIORITY_EXE); + obs_property_list_add_int(p, TEXT_MATCH_EXE, WINDOW_PRIORITY_EXE); obs_properties_add_bool(ppts, SETTING_COMPATIBILITY, - TEXT_SLI_COMPATIBILITY); + TEXT_SLI_COMPATIBILITY); p = obs_properties_add_bool(ppts, SETTING_FORCE_SCALING, - TEXT_FORCE_SCALING); + TEXT_FORCE_SCALING); obs_property_set_modified_callback(p, use_scaling_callback); p = obs_properties_add_list(ppts, SETTING_SCALE_RES, TEXT_SCALE_RES, - OBS_COMBO_TYPE_EDITABLE, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_EDITABLE, + OBS_COMBO_FORMAT_STRING); for (size_t i = 0; i < NUM_DEFAULT_SCALE_VALS; i++) { char scale_str[64]; @@ -2021,7 +2056,7 @@ uint32_t new_cy = (uint32_t)((double)cy / default_scale_vals[i]) & ~2; - sprintf(scale_str, "%"PRIu32"x%"PRIu32, new_cx, new_cy); + sprintf(scale_str, "%" PRIu32 "x%" PRIu32, new_cx, new_cy); obs_property_list_add_string(p, scale_str, scale_str); } @@ -2029,37 +2064,35 @@ obs_property_set_enabled(p, false); obs_properties_add_bool(ppts, SETTING_TRANSPARENCY, - TEXT_ALLOW_TRANSPARENCY); + TEXT_ALLOW_TRANSPARENCY); obs_properties_add_bool(ppts, SETTING_LIMIT_FRAMERATE, - TEXT_LIMIT_FRAMERATE); + TEXT_LIMIT_FRAMERATE); obs_properties_add_bool(ppts, SETTING_CURSOR, TEXT_CAPTURE_CURSOR); obs_properties_add_bool(ppts, SETTING_ANTI_CHEAT_HOOK, - TEXT_ANTI_CHEAT_HOOK); + TEXT_ANTI_CHEAT_HOOK); obs_properties_add_bool(ppts, SETTING_CAPTURE_OVERLAYS, - TEXT_CAPTURE_OVERLAYS); - - p = obs_properties_add_list(ppts, SETTING_HOOK_RATE, - TEXT_HOOK_RATE, OBS_COMBO_TYPE_LIST, - OBS_COMBO_FORMAT_INT); - obs_property_list_add_int(p, TEXT_HOOK_RATE_SLOW, HOOK_RATE_SLOW); - obs_property_list_add_int(p, TEXT_HOOK_RATE_NORMAL, HOOK_RATE_NORMAL); - obs_property_list_add_int(p, TEXT_HOOK_RATE_FAST, HOOK_RATE_FAST); + TEXT_CAPTURE_OVERLAYS); + + p = obs_properties_add_list(ppts, SETTING_HOOK_RATE, TEXT_HOOK_RATE, + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_list_add_int(p, TEXT_HOOK_RATE_SLOW, HOOK_RATE_SLOW); + obs_property_list_add_int(p, TEXT_HOOK_RATE_NORMAL, HOOK_RATE_NORMAL); + obs_property_list_add_int(p, TEXT_HOOK_RATE_FAST, HOOK_RATE_FAST); obs_property_list_add_int(p, TEXT_HOOK_RATE_FASTEST, HOOK_RATE_FASTEST); UNUSED_PARAMETER(data); return ppts; } - struct obs_source_info game_capture_info = { .id = "game_capture", .type = OBS_SOURCE_TYPE_INPUT, .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_DO_NOT_DUPLICATE, + OBS_SOURCE_DO_NOT_DUPLICATE, .get_name = game_capture_name, .create = game_capture_create, .destroy = game_capture_destroy, @@ -2069,5 +2102,5 @@ .get_properties = game_capture_properties, .update = game_capture_update, .video_tick = game_capture_tick, - .video_render = game_capture_render + .video_render = game_capture_render, };
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/get-graphics-offsets/d3d8-offsets.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/get-graphics-offsets/d3d8-offsets.cpp
Changed
@@ -6,20 +6,20 @@ typedef IDirect3D8 *(WINAPI *d3d8create_t)(UINT); struct d3d8_info { - HMODULE module; - HWND hwnd; - IDirect3D8 *d3d8; + HMODULE module; + HWND hwnd; + IDirect3D8 *d3d8; IDirect3DDevice8 *device; }; static inline bool d3d8_init(d3d8_info &info) { d3d8create_t create; - HRESULT hr; + HRESULT hr; info.hwnd = CreateWindowExA(0, DUMMY_WNDCLASS, "d3d8 get-addr window", - WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, - GetModuleHandleA(nullptr), nullptr); + WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, + GetModuleHandleA(nullptr), nullptr); if (!info.hwnd) { return false; } @@ -40,17 +40,18 @@ } D3DPRESENT_PARAMETERS pp = {}; - pp.Windowed = true; - pp.SwapEffect = D3DSWAPEFFECT_FLIP; - pp.BackBufferFormat = D3DFMT_A8R8G8B8; - pp.BackBufferWidth = 2; - pp.BackBufferHeight = 2; - pp.BackBufferCount = 1; - pp.hDeviceWindow = info.hwnd; + pp.Windowed = true; + pp.SwapEffect = D3DSWAPEFFECT_FLIP; + pp.BackBufferFormat = D3DFMT_A8R8G8B8; + pp.BackBufferWidth = 2; + pp.BackBufferHeight = 2; + pp.BackBufferCount = 1; + pp.hDeviceWindow = info.hwnd; hr = info.d3d8->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - info.hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, - &info.device); + info.hwnd, + D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, + &info.device); if (FAILED(hr)) { return false; } @@ -70,8 +71,8 @@ void get_d3d8_offsets(struct d3d8_offsets *offsets) { - d3d8_info info = {}; - bool success = d3d8_init(info); + d3d8_info info = {}; + bool success = d3d8_init(info); if (success) { offsets->present = vtable_offset(info.module, info.device, 15);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/get-graphics-offsets/d3d9-offsets.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/get-graphics-offsets/d3d9-offsets.cpp
Changed
@@ -3,24 +3,24 @@ #include <d3d9.h> #include "get-graphics-offsets.h" -typedef HRESULT (WINAPI *d3d9createex_t)(UINT, IDirect3D9Ex**); +typedef HRESULT(WINAPI *d3d9createex_t)(UINT, IDirect3D9Ex **); struct d3d9_info { - HMODULE module; - HWND hwnd; - IDirect3D9Ex *d3d9ex; - IDirect3DDevice9Ex *device; - IDirect3DSwapChain9 *swap; + HMODULE module; + HWND hwnd; + IDirect3D9Ex *d3d9ex; + IDirect3DDevice9Ex *device; + IDirect3DSwapChain9 *swap; }; static inline bool d3d9_init(d3d9_info &info) { d3d9createex_t create; - HRESULT hr; + HRESULT hr; info.hwnd = CreateWindowExA(0, DUMMY_WNDCLASS, "d3d9 get-offset window", - WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, - GetModuleHandleA(nullptr), nullptr); + WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, + GetModuleHandleA(nullptr), nullptr); if (!info.hwnd) { return false; } @@ -31,7 +31,7 @@ } create = (d3d9createex_t)GetProcAddress(info.module, - "Direct3DCreate9Ex"); + "Direct3DCreate9Ex"); if (!create) { return false; } @@ -42,19 +42,19 @@ } D3DPRESENT_PARAMETERS pp = {}; - pp.Windowed = true; - pp.SwapEffect = D3DSWAPEFFECT_FLIP; - pp.BackBufferFormat = D3DFMT_A8R8G8B8; - pp.BackBufferWidth = 2; - pp.BackBufferHeight = 2; - pp.BackBufferCount = 1; - pp.hDeviceWindow = info.hwnd; - pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; - - hr = info.d3d9ex->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - info.hwnd, - D3DCREATE_HARDWARE_VERTEXPROCESSING | - D3DCREATE_NOWINDOWCHANGES, &pp, nullptr, &info.device); + pp.Windowed = true; + pp.SwapEffect = D3DSWAPEFFECT_FLIP; + pp.BackBufferFormat = D3DFMT_A8R8G8B8; + pp.BackBufferWidth = 2; + pp.BackBufferHeight = 2; + pp.BackBufferCount = 1; + pp.hDeviceWindow = info.hwnd; + pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; + + hr = info.d3d9ex->CreateDeviceEx( + D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, info.hwnd, + D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_NOWINDOWCHANGES, + &pp, nullptr, &info.device); if (FAILED(hr)) { return false; } @@ -84,24 +84,12 @@ #define MAX_CMP_SIZE 22 static const uint8_t mask[][MAX_CMP_SIZE] = { - { - 0xF8, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0x00, - 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00 - }, - { - 0xF8, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0x00, - 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00 - }, - { - 0xF8, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0x00, - 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00 - }, + {0xF8, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00}, + {0xF8, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x00, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00}, + {0xF8, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}, }; static const uint8_t mask_cmp[][MAX_CMP_SIZE] = { @@ -112,12 +100,8 @@ * 75 12 jnz short loc_7FF7AA90530 * 41 B8 F9 19 00 00 mov r8d, 19F9h */ - { - 0x48, 0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x44, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x75, 0x00, - 0x40, 0xB8, 0x00, 0x00, 0x00, 0x00 - }, + {0x48, 0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x44, 0x39, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x75, 0x00, 0x40, 0xB8, 0x00, 0x00, 0x00, 0x00}, /* * Windows ???+ * 49 8B 87 78 41 00 00 mov rax, [r15+4178h] @@ -125,12 +109,8 @@ * 75 12 jnz short loc_1800AEC9C * 41 B9 C3 1A 00 00 mov r9d, 1AC3h */ - { - 0x48, 0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x39, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x75, 0x00, - 0x40, 0xB8, 0x00, 0x00, 0x00, 0x00 - }, + {0x48, 0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x39, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x75, 0x00, 0x40, 0xB8, 0x00, 0x00, 0x00, 0x00}, /* * Windows 10 April 2018 * 49 8B 87 58 40 00 00 mov rax, [r15+4058h] @@ -140,13 +120,8 @@ * * Note: different instructions, last byte skipped due to MAX_CMP_SIZE */ - { - 0x48, 0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x39, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x75, 0x00, - 0x48, 0x8D, 0x00, 0x00, 0x00, 0x00 - } -}; + {0x48, 0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x39, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x75, 0x00, 0x48, 0x8D, 0x00, 0x00, 0x00, 0x00}}; // Offset into the code for the numbers we're interested in static const uint32_t code_offsets[][2] = { @@ -159,24 +134,12 @@ #define MAX_CMP_SIZE 20 static const uint8_t mask[][MAX_CMP_SIZE] = { - { - 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0x00, - 0xFF, 0x00, 0x00, 0x00, 0x00 - }, - { - 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, - 0xFF, 0x00, - 0xFF, 0x00, 0x00, 0x00, 0x00 - }, - { - 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, - 0xFF, 0x00, - 0xFF, 0x00, 0x00, 0x00, 0x00 - }, + {0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, + 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00}, + {0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00}, + {0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, + 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00}, }; static const uint8_t mask_cmp[][MAX_CMP_SIZE] = { @@ -187,12 +150,8 @@ * 75 14 jnz short loc_754CD9E1 * 68 F9 19 00 00 push 19F9h */ - { - 0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x39, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x75, 0x00, - 0x68, 0x00, 0x00, 0x00, 0x00 - }, + {0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x39, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x75, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00}, /* Windows 10 Creator's Update+ * 8B 86 F8 2B 00 00 mov eax, [esi+2BF8h] @@ -200,12 +159,8 @@ * 75 0F jnz short loc_100D793C * 68 C3 1A 00 00 push 1AC3h */ - { - 0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x75, 0x00, - 0x68, 0x00, 0x00, 0x00, 0x00 - }, + {0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x83, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x75, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00}, /* * Windows 10 April 2018 Update @@ -214,13 +169,8 @@ * 75 0F jnz short loc_100D9A9C * BA 08 71 01 10 mov edx, offset errMsg */ - { - 0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x75, 0x00, - 0xBA, 0x00, 0x00, 0x00, 0x00 - } -}; + {0x8B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x83, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x75, 0x00, 0xBA, 0x00, 0x00, 0x00, 0x00}}; // Offset into the code for the numbers we're interested in static const uint32_t code_offsets[][2] = { @@ -233,7 +183,7 @@ #define MAX_FUNC_SCAN_BYTES 200 static inline bool pattern_matches(uint8_t *byte, uint32_t *offset1, - uint32_t *offset2) + uint32_t *offset2) { for (size_t j = 0; j < sizeof(mask) / sizeof(mask[0]); j++) { for (size_t i = 0; i < MAX_CMP_SIZE; i++) { @@ -245,7 +195,7 @@ *offset2 = code_offsets[j][1]; return true; -next_signature:; + next_signature:; } return false; @@ -253,23 +203,23 @@ void get_d3d9_offsets(struct d3d9_offsets *offsets) { - d3d9_info info = {}; - bool success = d3d9_init(info); + d3d9_info info = {}; + bool success = d3d9_init(info); if (success) { - uint8_t **vt = *(uint8_t***)info.device; + uint8_t **vt = *(uint8_t ***)info.device; uint8_t *crr = vt[125]; offsets->present = vtable_offset(info.module, info.device, 17); - offsets->present_ex = vtable_offset(info.module, info.device, - 121); - offsets->present_swap = vtable_offset(info.module, info.swap, - 3); + offsets->present_ex = + vtable_offset(info.module, info.device, 121); + offsets->present_swap = + vtable_offset(info.module, info.swap, 3); uint32_t offset1, offset2; for (size_t i = 0; i < MAX_FUNC_SCAN_BYTES; i++) { if (pattern_matches(&crr[i], &offset1, &offset2)) { -#define get_offset(x) *(uint32_t*)&crr[i + x] +#define get_offset(x) *(uint32_t *)&crr[i + x] uint32_t off1 = get_offset(offset1); uint32_t off2 = get_offset(offset2); @@ -278,23 +228,23 @@ if (off1 > 0xFFFF || off2 > 0xFFFF) break; - /* check to make sure offsets actually point + /* check to make sure offsets actually point * toward expected data */ #ifdef _MSC_VER __try { - uint8_t *ptr = (uint8_t*)(info.device); + uint8_t *ptr = (uint8_t *)(info.device); uint8_t *d3d9_ptr = - *(uint8_t**)(ptr + off1); - if (d3d9_ptr != (uint8_t*)info.d3d9ex) + *(uint8_t **)(ptr + off1); + if (d3d9_ptr != (uint8_t *)info.d3d9ex) break; BOOL &is_d3d9ex = - *(BOOL*)(d3d9_ptr + off2); + *(BOOL *)(d3d9_ptr + off2); if (is_d3d9ex != TRUE) break; - } __except(EXCEPTION_EXECUTE_HANDLER) { + } __except (EXCEPTION_EXECUTE_HANDLER) { break; } #endif
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/get-graphics-offsets/dxgi-offsets.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/get-graphics-offsets/dxgi-offsets.cpp
Changed
@@ -4,33 +4,38 @@ #include <dxgi1_2.h> #include "get-graphics-offsets.h" -typedef HRESULT (WINAPI *d3d10create_t)(IDXGIAdapter*, D3D10_DRIVER_TYPE, - HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC*, - IDXGISwapChain**, IUnknown**); -typedef HRESULT (WINAPI *create_fac_t)(IID *id, void**); +typedef HRESULT(WINAPI *d3d10create_t)(IDXGIAdapter *, D3D10_DRIVER_TYPE, + HMODULE, UINT, UINT, + DXGI_SWAP_CHAIN_DESC *, + IDXGISwapChain **, IUnknown **); +typedef HRESULT(WINAPI *create_fac_t)(IID *id, void **); struct dxgi_info { - HMODULE module; - HWND hwnd; + HMODULE module; + HWND hwnd; IDXGISwapChain *swap; }; -static const IID dxgiFactory2 = -{0x50c83a1c, 0xe072, 0x4c48, {0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, 0xd0}}; +static const IID dxgiFactory2 = {0x50c83a1c, + 0xe072, + 0x4c48, + {0x87, 0xb0, 0x36, 0x30, 0xfa, 0x36, 0xa6, + 0xd0}}; static inline bool dxgi_init(dxgi_info &info) { - HMODULE d3d10_module; + HMODULE d3d10_module; d3d10create_t create; - create_fac_t create_factory; + create_fac_t create_factory; IDXGIFactory1 *factory; IDXGIAdapter1 *adapter; - IUnknown *device; - HRESULT hr; + IUnknown *device; + HRESULT hr; - info.hwnd = CreateWindowExA(0, DUMMY_WNDCLASS, "d3d10 get-offset window", - WS_POPUP, 0, 0, 2, 2, nullptr, nullptr, - GetModuleHandleA(nullptr), nullptr); + info.hwnd = CreateWindowExA(0, DUMMY_WNDCLASS, + "d3d10 get-offset window", WS_POPUP, 0, 0, + 2, 2, nullptr, nullptr, + GetModuleHandleA(nullptr), nullptr); if (!info.hwnd) { return false; } @@ -40,8 +45,8 @@ return false; } - create_factory = (create_fac_t)GetProcAddress(info.module, - "CreateDXGIFactory1"); + create_factory = + (create_fac_t)GetProcAddress(info.module, "CreateDXGIFactory1"); d3d10_module = LoadLibraryA("d3d10.dll"); if (!d3d10_module) { @@ -49,16 +54,15 @@ } create = (d3d10create_t)GetProcAddress(d3d10_module, - "D3D10CreateDeviceAndSwapChain"); + "D3D10CreateDeviceAndSwapChain"); if (!create) { return false; } - IID factory_iid = IsWindows8OrGreater() - ? dxgiFactory2 - : __uuidof(IDXGIFactory1); + IID factory_iid = IsWindows8OrGreater() ? dxgiFactory2 + : __uuidof(IDXGIFactory1); - hr = create_factory(&factory_iid, (void**)&factory); + hr = create_factory(&factory_iid, (void **)&factory); if (FAILED(hr)) { return false; } @@ -70,17 +74,17 @@ } DXGI_SWAP_CHAIN_DESC desc = {}; - desc.BufferCount = 2; - desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - desc.BufferDesc.Width = 2; - desc.BufferDesc.Height = 2; - desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - desc.OutputWindow = info.hwnd; - desc.SampleDesc.Count = 1; - desc.Windowed = true; + desc.BufferCount = 2; + desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + desc.BufferDesc.Width = 2; + desc.BufferDesc.Height = 2; + desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + desc.OutputWindow = info.hwnd; + desc.SampleDesc.Count = 1; + desc.Windowed = true; hr = create(adapter, D3D10_DRIVER_TYPE_HARDWARE, nullptr, 0, - D3D10_SDK_VERSION, &desc, &info.swap, &device); + D3D10_SDK_VERSION, &desc, &info.swap, &device); adapter->Release(); if (FAILED(hr)) { return false; @@ -100,17 +104,17 @@ void get_dxgi_offsets(struct dxgi_offsets *offsets) { - dxgi_info info = {}; - bool success = dxgi_init(info); - HRESULT hr; + dxgi_info info = {}; + bool success = dxgi_init(info); + HRESULT hr; if (success) { offsets->present = vtable_offset(info.module, info.swap, 8); - offsets->resize = vtable_offset(info.module, info.swap, 13); + offsets->resize = vtable_offset(info.module, info.swap, 13); IDXGISwapChain1 *swap1; hr = info.swap->QueryInterface(__uuidof(IDXGISwapChain1), - (void**)&swap1); + (void **)&swap1); if (SUCCEEDED(hr)) { offsets->present1 = vtable_offset(info.module, swap1, 22);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.c
Changed
@@ -9,10 +9,10 @@ struct d3d9_offsets d3d9 = {0}; struct dxgi_offsets dxgi = {0}; - WNDCLASSA wc = {0}; - wc.style = CS_OWNDC; - wc.hInstance = GetModuleHandleA(NULL); - wc.lpfnWndProc = (WNDPROC)DefWindowProcA; + WNDCLASSA wc = {0}; + wc.style = CS_OWNDC; + wc.hInstance = GetModuleHandleA(NULL); + wc.lpfnWndProc = (WNDPROC)DefWindowProcA; wc.lpszClassName = DUMMY_WNDCLASS; SetErrorMode(SEM_FAILCRITICALERRORS); @@ -27,17 +27,17 @@ get_dxgi_offsets(&dxgi); printf("[d3d8]\n"); - printf("present=0x%"PRIx32"\n", d3d8.present); + printf("present=0x%" PRIx32 "\n", d3d8.present); printf("[d3d9]\n"); - printf("present=0x%"PRIx32"\n", d3d9.present); - printf("present_ex=0x%"PRIx32"\n", d3d9.present_ex); - printf("present_swap=0x%"PRIx32"\n", d3d9.present_swap); - printf("d3d9_clsoff=0x%"PRIx32"\n", d3d9.d3d9_clsoff); - printf("is_d3d9ex_clsoff=0x%"PRIx32"\n", d3d9.is_d3d9ex_clsoff); + printf("present=0x%" PRIx32 "\n", d3d9.present); + printf("present_ex=0x%" PRIx32 "\n", d3d9.present_ex); + printf("present_swap=0x%" PRIx32 "\n", d3d9.present_swap); + printf("d3d9_clsoff=0x%" PRIx32 "\n", d3d9.d3d9_clsoff); + printf("is_d3d9ex_clsoff=0x%" PRIx32 "\n", d3d9.is_d3d9ex_clsoff); printf("[dxgi]\n"); - printf("present=0x%"PRIx32"\n", dxgi.present); - printf("present1=0x%"PRIx32"\n", dxgi.present1); - printf("resize=0x%"PRIx32"\n", dxgi.resize); + printf("present=0x%" PRIx32 "\n", dxgi.present); + printf("present1=0x%" PRIx32 "\n", dxgi.present1); + printf("resize=0x%" PRIx32 "\n", dxgi.resize); (void)argc; (void)argv;
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/get-graphics-offsets/get-graphics-offsets.h
Changed
@@ -15,9 +15,9 @@ #endif static inline uint32_t vtable_offset(HMODULE module, void *cls, - unsigned int offset) + unsigned int offset) { - uintptr_t *vtable = *(uintptr_t**)cls; + uintptr_t *vtable = *(uintptr_t **)cls; return (uint32_t)(vtable[offset] - (uintptr_t)module); }
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook-info.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook-info.h
Changed
@@ -8,22 +8,22 @@ #include "hook-helpers.h" #define EVENT_CAPTURE_RESTART L"CaptureHook_Restart" -#define EVENT_CAPTURE_STOP L"CaptureHook_Stop" +#define EVENT_CAPTURE_STOP L"CaptureHook_Stop" -#define EVENT_HOOK_READY L"CaptureHook_HookReady" -#define EVENT_HOOK_EXIT L"CaptureHook_Exit" +#define EVENT_HOOK_READY L"CaptureHook_HookReady" +#define EVENT_HOOK_EXIT L"CaptureHook_Exit" -#define EVENT_HOOK_INIT L"CaptureHook_Initialize" +#define EVENT_HOOK_INIT L"CaptureHook_Initialize" #define WINDOW_HOOK_KEEPALIVE L"CaptureHook_KeepAlive" -#define MUTEX_TEXTURE1 L"CaptureHook_TextureMutex1" -#define MUTEX_TEXTURE2 L"CaptureHook_TextureMutex2" +#define MUTEX_TEXTURE1 L"CaptureHook_TextureMutex1" +#define MUTEX_TEXTURE2 L"CaptureHook_TextureMutex2" -#define SHMEM_HOOK_INFO L"CaptureHook_HookInfo" -#define SHMEM_TEXTURE L"CaptureHook_Texture" +#define SHMEM_HOOK_INFO L"CaptureHook_HookInfo" +#define SHMEM_TEXTURE L"CaptureHook_Texture" -#define PIPE_NAME "CaptureHook_Pipe" +#define PIPE_NAME "CaptureHook_Pipe" #pragma pack(push, 8) @@ -69,7 +69,7 @@ enum capture_type { CAPTURE_TYPE_MEMORY, - CAPTURE_TYPE_TEXTURE + CAPTURE_TYPE_TEXTURE, }; struct graphics_offsets { @@ -81,26 +81,26 @@ struct hook_info { /* capture info */ - enum capture_type type; - uint32_t window; - uint32_t format; - uint32_t cx; - uint32_t cy; - uint32_t base_cx; - uint32_t base_cy; - uint32_t pitch; - uint32_t map_id; - uint32_t map_size; - bool flip; + enum capture_type type; + uint32_t window; + uint32_t format; + uint32_t cx; + uint32_t cy; + uint32_t base_cx; + uint32_t base_cy; + uint32_t pitch; + uint32_t map_id; + uint32_t map_size; + bool flip; /* additional options */ - uint64_t frame_interval; - bool use_scale; - bool force_shmem; - bool capture_overlay; + uint64_t frame_interval; + bool use_scale; + bool force_shmem; + bool capture_overlay; /* hook addresses */ - struct graphics_offsets offsets; + struct graphics_offsets offsets; }; #pragma pack(pop) @@ -112,6 +112,6 @@ wchar_t new_name[64]; _snwprintf(new_name, 64, L"%s%lu", SHMEM_HOOK_INFO, id); - return CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, - 0, sizeof(struct hook_info), new_name); + return CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, + sizeof(struct hook_info), new_name); }
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/d3d10-capture.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/d3d10-capture.cpp
Changed
@@ -6,49 +6,49 @@ #include "../funchook.h" struct d3d10_data { - ID3D10Device *device; /* do not release */ - uint32_t base_cx; - uint32_t base_cy; - uint32_t cx; - uint32_t cy; - DXGI_FORMAT format; - bool using_shtex; - bool using_scale; - bool multisampled; - - ID3D10Texture2D *scale_tex; - ID3D10ShaderResourceView *scale_resource; - - ID3D10VertexShader *vertex_shader; - ID3D10InputLayout *vertex_layout; - ID3D10PixelShader *pixel_shader; - - ID3D10SamplerState *sampler_state; - ID3D10BlendState *blend_state; - ID3D10DepthStencilState *zstencil_state; - ID3D10RasterizerState *raster_state; - - ID3D10Buffer *vertex_buffer; + ID3D10Device *device; /* do not release */ + uint32_t base_cx; + uint32_t base_cy; + uint32_t cx; + uint32_t cy; + DXGI_FORMAT format; + bool using_shtex; + bool using_scale; + bool multisampled; + + ID3D10Texture2D *scale_tex; + ID3D10ShaderResourceView *scale_resource; + + ID3D10VertexShader *vertex_shader; + ID3D10InputLayout *vertex_layout; + ID3D10PixelShader *pixel_shader; + + ID3D10SamplerState *sampler_state; + ID3D10BlendState *blend_state; + ID3D10DepthStencilState *zstencil_state; + ID3D10RasterizerState *raster_state; + + ID3D10Buffer *vertex_buffer; union { /* shared texture */ struct { - struct shtex_data *shtex_info; - ID3D10Texture2D *texture; + struct shtex_data *shtex_info; + ID3D10Texture2D *texture; ID3D10RenderTargetView *render_target; - HANDLE handle; + HANDLE handle; }; /* shared memory */ struct { - struct shmem_data *shmem_info; - ID3D10Texture2D *copy_surfaces[NUM_BUFFERS]; - ID3D10Texture2D *textures[NUM_BUFFERS]; + struct shmem_data *shmem_info; + ID3D10Texture2D *copy_surfaces[NUM_BUFFERS]; + ID3D10Texture2D *textures[NUM_BUFFERS]; ID3D10RenderTargetView *render_targets[NUM_BUFFERS]; - bool texture_ready[NUM_BUFFERS]; - bool texture_mapped[NUM_BUFFERS]; - uint32_t pitch; - int cur_tex; - int copy_wait; + bool texture_ready[NUM_BUFFERS]; + bool texture_mapped[NUM_BUFFERS]; + uint32_t pitch; + int cur_tex; + int copy_wait; }; }; }; @@ -108,31 +108,30 @@ { HRESULT hr; - D3D10_TEXTURE2D_DESC desc = {}; - desc.Width = data.cx; - desc.Height = data.cy; - desc.Format = data.format; - desc.MipLevels = 1; - desc.ArraySize = 1; - desc.SampleDesc.Count = 1; - desc.Usage = D3D10_USAGE_STAGING; - desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ; + D3D10_TEXTURE2D_DESC desc = {}; + desc.Width = data.cx; + desc.Height = data.cy; + desc.Format = data.format; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.SampleDesc.Count = 1; + desc.Usage = D3D10_USAGE_STAGING; + desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ; hr = data.device->CreateTexture2D(&desc, nullptr, tex); if (FAILED(hr)) { hlog_hr("create_d3d10_stage_surface: failed to create texture", - hr); + hr); return false; } return true; } -static bool create_d3d10_tex(uint32_t cx, uint32_t cy, - ID3D10Texture2D **tex, - ID3D10ShaderResourceView **resource, - ID3D10RenderTargetView **render_target, - HANDLE *handle) +static bool create_d3d10_tex(uint32_t cx, uint32_t cy, ID3D10Texture2D **tex, + ID3D10ShaderResourceView **resource, + ID3D10RenderTargetView **render_target, + HANDLE *handle) { UINT flags = 0; UINT misc_flags = 0; @@ -145,16 +144,16 @@ if (!!handle) misc_flags |= D3D10_RESOURCE_MISC_SHARED; - D3D10_TEXTURE2D_DESC desc = {}; - desc.Width = cx; - desc.Height = cy; - desc.MipLevels = 1; - desc.ArraySize = 1; - desc.Format = data.format; - desc.BindFlags = flags; - desc.SampleDesc.Count = 1; - desc.Usage = D3D10_USAGE_DEFAULT; - desc.MiscFlags = misc_flags; + D3D10_TEXTURE2D_DESC desc = {}; + desc.Width = cx; + desc.Height = cy; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.Format = data.format; + desc.BindFlags = flags; + desc.SampleDesc.Count = 1; + desc.Usage = D3D10_USAGE_DEFAULT; + desc.MiscFlags = misc_flags; hr = data.device->CreateTexture2D(&desc, nullptr, tex); if (FAILED(hr)) { @@ -169,20 +168,22 @@ res_desc.Texture2D.MipLevels = 1; hr = data.device->CreateShaderResourceView(*tex, &res_desc, - resource); + resource); if (FAILED(hr)) { hlog_hr("create_d3d10_tex: failed to create resource " - "view", hr); + "view", + hr); return false; } } if (!!render_target) { hr = data.device->CreateRenderTargetView(*tex, nullptr, - render_target); + render_target); if (FAILED(hr)) { hlog_hr("create_d3d10_tex: failed to create render " - "target view", hr); + "target view", + hr); return false; } } @@ -190,10 +191,11 @@ if (!!handle) { IDXGIResource *dxgi_res; hr = (*tex)->QueryInterface(__uuidof(IDXGIResource), - (void**)&dxgi_res); + (void **)&dxgi_res); if (FAILED(hr)) { hlog_hr("create_d3d10_tex: failed to query " - "IDXGIResource interface from texture", hr); + "IDXGIResource interface from texture", + hr); return false; } @@ -201,7 +203,7 @@ dxgi_res->Release(); if (FAILED(hr)) { hlog_hr("create_d3d10_tex: failed to get shared handle", - hr); + hr); return false; } } @@ -246,10 +248,10 @@ vs_data = get_d3d1x_vertex_shader(&size); hr = data.device->CreateVertexShader(vs_data, size, - &data.vertex_shader); + &data.vertex_shader); if (FAILED(hr)) { hlog_hr("d3d10_init_vertex_shader: failed to create shader", - hr); + hr); return false; } @@ -270,10 +272,10 @@ desc[1].InstanceDataStepRate = 0; hr = data.device->CreateInputLayout(desc, 2, vs_data, size, - &data.vertex_layout); + &data.vertex_layout); if (FAILED(hr)) { hlog_hr("d3d10_init_vertex_shader: failed to create layout", - hr); + hr); return false; } @@ -301,16 +303,17 @@ { HRESULT hr; - D3D10_SAMPLER_DESC desc = {}; - desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR; - desc.AddressU = D3D10_TEXTURE_ADDRESS_CLAMP; - desc.AddressV = D3D10_TEXTURE_ADDRESS_CLAMP; - desc.AddressW = D3D10_TEXTURE_ADDRESS_CLAMP; + D3D10_SAMPLER_DESC desc = {}; + desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR; + desc.AddressU = D3D10_TEXTURE_ADDRESS_CLAMP; + desc.AddressV = D3D10_TEXTURE_ADDRESS_CLAMP; + desc.AddressW = D3D10_TEXTURE_ADDRESS_CLAMP; hr = data.device->CreateSamplerState(&desc, &data.sampler_state); if (FAILED(hr)) { hlog_hr("d3d10_init_sampler_state: failed to create sampler " - "state", hr); + "state", + hr); return false; } @@ -328,7 +331,7 @@ hr = data.device->CreateBlendState(&desc, &data.blend_state); if (FAILED(hr)) { hlog_hr("d3d10_init_blend_state: failed to create blend state", - hr); + hr); return false; } @@ -343,7 +346,8 @@ hr = data.device->CreateDepthStencilState(&desc, &data.zstencil_state); if (FAILED(hr)) { hlog_hr("d3d10_init_zstencil_state: failed to create " - "zstencil state", hr); + "zstencil state", + hr); return false; } @@ -361,7 +365,8 @@ hr = data.device->CreateRasterizerState(&desc, &data.raster_state); if (FAILED(hr)) { hlog_hr("d3d10_init_raster_state: failed to create raster " - "state", hr); + "state", + hr); return false; } @@ -374,26 +379,26 @@ { HRESULT hr; const vertex verts[NUM_VERTS] = { - {{-1.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 0.0f}}, + {{-1.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 0.0f}}, {{-1.0f, -1.0f, 0.0f, 1.0f}, {0.0f, 1.0f}}, - {{ 1.0f, 1.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, - {{ 1.0f, -1.0f, 0.0f, 1.0f}, {1.0f, 1.0f}} - }; + {{1.0f, 1.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, + {{1.0f, -1.0f, 0.0f, 1.0f}, {1.0f, 1.0f}}}; D3D10_BUFFER_DESC desc; - desc.ByteWidth = sizeof(vertex) * NUM_VERTS; - desc.Usage = D3D10_USAGE_DEFAULT; - desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; - desc.CPUAccessFlags = 0; - desc.MiscFlags = 0; + desc.ByteWidth = sizeof(vertex) * NUM_VERTS; + desc.Usage = D3D10_USAGE_DEFAULT; + desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + desc.CPUAccessFlags = 0; + desc.MiscFlags = 0; - D3D10_SUBRESOURCE_DATA srd = {}; - srd.pSysMem = (const void*)verts; + D3D10_SUBRESOURCE_DATA srd = {}; + srd.pSysMem = (const void *)verts; hr = data.device->CreateBuffer(&desc, &srd, &data.vertex_buffer); if (FAILED(hr)) { hlog_hr("d3d10_init_vertex_buffer: failed to create vertex " - "buffer", hr); + "buffer", + hr); return false; } @@ -404,9 +409,8 @@ { bool success; - success = create_d3d10_tex(data.base_cx, data.base_cy, - &data.scale_tex, &data.scale_resource, nullptr, - nullptr); + success = create_d3d10_tex(data.base_cx, data.base_cy, &data.scale_tex, + &data.scale_resource, nullptr, nullptr); if (!success) { hlog("d3d10_init_scaling: failed to create scale texture"); return false; @@ -454,7 +458,8 @@ hr = data.copy_surfaces[idx]->Map(0, D3D10_MAP_READ, 0, &map); if (FAILED(hr)) { hlog_hr("d3d10_shmem_init_buffers: failed to get " - "pitch", hr); + "pitch", + hr); return false; } @@ -463,7 +468,7 @@ } success = create_d3d10_tex(data.cx, data.cy, &data.textures[idx], - nullptr, &data.render_targets[idx], nullptr); + nullptr, &data.render_targets[idx], nullptr); if (!success) { hlog("d3d10_shmem_init_buffers: failed to create texture"); return false; @@ -481,9 +486,9 @@ return false; } } - if (!capture_init_shmem(&data.shmem_info, window, - data.base_cx, data.base_cy, data.cx, data.cy, - data.pitch, data.format, false)) { + if (!capture_init_shmem(&data.shmem_info, window, data.base_cx, + data.base_cy, data.cx, data.cy, data.pitch, + data.format, false)) { return false; } @@ -499,7 +504,7 @@ data.using_shtex = true; success = create_d3d10_tex(data.cx, data.cy, &data.texture, &resource, - &data.render_target, &data.handle); + &data.render_target, &data.handle); if (resource) resource->Release(); @@ -507,9 +512,9 @@ hlog("d3d10_shtex_init: failed to create texture"); return false; } - if (!capture_init_shtex(&data.shtex_info, window, - data.base_cx, data.base_cy, data.cx, data.cy, - data.format, false, (uintptr_t)data.handle)) { + if (!capture_init_shtex(&data.shtex_info, window, data.base_cx, + data.base_cy, data.cx, data.cy, data.format, + false, (uintptr_t)data.handle)) { return false; } @@ -525,7 +530,7 @@ data.using_scale = global_hook_info->use_scale; - hr = swap->GetDevice(__uuidof(ID3D10Device), (void**)&data.device); + hr = swap->GetDevice(__uuidof(ID3D10Device), (void **)&data.device); if (FAILED(hr)) { hlog_hr("d3d10_init: failed to get device from swap", hr); return; @@ -553,32 +558,32 @@ d3d10_free(); } -#define MAX_RENDER_TARGETS D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT -#define MAX_SO_TARGETS 4 +#define MAX_RENDER_TARGETS D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT +#define MAX_SO_TARGETS 4 struct d3d10_state { - ID3D10GeometryShader *geom_shader; - ID3D10InputLayout *vertex_layout; - D3D10_PRIMITIVE_TOPOLOGY topology; - ID3D10Buffer *vertex_buffer; - UINT vb_stride; - UINT vb_offset; - ID3D10BlendState *blend_state; - float blend_factor[4]; - UINT sample_mask; - ID3D10DepthStencilState *zstencil_state; - UINT zstencil_ref; - ID3D10RenderTargetView *render_targets[MAX_RENDER_TARGETS]; - ID3D10DepthStencilView *zstencil_view; - ID3D10SamplerState *sampler_state; - ID3D10PixelShader *pixel_shader; - ID3D10ShaderResourceView *resource; - ID3D10RasterizerState *raster_state; - UINT num_viewports; - D3D10_VIEWPORT *viewports; - ID3D10Buffer *stream_output_targets[MAX_SO_TARGETS]; - UINT so_offsets[MAX_SO_TARGETS]; - ID3D10VertexShader *vertex_shader; + ID3D10GeometryShader *geom_shader; + ID3D10InputLayout *vertex_layout; + D3D10_PRIMITIVE_TOPOLOGY topology; + ID3D10Buffer *vertex_buffer; + UINT vb_stride; + UINT vb_offset; + ID3D10BlendState *blend_state; + float blend_factor[4]; + UINT sample_mask; + ID3D10DepthStencilState *zstencil_state; + UINT zstencil_ref; + ID3D10RenderTargetView *render_targets[MAX_RENDER_TARGETS]; + ID3D10DepthStencilView *zstencil_view; + ID3D10SamplerState *sampler_state; + ID3D10PixelShader *pixel_shader; + ID3D10ShaderResourceView *resource; + ID3D10RasterizerState *raster_state; + UINT num_viewports; + D3D10_VIEWPORT *viewports; + ID3D10Buffer *stream_output_targets[MAX_SO_TARGETS]; + UINT so_offsets[MAX_SO_TARGETS]; + ID3D10VertexShader *vertex_shader; }; static inline void d3d10_save_state(struct d3d10_state *state) @@ -587,32 +592,34 @@ data.device->IAGetInputLayout(&state->vertex_layout); data.device->IAGetPrimitiveTopology(&state->topology); data.device->IAGetVertexBuffers(0, 1, &state->vertex_buffer, - &state->vb_stride, &state->vb_offset); + &state->vb_stride, &state->vb_offset); data.device->OMGetBlendState(&state->blend_state, state->blend_factor, - &state->sample_mask); + &state->sample_mask); data.device->OMGetDepthStencilState(&state->zstencil_state, - &state->zstencil_ref); + &state->zstencil_ref); data.device->OMGetRenderTargets(MAX_RENDER_TARGETS, - state->render_targets, &state->zstencil_view); + state->render_targets, + &state->zstencil_view); data.device->PSGetSamplers(0, 1, &state->sampler_state); data.device->PSGetShader(&state->pixel_shader); data.device->PSGetShaderResources(0, 1, &state->resource); data.device->RSGetState(&state->raster_state); data.device->RSGetViewports(&state->num_viewports, nullptr); if (state->num_viewports) { - state->viewports = (D3D10_VIEWPORT*)malloc( - sizeof(D3D10_VIEWPORT) * state->num_viewports); + state->viewports = (D3D10_VIEWPORT *)malloc( + sizeof(D3D10_VIEWPORT) * state->num_viewports); data.device->RSGetViewports(&state->num_viewports, - state->viewports); + state->viewports); } data.device->SOGetTargets(MAX_SO_TARGETS, state->stream_output_targets, - state->so_offsets); + state->so_offsets); data.device->VSGetShader(&state->vertex_shader); } static inline void safe_release(IUnknown *p) { - if (p) p->Release(); + if (p) + p->Release(); } static inline void d3d10_restore_state(struct d3d10_state *state) @@ -621,20 +628,21 @@ data.device->IASetInputLayout(state->vertex_layout); data.device->IASetPrimitiveTopology(state->topology); data.device->IASetVertexBuffers(0, 1, &state->vertex_buffer, - &state->vb_stride, &state->vb_offset); + &state->vb_stride, &state->vb_offset); data.device->OMSetBlendState(state->blend_state, state->blend_factor, - state->sample_mask); + state->sample_mask); data.device->OMSetDepthStencilState(state->zstencil_state, - state->zstencil_ref); + state->zstencil_ref); data.device->OMSetRenderTargets(MAX_RENDER_TARGETS, - state->render_targets, state->zstencil_view); + state->render_targets, + state->zstencil_view); data.device->PSSetSamplers(0, 1, &state->sampler_state); data.device->PSSetShader(state->pixel_shader); data.device->PSSetShaderResources(0, 1, &state->resource); data.device->RSSetState(state->raster_state); data.device->RSSetViewports(state->num_viewports, state->viewports); data.device->SOSetTargets(MAX_SO_TARGETS, state->stream_output_targets, - state->so_offsets); + state->so_offsets); data.device->VSSetShader(state->vertex_shader); safe_release(state->geom_shader); safe_release(state->vertex_layout); @@ -656,7 +664,7 @@ } static inline void d3d10_setup_pipeline(ID3D10RenderTargetView *target, - ID3D10ShaderResourceView *resource) + ID3D10ShaderResourceView *resource) { D3D10_VIEWPORT viewport = {0}; const float factor[4] = {1.0f, 1.0f, 1.0f, 1.0f}; @@ -671,9 +679,9 @@ data.device->GSSetShader(nullptr); data.device->IASetInputLayout(data.vertex_layout); data.device->IASetPrimitiveTopology( - D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); data.device->IASetVertexBuffers(0, 1, &data.vertex_buffer, &stride, - &zero); + &zero); data.device->OMSetBlendState(data.blend_state, factor, 0xFFFFFFFF); data.device->OMSetDepthStencilState(data.zstencil_state, 0); data.device->OMSetRenderTargets(1, &target, nullptr); @@ -682,12 +690,12 @@ data.device->PSSetShaderResources(0, 1, &resource); data.device->RSSetState(data.raster_state); data.device->RSSetViewports(1, &viewport); - data.device->SOSetTargets(1, (ID3D10Buffer**)&emptyptr, &zero); + data.device->SOSetTargets(1, (ID3D10Buffer **)&emptyptr, &zero); data.device->VSSetShader(data.vertex_shader); } static inline void d3d10_scale_texture(ID3D10RenderTargetView *target, - ID3D10ShaderResourceView *resource) + ID3D10ShaderResourceView *resource) { struct d3d10_state old_state = {}; @@ -725,8 +733,8 @@ if (data.texture_ready[i]) { data.texture_ready[i] = false; - hr = data.copy_surfaces[i]->Map(0, D3D10_MAP_READ, - 0, &map); + hr = data.copy_surfaces[i]->Map(0, D3D10_MAP_READ, 0, + &map); if (SUCCEEDED(hr)) { data.texture_mapped[i] = true; shmem_copy_data(i, map.pData); @@ -742,12 +750,12 @@ d3d10_shmem_queue_copy(); - next_tex = (data.cur_tex == NUM_BUFFERS - 1) ? 0 : data.cur_tex + 1; + next_tex = (data.cur_tex == NUM_BUFFERS - 1) ? 0 : data.cur_tex + 1; if (data.using_scale) { d3d10_copy_texture(data.scale_tex, backbuffer); d3d10_scale_texture(data.render_targets[data.cur_tex], - data.scale_resource); + data.scale_resource); } else { d3d10_copy_texture(data.textures[data.cur_tex], backbuffer); } @@ -773,8 +781,8 @@ void d3d10_capture(void *swap_ptr, void *backbuffer_ptr, bool) { - IDXGIResource *dxgi_backbuffer = (IDXGIResource*)backbuffer_ptr; - IDXGISwapChain *swap = (IDXGISwapChain*)swap_ptr; + IDXGIResource *dxgi_backbuffer = (IDXGIResource *)backbuffer_ptr; + IDXGISwapChain *swap = (IDXGISwapChain *)swap_ptr; HRESULT hr; if (capture_should_stop()) { @@ -787,10 +795,11 @@ ID3D10Resource *backbuffer; hr = dxgi_backbuffer->QueryInterface(__uuidof(ID3D10Resource), - (void**)&backbuffer); + (void **)&backbuffer); if (FAILED(hr)) { hlog_hr("d3d10_shtex_capture: failed to get " - "backbuffer", hr); + "backbuffer", + hr); return; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/d3d11-capture.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/d3d11-capture.cpp
Changed
@@ -6,50 +6,50 @@ #include "../funchook.h" struct d3d11_data { - ID3D11Device *device; /* do not release */ - ID3D11DeviceContext *context; /* do not release */ - uint32_t base_cx; - uint32_t base_cy; - uint32_t cx; - uint32_t cy; - DXGI_FORMAT format; - bool using_shtex; - bool using_scale; - bool multisampled; - - ID3D11Texture2D *scale_tex; - ID3D11ShaderResourceView *scale_resource; - - ID3D11VertexShader *vertex_shader; - ID3D11InputLayout *vertex_layout; - ID3D11PixelShader *pixel_shader; - - ID3D11SamplerState *sampler_state; - ID3D11BlendState *blend_state; - ID3D11DepthStencilState *zstencil_state; - ID3D11RasterizerState *raster_state; - - ID3D11Buffer *vertex_buffer; + ID3D11Device *device; /* do not release */ + ID3D11DeviceContext *context; /* do not release */ + uint32_t base_cx; + uint32_t base_cy; + uint32_t cx; + uint32_t cy; + DXGI_FORMAT format; + bool using_shtex; + bool using_scale; + bool multisampled; + + ID3D11Texture2D *scale_tex; + ID3D11ShaderResourceView *scale_resource; + + ID3D11VertexShader *vertex_shader; + ID3D11InputLayout *vertex_layout; + ID3D11PixelShader *pixel_shader; + + ID3D11SamplerState *sampler_state; + ID3D11BlendState *blend_state; + ID3D11DepthStencilState *zstencil_state; + ID3D11RasterizerState *raster_state; + + ID3D11Buffer *vertex_buffer; union { /* shared texture */ struct { - struct shtex_data *shtex_info; - ID3D11Texture2D *texture; + struct shtex_data *shtex_info; + ID3D11Texture2D *texture; ID3D11RenderTargetView *render_target; - HANDLE handle; + HANDLE handle; }; /* shared memory */ struct { - ID3D11Texture2D *copy_surfaces[NUM_BUFFERS]; - ID3D11Texture2D *textures[NUM_BUFFERS]; + ID3D11Texture2D *copy_surfaces[NUM_BUFFERS]; + ID3D11Texture2D *textures[NUM_BUFFERS]; ID3D11RenderTargetView *render_targets[NUM_BUFFERS]; - bool texture_ready[NUM_BUFFERS]; - bool texture_mapped[NUM_BUFFERS]; - uint32_t pitch; - struct shmem_data *shmem_info; - int cur_tex; - int copy_wait; + bool texture_ready[NUM_BUFFERS]; + bool texture_mapped[NUM_BUFFERS]; + uint32_t pitch; + struct shmem_data *shmem_info; + int cur_tex; + int copy_wait; }; }; }; @@ -91,8 +91,7 @@ if (data.copy_surfaces[i]) { if (data.texture_mapped[i]) data.context->Unmap( - data.copy_surfaces[i], - 0); + data.copy_surfaces[i], 0); data.copy_surfaces[i]->Release(); } if (data.textures[i]) @@ -111,31 +110,30 @@ { HRESULT hr; - D3D11_TEXTURE2D_DESC desc = {}; - desc.Width = data.cx; - desc.Height = data.cy; - desc.Format = data.format; - desc.MipLevels = 1; - desc.ArraySize = 1; - desc.SampleDesc.Count = 1; - desc.Usage = D3D11_USAGE_STAGING; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; + D3D11_TEXTURE2D_DESC desc = {}; + desc.Width = data.cx; + desc.Height = data.cy; + desc.Format = data.format; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.SampleDesc.Count = 1; + desc.Usage = D3D11_USAGE_STAGING; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; hr = data.device->CreateTexture2D(&desc, nullptr, tex); if (FAILED(hr)) { hlog_hr("create_d3d11_stage_surface: failed to create texture", - hr); + hr); return false; } return true; } -static bool create_d3d11_tex(uint32_t cx, uint32_t cy, - ID3D11Texture2D **tex, - ID3D11ShaderResourceView **resource, - ID3D11RenderTargetView **render_target, - HANDLE *handle) +static bool create_d3d11_tex(uint32_t cx, uint32_t cy, ID3D11Texture2D **tex, + ID3D11ShaderResourceView **resource, + ID3D11RenderTargetView **render_target, + HANDLE *handle) { UINT flags = 0; UINT misc_flags = 0; @@ -148,16 +146,16 @@ if (!!handle) misc_flags |= D3D11_RESOURCE_MISC_SHARED; - D3D11_TEXTURE2D_DESC desc = {}; - desc.Width = cx; - desc.Height = cy; - desc.MipLevels = 1; - desc.ArraySize = 1; - desc.Format = data.format; - desc.BindFlags = flags; - desc.SampleDesc.Count = 1; - desc.Usage = D3D11_USAGE_DEFAULT; - desc.MiscFlags = misc_flags; + D3D11_TEXTURE2D_DESC desc = {}; + desc.Width = cx; + desc.Height = cy; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.Format = data.format; + desc.BindFlags = flags; + desc.SampleDesc.Count = 1; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.MiscFlags = misc_flags; hr = data.device->CreateTexture2D(&desc, nullptr, tex); if (FAILED(hr)) { @@ -172,20 +170,22 @@ res_desc.Texture2D.MipLevels = 1; hr = data.device->CreateShaderResourceView(*tex, &res_desc, - resource); + resource); if (FAILED(hr)) { hlog_hr("create_d3d11_tex: failed to create resource " - "view", hr); + "view", + hr); return false; } } if (!!render_target) { hr = data.device->CreateRenderTargetView(*tex, nullptr, - render_target); + render_target); if (FAILED(hr)) { hlog_hr("create_d3d11_tex: failed to create render " - "target view", hr); + "target view", + hr); return false; } } @@ -193,10 +193,11 @@ if (!!handle) { IDXGIResource *dxgi_res; hr = (*tex)->QueryInterface(__uuidof(IDXGIResource), - (void**)&dxgi_res); + (void **)&dxgi_res); if (FAILED(hr)) { hlog_hr("create_d3d11_tex: failed to query " - "IDXGIResource interface from texture", hr); + "IDXGIResource interface from texture", + hr); return false; } @@ -204,7 +205,7 @@ dxgi_res->Release(); if (FAILED(hr)) { hlog_hr("create_d3d11_tex: failed to get shared handle", - hr); + hr); return false; } } @@ -249,10 +250,10 @@ vs_data = get_d3d1x_vertex_shader(&size); hr = data.device->CreateVertexShader(vs_data, size, nullptr, - &data.vertex_shader); + &data.vertex_shader); if (FAILED(hr)) { hlog_hr("d3d11_init_vertex_shader: failed to create shader", - hr); + hr); return false; } @@ -273,10 +274,10 @@ desc[1].InstanceDataStepRate = 0; hr = data.device->CreateInputLayout(desc, 2, vs_data, size, - &data.vertex_layout); + &data.vertex_layout); if (FAILED(hr)) { hlog_hr("d3d11_init_vertex_shader: failed to create layout", - hr); + hr); return false; } @@ -292,7 +293,7 @@ ps_data = get_d3d1x_pixel_shader(&size); hr = data.device->CreatePixelShader(ps_data, size, nullptr, - &data.pixel_shader); + &data.pixel_shader); if (FAILED(hr)) { hlog_hr("d3d11_init_pixel_shader: failed to create shader", hr); return false; @@ -305,16 +306,17 @@ { HRESULT hr; - D3D11_SAMPLER_DESC desc = {}; - desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; - desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; - desc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; - desc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; + D3D11_SAMPLER_DESC desc = {}; + desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; + desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; + desc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; + desc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; hr = data.device->CreateSamplerState(&desc, &data.sampler_state); if (FAILED(hr)) { hlog_hr("d3d11_init_sampler_state: failed to create sampler " - "state", hr); + "state", + hr); return false; } @@ -333,7 +335,7 @@ hr = data.device->CreateBlendState(&desc, &data.blend_state); if (FAILED(hr)) { hlog_hr("d3d11_init_blend_state: failed to create blend state", - hr); + hr); return false; } @@ -348,7 +350,8 @@ hr = data.device->CreateDepthStencilState(&desc, &data.zstencil_state); if (FAILED(hr)) { hlog_hr("d3d11_init_zstencil_state: failed to create " - "zstencil state", hr); + "zstencil state", + hr); return false; } @@ -366,7 +369,8 @@ hr = data.device->CreateRasterizerState(&desc, &data.raster_state); if (FAILED(hr)) { hlog_hr("d3d11_init_raster_state: failed to create raster " - "state", hr); + "state", + hr); return false; } @@ -379,26 +383,26 @@ { HRESULT hr; const vertex verts[NUM_VERTS] = { - {{-1.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 0.0f}}, + {{-1.0f, 1.0f, 0.0f, 1.0f}, {0.0f, 0.0f}}, {{-1.0f, -1.0f, 0.0f, 1.0f}, {0.0f, 1.0f}}, - {{ 1.0f, 1.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, - {{ 1.0f, -1.0f, 0.0f, 1.0f}, {1.0f, 1.0f}} - }; + {{1.0f, 1.0f, 0.0f, 1.0f}, {1.0f, 0.0f}}, + {{1.0f, -1.0f, 0.0f, 1.0f}, {1.0f, 1.0f}}}; D3D11_BUFFER_DESC desc; - desc.ByteWidth = sizeof(vertex) * NUM_VERTS; - desc.Usage = D3D11_USAGE_DEFAULT; - desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - desc.CPUAccessFlags = 0; - desc.MiscFlags = 0; + desc.ByteWidth = sizeof(vertex) * NUM_VERTS; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + desc.CPUAccessFlags = 0; + desc.MiscFlags = 0; - D3D11_SUBRESOURCE_DATA srd = {}; - srd.pSysMem = (const void*)verts; + D3D11_SUBRESOURCE_DATA srd = {}; + srd.pSysMem = (const void *)verts; hr = data.device->CreateBuffer(&desc, &srd, &data.vertex_buffer); if (FAILED(hr)) { hlog_hr("d3d11_init_vertex_buffer: failed to create vertex " - "buffer", hr); + "buffer", + hr); return false; } @@ -409,9 +413,8 @@ { bool success; - success = create_d3d11_tex(data.base_cx, data.base_cy, - &data.scale_tex, &data.scale_resource, nullptr, - nullptr); + success = create_d3d11_tex(data.base_cx, data.base_cy, &data.scale_tex, + &data.scale_resource, nullptr, nullptr); if (!success) { hlog("d3d11_init_scaling: failed to create scale texture"); return false; @@ -457,10 +460,11 @@ HRESULT hr; hr = data.context->Map(data.copy_surfaces[idx], 0, - D3D11_MAP_READ, 0, &map); + D3D11_MAP_READ, 0, &map); if (FAILED(hr)) { hlog_hr("d3d11_shmem_init_buffers: failed to get " - "pitch", hr); + "pitch", + hr); return false; } @@ -469,7 +473,7 @@ } success = create_d3d11_tex(data.cx, data.cy, &data.textures[idx], - nullptr, &data.render_targets[idx], nullptr); + nullptr, &data.render_targets[idx], nullptr); if (!success) { hlog("d3d11_shmem_init_buffers: failed to create texture"); return false; @@ -487,9 +491,9 @@ return false; } } - if (!capture_init_shmem(&data.shmem_info, window, - data.base_cx, data.base_cy, data.cx, data.cy, - data.pitch, data.format, false)) { + if (!capture_init_shmem(&data.shmem_info, window, data.base_cx, + data.base_cy, data.cx, data.cy, data.pitch, + data.format, false)) { return false; } @@ -505,7 +509,7 @@ data.using_shtex = true; success = create_d3d11_tex(data.cx, data.cy, &data.texture, &resource, - &data.render_target, &data.handle); + &data.render_target, &data.handle); if (resource) resource->Release(); @@ -513,9 +517,9 @@ hlog("d3d11_shtex_init: failed to create texture"); return false; } - if (!capture_init_shtex(&data.shtex_info, window, - data.base_cx, data.base_cy, data.cx, data.cy, - data.format, false, (uintptr_t)data.handle)) { + if (!capture_init_shtex(&data.shtex_info, window, data.base_cx, + data.base_cy, data.cx, data.cy, data.format, + false, (uintptr_t)data.handle)) { return false; } @@ -531,7 +535,7 @@ data.using_scale = global_hook_info->use_scale; - hr = swap->GetDevice(__uuidof(ID3D11Device), (void**)&data.device); + hr = swap->GetDevice(__uuidof(ID3D11Device), (void **)&data.device); if (FAILED(hr)) { hlog_hr("d3d11_init: failed to get device from swap", hr); return; @@ -561,38 +565,38 @@ d3d11_free(); } -#define MAX_RENDER_TARGETS D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT -#define MAX_SO_TARGETS 4 -#define MAX_CLASS_INSTS 256 +#define MAX_RENDER_TARGETS D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT +#define MAX_SO_TARGETS 4 +#define MAX_CLASS_INSTS 256 struct d3d11_state { - ID3D11GeometryShader *geom_shader; - ID3D11InputLayout *vertex_layout; - D3D11_PRIMITIVE_TOPOLOGY topology; - ID3D11Buffer *vertex_buffer; - UINT vb_stride; - UINT vb_offset; - ID3D11BlendState *blend_state; - float blend_factor[4]; - UINT sample_mask; - ID3D11DepthStencilState *zstencil_state; - UINT zstencil_ref; - ID3D11RenderTargetView *render_targets[MAX_RENDER_TARGETS]; - ID3D11DepthStencilView *zstencil_view; - ID3D11SamplerState *sampler_state; - ID3D11PixelShader *pixel_shader; - ID3D11ShaderResourceView *resource; - ID3D11RasterizerState *raster_state; - UINT num_viewports; - D3D11_VIEWPORT *viewports; - ID3D11Buffer *stream_output_targets[MAX_SO_TARGETS]; - ID3D11VertexShader *vertex_shader; - ID3D11ClassInstance *gs_class_instances[MAX_CLASS_INSTS]; - ID3D11ClassInstance *ps_class_instances[MAX_CLASS_INSTS]; - ID3D11ClassInstance *vs_class_instances[MAX_CLASS_INSTS]; - UINT gs_class_inst_count; - UINT ps_class_inst_count; - UINT vs_class_inst_count; + ID3D11GeometryShader *geom_shader; + ID3D11InputLayout *vertex_layout; + D3D11_PRIMITIVE_TOPOLOGY topology; + ID3D11Buffer *vertex_buffer; + UINT vb_stride; + UINT vb_offset; + ID3D11BlendState *blend_state; + float blend_factor[4]; + UINT sample_mask; + ID3D11DepthStencilState *zstencil_state; + UINT zstencil_ref; + ID3D11RenderTargetView *render_targets[MAX_RENDER_TARGETS]; + ID3D11DepthStencilView *zstencil_view; + ID3D11SamplerState *sampler_state; + ID3D11PixelShader *pixel_shader; + ID3D11ShaderResourceView *resource; + ID3D11RasterizerState *raster_state; + UINT num_viewports; + D3D11_VIEWPORT *viewports; + ID3D11Buffer *stream_output_targets[MAX_SO_TARGETS]; + ID3D11VertexShader *vertex_shader; + ID3D11ClassInstance *gs_class_instances[MAX_CLASS_INSTS]; + ID3D11ClassInstance *ps_class_instances[MAX_CLASS_INSTS]; + ID3D11ClassInstance *vs_class_instances[MAX_CLASS_INSTS]; + UINT gs_class_inst_count; + UINT ps_class_inst_count; + UINT vs_class_inst_count; }; static inline void d3d11_save_state(struct d3d11_state *state) @@ -602,76 +606,77 @@ state->vs_class_inst_count = MAX_CLASS_INSTS; data.context->GSGetShader(&state->geom_shader, - state->gs_class_instances, - &state->gs_class_inst_count); + state->gs_class_instances, + &state->gs_class_inst_count); data.context->IAGetInputLayout(&state->vertex_layout); data.context->IAGetPrimitiveTopology(&state->topology); data.context->IAGetVertexBuffers(0, 1, &state->vertex_buffer, - &state->vb_stride, &state->vb_offset); + &state->vb_stride, &state->vb_offset); data.context->OMGetBlendState(&state->blend_state, state->blend_factor, - &state->sample_mask); + &state->sample_mask); data.context->OMGetDepthStencilState(&state->zstencil_state, - &state->zstencil_ref); + &state->zstencil_ref); data.context->OMGetRenderTargets(MAX_RENDER_TARGETS, - state->render_targets, &state->zstencil_view); + state->render_targets, + &state->zstencil_view); data.context->PSGetSamplers(0, 1, &state->sampler_state); data.context->PSGetShader(&state->pixel_shader, - state->ps_class_instances, - &state->ps_class_inst_count); + state->ps_class_instances, + &state->ps_class_inst_count); data.context->PSGetShaderResources(0, 1, &state->resource); data.context->RSGetState(&state->raster_state); data.context->RSGetViewports(&state->num_viewports, nullptr); if (state->num_viewports) { - state->viewports = (D3D11_VIEWPORT*)malloc( - sizeof(D3D11_VIEWPORT) * state->num_viewports); + state->viewports = (D3D11_VIEWPORT *)malloc( + sizeof(D3D11_VIEWPORT) * state->num_viewports); data.context->RSGetViewports(&state->num_viewports, - state->viewports); + state->viewports); } data.context->SOGetTargets(MAX_SO_TARGETS, - state->stream_output_targets); + state->stream_output_targets); data.context->VSGetShader(&state->vertex_shader, - state->vs_class_instances, - &state->vs_class_inst_count); + state->vs_class_instances, + &state->vs_class_inst_count); } static inline void safe_release(IUnknown *p) { - if (p) p->Release(); + if (p) + p->Release(); } #define SO_APPEND ((UINT)-1) static inline void d3d11_restore_state(struct d3d11_state *state) { - UINT so_offsets[MAX_SO_TARGETS] = - {SO_APPEND, SO_APPEND, SO_APPEND, SO_APPEND}; + UINT so_offsets[MAX_SO_TARGETS] = {SO_APPEND, SO_APPEND, SO_APPEND, + SO_APPEND}; - data.context->GSSetShader(state->geom_shader, - state->gs_class_instances, - state->gs_class_inst_count); + data.context->GSSetShader(state->geom_shader, state->gs_class_instances, + state->gs_class_inst_count); data.context->IASetInputLayout(state->vertex_layout); data.context->IASetPrimitiveTopology(state->topology); data.context->IASetVertexBuffers(0, 1, &state->vertex_buffer, - &state->vb_stride, &state->vb_offset); + &state->vb_stride, &state->vb_offset); data.context->OMSetBlendState(state->blend_state, state->blend_factor, - state->sample_mask); + state->sample_mask); data.context->OMSetDepthStencilState(state->zstencil_state, - state->zstencil_ref); + state->zstencil_ref); data.context->OMSetRenderTargets(MAX_RENDER_TARGETS, - state->render_targets, - state->zstencil_view); + state->render_targets, + state->zstencil_view); data.context->PSSetSamplers(0, 1, &state->sampler_state); data.context->PSSetShader(state->pixel_shader, - state->ps_class_instances, - state->ps_class_inst_count); + state->ps_class_instances, + state->ps_class_inst_count); data.context->PSSetShaderResources(0, 1, &state->resource); data.context->RSSetState(state->raster_state); data.context->RSSetViewports(state->num_viewports, state->viewports); - data.context->SOSetTargets(MAX_SO_TARGETS, - state->stream_output_targets, so_offsets); + data.context->SOSetTargets(MAX_SO_TARGETS, state->stream_output_targets, + so_offsets); data.context->VSSetShader(state->vertex_shader, - state->vs_class_instances, - state->vs_class_inst_count); + state->vs_class_instances, + state->vs_class_inst_count); safe_release(state->geom_shader); safe_release(state->vertex_layout); safe_release(state->vertex_buffer); @@ -698,7 +703,7 @@ } static inline void d3d11_setup_pipeline(ID3D11RenderTargetView *target, - ID3D11ShaderResourceView *resource) + ID3D11ShaderResourceView *resource) { const float factor[4] = {1.0f, 1.0f, 1.0f, 1.0f}; D3D11_VIEWPORT viewport = {0}; @@ -713,9 +718,9 @@ data.context->GSSetShader(nullptr, nullptr, 0); data.context->IASetInputLayout(data.vertex_layout); data.context->IASetPrimitiveTopology( - D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); data.context->IASetVertexBuffers(0, 1, &data.vertex_buffer, &stride, - &zero); + &zero); data.context->OMSetBlendState(data.blend_state, factor, 0xFFFFFFFF); data.context->OMSetDepthStencilState(data.zstencil_state, 0); data.context->OMSetRenderTargets(1, &target, nullptr); @@ -724,12 +729,12 @@ data.context->PSSetShaderResources(0, 1, &resource); data.context->RSSetState(data.raster_state); data.context->RSSetViewports(1, &viewport); - data.context->SOSetTargets(1, (ID3D11Buffer**)&emptyptr, &zero); + data.context->SOSetTargets(1, (ID3D11Buffer **)&emptyptr, &zero); data.context->VSSetShader(data.vertex_shader, nullptr, 0); } static inline void d3d11_scale_texture(ID3D11RenderTargetView *target, - ID3D11ShaderResourceView *resource) + ID3D11ShaderResourceView *resource) { static struct d3d11_state old_state = {0}; @@ -768,7 +773,7 @@ data.texture_ready[i] = false; hr = data.context->Map(data.copy_surfaces[i], 0, - D3D11_MAP_READ, 0, &map); + D3D11_MAP_READ, 0, &map); if (SUCCEEDED(hr)) { data.texture_mapped[i] = true; shmem_copy_data(i, map.pData); @@ -784,12 +789,12 @@ d3d11_shmem_queue_copy(); - next_tex = (data.cur_tex == NUM_BUFFERS - 1) ? 0 : data.cur_tex + 1; + next_tex = (data.cur_tex == NUM_BUFFERS - 1) ? 0 : data.cur_tex + 1; if (data.using_scale) { d3d11_copy_texture(data.scale_tex, backbuffer); d3d11_scale_texture(data.render_targets[data.cur_tex], - data.scale_resource); + data.scale_resource); } else { d3d11_copy_texture(data.textures[data.cur_tex], backbuffer); } @@ -815,8 +820,8 @@ void d3d11_capture(void *swap_ptr, void *backbuffer_ptr, bool) { - IDXGIResource *dxgi_backbuffer = (IDXGIResource*)backbuffer_ptr; - IDXGISwapChain *swap = (IDXGISwapChain*)swap_ptr; + IDXGIResource *dxgi_backbuffer = (IDXGIResource *)backbuffer_ptr; + IDXGISwapChain *swap = (IDXGISwapChain *)swap_ptr; HRESULT hr; if (capture_should_stop()) { @@ -829,10 +834,11 @@ ID3D11Resource *backbuffer; hr = dxgi_backbuffer->QueryInterface(__uuidof(ID3D11Resource), - (void**)&backbuffer); + (void **)&backbuffer); if (FAILED(hr)) { hlog_hr("d3d11_shtex_capture: failed to get " - "backbuffer", hr); + "backbuffer", + hr); return; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/d3d12-capture.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/d3d12-capture.cpp
Changed
@@ -13,29 +13,29 @@ #define MAX_BACKBUFFERS 8 struct d3d12_data { - ID3D12Device *device; /* do not release */ - uint32_t base_cx; - uint32_t base_cy; - uint32_t cx; - uint32_t cy; - DXGI_FORMAT format; - bool using_shtex; - bool using_scale; - bool multisampled; - bool dxgi_1_4; - - ID3D11Device *device11; - ID3D11DeviceContext *context11; - ID3D11On12Device *device11on12; + ID3D12Device *device; /* do not release */ + uint32_t base_cx; + uint32_t base_cy; + uint32_t cx; + uint32_t cy; + DXGI_FORMAT format; + bool using_shtex; + bool using_scale; + bool multisampled; + bool dxgi_1_4; + + ID3D11Device *device11; + ID3D11DeviceContext *context11; + ID3D11On12Device *device11on12; union { struct { - struct shtex_data *shtex_info; - ID3D11Resource *backbuffer11[MAX_BACKBUFFERS]; - UINT backbuffer_count; - UINT cur_backbuffer; - ID3D11Texture2D *copy_tex; - HANDLE handle; + struct shtex_data *shtex_info; + ID3D11Resource *backbuffer11[MAX_BACKBUFFERS]; + UINT backbuffer_count; + UINT cur_backbuffer; + ID3D11Texture2D *copy_tex; + HANDLE handle; }; }; }; @@ -81,15 +81,14 @@ for (UINT i = 0; i < bb.count; i++) { hr = data.device11on12->CreateWrappedResource( - bb.backbuffer[i], - &rf11, - D3D12_RESOURCE_STATE_COPY_SOURCE, - D3D12_RESOURCE_STATE_PRESENT, - __uuidof(ID3D11Resource), - (void**)&data.backbuffer11[i]); + bb.backbuffer[i], &rf11, + D3D12_RESOURCE_STATE_COPY_SOURCE, + D3D12_RESOURCE_STATE_PRESENT, __uuidof(ID3D11Resource), + (void **)&data.backbuffer11[i]); if (FAILED(hr)) { hlog_hr("create_d3d12_tex: failed to create " - "backbuffer11", hr); + "backbuffer11", + hr); return false; } } @@ -107,21 +106,22 @@ hr = data.device11->CreateTexture2D(&desc11, nullptr, &data.copy_tex); if (FAILED(hr)) { hlog_hr("create_d3d12_tex: creation of d3d11 copy tex failed", - hr); + hr); return false; } for (UINT i = 0; i < bb.count; i++) { data.device11on12->ReleaseWrappedResources( - &data.backbuffer11[i], 1); + &data.backbuffer11[i], 1); } IDXGIResource *dxgi_res; hr = data.copy_tex->QueryInterface(__uuidof(IDXGIResource), - (void**)&dxgi_res); + (void **)&dxgi_res); if (FAILED(hr)) { hlog_hr("create_d3d12_tex: failed to query " - "IDXGIResource interface from texture", hr); + "IDXGIResource interface from texture", + hr); return false; } @@ -137,8 +137,7 @@ typedef PFN_D3D11ON12_CREATE_DEVICE create_11_on_12_t; -const static D3D_FEATURE_LEVEL feature_levels[] = -{ +const static D3D_FEATURE_LEVEL feature_levels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, @@ -166,11 +165,11 @@ } if (!initialized_func && !create_11_on_12) { - create_11_on_12 = (create_11_on_12_t)GetProcAddress(d3d11, - "D3D11On12CreateDevice"); + create_11_on_12 = (create_11_on_12_t)GetProcAddress( + d3d11, "D3D11On12CreateDevice"); if (!create_11_on_12) { hlog("d3d12_init_11on12: Failed to get " - "D3D11On12CreateDevice address"); + "D3D11On12CreateDevice address"); } initialized_func = true; @@ -180,16 +179,15 @@ return false; } - hr = create_11_on_12(data.device, 0, nullptr, 0, - nullptr, 0, 0, - &data.device11, &data.context11, nullptr); + hr = create_11_on_12(data.device, 0, nullptr, 0, nullptr, 0, 0, + &data.device11, &data.context11, nullptr); if (FAILED(hr)) { hlog_hr("d3d12_init_11on12: failed to create 11 device", hr); return false; } data.device11->QueryInterface(__uuidof(ID3D11On12Device), - (void**)&data.device11on12); + (void **)&data.device11on12); if (FAILED(hr)) { hlog_hr("d3d12_init_11on12: failed to query 11on12 device", hr); return false; @@ -206,9 +204,9 @@ if (!create_d3d12_tex(bb)) { return false; } - if (!capture_init_shtex(&data.shtex_info, window, - data.base_cx, data.base_cy, data.cx, data.cy, - data.format, false, (uintptr_t)data.handle)) { + if (!capture_init_shtex(&data.shtex_info, window, data.base_cx, + data.base_cy, data.cx, data.cy, data.format, + false, (uintptr_t)data.handle)) { return false; } @@ -217,7 +215,7 @@ } static inline bool d3d12_init_format(IDXGISwapChain *swap, HWND &window, - bb_info &bb) + bb_info &bb) { DXGI_SWAP_CHAIN_DESC desc; IDXGISwapChain3 *swap3; @@ -235,7 +233,7 @@ data.base_cx = desc.BufferDesc.Width; data.base_cy = desc.BufferDesc.Height; - hr = swap->QueryInterface(__uuidof(IDXGISwapChain3), (void**)&swap3); + hr = swap->QueryInterface(__uuidof(IDXGISwapChain3), (void **)&swap3); if (SUCCEEDED(hr)) { data.dxgi_1_4 = true; hlog("We're DXGI1.4 boys!"); @@ -243,24 +241,25 @@ } hlog("Buffer count: %d, swap effect: %d", (int)desc.BufferCount, - (int)desc.SwapEffect); + (int)desc.SwapEffect); bb.count = desc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD - ? 1 : desc.BufferCount; + ? 1 + : desc.BufferCount; if (bb.count == 1) data.dxgi_1_4 = false; if (bb.count > MAX_BACKBUFFERS) { hlog("Somehow it's using more than the max backbuffers. " - "Not sure why anyone would do that."); + "Not sure why anyone would do that."); bb.count = 1; data.dxgi_1_4 = false; } for (UINT i = 0; i < bb.count; i++) { hr = swap->GetBuffer(i, __uuidof(ID3D12Resource), - (void**)&bb.backbuffer[i]); + (void **)&bb.backbuffer[i]); if (SUCCEEDED(hr)) { bb.backbuffer[i]->Release(); } else { @@ -287,7 +286,7 @@ data.using_scale = global_hook_info->use_scale; - hr = swap->GetDevice(__uuidof(ID3D12Device), (void**)&data.device); + hr = swap->GetDevice(__uuidof(ID3D12Device), (void **)&data.device); if (FAILED(hr)) { hlog_hr("d3d12_init: failed to get device from swap", hr); return; @@ -304,7 +303,7 @@ if (success) { if (global_hook_info->force_shmem) { hlog("d3d12_init: shared memory capture currently " - "unsupported; ignoring"); + "unsupported; ignoring"); } success = d3d12_shtex_init(window, bb); @@ -324,14 +323,14 @@ } static inline void d3d12_shtex_capture(IDXGISwapChain *swap, - bool capture_overlay) + bool capture_overlay) { bool dxgi_1_4 = data.dxgi_1_4; UINT cur_idx; if (dxgi_1_4) { IDXGISwapChain3 *swap3 = - reinterpret_cast<IDXGISwapChain3*>(swap); + reinterpret_cast<IDXGISwapChain3 *>(swap); cur_idx = swap3->GetCurrentBackBufferIndex(); if (!capture_overlay) { if (++cur_idx >= data.backbuffer_count) @@ -354,9 +353,9 @@ } } -void d3d12_capture(void *swap_ptr, void*, bool capture_overlay) +void d3d12_capture(void *swap_ptr, void *, bool capture_overlay) { - IDXGISwapChain *swap = (IDXGISwapChain*)swap_ptr; + IDXGISwapChain *swap = (IDXGISwapChain *)swap_ptr; if (capture_should_stop()) { d3d12_free();
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/d3d1x_shaders.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/d3d1x_shaders.hpp
Changed
@@ -1,7 +1,6 @@ #pragma once -static const char vertex_shader_string[] = -"struct VertData \ +static const char vertex_shader_string[] = "struct VertData \ { \ float4 pos : SV_Position; \ float2 texCoord : TexCoord0; \ @@ -14,8 +13,7 @@ return output; \ }"; -static const char pixel_shader_string[] = -"uniform Texture2D diffuseTexture; \ +static const char pixel_shader_string[] = "uniform Texture2D diffuseTexture; \ SamplerState textureSampler \ { \ AddressU = Clamp; \
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/d3d8-capture.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/d3d8-capture.cpp
Changed
@@ -4,28 +4,29 @@ #include "graphics-hook.h" #include "../funchook.h" -typedef HRESULT(STDMETHODCALLTYPE *reset_t)(IDirect3DDevice8*, - D3DPRESENT_PARAMETERS*); -typedef HRESULT(STDMETHODCALLTYPE *present_t)(IDirect3DDevice8*, - CONST RECT*, CONST RECT*, HWND, CONST RGNDATA*); +typedef HRESULT(STDMETHODCALLTYPE *reset_t)(IDirect3DDevice8 *, + D3DPRESENT_PARAMETERS *); +typedef HRESULT(STDMETHODCALLTYPE *present_t)(IDirect3DDevice8 *, CONST RECT *, + CONST RECT *, HWND, + CONST RGNDATA *); static struct func_hook present; static struct func_hook reset; struct d3d8_data { - HMODULE d3d8; - uint32_t cx; - uint32_t cy; - D3DFORMAT d3d8_format; - DXGI_FORMAT dxgi_format; - - struct shmem_data *shmem_info; - HWND window; - uint32_t pitch; - IDirect3DSurface8 *copy_surfaces[NUM_BUFFERS]; - bool surface_locked[NUM_BUFFERS]; - int cur_surface; - int copy_wait; + HMODULE d3d8; + uint32_t cx; + uint32_t cy; + D3DFORMAT d3d8_format; + DXGI_FORMAT dxgi_format; + + struct shmem_data *shmem_info; + HWND window; + uint32_t pitch; + IDirect3DSurface8 *copy_surfaces[NUM_BUFFERS]; + bool surface_locked[NUM_BUFFERS]; + int cur_surface; + int copy_wait; }; static d3d8_data data = {}; @@ -34,10 +35,14 @@ { switch ((unsigned long)format) { case D3DFMT_X1R5G5B5: - case D3DFMT_A1R5G5B5: return DXGI_FORMAT_B5G5R5A1_UNORM; - case D3DFMT_R5G6B5: return DXGI_FORMAT_B5G6R5_UNORM; - case D3DFMT_A8R8G8B8: return DXGI_FORMAT_B8G8R8A8_UNORM; - case D3DFMT_X8R8G8B8: return DXGI_FORMAT_B8G8R8X8_UNORM; + case D3DFMT_A1R5G5B5: + return DXGI_FORMAT_B5G5R5A1_UNORM; + case D3DFMT_R5G6B5: + return DXGI_FORMAT_B5G6R5_UNORM; + case D3DFMT_A8R8G8B8: + return DXGI_FORMAT_B8G8R8A8_UNORM; + case D3DFMT_X8R8G8B8: + return DXGI_FORMAT_B8G8R8X8_UNORM; } return DXGI_FORMAT_UNKNOWN; @@ -64,7 +69,8 @@ hr = device->GetCreationParameters(¶meters); if (FAILED(hr)) { hlog_hr("d3d8_get_window_handle: Failed to get " - "device creation parameters", hr); + "device creation parameters", + hr); return false; } @@ -90,7 +96,8 @@ backbuffer->Release(); if (FAILED(hr)) { hlog_hr("d3d8_init_format_backbuffer: Failed to get " - "backbuffer descriptor", hr); + "backbuffer descriptor", + hr); return false; } @@ -106,8 +113,8 @@ { HRESULT hr; - hr = device->CreateImageSurface(data.cx, data.cy, - data.d3d8_format, &data.copy_surfaces[idx]); + hr = device->CreateImageSurface(data.cx, data.cy, data.d3d8_format, + &data.copy_surfaces[idx]); if (FAILED(hr)) { hlog_hr("d3d8_shmem_init_buffer: Failed to create surface", hr); return false; @@ -116,9 +123,10 @@ if (idx == 0) { D3DLOCKED_RECT rect; hr = data.copy_surfaces[0]->LockRect(&rect, nullptr, - D3DLOCK_READONLY); + D3DLOCK_READONLY); if (FAILED(hr)) { - hlog_hr("d3d8_shmem_init_buffer: Failed to lock buffer", hr); + hlog_hr("d3d8_shmem_init_buffer: Failed to lock buffer", + hr); return false; } @@ -190,7 +198,7 @@ } static void d3d8_shmem_capture(IDirect3DDevice8 *device, - IDirect3DSurface8 *backbuffer) + IDirect3DSurface8 *backbuffer) { int cur_surface; int next_surface; @@ -221,7 +229,7 @@ } static void d3d8_capture(IDirect3DDevice8 *device, - IDirect3DSurface8 *backbuffer) + IDirect3DSurface8 *backbuffer) { if (capture_should_stop()) { d3d8_free(); @@ -234,9 +242,8 @@ } } - static HRESULT STDMETHODCALLTYPE hook_reset(IDirect3DDevice8 *device, - D3DPRESENT_PARAMETERS *parameters) + D3DPRESENT_PARAMETERS *parameters) { HRESULT hr; @@ -255,18 +262,20 @@ static void setup_reset_hooks(IDirect3DDevice8 *device) { - uintptr_t *vtable = *(uintptr_t**)device; + uintptr_t *vtable = *(uintptr_t **)device; - hook_init(&reset, (void*)vtable[14], (void*)hook_reset, - "IDirect3DDevice8::Reset"); + hook_init(&reset, (void *)vtable[14], (void *)hook_reset, + "IDirect3DDevice8::Reset"); rehook(&reset); hooked_reset = true; } static HRESULT STDMETHODCALLTYPE hook_present(IDirect3DDevice8 *device, - CONST RECT *src_rect, CONST RECT *dst_rect, - HWND override_window, CONST RGNDATA *dirty_region) + CONST RECT *src_rect, + CONST RECT *dst_rect, + HWND override_window, + CONST RGNDATA *dirty_region) { IDirect3DSurface8 *backbuffer; HRESULT hr; @@ -291,7 +300,7 @@ typedef IDirect3D8 *(WINAPI *d3d8create_t)(UINT); static bool manually_get_d3d8_present_addr(HMODULE d3d8_module, - void **present_addr) + void **present_addr) { d3d8create_t create; D3DPRESENT_PARAMETERS pp; @@ -315,22 +324,23 @@ } memset(&pp, 0, sizeof(pp)); - pp.Windowed = true; - pp.SwapEffect = D3DSWAPEFFECT_FLIP; - pp.BackBufferFormat = D3DFMT_A8R8G8B8; - pp.BackBufferWidth = 2; - pp.BackBufferHeight = 2; - pp.BackBufferCount = 1; - pp.hDeviceWindow = dummy_window; + pp.Windowed = true; + pp.SwapEffect = D3DSWAPEFFECT_FLIP; + pp.BackBufferFormat = D3DFMT_A8R8G8B8; + pp.BackBufferWidth = 2; + pp.BackBufferHeight = 2; + pp.BackBufferCount = 1; + pp.hDeviceWindow = dummy_window; hr = d3d8->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - dummy_window, D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, - &device); + dummy_window, + D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, + &device); d3d8->Release(); if (SUCCEEDED(hr)) { - uintptr_t *vtable = *(uintptr_t**)device; - *present_addr = (void*)vtable[15]; + uintptr_t *vtable = *(uintptr_t **)device; + *present_addr = (void *)vtable[15]; device->Release(); } else { @@ -354,15 +364,15 @@ d3d8_size = module_size(d3d8_module); if (global_hook_info->offsets.d3d8.present < d3d8_size) { - present_addr = get_offset_addr(d3d8_module, - global_hook_info->offsets.d3d8.present); + present_addr = get_offset_addr( + d3d8_module, global_hook_info->offsets.d3d8.present); } else { if (!dummy_window) { return false; } if (!manually_get_d3d8_present_addr(d3d8_module, - &present_addr)) { + &present_addr)) { hlog("Failed to get D3D8 value"); return true; } @@ -373,8 +383,8 @@ return true; } - hook_init(&present, present_addr, (void*)hook_present, - "IDirect3DDevice8::Present"); + hook_init(&present, present_addr, (void *)hook_present, + "IDirect3DDevice8::Present"); rehook(&present);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/d3d9-capture.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/d3d9-capture.cpp
Changed
@@ -6,18 +6,23 @@ #include "../funchook.h" #include "d3d9-patches.hpp" -typedef HRESULT (STDMETHODCALLTYPE *present_t)(IDirect3DDevice9*, - CONST RECT*, CONST RECT*, HWND, CONST RGNDATA*); -typedef HRESULT (STDMETHODCALLTYPE *present_ex_t)(IDirect3DDevice9*, - CONST RECT*, CONST RECT*, HWND, CONST RGNDATA*, DWORD); -typedef HRESULT (STDMETHODCALLTYPE *present_swap_t)(IDirect3DSwapChain9*, - CONST RECT*, CONST RECT*, HWND, CONST RGNDATA*, DWORD); -typedef HRESULT (STDMETHODCALLTYPE *reset_t)(IDirect3DDevice9*, - D3DPRESENT_PARAMETERS*); -typedef HRESULT (STDMETHODCALLTYPE *reset_ex_t)(IDirect3DDevice9*, - D3DPRESENT_PARAMETERS*, D3DDISPLAYMODEEX*); - -typedef HRESULT (WINAPI *createfactory1_t)(REFIID, void **); +typedef HRESULT(STDMETHODCALLTYPE *present_t)(IDirect3DDevice9 *, CONST RECT *, + CONST RECT *, HWND, + CONST RGNDATA *); +typedef HRESULT(STDMETHODCALLTYPE *present_ex_t)(IDirect3DDevice9 *, + CONST RECT *, CONST RECT *, + HWND, CONST RGNDATA *, DWORD); +typedef HRESULT(STDMETHODCALLTYPE *present_swap_t)(IDirect3DSwapChain9 *, + CONST RECT *, CONST RECT *, + HWND, CONST RGNDATA *, + DWORD); +typedef HRESULT(STDMETHODCALLTYPE *reset_t)(IDirect3DDevice9 *, + D3DPRESENT_PARAMETERS *); +typedef HRESULT(STDMETHODCALLTYPE *reset_ex_t)(IDirect3DDevice9 *, + D3DPRESENT_PARAMETERS *, + D3DDISPLAYMODEEX *); + +typedef HRESULT(WINAPI *createfactory1_t)(REFIID, void **); static struct func_hook present; static struct func_hook present_ex; @@ -26,34 +31,34 @@ static struct func_hook reset_ex; struct d3d9_data { - HMODULE d3d9; - IDirect3DDevice9 *device; /* do not release */ - uint32_t cx; - uint32_t cy; - D3DFORMAT d3d9_format; - DXGI_FORMAT dxgi_format; - bool using_shtex; - bool using_scale; + HMODULE d3d9; + IDirect3DDevice9 *device; /* do not release */ + uint32_t cx; + uint32_t cy; + D3DFORMAT d3d9_format; + DXGI_FORMAT dxgi_format; + bool using_shtex; + bool using_scale; /* shared texture */ - IDirect3DSurface9 *d3d9_copytex; - ID3D11Device *d3d11_device; - ID3D11DeviceContext *d3d11_context; - ID3D11Resource *d3d11_tex; - struct shtex_data *shtex_info; - HANDLE handle; - int patch; + IDirect3DSurface9 *d3d9_copytex; + ID3D11Device *d3d11_device; + ID3D11DeviceContext *d3d11_context; + ID3D11Resource *d3d11_tex; + struct shtex_data *shtex_info; + HANDLE handle; + int patch; /* shared memory */ - IDirect3DSurface9 *copy_surfaces[NUM_BUFFERS]; - IDirect3DSurface9 *render_targets[NUM_BUFFERS]; - IDirect3DQuery9 *queries[NUM_BUFFERS]; - struct shmem_data *shmem_info; - bool texture_mapped[NUM_BUFFERS]; - volatile bool issued_queries[NUM_BUFFERS]; - uint32_t pitch; - int cur_tex; - int copy_wait; + IDirect3DSurface9 *copy_surfaces[NUM_BUFFERS]; + IDirect3DSurface9 *render_targets[NUM_BUFFERS]; + IDirect3DQuery9 *queries[NUM_BUFFERS]; + struct shmem_data *shmem_info; + bool texture_mapped[NUM_BUFFERS]; + volatile bool issued_queries[NUM_BUFFERS]; + uint32_t pitch; + int cur_tex; + int copy_wait; }; static struct d3d9_data data = {}; @@ -93,16 +98,18 @@ static DXGI_FORMAT d3d9_to_dxgi_format(D3DFORMAT format) { switch ((unsigned long)format) { - case D3DFMT_A2B10G10R10: return DXGI_FORMAT_R10G10B10A2_UNORM; - case D3DFMT_A8R8G8B8: return DXGI_FORMAT_B8G8R8A8_UNORM; - case D3DFMT_X8R8G8B8: return DXGI_FORMAT_B8G8R8X8_UNORM; + case D3DFMT_A2B10G10R10: + return DXGI_FORMAT_R10G10B10A2_UNORM; + case D3DFMT_A8R8G8B8: + return DXGI_FORMAT_B8G8R8A8_UNORM; + case D3DFMT_X8R8G8B8: + return DXGI_FORMAT_B8G8R8X8_UNORM; } return DXGI_FORMAT_UNKNOWN; } -const static D3D_FEATURE_LEVEL feature_levels[] = -{ +const static D3D_FEATURE_LEVEL feature_levels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, @@ -132,21 +139,21 @@ return false; } - create_factory = (createfactory1_t)GetProcAddress(dxgi, - "CreateDXGIFactory1"); + create_factory = + (createfactory1_t)GetProcAddress(dxgi, "CreateDXGIFactory1"); if (!create_factory) { hlog("d3d9_init: Failed to get CreateDXGIFactory1 address"); return false; } - create_device = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(d3d11, - "D3D11CreateDevice"); + create_device = (PFN_D3D11_CREATE_DEVICE)GetProcAddress( + d3d11, "D3D11CreateDevice"); if (!create_device) { hlog("d3d9_init: Failed to get D3D11CreateDevice address"); return false; } - hr = create_factory(__uuidof(IDXGIFactory1), (void**)&factory); + hr = create_factory(__uuidof(IDXGIFactory1), (void **)&factory); if (FAILED(hr)) { hlog_hr("d3d9_init: Failed to create factory object", hr); return false; @@ -160,11 +167,11 @@ return false; } - hr = create_device(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, - 0, feature_levels, - sizeof(feature_levels) / sizeof(D3D_FEATURE_LEVEL), - D3D11_SDK_VERSION, &data.d3d11_device, &level_used, - &data.d3d11_context); + hr = create_device(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, 0, + feature_levels, + sizeof(feature_levels) / sizeof(D3D_FEATURE_LEVEL), + D3D11_SDK_VERSION, &data.d3d11_device, &level_used, + &data.d3d11_context); adapter->Release(); if (FAILED(hr)) { @@ -181,30 +188,29 @@ HRESULT hr; D3D11_TEXTURE2D_DESC desc = {}; - desc.Width = data.cx; - desc.Height = data.cy; - desc.Format = data.dxgi_format; - desc.MipLevels = 1; - desc.ArraySize = 1; - desc.SampleDesc.Count = 1; - desc.Usage = D3D11_USAGE_DEFAULT; - desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; - desc.BindFlags = D3D11_BIND_RENDER_TARGET | - D3D11_BIND_SHADER_RESOURCE; - - hr = data.d3d11_device->CreateTexture2D(&desc, nullptr, - (ID3D11Texture2D**)&data.d3d11_tex); + desc.Width = data.cx; + desc.Height = data.cy; + desc.Format = data.dxgi_format; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.SampleDesc.Count = 1; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; + desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE; + + hr = data.d3d11_device->CreateTexture2D( + &desc, nullptr, (ID3D11Texture2D **)&data.d3d11_tex); if (FAILED(hr)) { hlog_hr("d3d9_shtex_init_shtex: Failed to create D3D11 texture", - hr); + hr); return false; } hr = data.d3d11_tex->QueryInterface(__uuidof(IDXGIResource), - (void**)&res); + (void **)&res); if (FAILED(hr)) { hlog_hr("d3d9_shtex_init_shtex: Failed to query IDXGIResource", - hr); + hr); return false; } @@ -213,7 +219,7 @@ if (FAILED(hr)) { hlog_hr("d3d9_shtex_init_shtex: Failed to get shared handle", - hr); + hr); return false; } @@ -233,10 +239,10 @@ HRESULT hr; if (offsets.d3d9_clsoff && offsets.is_d3d9ex_clsoff) { - uint8_t *device_ptr = (uint8_t*)(data.device); + uint8_t *device_ptr = (uint8_t *)(data.device); uint8_t *d3d9_ptr = - *(uint8_t**)(device_ptr + offsets.d3d9_clsoff); - p_is_d3d9 = (BOOL*)(d3d9_ptr + offsets.is_d3d9ex_clsoff); + *(uint8_t **)(device_ptr + offsets.d3d9_clsoff); + p_is_d3d9 = (BOOL *)(d3d9_ptr + offsets.is_d3d9ex_clsoff); } else { patch_addr = get_d3d9_patch_addr(data.d3d9, data.patch); } @@ -248,14 +254,14 @@ } else if (patch_addr) { patch_size = patch[data.patch].size; VirtualProtect(patch_addr, patch_size, PAGE_EXECUTE_READWRITE, - &protect_val); + &protect_val); memcpy(saved_data, patch_addr, patch_size); memcpy(patch_addr, patch[data.patch].data, patch_size); } hr = data.device->CreateTexture(data.cx, data.cy, 1, - D3DUSAGE_RENDERTARGET, data.d3d9_format, - D3DPOOL_DEFAULT, &tex, &data.handle); + D3DUSAGE_RENDERTARGET, data.d3d9_format, + D3DPOOL_DEFAULT, &tex, &data.handle); if (p_is_d3d9) { *p_is_d3d9 = was_d3d9ex; @@ -263,12 +269,12 @@ } else if (patch_addr && patch_size) { memcpy(patch_addr, saved_data, patch_size); VirtualProtect(patch_addr, patch_size, protect_val, - &protect_val); + &protect_val); } if (FAILED(hr)) { hlog_hr("d3d9_shtex_init_copytex: Failed to create shared texture", - hr); + hr); return false; } @@ -276,7 +282,8 @@ tex->Release(); if (FAILED(hr)) { - hlog_hr("d3d9_shtex_init_copytex: Failed to get surface level", hr); + hlog_hr("d3d9_shtex_init_copytex: Failed to get surface level", + hr); return false; } @@ -296,8 +303,8 @@ if (!d3d9_shtex_init_copytex()) { return false; } - if (!capture_init_shtex(&data.shtex_info, window, cx, cy, - data.cx, data.cy, data.dxgi_format, false, + if (!capture_init_shtex(&data.shtex_info, window, cx, cy, data.cx, + data.cy, data.dxgi_format, false, (uintptr_t)data.handle)) { return false; } @@ -310,40 +317,43 @@ { HRESULT hr; - hr = data.device->CreateOffscreenPlainSurface(data.cx, data.cy, - data.d3d9_format, D3DPOOL_SYSTEMMEM, - &data.copy_surfaces[buffer], nullptr); + hr = data.device->CreateOffscreenPlainSurface( + data.cx, data.cy, data.d3d9_format, D3DPOOL_SYSTEMMEM, + &data.copy_surfaces[buffer], nullptr); if (FAILED(hr)) { hlog_hr("d3d9_shmem_init_buffers: Failed to create surface", - hr); + hr); return false; } if (buffer == 0) { D3DLOCKED_RECT rect; hr = data.copy_surfaces[buffer]->LockRect(&rect, nullptr, - D3DLOCK_READONLY); + D3DLOCK_READONLY); if (FAILED(hr)) { hlog_hr("d3d9_shmem_init_buffers: Failed to lock " - "buffer", hr); + "buffer", + hr); return false; } data.pitch = rect.Pitch; data.copy_surfaces[buffer]->UnlockRect(); - } + } - hr = data.device->CreateRenderTarget(data.cx, data.cy, - data.d3d9_format, D3DMULTISAMPLE_NONE, 0, false, - &data.render_targets[buffer], nullptr); + hr = data.device->CreateRenderTarget(data.cx, data.cy, data.d3d9_format, + D3DMULTISAMPLE_NONE, 0, false, + &data.render_targets[buffer], + nullptr); if (FAILED(hr)) { hlog_hr("d3d9_shmem_init_buffers: Failed to create render " - "target", hr); + "target", + hr); return false; } hr = data.device->CreateQuery(D3DQUERYTYPE_EVENT, - &data.queries[buffer]); + &data.queries[buffer]); if (FAILED(hr)) { hlog_hr("d3d9_shmem_init_buffers: Failed to create query", hr); return false; @@ -361,9 +371,8 @@ return false; } } - if (!capture_init_shmem(&data.shmem_info, window, cx, cy, - data.cx, data.cy, data.pitch, data.dxgi_format, - false)) { + if (!capture_init_shmem(&data.shmem_info, window, cx, cy, data.cx, + data.cy, data.pitch, data.dxgi_format, false)) { return false; } @@ -387,7 +396,8 @@ if (FAILED(hr)) { hlog_hr("d3d9_get_swap_desc: Failed to get " - "presentation parameters", hr); + "presentation parameters", + hr); return false; } @@ -395,7 +405,7 @@ } static bool d3d9_init_format_backbuffer(uint32_t &cx, uint32_t &cy, - HWND &window) + HWND &window) { IDirect3DSurface9 *back_buffer = nullptr; D3DPRESENT_PARAMETERS pp; @@ -416,7 +426,8 @@ if (FAILED(hr)) { hlog_hr("d3d9_init_format_backbuffer: Failed to get " - "backbuffer descriptor", hr); + "backbuffer descriptor", + hr); return false; } @@ -480,7 +491,7 @@ data.device = device; hr = device->QueryInterface(__uuidof(IDirect3DDevice9Ex), - (void**)&d3d9ex); + (void **)&d3d9ex); if (SUCCEEDED(hr)) { d3d9ex->Release(); data.patch = -1; @@ -508,7 +519,7 @@ } static inline HRESULT get_backbuffer(IDirect3DDevice9 *device, - IDirect3DSurface9 **surface) + IDirect3DSurface9 **surface) { static bool use_backbuffer = false; static bool checked_exceptions = false; @@ -521,7 +532,7 @@ if (use_backbuffer) { return device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, - surface); + surface); } else { return device->GetRenderTarget(0, surface); } @@ -535,7 +546,7 @@ filter = data.using_scale ? D3DTEXF_LINEAR : D3DTEXF_NONE; hr = data.device->StretchRect(backbuffer, nullptr, data.d3d9_copytex, - nullptr, filter); + nullptr, filter); if (FAILED(hr)) hlog_hr("d3d9_shtex_capture: StretchRect failed", hr); } @@ -574,12 +585,12 @@ d3d9_shmem_capture_queue_copy(); - next_tex = (data.cur_tex == NUM_BUFFERS - 1) ? 0 : data.cur_tex + 1; + next_tex = (data.cur_tex == NUM_BUFFERS - 1) ? 0 : data.cur_tex + 1; filter = data.using_scale ? D3DTEXF_LINEAR : D3DTEXF_NONE; copy = data.render_targets[data.cur_tex]; hr = data.device->StretchRect(backbuffer, nullptr, copy, nullptr, - filter); + filter); if (FAILED(hr)) { hlog_hr("d3d9_shmem_capture: StretchRect failed", hr); @@ -601,7 +612,8 @@ hr = data.device->GetRenderTargetData(src, dst); if (FAILED(hr)) { hlog_hr("d3d9_shmem_capture: GetRenderTargetData " - "failed", hr); + "failed", + hr); } data.queries[next_tex]->Issue(D3DISSUE_END); @@ -612,7 +624,7 @@ } static void d3d9_capture(IDirect3DDevice9 *device, - IDirect3DSurface9 *backbuffer) + IDirect3DSurface9 *backbuffer) { if (capture_should_stop()) { d3d9_free(); @@ -637,7 +649,7 @@ static int present_recurse = 0; static inline void present_begin(IDirect3DDevice9 *device, - IDirect3DSurface9 *&backbuffer) + IDirect3DSurface9 *&backbuffer) { HRESULT hr; @@ -645,7 +657,8 @@ hr = get_backbuffer(device, &backbuffer); if (FAILED(hr)) { hlog_hr("d3d9_shmem_capture: Failed to get " - "backbuffer", hr); + "backbuffer", + hr); } if (!global_hook_info->capture_overlay) { @@ -657,7 +670,7 @@ } static inline void present_end(IDirect3DDevice9 *device, - IDirect3DSurface9 *backbuffer) + IDirect3DSurface9 *backbuffer) { present_recurse--; @@ -676,8 +689,10 @@ static void setup_reset_hooks(IDirect3DDevice9 *device); static HRESULT STDMETHODCALLTYPE hook_present(IDirect3DDevice9 *device, - CONST RECT *src_rect, CONST RECT *dst_rect, - HWND override_window, CONST RGNDATA *dirty_region) + CONST RECT *src_rect, + CONST RECT *dst_rect, + HWND override_window, + CONST RGNDATA *dirty_region) { IDirect3DSurface9 *backbuffer = nullptr; HRESULT hr; @@ -697,9 +712,9 @@ return hr; } -static HRESULT STDMETHODCALLTYPE hook_present_ex(IDirect3DDevice9 *device, - CONST RECT *src_rect, CONST RECT *dst_rect, - HWND override_window, CONST RGNDATA *dirty_region, DWORD flags) +static HRESULT STDMETHODCALLTYPE hook_present_ex( + IDirect3DDevice9 *device, CONST RECT *src_rect, CONST RECT *dst_rect, + HWND override_window, CONST RGNDATA *dirty_region, DWORD flags) { IDirect3DSurface9 *backbuffer = nullptr; HRESULT hr; @@ -712,7 +727,7 @@ unhook(&present_ex); present_ex_t call = (present_ex_t)present_ex.call_addr; hr = call(device, src_rect, dst_rect, override_window, dirty_region, - flags); + flags); rehook(&present_ex); present_end(device, backbuffer); @@ -720,9 +735,9 @@ return hr; } -static HRESULT STDMETHODCALLTYPE hook_present_swap(IDirect3DSwapChain9 *swap, - CONST RECT *src_rect, CONST RECT *dst_rect, - HWND override_window, CONST RGNDATA *dirty_region, DWORD flags) +static HRESULT STDMETHODCALLTYPE hook_present_swap( + IDirect3DSwapChain9 *swap, CONST RECT *src_rect, CONST RECT *dst_rect, + HWND override_window, CONST RGNDATA *dirty_region, DWORD flags) { IDirect3DSurface9 *backbuffer = nullptr; IDirect3DDevice9 *device = nullptr; @@ -745,7 +760,7 @@ unhook(&present_swap); present_swap_t call = (present_swap_t)present_swap.call_addr; hr = call(swap, src_rect, dst_rect, override_window, dirty_region, - flags); + flags); rehook(&present_swap); if (device) @@ -755,7 +770,7 @@ } static HRESULT STDMETHODCALLTYPE hook_reset(IDirect3DDevice9 *device, - D3DPRESENT_PARAMETERS *params) + D3DPRESENT_PARAMETERS *params) { HRESULT hr; @@ -771,7 +786,8 @@ } static HRESULT STDMETHODCALLTYPE hook_reset_ex(IDirect3DDevice9 *device, - D3DPRESENT_PARAMETERS *params, D3DDISPLAYMODEEX *dmex) + D3DPRESENT_PARAMETERS *params, + D3DDISPLAYMODEEX *dmex) { HRESULT hr; @@ -789,18 +805,18 @@ static void setup_reset_hooks(IDirect3DDevice9 *device) { IDirect3DDevice9Ex *d3d9ex = nullptr; - uintptr_t *vtable = *(uintptr_t**)device; + uintptr_t *vtable = *(uintptr_t **)device; HRESULT hr; - hook_init(&reset, (void*)vtable[16], (void*)hook_reset, - "IDirect3DDevice9::Reset"); + hook_init(&reset, (void *)vtable[16], (void *)hook_reset, + "IDirect3DDevice9::Reset"); rehook(&reset); hr = device->QueryInterface(__uuidof(IDirect3DDevice9Ex), - (void**)&d3d9ex); + (void **)&d3d9ex); if (SUCCEEDED(hr)) { - hook_init(&reset_ex, (void*)vtable[132], (void*)hook_reset_ex, - "IDirect3DDevice9Ex::ResetEx"); + hook_init(&reset_ex, (void *)vtable[132], (void *)hook_reset_ex, + "IDirect3DDevice9Ex::ResetEx"); rehook(&reset_ex); d3d9ex->Release(); @@ -809,12 +825,11 @@ hooked_reset = true; } -typedef HRESULT (WINAPI *d3d9create_ex_t)(UINT, IDirect3D9Ex**); +typedef HRESULT(WINAPI *d3d9create_ex_t)(UINT, IDirect3D9Ex **); -static bool manually_get_d3d9_addrs(HMODULE d3d9_module, - void **present_addr, - void **present_ex_addr, - void **present_swap_addr) +static bool manually_get_d3d9_addrs(HMODULE d3d9_module, void **present_addr, + void **present_ex_addr, + void **present_swap_addr) { d3d9create_ex_t create_ex; D3DPRESENT_PARAMETERS pp; @@ -826,7 +841,7 @@ hlog("D3D9 values invalid, manually obtaining"); create_ex = (d3d9create_ex_t)GetProcAddress(d3d9_module, - "Direct3DCreate9Ex"); + "Direct3DCreate9Ex"); if (!create_ex) { hlog("Failed to load Direct3DCreate9Ex"); return false; @@ -837,30 +852,30 @@ } memset(&pp, 0, sizeof(pp)); - pp.Windowed = 1; - pp.SwapEffect = D3DSWAPEFFECT_FLIP; - pp.BackBufferFormat = D3DFMT_A8R8G8B8; - pp.BackBufferCount = 1; - pp.hDeviceWindow = (HWND)dummy_window; - pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; - - hr = d3d9ex->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - dummy_window, - D3DCREATE_HARDWARE_VERTEXPROCESSING | - D3DCREATE_NOWINDOWCHANGES, &pp, NULL, &device); + pp.Windowed = 1; + pp.SwapEffect = D3DSWAPEFFECT_FLIP; + pp.BackBufferFormat = D3DFMT_A8R8G8B8; + pp.BackBufferCount = 1; + pp.hDeviceWindow = (HWND)dummy_window; + pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; + + hr = d3d9ex->CreateDeviceEx( + D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, dummy_window, + D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_NOWINDOWCHANGES, + &pp, NULL, &device); d3d9ex->Release(); if (SUCCEEDED(hr)) { - uintptr_t *vtable = *(uintptr_t**)device; + uintptr_t *vtable = *(uintptr_t **)device; IDirect3DSwapChain9 *swap; - *present_addr = (void*)vtable[17]; - *present_ex_addr = (void*)vtable[121]; + *present_addr = (void *)vtable[17]; + *present_ex_addr = (void *)vtable[121]; hr = device->GetSwapChain(0, &swap); if (SUCCEEDED(hr)) { - vtable = *(uintptr_t**)swap; - *present_swap_addr = (void*)vtable[3]; + vtable = *(uintptr_t **)swap; + *present_swap_addr = (void *)vtable[3]; swap->Release(); } @@ -888,25 +903,25 @@ d3d9_size = module_size(d3d9_module); - if (global_hook_info->offsets.d3d9.present < d3d9_size && - global_hook_info->offsets.d3d9.present_ex < d3d9_size && + if (global_hook_info->offsets.d3d9.present < d3d9_size && + global_hook_info->offsets.d3d9.present_ex < d3d9_size && global_hook_info->offsets.d3d9.present_swap < d3d9_size) { - present_addr = get_offset_addr(d3d9_module, - global_hook_info->offsets.d3d9.present); - present_ex_addr = get_offset_addr(d3d9_module, - global_hook_info->offsets.d3d9.present_ex); - present_swap_addr = get_offset_addr(d3d9_module, - global_hook_info->offsets.d3d9.present_swap); + present_addr = get_offset_addr( + d3d9_module, global_hook_info->offsets.d3d9.present); + present_ex_addr = get_offset_addr( + d3d9_module, global_hook_info->offsets.d3d9.present_ex); + present_swap_addr = get_offset_addr( + d3d9_module, + global_hook_info->offsets.d3d9.present_swap); } else { if (!dummy_window) { return false; } - if (!manually_get_d3d9_addrs(d3d9_module, - &present_addr, - &present_ex_addr, - &present_swap_addr)) { + if (!manually_get_d3d9_addrs(d3d9_module, &present_addr, + &present_ex_addr, + &present_swap_addr)) { hlog("Failed to get D3D9 values"); return true; } @@ -919,20 +934,18 @@ if (present_swap_addr) { hook_init(&present_swap, present_swap_addr, - (void*)hook_present_swap, - "IDirect3DSwapChain9::Present"); + (void *)hook_present_swap, + "IDirect3DSwapChain9::Present"); rehook(&present_swap); } if (present_ex_addr) { - hook_init(&present_ex, present_ex_addr, - (void*)hook_present_ex, - "IDirect3DDevice9Ex::PresentEx"); + hook_init(&present_ex, present_ex_addr, (void *)hook_present_ex, + "IDirect3DDevice9Ex::PresentEx"); rehook(&present_ex); } if (present_addr) { - hook_init(&present, present_addr, - (void*)hook_present, - "IDirect3DDevice9::Present"); + hook_init(&present, present_addr, (void *)hook_present, + "IDirect3DDevice9::Present"); rehook(&present); }
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/d3d9-patches.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/d3d9-patches.hpp
Changed
@@ -12,7 +12,7 @@ #define __try #endif #ifndef __except -#define __except(x) if (0) +#define __except (x) if (0) #endif #endif #endif @@ -36,7 +36,7 @@ #ifdef NO_SEH_MINGW __except1 #else - __except(EXCEPTION_EXECUTE_HANDLER) + __except (EXCEPTION_EXECUTE_HANDLER) #endif { return -1; @@ -49,7 +49,10 @@ const BYTE *data; }; -#define NEW_PATCH(x) {sizeof(x), (x)} +#define NEW_PATCH(x) \ + { \ + sizeof(x), (x) \ + } #define MAX_PATCH_SIZE 2 static const BYTE force_jump[] = {0xEB}; @@ -57,125 +60,137 @@ #ifdef _WIN64 -#define NUM_VERS (16) -#define CMP_SIZE (13) +#define NUM_VERS (16) +#define CMP_SIZE (13) static const uintptr_t patch_offset[NUM_VERS] = { - 0x54FE6, //win7 - 6.1.7600.16385 - 0x55095, //win7 - 6.1.7601.16562 - 0x550C5, //win7 - 6.1.7601.17514 - 0x6E2FC, //win10 - 10.0.14393.0 - 0x6FE18, //win10 - 10.0.10240.16412 - 0x70050, //win10 - 10.0.10240.16384 - 0x703F8, //win10 - 10.0.10162.0 - 0x7E48C, //win10 - 10.0.10586.494 - 0x7E49C, //win10 - 10.0.10586.0 - 0x8BDB5, //win8.1 - 6.3.9431.00000 - 0x8E635, //win8.1 - 6.3.9600.17415 - 0x90352, //win8.1 - 6.3.9600.17085 - 0x9038A, //win8.1 - 6.3.9600.17095 - 0x93AFA, //win8.1 - 6.3.9600.16384 - 0x93B8A, //win8.1 - 6.3.9600.16404 - 0x1841E5 //win8 - 6.2.9200.16384 + 0x54FE6, //win7 - 6.1.7600.16385 + 0x55095, //win7 - 6.1.7601.16562 + 0x550C5, //win7 - 6.1.7601.17514 + 0x6E2FC, //win10 - 10.0.14393.0 + 0x6FE18, //win10 - 10.0.10240.16412 + 0x70050, //win10 - 10.0.10240.16384 + 0x703F8, //win10 - 10.0.10162.0 + 0x7E48C, //win10 - 10.0.10586.494 + 0x7E49C, //win10 - 10.0.10586.0 + 0x8BDB5, //win8.1 - 6.3.9431.00000 + 0x8E635, //win8.1 - 6.3.9600.17415 + 0x90352, //win8.1 - 6.3.9600.17085 + 0x9038A, //win8.1 - 6.3.9600.17095 + 0x93AFA, //win8.1 - 6.3.9600.16384 + 0x93B8A, //win8.1 - 6.3.9600.16404 + 0x1841E5 //win8 - 6.2.9200.16384 }; static const uint8_t patch_cmp[NUM_VERS][CMP_SIZE] = { -{0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0x98, 0x68, 0x50, 0x00, 0x00}, -{0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0x98, 0x68, 0x50, 0x00, 0x00}, -{0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0x98, 0x68, 0x50, 0x00, 0x00}, -{0x8b, 0x81, 0x18, 0x3e, 0x00, 0x00, 0x44, 0x39, 0x98, 0x90, 0x51, 0x00, 0x00}, -{0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, 0x00}, -{0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, 0x00}, -{0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, 0x00}, -{0x8b, 0x81, 0x18, 0x3e, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, 0x00}, -{0x8b, 0x81, 0x18, 0x3e, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, 0x00}, -{0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0xB0, 0x28, 0x51, 0x00, 0x00}, -{0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0xA8, 0x28, 0x51, 0x00, 0x00}, -{0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0xA0, 0x28, 0x51, 0x00, 0x00}, -{0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0xA0, 0x28, 0x51, 0x00, 0x00}, -{0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0xA0, 0x28, 0x51, 0x00, 0x00}, -{0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0xA0, 0x28, 0x51, 0x00, 0x00}, -{0x49, 0x8b, 0x85, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0x88, 0xc8, 0x50, 0x00, 0x00}, + {0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0x98, 0x68, 0x50, 0x00, + 0x00}, + {0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0x98, 0x68, 0x50, 0x00, + 0x00}, + {0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0x98, 0x68, 0x50, 0x00, + 0x00}, + {0x8b, 0x81, 0x18, 0x3e, 0x00, 0x00, 0x44, 0x39, 0x98, 0x90, 0x51, 0x00, + 0x00}, + {0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, + 0x00}, + {0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, + 0x00}, + {0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, + 0x00}, + {0x8b, 0x81, 0x18, 0x3e, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, + 0x00}, + {0x8b, 0x81, 0x18, 0x3e, 0x00, 0x00, 0x44, 0x39, 0x98, 0x88, 0x51, 0x00, + 0x00}, + {0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0xB0, 0x28, 0x51, 0x00, + 0x00}, + {0x48, 0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0xA8, 0x28, 0x51, 0x00, + 0x00}, + {0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0xA0, 0x28, 0x51, 0x00, + 0x00}, + {0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0xA0, 0x28, 0x51, 0x00, + 0x00}, + {0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0xA0, 0x28, 0x51, 0x00, + 0x00}, + {0x8b, 0x81, 0xb8, 0x3d, 0x00, 0x00, 0x44, 0x39, 0xA0, 0x28, 0x51, 0x00, + 0x00}, + {0x49, 0x8b, 0x85, 0xb8, 0x3d, 0x00, 0x00, 0x39, 0x88, 0xc8, 0x50, 0x00, + 0x00}, }; static const struct patch_info patch[NUM_VERS] = { - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), + NEW_PATCH(force_jump), NEW_PATCH(force_jump), NEW_PATCH(force_jump), + NEW_PATCH(force_jump), NEW_PATCH(force_jump), NEW_PATCH(force_jump), + NEW_PATCH(force_jump), NEW_PATCH(force_jump), NEW_PATCH(force_jump), + NEW_PATCH(ignore_jump), NEW_PATCH(ignore_jump), NEW_PATCH(ignore_jump), + NEW_PATCH(ignore_jump), NEW_PATCH(ignore_jump), NEW_PATCH(ignore_jump), NEW_PATCH(ignore_jump), }; #else -#define NUM_VERS (16) -#define CMP_SIZE (12) +#define NUM_VERS (16) +#define CMP_SIZE (12) static const uintptr_t patch_offset[NUM_VERS] = { - 0x79AA6, //win7 - 6.1.7601.16562 - 0x79C9E, //win7 - 6.1.7600.16385 - 0x79D96, //win7 - 6.1.7601.17514 - 0x7F9BD, //win8.1 - 6.3.9431.00000 - 0x8A3F4, //win8.1 - 6.3.9600.16404 - 0x8B15F, //win10 - 10.0.10240.16384 - 0x8B19F, //win10 - 10.0.10162.0 - 0x8B83F, //win10 - 10.0.10240.16412 - 0x8E9F7, //win8.1 - 6.3.9600.17095 - 0x8F00F, //win8.1 - 6.3.9600.17085 - 0x8FBB1, //win8.1 - 6.3.9600.16384 - 0x90264, //win8.1 - 6.3.9600.17415 - 0x90C3A, //win10 - 10.0.10586.494 - 0x90C57, //win10 - 10.0.10586.0 - 0x96673, //win10 - 10.0.14393.0 - 0x166A08 //win8 - 6.2.9200.16384 + 0x79AA6, //win7 - 6.1.7601.16562 + 0x79C9E, //win7 - 6.1.7600.16385 + 0x79D96, //win7 - 6.1.7601.17514 + 0x7F9BD, //win8.1 - 6.3.9431.00000 + 0x8A3F4, //win8.1 - 6.3.9600.16404 + 0x8B15F, //win10 - 10.0.10240.16384 + 0x8B19F, //win10 - 10.0.10162.0 + 0x8B83F, //win10 - 10.0.10240.16412 + 0x8E9F7, //win8.1 - 6.3.9600.17095 + 0x8F00F, //win8.1 - 6.3.9600.17085 + 0x8FBB1, //win8.1 - 6.3.9600.16384 + 0x90264, //win8.1 - 6.3.9600.17415 + 0x90C3A, //win10 - 10.0.10586.494 + 0x90C57, //win10 - 10.0.10586.0 + 0x96673, //win10 - 10.0.14393.0 + 0x166A08 //win8 - 6.2.9200.16384 }; static const uint8_t patch_cmp[NUM_VERS][CMP_SIZE] = { -{0x8b, 0x89, 0xe8, 0x29, 0x00, 0x00, 0x39, 0xb9, 0x80, 0x4b, 0x00, 0x00}, -{0x8b, 0x89, 0xe8, 0x29, 0x00, 0x00, 0x39, 0xb9, 0x80, 0x4b, 0x00, 0x00}, -{0x8b, 0x89, 0xe8, 0x29, 0x00, 0x00, 0x39, 0xb9, 0x80, 0x4b, 0x00, 0x00}, -{0x8b, 0x80, 0xe8, 0x29, 0x00, 0x00, 0x39, 0xb0, 0x40, 0x4c, 0x00, 0x00}, -{0x80, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, 0x00}, -{0x81, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, 0x00}, -{0x81, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, 0x00}, -{0x81, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, 0x00}, -{0x80, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, 0x00}, -{0x80, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, 0x00}, -{0x80, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, 0x00}, -{0x87, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, 0x00}, -{0x81, 0x18, 0x2a, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, 0x00}, -{0x81, 0x18, 0x2a, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, 0x00}, -{0x81, 0x18, 0x2a, 0x00, 0x00, 0x83, 0xb8, 0xa8, 0x4c, 0x00, 0x00, 0x00}, -{0x8b, 0x80, 0xe8, 0x29, 0x00, 0x00, 0x39, 0x90, 0xb0, 0x4b, 0x00, 0x00}, + {0x8b, 0x89, 0xe8, 0x29, 0x00, 0x00, 0x39, 0xb9, 0x80, 0x4b, 0x00, + 0x00}, + {0x8b, 0x89, 0xe8, 0x29, 0x00, 0x00, 0x39, 0xb9, 0x80, 0x4b, 0x00, + 0x00}, + {0x8b, 0x89, 0xe8, 0x29, 0x00, 0x00, 0x39, 0xb9, 0x80, 0x4b, 0x00, + 0x00}, + {0x8b, 0x80, 0xe8, 0x29, 0x00, 0x00, 0x39, 0xb0, 0x40, 0x4c, 0x00, + 0x00}, + {0x80, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, + 0x00}, + {0x81, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, + 0x00}, + {0x81, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, + 0x00}, + {0x81, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, + 0x00}, + {0x80, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, + 0x00}, + {0x80, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, + 0x00}, + {0x80, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, + 0x00}, + {0x87, 0xe8, 0x29, 0x00, 0x00, 0x83, 0xb8, 0x40, 0x4c, 0x00, 0x00, + 0x00}, + {0x81, 0x18, 0x2a, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, + 0x00}, + {0x81, 0x18, 0x2a, 0x00, 0x00, 0x83, 0xb8, 0xa0, 0x4c, 0x00, 0x00, + 0x00}, + {0x81, 0x18, 0x2a, 0x00, 0x00, 0x83, 0xb8, 0xa8, 0x4c, 0x00, 0x00, + 0x00}, + {0x8b, 0x80, 0xe8, 0x29, 0x00, 0x00, 0x39, 0x90, 0xb0, 0x4b, 0x00, + 0x00}, }; static const struct patch_info patch[NUM_VERS] = { - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(force_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), - NEW_PATCH(ignore_jump), + NEW_PATCH(force_jump), NEW_PATCH(force_jump), NEW_PATCH(force_jump), + NEW_PATCH(force_jump), NEW_PATCH(force_jump), NEW_PATCH(ignore_jump), + NEW_PATCH(ignore_jump), NEW_PATCH(ignore_jump), NEW_PATCH(force_jump), + NEW_PATCH(force_jump), NEW_PATCH(force_jump), NEW_PATCH(ignore_jump), + NEW_PATCH(ignore_jump), NEW_PATCH(ignore_jump), NEW_PATCH(ignore_jump), NEW_PATCH(force_jump), }; @@ -183,10 +198,10 @@ static inline int get_d3d9_patch(HMODULE d3d9) { - uint8_t *addr = (uint8_t*)d3d9; + uint8_t *addr = (uint8_t *)d3d9; for (int i = 0; i < NUM_VERS; i++) { int ret = safe_memcmp(addr + patch_offset[i], patch_cmp[i], - CMP_SIZE); + CMP_SIZE); if (ret == 0) return i; } @@ -199,6 +214,6 @@ if (patch == -1) return nullptr; - uint8_t *addr = (uint8_t*)d3d9; + uint8_t *addr = (uint8_t *)d3d9; return addr + patch_offset[patch] + CMP_SIZE; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/dxgi-capture.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/dxgi-capture.cpp
Changed
@@ -11,11 +11,12 @@ #include <d3d12.h> #endif -typedef HRESULT (STDMETHODCALLTYPE *resize_buffers_t)(IDXGISwapChain*, UINT, - UINT, UINT, DXGI_FORMAT, UINT); -typedef HRESULT (STDMETHODCALLTYPE *present_t)(IDXGISwapChain*, UINT, UINT); -typedef HRESULT (STDMETHODCALLTYPE *present1_t)(IDXGISwapChain1*, UINT, UINT, - const DXGI_PRESENT_PARAMETERS *); +typedef HRESULT(STDMETHODCALLTYPE *resize_buffers_t)(IDXGISwapChain *, UINT, + UINT, UINT, DXGI_FORMAT, + UINT); +typedef HRESULT(STDMETHODCALLTYPE *present_t)(IDXGISwapChain *, UINT, UINT); +typedef HRESULT(STDMETHODCALLTYPE *present1_t)(IDXGISwapChain1 *, UINT, UINT, + const DXGI_PRESENT_PARAMETERS *); static struct func_hook resize_buffers; static struct func_hook present; @@ -23,7 +24,7 @@ struct dxgi_swap_data { IDXGISwapChain *swap; - void (*capture)(void*, void*, bool); + void (*capture)(void *, void *, bool); void (*free)(void); }; @@ -34,9 +35,9 @@ IUnknown *device; HRESULT hr; - hr = swap->GetDevice(__uuidof(ID3D11Device), (void**)&device); + hr = swap->GetDevice(__uuidof(ID3D11Device), (void **)&device); if (SUCCEEDED(hr)) { - ID3D11Device *d3d11 = reinterpret_cast<ID3D11Device*>(device); + ID3D11Device *d3d11 = reinterpret_cast<ID3D11Device *>(device); D3D_FEATURE_LEVEL level = d3d11->GetFeatureLevel(); device->Release(); @@ -48,7 +49,7 @@ } } - hr = swap->GetDevice(__uuidof(ID3D10Device), (void**)&device); + hr = swap->GetDevice(__uuidof(ID3D10Device), (void **)&device); if (SUCCEEDED(hr)) { data.swap = swap; data.capture = d3d10_capture; @@ -57,7 +58,7 @@ return true; } - hr = swap->GetDevice(__uuidof(ID3D11Device), (void**)&device); + hr = swap->GetDevice(__uuidof(ID3D11Device), (void **)&device); if (SUCCEEDED(hr)) { data.swap = swap; data.capture = d3d11_capture; @@ -67,7 +68,7 @@ } #if COMPILE_D3D12_HOOK - hr = swap->GetDevice(__uuidof(ID3D12Device), (void**)&device); + hr = swap->GetDevice(__uuidof(ID3D12Device), (void **)&device); if (SUCCEEDED(hr)) { data.swap = swap; data.capture = d3d12_capture; @@ -83,8 +84,10 @@ static bool resize_buffers_called = false; static HRESULT STDMETHODCALLTYPE hook_resize_buffers(IDXGISwapChain *swap, - UINT buffer_count, UINT width, UINT height, DXGI_FORMAT format, - UINT flags) + UINT buffer_count, + UINT width, UINT height, + DXGI_FORMAT format, + UINT flags) { HRESULT hr; @@ -110,7 +113,7 @@ IDXGIResource *res = nullptr; HRESULT hr; - hr = swap->GetBuffer(0, __uuidof(IUnknown), (void**)&res); + hr = swap->GetBuffer(0, __uuidof(IUnknown), (void **)&res); if (FAILED(hr)) hlog_hr("get_dxgi_backbuffer: GetBuffer failed", hr); @@ -118,7 +121,7 @@ } static HRESULT STDMETHODCALLTYPE hook_present(IDXGISwapChain *swap, - UINT sync_interval, UINT flags) + UINT sync_interval, UINT flags) { IUnknown *backbuffer = nullptr; bool capture_overlay = global_hook_info->capture_overlay; @@ -168,9 +171,9 @@ return hr; } -static HRESULT STDMETHODCALLTYPE hook_present1(IDXGISwapChain1 *swap, - UINT sync_interval, UINT flags, - const DXGI_PRESENT_PARAMETERS *params) +static HRESULT STDMETHODCALLTYPE +hook_present1(IDXGISwapChain1 *swap, UINT sync_interval, UINT flags, + const DXGI_PRESENT_PARAMETERS *params) { IUnknown *backbuffer = nullptr; bool capture_overlay = global_hook_info->capture_overlay; @@ -227,7 +230,7 @@ HMODULE module = LoadLibraryA(d3dcompiler); if (module) { compile = (pD3DCompile)GetProcAddress(module, - "D3DCompile"); + "D3DCompile"); if (compile) { break; } @@ -267,9 +270,8 @@ /* ---------------------- */ hr = compile(vertex_shader_string, sizeof(vertex_shader_string), - "vertex_shader_string", nullptr, nullptr, "main", - "vs_4_0", D3D10_SHADER_OPTIMIZATION_LEVEL1, 0, &blob, - nullptr); + "vertex_shader_string", nullptr, nullptr, "main", "vs_4_0", + D3D10_SHADER_OPTIMIZATION_LEVEL1, 0, &blob, nullptr); if (FAILED(hr)) { hlog_hr("hook_dxgi: failed to compile vertex shader", hr); return true; @@ -277,15 +279,14 @@ vertex_shader_size = (size_t)blob->GetBufferSize(); memcpy(vertex_shader_data, blob->GetBufferPointer(), - blob->GetBufferSize()); + blob->GetBufferSize()); blob->Release(); /* ---------------------- */ hr = compile(pixel_shader_string, sizeof(pixel_shader_string), - "pixel_shader_string", nullptr, nullptr, "main", - "ps_4_0", D3D10_SHADER_OPTIMIZATION_LEVEL1, 0, &blob, - nullptr); + "pixel_shader_string", nullptr, nullptr, "main", "ps_4_0", + D3D10_SHADER_OPTIMIZATION_LEVEL1, 0, &blob, nullptr); if (FAILED(hr)) { hlog_hr("hook_dxgi: failed to compile pixel shader", hr); return true; @@ -293,26 +294,26 @@ pixel_shader_size = (size_t)blob->GetBufferSize(); memcpy(pixel_shader_data, blob->GetBufferPointer(), - blob->GetBufferSize()); + blob->GetBufferSize()); blob->Release(); /* ---------------------- */ present_addr = get_offset_addr(dxgi_module, - global_hook_info->offsets.dxgi.present); + global_hook_info->offsets.dxgi.present); resize_addr = get_offset_addr(dxgi_module, - global_hook_info->offsets.dxgi.resize); + global_hook_info->offsets.dxgi.resize); if (global_hook_info->offsets.dxgi.present1) - present1_addr = get_offset_addr(dxgi_module, - global_hook_info->offsets.dxgi.present1); + present1_addr = get_offset_addr( + dxgi_module, global_hook_info->offsets.dxgi.present1); - hook_init(&present, present_addr, (void*)hook_present, - "IDXGISwapChain::Present"); - hook_init(&resize_buffers, resize_addr, (void*)hook_resize_buffers, - "IDXGISwapChain::ResizeBuffers"); + hook_init(&present, present_addr, (void *)hook_present, + "IDXGISwapChain::Present"); + hook_init(&resize_buffers, resize_addr, (void *)hook_resize_buffers, + "IDXGISwapChain::ResizeBuffers"); if (present1_addr) - hook_init(&present1, present1_addr, (void*)hook_present1, - "IDXGISwapChain1::Present1"); + hook_init(&present1, present1_addr, (void *)hook_present1, + "IDXGISwapChain1::Present1"); rehook(&resize_buffers); rehook(&present);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/dxgi-helpers.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/dxgi-helpers.hpp
Changed
@@ -3,12 +3,11 @@ static inline DXGI_FORMAT fix_dxgi_format(DXGI_FORMAT format) { switch ((unsigned long)format) { - case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: - return DXGI_FORMAT_B8G8R8A8_UNORM; - case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: - return DXGI_FORMAT_R8G8B8A8_UNORM; + case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: + return DXGI_FORMAT_B8G8R8A8_UNORM; + case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: + return DXGI_FORMAT_R8G8B8A8_UNORM; } return format; } -
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/gl-capture.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/gl-capture.c
Changed
@@ -15,11 +15,15 @@ #define DUMMY_WINDOW_CLASS_NAME L"graphics_hook_gl_dummy_window" +/* clang-format off */ + static const GUID GUID_IDXGIFactory1 = {0x770aae78, 0xf26f, 0x4dba, {0xa8, 0x29, 0x25, 0x3c, 0x83, 0xd1, 0xb3, 0x87}}; static const GUID GUID_IDXGIResource = {0x035f3ab4, 0x482e, 0x4e50, {0xb4, 0x1f, 0x8a, 0x7f, 0x8b, 0xd8, 0x96, 0x0b}}; +/* clang-format on */ + static struct func_hook swap_buffers; static struct func_hook wgl_swap_layer_buffers; static struct func_hook wgl_swap_buffers; @@ -28,40 +32,40 @@ static bool darkest_dungeon_fix = false; struct gl_data { - HDC hdc; - uint32_t base_cx; - uint32_t base_cy; - uint32_t cx; - uint32_t cy; - DXGI_FORMAT format; - GLuint fbo; - bool using_shtex; - bool using_scale; - bool shmem_fallback; + HDC hdc; + uint32_t base_cx; + uint32_t base_cy; + uint32_t cx; + uint32_t cy; + DXGI_FORMAT format; + GLuint fbo; + bool using_shtex; + bool using_scale; + bool shmem_fallback; union { /* shared texture */ struct { - struct shtex_data *shtex_info; - ID3D11Device *d3d11_device; - ID3D11DeviceContext *d3d11_context; - ID3D11Texture2D *d3d11_tex; - IDXGISwapChain *dxgi_swap; - HANDLE gl_device; - HANDLE gl_dxobj; - HANDLE handle; - HWND hwnd; - GLuint texture; + struct shtex_data *shtex_info; + ID3D11Device *d3d11_device; + ID3D11DeviceContext *d3d11_context; + ID3D11Texture2D *d3d11_tex; + IDXGISwapChain *dxgi_swap; + HANDLE gl_device; + HANDLE gl_dxobj; + HANDLE handle; + HWND hwnd; + GLuint texture; }; /* shared memory */ struct { - struct shmem_data *shmem_info; - int cur_tex; - int copy_wait; - GLuint pbos[NUM_BUFFERS]; - GLuint textures[NUM_BUFFERS]; - bool texture_ready[NUM_BUFFERS]; - bool texture_mapped[NUM_BUFFERS]; + struct shmem_data *shmem_info; + int cur_tex; + int copy_wait; + GLuint pbos[NUM_BUFFERS]; + GLuint textures[NUM_BUFFERS]; + bool texture_ready[NUM_BUFFERS]; + bool texture_mapped[NUM_BUFFERS]; }; }; }; @@ -88,7 +92,7 @@ if (data.using_shtex) { if (data.gl_dxobj) jimglDXUnregisterObjectNV(data.gl_device, - data.gl_dxobj); + data.gl_dxobj); if (data.gl_device) jimglDXCloseDeviceNV(data.gl_device); if (data.texture) @@ -108,7 +112,7 @@ if (data.pbos[i]) { if (data.texture_mapped[i]) { glBindBuffer(GL_PIXEL_PACK_BUFFER, - data.pbos[i]); + data.pbos[i]); glUnmapBuffer(GL_PIXEL_PACK_BUFFER); glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); } @@ -133,12 +137,12 @@ static inline void *base_get_proc(const char *name) { - return (void*)GetProcAddress(gl, name); + return (void *)GetProcAddress(gl, name); } static inline void *wgl_get_proc(const char *name) { - return (void*)jimglGetProcAddress(name); + return (void *)jimglGetProcAddress(name); } static inline void *get_proc(const char *name) @@ -163,27 +167,23 @@ jimglDXUnlockObjectsNV = get_proc("wglDXUnlockObjectsNV"); nv_capture_available = - !!jimglDXSetResourceShareHandleNV && - !!jimglDXOpenDeviceNV && - !!jimglDXCloseDeviceNV && - !!jimglDXRegisterObjectNV && - !!jimglDXUnregisterObjectNV && - !!jimglDXObjectAccessNV && - !!jimglDXLockObjectsNV && - !!jimglDXUnlockObjectsNV; + !!jimglDXSetResourceShareHandleNV && !!jimglDXOpenDeviceNV && + !!jimglDXCloseDeviceNV && !!jimglDXRegisterObjectNV && + !!jimglDXUnregisterObjectNV && !!jimglDXObjectAccessNV && + !!jimglDXLockObjectsNV && !!jimglDXUnlockObjectsNV; if (nv_capture_available) hlog("Shared-texture OpenGL capture available"); } -#define GET_PROC(cur_func, ptr, func) \ - do { \ - ptr = get_proc(#func); \ - if (!ptr) { \ +#define GET_PROC(cur_func, ptr, func) \ + do { \ + ptr = get_proc(#func); \ + if (!ptr) { \ hlog("%s: failed to get function '%s'", #cur_func, \ - #func); \ - success = false; \ - } \ + #func); \ + success = false; \ + } \ } while (false) static bool init_gl_functions(void) @@ -199,7 +199,7 @@ GET_PROC(init_gl_functions, jimglMakeCurrent, wglMakeCurrent); GET_PROC(init_gl_functions, jimglGetCurrentDC, wglGetCurrentDC); GET_PROC(init_gl_functions, jimglGetCurrentContext, - wglGetCurrentContext); + wglGetCurrentContext); GET_PROC(init_gl_functions, glTexImage2D, glTexImage2D); GET_PROC(init_gl_functions, glReadBuffer, glReadBuffer); GET_PROC(init_gl_functions, glGetTexImage, glGetTexImage); @@ -220,7 +220,7 @@ GET_PROC(init_gl_functions, glBindFramebuffer, glBindFramebuffer); GET_PROC(init_gl_functions, glBlitFramebuffer, glBlitFramebuffer); GET_PROC(init_gl_functions, glFramebufferTexture2D, - glFramebufferTexture2D); + glFramebufferTexture2D); init_nv_functions(); return success; @@ -229,7 +229,7 @@ static void get_window_size(HDC hdc, uint32_t *cx, uint32_t *cy) { HWND hwnd = WindowFromDC(hdc); - RECT rc = {0}; + RECT rc = {0}; if (darkest_dungeon_fix) { *cx = 1920; @@ -243,23 +243,22 @@ static inline bool gl_shtex_init_window(void) { - data.hwnd = CreateWindowExW(0, DUMMY_WINDOW_CLASS_NAME, - L"Dummy GL window, ignore", - WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, - 0, 0, 2, 2, NULL, NULL, GetModuleHandle(NULL), NULL); + data.hwnd = CreateWindowExW( + 0, DUMMY_WINDOW_CLASS_NAME, L"Dummy GL window, ignore", + WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, 2, 2, NULL, + NULL, GetModuleHandle(NULL), NULL); if (!data.hwnd) { hlog("gl_shtex_init_window: failed to create window: %d", - GetLastError()); + GetLastError()); return false; } return true; } -typedef HRESULT (WINAPI *create_dxgi_factory1_t)(REFIID, void **); +typedef HRESULT(WINAPI *create_dxgi_factory1_t)(REFIID, void **); -static const D3D_FEATURE_LEVEL feature_levels[] = -{ +static const D3D_FEATURE_LEVEL feature_levels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, @@ -276,37 +275,38 @@ HMODULE d3d11 = load_system_library("d3d11.dll"); if (!d3d11) { hlog("gl_shtex_init_d3d11: failed to load D3D11.dll: %d", - GetLastError()); + GetLastError()); return false; } HMODULE dxgi = load_system_library("dxgi.dll"); if (!dxgi) { hlog("gl_shtex_init_d3d11: failed to load DXGI.dll: %d", - GetLastError()); + GetLastError()); return false; } - DXGI_SWAP_CHAIN_DESC desc = {0}; - desc.BufferCount = 2; - desc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; - desc.BufferDesc.Width = 2; - desc.BufferDesc.Height = 2; - desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - desc.SampleDesc.Count = 1; - desc.Windowed = true; - desc.OutputWindow = data.hwnd; + DXGI_SWAP_CHAIN_DESC desc = {0}; + desc.BufferCount = 2; + desc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + desc.BufferDesc.Width = 2; + desc.BufferDesc.Height = 2; + desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + desc.SampleDesc.Count = 1; + desc.Windowed = true; + desc.OutputWindow = data.hwnd; - create_dxgi_factory1_t create_factory = (void*)GetProcAddress(dxgi, - "CreateDXGIFactory1"); + create_dxgi_factory1_t create_factory = + (void *)GetProcAddress(dxgi, "CreateDXGIFactory1"); if (!create_factory) { hlog("gl_shtex_init_d3d11: failed to load CreateDXGIFactory1 " - "procedure: %d", GetLastError()); + "procedure: %d", + GetLastError()); return false; } - PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN create = (void*)GetProcAddress( - d3d11, "D3D11CreateDeviceAndSwapChain"); + PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN create = + (void *)GetProcAddress(d3d11, "D3D11CreateDeviceAndSwapChain"); if (!create) { hlog("gl_shtex_init_d3d11: failed to load " "D3D11CreateDeviceAndSwapChain procedure: %d", @@ -314,13 +314,14 @@ return false; } - hr = create_factory(&GUID_IDXGIFactory1, (void**)&factory); + hr = create_factory(&GUID_IDXGIFactory1, (void **)&factory); if (FAILED(hr)) { hlog_hr("gl_shtex_init_d3d11: failed to create factory", hr); return false; } - hr = IDXGIFactory1_EnumAdapters1(factory, 0, (IDXGIAdapter1**)&adapter); + hr = IDXGIFactory1_EnumAdapters1(factory, 0, + (IDXGIAdapter1 **)&adapter); IDXGIFactory1_Release(factory); if (FAILED(hr)) { @@ -329,9 +330,9 @@ } hr = create(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, 0, feature_levels, - sizeof(feature_levels) / sizeof(D3D_FEATURE_LEVEL), - D3D11_SDK_VERSION, &desc, &data.dxgi_swap, - &data.d3d11_device, &level_used, &data.d3d11_context); + sizeof(feature_levels) / sizeof(D3D_FEATURE_LEVEL), + D3D11_SDK_VERSION, &desc, &data.dxgi_swap, + &data.d3d11_device, &level_used, &data.d3d11_context); IDXGIAdapter_Release(adapter); if (FAILED(hr)) { @@ -347,31 +348,30 @@ IDXGIResource *dxgi_res; HRESULT hr; - D3D11_TEXTURE2D_DESC desc = {0}; - desc.Width = data.cx; - desc.Height = data.cy; - desc.MipLevels = 1; - desc.ArraySize = 1; - desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; - desc.SampleDesc.Count = 1; - desc.Usage = D3D11_USAGE_DEFAULT; - desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; - desc.BindFlags = D3D11_BIND_RENDER_TARGET | - D3D11_BIND_SHADER_RESOURCE; + D3D11_TEXTURE2D_DESC desc = {0}; + desc.Width = data.cx; + desc.Height = data.cy; + desc.MipLevels = 1; + desc.ArraySize = 1; + desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + desc.SampleDesc.Count = 1; + desc.Usage = D3D11_USAGE_DEFAULT; + desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; + desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE; hr = ID3D11Device_CreateTexture2D(data.d3d11_device, &desc, NULL, - &data.d3d11_tex); + &data.d3d11_tex); if (FAILED(hr)) { hlog_hr("gl_shtex_init_d3d11_tex: failed to create texture", - hr); + hr); return false; } - hr = ID3D11Device_QueryInterface(data.d3d11_tex, - &GUID_IDXGIResource, (void**)&dxgi_res); + hr = ID3D11Device_QueryInterface(data.d3d11_tex, &GUID_IDXGIResource, + (void **)&dxgi_res); if (FAILED(hr)) { hlog_hr("gl_shtex_init_d3d11_tex: failed to get IDXGIResource", - hr); + hr); return false; } @@ -380,7 +380,7 @@ if (FAILED(hr)) { hlog_hr("gl_shtex_init_d3d11_tex: failed to get shared handle", - hr); + hr); return false; } @@ -401,8 +401,8 @@ } data.gl_dxobj = jimglDXRegisterObjectNV(data.gl_device, data.d3d11_tex, - data.texture, GL_TEXTURE_2D, - WGL_ACCESS_WRITE_DISCARD_NV); + data.texture, GL_TEXTURE_2D, + WGL_ACCESS_WRITE_DISCARD_NV); if (!data.gl_dxobj) { hlog("gl_shtex_init_gl_tex: failed to register object"); return false; @@ -434,9 +434,9 @@ if (!gl_init_fbo()) { return false; } - if (!capture_init_shtex(&data.shtex_info, window, - data.base_cx, data.base_cy, data.cx, data.cy, - data.format, true, (uintptr_t)data.handle)) { + if (!capture_init_shtex(&data.shtex_info, window, data.base_cx, + data.base_cy, data.cx, data.cy, data.format, + true, (uintptr_t)data.handle)) { return false; } @@ -461,8 +461,8 @@ return false; } - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, data.cx, data.cy, - 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, data.cx, data.cy, 0, GL_BGRA, + GL_UNSIGNED_BYTE, NULL); if (gl_error("gl_shmem_init_data", "failed to set texture data")) { return false; } @@ -488,7 +488,7 @@ glGetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &last_pbo); if (gl_error("gl_shmem_init_buffers", - "failed to save pixel pack buffer")) { + "failed to save pixel pack buffer")) { return false; } @@ -516,9 +516,9 @@ if (!gl_init_fbo()) { return false; } - if (!capture_init_shmem(&data.shmem_info, window, - data.base_cx, data.base_cy, data.cx, data.cy, - data.cx * 4, data.format, true)) { + if (!capture_init_shmem(&data.shmem_info, window, data.base_cx, + data.base_cy, data.cx, data.cy, data.cx * 4, + data.format, true)) { return false; } @@ -526,9 +526,9 @@ return true; } -#define INIT_SUCCESS 0 -#define INIT_FAILED -1 -#define INIT_SHTEX_FAILED -2 +#define INIT_SUCCESS 0 +#define INIT_FAILED -1 +#define INIT_SHTEX_FAILED -2 static int gl_init(HDC hdc) { @@ -550,8 +550,8 @@ data.format = DXGI_FORMAT_B8G8R8A8_UNORM; data.using_scale = global_hook_info->use_scale; data.using_shtex = nv_capture_available && - !global_hook_info->force_shmem && - !data.shmem_fallback; + !global_hook_info->force_shmem && + !data.shmem_fallback; if (data.using_scale) { data.cx = global_hook_info->cx; @@ -590,7 +590,7 @@ } glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, dst, 0); + GL_TEXTURE_2D, dst, 0); if (gl_error("gl_copy_backbuffer", "failed to set frame buffer")) { return; } @@ -598,17 +598,16 @@ glReadBuffer(GL_BACK); /* darkest dungeon fix */ - darkest_dungeon_fix = - glGetError() == GL_INVALID_OPERATION && - _strcmpi(process_name, "Darkest.exe") == 0; + darkest_dungeon_fix = glGetError() == GL_INVALID_OPERATION && + _strcmpi(process_name, "Darkest.exe") == 0; glDrawBuffer(GL_COLOR_ATTACHMENT0); if (gl_error("gl_copy_backbuffer", "failed to set draw buffer")) { return; } - glBlitFramebuffer(0, 0, data.base_cx, data.base_cy, - 0, 0, data.cx, data.cy, GL_COLOR_BUFFER_BIT, GL_LINEAR); + glBlitFramebuffer(0, 0, data.base_cx, data.base_cy, 0, 0, data.cx, + data.cy, GL_COLOR_BUFFER_BIT, GL_LINEAR); gl_error("gl_copy_backbuffer", "failed to blit"); } @@ -649,11 +648,12 @@ glBindBuffer(GL_PIXEL_PACK_BUFFER, data.pbos[i]); if (gl_error("gl_shmem_capture_queue_copy", - "failed to bind pbo")) { + "failed to bind pbo")) { return; } - buffer = glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); + buffer = + glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); if (buffer) { data.texture_mapped[i] = true; shmem_copy_data(i, buffer); @@ -779,7 +779,7 @@ gl_capture(hdc); unhook(&swap_buffers); - BOOL (WINAPI *call)(HDC) = swap_buffers.call_addr; + BOOL(WINAPI * call)(HDC) = swap_buffers.call_addr; ret = call(hdc); rehook(&swap_buffers); @@ -797,7 +797,7 @@ gl_capture(hdc); unhook(&wgl_swap_buffers); - BOOL (WINAPI *call)(HDC) = wgl_swap_buffers.call_addr; + BOOL(WINAPI * call)(HDC) = wgl_swap_buffers.call_addr; ret = call(hdc); rehook(&wgl_swap_buffers); @@ -815,7 +815,7 @@ gl_capture(hdc); unhook(&wgl_swap_layer_buffers); - BOOL (WINAPI *call)(HDC, UINT) = wgl_swap_layer_buffers.call_addr; + BOOL(WINAPI * call)(HDC, UINT) = wgl_swap_layer_buffers.call_addr; ret = call(hdc, planes); rehook(&wgl_swap_layer_buffers); @@ -839,7 +839,7 @@ } unhook(&wgl_delete_context); - BOOL (WINAPI *call)(HGLRC) = wgl_delete_context.call_addr; + BOOL(WINAPI * call)(HGLRC) = wgl_delete_context.call_addr; ret = call(hrc); rehook(&wgl_delete_context); @@ -856,7 +856,7 @@ if (!RegisterClassW(&wc)) { hlog("gl_register_window: failed to register window class: %d", - GetLastError()); + GetLastError()); return false; } @@ -878,7 +878,7 @@ * the same time, so blacklist it from capturing opengl */ const char *process_name = get_process_name(); if (_strcmpi(process_name, "yo_cm_client.exe") == 0 || - _strcmpi(process_name, "cm_client.exe") == 0) { + _strcmpi(process_name, "cm_client.exe") == 0) { hlog("Ignoring opengl for game: %s", process_name); return true; } @@ -894,20 +894,17 @@ hook_init(&swap_buffers, SwapBuffers, hook_swap_buffers, "SwapBuffers"); if (wgl_dc_proc) { hook_init(&wgl_delete_context, wgl_dc_proc, - hook_wgl_delete_context, - "wglDeleteContext"); + hook_wgl_delete_context, "wglDeleteContext"); rehook(&wgl_delete_context); } if (wgl_slb_proc) { hook_init(&wgl_swap_layer_buffers, wgl_slb_proc, - hook_wgl_swap_layer_buffers, - "wglSwapLayerBuffers"); + hook_wgl_swap_layer_buffers, "wglSwapLayerBuffers"); rehook(&wgl_swap_layer_buffers); } if (wgl_sb_proc) { - hook_init(&wgl_swap_buffers, wgl_sb_proc, - hook_wgl_swap_buffers, - "wglSwapBuffers"); + hook_init(&wgl_swap_buffers, wgl_sb_proc, hook_wgl_swap_buffers, + "wglSwapBuffers"); rehook(&wgl_swap_buffers); }
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/gl-decs.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/gl-decs.h
Changed
@@ -69,51 +69,57 @@ #define GL_COLOR_ATTACHMENT0 0x8CE0 #define GL_COLOR_ATTACHMENT1 0x8CE1 -typedef void (WINAPI *GLTEXIMAGE2DPROC)(GLenum target, GLint level, - GLint internal_format, GLsizei width, GLsizei height, - GLint border, GLenum format, GLenum type, const GLvoid *data); -typedef void (WINAPI *GLGETTEXIMAGEPROC)(GLenum target, GLint level, - GLenum format, GLenum type, GLvoid *img); -typedef void (WINAPI *GLREADBUFFERPROC)(GLenum); -typedef void (WINAPI *GLDRAWBUFFERPROC)(GLenum mode); -typedef void (WINAPI *GLGETINTEGERVPROC)(GLenum pname, GLint *params); -typedef GLenum (WINAPI *GLGETERRORPROC)(); -typedef BOOL (WINAPI *WGLSWAPLAYERBUFFERSPROC)(HDC, UINT); -typedef BOOL (WINAPI *WGLSWAPBUFFERSPROC)(HDC); -typedef BOOL (WINAPI *WGLDELETECONTEXTPROC)(HGLRC); -typedef PROC (WINAPI *WGLGETPROCADDRESSPROC)(LPCSTR); -typedef BOOL (WINAPI *WGLMAKECURRENTPROC)(HDC, HGLRC); -typedef HDC (WINAPI *WGLGETCURRENTDCPROC)(); -typedef HGLRC (WINAPI *WGLGETCURRENTCONTEXTPROC)(); -typedef HGLRC (WINAPI *WGLCREATECONTEXTPROC)(HDC); -typedef void (WINAPI *GLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, - const GLvoid* data, GLenum usage); -typedef void (WINAPI *GLDELETEBUFFERSARBPROC)(GLsizei n, const GLuint* buffers); -typedef void (WINAPI *GLDELETETEXTURESPROC)(GLsizei n, const GLuint* buffers); -typedef void (WINAPI *GLGENBUFFERSARBPROC)(GLsizei n, GLuint* buffers); -typedef void (WINAPI *GLGENTEXTURESPROC)(GLsizei n, GLuint* textures); -typedef GLvoid* (WINAPI *GLMAPBUFFERPROC)(GLenum target, GLenum access); -typedef GLboolean (WINAPI *GLUNMAPBUFFERPROC)(GLenum target); -typedef void (WINAPI *GLBINDBUFFERPROC)(GLenum target, GLuint buffer); -typedef void (WINAPI *GLBINDTEXTUREPROC)(GLenum target, GLuint texture); -typedef void (WINAPI *GLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint* buffers); -typedef void (WINAPI *GLDELETEFRAMEBUFFERSPROC)(GLsizei n, - GLuint *framebuffers); -typedef void (WINAPI *GLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); -typedef void (WINAPI *GLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, - GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, - GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef void (WINAPI *GLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, - GLenum attachment, GLenum textarget, GLuint texture, - GLint level); -typedef BOOL (WINAPI *WGLSETRESOURCESHAREHANDLENVPROC)(void*, HANDLE); -typedef HANDLE (WINAPI *WGLDXOPENDEVICENVPROC)(void*); -typedef BOOL (WINAPI *WGLDXCLOSEDEVICENVPROC)(HANDLE); -typedef HANDLE (WINAPI *WGLDXREGISTEROBJECTNVPROC)(HANDLE, void *, GLuint, GLenum, GLenum); -typedef BOOL (WINAPI *WGLDXUNREGISTEROBJECTNVPROC)(HANDLE, HANDLE); -typedef BOOL (WINAPI *WGLDXOBJECTACCESSNVPROC)(HANDLE, GLenum); -typedef BOOL (WINAPI *WGLDXLOCKOBJECTSNVPROC)(HANDLE, GLint, HANDLE *); -typedef BOOL (WINAPI *WGLDXUNLOCKOBJECTSNVPROC)(HANDLE, GLint, HANDLE *); +typedef void(WINAPI *GLTEXIMAGE2DPROC)(GLenum target, GLint level, + GLint internal_format, GLsizei width, + GLsizei height, GLint border, + GLenum format, GLenum type, + const GLvoid *data); +typedef void(WINAPI *GLGETTEXIMAGEPROC)(GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *img); +typedef void(WINAPI *GLREADBUFFERPROC)(GLenum); +typedef void(WINAPI *GLDRAWBUFFERPROC)(GLenum mode); +typedef void(WINAPI *GLGETINTEGERVPROC)(GLenum pname, GLint *params); +typedef GLenum(WINAPI *GLGETERRORPROC)(); +typedef BOOL(WINAPI *WGLSWAPLAYERBUFFERSPROC)(HDC, UINT); +typedef BOOL(WINAPI *WGLSWAPBUFFERSPROC)(HDC); +typedef BOOL(WINAPI *WGLDELETECONTEXTPROC)(HGLRC); +typedef PROC(WINAPI *WGLGETPROCADDRESSPROC)(LPCSTR); +typedef BOOL(WINAPI *WGLMAKECURRENTPROC)(HDC, HGLRC); +typedef HDC(WINAPI *WGLGETCURRENTDCPROC)(); +typedef HGLRC(WINAPI *WGLGETCURRENTCONTEXTPROC)(); +typedef HGLRC(WINAPI *WGLCREATECONTEXTPROC)(HDC); +typedef void(WINAPI *GLBUFFERDATAARBPROC)(GLenum target, GLsizeiptrARB size, + const GLvoid *data, GLenum usage); +typedef void(WINAPI *GLDELETEBUFFERSARBPROC)(GLsizei n, const GLuint *buffers); +typedef void(WINAPI *GLDELETETEXTURESPROC)(GLsizei n, const GLuint *buffers); +typedef void(WINAPI *GLGENBUFFERSARBPROC)(GLsizei n, GLuint *buffers); +typedef void(WINAPI *GLGENTEXTURESPROC)(GLsizei n, GLuint *textures); +typedef GLvoid *(WINAPI *GLMAPBUFFERPROC)(GLenum target, GLenum access); +typedef GLboolean(WINAPI *GLUNMAPBUFFERPROC)(GLenum target); +typedef void(WINAPI *GLBINDBUFFERPROC)(GLenum target, GLuint buffer); +typedef void(WINAPI *GLBINDTEXTUREPROC)(GLenum target, GLuint texture); +typedef void(WINAPI *GLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *buffers); +typedef void(WINAPI *GLDELETEFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); +typedef void(WINAPI *GLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); +typedef void(WINAPI *GLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, + GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, + GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); +typedef void(WINAPI *GLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, GLint level); +typedef BOOL(WINAPI *WGLSETRESOURCESHAREHANDLENVPROC)(void *, HANDLE); +typedef HANDLE(WINAPI *WGLDXOPENDEVICENVPROC)(void *); +typedef BOOL(WINAPI *WGLDXCLOSEDEVICENVPROC)(HANDLE); +typedef HANDLE(WINAPI *WGLDXREGISTEROBJECTNVPROC)(HANDLE, void *, GLuint, + GLenum, GLenum); +typedef BOOL(WINAPI *WGLDXUNREGISTEROBJECTNVPROC)(HANDLE, HANDLE); +typedef BOOL(WINAPI *WGLDXOBJECTACCESSNVPROC)(HANDLE, GLenum); +typedef BOOL(WINAPI *WGLDXLOCKOBJECTSNVPROC)(HANDLE, GLint, HANDLE *); +typedef BOOL(WINAPI *WGLDXUNLOCKOBJECTSNVPROC)(HANDLE, GLint, HANDLE *); static GLTEXIMAGE2DPROC glTexImage2D = NULL; static GLGETTEXIMAGEPROC glGetTexImage = NULL;
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/graphics-hook.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/graphics-hook.c
Changed
@@ -13,45 +13,44 @@ #endif struct thread_data { - CRITICAL_SECTION mutexes[NUM_BUFFERS]; - CRITICAL_SECTION data_mutex; - void *volatile cur_data; - uint8_t *shmem_textures[2]; - HANDLE copy_thread; - HANDLE copy_event; - HANDLE stop_event; - volatile int cur_tex; - unsigned int pitch; - unsigned int cy; - volatile bool locked_textures[NUM_BUFFERS]; + CRITICAL_SECTION mutexes[NUM_BUFFERS]; + CRITICAL_SECTION data_mutex; + void *volatile cur_data; + uint8_t *shmem_textures[2]; + HANDLE copy_thread; + HANDLE copy_event; + HANDLE stop_event; + volatile int cur_tex; + unsigned int pitch; + unsigned int cy; + volatile bool locked_textures[NUM_BUFFERS]; }; -ipc_pipe_client_t pipe = {0}; -HANDLE signal_restart = NULL; -HANDLE signal_stop = NULL; -HANDLE signal_ready = NULL; -HANDLE signal_exit = NULL; -static HANDLE signal_init = NULL; -HANDLE tex_mutexes[2] = {NULL, NULL}; -static HANDLE filemap_hook_info = NULL; +ipc_pipe_client_t pipe = {0}; +HANDLE signal_restart = NULL; +HANDLE signal_stop = NULL; +HANDLE signal_ready = NULL; +HANDLE signal_exit = NULL; +static HANDLE signal_init = NULL; +HANDLE tex_mutexes[2] = {NULL, NULL}; +static HANDLE filemap_hook_info = NULL; -static HINSTANCE dll_inst = NULL; -static volatile bool stop_loop = false; -static HANDLE capture_thread = NULL; -char system_path[MAX_PATH] = {0}; -char process_name[MAX_PATH] = {0}; -wchar_t keepalive_name[64] = {0}; -HWND dummy_window = NULL; +static HINSTANCE dll_inst = NULL; +static volatile bool stop_loop = false; +static HANDLE capture_thread = NULL; +char system_path[MAX_PATH] = {0}; +char process_name[MAX_PATH] = {0}; +wchar_t keepalive_name[64] = {0}; +HWND dummy_window = NULL; -static unsigned int shmem_id_counter = 0; -static void *shmem_info = NULL; -static HANDLE shmem_file_handle = 0; +static unsigned int shmem_id_counter = 0; +static void *shmem_info = NULL; +static HANDLE shmem_file_handle = 0; -static struct thread_data thread_data = {0}; - -volatile bool active = false; -struct hook_info *global_hook_info = NULL; +static struct thread_data thread_data = {0}; +volatile bool active = false; +struct hook_info *global_hook_info = NULL; static inline void wait_for_dll_main_finish(HANDLE thread_handle) { @@ -153,7 +152,7 @@ static inline void log_current_process(void) { DWORD len = GetModuleBaseNameA(GetCurrentProcess(), NULL, process_name, - MAX_PATH); + MAX_PATH); if (len > 0) { process_name[len] = 0; hlog("Hooked to process: %s", process_name); @@ -167,15 +166,15 @@ filemap_hook_info = create_hook_info(GetCurrentProcessId()); if (!filemap_hook_info) { hlog("Failed to create hook info file mapping: %lu", - GetLastError()); + GetLastError()); return false; } global_hook_info = MapViewOfFile(filemap_hook_info, FILE_MAP_ALL_ACCESS, - 0, 0, sizeof(struct hook_info)); + 0, 0, sizeof(struct hook_info)); if (!global_hook_info) { hlog("Failed to map the hook info file mapping: %lu", - GetLastError()); + GetLastError()); return false; } @@ -198,12 +197,13 @@ if (!RegisterClass(&wc)) { hlog("Failed to create temp D3D window class: %lu", - GetLastError()); + GetLastError()); return 0; } dummy_window = CreateWindowExW(0, dummy_window_class, L"Temp Window", - DEF_FLAGS, 0, 0, 1, 1, NULL, NULL, dll_inst, NULL); + DEF_FLAGS, 0, 0, 1, 1, NULL, NULL, + dll_inst, NULL); if (!dummy_window) { hlog("Failed to create temp D3D window: %lu", GetLastError()); return 0; @@ -220,11 +220,11 @@ static inline void init_dummy_window_thread(void) { - HANDLE thread = CreateThread(NULL, 0, dummy_window_thread, NULL, 0, - NULL); + HANDLE thread = + CreateThread(NULL, 0, dummy_window_thread, NULL, 0, NULL); if (!thread) { hlog("Failed to create temp D3D window thread: %lu", - GetLastError()); + GetLastError()); return; } @@ -236,7 +236,7 @@ wait_for_dll_main_finish(thread_handle); _snwprintf(keepalive_name, sizeof(keepalive_name) / sizeof(wchar_t), - L"%s%lu", WINDOW_HOOK_KEEPALIVE, GetCurrentProcessId()); + L"%s%lu", WINDOW_HOOK_KEEPALIVE, GetCurrentProcessId()); init_pipe(); @@ -283,35 +283,35 @@ static inline bool ddraw_hookable(void) { return !!global_hook_info->offsets.ddraw.surface_create && - !!global_hook_info->offsets.ddraw.surface_restore && - !!global_hook_info->offsets.ddraw.surface_release && - !!global_hook_info->offsets.ddraw.surface_unlock && - !!global_hook_info->offsets.ddraw.surface_blt && - !!global_hook_info->offsets.ddraw.surface_flip && - !!global_hook_info->offsets.ddraw.surface_set_palette && - !!global_hook_info->offsets.ddraw.palette_set_entries; + !!global_hook_info->offsets.ddraw.surface_restore && + !!global_hook_info->offsets.ddraw.surface_release && + !!global_hook_info->offsets.ddraw.surface_unlock && + !!global_hook_info->offsets.ddraw.surface_blt && + !!global_hook_info->offsets.ddraw.surface_flip && + !!global_hook_info->offsets.ddraw.surface_set_palette && + !!global_hook_info->offsets.ddraw.palette_set_entries; } static inline bool d3d9_hookable(void) { return !!global_hook_info->offsets.d3d9.present && - !!global_hook_info->offsets.d3d9.present_ex && - !!global_hook_info->offsets.d3d9.present_swap; + !!global_hook_info->offsets.d3d9.present_ex && + !!global_hook_info->offsets.d3d9.present_swap; } static inline bool dxgi_hookable(void) { return !!global_hook_info->offsets.dxgi.present && - !!global_hook_info->offsets.dxgi.resize; + !!global_hook_info->offsets.dxgi.resize; } static inline bool attempt_hook(void) { //static bool ddraw_hooked = false; - static bool d3d8_hooked = false; - static bool d3d9_hooked = false; - static bool dxgi_hooked = false; - static bool gl_hooked = false; + static bool d3d8_hooked = false; + static bool d3d9_hooked = false; + static bool dxgi_hooked = false; + static bool gl_hooked = false; if (!d3d9_hooked) { if (!d3d9_hookable()) { @@ -342,7 +342,7 @@ if (gl_hooked) { return true; } - /*} else { + /*} else { rehook_gl();*/ } @@ -381,7 +381,8 @@ for (size_t n = 0; !stop_loop; n++) { /* this causes it to check every 4 seconds, but still with * a small sleep interval in case the thread needs to stop */ - if (n % 100 == 0) attempt_hook(); + if (n % 100 == 0) + attempt_hook(); Sleep(40); } } @@ -425,10 +426,10 @@ LPSTR buffer = NULL; FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, hr, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), - (LPSTR)&buffer, 0, NULL); + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, hr, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), + (LPSTR)&buffer, 0, NULL); if (buffer) { hlog("%s (0x%08lX): %s", text, hr, buffer); @@ -492,30 +493,31 @@ static inline bool init_shared_info(size_t size) { wchar_t name[64]; - _snwprintf(name, 64, L"%s%ld", SHMEM_TEXTURE, ++shmem_id_counter); + _snwprintf(name, 64, L"%s%u", SHMEM_TEXTURE, ++shmem_id_counter); shmem_file_handle = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, - PAGE_READWRITE, 0, (DWORD)size, name); + PAGE_READWRITE, 0, (DWORD)size, + name); if (!shmem_file_handle) { hlog("init_shared_info: Failed to create shared memory: %d", - GetLastError()); + GetLastError()); return false; } - shmem_info = MapViewOfFile(shmem_file_handle, FILE_MAP_ALL_ACCESS, - 0, 0, size); + shmem_info = MapViewOfFile(shmem_file_handle, FILE_MAP_ALL_ACCESS, 0, 0, + size); if (!shmem_info) { hlog("init_shared_info: Failed to map shared memory: %d", - GetLastError()); + GetLastError()); return false; } return true; } -bool capture_init_shtex(struct shtex_data **data, HWND window, - uint32_t base_cx, uint32_t base_cy, uint32_t cx, uint32_t cy, - uint32_t format, bool flip, uintptr_t handle) +bool capture_init_shtex(struct shtex_data **data, HWND window, uint32_t base_cx, + uint32_t base_cy, uint32_t cx, uint32_t cy, + uint32_t format, bool flip, uintptr_t handle) { if (!init_shared_info(sizeof(struct shtex_data))) { hlog("capture_init_shtex: Failed to initialize memory"); @@ -538,7 +540,7 @@ if (!SetEvent(signal_ready)) { hlog("capture_init_shtex: Failed to signal ready: %d", - GetLastError()); + GetLastError()); return false; } @@ -555,13 +557,13 @@ if (!duplicate_handle(&events[0], thread_data.copy_event)) { hlog_hr("copy_thread: Failed to duplicate copy event: %d", - GetLastError()); + GetLastError()); return 0; } if (!duplicate_handle(&events[1], thread_data.stop_event)) { hlog_hr("copy_thread: Failed to duplicate stop event: %d", - GetLastError()); + GetLastError()); goto finish; } @@ -585,10 +587,10 @@ int lock_id = try_lock_shmem_tex(shmem_id); if (lock_id != -1) { memcpy(thread_data.shmem_textures[lock_id], - cur_data, pitch * cy); + cur_data, pitch * cy); unlock_shmem_tex(lock_id); - ((struct shmem_data*)shmem_info)->last_tex = + ((struct shmem_data *)shmem_info)->last_tex = lock_id; shmem_id = lock_id == 0 ? 1 : 0; @@ -623,7 +625,7 @@ bool shmem_texture_data_lock(int idx) { bool locked; - + EnterCriticalSection(&thread_data.data_mutex); locked = thread_data.locked_textures[idx]; LeaveCriticalSection(&thread_data.data_mutex); @@ -651,20 +653,20 @@ thread_data.pitch = pitch; thread_data.cy = cy; - thread_data.shmem_textures[0] = (uint8_t*)data + data->tex1_offset; - thread_data.shmem_textures[1] = (uint8_t*)data + data->tex2_offset; + thread_data.shmem_textures[0] = (uint8_t *)data + data->tex1_offset; + thread_data.shmem_textures[1] = (uint8_t *)data + data->tex2_offset; thread_data.copy_event = CreateEvent(NULL, false, false, NULL); if (!thread_data.copy_event) { hlog("init_shmem_thread: Failed to create copy event: %d", - GetLastError()); + GetLastError()); return false; } thread_data.stop_event = CreateEvent(NULL, true, false, NULL); if (!thread_data.stop_event) { hlog("init_shmem_thread: Failed to create stop event: %d", - GetLastError()); + GetLastError()); return false; } @@ -674,28 +676,28 @@ InitializeCriticalSection(&thread_data.data_mutex); - thread_data.copy_thread = CreateThread(NULL, 0, copy_thread, NULL, 0, - NULL); + thread_data.copy_thread = + CreateThread(NULL, 0, copy_thread, NULL, 0, NULL); if (!thread_data.copy_thread) { hlog("init_shmem_thread: Failed to create thread: %d", - GetLastError()); + GetLastError()); return false; } return true; } #ifndef ALIGN -#define ALIGN(bytes, align) (((bytes) + ((align) - 1)) & ~((align) - 1)) +#define ALIGN(bytes, align) (((bytes) + ((align)-1)) & ~((align)-1)) #endif -bool capture_init_shmem(struct shmem_data **data, HWND window, - uint32_t base_cx, uint32_t base_cy, uint32_t cx, uint32_t cy, - uint32_t pitch, uint32_t format, bool flip) +bool capture_init_shmem(struct shmem_data **data, HWND window, uint32_t base_cx, + uint32_t base_cy, uint32_t cx, uint32_t cy, + uint32_t pitch, uint32_t format, bool flip) { - uint32_t tex_size = cy * pitch; - uint32_t aligned_header = ALIGN(sizeof(struct shmem_data), 32); - uint32_t aligned_tex = ALIGN(tex_size, 32); - uint32_t total_size = aligned_header + aligned_tex * 2 + 32; + uint32_t tex_size = cy * pitch; + uint32_t aligned_header = ALIGN(sizeof(struct shmem_data), 32); + uint32_t aligned_tex = ALIGN(tex_size, 32); + uint32_t total_size = aligned_header + aligned_tex * 2 + 32; uintptr_t align_pos; if (!init_shared_info(total_size)) { @@ -706,7 +708,7 @@ *data = shmem_info; /* to ensure fast copy rate, align texture data to 256bit addresses */ - align_pos = (uintptr_t)shmem_info; + align_pos = (uintptr_t)shmem_info; align_pos += aligned_header; align_pos &= ~(32 - 1); align_pos -= (uintptr_t)shmem_info; @@ -736,7 +738,7 @@ if (!SetEvent(signal_ready)) { hlog("capture_init_shmem: Failed to signal ready: %d", - GetLastError()); + GetLastError()); return false; } @@ -792,9 +794,9 @@ HANDLE cur_thread; bool success = DuplicateHandle(GetCurrentProcess(), - GetCurrentThread(), - GetCurrentProcess(), &cur_thread, - SYNCHRONIZE, false, 0); + GetCurrentThread(), + GetCurrentProcess(), &cur_thread, + SYNCHRONIZE, false, 0); if (!success) DbgOut("Failed to get current thread handle"); @@ -817,9 +819,9 @@ GetModuleFileNameW(hinst, name, MAX_PATH); LoadLibraryW(name); - capture_thread = CreateThread(NULL, 0, - (LPTHREAD_START_ROUTINE)main_capture_thread, - (LPVOID)cur_thread, 0, 0); + capture_thread = CreateThread( + NULL, 0, (LPTHREAD_START_ROUTINE)main_capture_thread, + (LPVOID)cur_thread, 0, 0); if (!capture_thread) { CloseHandle(cur_thread); return false; @@ -839,19 +841,18 @@ return true; } -__declspec(dllexport) LRESULT CALLBACK dummy_debug_proc(int code, - WPARAM wparam, LPARAM lparam) +__declspec(dllexport) LRESULT CALLBACK + dummy_debug_proc(int code, WPARAM wparam, LPARAM lparam) { static bool hooking = true; - MSG *msg = (MSG*)lparam; + MSG *msg = (MSG *)lparam; if (hooking && msg->message == (WM_USER + 432)) { HMODULE user32 = GetModuleHandleW(L"USER32"); - BOOL (WINAPI *unhook_windows_hook_ex)(HHOOK) = NULL; + BOOL(WINAPI * unhook_windows_hook_ex)(HHOOK) = NULL; - unhook_windows_hook_ex = get_obfuscated_func(user32, - "VojeleY`bdgxvM`hhDz", - 0x7F55F80C9EE3A213ULL); + unhook_windows_hook_ex = get_obfuscated_func( + user32, "VojeleY`bdgxvM`hhDz", 0x7F55F80C9EE3A213ULL); if (unhook_windows_hook_ex) unhook_windows_hook_ex((HHOOK)msg->lParam);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/graphics-hook/graphics-hook.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/graphics-hook/graphics-hook.h
Changed
@@ -4,7 +4,7 @@ #ifdef _MSC_VER /* conversion from data/function pointer */ -#pragma warning(disable: 4152) +#pragma warning(disable : 4152) #endif #include "../graphics-hook-info.h" @@ -59,11 +59,13 @@ extern bool rehook_gl(void); extern bool capture_init_shtex(struct shtex_data **data, HWND window, - uint32_t base_cx, uint32_t base_cy, uint32_t cx, uint32_t cy, - uint32_t format, bool flip, uintptr_t handle); + uint32_t base_cx, uint32_t base_cy, uint32_t cx, + uint32_t cy, uint32_t format, bool flip, + uintptr_t handle); extern bool capture_init_shmem(struct shmem_data **data, HWND window, - uint32_t base_cx, uint32_t base_cy, uint32_t cx, uint32_t cy, - uint32_t pitch, uint32_t format, bool flip); + uint32_t base_cx, uint32_t base_cy, uint32_t cx, + uint32_t cy, uint32_t pitch, uint32_t format, + bool flip); extern void capture_free(void); extern struct hook_info *global_hook_info; @@ -80,12 +82,12 @@ static inline bool duplicate_handle(HANDLE *dst, HANDLE src) { return !!DuplicateHandle(GetCurrentProcess(), src, GetCurrentProcess(), - dst, 0, false, DUPLICATE_SAME_ACCESS); + dst, 0, false, DUPLICATE_SAME_ACCESS); } static inline void *get_offset_addr(HMODULE module, uint32_t offset) { - return (void*)((uintptr_t)module + (uintptr_t)offset); + return (void *)((uintptr_t)module + (uintptr_t)offset); } /* ------------------------------------------------------------------------- */ @@ -121,7 +123,7 @@ { MODULEINFO info; bool success = !!GetModuleInformation(GetCurrentProcess(), module, - &info, sizeof(info)); + &info, sizeof(info)); return success ? info.SizeOfImage : 0; } @@ -160,8 +162,8 @@ static inline bool frame_ready(uint64_t interval) { static uint64_t last_time = 0; - uint64_t elapsed; - uint64_t t; + uint64_t elapsed; + uint64_t t; if (!interval) { return true; @@ -181,7 +183,7 @@ static inline bool capture_ready(void) { return capture_active() && - frame_ready(global_hook_info->frame_interval); + frame_ready(global_hook_info->frame_interval); } static inline bool capture_stopped(void)
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/hook-helpers.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/hook-helpers.h
Changed
@@ -48,4 +48,3 @@ return WaitForSingleObject(event, 0) == WAIT_OBJECT_0; } -
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/inject-helper/inject-helper.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/inject-helper/inject-helper.c
Changed
@@ -27,37 +27,38 @@ tp.Privileges[0].Luid = val; tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - AdjustTokenPrivileges(token, false, &tp, - sizeof(tp), NULL, NULL); + AdjustTokenPrivileges(token, false, &tp, sizeof(tp), NULL, + NULL); } CloseHandle(token); } static inline HANDLE open_process(DWORD desired_access, bool inherit_handle, - DWORD process_id) + DWORD process_id) { - HANDLE (WINAPI *open_process_proc)(DWORD, BOOL, DWORD); + HANDLE(WINAPI * open_process_proc)(DWORD, BOOL, DWORD); open_process_proc = get_obfuscated_func(GetModuleHandleW(L"KERNEL32"), - "HxjcQrmkb|~", 0xc82efdf78201df87); + "HxjcQrmkb|~", + 0xc82efdf78201df87); return open_process_proc(desired_access, inherit_handle, process_id); } static inline int inject_library(HANDLE process, const wchar_t *dll) { - return inject_library_obf(process, dll, - "E}mo|d[cefubWk~bgk", 0x7c3371986918e8f6, - "Rqbr`T{cnor{Bnlgwz", 0x81bf81adc9456b35, - "]`~wrl`KeghiCt", 0xadc6a7b9acd73c9b, - "Zh}{}agHzfd@{", 0x57135138eb08ff1c, - "DnafGhj}l~sX", 0x350bfacdf81b2018); + return inject_library_obf(process, dll, "E}mo|d[cefubWk~bgk", + 0x7c3371986918e8f6, "Rqbr`T{cnor{Bnlgwz", + 0x81bf81adc9456b35, "]`~wrl`KeghiCt", + 0xadc6a7b9acd73c9b, "Zh}{}agHzfd@{", + 0x57135138eb08ff1c, "DnafGhj}l~sX", + 0x350bfacdf81b2018); } static inline int inject_library_safe(DWORD thread_id, const wchar_t *dll) { - return inject_library_safe_obf(thread_id, dll, - "[bs^fbkmwuKfmfOvI", 0xEAD293602FCF9778ULL); + return inject_library_safe_obf(thread_id, dll, "[bs^fbkmwuKfmfOvI", + 0xEAD293602FCF9778ULL); } static inline int inject_library_full(DWORD process_id, const wchar_t *dll) @@ -87,9 +88,8 @@ return INJECT_ERROR_INVALID_PARAMS; } - return use_safe_inject - ? inject_library_safe(id, dll) - : inject_library_full(id, dll); + return use_safe_inject ? inject_library_safe(id, dll) + : inject_library_full(id, dll); } #define UNUSED_PARAMETER(x) ((void)(x)) @@ -107,8 +107,7 @@ pCommandLineW = GetCommandLineW(); argv = CommandLineToArgvW(pCommandLineW, &argc); if (argv && argc == 4) { - DWORD size = GetModuleFileNameW(NULL, - dll_path, MAX_PATH); + DWORD size = GetModuleFileNameW(NULL, dll_path, MAX_PATH); if (size) { wchar_t *name_start = wcsrchr(dll_path, '\\'); if (name_start) {
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/inject-library.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/inject-library.c
Changed
@@ -3,20 +3,21 @@ #include "obfuscate.h" #include "inject-library.h" -typedef HANDLE (WINAPI *create_remote_thread_t)(HANDLE, LPSECURITY_ATTRIBUTES, - SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD); -typedef BOOL (WINAPI *write_process_memory_t)(HANDLE, LPVOID, LPCVOID, SIZE_T, - SIZE_T*); -typedef LPVOID (WINAPI *virtual_alloc_ex_t)(HANDLE, LPVOID, SIZE_T, DWORD, - DWORD); -typedef BOOL (WINAPI *virtual_free_ex_t)(HANDLE, LPVOID, SIZE_T, DWORD); +typedef HANDLE(WINAPI *create_remote_thread_t)(HANDLE, LPSECURITY_ATTRIBUTES, + SIZE_T, LPTHREAD_START_ROUTINE, + LPVOID, DWORD, LPDWORD); +typedef BOOL(WINAPI *write_process_memory_t)(HANDLE, LPVOID, LPCVOID, SIZE_T, + SIZE_T *); +typedef LPVOID(WINAPI *virtual_alloc_ex_t)(HANDLE, LPVOID, SIZE_T, DWORD, + DWORD); +typedef BOOL(WINAPI *virtual_free_ex_t)(HANDLE, LPVOID, SIZE_T, DWORD); int inject_library_obf(HANDLE process, const wchar_t *dll, - const char *create_remote_thread_obf, uint64_t obf1, - const char *write_process_memory_obf, uint64_t obf2, - const char *virtual_alloc_ex_obf, uint64_t obf3, - const char *virtual_free_ex_obf, uint64_t obf4, - const char *load_library_w_obf, uint64_t obf5) + const char *create_remote_thread_obf, uint64_t obf1, + const char *write_process_memory_obf, uint64_t obf2, + const char *virtual_alloc_ex_obf, uint64_t obf3, + const char *virtual_free_ex_obf, uint64_t obf4, + const char *load_library_w_obf, uint64_t obf5) { int ret = INJECT_ERROR_UNLIKELY_FAIL; DWORD last_error = 0; @@ -36,34 +37,34 @@ virtual_free_ex_t virtual_free_ex; FARPROC load_library_w; - create_remote_thread = get_obfuscated_func(kernel32, - create_remote_thread_obf, obf1); - write_process_memory = get_obfuscated_func(kernel32, - write_process_memory_obf, obf2); - virtual_alloc_ex = get_obfuscated_func(kernel32, - virtual_alloc_ex_obf, obf3); - virtual_free_ex = get_obfuscated_func(kernel32, - virtual_free_ex_obf, obf4); - load_library_w = get_obfuscated_func(kernel32, - load_library_w_obf, obf5); + create_remote_thread = + get_obfuscated_func(kernel32, create_remote_thread_obf, obf1); + write_process_memory = + get_obfuscated_func(kernel32, write_process_memory_obf, obf2); + virtual_alloc_ex = + get_obfuscated_func(kernel32, virtual_alloc_ex_obf, obf3); + virtual_free_ex = + get_obfuscated_func(kernel32, virtual_free_ex_obf, obf4); + load_library_w = + get_obfuscated_func(kernel32, load_library_w_obf, obf5); /* -------------------------------- */ size = (wcslen(dll) + 1) * sizeof(wchar_t); - mem = virtual_alloc_ex(process, NULL, size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + mem = virtual_alloc_ex(process, NULL, size, MEM_RESERVE | MEM_COMMIT, + PAGE_READWRITE); if (!mem) { goto fail; } - success = write_process_memory(process, mem, dll, - size, &written_size); + success = write_process_memory(process, mem, dll, size, &written_size); if (!success) { goto fail; } thread = create_remote_thread(process, NULL, 0, - (LPTHREAD_START_ROUTINE)load_library_w, mem, 0, - &thread_id); + (LPTHREAD_START_ROUTINE)load_library_w, + mem, 0, &thread_id); if (!thread) { goto fail; } @@ -95,14 +96,14 @@ /* ------------------------------------------------------------------------- */ -typedef HHOOK (WINAPI *set_windows_hook_ex_t)(int, HOOKPROC, HINSTANCE, DWORD); +typedef HHOOK(WINAPI *set_windows_hook_ex_t)(int, HOOKPROC, HINSTANCE, DWORD); -#define RETRY_INTERVAL_MS 500 -#define TOTAL_RETRY_TIME_MS 4000 -#define RETRY_COUNT (TOTAL_RETRY_TIME_MS / RETRY_INTERVAL_MS) +#define RETRY_INTERVAL_MS 500 +#define TOTAL_RETRY_TIME_MS 4000 +#define RETRY_COUNT (TOTAL_RETRY_TIME_MS / RETRY_INTERVAL_MS) int inject_library_safe_obf(DWORD thread_id, const wchar_t *dll, - const char *set_windows_hook_ex_obf, uint64_t obf1) + const char *set_windows_hook_ex_obf, uint64_t obf1) { HMODULE user32 = GetModuleHandleW(L"USER32"); set_windows_hook_ex_t set_windows_hook_ex; @@ -125,8 +126,8 @@ return INJECT_ERROR_UNLIKELY_FAIL; } - set_windows_hook_ex = get_obfuscated_func(user32, - set_windows_hook_ex_obf, obf1); + set_windows_hook_ex = + get_obfuscated_func(user32, set_windows_hook_ex_obf, obf1); hook = set_windows_hook_ex(WH_GETMESSAGE, proc, lib, thread_id); if (!hook) {
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/inject-library.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/inject-library.h
Changed
@@ -1,17 +1,20 @@ #include <windows.h> #include <stdint.h> -#define INJECT_ERROR_INJECT_FAILED -1 -#define INJECT_ERROR_INVALID_PARAMS -2 +#define INJECT_ERROR_INJECT_FAILED -1 +#define INJECT_ERROR_INVALID_PARAMS -2 #define INJECT_ERROR_OPEN_PROCESS_FAIL -3 -#define INJECT_ERROR_UNLIKELY_FAIL -4 +#define INJECT_ERROR_UNLIKELY_FAIL -4 extern int inject_library_obf(HANDLE process, const wchar_t *dll, - const char *create_remote_thread_obf, uint64_t obf1, - const char *write_process_memory_obf, uint64_t obf2, - const char *virtual_alloc_ex_obf, uint64_t obf3, - const char *virtual_free_ex_obf, uint64_t obf4, - const char *load_library_w_obf, uint64_t obf5); + const char *create_remote_thread_obf, + uint64_t obf1, + const char *write_process_memory_obf, + uint64_t obf2, const char *virtual_alloc_ex_obf, + uint64_t obf3, const char *virtual_free_ex_obf, + uint64_t obf4, const char *load_library_w_obf, + uint64_t obf5); extern int inject_library_safe_obf(DWORD thread_id, const wchar_t *dll, - const char *set_windows_hook_ex_obf, uint64_t obf1); + const char *set_windows_hook_ex_obf, + uint64_t obf1);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/load-graphics-offsets.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/load-graphics-offsets.c
Changed
@@ -12,7 +12,7 @@ extern struct graphics_offsets offsets64; static inline bool load_offsets_from_string(struct graphics_offsets *offsets, - const char *str) + const char *str) { config_t *config; @@ -46,7 +46,7 @@ } static inline bool load_offsets_from_file(struct graphics_offsets *offsets, - const char *file) + const char *file) { char *str = os_quick_read_utf8_file(file); bool success = false; @@ -56,15 +56,14 @@ return success; } -static inline bool config_ver_mismatch( - config_t *ver_config, - const char *section, - struct win_version_info *ver) +static inline bool config_ver_mismatch(config_t *ver_config, + const char *section, + struct win_version_info *ver) { struct win_version_info config_ver; bool mismatch = false; -#define get_sub_ver(subver) \ +#define get_sub_ver(subver) \ config_ver.subver = (int)config_get_int(ver_config, section, #subver); \ mismatch |= config_ver.subver != ver->subver; @@ -79,7 +78,7 @@ } static inline void write_config_ver(config_t *ver_config, const char *section, - struct win_version_info *ver) + struct win_version_info *ver) { #define set_sub_ver(subver) \ config_set_int(ver_config, section, #subver, ver->subver); @@ -93,7 +92,7 @@ } static bool get_32bit_system_dll_ver(const wchar_t *system_lib, - struct win_version_info *ver) + struct win_version_info *ver) { wchar_t path[MAX_PATH]; UINT ret; @@ -104,8 +103,10 @@ ret = GetSystemDirectoryW(path, MAX_PATH); #endif if (!ret) { - blog(LOG_ERROR, "Failed to get windows 32bit system path: " - "%lu", GetLastError()); + blog(LOG_ERROR, + "Failed to get windows 32bit system path: " + "%lu", + GetLastError()); return false; } @@ -116,8 +117,8 @@ bool cached_versions_match(void) { - struct win_version_info d3d8_ver = {0}; - struct win_version_info d3d9_ver = {0}; + struct win_version_info d3d8_ver = {0}; + struct win_version_info d3d9_ver = {0}; struct win_version_info dxgi_ver = {0}; bool ver_mismatch = false; config_t *config; @@ -176,12 +177,13 @@ pp = os_process_pipe_create(offset_exe_path, "r"); if (!pp) { blog(LOG_INFO, "load_graphics_offsets: Failed to start '%s'", - offset_exe.array); + offset_exe.array); goto error; } for (;;) { - size_t len = os_process_pipe_read(pp, (uint8_t*)data, sizeof(data)); + size_t len = + os_process_pipe_read(pp, (uint8_t *)data, sizeof(data)); if (!len) break; @@ -189,13 +191,15 @@ } if (dstr_is_empty(&str)) { - blog(LOG_INFO, "load_graphics_offsets: Failed to read " - "from '%s'", offset_exe.array); + blog(LOG_INFO, + "load_graphics_offsets: Failed to read " + "from '%s'", + offset_exe.array); goto error; } // uncomment this if you enable USE_HOOK_ADDRESS_CACHE -/* + /* dstr_copy(&config_ini, config_path); dstr_cat(&config_ini, is32bit ? "32.ini" : "64.ini"); @@ -205,7 +209,7 @@ */ success = load_offsets_from_string(is32bit ? &offsets32 : &offsets64, - str.array); + str.array); if (!success) { blog(LOG_INFO, "load_graphics_offsets: Failed to load string"); } @@ -227,7 +231,7 @@ dstr_copy(&config_ini, config_path); dstr_cat(&config_ini, is32bit ? "32.ini" : "64.ini"); success = load_offsets_from_file(is32bit ? &offsets32 : &offsets64, - config_ini.array); + config_ini.array); if (!success) success = load_graphics_offsets(is32bit, config_path);
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/monitor-capture.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/monitor-capture.c
Changed
@@ -1,27 +1,31 @@ #include <util/dstr.h> #include "dc-capture.h" +/* clang-format off */ + #define TEXT_MONITOR_CAPTURE obs_module_text("MonitorCapture") #define TEXT_CAPTURE_CURSOR obs_module_text("CaptureCursor") #define TEXT_COMPATIBILITY obs_module_text("Compatibility") #define TEXT_MONITOR obs_module_text("Monitor") #define TEXT_PRIMARY_MONITOR obs_module_text("PrimaryMonitor") +/* clang-format on */ + struct monitor_capture { - obs_source_t *source; + obs_source_t *source; - int monitor; - bool capture_cursor; - bool compatibility; + int monitor; + bool capture_cursor; + bool compatibility; struct dc_capture data; }; struct monitor_info { - int cur_id; - int desired_id; - int id; - RECT rect; + int cur_id; + int desired_id; + int id; + RECT rect; }; /* ------------------------------------------------------------------------- */ @@ -42,13 +46,13 @@ } static BOOL CALLBACK enum_monitor(HMONITOR handle, HDC hdc, LPRECT rect, - LPARAM param) + LPARAM param) { struct monitor_info *monitor = (struct monitor_info *)param; if (monitor->cur_id == 0 || monitor->desired_id == monitor->cur_id) { monitor->rect = *rect; - monitor->id = monitor->cur_id; + monitor->id = monitor->cur_id; } UNUSED_PARAMETER(hdc); @@ -57,7 +61,7 @@ } static void update_monitor(struct monitor_capture *capture, - obs_data_t *settings) + obs_data_t *settings) { struct monitor_info monitor = {0}; uint32_t width, height; @@ -67,7 +71,7 @@ capture->monitor = monitor.id; - width = monitor.rect.right - monitor.rect.left; + width = monitor.rect.right - monitor.rect.left; height = monitor.rect.bottom - monitor.rect.top; dc_capture_init(&capture->data, monitor.rect.left, monitor.rect.top, @@ -76,11 +80,11 @@ } static inline void update_settings(struct monitor_capture *capture, - obs_data_t *settings) + obs_data_t *settings) { - capture->monitor = (int)obs_data_get_int(settings, "monitor"); + capture->monitor = (int)obs_data_get_int(settings, "monitor"); capture->capture_cursor = obs_data_get_bool(settings, "capture_cursor"); - capture->compatibility = obs_data_get_bool(settings, "compatibility"); + capture->compatibility = obs_data_get_bool(settings, "compatibility"); dc_capture_free(&capture->data); update_monitor(capture, settings); @@ -148,7 +152,7 @@ { struct monitor_capture *capture = data; dc_capture_render(&capture->data, - obs_get_base_effect(OBS_EFFECT_OPAQUE)); + obs_get_base_effect(OBS_EFFECT_OPAQUE)); UNUSED_PARAMETER(effect); } @@ -166,43 +170,38 @@ } static BOOL CALLBACK enum_monitor_props(HMONITOR handle, HDC hdc, LPRECT rect, - LPARAM param) + LPARAM param) { UNUSED_PARAMETER(hdc); UNUSED_PARAMETER(rect); - obs_property_t *monitor_list = (obs_property_t*)param; + obs_property_t *monitor_list = (obs_property_t *)param; MONITORINFO mi; size_t monitor_id = 0; - struct dstr monitor_desc = { 0 }; - struct dstr resolution = { 0 }; - struct dstr format_string = { 0 }; + struct dstr monitor_desc = {0}; + struct dstr resolution = {0}; + struct dstr format_string = {0}; monitor_id = obs_property_list_item_count(monitor_list); mi.cbSize = sizeof(mi); GetMonitorInfo(handle, &mi); - dstr_catf(&resolution, - "%dx%d @ %d,%d", - mi.rcMonitor.right - mi.rcMonitor.left, - mi.rcMonitor.bottom - mi.rcMonitor.top, - mi.rcMonitor.left, - mi.rcMonitor.top); + dstr_catf(&resolution, "%dx%d @ %d,%d", + mi.rcMonitor.right - mi.rcMonitor.left, + mi.rcMonitor.bottom - mi.rcMonitor.top, mi.rcMonitor.left, + mi.rcMonitor.top); dstr_copy(&format_string, "%s %d: %s"); if (mi.dwFlags == MONITORINFOF_PRIMARY) { dstr_catf(&format_string, " (%s)", TEXT_PRIMARY_MONITOR); } - dstr_catf(&monitor_desc, - format_string.array, - TEXT_MONITOR, - monitor_id + 1, - resolution.array); + dstr_catf(&monitor_desc, format_string.array, TEXT_MONITOR, + monitor_id + 1, resolution.array); - obs_property_list_add_int(monitor_list, - monitor_desc.array, (int)monitor_id); + obs_property_list_add_int(monitor_list, monitor_desc.array, + (int)monitor_id); dstr_free(&monitor_desc); dstr_free(&resolution); @@ -217,9 +216,9 @@ obs_properties_t *props = obs_properties_create(); - obs_property_t *monitors = obs_properties_add_list(props, - "monitor", TEXT_MONITOR, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + obs_property_t *monitors = obs_properties_add_list( + props, "monitor", TEXT_MONITOR, OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_INT); obs_properties_add_bool(props, "compatibility", TEXT_COMPATIBILITY); obs_properties_add_bool(props, "capture_cursor", TEXT_CAPTURE_CURSOR); @@ -230,18 +229,18 @@ } struct obs_source_info monitor_capture_info = { - .id = "monitor_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | - OBS_SOURCE_DO_NOT_DUPLICATE, - .get_name = monitor_capture_getname, - .create = monitor_capture_create, - .destroy = monitor_capture_destroy, - .video_render = monitor_capture_render, - .video_tick = monitor_capture_tick, - .update = monitor_capture_update, - .get_width = monitor_capture_width, - .get_height = monitor_capture_height, - .get_defaults = monitor_capture_defaults, - .get_properties = monitor_capture_properties + .id = "monitor_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW | + OBS_SOURCE_DO_NOT_DUPLICATE, + .get_name = monitor_capture_getname, + .create = monitor_capture_create, + .destroy = monitor_capture_destroy, + .video_render = monitor_capture_render, + .video_tick = monitor_capture_tick, + .update = monitor_capture_update, + .get_width = monitor_capture_width, + .get_height = monitor_capture_height, + .get_defaults = monitor_capture_defaults, + .get_properties = monitor_capture_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/nt-stuff.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/nt-stuff.h
Changed
@@ -6,18 +6,18 @@ #define THREAD_WAIT_REASON_SUSPENDED 5 typedef struct _OBS_SYSTEM_PROCESS_INFORMATION2 { - ULONG NextEntryOffset; - ULONG ThreadCount; - BYTE Reserved1[48]; - PVOID Reserved2[3]; - HANDLE UniqueProcessId; - PVOID Reserved3; - ULONG HandleCount; - BYTE Reserved4[4]; - PVOID Reserved5[11]; - SIZE_T PeakPagefileUsage; - SIZE_T PrivatePageCount; - LARGE_INTEGER Reserved6[6]; + ULONG NextEntryOffset; + ULONG ThreadCount; + BYTE Reserved1[48]; + PVOID Reserved2[3]; + HANDLE UniqueProcessId; + PVOID Reserved3; + ULONG HandleCount; + BYTE Reserved4[4]; + PVOID Reserved5[11]; + SIZE_T PeakPagefileUsage; + SIZE_T PrivatePageCount; + LARGE_INTEGER Reserved6[6]; } OBS_SYSTEM_PROCESS_INFORMATION2; typedef struct _OBS_SYSTEM_THREAD_INFORMATION { @@ -40,22 +40,25 @@ #define NT_SUCCESS(status) ((NTSTATUS)(status) >= 0) #endif -#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) +#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) -#define init_named_attribs(o, name) \ - do { \ - (o)->Length = sizeof(*(o)); \ - (o)->ObjectName = name; \ - (o)->RootDirectory = NULL; \ - (o)->Attributes = 0; \ - (o)->SecurityDescriptor = NULL; \ +#define init_named_attribs(o, name) \ + do { \ + (o)->Length = sizeof(*(o)); \ + (o)->ObjectName = name; \ + (o)->RootDirectory = NULL; \ + (o)->Attributes = 0; \ + (o)->SecurityDescriptor = NULL; \ (o)->SecurityQualityOfService = NULL; \ } while (false) -typedef void (WINAPI *RTLINITUNICODESTRINGFUNC)(PCUNICODE_STRING pstr, const wchar_t *lpstrName); -typedef NTSTATUS (WINAPI *NTOPENFUNC)(PHANDLE phandle, ACCESS_MASK access, POBJECT_ATTRIBUTES objattr); -typedef ULONG (WINAPI *RTLNTSTATUSTODOSERRORFUNC)(NTSTATUS status); -typedef NTSTATUS (WINAPI *NTQUERYSYSTEMINFORMATIONFUNC)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); +typedef void(WINAPI *RTLINITUNICODESTRINGFUNC)(PCUNICODE_STRING pstr, + const wchar_t *lpstrName); +typedef NTSTATUS(WINAPI *NTOPENFUNC)(PHANDLE phandle, ACCESS_MASK access, + POBJECT_ATTRIBUTES objattr); +typedef ULONG(WINAPI *RTLNTSTATUSTODOSERRORFUNC)(NTSTATUS status); +typedef NTSTATUS(WINAPI *NTQUERYSYSTEMINFORMATIONFUNC)(SYSTEM_INFORMATION_CLASS, + PVOID, ULONG, PULONG); static FARPROC get_nt_func(const char *name) { @@ -76,7 +79,7 @@ if (!initialized) { func = (RTLNTSTATUSTODOSERRORFUNC)get_nt_func( - "RtlNtStatusToDosError"); + "RtlNtStatusToDosError"); initialized = true; } @@ -91,7 +94,7 @@ if (!initialized) { func = (RTLINITUNICODESTRINGFUNC)get_nt_func( - "RtlInitUnicodeString"); + "RtlInitUnicodeString"); initialized = true; } @@ -100,14 +103,14 @@ } static NTSTATUS nt_query_information(SYSTEM_INFORMATION_CLASS info_class, - PVOID info, ULONG info_len, PULONG ret_len) + PVOID info, ULONG info_len, PULONG ret_len) { static bool initialized = false; static NTQUERYSYSTEMINFORMATIONFUNC func = NULL; if (!initialized) { func = (NTQUERYSYSTEMINFORMATIONFUNC)get_nt_func( - "NtQuerySystemInformation"); + "NtQuerySystemInformation"); initialized = true; } @@ -124,7 +127,7 @@ for (;;) { NTSTATUS stat = nt_query_information(SystemProcessInformation, - data, size, &size); + data, size, &size); if (NT_SUCCESS(stat)) break; @@ -148,12 +151,12 @@ if (!offset) goto fail; - spi = (OBS_SYSTEM_PROCESS_INFORMATION2*)((BYTE*)spi + offset); + spi = (OBS_SYSTEM_PROCESS_INFORMATION2 *)((BYTE *)spi + offset); } OBS_SYSTEM_THREAD_INFORMATION *sti; OBS_SYSTEM_THREAD_INFORMATION *info = NULL; - sti = (OBS_SYSTEM_THREAD_INFORMATION*)((BYTE*)spi + sizeof(*spi)); + sti = (OBS_SYSTEM_THREAD_INFORMATION *)((BYTE *)spi + sizeof(*spi)); for (ULONG i = 0; i < spi->ThreadCount; i++) { if (sti[i].UniqueThreadId == (HANDLE)(DWORD_PTR)thread_id) { @@ -164,7 +167,7 @@ if (info) { suspended = info->ThreadState == THREAD_STATE_WAITING && - info->WaitReason == THREAD_WAIT_REASON_SUSPENDED; + info->WaitReason == THREAD_WAIT_REASON_SUSPENDED; } fail: @@ -172,33 +175,33 @@ return suspended; } -#define MAKE_NT_OPEN_FUNC(func_name, nt_name, access) \ -static HANDLE func_name(const wchar_t *name) \ -{ \ - static bool initialized = false; \ - static NTOPENFUNC open = NULL; \ - HANDLE handle; \ - NTSTATUS status; \ - UNICODE_STRING unistr; \ - OBJECT_ATTRIBUTES attr; \ -\ - if (!initialized) { \ - open = (NTOPENFUNC)get_nt_func(#nt_name); \ - initialized = true; \ - } \ -\ - if (!open) \ - return NULL; \ -\ - rtl_init_str(&unistr, name); \ - init_named_attribs(&attr, &unistr); \ -\ - status = open(&handle, access, &attr); \ - if (NT_SUCCESS(status)) \ - return handle; \ - nt_set_last_error(status); \ - return NULL; \ -} +#define MAKE_NT_OPEN_FUNC(func_name, nt_name, access) \ + static HANDLE func_name(const wchar_t *name) \ + { \ + static bool initialized = false; \ + static NTOPENFUNC open = NULL; \ + HANDLE handle; \ + NTSTATUS status; \ + UNICODE_STRING unistr; \ + OBJECT_ATTRIBUTES attr; \ + \ + if (!initialized) { \ + open = (NTOPENFUNC)get_nt_func(#nt_name); \ + initialized = true; \ + } \ + \ + if (!open) \ + return NULL; \ + \ + rtl_init_str(&unistr, name); \ + init_named_attribs(&attr, &unistr); \ + \ + status = open(&handle, access, &attr); \ + if (NT_SUCCESS(status)) \ + return handle; \ + nt_set_last_error(status); \ + return NULL; \ + } MAKE_NT_OPEN_FUNC(nt_open_mutex, NtOpenMutant, SYNCHRONIZE) MAKE_NT_OPEN_FUNC(nt_open_event, NtOpenEvent, EVENT_MODIFY_STATE | SYNCHRONIZE)
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/obfuscate.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/obfuscate.c
Changed
@@ -6,21 +6,20 @@ #include <windows.h> #include "obfuscate.h" -#define LOWER_HALFBYTE(x) ((x) & 0xF) +#define LOWER_HALFBYTE(x) ((x)&0xF) #define UPPER_HALFBYTE(x) (((x) >> 4) & 0xF) static void deobfuscate_str(char *str, uint64_t val) { - uint8_t *dec_val = (uint8_t*)&val; + uint8_t *dec_val = (uint8_t *)&val; int i = 0; while (*str != 0) { int pos = i / 2; bool bottom = (i % 2) == 0; - uint8_t *ch = (uint8_t*)str; - uint8_t xor = bottom ? - LOWER_HALFBYTE(dec_val[pos]) : - UPPER_HALFBYTE(dec_val[pos]); + uint8_t *ch = (uint8_t *)str; + uint8_t xor = bottom ? LOWER_HALFBYTE(dec_val[pos]) + : UPPER_HALFBYTE(dec_val[pos]); *ch ^= xor;
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/obfuscate.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/obfuscate.h
Changed
@@ -7,7 +7,7 @@ #endif /* this is a workaround to A/Vs going crazy whenever certain functions (such as - * OpenProcess) are used */ + * OpenProcess) are used */ extern void *get_obfuscated_func(HMODULE module, const char *str, uint64_t val); #ifdef __cplusplus
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/plugin-main.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/plugin-main.c
Changed
@@ -37,8 +37,7 @@ { char *config_path = param; - if (USE_HOOK_ADDRESS_CACHE && - cached_versions_match() && + if (USE_HOOK_ADDRESS_CACHE && cached_versions_match() && load_cached_graphics_offsets(IS32BIT, config_path)) { load_cached_graphics_offsets(!IS32BIT, config_path); @@ -95,7 +94,8 @@ char *config_path = obs_module_config_path(NULL); - init_hooks_thread = CreateThread(NULL, 0, init_hooks, config_path, 0, NULL); + init_hooks_thread = + CreateThread(NULL, 0, init_hooks, config_path, 0, NULL); obs_register_source(&game_capture_info); return true;
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/window-capture.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/window-capture.c
Changed
@@ -3,6 +3,8 @@ #include "dc-capture.h" #include "window-helpers.h" +/* clang-format off */ + #define TEXT_WINDOW_CAPTURE obs_module_text("WindowCapture") #define TEXT_WINDOW obs_module_text("WindowCapture.Window") #define TEXT_MATCH_PRIORITY obs_module_text("WindowCapture.Priority") @@ -12,31 +14,33 @@ #define TEXT_CAPTURE_CURSOR obs_module_text("CaptureCursor") #define TEXT_COMPATIBILITY obs_module_text("Compatibility") +/* clang-format on */ + struct window_capture { - obs_source_t *source; + obs_source_t *source; - char *title; - char *class; - char *executable; + char *title; + char *class; + char *executable; enum window_priority priority; - bool cursor; - bool compatibility; - bool use_wildcards; /* TODO */ + bool cursor; + bool compatibility; + bool use_wildcards; /* TODO */ - struct dc_capture capture; + struct dc_capture capture; - float resize_timer; - float check_window_timer; - float cursor_check_time; + float resize_timer; + float check_window_timer; + float cursor_check_time; - HWND window; - RECT last_rect; + HWND window; + RECT last_rect; }; static void update_settings(struct window_capture *wc, obs_data_t *s) { - const char *window = obs_data_get_string(s, "window"); - int priority = (int)obs_data_get_int(s, "priority"); + const char *window = obs_data_get_string(s, "window"); + int priority = (int)obs_data_get_int(s, "priority"); bfree(wc->title); bfree(wc->class); @@ -45,15 +49,15 @@ build_window_strings(window, &wc->class, &wc->title, &wc->executable); if (wc->title != NULL) { - blog(LOG_INFO, "[window-capture: '%s'] update settings:\n" - "\texecutable: %s", - obs_source_get_name(wc->source), - wc->executable); + blog(LOG_INFO, + "[window-capture: '%s'] update settings:\n" + "\texecutable: %s", + obs_source_get_name(wc->source), wc->executable); blog(LOG_DEBUG, "\tclass: %s", wc->class); } - wc->priority = (enum window_priority)priority; - wc->cursor = obs_data_get_bool(s, "cursor"); + wc->priority = (enum window_priority)priority; + wc->cursor = obs_data_get_bool(s, "cursor"); wc->use_wildcards = obs_data_get_bool(s, "use_wildcards"); wc->compatibility = obs_data_get_bool(s, "compatibility"); } @@ -127,14 +131,15 @@ obs_property_t *p; p = obs_properties_add_list(ppts, "window", TEXT_WINDOW, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); fill_window_list(p, EXCLUDE_MINIMIZED, NULL); p = obs_properties_add_list(ppts, "priority", TEXT_MATCH_PRIORITY, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_list_add_int(p, TEXT_MATCH_TITLE, WINDOW_PRIORITY_TITLE); obs_property_list_add_int(p, TEXT_MATCH_CLASS, WINDOW_PRIORITY_CLASS); - obs_property_list_add_int(p, TEXT_MATCH_EXE, WINDOW_PRIORITY_EXE); + obs_property_list_add_int(p, TEXT_MATCH_EXE, WINDOW_PRIORITY_EXE); obs_properties_add_bool(ppts, "cursor", TEXT_CAPTURE_CURSOR); @@ -170,7 +175,7 @@ wc->check_window_timer = 0.0f; wc->window = find_window(EXCLUDE_MINIMIZED, wc->priority, - wc->class, wc->title, wc->executable); + wc->class, wc->title, wc->executable); if (!wc->window) { if (wc->capture.valid) dc_capture_free(&wc->capture); @@ -188,13 +193,15 @@ DWORD foreground_pid, target_pid; // Can't just compare the window handle in case of app with child windows - if (!GetWindowThreadProcessId(GetForegroundWindow(), &foreground_pid)) + if (!GetWindowThreadProcessId(GetForegroundWindow(), + &foreground_pid)) foreground_pid = 0; if (!GetWindowThreadProcessId(wc->window, &target_pid)) target_pid = 0; - if (foreground_pid && target_pid && foreground_pid != target_pid) + if (foreground_pid && target_pid && + foreground_pid != target_pid) wc->capture.cursor_hidden = true; else wc->capture.cursor_hidden = false; @@ -211,7 +218,7 @@ if (wc->resize_timer >= RESIZE_CHECK_TIME) { if (rect.bottom != wc->last_rect.bottom || - rect.right != wc->last_rect.right) + rect.right != wc->last_rect.right) reset_capture = true; wc->resize_timer = 0.0f; @@ -239,17 +246,17 @@ } struct obs_source_info window_capture_info = { - .id = "window_capture", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW, - .get_name = wc_getname, - .create = wc_create, - .destroy = wc_destroy, - .update = wc_update, - .video_render = wc_render, - .video_tick = wc_tick, - .get_width = wc_width, - .get_height = wc_height, - .get_defaults = wc_defaults, - .get_properties = wc_properties + .id = "window_capture", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW, + .get_name = wc_getname, + .create = wc_create, + .destroy = wc_destroy, + .update = wc_update, + .video_render = wc_render, + .video_tick = wc_tick, + .get_width = wc_width, + .get_height = wc_height, + .get_defaults = wc_defaults, + .get_properties = wc_properties, };
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/window-helpers.c -> obs-studio-24.0.0.tar.xz/plugins/win-capture/window-helpers.c
Changed
@@ -22,16 +22,14 @@ return str.array; } -extern void build_window_strings(const char *str, - char **class, - char **title, - char **exe) +extern void build_window_strings(const char *str, char **class, char **title, + char **exe) { char **strlist; *class = NULL; *title = NULL; - *exe = NULL; + *exe = NULL; if (!str) { return; @@ -42,7 +40,7 @@ if (strlist && strlist[0] && strlist[1] && strlist[2]) { *title = decode_str(strlist[0]); *class = decode_str(strlist[1]); - *exe = decode_str(strlist[2]); + *exe = decode_str(strlist[2]); } strlist_free(strlist); @@ -57,24 +55,24 @@ } static inline HANDLE open_process(DWORD desired_access, bool inherit_handle, - DWORD process_id) + DWORD process_id) { - static HANDLE (WINAPI *open_process_proc)(DWORD, BOOL, DWORD) = NULL; + static HANDLE(WINAPI * open_process_proc)(DWORD, BOOL, DWORD) = NULL; if (!open_process_proc) - open_process_proc = get_obfuscated_func(kernel32(), - "B}caZyah`~q", 0x2D5BEBAF6DDULL); + open_process_proc = get_obfuscated_func( + kernel32(), "B}caZyah`~q", 0x2D5BEBAF6DDULL); return open_process_proc(desired_access, inherit_handle, process_id); } bool get_window_exe(struct dstr *name, HWND window) { - wchar_t wname[MAX_PATH]; - struct dstr temp = {0}; - bool success = false; - HANDLE process = NULL; - char *slash; - DWORD id; + wchar_t wname[MAX_PATH]; + struct dstr temp = {0}; + bool success = false; + HANDLE process = NULL; + char *slash; + DWORD id; GetWindowThreadProcessId(window, &id); if (id == GetCurrentProcessId()) @@ -92,7 +90,7 @@ if (!slash) goto fail; - dstr_copy(name, slash+1); + dstr_copy(name, slash + 1); success = true; fail: @@ -113,8 +111,8 @@ if (!len) return; - temp = malloc(sizeof(wchar_t) * (len+1)); - if (GetWindowTextW(hwnd, temp, len+1)) + temp = malloc(sizeof(wchar_t) * (len + 1)); + if (GetWindowTextW(hwnd, temp, len + 1)) dstr_from_wcs(name, temp); free(temp); } @@ -136,7 +134,7 @@ "winstore.app", "searchui", "lockapp", - NULL + NULL, }; static bool is_microsoft_internal_window_exe(const char *exe) @@ -154,11 +152,11 @@ static void add_window(obs_property_t *p, HWND hwnd, add_window_cb callback) { - struct dstr class = {0}; - struct dstr title = {0}; - struct dstr exe = {0}; + struct dstr class = {0}; + struct dstr title = {0}; + struct dstr exe = {0}; struct dstr encoded = {0}; - struct dstr desc = {0}; + struct dstr desc = {0}; if (!get_window_exe(&exe, hwnd)) return; @@ -207,14 +205,14 @@ static bool check_window_valid(HWND window, enum window_search_mode mode) { DWORD styles, ex_styles; - RECT rect; + RECT rect; if (!IsWindowVisible(window) || (mode == EXCLUDE_MINIMIZED && IsIconic(window))) return false; GetClientRect(window, &rect); - styles = (DWORD)GetWindowLongPtr(window, GWL_STYLE); + styles = (DWORD)GetWindowLongPtr(window, GWL_STYLE); ex_styles = (DWORD)GetWindowLongPtr(window, GWL_EXSTYLE); if (ex_styles & WS_EX_TOOLWINDOW) @@ -259,8 +257,8 @@ return NULL; } -static HWND next_window(HWND window, enum window_search_mode mode, - HWND *parent, bool use_findwindowex) +static HWND next_window(HWND window, enum window_search_mode mode, HWND *parent, + bool use_findwindowex) { if (*parent) { window = *parent; @@ -270,7 +268,7 @@ while (true) { if (use_findwindowex) window = FindWindowEx(GetDesktopWindow(), window, NULL, - NULL); + NULL); else window = GetNextWindow(window, GW_HWNDNEXT); @@ -290,7 +288,7 @@ } static HWND first_window(enum window_search_mode mode, HWND *parent, - bool *use_findwindowex) + bool *use_findwindowex) { HWND window = FindWindowEx(GetDesktopWindow(), NULL, NULL, NULL); @@ -312,7 +310,7 @@ window = GetWindow(GetDesktopWindow(), GW_CHILD); if (!check_window_valid(window, mode)) window = next_window(window, mode, parent, - *use_findwindowex); + *use_findwindowex); } } @@ -328,7 +326,7 @@ } void fill_window_list(obs_property_t *p, enum window_search_mode mode, - add_window_cb callback) + add_window_cb callback) { HWND parent; bool use_findwindowex = false; @@ -341,16 +339,13 @@ } } -static int window_rating(HWND window, - enum window_priority priority, - const char *class, - const char *title, - const char *exe, - bool uwp_window) +static int window_rating(HWND window, enum window_priority priority, + const char *class, const char *title, const char *exe, + bool uwp_window) { struct dstr cur_class = {0}; struct dstr cur_title = {0}; - struct dstr cur_exe = {0}; + struct dstr cur_exe = {0}; int val = 0x7FFFFFFF; if (!get_window_exe(&cur_exe, window)) @@ -388,27 +383,24 @@ return val; } -HWND find_window(enum window_search_mode mode, - enum window_priority priority, - const char *class, - const char *title, - const char *exe) +HWND find_window(enum window_search_mode mode, enum window_priority priority, + const char *class, const char *title, const char *exe) { HWND parent; bool use_findwindowex = false; - HWND window = first_window(mode, &parent, &use_findwindowex); + HWND window = first_window(mode, &parent, &use_findwindowex); HWND best_window = NULL; - int best_rating = 0x7FFFFFFF; + int best_rating = 0x7FFFFFFF; if (!class) return NULL; - bool uwp_window = strcmp(class, "Windows.UI.Core.CoreWindow") == 0; + bool uwp_window = strcmp(class, "Windows.UI.Core.CoreWindow") == 0; while (window) { int rating = window_rating(window, priority, class, title, exe, - uwp_window); + uwp_window); if (rating < best_rating) { best_rating = rating; best_window = window;
View file
obs-studio-23.2.1.tar.xz/plugins/win-capture/window-helpers.h -> obs-studio-24.0.0.tar.xz/plugins/win-capture/window-helpers.h
Changed
@@ -10,7 +10,7 @@ enum window_search_mode { INCLUDE_MINIMIZED, - EXCLUDE_MINIMIZED + EXCLUDE_MINIMIZED, }; extern bool get_window_exe(struct dstr *name, HWND window); @@ -20,18 +20,14 @@ extern HWND get_uwp_actual_window(HWND parent); typedef bool (*add_window_cb)(const char *title, const char *class, - const char *exe); + const char *exe); extern void fill_window_list(obs_property_t *p, enum window_search_mode mode, - add_window_cb callback); + add_window_cb callback); -extern void build_window_strings(const char *str, - char **class, - char **title, - char **exe); +extern void build_window_strings(const char *str, char **class, char **title, + char **exe); extern HWND find_window(enum window_search_mode mode, - enum window_priority priority, - const char *class, - const char *title, - const char *exe); + enum window_priority priority, const char *class, + const char *title, const char *exe);
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/CMakeLists.txt
Changed
@@ -35,7 +35,7 @@ set(libdshowcapture_HEADERS libdshowcapture/dshowcapture.hpp - libdshowcapture/source/IVideoCaptureFilter.h + libdshowcapture/source/external/IVideoCaptureFilter.h libdshowcapture/source/capture-filter.hpp libdshowcapture/source/output-filter.hpp libdshowcapture/source/device.hpp
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/ca-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/ca-ES.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Espai de color" ColorSpace.Default="Per defecte" ColorRange="Gamma de colors" +ColorRange.Default="Per defecte" ColorRange.Partial="Parcial" ColorRange.Full="Completa" ConfigureAudio="Configura l'àudio"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/cs-CZ.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/cs-CZ.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Barevný prostor" ColorSpace.Default="Výchozí" ColorRange="Rozsah barev" +ColorRange.Default="Výchozí" ColorRange.Partial="Částečná" ColorRange.Full="Plná" ConfigureAudio="Natavit zvuk"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/da-DK.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/da-DK.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Farverum" ColorSpace.Default="Standard" ColorRange="Farveområde" +ColorRange.Default="Standard" ColorRange.Partial="Delvis" ColorRange.Full="Fuld" ConfigureAudio="Opsæt lyd"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/de-DE.ini
Changed
@@ -3,12 +3,13 @@ ColorSpace="Farbraum" ColorSpace.Default="Standard" ColorRange="Farbbereich" +ColorRange.Default="Standard" ColorRange.Partial="Teilweise" ColorRange.Full="Voll" ConfigureAudio="Audio konfigurieren" ConfigureVideo="Video konfigurieren" ConfigureCrossbar="Crossbar konfigurieren" -ResFPSType="Auflösung/FPS-Typ" +ResFPSType="Auflösung/FPS‐Typ" ResFPSType.Custom="Benutzerdefiniert" ResFPSType.DevPreferred="Gerätestandard" FPS.Matching="An Ausgabe angleichen" @@ -19,12 +20,12 @@ VideoFormat.Unknown="Unbekannt (%1)" AudioOutputMode="Audioausgabemodus" AudioOutputMode.Capture="Audio nur aufnehmen" -AudioOutputMode.DirectSound="Audioausgabe auf dem Desktop (DirectSound)" -AudioOutputMode.WaveOut="Audioausgabe auf dem Desktop (WaveOut)" +AudioOutputMode.DirectSound="Desktop‐Audioausgabe (DirectSound)" +AudioOutputMode.WaveOut="Desktop‐Audioausgabe (WaveOut)" UseCustomAudioDevice="Benutzerdefiniertes Audiogerät verwenden" AudioDevice="Audiogerät" Buffering="Pufferung" -Buffering.ToolTip="Wenn aktiviert, werden die Video-/Audiodaten gepuffert, um die möglichst flüssigste und genaueste Wiedergabe zu gewährleisten, aber auf Kosten von erhöhter Verzögerung. Wenn eine Capture-Card-Pufferung benutzt wird, wird es empfohlen, die Karte und OBS Studio auf die gleiche FPS-Anzahl zu setzen, um die besten Ergebnisse zu erzielen.\n\nWenn deaktiviert, wird die niedrigste Verzögerung für die Wiedergabe gewährleistet, aber auf Kosten der Framewiedergabegenauigkeit.\nDies ist ideal für Webcams oder, wenn Sie das Vorschaufenster des Programms benutzen wollen, um z. B. an einer Spielekonsole zu spielen.\n\nDie automatisch Erkennung aktiviert es, wenn das Gerät Verzögerung hat und deaktiviert es, wenn es keine Verzögerung gibt." +Buffering.ToolTip="Wenn aktiviert, werden die Video‐/Audiodaten gepuffert, um die möglichst flüssigste und genaueste Wiedergabe auf Kosten von erhöhter Verzögerung zu gewährleisten. Wenn eine Capture‐Card‐Pufferung benutzt wird, wird es empfohlen, die Karte und OBS Studio auf die gleiche FPS‐Anzahl zu setzen, um die besten Ergebnisse zu erzielen.\n\nWenn deaktiviert, wird die niedrigste Verzögerung für die Wiedergabe auf Kosten der Framewiedergabegenauigkeit gewährleistet.\nDies ist ideal für Webcams oder, wenn Sie das Vorschaufenster des Programms benutzen wollen, um z. B. an einer Spielekonsole zu spielen.\n\nDie automatische Erkennung (Standard) aktiviert sie, wenn das Gerät Verzögerung hat und deaktiviert sie, wenn es keine Verzögerung gibt." Buffering.AutoDetect="Automatisch erkennen" Buffering.Enable="Aktivieren" Buffering.Disable="Deaktivieren" @@ -34,6 +35,6 @@ DeactivateWhenNotShowing="Deaktivieren, wenn die Quelle nicht angezeigt wird" Bitrate="Bitrate" -Encoder.C985="AVerMedia-H.264-Kodierer (c985)" -Encoder.C353="AVerMedia-H.264-Kodierer" +Encoder.C985="AVerMedia‐H.264‐Kodierer (c985)" +Encoder.C353="AVerMedia‐H.264‐Kodierer"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/en-US.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/en-US.ini
Changed
@@ -4,6 +4,7 @@ ColorSpace="Color Space" ColorSpace.Default="Default" ColorRange="Color Range" +ColorRange.Default="Default" ColorRange.Partial="Partial" ColorRange.Full="Full" ConfigureAudio="Configure Audio"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/es-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/es-ES.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Espacio de color" ColorSpace.Default="Por defecto" ColorRange="Rango de colores" +ColorRange.Default="Predeterminado" ColorRange.Partial="Parcial" ColorRange.Full="Completo" ConfigureAudio="Configurar Audio"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/eu-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/eu-ES.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Kolore-espazioa" ColorSpace.Default="Lehenetsia" ColorRange="Kolore tartea" +ColorRange.Default="Lehenetsia" ColorRange.Partial="Partziala" ColorRange.Full="Osoa" ConfigureAudio="Konfiguratu audioa"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/fi-FI.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/fi-FI.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Väriavaruus" ColorSpace.Default="Oletus" ColorRange="Värialue" +ColorRange.Default="Oletus" ColorRange.Partial="Osittainen" ColorRange.Full="Täysi" ConfigureAudio="Määritä ääni"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/fr-FR.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/fr-FR.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Espace de couleurs YUV" ColorSpace.Default="Par défaut" ColorRange="Gamme de couleurs YUV" +ColorRange.Default="Par défaut" ColorRange.Partial="Partielle" ColorRange.Full="Complète" ConfigureAudio="Configurer l'audio"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/gl-ES.ini
Changed
@@ -1,14 +1,17 @@ VideoCaptureDevice="Dispositivo de captura de vídeo" Device="Dispositivo" -ColorSpace.Default="Por defecto" +ColorSpace="Espazo de cor" +ColorSpace.Default="Predeterminado" +ColorRange="Gama de cores" +ColorRange.Default="Predeterminado" ColorRange.Partial="Parcial" -ColorRange.Full="Completo" +ColorRange.Full="Total" ConfigureAudio="Configurar audio" ConfigureVideo="Configurar vídeo" ConfigureCrossbar="Configurar a barra fixa" ResFPSType="Tipo de resolución/FPS" ResFPSType.Custom="Personalizado" -ResFPSType.DevPreferred="Dispositivo predefinido" +ResFPSType.DevPreferred="Dispositivo predeterminado" FPS.Matching="Emparellar os FPS de saída" FPS.Highest="FPS máximos" Resolution="Resolución" @@ -19,15 +22,19 @@ AudioOutputMode.Capture="Só capturar audio" AudioOutputMode.DirectSound="Saída de audio de escritorio (DirectSound)" AudioOutputMode.WaveOut="Saída de audio de escritorio (WaveOut)" -UseCustomAudioDevice="Utilizar o dispositivo de audio personalizado" -AudioDevice="Dispositivo de audio" -Buffering="Almacenamento no búfer" -Activate="Activar" -Deactivate="Desactivar" +UseCustomAudioDevice="Utilizar o dispositivo de son personalizado" +AudioDevice="Dispositivo de son" +Buffering="Almacenamento na memoria temporal" +Buffering.ToolTip="Cando está activado, almacena nas memorias temporais os datos de vídeo/son para\ngarantir a reprodución máis suave e precisa posíbel, mais a un custo de maior\nlatencia. Cando se utilice o almacenamento de memoria temporal cunha tarxeta\nde captura de vídeo, recoméndase axustar a tarxeta e o programa á mesma taxa\nde fotogramas para obter mellores resultados.\n\nCando está desactivado, asegura a reprodución de menor latencia, mis a custo\nda precisión da reprodución de fotogramas. Isto é ideal para cámaras de cara\nou cando quere usar a xanela de vista previa do programa para reproducir unha\n consola.\n\nA detección automática (predeterminado) estabeléceo como activado se o\ndispositivo ten retardo e desactivado se non ten retardo." +Buffering.AutoDetect="Detección automática" +Buffering.Enable="Activar" +Buffering.Disable="Desactivar" +Activate="Activado" +Deactivate="Desactivado" FlipVertically="Voltear verticalmente" -DeactivateWhenNotShowing="Desactivar cando non se mostre" +DeactivateWhenNotShowing="Desactivado cando non se amose" -Bitrate="Velocidade de bits" -Encoder.C985="Codificador AVerMedia h264 (c985)" -Encoder.C353="Codificador AVerMedia h264 (c985)" +Bitrate="Taxa de bits" +Encoder.C985="Codificador h264 (c985) de AVerMedia" +Encoder.C353="Codificador h264 de AVerMedia"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/hu-HU.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/hu-HU.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Színtér" ColorSpace.Default="Alapértelmezett" ColorRange="Színtartomány" +ColorRange.Default="Alapértelmezett" ColorRange.Partial="Részleges" ColorRange.Full="Teljes" ConfigureAudio="Audio beállítása"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/it-IT.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/it-IT.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Spazio colore" ColorSpace.Default="Predefinito" ColorRange="Gamma di colori" +ColorRange.Default="Predefinito" ColorRange.Partial="Parziale" ColorRange.Full="Intero" ConfigureAudio="Configura l'audio"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/ja-JP.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/ja-JP.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="色空間" ColorSpace.Default="既定" ColorRange="色範囲" +ColorRange.Default="既定" ColorRange.Partial="一部" ColorRange.Full="全部" ConfigureAudio="音声を構成"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/ka-GE.ini
Changed
@@ -1,8 +1,9 @@ -VideoCaptureDevice="ვიდეოს გადამღები მოწყობილობა" +VideoCaptureDevice="ვიდეოჩამწერი მოწყობილობა" Device="მოწყობილობა" ColorSpace="ფერთა სივრცე" ColorSpace.Default="ნაგულისხმევი" ColorRange="ფერთა გამა" +ColorRange.Default="ნაგულისხმევი" ColorRange.Partial="ნაწილობრივი" ColorRange.Full="სრული" ConfigureAudio="ხმის გამართვა"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/ko-KR.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/ko-KR.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="색 공간" ColorSpace.Default="기본" ColorRange="색상 범위" +ColorRange.Default="기본값" ColorRange.Partial="부분" ColorRange.Full="전체" ConfigureAudio="오디오 설정"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/nl-NL.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/nl-NL.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Kleurruimte" ColorSpace.Default="Standaard" ColorRange="Kleurbereik" +ColorRange.Default="Standaard" ColorRange.Partial="Partial" ColorRange.Full="Full" ConfigureAudio="Audio Instellen"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/pl-PL.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/pl-PL.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Przestrzeń kolorów" ColorSpace.Default="Domyślne" ColorRange="Zakres kolorów" +ColorRange.Default="Domyślny" ColorRange.Partial="Częściowy" ColorRange.Full="Pełny" ConfigureAudio="Konfiguracja dźwięku"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/pt-BR.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/pt-BR.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Espaço de cor" ColorSpace.Default="Padrão" ColorRange="Faixa de cores" +ColorRange.Default="Padrão" ColorRange.Partial="Parcial" ColorRange.Full="Completo" ConfigureAudio="Configurar Áudio"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/ro-RO.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/ro-RO.ini
Changed
@@ -1,6 +1,9 @@ VideoCaptureDevice="Dispozitiv de captură video" Device="Dispozitiv" +ColorSpace="Spațiu de culori" ColorSpace.Default="Implicit" +ColorRange="Gamă de culori" +ColorRange.Default="Implicită" ColorRange.Partial="Parțială" ColorRange.Full="Completă" ConfigureAudio="Configurare audio"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/ru-RU.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/ru-RU.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Цветовое пространство" ColorSpace.Default="По умолчанию" ColorRange="Цветовой диапазон" +ColorRange.Default="По умолчанию" ColorRange.Partial="Частичный" ColorRange.Full="Полный" ConfigureAudio="Настроить звук"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/sl-SI.ini
Changed
@@ -1,26 +1,40 @@ -VideoCaptureDevice="Naprava za zajemanje videa" +VideoCaptureDevice="Naprava za zajemanje videoposnetkov" Device="Naprava" -ColorRange.Partial="Delno" -ColorRange.Full="Polno" +ColorSpace="Barvni prostor" +ColorSpace.Default="Privzeto" +ColorRange="Barvni razpon" +ColorRange.Default="Privzeto" +ColorRange.Partial="Delen" +ColorRange.Full="Poln" ConfigureAudio="Nastavi zvok" -ConfigureVideo="Nastavitve videa" -ConfigureCrossbar="Konfiguriranje stičišče vratnice in prečke" -ResFPSType="Vrsta Resolucije/FPS" +ConfigureVideo="Nastavi sliko" +ConfigureCrossbar="Nastavi navzkrižni preklopnik" +ResFPSType="Ločljivost/Vrsta sl./s" ResFPSType.Custom="Po meri" -ResFPSType.DevPreferred="Prevzete Nastavitve Naprave" -FPS.Matching="Usklajaj se z Izhodnim FPS" -FPS.Highest="Najvišji FPS" -Resolution="Resolucija" -VideoFormat="Video Format" -VideoFormat.Any="Vse" +ResFPSType.DevPreferred="Privzeto od naprave" +FPS.Matching="Uskladi se z izhodno hitrostjo sličic" +FPS.Highest="Najvišja hitrost sličic" +Resolution="Ločljivost" +VideoFormat="Oblika slike" +VideoFormat.Any="Katerakoli" VideoFormat.Unknown="Neznano (%1)" +AudioOutputMode="Način izhodnega zvoka" +AudioOutputMode.Capture="Samo zajemaj zvok" +AudioOutputMode.DirectSound="Odvajaj namizni zvok (DirectSound)" +AudioOutputMode.WaveOut="Odvajaj namizni zvok (WaveOut)" UseCustomAudioDevice="Uporabi zvočno napravo po meri" AudioDevice="Zvočna naprava" -Buffering="Medpomnjenje" -Activate="Aktiviraj" -Deactivate="Deaktiviraj" +Buffering="Medpomnenje" +Buffering.ToolTip="Ko je omogočeno, medpomni slikovne/zvočne podatke, da zagotovi najbolj\ntekoče in natančno predvajanje, vendar na račun povečane zakasnitve.\nKadar medpomnenje uporabljate s kartico za zajem, je za najboljše rezultate\npriporočljivo kartico in program nastaviti na isto hitrost sličic.\n\nKo je onemogočeno, zagotovi predvajanje z najnižjo zakasnitvijo, vendar na račun\nnatančnosti predvajanja. To je idealno za obrazne kamere ali kadar želite\nokno za predogled uporabiti za igranje na konzoli.\n\n'Samodejno zaznaj' (privzeto) ga nastavi na omogočeno, če ima naprava\nzakasnitev, in na onemogočeno, če nima zakasnitve." +Buffering.AutoDetect="Samodejno zaznaj" +Buffering.Enable="Omogoči" +Buffering.Disable="Onemogoči" +Activate="Omogoči" +Deactivate="Onemogoči" +FlipVertically="Zrcali navpično" +DeactivateWhenNotShowing="Onemogoči, ko ni prikazano" -Bitrate="Bitrate" -Encoder.C985="AVerMedia H.264 Encoder (c985)" -Encoder.C353="AVerMedia H.264 Encoder" +Bitrate="Bitna hitrost" +Encoder.C985="Kodirnik AVerMedia H.264 (c985)" +Encoder.C353="Kodirnik AVerMedia H.264"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/sv-SE.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/sv-SE.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Färgrymd" ColorSpace.Default="Standard" ColorRange="Färgintervall" +ColorRange.Default="Standard" ColorRange.Partial="Partiell" ColorRange.Full="Full" ConfigureAudio="Konfigurera ljud"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/tr-TR.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/tr-TR.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="Renk Uzayı" ColorSpace.Default="Varsayılan" ColorRange="Renk Aralığı" +ColorRange.Default="Varsayılan" ColorRange.Partial="Kısmi" ColorRange.Full="Tam" ConfigureAudio="Ses Ayarları"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/uk-UA.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/uk-UA.ini
Changed
@@ -1,6 +1,9 @@ VideoCaptureDevice="Відео пристрій" Device="Пристрій" +ColorSpace="Колірний простір" ColorSpace.Default="За замовчанням" +ColorRange="Колірний діапазон" +ColorRange.Default="За замовчанням" ColorRange.Partial="Частковий" ColorRange.Full="Повний" ConfigureAudio="Настроювати Аудіо"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/zh-CN.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/zh-CN.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="色彩空间" ColorSpace.Default="默认" ColorRange="色彩范围" +ColorRange.Default="默认" ColorRange.Partial="局部" ColorRange.Full="全部" ConfigureAudio="配置音频"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/data/locale/zh-TW.ini -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/data/locale/zh-TW.ini
Changed
@@ -3,6 +3,7 @@ ColorSpace="色彩空間" ColorSpace.Default="預設" ColorRange="顏色範圍" +ColorRange.Default="預設值" ColorRange.Partial="部分" ColorRange.Full="全部" ConfigureAudio="設定音訊"
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/encode-dstr.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/encode-dstr.hpp
Changed
@@ -15,7 +15,8 @@ } static inline void EncodeDeviceId(struct dstr *encodedStr, - const wchar_t *name_str, const wchar_t *path_str) + const wchar_t *name_str, + const wchar_t *path_str) { DStr name; DStr path; @@ -32,7 +33,7 @@ } static inline bool DecodeDeviceDStr(DStr &name, DStr &path, - const char *device_id) + const char *device_id) { const char *path_str; @@ -43,12 +44,12 @@ if (!path_str) return false; - dstr_copy(path, path_str+1); + dstr_copy(path, path_str + 1); dstr_copy(name, device_id); size_t len = path_str - device_id; name->array[len] = 0; - name->len = len; + name->len = len; decode_dstr(name); decode_dstr(path); @@ -73,4 +74,3 @@ return true; } -
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/ffmpeg-decode.c -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/ffmpeg-decode.c
Changed
@@ -19,11 +19,63 @@ #include "obs-ffmpeg-compat.h" #include <obs-avc.h> -int ffmpeg_decode_init(struct ffmpeg_decode *decode, enum AVCodecID id) +#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 4, 100) +#define USE_NEW_HARDWARE_CODEC_METHOD +#endif + +#ifdef USE_NEW_HARDWARE_CODEC_METHOD +enum AVHWDeviceType hw_priority[] = { + AV_HWDEVICE_TYPE_D3D11VA, AV_HWDEVICE_TYPE_DXVA2, AV_HWDEVICE_TYPE_QSV, + AV_HWDEVICE_TYPE_CUDA, AV_HWDEVICE_TYPE_NONE, +}; + +static bool has_hw_type(AVCodec *c, enum AVHWDeviceType type) +{ + for (int i = 0;; i++) { + const AVCodecHWConfig *config = avcodec_get_hw_config(c, i); + if (!config) { + break; + } + + if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX && + config->device_type == type) + return true; + } + + return false; +} + +static void init_hw_decoder(struct ffmpeg_decode *d) +{ + enum AVHWDeviceType *priority = hw_priority; + AVBufferRef *hw_ctx = NULL; + + while (*priority != AV_HWDEVICE_TYPE_NONE) { + if (has_hw_type(d->codec, *priority)) { + int ret = av_hwdevice_ctx_create(&hw_ctx, *priority, + NULL, NULL, 0); + if (ret == 0) + break; + } + + priority++; + } + + if (hw_ctx) { + d->decoder->hw_device_ctx = av_buffer_ref(hw_ctx); + d->hw = true; + } +} +#endif + +int ffmpeg_decode_init(struct ffmpeg_decode *decode, enum AVCodecID id, + bool use_hw) { int ret; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) avcodec_register_all(); +#endif memset(decode, 0, sizeof(*decode)); decode->codec = avcodec_find_decoder(id); @@ -32,6 +84,15 @@ decode->decoder = avcodec_alloc_context3(decode->codec); + decode->decoder->thread_count = 0; + +#ifdef USE_NEW_HARDWARE_CODEC_METHOD + if (use_hw) + init_hw_decoder(decode); +#else + (void)use_hw; +#endif + ret = avcodec_open2(decode->decoder, decode->codec, NULL); if (ret < 0) { ffmpeg_decode_free(decode); @@ -46,6 +107,9 @@ void ffmpeg_decode_free(struct ffmpeg_decode *decode) { + if (decode->hw_frame) + av_free(decode->hw_frame); + if (decode->decoder) { avcodec_close(decode->decoder); av_free(decode->decoder); @@ -63,15 +127,26 @@ static inline enum video_format convert_pixel_format(int f) { switch (f) { - case AV_PIX_FMT_NONE: return VIDEO_FORMAT_NONE; + case AV_PIX_FMT_NONE: + return VIDEO_FORMAT_NONE; case AV_PIX_FMT_YUV420P: - case AV_PIX_FMT_YUVJ420P: return VIDEO_FORMAT_I420; - case AV_PIX_FMT_NV12: return VIDEO_FORMAT_NV12; - case AV_PIX_FMT_YUYV422: return VIDEO_FORMAT_YUY2; - case AV_PIX_FMT_UYVY422: return VIDEO_FORMAT_UYVY; - case AV_PIX_FMT_RGBA: return VIDEO_FORMAT_RGBA; - case AV_PIX_FMT_BGRA: return VIDEO_FORMAT_BGRA; - case AV_PIX_FMT_BGR0: return VIDEO_FORMAT_BGRX; + case AV_PIX_FMT_YUVJ420P: + return VIDEO_FORMAT_I420; + case AV_PIX_FMT_NV12: + return VIDEO_FORMAT_NV12; + case AV_PIX_FMT_YUYV422: + return VIDEO_FORMAT_YUY2; + case AV_PIX_FMT_UYVY422: + return VIDEO_FORMAT_UYVY; + case AV_PIX_FMT_YUV422P: + case AV_PIX_FMT_YUVJ422P: + return VIDEO_FORMAT_I422; + case AV_PIX_FMT_RGBA: + return VIDEO_FORMAT_RGBA; + case AV_PIX_FMT_BGRA: + return VIDEO_FORMAT_BGRA; + case AV_PIX_FMT_BGR0: + return VIDEO_FORMAT_BGRX; default:; } @@ -81,14 +156,22 @@ static inline enum audio_format convert_sample_format(int f) { switch (f) { - case AV_SAMPLE_FMT_U8: return AUDIO_FORMAT_U8BIT; - case AV_SAMPLE_FMT_S16: return AUDIO_FORMAT_16BIT; - case AV_SAMPLE_FMT_S32: return AUDIO_FORMAT_32BIT; - case AV_SAMPLE_FMT_FLT: return AUDIO_FORMAT_FLOAT; - case AV_SAMPLE_FMT_U8P: return AUDIO_FORMAT_U8BIT_PLANAR; - case AV_SAMPLE_FMT_S16P: return AUDIO_FORMAT_16BIT_PLANAR; - case AV_SAMPLE_FMT_S32P: return AUDIO_FORMAT_32BIT_PLANAR; - case AV_SAMPLE_FMT_FLTP: return AUDIO_FORMAT_FLOAT_PLANAR; + case AV_SAMPLE_FMT_U8: + return AUDIO_FORMAT_U8BIT; + case AV_SAMPLE_FMT_S16: + return AUDIO_FORMAT_16BIT; + case AV_SAMPLE_FMT_S32: + return AUDIO_FORMAT_32BIT; + case AV_SAMPLE_FMT_FLT: + return AUDIO_FORMAT_FLOAT; + case AV_SAMPLE_FMT_U8P: + return AUDIO_FORMAT_U8BIT_PLANAR; + case AV_SAMPLE_FMT_S16P: + return AUDIO_FORMAT_16BIT_PLANAR; + case AV_SAMPLE_FMT_S32P: + return AUDIO_FORMAT_32BIT_PLANAR; + case AV_SAMPLE_FMT_FLTP: + return AUDIO_FORMAT_FLOAT_PLANAR; default:; } @@ -98,37 +181,45 @@ static inline enum speaker_layout convert_speaker_layout(uint8_t channels) { switch (channels) { - case 0: return SPEAKERS_UNKNOWN; - case 1: return SPEAKERS_MONO; - case 2: return SPEAKERS_STEREO; - case 3: return SPEAKERS_2POINT1; - case 4: return SPEAKERS_4POINT0; - case 5: return SPEAKERS_4POINT1; - case 6: return SPEAKERS_5POINT1; - case 8: return SPEAKERS_7POINT1; - default: return SPEAKERS_UNKNOWN; + case 0: + return SPEAKERS_UNKNOWN; + case 1: + return SPEAKERS_MONO; + case 2: + return SPEAKERS_STEREO; + case 3: + return SPEAKERS_2POINT1; + case 4: + return SPEAKERS_4POINT0; + case 5: + return SPEAKERS_4POINT1; + case 6: + return SPEAKERS_5POINT1; + case 8: + return SPEAKERS_7POINT1; + default: + return SPEAKERS_UNKNOWN; } } static inline void copy_data(struct ffmpeg_decode *decode, uint8_t *data, - size_t size) + size_t size) { size_t new_size = size + INPUT_BUFFER_PADDING_SIZE; if (decode->packet_size < new_size) { - decode->packet_buffer = brealloc(decode->packet_buffer, - new_size); - decode->packet_size = new_size; + decode->packet_buffer = + brealloc(decode->packet_buffer, new_size); + decode->packet_size = new_size; } memset(decode->packet_buffer + size, 0, INPUT_BUFFER_PADDING_SIZE); memcpy(decode->packet_buffer, data, size); } -bool ffmpeg_decode_audio(struct ffmpeg_decode *decode, - uint8_t *data, size_t size, - struct obs_source_audio *audio, - bool *got_output) +bool ffmpeg_decode_audio(struct ffmpeg_decode *decode, uint8_t *data, + size_t size, struct obs_source_audio *audio, + bool *got_output) { AVPacket packet = {0}; int got_frame = false; @@ -167,8 +258,8 @@ audio->data[i] = decode->frame->data[i]; audio->samples_per_sec = decode->frame->sample_rate; - audio->format = convert_sample_format(decode->frame->format); - audio->speakers = + audio->format = convert_sample_format(decode->frame->format); + audio->speakers = convert_speaker_layout((uint8_t)decode->decoder->channels); audio->frames = decode->frame->nb_samples; @@ -180,14 +271,14 @@ return true; } -bool ffmpeg_decode_video(struct ffmpeg_decode *decode, - uint8_t *data, size_t size, long long *ts, - struct obs_source_frame2 *frame, - bool *got_output) +bool ffmpeg_decode_video(struct ffmpeg_decode *decode, uint8_t *data, + size_t size, long long *ts, + enum video_range_type range, + struct obs_source_frame2 *frame, bool *got_output) { AVPacket packet = {0}; int got_frame = false; - enum video_format new_format; + AVFrame *out_frame; int ret; *got_output = false; @@ -195,23 +286,32 @@ copy_data(decode, data, size); av_init_packet(&packet); - packet.data = decode->packet_buffer; - packet.size = (int)size; - packet.pts = *ts; + packet.data = decode->packet_buffer; + packet.size = (int)size; + packet.pts = *ts; if (decode->codec->id == AV_CODEC_ID_H264 && - obs_avc_keyframe(data, size)) + obs_avc_keyframe(data, size)) packet.flags |= AV_PKT_FLAG_KEY; if (!decode->frame) { decode->frame = av_frame_alloc(); if (!decode->frame) return false; + + if (decode->hw && !decode->hw_frame) { + decode->hw_frame = av_frame_alloc(); + if (!decode->hw_frame) + return false; + } } + out_frame = decode->hw ? decode->hw_frame : decode->frame; + ret = avcodec_send_packet(decode->decoder, &packet); - if (ret == 0) - ret = avcodec_receive_frame(decode->decoder, decode->frame); + if (ret == 0) { + ret = avcodec_receive_frame(decode->decoder, out_frame); + } got_frame = (ret == 0); @@ -223,36 +323,48 @@ else if (!got_frame) return true; +#ifdef USE_NEW_HARDWARE_CODEC_METHOD + if (got_frame && decode->hw) { + ret = av_hwframe_transfer_data(decode->frame, out_frame, 0); + if (ret < 0) { + return false; + } + } +#endif + for (size_t i = 0; i < MAX_AV_PLANES; i++) { - frame->data[i] = decode->frame->data[i]; + frame->data[i] = decode->frame->data[i]; frame->linesize[i] = decode->frame->linesize[i]; } - new_format = convert_pixel_format(decode->frame->format); - if (new_format != frame->format) { - bool success; + frame->format = convert_pixel_format(decode->frame->format); - frame->format = new_format; - frame->range = decode->frame->color_range == AVCOL_RANGE_JPEG - ? VIDEO_RANGE_FULL - : VIDEO_RANGE_DEFAULT; + if (range == VIDEO_RANGE_DEFAULT) { + range = (decode->frame->color_range == AVCOL_RANGE_JPEG) + ? VIDEO_RANGE_FULL + : VIDEO_RANGE_PARTIAL; + } - success = video_format_get_parameters(VIDEO_CS_601, - frame->range, frame->color_matrix, - frame->color_range_min, frame->color_range_max); + if (range != frame->range) { + const bool success = video_format_get_parameters( + VIDEO_CS_601, range, frame->color_matrix, + frame->color_range_min, frame->color_range_max); if (!success) { - blog(LOG_ERROR, "Failed to get video format " - "parameters for video format %u", - VIDEO_CS_601); + blog(LOG_ERROR, + "Failed to get video format " + "parameters for video format %u", + VIDEO_CS_601); return false; } + + frame->range = range; } *ts = decode->frame->pkt_pts; - frame->width = decode->frame->width; + frame->width = decode->frame->width; frame->height = decode->frame->height; - frame->flip = false; + frame->flip = false; if (frame->format == VIDEO_FORMAT_NONE) return false;
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/ffmpeg-decode.h -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/ffmpeg-decode.h
Changed
@@ -38,26 +38,29 @@ struct ffmpeg_decode { AVCodecContext *decoder; - AVCodec *codec; + AVCodec *codec; - AVFrame *frame; + AVFrame *hw_frame; + AVFrame *frame; + bool hw; - uint8_t *packet_buffer; - size_t packet_size; + uint8_t *packet_buffer; + size_t packet_size; }; -extern int ffmpeg_decode_init(struct ffmpeg_decode *decode, enum AVCodecID id); +extern int ffmpeg_decode_init(struct ffmpeg_decode *decode, enum AVCodecID id, + bool use_hw); extern void ffmpeg_decode_free(struct ffmpeg_decode *decode); -extern bool ffmpeg_decode_audio(struct ffmpeg_decode *decode, - uint8_t *data, size_t size, - struct obs_source_audio *audio, - bool *got_output); +extern bool ffmpeg_decode_audio(struct ffmpeg_decode *decode, uint8_t *data, + size_t size, struct obs_source_audio *audio, + bool *got_output); -extern bool ffmpeg_decode_video(struct ffmpeg_decode *decode, - uint8_t *data, size_t size, long long *ts, - struct obs_source_frame2 *frame, - bool *got_output); +extern bool ffmpeg_decode_video(struct ffmpeg_decode *decode, uint8_t *data, + size_t size, long long *ts, + enum video_range_type range, + struct obs_source_frame2 *frame, + bool *got_output); static inline bool ffmpeg_decode_valid(struct ffmpeg_decode *decode) {
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/CMakeLists.txt -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/CMakeLists.txt
Changed
@@ -82,7 +82,7 @@ set(libdshowcapture_HEADERS dshowcapture.hpp - source/IVideoCaptureFilter.h + source/external/IVideoCaptureFilter.h source/capture-filter.hpp source/output-filter.hpp source/device.hpp
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/dshowcapture.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/dshowcapture.hpp
Changed
@@ -24,280 +24,270 @@ #include <functional> #ifdef DSHOWCAPTURE_EXPORTS - #define DSHOWCAPTURE_EXPORT __declspec(dllexport) +#define DSHOWCAPTURE_EXPORT __declspec(dllexport) #else - #define DSHOWCAPTURE_EXPORT +#define DSHOWCAPTURE_EXPORT #endif #define DSHOWCAPTURE_VERSION_MAJOR 0 #define DSHOWCAPTURE_VERSION_MINOR 6 -#define DSHOWCAPTURE_VERSION_PATCH 0 +#define DSHOWCAPTURE_VERSION_PATCH 1 #define MAKE_DSHOWCAPTURE_VERSION(major, minor, patch) \ - ( (major << 24) | \ - (minor << 16) | \ - (patch) ) + ((major << 24) | (minor << 16) | (patch)) -#define DSHOWCAPTURE_VERSION MAKE_DSHOWCAPTURE_VERSION( \ - DSHOWCAPTURE_VERSION_MAJOR, \ - DSHOWCAPTURE_VERSION_MINOR, \ - DSHOWCAPTURE_VERSION_PATCH) +#define DSHOWCAPTURE_VERSION \ + MAKE_DSHOWCAPTURE_VERSION(DSHOWCAPTURE_VERSION_MAJOR, \ + DSHOWCAPTURE_VERSION_MINOR, \ + DSHOWCAPTURE_VERSION_PATCH) #define DSHOW_MAX_PLANES 8 namespace DShow { - /* internal forward */ - struct HDevice; - struct HVideoEncoder; - struct VideoConfig; - struct AudioConfig; - - typedef std::function< - void (const VideoConfig &config, - unsigned char *data, size_t size, - long long startTime, long long stopTime) - > VideoProc; - - typedef std::function< - void (const AudioConfig &config, - unsigned char *data, size_t size, - long long startTime, long long stopTime) - > AudioProc; - - enum class InitGraph { - False, - True - }; - - /** DirectShow configuration dialog type */ - enum class DialogType { - ConfigVideo, - ConfigAudio, - ConfigCrossbar, - ConfigCrossbar2 - }; - - enum class VideoFormat { - Any, - Unknown, - - /* raw formats */ - ARGB = 100, - XRGB, - - /* planar YUV formats */ - I420 = 200, - NV12, - YV12, - Y800, - - /* packed YUV formats */ - YVYU = 300, - YUY2, - UYVY, - HDYC, - - /* encoded formats */ - MJPEG = 400, - H264 - }; - - enum class AudioFormat { - Any, - Unknown, - - /* raw formats */ - Wave16bit = 100, - WaveFloat, - - /* encoded formats */ - AAC = 200, - AC3, - MPGA /* MPEG 1 */ - }; - - enum class AudioMode { - Capture, - DirectSound, - WaveOut - }; - - enum class Result { - Success, - InUse, - Error - }; - - struct VideoInfo { - int minCX, minCY; - int maxCX, maxCY; - int granularityCX, granularityCY; - long long minInterval, maxInterval; - VideoFormat format; - }; - - struct AudioInfo { - int minChannels, maxChannels; - int channelsGranularity; - int minSampleRate, maxSampleRate; - int sampleRateGranularity; - AudioFormat format; - }; - - struct DeviceId { - std::wstring name; - std::wstring path; - }; - - struct VideoDevice : DeviceId { - bool audioAttached = false; - bool separateAudioFilter = false; - std::vector<VideoInfo> caps; - }; - - struct AudioDevice : DeviceId { - std::vector<AudioInfo> caps; - }; - - struct Config : DeviceId { - /** Use the device's desired default config */ - bool useDefaultConfig = true; - }; - - struct VideoConfig : Config { - VideoProc callback; - - /** Desired width/height of video. */ - int cx = 0, cy = 0; - - /** Desired frame interval (in 100-nanosecond units) */ - long long frameInterval = 0; - - /** Internal video format. */ - VideoFormat internalFormat = VideoFormat::Any; - - /** Desired video format. */ - VideoFormat format = VideoFormat::Any; - }; - - struct AudioConfig : Config { - AudioProc callback; - - /** +/* internal forward */ +struct HDevice; +struct HVideoEncoder; +struct VideoConfig; +struct AudioConfig; + +typedef std::function<void(const VideoConfig &config, unsigned char *data, + size_t size, long long startTime, long long stopTime)> + VideoProc; + +typedef std::function<void(const AudioConfig &config, unsigned char *data, + size_t size, long long startTime, long long stopTime)> + AudioProc; + +enum class InitGraph { + False, + True, +}; + +/** DirectShow configuration dialog type */ +enum class DialogType { + ConfigVideo, + ConfigAudio, + ConfigCrossbar, + ConfigCrossbar2, +}; + +enum class VideoFormat { + Any, + Unknown, + + /* raw formats */ + ARGB = 100, + XRGB, + + /* planar YUV formats */ + I420 = 200, + NV12, + YV12, + Y800, + + /* packed YUV formats */ + YVYU = 300, + YUY2, + UYVY, + HDYC, + + /* encoded formats */ + MJPEG = 400, + H264, +}; + +enum class AudioFormat { + Any, + Unknown, + + /* raw formats */ + Wave16bit = 100, + WaveFloat, + + /* encoded formats */ + AAC = 200, + AC3, + MPGA, /* MPEG 1 */ +}; + +enum class AudioMode { + Capture, + DirectSound, + WaveOut, +}; + +enum class Result { + Success, + InUse, + Error, +}; + +struct VideoInfo { + int minCX, minCY; + int maxCX, maxCY; + int granularityCX, granularityCY; + long long minInterval, maxInterval; + VideoFormat format; +}; + +struct AudioInfo { + int minChannels, maxChannels; + int channelsGranularity; + int minSampleRate, maxSampleRate; + int sampleRateGranularity; + AudioFormat format; +}; + +struct DeviceId { + std::wstring name; + std::wstring path; +}; + +struct VideoDevice : DeviceId { + bool audioAttached = false; + bool separateAudioFilter = false; + std::vector<VideoInfo> caps; +}; + +struct AudioDevice : DeviceId { + std::vector<AudioInfo> caps; +}; + +struct Config : DeviceId { + /** Use the device's desired default config */ + bool useDefaultConfig = true; +}; + +struct VideoConfig : Config { + VideoProc callback; + + /** Desired width/height of video. */ + int cx = 0, cy = 0; + + /** Desired frame interval (in 100-nanosecond units) */ + long long frameInterval = 0; + + /** Internal video format. */ + VideoFormat internalFormat = VideoFormat::Any; + + /** Desired video format. */ + VideoFormat format = VideoFormat::Any; +}; + +struct AudioConfig : Config { + AudioProc callback; + + /** * Use the audio attached to the video device * * (name/path memeber variables will be ignored) */ - bool useVideoDevice = false; + bool useVideoDevice = false; - /** Use separate filter for audio */ - bool useSeparateAudioFilter = false; + /** Use separate filter for audio */ + bool useSeparateAudioFilter = false; - /** Desired sample rate */ - int sampleRate = 0; + /** Desired sample rate */ + int sampleRate = 0; - /** Desired channels */ - int channels = 0; + /** Desired channels */ + int channels = 0; - /** Desired audio format */ - AudioFormat format = AudioFormat::Any; + /** Desired audio format */ + AudioFormat format = AudioFormat::Any; - /** Audio playback mode */ - AudioMode mode = AudioMode::Capture; - }; + /** Audio playback mode */ + AudioMode mode = AudioMode::Capture; +}; - class DSHOWCAPTURE_EXPORT Device { - HDevice *context; +class DSHOWCAPTURE_EXPORT Device { + HDevice *context; - public: - Device(InitGraph initialize = InitGraph::False); - ~Device(); +public: + Device(InitGraph initialize = InitGraph::False); + ~Device(); - bool Valid() const; + bool Valid() const; - bool ResetGraph(); - void ShutdownGraph(); + bool ResetGraph(); + void ShutdownGraph(); - bool SetVideoConfig(VideoConfig *config); - bool SetAudioConfig(AudioConfig *config); + bool SetVideoConfig(VideoConfig *config); + bool SetAudioConfig(AudioConfig *config); - /** + /** * Connects all the configured filters together. * * Call SetVideoConfig and/or SetAudioConfig before using. */ - bool ConnectFilters(); + bool ConnectFilters(); - Result Start(); - void Stop(); + Result Start(); + void Stop(); - bool GetVideoConfig(VideoConfig &config) const; - bool GetAudioConfig(AudioConfig &config) const; - bool GetVideoDeviceId(DeviceId &id) const; - bool GetAudioDeviceId(DeviceId &id) const; + bool GetVideoConfig(VideoConfig &config) const; + bool GetAudioConfig(AudioConfig &config) const; + bool GetVideoDeviceId(DeviceId &id) const; + bool GetAudioDeviceId(DeviceId &id) const; - /** + /** * Opens a DirectShow dialog associated with this device * * @param type The dialog type */ - void OpenDialog(void *hwnd, DialogType type) const; - - static bool EnumVideoDevices(std::vector<VideoDevice> &devices); - static bool EnumAudioDevices(std::vector<AudioDevice> &devices); - }; - - struct VideoEncoderConfig : DeviceId { - int fpsNumerator; - int fpsDenominator; - int bitrate; - int keyframeInterval; - int cx; - int cy; - }; - - struct EncoderPacket { - unsigned char *data; - size_t size; - long long pts; - long long dts; - }; - - class VideoEncoder { - HVideoEncoder *context; - - public: - VideoEncoder(); - ~VideoEncoder(); - - bool Valid() const; - bool Active() const; - - bool ResetGraph(); - - bool SetConfig(VideoEncoderConfig &config); - bool GetConfig(VideoEncoderConfig &config) const; - - bool Encode(unsigned char *data[DSHOW_MAX_PLANES], - size_t linesize[DSHOW_MAX_PLANES], - long long timestampStart, - long long timestampEnd, - EncoderPacket &packet, - bool &new_packet); - - static bool EnumEncoders(std::vector<DeviceId> &encoders); - }; - - enum class LogType { - Error, - Warning, - Info, - Debug - }; - - typedef void (*LogCallback)(LogType type, const wchar_t *msg, - void *param); - - DSHOWCAPTURE_EXPORT void SetLogCallback(LogCallback callback, - void *param); + void OpenDialog(void *hwnd, DialogType type) const; + + static bool EnumVideoDevices(std::vector<VideoDevice> &devices); + static bool EnumAudioDevices(std::vector<AudioDevice> &devices); +}; + +struct VideoEncoderConfig : DeviceId { + int fpsNumerator; + int fpsDenominator; + int bitrate; + int keyframeInterval; + int cx; + int cy; +}; + +struct EncoderPacket { + unsigned char *data; + size_t size; + long long pts; + long long dts; +}; + +class VideoEncoder { + HVideoEncoder *context; + +public: + VideoEncoder(); + ~VideoEncoder(); + + bool Valid() const; + bool Active() const; + + bool ResetGraph(); + + bool SetConfig(VideoEncoderConfig &config); + bool GetConfig(VideoEncoderConfig &config) const; + + bool Encode(unsigned char *data[DSHOW_MAX_PLANES], + size_t linesize[DSHOW_MAX_PLANES], long long timestampStart, + long long timestampEnd, EncoderPacket &packet, + bool &new_packet); + + static bool EnumEncoders(std::vector<DeviceId> &encoders); +}; + +enum class LogType { + Error, + Warning, + Info, + Debug, +}; + +typedef void (*LogCallback)(LogType type, const wchar_t *msg, void *param); + +DSHOWCAPTURE_EXPORT void SetLogCallback(LogCallback callback, void *param); };
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/CoTaskMemPtr.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/CoTaskMemPtr.hpp
Changed
@@ -19,23 +19,27 @@ template<typename T> class CoTaskMemPtr { T *ptr; - inline void Clear() {if (ptr) CoTaskMemFree(ptr);} + inline void Clear() + { + if (ptr) + CoTaskMemFree(ptr); + } public: - inline CoTaskMemPtr() : ptr(NULL) {} + inline CoTaskMemPtr() : ptr(NULL) {} inline CoTaskMemPtr(T *ptr_) : ptr(ptr_) {} - inline ~CoTaskMemPtr() {Clear();} + inline ~CoTaskMemPtr() { Clear(); } - inline operator T*() const {return ptr;} - inline T *operator->() const {return ptr;} + inline operator T *() const { return ptr; } + inline T *operator->() const { return ptr; } - inline CoTaskMemPtr& operator=(T* val) + inline CoTaskMemPtr &operator=(T *val) { Clear(); ptr = val; } - inline T** operator&() + inline T **operator&() { Clear(); ptr = NULL;
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/ComPtr.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/ComPtr.hpp
Changed
@@ -33,24 +33,34 @@ inline void Replace(T *p) { if (ptr != p) { - if (p) p->AddRef(); - if (ptr) ptr->Release(); + if (p) + p->AddRef(); + if (ptr) + ptr->Release(); ptr = p; } } public: - inline ComPtr() : ptr(NULL) {} - inline ComPtr(T *p) : ptr(p) {if (ptr) ptr->AddRef();} - inline ComPtr(const ComPtr<T> &c) : ptr(c.ptr) {if (ptr) ptr->AddRef();} - inline ComPtr(ComPtr<T> &&c) : ptr(c.ptr) {c.ptr = NULL;} - inline ~ComPtr() {Kill();} + inline ComPtr() : ptr(nullptr) {} + inline ComPtr(T *p) : ptr(p) + { + if (ptr) + ptr->AddRef(); + } + inline ComPtr(const ComPtr<T> &c) : ptr(c.ptr) + { + if (ptr) + ptr->AddRef(); + } + inline ComPtr(ComPtr<T> &&c) : ptr(c.ptr) { c.ptr = nullptr; } + inline ~ComPtr() { Kill(); } inline void Clear() { if (ptr) { ptr->Release(); - ptr = NULL; + ptr = nullptr; } } @@ -68,10 +78,10 @@ inline ComPtr<T> &operator=(ComPtr<T> &&c) { - if (this != &c) { + if (&ptr != &c.ptr) { Kill(); ptr = c.ptr; - c.ptr = NULL; + c.ptr = nullptr; } return *this; @@ -87,7 +97,8 @@ inline void CopyTo(T **out) { if (out) { - if (ptr) ptr->AddRef(); + if (ptr) + ptr->AddRef(); *out = ptr; } } @@ -96,26 +107,35 @@ { ULONG ref; - if (!ptr) return 0; + if (!ptr) + return 0; ref = ptr->Release(); ptr = nullptr; return ref; } - inline T **Assign() {Clear(); return &ptr;} - inline void Set(T *p) {Kill(); ptr = p;} + inline T **Assign() + { + Clear(); + return &ptr; + } + inline void Set(T *p) + { + Kill(); + ptr = p; + } - inline T *Get() const {return ptr;} + inline T *Get() const { return ptr; } - inline T **operator&() {return Assign();} + inline T **operator&() { return Assign(); } - inline operator T*() const {return ptr;} - inline T *operator->() const {return ptr;} + inline operator T *() const { return ptr; } + inline T *operator->() const { return ptr; } - inline bool operator==(T *p) const {return ptr == p;} - inline bool operator!=(T *p) const {return ptr != p;} + inline bool operator==(T *p) const { return ptr == p; } + inline bool operator!=(T *p) const { return ptr != p; } - inline bool operator!() const {return !ptr;} + inline bool operator!() const { return !ptr; } }; template<class T> class ComQIPtr : public ComPtr<T> { @@ -124,13 +144,13 @@ inline ComQIPtr(IUnknown *unk) { this->ptr = nullptr; - unk->QueryInterface(__uuidof(T), (void**)&this->ptr); + unk->QueryInterface(__uuidof(T), (void **)&this->ptr); } inline ComPtr<T> &operator=(IUnknown *unk) { ComPtr<T>::Clear(); - unk->QueryInterface(__uuidof(T), (void**)&this->ptr); + unk->QueryInterface(__uuidof(T), (void **)&this->ptr); return *this; } };
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/avermedia-encode.h -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/avermedia-encode.h
Changed
@@ -12,40 +12,43 @@ */ #pragma once -static const GUID AVER_HW_ENCODE_PROPERTY = -{0x1bd55918, 0xbaf5, 0x4781, {0x8d, 0x76, 0xe0, 0xa0, 0xa5, 0xe1, 0xd2, 0xb8}}; +static const GUID AVER_HW_ENCODE_PROPERTY = {0x1bd55918, + 0xbaf5, + 0x4781, + {0x8d, 0x76, 0xe0, 0xa0, 0xa5, + 0xe1, 0xd2, 0xb8}}; enum { // @brief PropertySet Enumeration - // param AVER_PARAMETERS - PROPERTY_HW_ENCODE_PARAMETER = 0 + // param AVER_PARAMETERS + PROPERTY_HW_ENCODE_PARAMETER = 0 }; enum { // property to set/get the encode frame rate // ulParam1 = Frames per second - AVER_PARAMETER_ENCODE_FRAME_RATE = 0, + AVER_PARAMETER_ENCODE_FRAME_RATE = 0, // property to set/get the encode bit rate // ulParam1 = Bitrate (kb/s) - AVER_PARAMETER_ENCODE_BIT_RATE = 1, + AVER_PARAMETER_ENCODE_BIT_RATE = 1, // property to get the output resolution // ulParam1 = Resolution width // ulParam2 = Resolution height - AVER_PARAMETER_CURRENT_RESOLUTION = 2, + AVER_PARAMETER_CURRENT_RESOLUTION = 2, // property to set the output resolution // ulParam1 = Resolution width // ulParam2 = Resolution height - AVER_PARAMETER_ENCODE_RESOLUTION = 3, + AVER_PARAMETER_ENCODE_RESOLUTION = 3, // property to set/get the encode GOP // ulParam1 = GOP length - AVER_PARAMETER_ENCODE_GOP = 4, + AVER_PARAMETER_ENCODE_GOP = 4, // property to insert an I frame to the encoded stream - AVER_PARAMETER_INSERT_I_FRAME = 6 + AVER_PARAMETER_INSERT_I_FRAME = 6 }; struct AVER_PARAMETERS {
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/capture-filter.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/capture-filter.cpp
Changed
@@ -28,21 +28,17 @@ #define PrintFunc(x) #endif -#define FILTER_NAME L"Capture Filter" +#define FILTER_NAME L"Capture Filter" #define VIDEO_PIN_NAME L"Video Capture" #define AUDIO_PIN_NAME L"Audio Capture" CapturePin::CapturePin(CaptureFilter *filter_, const PinCaptureInfo &info) - : refCount (0), - captureInfo (info), - filter (filter_) + : refCount(0), captureInfo(info), filter(filter_) { connectedMediaType->majortype = info.expectedMajorType; } -CapturePin::~CapturePin() -{ -} +CapturePin::~CapturePin() {} STDMETHODIMP CapturePin::QueryInterface(REFIID riid, void **ppv) { @@ -51,10 +47,10 @@ *ppv = this; } else if (riid == IID_IPin) { AddRef(); - *ppv = (IPin*)this; + *ppv = (IPin *)this; } else if (riid == IID_IMemInputPin) { AddRef(); - *ppv = (IMemInputPin*)this; + *ppv = (IMemInputPin *)this; } else { *ppv = nullptr; return E_NOINTERFACE; @@ -105,7 +101,7 @@ } STDMETHODIMP CapturePin::ReceiveConnection(IPin *pConnector, - const AM_MEDIA_TYPE *pmt) + const AM_MEDIA_TYPE *pmt) { PrintFunc(L"CapturePin::ReceiveConnection"); @@ -119,7 +115,7 @@ if (QueryAccept(pmt) != S_OK) return VFW_E_TYPE_NOT_ACCEPTED; - connectedPin = pConnector; + connectedPin = pConnector; connectedMediaType = pmt; return S_OK; @@ -136,7 +132,6 @@ return S_OK; } - STDMETHODIMP CapturePin::ConnectedTo(IPin **pPin) { PrintFunc(L"CapturePin::ConnectedTo"); @@ -190,7 +185,7 @@ STDMETHODIMP CapturePin::QueryId(LPWSTR *lpId) { - wchar_t *str = (wchar_t*)CoTaskMemAlloc(sizeof(CAPTURE_PIN_NAME)); + wchar_t *str = (wchar_t *)CoTaskMemAlloc(sizeof(CAPTURE_PIN_NAME)); memcpy(str, CAPTURE_PIN_NAME, sizeof(CAPTURE_PIN_NAME)); *lpId = str; return S_OK; @@ -254,8 +249,8 @@ return S_OK; } -STDMETHODIMP CapturePin::NewSegment(REFERENCE_TIME tStart, - REFERENCE_TIME tStop, double dRate) +STDMETHODIMP CapturePin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, + double dRate) { PrintFunc(L"CapturePin::NewSegment"); @@ -275,7 +270,7 @@ } STDMETHODIMP CapturePin::NotifyAllocator(IMemAllocator *pAllocator, - BOOL bReadOnly) + BOOL bReadOnly) { PrintFunc(L"CapturePin::NotifyAllocator"); @@ -305,8 +300,8 @@ return S_OK; } -STDMETHODIMP CapturePin::ReceiveMultiple(IMediaSample **pSamples, - long nSamples, long *nSamplesProcessed) +STDMETHODIMP CapturePin::ReceiveMultiple(IMediaSample **pSamples, long nSamples, + long *nSamplesProcessed) { PrintFunc(L"CapturePin::ReceiveMultiple"); @@ -322,12 +317,15 @@ return S_OK; } -STDMETHODIMP CapturePin::ReceiveCanBlock() {return S_FALSE;} +STDMETHODIMP CapturePin::ReceiveCanBlock() +{ + return S_FALSE; +} bool CapturePin::IsValidMediaType(const AM_MEDIA_TYPE *pmt) const { if (pmt->pbFormat) { - if (pmt->subtype != captureInfo.expectedSubType || + if (pmt->subtype != captureInfo.expectedSubType || pmt->majortype != captureInfo.expectedMajorType) return false; @@ -385,16 +383,14 @@ }; CaptureFilter::CaptureFilter(const PinCaptureInfo &info) - : refCount (0), - state (State_Stopped), - pin (new CapturePin(this, info)), - misc (new MiscFlagsHandler) + : refCount(0), + state(State_Stopped), + pin(new CapturePin(this, info)), + misc(new MiscFlagsHandler) { } -CaptureFilter::~CaptureFilter() -{ -} +CaptureFilter::~CaptureFilter() {} // IUnknown methods STDMETHODIMP CaptureFilter::QueryInterface(REFIID riid, void **ppv) @@ -404,15 +400,15 @@ *ppv = this; } else if (riid == IID_IPersist) { AddRef(); - *ppv = (IPersist*)this; + *ppv = (IPersist *)this; } else if (riid == IID_IMediaFilter) { AddRef(); - *ppv = (IMediaFilter*)this; + *ppv = (IMediaFilter *)this; } else if (riid == IID_IBaseFilter) { AddRef(); - *ppv = (IBaseFilter*)this; + *ppv = (IBaseFilter *)this; } else if (riid == IID_IAMFilterMiscFlags) { - misc.CopyTo((IAMFilterMiscFlags**)ppv); + misc.CopyTo((IAMFilterMiscFlags **)ppv); } else { *ppv = nullptr; return E_NOINTERFACE; @@ -541,21 +537,19 @@ // ============================================================================ CaptureEnumPins::CaptureEnumPins(CaptureFilter *filter_, CaptureEnumPins *pEnum) - : filter (filter_) + : filter(filter_) { curPin = (pEnum != nullptr) ? pEnum->curPin : 0; } -CaptureEnumPins::~CaptureEnumPins() -{ -} +CaptureEnumPins::~CaptureEnumPins() {} // IUnknown STDMETHODIMP CaptureEnumPins::QueryInterface(REFIID riid, void **ppv) { if (riid == IID_IUnknown || riid == IID_IEnumPins) { AddRef(); - *ppv = (IEnumPins*)this; + *ppv = (IEnumPins *)this; return NOERROR; } else { *ppv = nullptr; @@ -593,7 +587,8 @@ curPin++; } - if (pcFetched) *pcFetched = nFetched; + if (pcFetched) + *pcFetched = nFetched; return (nFetched == cPins) ? S_OK : S_FALSE; } @@ -615,17 +610,11 @@ return (*ppEnum == nullptr) ? E_OUTOFMEMORY : NOERROR; } - // ============================================================================ -CaptureEnumMediaTypes::CaptureEnumMediaTypes(CapturePin *pin_) - : pin (pin_) -{ -} +CaptureEnumMediaTypes::CaptureEnumMediaTypes(CapturePin *pin_) : pin(pin_) {} -CaptureEnumMediaTypes::~CaptureEnumMediaTypes() -{ -} +CaptureEnumMediaTypes::~CaptureEnumMediaTypes() {} STDMETHODIMP CaptureEnumMediaTypes::QueryInterface(REFIID riid, void **ppv) { @@ -656,7 +645,8 @@ // IEnumMediaTypes STDMETHODIMP CaptureEnumMediaTypes::Next(ULONG cMediaTypes, - AM_MEDIA_TYPE **ppMediaTypes, ULONG *pcFetched) + AM_MEDIA_TYPE **ppMediaTypes, + ULONG *pcFetched) { PrintFunc(L"CaptureEnumMediaTypes::Next"); @@ -668,7 +658,8 @@ curMT++; } - if (pcFetched) *pcFetched = nFetched; + if (pcFetched) + *pcFetched = nFetched; return (nFetched == cMediaTypes) ? S_OK : S_FALSE; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/capture-filter.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/capture-filter.hpp
Changed
@@ -31,21 +31,21 @@ typedef void (*CaptureCallback)(void *param, IMediaSample *sample); struct PinCaptureInfo { - std::function<void (IMediaSample *sample)> callback; - GUID expectedMajorType; - GUID expectedSubType; + std::function<void(IMediaSample *sample)> callback; + GUID expectedMajorType; + GUID expectedSubType; }; class CapturePin : public IPin, public IMemInputPin { friend class CaptureEnumMediaTypes; - volatile long refCount; + volatile long refCount; - PinCaptureInfo captureInfo; - ComPtr<IPin> connectedPin; - CaptureFilter *filter; - MediaType connectedMediaType; - volatile bool flushing = false; + PinCaptureInfo captureInfo; + ComPtr<IPin> connectedPin; + CaptureFilter *filter; + MediaType connectedMediaType; + volatile bool flushing = false; bool IsValidMediaType(const AM_MEDIA_TYPE *pmt) const; @@ -60,7 +60,7 @@ // IPin methods STDMETHODIMP Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt); STDMETHODIMP ReceiveConnection(IPin *connector, - const AM_MEDIA_TYPE *pmt); + const AM_MEDIA_TYPE *pmt); STDMETHODIMP Disconnect(); STDMETHODIMP ConnectedTo(IPin **pPin); STDMETHODIMP ConnectionMediaType(AM_MEDIA_TYPE *pmt); @@ -69,13 +69,13 @@ STDMETHODIMP QueryId(LPWSTR *lpId); STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE *pmt); STDMETHODIMP EnumMediaTypes(IEnumMediaTypes **ppEnum); - STDMETHODIMP QueryInternalConnections(IPin* *apPin, ULONG *nPin); + STDMETHODIMP QueryInternalConnections(IPin **apPin, ULONG *nPin); STDMETHODIMP EndOfStream(); STDMETHODIMP BeginFlush(); STDMETHODIMP EndFlush(); STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, - double dRate); + double dRate); // IMemInputPin methods STDMETHODIMP GetAllocator(IMemAllocator **ppAllocator); @@ -83,17 +83,17 @@ STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps); STDMETHODIMP Receive(IMediaSample *pSample); STDMETHODIMP ReceiveMultiple(IMediaSample **pSamples, long nSamples, - long *nSamplesProcessed); + long *nSamplesProcessed); STDMETHODIMP ReceiveCanBlock(); }; class CaptureFilter : public IBaseFilter { friend class CapturePin; - volatile long refCount; - FILTER_STATE state; - ComPtr<IFilterGraph> graph; - ComPtr<CapturePin> pin; + volatile long refCount; + FILTER_STATE state; + ComPtr<IFilterGraph> graph; + ComPtr<CapturePin> pin; ComPtr<IAMFilterMiscFlags> misc; @@ -124,13 +124,13 @@ STDMETHODIMP JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName); STDMETHODIMP QueryVendorInfo(LPWSTR *pVendorInfo); - inline CapturePin* GetPin() const {return (CapturePin*)pin;} + inline CapturePin *GetPin() const { return (CapturePin *)pin; } }; class CaptureEnumPins : public IEnumPins { - volatile long refCount = 1; - ComPtr<CaptureFilter> filter; - UINT curPin; + volatile long refCount = 1; + ComPtr<CaptureFilter> filter; + UINT curPin; public: CaptureEnumPins(CaptureFilter *filter, CaptureEnumPins *pEnum); @@ -149,9 +149,9 @@ }; class CaptureEnumMediaTypes : public IEnumMediaTypes { - volatile long refCount = 1; - ComPtr<CapturePin> pin; - UINT curMT = 0; + volatile long refCount = 1; + ComPtr<CapturePin> pin; + UINT curMT = 0; public: CaptureEnumMediaTypes(CapturePin *pin); @@ -164,7 +164,7 @@ // IEnumMediaTypes STDMETHODIMP Next(ULONG cMediaTypes, AM_MEDIA_TYPE **ppMediaTypes, - ULONG *pcFetched); + ULONG *pcFetched); STDMETHODIMP Skip(ULONG cMediaTypes); STDMETHODIMP Reset(); STDMETHODIMP Clone(IEnumMediaTypes **ppEnum);
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/device.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/device.cpp
Changed
@@ -30,11 +30,7 @@ bool SetRocketEnabled(IBaseFilter *encoder, bool enable); -HDevice::HDevice() - : initialized (false), - active (false) -{ -} +HDevice::HDevice() : initialized(false), active(false) {} HDevice::~HDevice() { @@ -87,28 +83,27 @@ return true; } -inline void HDevice::SendToCallback(bool video, - unsigned char *data, size_t size, - long long startTime, long long stopTime) +inline void HDevice::SendToCallback(bool video, unsigned char *data, + size_t size, long long startTime, + long long stopTime) { if (!size) return; if (video) videoConfig.callback(videoConfig, data, size, startTime, - stopTime); + stopTime); else audioConfig.callback(audioConfig, data, size, startTime, - stopTime); + stopTime); } void HDevice::Receive(bool isVideo, IMediaSample *sample) { BYTE *ptr; MediaTypePtr mt; - bool encoded = isVideo ? - ((int)videoConfig.format >= 400) : - ((int)audioConfig.format >= 200); + bool encoded = isVideo ? ((int)videoConfig.format >= 400) + : ((int)audioConfig.format >= 200); if (!sample) return; @@ -142,18 +137,17 @@ /* packets that have time are the first packet in a group of * segments */ if (hasTime) { - SendToCallback(isVideo, - data.bytes.data(), data.bytes.size(), - data.lastStartTime, data.lastStopTime); + SendToCallback(isVideo, data.bytes.data(), + data.bytes.size(), data.lastStartTime, + data.lastStopTime); data.bytes.resize(0); data.lastStartTime = startTime; - data.lastStopTime = stopTime; + data.lastStopTime = stopTime; } - data.bytes.insert(data.bytes.end(), - (unsigned char*)ptr, - (unsigned char*)ptr + size); + data.bytes.insert(data.bytes.end(), (unsigned char *)ptr, + (unsigned char *)ptr + size); } else if (hasTime) { SendToCallback(isVideo, ptr, size, startTime, stopTime); @@ -162,14 +156,14 @@ void HDevice::ConvertVideoSettings() { - VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)videoMediaType->pbFormat; + VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)videoMediaType->pbFormat; BITMAPINFOHEADER *bmih = GetBitmapInfoHeader(videoMediaType); if (bmih) { Debug(L"Video media type changed"); - videoConfig.cx = bmih->biWidth; - videoConfig.cy = bmih->biHeight; + videoConfig.cx = bmih->biWidth; + videoConfig.cy = bmih->biHeight; videoConfig.frameInterval = vih->AvgTimePerFrame; bool same = videoConfig.internalFormat == videoConfig.format; @@ -183,12 +177,12 @@ void HDevice::ConvertAudioSettings() { WAVEFORMATEX *wfex = - reinterpret_cast<WAVEFORMATEX*>(audioMediaType->pbFormat); + reinterpret_cast<WAVEFORMATEX *>(audioMediaType->pbFormat); Debug(L"Audio media type changed"); audioConfig.sampleRate = wfex->nSamplesPerSec; - audioConfig.channels = wfex->nChannels; + audioConfig.channels = wfex->nChannels; if (wfex->wFormatTag == WAVE_FORMAT_RAW_AAC1) audioConfig.format = AudioFormat::AAC; @@ -207,7 +201,7 @@ #define HD_PVR1_NAME L"Hauppauge HD PVR Capture" bool HDevice::SetupExceptionVideoCapture(IBaseFilter *filter, - VideoConfig &config) + VideoConfig &config) { ComPtr<IPin> pin; @@ -226,7 +220,7 @@ if (SUCCEEDED(pin->EnumMediaTypes(&mediaTypes))) { MediaTypePtr curMT; - ULONG count = 0; + ULONG count = 0; while (mediaTypes->Next(1, &curMT, &count) == S_OK) { if (curMT->formattype == FORMAT_VideoInfo) { @@ -241,9 +235,9 @@ bool HDevice::SetupVideoCapture(IBaseFilter *filter, VideoConfig &config) { - ComPtr<IPin> pin; - HRESULT hr; - bool success; + ComPtr<IPin> pin; + HRESULT hr; + bool success; if (config.name.find(L"C875") != std::string::npos || config.name.find(L"Prif Streambox") != std::string::npos || @@ -257,7 +251,7 @@ return SetupEncodedVideoCapture(filter, config, HD_PVR1); success = GetFilterPin(filter, MEDIATYPE_Video, PIN_CATEGORY_CAPTURE, - PINDIR_OUTPUT, &pin); + PINDIR_OUTPUT, &pin); if (!success) { if (SetupExceptionVideoCapture(filter, config)) { return true; @@ -310,7 +304,7 @@ ConvertVideoSettings(); PinCaptureInfo info; - info.callback = [this] (IMediaSample *s) {Receive(true, s);}; + info.callback = [this](IMediaSample *s) { Receive(true, s); }; info.expectedMajorType = videoMediaType->majortype; /* attempt to force intermediary filters for these types */ @@ -328,7 +322,7 @@ info.expectedSubType = videoMediaType->subtype; videoCapture = new CaptureFilter(info); - videoFilter = filter; + videoFilter = filter; graph->AddFilter(videoCapture, L"Video Capture Filter"); graph->AddFilter(videoFilter, L"Video Filter"); @@ -358,10 +352,11 @@ } bool success = GetDeviceFilter(CLSID_VideoInputDeviceCategory, - config->name.c_str(), config->path.c_str(), &filter); + config->name.c_str(), + config->path.c_str(), &filter); if (!success) { Error(L"Video device '%s': %s not found", config->name.c_str(), - config->path.c_str()); + config->path.c_str()); return false; } @@ -381,15 +376,16 @@ bool HDevice::SetupExceptionAudioCapture(IPin *pin) { - ComPtr<IEnumMediaTypes> enumMediaTypes; - ULONG count = 0; - HRESULT hr; - MediaTypePtr mt; + ComPtr<IEnumMediaTypes> enumMediaTypes; + ULONG count = 0; + HRESULT hr; + MediaTypePtr mt; hr = pin->EnumMediaTypes(&enumMediaTypes); if (FAILED(hr)) { WarningHR(L"SetupExceptionAudioCapture: pin->EnumMediaTypes " - L"failed", hr); + L"failed", + hr); return false; } @@ -406,13 +402,13 @@ bool HDevice::SetupAudioCapture(IBaseFilter *filter, AudioConfig &config) { - ComPtr<IPin> pin; - MediaTypePtr defaultMT; - bool success; - HRESULT hr; + ComPtr<IPin> pin; + MediaTypePtr defaultMT; + bool success; + HRESULT hr; success = GetFilterPin(filter, MEDIATYPE_Audio, PIN_CATEGORY_CAPTURE, - PINDIR_OUTPUT, &pin); + PINDIR_OUTPUT, &pin); if (!success) { Error(L"Could not get audio pin"); return false; @@ -451,13 +447,13 @@ ConvertAudioSettings(); PinCaptureInfo info; - info.callback = [this] (IMediaSample *s) {Receive(false, s);}; + info.callback = [this](IMediaSample *s) { Receive(false, s); }; info.expectedMajorType = audioMediaType->majortype; - info.expectedSubType = audioMediaType->subtype; + info.expectedSubType = audioMediaType->subtype; audioCapture = new CaptureFilter(info); - audioFilter = filter; - audioConfig = config; + audioFilter = filter; + audioConfig = config; graph->AddFilter(audioCapture, L"Audio Capture Filter"); if (!config.useVideoDevice) @@ -478,7 +474,7 @@ } hr = CoCreateInstance(*clsID, nullptr, CLSCTX_INPROC_SERVER, - IID_IBaseFilter, (void**)&outputFilter); + IID_IBaseFilter, (void **)&outputFilter); if (FAILED(hr)) { ErrorHR(L"Failed to create audio sound output filter", hr); return false; @@ -528,20 +524,21 @@ filter = videoFilter; } else if (config->useSeparateAudioFilter) { - bool success = GetDeviceAudioFilter(videoConfig.path.c_str(), &filter); + bool success = + GetDeviceAudioFilter(videoConfig.path.c_str(), &filter); if (!success) { Error(L"Corresponding audio device for '%s' not found", - videoConfig.path.c_str()); + videoConfig.path.c_str()); return false; } } else { bool success = GetDeviceFilter(CLSID_AudioInputDeviceCategory, - config->name.c_str(), config->path.c_str(), - &filter); + config->name.c_str(), + config->path.c_str(), &filter); if (!success) { - Error(L"Audio device '%s': %s not found", config->name.c_str(), - config->path.c_str()); + Error(L"Audio device '%s': %s not found", + config->name.c_str(), config->path.c_str()); return false; } } @@ -583,7 +580,7 @@ HRESULT hr; hr = builder->FindInterface(NULL, NULL, filter, IID_IAMCrossbar, - (void**)crossbar); + (void **)crossbar); if (SUCCEEDED(hr)) return true; @@ -599,7 +596,7 @@ } bool HDevice::ConnectPins(const GUID &category, const GUID &type, - IBaseFilter *filter, IBaseFilter *capture) + IBaseFilter *filter, IBaseFilter *capture) { HRESULT hr; ComPtr<IBaseFilter> crossbar; @@ -614,7 +611,7 @@ if (connectCrossbar && FindCrossbar(filter, &crossbar)) { if (!DirectConnectFilters(graph, crossbar, filter)) { Warning(L"HDevice::ConnectPins: Failed to connect " - L"crossbar"); + L"crossbar"); return false; } } @@ -631,8 +628,7 @@ hr = graph->ConnectDirect(filterPin, capturePin, nullptr); if (FAILED(hr)) { - WarningHR(L"HDevice::ConnectPins: failed to connect pins", - hr); + WarningHR(L"HDevice::ConnectPins: failed to connect pins", hr); return false; } @@ -640,7 +636,7 @@ } bool HDevice::RenderFilters(const GUID &category, const GUID &type, - IBaseFilter *filter, IBaseFilter *capture) + IBaseFilter *filter, IBaseFilter *capture) { HRESULT hr; @@ -661,7 +657,7 @@ { ComPtr<IPin> pin; bool success = GetFilterPin(audioFilter, MEDIATYPE_Audio, - PIN_CATEGORY_CAPTURE, PINDIR_OUTPUT, &pin); + PIN_CATEGORY_CAPTURE, PINDIR_OUTPUT, &pin); if (!success) return; @@ -682,7 +678,7 @@ if (mt->cbFormat != sizeof(WAVEFORMATEX)) return; - WAVEFORMATEX *wfex = (WAVEFORMATEX*)mt->pbFormat; + WAVEFORMATEX *wfex = (WAVEFORMATEX *)mt->pbFormat; ALLOCATOR_PROPERTIES props; props.cBuffers = -1; @@ -692,7 +688,8 @@ HRESULT hr = neg->SuggestAllocatorProperties(&props); if (FAILED(hr)) WarningHR(L"Could not set allocator properties on audio " - L"capture pin", hr); + L"capture pin", + hr); } bool HDevice::ConnectFilters() @@ -704,37 +701,36 @@ return false; if (videoCapture != NULL) { - success = ConnectPins(PIN_CATEGORY_CAPTURE, - MEDIATYPE_Video, videoFilter, - videoCapture); + success = ConnectPins(PIN_CATEGORY_CAPTURE, MEDIATYPE_Video, + videoFilter, videoCapture); if (!success) { success = RenderFilters(PIN_CATEGORY_CAPTURE, - MEDIATYPE_Video, videoFilter, - videoCapture); + MEDIATYPE_Video, videoFilter, + videoCapture); } } if ((audioCapture || audioOutput) && success) { - IBaseFilter *filter = (audioCapture != nullptr) ? - audioCapture.Get() : audioOutput.Get(); + IBaseFilter *filter = (audioCapture != nullptr) + ? audioCapture.Get() + : audioOutput.Get(); /* Stream engine has a bug where it will break if you try to * set different audio buffering, so don't use audio buffering * if using the stream engine's audio */ bool streamEngine = audioConfig.useVideoDevice && - (videoConfig.name.find(L"Stream Engine") != - std::string::npos); + (videoConfig.name.find(L"Stream Engine") != + std::string::npos); if (!streamEngine && audioCapture != nullptr) SetAudioBuffering(10); - success = ConnectPins(PIN_CATEGORY_CAPTURE, - MEDIATYPE_Audio, audioFilter, - filter); + success = ConnectPins(PIN_CATEGORY_CAPTURE, MEDIATYPE_Audio, + audioFilter, filter); if (!success) { success = RenderFilters(PIN_CATEGORY_CAPTURE, - MEDIATYPE_Audio, audioFilter, - filter); + MEDIATYPE_Audio, audioFilter, + filter); } } @@ -746,8 +742,8 @@ void HDevice::DisconnectFilters() { - ComPtr<IEnumFilters> filterEnum; - HRESULT hr; + ComPtr<IEnumFilters> filterEnum; + HRESULT hr; if (!graph) return; @@ -767,8 +763,7 @@ { HRESULT hr; - if (!EnsureInitialized(L"Start") || - !EnsureInactive(L"Start")) + if (!EnsureInitialized(L"Start") || !EnsureInactive(L"Start")) return Result::Error; if (!!rocketEncoder)
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/device.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/device.hpp
Changed
@@ -29,45 +29,45 @@ namespace DShow { struct EncodedData { - long long lastStartTime = 0; - long long lastStopTime = 0; - vector<unsigned char> bytes; + long long lastStartTime = 0; + long long lastStopTime = 0; + vector<unsigned char> bytes; }; struct EncodedDevice { VideoFormat videoFormat; - ULONG videoPacketID; - long width; - long height; - long long frameInterval; + ULONG videoPacketID; + long width; + long height; + long long frameInterval; AudioFormat audioFormat; - ULONG audioPacketID; - DWORD samplesPerSec; + ULONG audioPacketID; + DWORD samplesPerSec; }; struct HDevice { - ComPtr<IGraphBuilder> graph; - ComPtr<ICaptureGraphBuilder2> builder; - ComPtr<IMediaControl> control; - - ComPtr<IBaseFilter> videoFilter; - ComPtr<IBaseFilter> audioFilter; - ComPtr<CaptureFilter> videoCapture; - ComPtr<CaptureFilter> audioCapture; - ComPtr<IBaseFilter> audioOutput; - ComPtr<IBaseFilter> rocketEncoder; - MediaType videoMediaType; - MediaType audioMediaType; - VideoConfig videoConfig; - AudioConfig audioConfig; - - bool encodedDevice = false; - bool initialized; - bool active; - - EncodedData encodedVideo; - EncodedData encodedAudio; + ComPtr<IGraphBuilder> graph; + ComPtr<ICaptureGraphBuilder2> builder; + ComPtr<IMediaControl> control; + + ComPtr<IBaseFilter> videoFilter; + ComPtr<IBaseFilter> audioFilter; + ComPtr<CaptureFilter> videoCapture; + ComPtr<CaptureFilter> audioCapture; + ComPtr<IBaseFilter> audioOutput; + ComPtr<IBaseFilter> rocketEncoder; + MediaType videoMediaType; + MediaType audioMediaType; + VideoConfig videoConfig; + AudioConfig audioConfig; + + bool encodedDevice = false; + bool initialized; + bool active; + + EncodedData encodedVideo; + EncodedData encodedAudio; HDevice(); ~HDevice(); @@ -79,18 +79,16 @@ bool EnsureActive(const wchar_t *func); bool EnsureInactive(const wchar_t *func); - inline void SendToCallback(bool video, - unsigned char *data, size_t size, - long long startTime, long long stopTime); + inline void SendToCallback(bool video, unsigned char *data, size_t size, + long long startTime, long long stopTime); void Receive(bool video, IMediaSample *sample); - bool SetupEncodedVideoCapture(IBaseFilter *filter, - VideoConfig &config, - const EncodedDevice &info); + bool SetupEncodedVideoCapture(IBaseFilter *filter, VideoConfig &config, + const EncodedDevice &info); bool SetupExceptionVideoCapture(IBaseFilter *filter, - VideoConfig &config); + VideoConfig &config); bool SetupExceptionAudioCapture(IPin *pin); @@ -105,9 +103,9 @@ bool CreateGraph(); bool FindCrossbar(IBaseFilter *filter, IBaseFilter **crossbar); bool ConnectPins(const GUID &category, const GUID &type, - IBaseFilter *filter, IBaseFilter *capture); + IBaseFilter *filter, IBaseFilter *capture); bool RenderFilters(const GUID &category, const GUID &type, - IBaseFilter *filter, IBaseFilter *capture); + IBaseFilter *filter, IBaseFilter *capture); void SetAudioBuffering(int bufferingMs); bool ConnectFilters(); void DisconnectFilters();
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-base.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-base.cpp
Changed
@@ -26,10 +26,10 @@ #include <vector> #include <string> -#include <mmddk.h> // for DRV_QUERYDEVICEINTERFACE -#include <SetupAPI.h> // for SetupDixxx -#include <cfgmgr32.h> // for CM_xxx -#include <algorithm> // for std::transform +#include <mmddk.h> // for DRV_QUERYDEVICEINTERFACE +#include <SetupAPI.h> // for SetupDixxx +#include <cfgmgr32.h> // for CM_xxx +#include <algorithm> // for std::transform #pragma comment(lib, "winmm.lib") // for waveInMessage #pragma comment(lib, "setupapi.lib") // for SetupDixxx @@ -39,7 +39,7 @@ namespace DShow { bool CreateFilterGraph(IGraphBuilder **pgraph, ICaptureGraphBuilder2 **pbuilder, - IMediaControl **pcontrol) + IMediaControl **pcontrol) { ComPtr<IGraphBuilder> graph; ComPtr<ICaptureGraphBuilder2> builder; @@ -47,15 +47,15 @@ HRESULT hr; hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, - IID_IFilterGraph, (void**)&graph); + IID_IFilterGraph, (void **)&graph); if (FAILED(hr)) { ErrorHR(L"Failed to create IGraphBuilder", hr); return false; } hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, - CLSCTX_INPROC_SERVER, - IID_ICaptureGraphBuilder2, (void**)&builder); + CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2, + (void **)&builder); if (FAILED(hr)) { ErrorHR(L"Failed to create ICaptureGraphBuilder2", hr); return false; @@ -67,7 +67,7 @@ return false; } - hr = graph->QueryInterface(IID_IMediaControl, (void**)&control); + hr = graph->QueryInterface(IID_IMediaControl, (void **)&control); if (FAILED(hr)) { ErrorHR(L"Failed to create IMediaControl", hr); return false; @@ -82,7 +82,7 @@ void LogFilters(IGraphBuilder *graph) { ComPtr<IEnumFilters> filterEnum; - ComPtr<IBaseFilter> filter; + ComPtr<IBaseFilter> filter; HRESULT hr; hr = graph->EnumFilters(&filterEnum); @@ -105,13 +105,14 @@ } struct DeviceFilterCallbackInfo { - ComPtr<IBaseFilter> filter; - const wchar_t *name; - const wchar_t *path; + ComPtr<IBaseFilter> filter; + const wchar_t *name; + const wchar_t *path; }; static bool GetDeviceCallback(DeviceFilterCallbackInfo &info, - IBaseFilter *filter, const wchar_t *name, const wchar_t *path) + IBaseFilter *filter, const wchar_t *name, + const wchar_t *path) { if (info.name && *info.name && wcscmp(name, info.name) != 0) return true; @@ -126,7 +127,7 @@ } bool GetDeviceFilter(const IID &type, const wchar_t *name, const wchar_t *path, - IBaseFilter **out) + IBaseFilter **out) { DeviceFilterCallbackInfo info; info.name = name; @@ -150,7 +151,7 @@ ComPtr<IAMStreamConfig> config; int count, size; - hr = pin->QueryInterface(IID_IAMStreamConfig, (void**)&config); + hr = pin->QueryInterface(IID_IAMStreamConfig, (void **)&config); if (FAILED(hr)) return false; @@ -208,19 +209,20 @@ if (!pin) return E_POINTER; - ComQIPtr<IKsPropertySet> propertySet(pin); - DWORD size; + ComQIPtr<IKsPropertySet> propertySet(pin); + DWORD size; if (propertySet == NULL) return E_NOINTERFACE; - return propertySet->Get(AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, - NULL, 0, &category, sizeof(GUID), &size); + return propertySet->Get(AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, NULL, + 0, &category, sizeof(GUID), &size); } static inline bool PinIsCategory(IPin *pin, const GUID &category) { - if (!pin) return false; + if (!pin) + return false; GUID pinCategory; HRESULT hr = GetPinCategory(pin, pinCategory); @@ -234,8 +236,10 @@ static inline bool PinNameIs(IPin *pin, const wchar_t *name) { - if (!pin) return false; - if (!name) return true; + if (!pin) + return false; + if (!name) + return true; PIN_INFO pinInfo; @@ -249,7 +253,7 @@ } static inline bool PinMatches(IPin *pin, const GUID &type, const GUID &category, - PIN_DIRECTION &dir) + PIN_DIRECTION &dir) { if (!PinHasMajorType(pin, type)) return false; @@ -262,11 +266,11 @@ } bool GetFilterPin(IBaseFilter *filter, const GUID &type, const GUID &category, - PIN_DIRECTION dir, IPin **pin) + PIN_DIRECTION dir, IPin **pin) { - ComPtr<IPin> curPin; - ComPtr<IEnumPins> pinsEnum; - ULONG num; + ComPtr<IPin> curPin; + ComPtr<IEnumPins> pinsEnum; + ULONG num; if (!filter) return false; @@ -286,11 +290,11 @@ } bool GetPinByName(IBaseFilter *filter, PIN_DIRECTION dir, const wchar_t *name, - IPin **pin) + IPin **pin) { - ComPtr<IPin> curPin; - ComPtr<IEnumPins> pinsEnum; - ULONG num; + ComPtr<IPin> curPin; + ComPtr<IEnumPins> pinsEnum; + ULONG num; if (!filter) return false; @@ -311,9 +315,9 @@ bool GetPinByMedium(IBaseFilter *filter, REGPINMEDIUM &medium, IPin **pin) { - ComPtr<IPin> curPin; - ComPtr<IEnumPins> pinsEnum; - ULONG num; + ComPtr<IPin> curPin; + ComPtr<IEnumPins> pinsEnum; + ULONG num; if (!filter) return false; @@ -334,13 +338,14 @@ } static bool GetFilterByMediumFromMoniker(IMoniker *moniker, - REGPINMEDIUM &medium, IBaseFilter **filter) + REGPINMEDIUM &medium, + IBaseFilter **filter) { - ComPtr<IBaseFilter> curFilter; - HRESULT hr; + ComPtr<IBaseFilter> curFilter; + HRESULT hr; hr = moniker->BindToObject(nullptr, nullptr, IID_IBaseFilter, - (void**)&curFilter); + (void **)&curFilter); if (SUCCEEDED(hr)) { ComPtr<IPin> pin; if (GetPinByMedium(curFilter, medium, &pin)) { @@ -349,34 +354,34 @@ } } else { WarningHR(L"GetFilterByMediumFromMoniker: BindToObject failed", - hr); + hr); } return false; } bool GetFilterByMedium(const CLSID &id, REGPINMEDIUM &medium, - IBaseFilter **filter) + IBaseFilter **filter) { - ComPtr<ICreateDevEnum> deviceEnum; - ComPtr<IEnumMoniker> enumMoniker; - ComPtr<IMoniker> moniker; - DWORD count = 0; - HRESULT hr; + ComPtr<ICreateDevEnum> deviceEnum; + ComPtr<IEnumMoniker> enumMoniker; + ComPtr<IMoniker> moniker; + DWORD count = 0; + HRESULT hr; hr = CoCreateInstance(CLSID_SystemDeviceEnum, nullptr, - CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, - (void**)&deviceEnum); + CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, + (void **)&deviceEnum); if (FAILED(hr)) { WarningHR(L"GetFilterByMedium: Failed to create device enum", - hr); + hr); return false; } hr = deviceEnum->CreateClassEnumerator(id, &enumMoniker, 0); if (hr != S_OK) { WarningHR(L"GetFilterByMedium: Failed to create enum moniker", - hr); + hr); return false; } @@ -392,7 +397,7 @@ bool GetPinMedium(IPin *pin, REGPINMEDIUM &medium) { - ComQIPtr<IKsPin> ksPin(pin); + ComQIPtr<IKsPin> ksPin(pin); CoTaskMemPtr<KSMULTIPLE_ITEM> items; if (!ksPin) @@ -401,7 +406,7 @@ if (FAILED(ksPin->KsQueryMediums(&items))) return false; - REGPINMEDIUM *curMed = reinterpret_cast<REGPINMEDIUM*>(items + 1); + REGPINMEDIUM *curMed = reinterpret_cast<REGPINMEDIUM *>(items + 1); for (ULONG i = 0; i < items->Count; i++, curMed++) { if (!IsEqualGUID(curMed->clsMedium, GUID_NULL) && !IsEqualGUID(curMed->clsMedium, KSMEDIUMSETID_Standard)) { @@ -421,11 +426,11 @@ } static bool DirectConnectOutputPin(IFilterGraph *graph, IPin *pin, - IBaseFilter *filterIn) + IBaseFilter *filterIn) { - ComPtr<IPin> curPin; - ComPtr<IEnumPins> pinsEnum; - ULONG num; + ComPtr<IPin> curPin; + ComPtr<IEnumPins> pinsEnum; + ULONG num; if (!graph || !filterIn || !pin) return false; @@ -445,12 +450,12 @@ } bool DirectConnectFilters(IFilterGraph *graph, IBaseFilter *filterOut, - IBaseFilter *filterIn) + IBaseFilter *filterIn) { - ComPtr<IPin> curPin; - ComPtr<IEnumPins> pinsEnum; - ULONG num; - bool connected = false; + ComPtr<IPin> curPin; + ComPtr<IEnumPins> pinsEnum; + ULONG num; + bool connected = false; if (!graph || !filterOut || !filterIn) return false; @@ -484,10 +489,10 @@ wstring str; FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, hr, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), - (LPTSTR)&buffer, 0, NULL); + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, hr, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), + (LPTSTR)&buffer, 0, NULL); if (buffer) { str = buffer; @@ -498,7 +503,7 @@ } static HRESULT DevicePathToDeviceInstancePath(const wchar_t *devicePath, - wchar_t *devInstPath, int size) + wchar_t *devInstPath, int size) { /* Sanity checks */ if (!devicePath) @@ -509,7 +514,7 @@ /* Convert to uppercase STL string */ wstring parseDevicePath = devicePath; std::transform(parseDevicePath.begin(), parseDevicePath.end(), - parseDevicePath.begin(), ::toupper); + parseDevicePath.begin(), ::toupper); /* Find start position ('\\?\' or '\?\') */ wstring startToken = L"\\\\?\\"; @@ -520,20 +525,20 @@ if (start == string::npos) return E_FAIL; } - parseDevicePath = parseDevicePath.substr(startToken.size(), - parseDevicePath.size() - startToken.size()); + parseDevicePath = parseDevicePath.substr( + startToken.size(), parseDevicePath.size() - startToken.size()); /* Find end position (last occurrence of '#') */ wstring endToken = L"#"; - size_t end = parseDevicePath.find_last_of(endToken, - parseDevicePath.size()); + size_t end = + parseDevicePath.find_last_of(endToken, parseDevicePath.size()); if (end == string::npos) return E_FAIL; parseDevicePath = parseDevicePath.substr(0, end); /* Replace '#' by '\' */ std::replace(parseDevicePath.begin(), parseDevicePath.end(), L'#', - L'\\'); + L'\\'); /* Set output parameter */ StringCchCopyW(devInstPath, size, parseDevicePath.c_str()); @@ -542,30 +547,29 @@ } static HRESULT GetParentDeviceInstancePath(const wchar_t *devInstPath, - wchar_t *parentDevInstPath, int size) + wchar_t *parentDevInstPath, int size) { /* Init return value */ HRESULT hr = E_FAIL; /* Get device info */ HDEVINFO hDevInfo = SetupDiCreateDeviceInfoList(nullptr, NULL); - if (NULL != hDevInfo) - { + if (NULL != hDevInfo) { SP_DEVINFO_DATA did; did.cbSize = sizeof(SP_DEVINFO_DATA); BOOL success = SetupDiOpenDeviceInfo(hDevInfo, devInstPath, - NULL, 0, &did); + NULL, 0, &did); if (success) { /* Get parent device */ DEVINST devParent; - CONFIGRET ret = CM_Get_Parent(&devParent, - did.DevInst, 0); + CONFIGRET ret = + CM_Get_Parent(&devParent, did.DevInst, 0); if (CR_SUCCESS == ret) { /* Get parent device instance path */ - ret = CM_Get_Device_ID(devParent, - parentDevInstPath, size, 0); + ret = CM_Get_Device_ID( + devParent, parentDevInstPath, size, 0); if (CR_SUCCESS == ret) hr = S_OK; } @@ -582,14 +586,12 @@ } static bool IsSameInstPath(const wchar_t *audDevPath, - const wchar_t *vidDevInstPath) + const wchar_t *vidDevInstPath) { /* Get audio device instance path */ wchar_t audDevInstPath[512]; - HRESULT hr = DevicePathToDeviceInstancePath( - audDevPath, - audDevInstPath, - _ARRAYSIZE(audDevInstPath)); + HRESULT hr = DevicePathToDeviceInstancePath(audDevPath, audDevInstPath, + _ARRAYSIZE(audDevInstPath)); /* Compare audio and video device instance path */ if (FAILED(hr)) @@ -598,8 +600,9 @@ return wcscmp(audDevInstPath, vidDevInstPath) == 0; } -static HRESULT GetAudioCaptureParentDeviceInstancePath(IMoniker *audioCapture, - wchar_t *parentDevInstPath, int size) +static HRESULT +GetAudioCaptureParentDeviceInstancePath(IMoniker *audioCapture, + wchar_t *parentDevInstPath, int size) { /* Sanity checks */ if (!audioCapture) @@ -608,7 +611,7 @@ /* Bind to property bag */ ComPtr<IPropertyBag> propertyBag; HRESULT hr = audioCapture->BindToStorage(0, 0, IID_IPropertyBag, - (void**)&propertyBag); + (void **)&propertyBag); if (SUCCEEDED(hr)) { /* Init variant */ @@ -622,23 +625,21 @@ /* Get device path */ wchar_t devicePath[512]; MMRESULT res = waveInMessage((HWAVEIN)var.iVal, - DRV_QUERYDEVICEINTERFACE, - (DWORD_PTR)devicePath, - sizeof(devicePath)); - if (res == MMSYSERR_NOERROR) - { + DRV_QUERYDEVICEINTERFACE, + (DWORD_PTR)devicePath, + sizeof(devicePath)); + if (res == MMSYSERR_NOERROR) { /* Get device instance path */ wchar_t devInstPath[512]; hr = DevicePathToDeviceInstancePath( - devicePath, devInstPath, - _ARRAYSIZE(devInstPath)); + devicePath, devInstPath, + _ARRAYSIZE(devInstPath)); /* Get parent */ if (SUCCEEDED(hr)) hr = GetParentDeviceInstancePath( - devInstPath, - parentDevInstPath, - size); + devInstPath, parentDevInstPath, + size); } } @@ -650,22 +651,20 @@ } static bool IsMonikerSameParentInstPath(IMoniker *moniker, - const wchar_t *vidDevInstPath) + const wchar_t *vidDevInstPath) { /* Get video parent device instance path */ wchar_t vidParentDevInstPath[512]; HRESULT hr = GetParentDeviceInstancePath( - vidDevInstPath, - vidParentDevInstPath, - _ARRAYSIZE(vidParentDevInstPath)); + vidDevInstPath, vidParentDevInstPath, + _ARRAYSIZE(vidParentDevInstPath)); /* Get audio parent device instance path */ wchar_t audParentDevInstPath[512]; - if(SUCCEEDED(hr)) + if (SUCCEEDED(hr)) hr = GetAudioCaptureParentDeviceInstancePath( - moniker, - audParentDevInstPath, - _ARRAYSIZE(audParentDevInstPath)); + moniker, audParentDevInstPath, + _ARRAYSIZE(audParentDevInstPath)); /* Compare audio and video parent device instance path */ if (FAILED(hr)) @@ -691,7 +690,7 @@ /* Get USB vendor ID */ wstring vid = path.substr(usbToken.size(), - usbVidElgato.size()); + usbVidElgato.size()); if (vid == usbVidElgato) return true; } @@ -704,8 +703,8 @@ if (path.find(pciToken) == 0) { size_t pos = path.find(pciSubsysToken); - size_t devSize = pos + pciSubsysToken.size() + - 4; /* skip product ID*/ + size_t devSize = + pos + pciSubsysToken.size() + 4; /* skip product ID*/ size_t expectedSize = devSize + pciVidElgato.size(); if (pos != string::npos && path.size() >= expectedSize) { @@ -720,7 +719,7 @@ } static HRESULT ReadProperty(IMoniker *moniker, const wchar_t *property, - wchar_t *value, int size) + wchar_t *value, int size) { /* Sanity checks */ if (!moniker) @@ -736,7 +735,7 @@ /* Bind to property bag */ ComPtr<IPropertyBag> propertyBag; HRESULT hr = moniker->BindToStorage(0, 0, IID_IPropertyBag, - (void**)&propertyBag); + (void **)&propertyBag); if (SUCCEEDED(hr)) { /* Initialize variant */ VARIANT var; @@ -758,14 +757,13 @@ } static bool GetDeviceAudioFilterInternal(REFCLSID deviceClass, - const wchar_t *vidDevPath, - IBaseFilter **audioCaptureFilter) + const wchar_t *vidDevPath, + IBaseFilter **audioCaptureFilter) { /* Get video device instance path */ wchar_t vidDevInstPath[512]; - HRESULT hr = DevicePathToDeviceInstancePath(vidDevPath, - vidDevInstPath, - _ARRAYSIZE(vidDevInstPath)); + HRESULT hr = DevicePathToDeviceInstancePath(vidDevPath, vidDevInstPath, + _ARRAYSIZE(vidDevInstPath)); /* Only enabled for Elgato devices for now to do not change behavior * for any other devices (e.g. webcams) */ @@ -776,17 +774,17 @@ /* Create device enumerator */ ComPtr<ICreateDevEnum> createDevEnum; - if(SUCCEEDED(hr)) + if (SUCCEEDED(hr)) hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, - CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, - (void**)&createDevEnum); + CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, + (void **)&createDevEnum); /* Enumerate filters */ ComPtr<IEnumMoniker> enumMoniker; if (SUCCEEDED(hr)) { /* returns S_FALSE if no devices are installed */ hr = createDevEnum->CreateClassEnumerator(deviceClass, - &enumMoniker, 0); + &enumMoniker, 0); if (!enumMoniker) hr = E_FAIL; } @@ -809,26 +807,25 @@ /* Get device path */ wchar_t audDevPath[512]; - hr = ReadProperty(moniker, L"DevicePath", - audDevPath, - _ARRAYSIZE(audDevPath)); + hr = ReadProperty(moniker, L"DevicePath", audDevPath, + _ARRAYSIZE(audDevPath)); if (SUCCEEDED(hr)) { /* Skip if it is the video device */ if (wcscmp(audDevPath, vidDevPath) == 0) continue; samePath = IsSameInstPath(audDevPath, - vidDevInstPath); + vidDevInstPath); } else { - samePath = IsMonikerSameParentInstPath(moniker, - vidDevInstPath); + samePath = IsMonikerSameParentInstPath( + moniker, vidDevInstPath); } /* Get audio capture filter */ if (samePath) { - hr = moniker->BindToObject(0, 0, - IID_IBaseFilter, - (void**)audioCaptureFilter); + hr = moniker->BindToObject( + 0, 0, IID_IBaseFilter, + (void **)audioCaptureFilter); if (SUCCEEDED(hr)) return true; } @@ -839,17 +836,16 @@ } bool GetDeviceAudioFilter(const wchar_t *vidDevPath, - IBaseFilter **audioCaptureFilter) + IBaseFilter **audioCaptureFilter) { /* Search in "Audio capture sources" */ bool success = GetDeviceAudioFilterInternal( - CLSID_AudioInputDeviceCategory, - vidDevPath, audioCaptureFilter); + CLSID_AudioInputDeviceCategory, vidDevPath, audioCaptureFilter); /* Search in "WDM Streaming Capture Devices" */ if (!success) - success = GetDeviceAudioFilterInternal(KSCATEGORY_CAPTURE, - vidDevPath, audioCaptureFilter); + success = GetDeviceAudioFilterInternal( + KSCATEGORY_CAPTURE, vidDevPath, audioCaptureFilter); return success; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-base.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-base.hpp
Changed
@@ -40,27 +40,27 @@ namespace DShow { bool CreateFilterGraph(IGraphBuilder **graph, ICaptureGraphBuilder2 **builder, - IMediaControl **control); + IMediaControl **control); void LogFilters(IGraphBuilder *graph); bool GetDeviceFilter(const IID &type, const wchar_t *name, const wchar_t *path, - IBaseFilter **filter); + IBaseFilter **filter); bool GetFilterPin(IBaseFilter *filter, const GUID &type, const GUID &category, - PIN_DIRECTION dir, IPin **pin); + PIN_DIRECTION dir, IPin **pin); bool GetPinByName(IBaseFilter *filter, PIN_DIRECTION dir, const wchar_t *name, - IPin **pin); + IPin **pin); bool GetPinByMedium(IBaseFilter *filter, REGPINMEDIUM &medium, IPin **pin); bool GetFilterByMedium(const CLSID &id, REGPINMEDIUM &medium, - IBaseFilter **filter); + IBaseFilter **filter); bool GetPinMedium(IPin *pin, REGPINMEDIUM &medium); bool DirectConnectFilters(IFilterGraph *graph, IBaseFilter *filterOut, - IBaseFilter *filterIn); + IBaseFilter *filterIn); /** * This maps a created demuxer pin to a packet ID for the mux stream. Note @@ -75,6 +75,6 @@ * Get audio filter for the same device as the given video device path */ bool GetDeviceAudioFilter(const wchar_t *videoDevicePath, - IBaseFilter **audioCaptureFilter); + IBaseFilter **audioCaptureFilter); }; /* namespace DShow */
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-demux.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-demux.cpp
Changed
@@ -39,46 +39,46 @@ return GUID_NULL; } -bool CreateDemuxVideoPin(IBaseFilter *demuxFilter, MediaType &mt, - long width, long height, long long frameTime, - VideoFormat format) +bool CreateDemuxVideoPin(IBaseFilter *demuxFilter, MediaType &mt, long width, + long height, long long frameTime, VideoFormat format) { ComQIPtr<IMpeg2Demultiplexer> demuxer(demuxFilter); if (!demuxer) { Warning(L"CreateDemuxVideoPin: Failed to get " - L"IMpeg2Demultiplexer from filter"); + L"IMpeg2Demultiplexer from filter"); return false; } - ComPtr<IPin> pin; - HRESULT hr; + ComPtr<IPin> pin; + HRESULT hr; - VIDEOINFOHEADER *vih = mt.AllocFormat<VIDEOINFOHEADER>(); - vih->bmiHeader.biSize = sizeof(vih->bmiHeader); - vih->bmiHeader.biWidth = width; - vih->bmiHeader.biHeight = height; - vih->bmiHeader.biCompression = VideoFormatToFourCC(format); - vih->rcSource.right = width; - vih->rcSource.bottom = height; - vih->AvgTimePerFrame = frameTime; + VIDEOINFOHEADER *vih = mt.AllocFormat<VIDEOINFOHEADER>(); + vih->bmiHeader.biSize = sizeof(vih->bmiHeader); + vih->bmiHeader.biWidth = width; + vih->bmiHeader.biHeight = height; + vih->bmiHeader.biCompression = VideoFormatToFourCC(format); + vih->rcSource.right = width; + vih->rcSource.bottom = height; + vih->AvgTimePerFrame = frameTime; if (!vih->bmiHeader.biCompression) { Warning(L"CreateDemuxVideoPin: Invalid video format"); return false; } - mt->majortype = MEDIATYPE_Video; - mt->subtype = VideoFormatToSubType(format); - mt->formattype = FORMAT_VideoInfo; + mt->majortype = MEDIATYPE_Video; + mt->subtype = VideoFormatToSubType(format); + mt->formattype = FORMAT_VideoInfo; mt->bTemporalCompression = true; - wchar_t *name = (wchar_t*)CoTaskMemAlloc(sizeof(DEMUX_VIDEO_PIN)); + wchar_t *name = (wchar_t *)CoTaskMemAlloc(sizeof(DEMUX_VIDEO_PIN)); memcpy(name, DEMUX_VIDEO_PIN, sizeof(DEMUX_VIDEO_PIN)); hr = demuxer->CreateOutputPin(mt, name, &pin); if (FAILED(hr)) { WarningHR(L"CreateDemuxVideoPin: Failed to create video pin " - L"on demuxer", hr); + L"on demuxer", + hr); return false; } @@ -110,22 +110,22 @@ } bool CreateDemuxAudioPin(IBaseFilter *demuxFilter, MediaType &mt, - DWORD samplesPerSec, WORD bitsPerSample, WORD channels, - AudioFormat format) + DWORD samplesPerSec, WORD bitsPerSample, WORD channels, + AudioFormat format) { ComQIPtr<IMpeg2Demultiplexer> demuxer(demuxFilter); if (!demuxer) { Warning(L"CreateDemuxAudioPin: Failed to get " - L"IMpeg2Demultiplexer from filter"); + L"IMpeg2Demultiplexer from filter"); return false; } - ComPtr<IPin> pin; - HRESULT hr; + ComPtr<IPin> pin; + HRESULT hr; - WAVEFORMATEX *wfex = mt.AllocFormat<WAVEFORMATEX>(); - wfex->wFormatTag = AudioFormatToFormatTag(format); - wfex->nChannels = channels; + WAVEFORMATEX *wfex = mt.AllocFormat<WAVEFORMATEX>(); + wfex->wFormatTag = AudioFormatToFormatTag(format); + wfex->nChannels = channels; wfex->nSamplesPerSec = samplesPerSec; wfex->wBitsPerSample = bitsPerSample; @@ -134,18 +134,19 @@ return false; } - mt->majortype = MEDIATYPE_Audio; - mt->subtype = AudioFormatToSubType(format); - mt->formattype = FORMAT_WaveFormatEx; + mt->majortype = MEDIATYPE_Audio; + mt->subtype = AudioFormatToSubType(format); + mt->formattype = FORMAT_WaveFormatEx; mt->bTemporalCompression = true; - wchar_t *name = (wchar_t*)CoTaskMemAlloc(sizeof(DEMUX_AUDIO_PIN)); + wchar_t *name = (wchar_t *)CoTaskMemAlloc(sizeof(DEMUX_AUDIO_PIN)); memcpy(name, DEMUX_AUDIO_PIN, sizeof(DEMUX_AUDIO_PIN)); hr = demuxer->CreateOutputPin(mt, name, &pin); if (FAILED(hr)) { WarningHR(L"CreateDemuxAudioPin: Failed to create audio pin " - L"on demuxer", hr); + L"on demuxer", + hr); return false; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-demux.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-demux.hpp
Changed
@@ -28,12 +28,11 @@ #define DEMUX_VIDEO_PIN L"Demuxer Video Pin" #define DEMUX_AUDIO_PIN L"Demuxer Audio Pin" -bool CreateDemuxVideoPin(IBaseFilter *demuxFilter, MediaType &mt, - long width, long height, long long frameTime, - VideoFormat format); +bool CreateDemuxVideoPin(IBaseFilter *demuxFilter, MediaType &mt, long width, + long height, long long frameTime, VideoFormat format); bool CreateDemuxAudioPin(IBaseFilter *demuxFilter, MediaType &mt, - DWORD samplesPerSec, WORD bitsPerSample, WORD channels, - AudioFormat format); + DWORD samplesPerSec, WORD bitsPerSample, WORD channels, + AudioFormat format); }; /* namespace DShow */
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-device-defs.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-device-defs.hpp
Changed
@@ -21,33 +21,29 @@ namespace DShow { -#define COMMON_ENCODED_CX 720 -#define COMMON_ENCODED_CY 480 -#define COMMON_ENCODED_INTERVAL (10010000000LL/60000LL) -#define COMMON_ENCODED_VFORMAT VideoFormat::H264 +#define COMMON_ENCODED_CX 720 +#define COMMON_ENCODED_CY 480 +#define COMMON_ENCODED_INTERVAL (10010000000LL / 60000LL) +#define COMMON_ENCODED_VFORMAT VideoFormat::H264 #define COMMON_ENCODED_SAMPLERATE 48000 -static const EncodedDevice HD_PVR1 = { - COMMON_ENCODED_VFORMAT, - 0x1011UL, - COMMON_ENCODED_CX, - COMMON_ENCODED_CY, - COMMON_ENCODED_INTERVAL, - AudioFormat::AC3, - 0x1100UL, - COMMON_ENCODED_SAMPLERATE -}; +static const EncodedDevice HD_PVR1 = {COMMON_ENCODED_VFORMAT, + 0x1011UL, + COMMON_ENCODED_CX, + COMMON_ENCODED_CY, + COMMON_ENCODED_INTERVAL, + AudioFormat::AC3, + 0x1100UL, + COMMON_ENCODED_SAMPLERATE}; -static const EncodedDevice HD_PVR2 = { - COMMON_ENCODED_VFORMAT, - 0x1011UL, - COMMON_ENCODED_CX, - COMMON_ENCODED_CY, - COMMON_ENCODED_INTERVAL, - AudioFormat::AAC, - 0x1100UL, - COMMON_ENCODED_SAMPLERATE -}; +static const EncodedDevice HD_PVR2 = {COMMON_ENCODED_VFORMAT, + 0x1011UL, + COMMON_ENCODED_CX, + COMMON_ENCODED_CY, + COMMON_ENCODED_INTERVAL, + AudioFormat::AAC, + 0x1100UL, + COMMON_ENCODED_SAMPLERATE}; static const EncodedDevice Roxio = { COMMON_ENCODED_VFORMAT, @@ -60,26 +56,22 @@ COMMON_ENCODED_SAMPLERATE, }; -static const EncodedDevice HD_PVR_Rocket = { - COMMON_ENCODED_VFORMAT, - 0x07D1UL, - COMMON_ENCODED_CX, - COMMON_ENCODED_CY, - COMMON_ENCODED_INTERVAL, - AudioFormat::AAC, - 0x07D2UL, - COMMON_ENCODED_SAMPLERATE -}; +static const EncodedDevice HD_PVR_Rocket = {COMMON_ENCODED_VFORMAT, + 0x07D1UL, + COMMON_ENCODED_CX, + COMMON_ENCODED_CY, + COMMON_ENCODED_INTERVAL, + AudioFormat::AAC, + 0x07D2UL, + COMMON_ENCODED_SAMPLERATE}; -static const EncodedDevice AV_LGP = { - COMMON_ENCODED_VFORMAT, - 68, - COMMON_ENCODED_CX, - COMMON_ENCODED_CY, - COMMON_ENCODED_INTERVAL, - AudioFormat::AAC, - 69, - COMMON_ENCODED_SAMPLERATE -}; +static const EncodedDevice AV_LGP = {COMMON_ENCODED_VFORMAT, + 68, + COMMON_ENCODED_CX, + COMMON_ENCODED_CY, + COMMON_ENCODED_INTERVAL, + AudioFormat::AAC, + 69, + COMMON_ENCODED_SAMPLERATE}; }; /* namespace DShow */
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-encoded-device.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-encoded-device.cpp
Changed
@@ -27,16 +27,15 @@ namespace DShow { -static inline bool CreateFilters(IBaseFilter *filter, - IBaseFilter **crossbar, IBaseFilter **encoder, - IBaseFilter **demuxer) +static inline bool CreateFilters(IBaseFilter *filter, IBaseFilter **crossbar, + IBaseFilter **encoder, IBaseFilter **demuxer) { - ComPtr<IPin> inputPin; - ComPtr<IPin> outputPin; - REGPINMEDIUM inMedium; - REGPINMEDIUM outMedium; - bool hasOutMedium; - HRESULT hr; + ComPtr<IPin> inputPin; + ComPtr<IPin> outputPin; + REGPINMEDIUM inMedium; + REGPINMEDIUM outMedium; + bool hasOutMedium; + HRESULT hr; if (!GetPinByName(filter, PINDIR_INPUT, nullptr, &inputPin)) { Warning(L"Encoded Device: Failed to get input pin"); @@ -65,7 +64,8 @@ GetFilterByMedium(KSCATEGORY_ENCODER, outMedium, encoder); hr = CoCreateInstance(CLSID_MPEG2Demultiplexer, nullptr, - CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)demuxer); + CLSCTX_INPROC_SERVER, IID_IBaseFilter, + (void **)demuxer); if (FAILED(hr)) { WarningHR(L"Encoded Device: Failed to create demuxer", hr); return false; @@ -75,19 +75,21 @@ } static inline bool ConnectEncodedFilters(IGraphBuilder *graph, - IBaseFilter *filter, IBaseFilter *crossbar, - IBaseFilter *encoder, IBaseFilter *demuxer) + IBaseFilter *filter, + IBaseFilter *crossbar, + IBaseFilter *encoder, + IBaseFilter *demuxer) { if (!DirectConnectFilters(graph, crossbar, filter)) { Warning(L"Encoded Device: Failed to connect crossbar to " - L"device"); + L"device"); return false; } if (!!encoder) { if (!DirectConnectFilters(graph, filter, encoder)) { Warning(L"Encoded Device: Failed to connect device to " - L"encoder"); + L"encoder"); return false; } @@ -99,7 +101,7 @@ } else { if (!DirectConnectFilters(graph, filter, demuxer)) { Warning(L"Encoded Device: Failed to connect device to " - L"demuxer"); + L"demuxer"); return false; } } @@ -109,32 +111,34 @@ static inline bool MapPacketIDs(IBaseFilter *demuxer, ULONG video, ULONG audio) { - ComPtr<IPin> videoPin, audioPin; - HRESULT hr; + ComPtr<IPin> videoPin, audioPin; + HRESULT hr; if (!GetPinByName(demuxer, PINDIR_OUTPUT, DEMUX_VIDEO_PIN, &videoPin)) { Warning(L"Encoded Device: Could not get video pin from " - L"demuxer"); + L"demuxer"); return false; } if (!GetPinByName(demuxer, PINDIR_OUTPUT, DEMUX_AUDIO_PIN, &audioPin)) { Warning(L"Encoded Device: Could not get audio pin from " - L"demuxer"); + L"demuxer"); return false; } hr = MapPinToPacketID(videoPin, video); if (FAILED(hr)) { WarningHR(L"Encoded Device: Failed to map demuxer video pin " - L"packet ID", hr); + L"packet ID", + hr); return false; } hr = MapPinToPacketID(audioPin, audio); if (FAILED(hr)) { WarningHR(L"Encoded Device: Failed to map demuxer audio pin " - L"packet ID", hr); + L"packet ID", + hr); return false; } @@ -149,8 +153,11 @@ * programs because I could not figure out how the hell to get this thing * to turn on. */ -static const GUID RocketEncoderGUID = -{0x99100000, 0xa330, 0x11e1, {0xa3, 0x80, 0x99, 0x10, 0x68, 0x64, 0x00, 0x00}}; +static const GUID RocketEncoderGUID = {0x99100000, + 0xa330, + 0x11e1, + {0xa3, 0x80, 0x99, 0x10, 0x68, 0x64, + 0x00, 0x00}}; struct RocketPropStruct { DWORD dwSize; @@ -159,7 +166,7 @@ DWORD unknown3; DWORD code; DWORD unknown4; - BOOL enabled; + BOOL enabled; }; struct RocketInstStruct { @@ -169,61 +176,60 @@ bool SetRocketEnabled(IBaseFilter *encoder, bool enable) { - static const ULONG rocketEnableId = 0x9910E001; + static const ULONG rocketEnableId = 0x9910E001; static const DWORD rocketEnableCode = 0x38384001; - RocketInstStruct rocketInstance = {}; - RocketPropStruct rocketProperty = {}; + RocketInstStruct rocketInstance = {}; + RocketPropStruct rocketProperty = {}; ComQIPtr<IKsPropertySet> propertySet(encoder); if (!propertySet) return false; - rocketProperty.dwSize = sizeof(rocketProperty); - rocketProperty.code = rocketEnableCode; + rocketProperty.dwSize = sizeof(rocketProperty); + rocketProperty.code = rocketEnableCode; rocketProperty.enabled = enable; - rocketInstance.code = rocketEnableCode; + rocketInstance.code = rocketEnableCode; HRESULT hr = propertySet->Set(RocketEncoderGUID, rocketEnableId, - &rocketInstance, sizeof(rocketInstance), - &rocketProperty, sizeof(rocketProperty)); + &rocketInstance, sizeof(rocketInstance), + &rocketProperty, sizeof(rocketProperty)); return SUCCEEDED(hr); } -bool HDevice::SetupEncodedVideoCapture(IBaseFilter *filter, - VideoConfig &config, - const EncodedDevice &info) +bool HDevice::SetupEncodedVideoCapture(IBaseFilter *filter, VideoConfig &config, + const EncodedDevice &info) { - ComPtr<IBaseFilter> crossbar; - ComPtr<IBaseFilter> encoder; - ComPtr<IBaseFilter> demuxer; - MediaType mtVideo; - MediaType mtAudio; + ComPtr<IBaseFilter> crossbar; + ComPtr<IBaseFilter> encoder; + ComPtr<IBaseFilter> demuxer; + MediaType mtVideo; + MediaType mtAudio; if (!CreateFilters(filter, &crossbar, &encoder, &demuxer)) return false; if (!CreateDemuxVideoPin(demuxer, mtVideo, info.width, info.height, - info.frameInterval, info.videoFormat)) + info.frameInterval, info.videoFormat)) return false; - if (!CreateDemuxAudioPin(demuxer, mtAudio, info.samplesPerSec, - 16, 2, info.audioFormat)) + if (!CreateDemuxAudioPin(demuxer, mtAudio, info.samplesPerSec, 16, 2, + info.audioFormat)) return false; - config.cx = info.width; - config.cy = info.height; - config.frameInterval = info.frameInterval; - config.format = info.videoFormat; + config.cx = info.width; + config.cy = info.height; + config.frameInterval = info.frameInterval; + config.format = info.videoFormat; config.internalFormat = info.videoFormat; PinCaptureInfo pci; - pci.callback = [this] (IMediaSample *s) {Receive(true, s);}; + pci.callback = [this](IMediaSample *s) { Receive(true, s); }; pci.expectedMajorType = mtVideo->majortype; - pci.expectedSubType = mtVideo->subtype; + pci.expectedSubType = mtVideo->subtype; videoCapture = new CaptureFilter(pci); - videoFilter = demuxer; + videoFilter = demuxer; if (!!encoder && config.name.find(L"IT9910") != std::string::npos) { rocketEncoder = encoder; @@ -232,19 +238,19 @@ return false; } - graph->AddFilter(crossbar, L"Crossbar"); - graph->AddFilter(filter, L"Device"); - graph->AddFilter(demuxer, L"Demuxer"); + graph->AddFilter(crossbar, L"Crossbar"); + graph->AddFilter(filter, L"Device"); + graph->AddFilter(demuxer, L"Demuxer"); graph->AddFilter(videoCapture, L"Capture Filter"); if (!!encoder) graph->AddFilter(encoder, L"Encoder"); - bool success = ConnectEncodedFilters(graph, filter, crossbar, - encoder, demuxer); + bool success = ConnectEncodedFilters(graph, filter, crossbar, encoder, + demuxer); if (success) success = MapPacketIDs(demuxer, info.videoPacketID, - info.audioPacketID); + info.audioPacketID); encodedDevice = success; return success;
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-enum.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-enum.cpp
Changed
@@ -25,16 +25,16 @@ #undef DEFINE_GUID #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - EXTERN_C const GUID DECLSPEC_SELECTANY name \ - = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } + EXTERN_C const GUID DECLSPEC_SELECTANY name = { \ + l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}} -#include "IVideoCaptureFilter.h" +#include "external/IVideoCaptureFilter.h" namespace DShow { using namespace std; typedef bool (*EnumCapsCallback)(void *param, const AM_MEDIA_TYPE &mt, - const BYTE *data); + const BYTE *data); static void EnumElgatoCaps(IPin *pin, EnumCapsCallback callback, void *param) { @@ -42,7 +42,7 @@ if (SUCCEEDED(pin->EnumMediaTypes(&mediaTypes))) { MediaTypePtr mt; - ULONG count = 0; + ULONG count = 0; while (mediaTypes->Next(1, &mt, &count) == S_OK) { if (!callback(param, *mt, nullptr)) @@ -82,16 +82,16 @@ } /* Note: DEVICE_VideoInfo is not to be confused with Device::VideoInfo */ -static bool Get_FORMAT_VideoInfo_Data(VideoInfo &info, - const AM_MEDIA_TYPE &mt, const BYTE *data) +static bool Get_FORMAT_VideoInfo_Data(VideoInfo &info, const AM_MEDIA_TYPE &mt, + const BYTE *data) { const VIDEO_STREAM_CONFIG_CAPS *vscc; - const VIDEOINFOHEADER *viHeader; - const BITMAPINFOHEADER *bmiHeader; - VideoFormat format; + const VIDEOINFOHEADER *viHeader; + const BITMAPINFOHEADER *bmiHeader; + VideoFormat format; - vscc = reinterpret_cast<const VIDEO_STREAM_CONFIG_CAPS*>(data); - viHeader = reinterpret_cast<const VIDEOINFOHEADER*>(mt.pbFormat); + vscc = reinterpret_cast<const VIDEO_STREAM_CONFIG_CAPS *>(data); + viHeader = reinterpret_cast<const VIDEOINFOHEADER *>(mt.pbFormat); bmiHeader = &viHeader->bmiHeader; if (!GetMediaTypeVFormat(mt, format)) @@ -102,13 +102,12 @@ if (vscc) { info.minInterval = vscc->MinFrameInterval; info.maxInterval = vscc->MaxFrameInterval; - info.minCX = vscc->MinOutputSize.cx; - info.minCY = vscc->MinOutputSize.cy; - info.maxCX = vscc->MaxOutputSize.cx; - info.maxCY = vscc->MaxOutputSize.cy; + info.minCX = vscc->MinOutputSize.cx; + info.minCY = vscc->MinOutputSize.cy; + info.maxCX = vscc->MaxOutputSize.cx; + info.maxCY = vscc->MaxOutputSize.cy; - if (!info.minCX || !info.minCY || - !info.maxCX || !info.maxCY) { + if (!info.minCX || !info.minCY || !info.maxCX || !info.maxCY) { info.minCX = info.maxCX = bmiHeader->biWidth; info.minCY = info.maxCY = bmiHeader->biHeight; } @@ -116,7 +115,7 @@ info.granularityCX = max(vscc->OutputGranularityX, 1); info.granularityCY = max(vscc->OutputGranularityY, 1); } else { - info.minInterval = info.maxInterval = 10010000000LL/60000LL; + info.minInterval = info.maxInterval = 10010000000LL / 60000LL; info.minCX = info.maxCX = bmiHeader->biWidth; info.minCY = info.maxCY = bmiHeader->biHeight; info.granularityCX = 1; @@ -127,46 +126,49 @@ } static bool Get_FORMAT_WaveFormatEx_Data(AudioInfo &info, - const AM_MEDIA_TYPE &mt, const BYTE *data) + const AM_MEDIA_TYPE &mt, + const BYTE *data) { const AUDIO_STREAM_CONFIG_CAPS *ascc; - const WAVEFORMATEX *wfex; + const WAVEFORMATEX *wfex; - ascc = reinterpret_cast<const AUDIO_STREAM_CONFIG_CAPS*>(data); - wfex = reinterpret_cast<const WAVEFORMATEX*>(mt.pbFormat); + ascc = reinterpret_cast<const AUDIO_STREAM_CONFIG_CAPS *>(data); + wfex = reinterpret_cast<const WAVEFORMATEX *>(mt.pbFormat); if (!wfex || !ascc) { return false; } switch (wfex->wBitsPerSample) { - case 16: info.format = AudioFormat::Wave16bit; break; - case 32: info.format = AudioFormat::WaveFloat; break; + case 16: + info.format = AudioFormat::Wave16bit; + break; + case 32: + info.format = AudioFormat::WaveFloat; + break; } - info.minChannels = ascc->MinimumChannels; - info.maxChannels = ascc->MaximumChannels; - info.channelsGranularity = ascc->ChannelsGranularity; - info.minSampleRate = ascc->MinimumSampleFrequency; - info.maxSampleRate = ascc->MaximumSampleFrequency; + info.minChannels = ascc->MinimumChannels; + info.maxChannels = ascc->MaximumChannels; + info.channelsGranularity = ascc->ChannelsGranularity; + info.minSampleRate = ascc->MinimumSampleFrequency; + info.maxSampleRate = ascc->MaximumSampleFrequency; info.sampleRateGranularity = ascc->SampleFrequencyGranularity; return true; } struct ClosestVideoData { VideoConfig &config; - MediaType &mt; - long long bestVal; - bool found; + MediaType &mt; + long long bestVal; + bool found; - ClosestVideoData &operator=(ClosestVideoData const&) = delete; - ClosestVideoData &operator=(ClosestVideoData&&) = delete; + ClosestVideoData &operator=(ClosestVideoData const &) = delete; + ClosestVideoData &operator=(ClosestVideoData &&) = delete; inline ClosestVideoData(VideoConfig &config, MediaType &mt) - : config (config), - mt (mt), - bestVal (0), - found (false) - {} + : config(config), mt(mt), bestVal(0), found(false) + { + } }; static inline void ClampToGranularity(LONG &val, int minVal, int granularity) @@ -187,7 +189,7 @@ } static bool ClosestVideoMTCallback(ClosestVideoData &data, - const AM_MEDIA_TYPE &mt, const BYTE *capData) + const AM_MEDIA_TYPE &mt, const BYTE *capData) { VideoInfo info; @@ -198,18 +200,18 @@ return true; } - MediaType copiedMT = mt; - VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)copiedMT->pbFormat; - BITMAPINFOHEADER *bmih = GetBitmapInfoHeader(copiedMT); + MediaType copiedMT = mt; + VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)copiedMT->pbFormat; + BITMAPINFOHEADER *bmih = GetBitmapInfoHeader(copiedMT); if (data.config.internalFormat != VideoFormat::Any && data.config.internalFormat != info.format) return true; - int xVal = 0; - int yVal = 0; - int formatVal = 0; - long long frameVal = 0; + int xVal = 0; + int yVal = 0; + int formatVal = 0; + long long frameVal = 0; if (data.config.cx < info.minCX) xVal = info.minCX - data.config.cx; @@ -221,10 +223,11 @@ else if (data.config.cy > info.maxCY) yVal = data.config.cy - info.maxCY; - if (data.config.frameInterval < info.minInterval) - frameVal = info.minInterval - data.config.frameInterval; - else if (data.config.frameInterval > info.maxInterval) - frameVal = data.config.frameInterval - info.maxInterval; + const long long frameInterval = data.config.frameInterval; + if (frameInterval < info.minInterval) + frameVal = info.minInterval - frameInterval; + else if (frameInterval > info.maxInterval) + frameVal = frameInterval - info.maxInterval; formatVal = GetFormatRating(info.format); @@ -234,21 +237,24 @@ if (xVal == 0) { bmih->biWidth = data.config.cx; ClampToGranularity(bmih->biWidth, info.minCX, - info.granularityCX); + info.granularityCX); } if (yVal == 0) { bmih->biHeight = data.config.cy; ClampToGranularity(bmih->biHeight, info.minCY, - info.granularityCY); + info.granularityCY); } - if (frameVal == 0) - vih->AvgTimePerFrame = data.config.frameInterval; + if (frameVal == 0) { + // Close enough. Fixes GV-USB2 29.97 FPS setting. + if (abs(vih->AvgTimePerFrame - frameInterval) > 1) + vih->AvgTimePerFrame = frameInterval; + } - data.found = true; + data.found = true; data.bestVal = totalVal; - data.mt = copiedMT; + data.mt = copiedMT; if (totalVal == 0) return false; @@ -258,21 +264,21 @@ } bool GetClosestVideoMediaType(IBaseFilter *filter, VideoConfig &config, - MediaType &mt) + MediaType &mt) { - ComPtr<IPin> pin; + ComPtr<IPin> pin; ClosestVideoData data(config, mt); - bool success; + bool success; success = GetFilterPin(filter, MEDIATYPE_Video, PIN_CATEGORY_CAPTURE, - PINDIR_OUTPUT, &pin); + PINDIR_OUTPUT, &pin); if (!success || pin == NULL) { Error(L"GetClosestVideoMediaType: Could not get pin"); return false; } success = EnumPinCaps(pin, EnumCapsCallback(ClosestVideoMTCallback), - &data); + &data); if (!success) { Error(L"GetClosestVideoMediaType: Could not enumerate caps"); return false; @@ -283,23 +289,21 @@ struct ClosestAudioData { AudioConfig &config; - MediaType &mt; - int bestVal; - bool found; + MediaType &mt; + int bestVal; + bool found; - ClosestAudioData &operator=(ClosestAudioData const&) = delete; - ClosestAudioData &operator=(ClosestAudioData&&) = delete; + ClosestAudioData &operator=(ClosestAudioData const &) = delete; + ClosestAudioData &operator=(ClosestAudioData &&) = delete; inline ClosestAudioData(AudioConfig &config, MediaType &mt) - : config (config), - mt (mt), - bestVal (0), - found (false) - {} + : config(config), mt(mt), bestVal(0), found(false) + { + } }; static bool ClosestAudioMTCallback(ClosestAudioData &data, - const AM_MEDIA_TYPE &mt, const BYTE *capData) + const AM_MEDIA_TYPE &mt, const BYTE *capData) { AudioInfo info = {}; @@ -310,15 +314,15 @@ return true; } - MediaType copiedMT = mt; - WAVEFORMATEX *wfex = (WAVEFORMATEX*)copiedMT->pbFormat; + MediaType copiedMT = mt; + WAVEFORMATEX *wfex = (WAVEFORMATEX *)copiedMT->pbFormat; if (data.config.format != AudioFormat::Any && data.config.format != info.format) return true; int sampleRateVal = 0; - int channelsVal = 0; + int channelsVal = 0; if (data.config.sampleRate < info.minSampleRate) sampleRateVal = info.minSampleRate - data.config.sampleRate; @@ -336,7 +340,7 @@ if (channelsVal == 0) { LONG channels = data.config.channels; ClampToGranularity(channels, info.minChannels, - info.channelsGranularity); + info.channelsGranularity); wfex->nChannels = (WORD)channels; wfex->nBlockAlign = @@ -345,16 +349,16 @@ if (sampleRateVal == 0) { wfex->nSamplesPerSec = data.config.sampleRate; - ClampToGranularity((LONG&)wfex->nSamplesPerSec, - info.minSampleRate, - info.sampleRateGranularity); + ClampToGranularity((LONG &)wfex->nSamplesPerSec, + info.minSampleRate, + info.sampleRateGranularity); } wfex->nAvgBytesPerSec = wfex->nSamplesPerSec * wfex->nBlockAlign; - data.mt = copiedMT; - data.found = true; + data.mt = copiedMT; + data.found = true; data.bestVal = totalVal; if (totalVal == 0) @@ -365,21 +369,21 @@ } bool GetClosestAudioMediaType(IBaseFilter *filter, AudioConfig &config, - MediaType &mt) + MediaType &mt) { - ComPtr<IPin> pin; + ComPtr<IPin> pin; ClosestAudioData data(config, mt); - bool success; + bool success; success = GetFilterPin(filter, MEDIATYPE_Audio, PIN_CATEGORY_CAPTURE, - PINDIR_OUTPUT, &pin); + PINDIR_OUTPUT, &pin); if (!success || pin == NULL) { Error(L"GetClosestAudioMediaType: Could not get pin"); return false; } success = EnumPinCaps(pin, EnumCapsCallback(ClosestAudioMTCallback), - &data); + &data); if (!success) { Error(L"GetClosestAudioMediaType: Could not enumerate caps"); return false; @@ -388,8 +392,8 @@ return data.found; } -static bool EnumVideoCap(vector<VideoInfo> &caps, - const AM_MEDIA_TYPE &mt, const BYTE *data) +static bool EnumVideoCap(vector<VideoInfo> &caps, const AM_MEDIA_TYPE &mt, + const BYTE *data) { VideoInfo info; @@ -405,8 +409,8 @@ return EnumPinCaps(pin, EnumCapsCallback(EnumVideoCap), &caps); } -static bool EnumAudioCap(vector<AudioInfo> &caps, - const AM_MEDIA_TYPE &mt, const BYTE *data) +static bool EnumAudioCap(vector<AudioInfo> &caps, const AM_MEDIA_TYPE &mt, + const BYTE *data) { AudioInfo info; @@ -426,20 +430,20 @@ static bool decklinkVideoPresent = false; static bool EnumDevice(const GUID &type, IMoniker *deviceInfo, - EnumDeviceCallback callback, void *param) + EnumDeviceCallback callback, void *param) { ComPtr<IPropertyBag> propertyData; - ComPtr<IBaseFilter> filter; + ComPtr<IBaseFilter> filter; HRESULT hr; hr = deviceInfo->BindToStorage(0, 0, IID_IPropertyBag, - (void**)&propertyData); + (void **)&propertyData); if (FAILED(hr)) return true; VARIANT deviceName, devicePath; - deviceName.vt = VT_BSTR; - devicePath.vt = VT_BSTR; + deviceName.vt = VT_BSTR; + devicePath.vt = VT_BSTR; devicePath.bstrVal = NULL; hr = propertyData->Read(L"FriendlyName", &deviceName, NULL); @@ -450,8 +454,7 @@ * is plugged in to the system, it will still try to enumerate the * decklink audio device, but will crash when trying to bind it to * a filter due to a bug in the drivers */ - if (deviceName.bstrVal && - type == CLSID_AudioInputDeviceCategory && + if (deviceName.bstrVal && type == CLSID_AudioInputDeviceCategory && wcsstr(deviceName.bstrVal, L"Decklink") != nullptr && !decklinkVideoPresent) { return true; @@ -460,10 +463,10 @@ propertyData->Read(L"DevicePath", &devicePath, NULL); hr = deviceInfo->BindToObject(NULL, 0, IID_IBaseFilter, - (void**)&filter); + (void **)&filter); if (SUCCEEDED(hr)) { if (!callback(param, filter, deviceName.bstrVal, - devicePath.bstrVal)) + devicePath.bstrVal)) return false; } @@ -472,14 +475,15 @@ static bool EnumExceptionVideoDevices(EnumDeviceCallback callback, void *param) { - ComPtr<IBaseFilter> filter; - HRESULT hr; + ComPtr<IBaseFilter> filter; + HRESULT hr; hr = CoCreateInstance(CLSID_ElgatoVideoCaptureFilter, nullptr, - CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&filter); + CLSCTX_INPROC_SERVER, IID_IBaseFilter, + (void **)&filter); if (SUCCEEDED(hr)) { if (!callback(param, filter, L"Elgato Game Capture HD", - L"__elgato")) + L"__elgato")) return false; } @@ -488,10 +492,9 @@ static recursive_mutex enumMutex; -static bool CheckForDLCallback(void *unused, - IBaseFilter *filter, - const wchar_t *deviceName, - const wchar_t *devicePath) +static bool CheckForDLCallback(void *unused, IBaseFilter *filter, + const wchar_t *deviceName, + const wchar_t *devicePath) { if (wcsstr(deviceName, L"Decklink") != nullptr) { decklinkVideoPresent = true; @@ -508,34 +511,36 @@ { decklinkVideoPresent = false; EnumDevices(CLSID_VideoInputDeviceCategory, CheckForDLCallback, - nullptr); + nullptr); } bool EnumDevices(const GUID &type, EnumDeviceCallback callback, void *param) { lock_guard<recursive_mutex> lock(enumMutex); - ComPtr<ICreateDevEnum> deviceEnum; - ComPtr<IEnumMoniker> enumMoniker; - ComPtr<IMoniker> deviceInfo; - HRESULT hr; - DWORD count = 0; + ComPtr<ICreateDevEnum> deviceEnum; + ComPtr<IEnumMoniker> enumMoniker; + ComPtr<IMoniker> deviceInfo; + HRESULT hr; + DWORD count = 0; if (type == CLSID_AudioInputDeviceCategory) { CheckForDecklinkVideo(); } hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, - CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void**)&deviceEnum); + CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, + (void **)&deviceEnum); if (FAILED(hr)) { WarningHR(L"EnumAudioDevices: Could not create " - L"ICreateDeviceEnum", hr); + L"ICreateDeviceEnum", + hr); return false; } hr = deviceEnum->CreateClassEnumerator(type, &enumMoniker, 0); if (FAILED(hr)) { WarningHR(L"EnumAudioDevices: CreateClassEnumerator failed", - hr); + hr); return false; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-enum.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-enum.hpp
Changed
@@ -30,17 +30,16 @@ namespace DShow { bool GetClosestVideoMediaType(IBaseFilter *filter, VideoConfig &config, - MediaType &mt); + MediaType &mt); bool GetClosestAudioMediaType(IBaseFilter *filter, AudioConfig &config, - MediaType &mt); + MediaType &mt); bool EnumVideoCaps(IPin *pin, vector<VideoInfo> &caps); bool EnumAudioCaps(IPin *pin, vector<AudioInfo> &caps); -typedef bool (*EnumDeviceCallback)(void *param, - IBaseFilter *filter, - const wchar_t *deviceName, - const wchar_t *devicePath); +typedef bool (*EnumDeviceCallback)(void *param, IBaseFilter *filter, + const wchar_t *deviceName, + const wchar_t *devicePath); bool EnumDevices(const GUID &type, EnumDeviceCallback callback, void *param);
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-formats.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-formats.cpp
Changed
@@ -22,19 +22,31 @@ #ifndef __MINGW32__ -const GUID MEDIASUBTYPE_RAW_AAC1 = -{0x000000FF, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; - -const GUID MEDIASUBTYPE_I420 = -{0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; - -const GUID MEDIASUBTYPE_DVM = -{0x00002000, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; +const GUID MEDIASUBTYPE_RAW_AAC1 = {0x000000FF, + 0x0000, + 0x0010, + {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, + 0x71}}; + +const GUID MEDIASUBTYPE_I420 = {0x30323449, + 0x0000, + 0x0010, + {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, + 0x71}}; + +const GUID MEDIASUBTYPE_DVM = {0x00002000, + 0x0000, + 0x0010, + {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, + 0x71}}; #endif -const GUID MEDIASUBTYPE_Y800 = -{0x30303859, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; +const GUID MEDIASUBTYPE_Y800 = {0x30303859, + 0x0000, + 0x0010, + {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, + 0x71}}; namespace DShow { @@ -43,41 +55,54 @@ switch (fourCC) { /* raw formats */ case MAKEFOURCC('R', 'G', 'B', '2'): - format = VideoFormat::XRGB; break; + format = VideoFormat::XRGB; + break; case MAKEFOURCC('R', 'G', 'B', '4'): - format = VideoFormat::XRGB; break; + format = VideoFormat::XRGB; + break; case MAKEFOURCC('A', 'R', 'G', 'B'): - format = VideoFormat::ARGB; break; + format = VideoFormat::ARGB; + break; /* planar YUV formats */ case MAKEFOURCC('I', '4', '2', '0'): case MAKEFOURCC('I', 'Y', 'U', 'V'): - format = VideoFormat::I420; break; + format = VideoFormat::I420; + break; case MAKEFOURCC('Y', 'V', '1', '2'): - format = VideoFormat::YV12; break; + format = VideoFormat::YV12; + break; case MAKEFOURCC('N', 'V', '1', '2'): - format = VideoFormat::NV12; break; + format = VideoFormat::NV12; + break; case MAKEFOURCC('Y', '8', '0', '0'): - format = VideoFormat::Y800; break; + format = VideoFormat::Y800; + break; /* packed YUV formats */ case MAKEFOURCC('Y', 'V', 'Y', 'U'): - format = VideoFormat::YVYU; break; + format = VideoFormat::YVYU; + break; case MAKEFOURCC('Y', 'U', 'Y', '2'): - format = VideoFormat::YUY2; break; + format = VideoFormat::YUY2; + break; case MAKEFOURCC('U', 'Y', 'V', 'Y'): - format = VideoFormat::UYVY; break; + format = VideoFormat::UYVY; + break; case MAKEFOURCC('H', 'D', 'Y', 'C'): - format = VideoFormat::HDYC; break; + format = VideoFormat::HDYC; + break; /* compressed formats */ case MAKEFOURCC('H', '2', '6', '4'): - format = VideoFormat::H264; break; + format = VideoFormat::H264; + break; /* compressed formats that can automatically create intermediary * filters for decompression */ case MAKEFOURCC('M', 'J', 'P', 'G'): - format = VideoFormat::MJPEG; break; + format = VideoFormat::MJPEG; + break; default: return false; @@ -134,8 +159,8 @@ /* no valid types, check fourcc value instead */ else - return bmih ? - GetFourCCVFormat(bmih->biCompression, format) : false; + return bmih ? GetFourCCVFormat(bmih->biCompression, format) + : false; return true; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-media-type.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-media-type.cpp
Changed
@@ -37,11 +37,11 @@ return E_OUTOFMEMORY; } else { memcpy(pmtTarget->pbFormat, pmtSource->pbFormat, - pmtTarget->cbFormat); + pmtTarget->cbFormat); } } - if(pmtTarget->pUnk != nullptr) + if (pmtTarget->pUnk != nullptr) pmtTarget->pUnk->AddRef(); return S_OK; @@ -49,7 +49,7 @@ void FreeMediaType(AM_MEDIA_TYPE &mt) { - if(mt.cbFormat != 0) { + if (mt.cbFormat != 0) { CoTaskMemFree((LPVOID)mt.pbFormat); mt.cbFormat = 0; mt.pbFormat = nullptr; @@ -65,12 +65,12 @@ { if (mt.formattype == FORMAT_VideoInfo) { VIDEOINFOHEADER *vih; - vih = reinterpret_cast<VIDEOINFOHEADER*>(mt.pbFormat); + vih = reinterpret_cast<VIDEOINFOHEADER *>(mt.pbFormat); return &vih->bmiHeader; } else if (mt.formattype == FORMAT_VideoInfo2) { VIDEOINFOHEADER2 *vih; - vih = reinterpret_cast<VIDEOINFOHEADER2*>(mt.pbFormat); + vih = reinterpret_cast<VIDEOINFOHEADER2 *>(mt.pbFormat); return &vih->bmiHeader; } @@ -81,12 +81,12 @@ { if (mt.formattype == FORMAT_VideoInfo) { const VIDEOINFOHEADER *vih; - vih = reinterpret_cast<const VIDEOINFOHEADER*>(mt.pbFormat); + vih = reinterpret_cast<const VIDEOINFOHEADER *>(mt.pbFormat); return &vih->bmiHeader; } else if (mt.formattype == FORMAT_VideoInfo2) { const VIDEOINFOHEADER2 *vih; - vih = reinterpret_cast<const VIDEOINFOHEADER2*>(mt.pbFormat); + vih = reinterpret_cast<const VIDEOINFOHEADER2 *>(mt.pbFormat); return &vih->bmiHeader; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-media-type.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshow-media-type.hpp
Changed
@@ -24,7 +24,7 @@ namespace DShow { HRESULT CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource); -void FreeMediaType(AM_MEDIA_TYPE &mt); +void FreeMediaType(AM_MEDIA_TYPE &mt); BITMAPINFOHEADER *GetBitmapInfoHeader(AM_MEDIA_TYPE &mt); const BITMAPINFOHEADER *GetBitmapInfoHeader(const AM_MEDIA_TYPE &mt); @@ -37,7 +37,7 @@ AM_MEDIA_TYPE type; public: - inline MediaType() {memset(&type, 0, sizeof(type));} + inline MediaType() { memset(&type, 0, sizeof(type)); } inline MediaType(const MediaType &mt) { @@ -49,20 +49,20 @@ CopyMediaType(&type, &type_); } - inline ~MediaType() {FreeMediaType(type);} + inline ~MediaType() { FreeMediaType(type); } - inline operator AM_MEDIA_TYPE*() {return &type;} - inline operator AM_MEDIA_TYPE&() {return type;} - inline operator const AM_MEDIA_TYPE*() const {return &type;} - inline operator const AM_MEDIA_TYPE&() const {return type;} - inline AM_MEDIA_TYPE *Ptr() {return &type;} + inline operator AM_MEDIA_TYPE *() { return &type; } + inline operator AM_MEDIA_TYPE &() { return type; } + inline operator const AM_MEDIA_TYPE *() const { return &type; } + inline operator const AM_MEDIA_TYPE &() const { return type; } + inline AM_MEDIA_TYPE *Ptr() { return &type; } - inline AM_MEDIA_TYPE *operator->() {return &type;} + inline AM_MEDIA_TYPE *operator->() { return &type; } inline AM_MEDIA_TYPE *Duplicate() const { AM_MEDIA_TYPE *ptr = - (AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(*ptr)); + (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(*ptr)); memset(ptr, 0, sizeof(*ptr)); CopyMediaType(ptr, &type); return ptr; @@ -91,7 +91,7 @@ CopyMediaType(&type, &type_); } - template <typename T> inline T *AllocFormat() + template<typename T> inline T *AllocFormat() { if (type.pbFormat) { CoTaskMemFree(type.pbFormat); @@ -103,7 +103,7 @@ type.cbFormat = sizeof(T); memset(type.pbFormat, 0, sizeof(T)); - return (T*)type.pbFormat; + return (T *)type.pbFormat; } }; @@ -124,15 +124,23 @@ inline MediaTypePtr() : ptr(nullptr) {} inline MediaTypePtr(AM_MEDIA_TYPE *ptr_) : ptr(ptr_) {} - inline ~MediaTypePtr() {Clear();} + inline ~MediaTypePtr() { Clear(); } - inline AM_MEDIA_TYPE **operator&() {Clear(); return &ptr;} + inline AM_MEDIA_TYPE **operator&() + { + Clear(); + return &ptr; + } - inline AM_MEDIA_TYPE *operator->() const {return ptr;} + inline AM_MEDIA_TYPE *operator->() const { return ptr; } - inline operator AM_MEDIA_TYPE*() const {return ptr;} + inline operator AM_MEDIA_TYPE *() const { return ptr; } - inline void operator=(AM_MEDIA_TYPE *ptr_) {Clear(); ptr = ptr_;} + inline void operator=(AM_MEDIA_TYPE *ptr_) + { + Clear(); + ptr = ptr_; + } inline bool operator==(const AM_MEDIA_TYPE *ptr_) const {
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshowcapture.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshowcapture.cpp
Changed
@@ -131,9 +131,9 @@ if (pages != NULL) { if (SUCCEEDED(pages->GetPages(&cauuid)) && cauuid.cElems) { OleCreatePropertyFrame(hwnd, 0, 0, NULL, 1, - (LPUNKNOWN*)&propertyObject, - cauuid.cElems, cauuid.pElems, - 0, 0, NULL); + (LPUNKNOWN *)&propertyObject, + cauuid.cElems, cauuid.pElems, 0, + 0, NULL); CoTaskMemFree(cauuid.pElems); } } @@ -141,16 +141,17 @@ void Device::OpenDialog(void *hwnd, DialogType type) const { - ComPtr<IUnknown> ptr; - HRESULT hr; + ComPtr<IUnknown> ptr; + HRESULT hr; if (type == DialogType::ConfigVideo) { ptr = context->videoFilter; } else if (type == DialogType::ConfigCrossbar || - type == DialogType::ConfigCrossbar2) { + type == DialogType::ConfigCrossbar2) { hr = context->builder->FindInterface(NULL, NULL, - context->videoFilter, IID_IAMCrossbar, - (void**)&ptr); + context->videoFilter, + IID_IAMCrossbar, + (void **)&ptr); if (FAILED(hr)) { WarningHR(L"Failed to find crossbar", hr); return; @@ -161,9 +162,8 @@ ComQIPtr<IBaseFilter> filter(xbar); hr = context->builder->FindInterface( - &LOOK_UPSTREAM_ONLY, - NULL, filter, IID_IAMCrossbar, - (void**)&ptr); + &LOOK_UPSTREAM_ONLY, NULL, filter, + IID_IAMCrossbar, (void **)&ptr); if (FAILED(hr)) { WarningHR(L"Failed to find crossbar2", hr); return; @@ -175,7 +175,7 @@ if (!ptr) { Warning(L"Could not find filter to open dialog type: %d with", - (int)type); + (int)type); return; } @@ -183,31 +183,32 @@ } static void EnumEncodedVideo(std::vector<VideoDevice> &devices, - const wchar_t *deviceName, const wchar_t *devicePath, - const EncodedDevice &info) + const wchar_t *deviceName, + const wchar_t *devicePath, + const EncodedDevice &info) { VideoDevice device; - VideoInfo caps; + VideoInfo caps; - device.name = deviceName; - device.path = devicePath; - device.audioAttached = true; + device.name = deviceName; + device.path = devicePath; + device.audioAttached = true; device.separateAudioFilter = false; - caps.minCX = caps.maxCX = info.width; - caps.minCY = caps.maxCY = info.height; + caps.minCX = caps.maxCX = info.width; + caps.minCY = caps.maxCY = info.height; caps.granularityCX = caps.granularityCY = 1; - caps.minInterval = caps.maxInterval = info.frameInterval; - caps.format = info.videoFormat; + caps.minInterval = caps.maxInterval = info.frameInterval; + caps.format = info.videoFormat; device.caps.push_back(caps); devices.push_back(device); } static void EnumExceptionVideoDevice(std::vector<VideoDevice> &devices, - IBaseFilter *filter, - const wchar_t *deviceName, - const wchar_t *devicePath) + IBaseFilter *filter, + const wchar_t *deviceName, + const wchar_t *devicePath) { ComPtr<IPin> pin; @@ -219,14 +220,13 @@ } static bool EnumVideoDevice(std::vector<VideoDevice> &devices, - IBaseFilter *filter, - const wchar_t *deviceName, - const wchar_t *devicePath) + IBaseFilter *filter, const wchar_t *deviceName, + const wchar_t *devicePath) { - ComPtr<IPin> pin; - ComPtr<IPin> audioPin; + ComPtr<IPin> pin; + ComPtr<IPin> audioPin; ComPtr<IBaseFilter> audioFilter; - VideoDevice info; + VideoDevice info; if (wcsstr(deviceName, L"C875") != nullptr || wcsstr(deviceName, L"Prif Streambox") != nullptr || @@ -240,14 +240,14 @@ } bool success = GetFilterPin(filter, MEDIATYPE_Video, - PIN_CATEGORY_CAPTURE, PINDIR_OUTPUT, &pin); + PIN_CATEGORY_CAPTURE, PINDIR_OUTPUT, &pin); /* if this device has no standard capture pin, see if it's an * encoded device, and get its information if so (all encoded devices * are exception devices pretty much) */ if (!success) { EnumExceptionVideoDevice(devices, filter, deviceName, - devicePath); + devicePath); return true; } @@ -255,11 +255,13 @@ return true; info.audioAttached = GetFilterPin(filter, MEDIATYPE_Audio, - PIN_CATEGORY_CAPTURE, PINDIR_OUTPUT, &audioPin); + PIN_CATEGORY_CAPTURE, PINDIR_OUTPUT, + &audioPin); // Fallback: Find a corresponding audio filter for the same device if (!info.audioAttached) { - info.separateAudioFilter = GetDeviceAudioFilter(devicePath, &audioFilter); + info.separateAudioFilter = + GetDeviceAudioFilter(devicePath, &audioFilter); info.audioAttached = info.separateAudioFilter; } @@ -275,19 +277,18 @@ { devices.clear(); return EnumDevices(CLSID_VideoInputDeviceCategory, - EnumDeviceCallback(EnumVideoDevice), &devices); + EnumDeviceCallback(EnumVideoDevice), &devices); } -static bool EnumAudioDevice(vector<AudioDevice> &devices, - IBaseFilter *filter, - const wchar_t *deviceName, - const wchar_t *devicePath) +static bool EnumAudioDevice(vector<AudioDevice> &devices, IBaseFilter *filter, + const wchar_t *deviceName, + const wchar_t *devicePath) { - ComPtr<IPin> pin; - AudioDevice info; + ComPtr<IPin> pin; + AudioDevice info; bool success = GetFilterPin(filter, MEDIATYPE_Audio, - PIN_CATEGORY_CAPTURE, PINDIR_OUTPUT, &pin); + PIN_CATEGORY_CAPTURE, PINDIR_OUTPUT, &pin); if (!success) return true; @@ -306,7 +307,7 @@ { devices.clear(); return EnumDevices(CLSID_AudioInputDeviceCategory, - EnumDeviceCallback(EnumAudioDevice), &devices); + EnumDeviceCallback(EnumAudioDevice), &devices); } }; /* namespace DShow */
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/dshowencode.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/dshowencode.cpp
Changed
@@ -25,9 +25,7 @@ namespace DShow { -VideoEncoder::VideoEncoder() : context(new HVideoEncoder) -{ -} +VideoEncoder::VideoEncoder() : context(new HVideoEncoder) {} VideoEncoder::~VideoEncoder() { @@ -72,26 +70,24 @@ } bool VideoEncoder::Encode(unsigned char *data[DSHOW_MAX_PLANES], - size_t linesize[DSHOW_MAX_PLANES], - long long timestampStart, long long timestampEnd, - EncoderPacket &packet, bool &new_packet) + size_t linesize[DSHOW_MAX_PLANES], + long long timestampStart, long long timestampEnd, + EncoderPacket &packet, bool &new_packet) { if (context->encoder == nullptr) return false; return context->Encode(data, linesize, timestampStart, timestampEnd, - packet, new_packet); + packet, new_packet); } -static bool EnumVideoEncoder(vector<DeviceId> &encoders, - IBaseFilter *encoder, - const wchar_t *deviceName, - const wchar_t *devicePath) +static bool EnumVideoEncoder(vector<DeviceId> &encoders, IBaseFilter *encoder, + const wchar_t *deviceName, + const wchar_t *devicePath) { DeviceId id; - bool validDevice = - wcsstr(deviceName, L"C985") || - wcsstr(deviceName, L"C353"); + bool validDevice = wcsstr(deviceName, L"C985") || + wcsstr(deviceName, L"C353"); if (!validDevice) return true; @@ -108,7 +104,7 @@ { encoders.clear(); return EnumDevices(KSCATEGORY_ENCODER, - EnumDeviceCallback(EnumVideoEncoder), &encoders); + EnumDeviceCallback(EnumVideoEncoder), &encoders); } };
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/encoder.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/encoder.cpp
Changed
@@ -68,14 +68,14 @@ } success = GetPinByName(device, PINDIR_OUTPUT, L"Virtual Video Out", - &deviceOut); + &deviceOut); if (!success) { Warning(L"Failed to get Virtual Video Out pin"); return false; } success = GetPinByName(encoder, PINDIR_INPUT, L"Virtual Video In", - &encoderIn); + &encoderIn); if (!success) { Warning(L"Failed to get encoder input pin"); return false; @@ -110,9 +110,9 @@ static bool GetPinFirstMediaType(IPin *pin, AM_MEDIA_TYPE **mt) { - ComPtr<IEnumMediaTypes> mediaEnum; - HRESULT hr; - ULONG fetched; + ComPtr<IEnumMediaTypes> mediaEnum; + HRESULT hr; + ULONG fetched; hr = pin->EnumMediaTypes(&mediaEnum); if (FAILED(hr)) { @@ -176,35 +176,35 @@ bitrate = size * config.fpsNumerator / config.fpsDenominator; - VIDEOINFOHEADER *vih = mt.AllocFormat<VIDEOINFOHEADER>(); - vih->bmiHeader.biSize = sizeof(vih->bmiHeader); - vih->bmiHeader.biWidth = config.cx; - vih->bmiHeader.biHeight = config.cy; - vih->bmiHeader.biPlanes = 1; - vih->bmiHeader.biBitCount = 12; - vih->bmiHeader.biSizeImage = size; - vih->bmiHeader.biCompression = MAKEFOURCC('Y', 'V', '1', '2'); - vih->rcSource.right = config.cx; - vih->rcSource.bottom = config.cy; - vih->rcTarget = vih->rcSource; - vih->dwBitRate = (DWORD)(bitrate * 8); - vih->AvgTimePerFrame = frameTime; - - mt->majortype = MEDIATYPE_Video; - mt->subtype = MEDIASUBTYPE_YV12; - mt->formattype = FORMAT_VideoInfo; - mt->bFixedSizeSamples = true; - mt->lSampleSize = size; + VIDEOINFOHEADER *vih = mt.AllocFormat<VIDEOINFOHEADER>(); + vih->bmiHeader.biSize = sizeof(vih->bmiHeader); + vih->bmiHeader.biWidth = config.cx; + vih->bmiHeader.biHeight = config.cy; + vih->bmiHeader.biPlanes = 1; + vih->bmiHeader.biBitCount = 12; + vih->bmiHeader.biSizeImage = size; + vih->bmiHeader.biCompression = MAKEFOURCC('Y', 'V', '1', '2'); + vih->rcSource.right = config.cx; + vih->rcSource.bottom = config.cy; + vih->rcTarget = vih->rcSource; + vih->dwBitRate = (DWORD)(bitrate * 8); + vih->AvgTimePerFrame = frameTime; + + mt->majortype = MEDIATYPE_Video; + mt->subtype = MEDIASUBTYPE_YV12; + mt->formattype = FORMAT_VideoInfo; + mt->bFixedSizeSamples = true; + mt->lSampleSize = size; } bool HVideoEncoder::SetupEncoder(IBaseFilter *filter) { - ComPtr<IBaseFilter> deviceFilter; - ComPtr<IPin> inputPin; - ComPtr<IPin> outputPin; - REGPINMEDIUM medium; - MediaTypePtr mtRaw; - MediaTypePtr mtEncoded; + ComPtr<IBaseFilter> deviceFilter; + ComPtr<IPin> inputPin; + ComPtr<IPin> outputPin; + REGPINMEDIUM medium; + MediaTypePtr mtRaw; + MediaTypePtr mtEncoded; if (!GetPinByName(filter, PINDIR_INPUT, nullptr, &inputPin)) { Warning(L"Could not get encoder input pin"); @@ -222,7 +222,7 @@ inputPin.Release(); if (!GetFilterByMedium(CLSID_VideoInputDeviceCategory, medium, - &deviceFilter)) { + &deviceFilter)) { Warning(L"Could not get device filter from medium"); return false; } @@ -240,22 +240,22 @@ } PinCaptureInfo captureInfo; - captureInfo.callback = [this] (IMediaSample *s) {Receive(s);}; - captureInfo.expectedMajorType = mtEncoded->majortype; - captureInfo.expectedSubType = mtEncoded->subtype; + captureInfo.callback = [this](IMediaSample *s) { Receive(s); }; + captureInfo.expectedMajorType = mtEncoded->majortype; + captureInfo.expectedSubType = mtEncoded->subtype; PinOutputInfo outputInfo; - outputInfo.expectedMajorType = mtRaw->majortype; - outputInfo.expectedSubType = mtRaw->subtype; - outputInfo.cx = config.cx; - outputInfo.cy = config.cy; + outputInfo.expectedMajorType = mtRaw->majortype; + outputInfo.expectedSubType = mtRaw->subtype; + outputInfo.cx = config.cx; + outputInfo.cy = config.cy; InitializeVideoFormat(outputInfo.mt); encoder = filter; - device = deviceFilter; + device = deviceFilter; capture = new CaptureFilter(captureInfo); - output = new OutputFilter(outputInfo); + output = new OutputFilter(outputInfo); graph->AddFilter(output, nullptr); graph->AddFilter(device, L"Device Filter"); @@ -266,12 +266,14 @@ static inline void Clamp(ULONG &val, ULONG minVal, ULONG maxVal) { - if (val < minVal) val = minVal; - else if (val > maxVal) val = maxVal; + if (val < minVal) + val = minVal; + else if (val > maxVal) + val = maxVal; } HRESULT SetAVMEncoderSetting(IKsPropertySet *propertySet, ULONG setting, - ULONG param1, ULONG param2) + ULONG param1, ULONG param2) { AVER_PARAMETERS params = {}; params.ulIndex = setting; @@ -287,9 +289,8 @@ } return propertySet->Set(AVER_HW_ENCODE_PROPERTY, - PROPERTY_HW_ENCODE_PARAMETER, - ¶ms, sizeof(params), - ¶ms, sizeof(params)); + PROPERTY_HW_ENCODE_PARAMETER, ¶ms, + sizeof(params), ¶ms, sizeof(params)); } bool SetAvermediaEncoderConfig(IBaseFilter *encoder, VideoEncoderConfig &config) @@ -302,44 +303,40 @@ return false; } - double fps = double(config.fpsNumerator) / - double(config.fpsDenominator); + double fps = + double(config.fpsNumerator) / double(config.fpsDenominator); - hr = SetAVMEncoderSetting(propertySet, - AVER_PARAMETER_ENCODE_FRAME_RATE, - ULONG(fps), 0); + hr = SetAVMEncoderSetting(propertySet, AVER_PARAMETER_ENCODE_FRAME_RATE, + ULONG(fps), 0); if (FAILED(hr)) { WarningHR(L"Failed to set Avermedia encoder FPS", hr); return false; } - hr = SetAVMEncoderSetting(propertySet, - AVER_PARAMETER_ENCODE_BIT_RATE, - ULONG(config.bitrate), 0); + hr = SetAVMEncoderSetting(propertySet, AVER_PARAMETER_ENCODE_BIT_RATE, + ULONG(config.bitrate), 0); if (FAILED(hr)) { WarningHR(L"Failed to set Avermedia encoder bitrate", hr); return false; } hr = SetAVMEncoderSetting(propertySet, - AVER_PARAMETER_CURRENT_RESOLUTION, - ULONG(config.cx), ULONG(config.cy)); + AVER_PARAMETER_CURRENT_RESOLUTION, + ULONG(config.cx), ULONG(config.cy)); if (FAILED(hr)) { WarningHR(L"Failed to set Avermedia encoder current res", hr); return false; } - hr = SetAVMEncoderSetting(propertySet, - AVER_PARAMETER_ENCODE_RESOLUTION, - ULONG(config.cx), ULONG(config.cy)); + hr = SetAVMEncoderSetting(propertySet, AVER_PARAMETER_ENCODE_RESOLUTION, + ULONG(config.cx), ULONG(config.cy)); if (FAILED(hr)) { WarningHR(L"Failed to set Avermedia encoder res", hr); return false; } - hr = SetAVMEncoderSetting(propertySet, - AVER_PARAMETER_ENCODE_GOP, - ULONG(config.keyframeInterval), 0); + hr = SetAVMEncoderSetting(propertySet, AVER_PARAMETER_ENCODE_GOP, + ULONG(config.keyframeInterval), 0); if (FAILED(hr)) { WarningHR(L"Failed to set Avermedia encoder GOP", hr); return false; @@ -358,11 +355,11 @@ return false; } - bool success = GetDeviceFilter(KSCATEGORY_ENCODER, - config.name.c_str(), config.path.c_str(), &filter); + bool success = GetDeviceFilter(KSCATEGORY_ENCODER, config.name.c_str(), + config.path.c_str(), &filter); if (!success) { - Warning(L"Video encoder '%s': %s not found", config.name.c_str(), - config.path.c_str()); + Warning(L"Video encoder '%s': %s not found", + config.name.c_str(), config.path.c_str()); return false; } @@ -420,9 +417,9 @@ } bool HVideoEncoder::Encode(unsigned char *data[DSHOW_MAX_PLANES], - size_t linesize[DSHOW_MAX_PLANES], - long long timestampStart, long long timestampEnd, - EncoderPacket &packet, bool &new_packet) + size_t linesize[DSHOW_MAX_PLANES], + long long timestampStart, long long timestampEnd, + EncoderPacket &packet, bool &new_packet) { new_packet = false; @@ -441,9 +438,9 @@ packet.data = curPacket.data.data(); packet.size = curPacket.data.size(); - packet.pts = ptsOut; - packet.dts = ptsOut; - new_packet = true; + packet.pts = ptsOut; + packet.dts = ptsOut; + new_packet = true; } packetMutex.unlock(); return true;
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/encoder.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/encoder.hpp
Changed
@@ -30,7 +30,7 @@ using namespace std; struct EncodedData { - vector<unsigned char> data; + vector<unsigned char> data; inline EncodedData() {} @@ -44,25 +44,25 @@ namespace DShow { struct HVideoEncoder { - ComPtr<IGraphBuilder> graph; - ComPtr<ICaptureGraphBuilder2> builder; - ComPtr<IMediaControl> control; + ComPtr<IGraphBuilder> graph; + ComPtr<ICaptureGraphBuilder2> builder; + ComPtr<IMediaControl> control; - ComPtr<IBaseFilter> encoder; - ComPtr<IBaseFilter> device; - ComPtr<OutputFilter> output; - ComPtr<CaptureFilter> capture; + ComPtr<IBaseFilter> encoder; + ComPtr<IBaseFilter> device; + ComPtr<OutputFilter> output; + ComPtr<CaptureFilter> capture; - VideoEncoderConfig config; + VideoEncoderConfig config; - mutex packetMutex; - deque<EncodedData> packets; - EncodedData curPacket; + mutex packetMutex; + deque<EncodedData> packets; + EncodedData curPacket; - deque<long long> ptsVals; + deque<long long> ptsVals; - bool initialized = false; - bool active = false; + bool initialized = false; + bool active = false; HVideoEncoder(); ~HVideoEncoder(); @@ -79,9 +79,9 @@ bool SetConfig(VideoEncoderConfig &config); bool Encode(unsigned char *frame[DSHOW_MAX_PLANES], - size_t linesize[DSHOW_MAX_PLANES], - long long timestampStart, long long timestampEnd, - EncoderPacket &packet, bool &new_packet); + size_t linesize[DSHOW_MAX_PLANES], long long timestampStart, + long long timestampEnd, EncoderPacket &packet, + bool &new_packet); }; };
View file
obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/external
Added
+(directory)
View file
obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/external/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/external/IVideoCaptureFilter.h
Changed
(renamed from plugins/win-dshow/libdshowcapture/source/IVideoCaptureFilter.h)
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/log.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/log.cpp
Changed
@@ -23,13 +23,13 @@ namespace DShow { -void *logParam = NULL; +void *logParam = NULL; static LogCallback logCallback = NULL; void SetLogCallback(LogCallback callback, void *param) { logCallback = callback; - logParam = param; + logParam = param; } static void Log(LogType type, const wchar_t *format, va_list args) @@ -41,7 +41,7 @@ logCallback(type, str, logParam); } -void Error (const wchar_t *format, ...) +void Error(const wchar_t *format, ...) { va_list args; va_start(args, format); @@ -57,7 +57,7 @@ va_end(args); } -void Info (const wchar_t *format, ...) +void Info(const wchar_t *format, ...) { va_list args; va_start(args, format); @@ -65,7 +65,7 @@ va_end(args); } -void Debug (const wchar_t *format, ...) +void Debug(const wchar_t *format, ...) { va_list args; va_start(args, format); @@ -73,7 +73,7 @@ va_end(args); } -void ErrorHR (const wchar_t *str, HRESULT hr) +void ErrorHR(const wchar_t *str, HRESULT hr) { Error(L"%s (0x%08lX): %s", str, hr, ConvertHRToEnglish(hr).c_str()); } @@ -83,12 +83,12 @@ Warning(L"%s (0x%08lX): %s", str, hr, ConvertHRToEnglish(hr).c_str()); } -void InfoHR (const wchar_t *str, HRESULT hr) +void InfoHR(const wchar_t *str, HRESULT hr) { Info(L"%s (0x%08lX): %s", str, hr, ConvertHRToEnglish(hr).c_str()); } -void DebugHR (const wchar_t *str, HRESULT hr) +void DebugHR(const wchar_t *str, HRESULT hr) { Info(L"%s (0x%08lX): %s", str, hr, ConvertHRToEnglish(hr).c_str()); }
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/log.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/log.hpp
Changed
@@ -24,14 +24,14 @@ namespace DShow { -void Error (const wchar_t *format, ...); +void Error(const wchar_t *format, ...); void Warning(const wchar_t *format, ...); -void Info (const wchar_t *format, ...); -void Debug (const wchar_t *format, ...); +void Info(const wchar_t *format, ...); +void Debug(const wchar_t *format, ...); -void ErrorHR (const wchar_t *str, HRESULT hr); +void ErrorHR(const wchar_t *str, HRESULT hr); void WarningHR(const wchar_t *str, HRESULT hr); -void InfoHR (const wchar_t *str, HRESULT hr); -void DebugHR (const wchar_t *str, HRESULT hr); +void InfoHR(const wchar_t *str, HRESULT hr); +void DebugHR(const wchar_t *str, HRESULT hr); }; /* namespace DShow */
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/output-filter.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/output-filter.cpp
Changed
@@ -28,20 +28,16 @@ #define PrintFunc(x) #endif -#define FILTER_NAME L"Output Filter" +#define FILTER_NAME L"Output Filter" #define VIDEO_PIN_NAME L"Video Output" #define AUDIO_PIN_NAME L"Audio Output" OutputPin::OutputPin(OutputFilter *filter_, const PinOutputInfo &info) - : refCount (0), - outputInfo (info), - filter (filter_) + : refCount(0), outputInfo(info), filter(filter_) { } -OutputPin::~OutputPin() -{ -} +OutputPin::~OutputPin() {} STDMETHODIMP OutputPin::QueryInterface(REFIID riid, void **ppv) { @@ -50,10 +46,10 @@ *ppv = this; } else if (riid == IID_IPin) { AddRef(); - *ppv = (IPin*)this; + *ppv = (IPin *)this; } else if (riid == IID_IMemInputPin) { AddRef(); - *ppv = (IMemInputPin*)this; + *ppv = (IMemInputPin *)this; } else { *ppv = nullptr; return E_NOINTERFACE; @@ -120,8 +116,9 @@ hr = memInput->GetAllocator(&allocator); if (hr == VFW_E_NO_ALLOCATOR) hr = CoCreateInstance(CLSID_MemoryAllocator, NULL, - CLSCTX_INPROC_SERVER, __uuidof(IMemAllocator), - (void**)&allocator); + CLSCTX_INPROC_SERVER, + __uuidof(IMemAllocator), + (void **)&allocator); if (FAILED(hr)) return E_FAIL; @@ -137,7 +134,7 @@ if (hr == E_NOTIMPL) { props.cBuffers = 4; props.cbBuffer = (long)bufSize; - props.cbAlign = 32; + props.cbAlign = 32; props.cbPrefix = 0; } else if (FAILED(hr)) { @@ -160,7 +157,7 @@ } STDMETHODIMP OutputPin::ReceiveConnection(IPin *pConnector, - const AM_MEDIA_TYPE *pmt) + const AM_MEDIA_TYPE *pmt) { PrintFunc(L"OutputPin::ReceiveConnection"); @@ -237,7 +234,7 @@ STDMETHODIMP OutputPin::QueryId(LPWSTR *lpId) { - wchar_t *str = (wchar_t*)CoTaskMemAlloc(sizeof(OUTPUT_PIN_NAME)); + wchar_t *str = (wchar_t *)CoTaskMemAlloc(sizeof(OUTPUT_PIN_NAME)); memcpy(str, OUTPUT_PIN_NAME, sizeof(OUTPUT_PIN_NAME)); *lpId = str; return S_OK; @@ -294,8 +291,8 @@ return S_OK; } -STDMETHODIMP OutputPin::NewSegment(REFERENCE_TIME tStart, - REFERENCE_TIME tStop, double dRate) +STDMETHODIMP OutputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, + double dRate) { PrintFunc(L"OutputPin::NewSegment"); @@ -308,7 +305,7 @@ bool OutputPin::IsValidMediaType(const AM_MEDIA_TYPE *pmt) const { if (pmt->pbFormat) { - if (pmt->subtype != outputInfo.expectedSubType || + if (pmt->subtype != outputInfo.expectedSubType || pmt->majortype != outputInfo.expectedMajorType) return false; @@ -323,8 +320,8 @@ } void OutputPin::Send(unsigned char *data[DSHOW_MAX_PLANES], - size_t linesize[DSHOW_MAX_PLANES], - long long timestampStart, long long timestampEnd) + size_t linesize[DSHOW_MAX_PLANES], + long long timestampStart, long long timestampEnd) { ComQIPtr<IMemInputPin> memInput(connectedPin); REFERENCE_TIME startTime = timestampStart; @@ -420,16 +417,14 @@ }; OutputFilter::OutputFilter(const PinOutputInfo &info) - : refCount (0), - state (State_Stopped), - pin (new OutputPin(this, info)), - misc (new SourceMiscFlags) + : refCount(0), + state(State_Stopped), + pin(new OutputPin(this, info)), + misc(new SourceMiscFlags) { } -OutputFilter::~OutputFilter() -{ -} +OutputFilter::~OutputFilter() {} // IUnknown methods STDMETHODIMP OutputFilter::QueryInterface(REFIID riid, void **ppv) @@ -439,15 +434,15 @@ *ppv = this; } else if (riid == IID_IPersist) { AddRef(); - *ppv = (IPersist*)this; + *ppv = (IPersist *)this; } else if (riid == IID_IMediaFilter) { AddRef(); - *ppv = (IMediaFilter*)this; + *ppv = (IMediaFilter *)this; } else if (riid == IID_IBaseFilter) { AddRef(); - *ppv = (IBaseFilter*)this; + *ppv = (IBaseFilter *)this; } else if (riid == IID_IAMFilterMiscFlags) { - misc.CopyTo((IAMFilterMiscFlags**)ppv); + misc.CopyTo((IAMFilterMiscFlags **)ppv); } else { *ppv = nullptr; return E_NOINTERFACE; @@ -580,21 +575,19 @@ // ============================================================================ OutputEnumPins::OutputEnumPins(OutputFilter *filter_, OutputEnumPins *pEnum) - : filter (filter_) + : filter(filter_) { curPin = (pEnum != nullptr) ? pEnum->curPin : 0; } -OutputEnumPins::~OutputEnumPins() -{ -} +OutputEnumPins::~OutputEnumPins() {} // IUnknown STDMETHODIMP OutputEnumPins::QueryInterface(REFIID riid, void **ppv) { if (riid == IID_IUnknown || riid == IID_IEnumPins) { AddRef(); - *ppv = (IEnumPins*)this; + *ppv = (IEnumPins *)this; return NOERROR; } else { *ppv = nullptr; @@ -632,7 +625,8 @@ curPin++; } - if (pcFetched) *pcFetched = nFetched; + if (pcFetched) + *pcFetched = nFetched; return (nFetched == cPins) ? S_OK : S_FALSE; } @@ -654,17 +648,11 @@ return (*ppEnum == nullptr) ? E_OUTOFMEMORY : NOERROR; } - // ============================================================================ -OutputEnumMediaTypes::OutputEnumMediaTypes(OutputPin *pin_) - : pin (pin_) -{ -} +OutputEnumMediaTypes::OutputEnumMediaTypes(OutputPin *pin_) : pin(pin_) {} -OutputEnumMediaTypes::~OutputEnumMediaTypes() -{ -} +OutputEnumMediaTypes::~OutputEnumMediaTypes() {} STDMETHODIMP OutputEnumMediaTypes::QueryInterface(REFIID riid, void **ppv) { @@ -695,7 +683,8 @@ // IEnumMediaTypes STDMETHODIMP OutputEnumMediaTypes::Next(ULONG cMediaTypes, - AM_MEDIA_TYPE **ppMediaTypes, ULONG *pcFetched) + AM_MEDIA_TYPE **ppMediaTypes, + ULONG *pcFetched) { PrintFunc(L"OutputEnumMediaTypes::Next"); @@ -707,7 +696,8 @@ curMT++; } - if (pcFetched) *pcFetched = nFetched; + if (pcFetched) + *pcFetched = nFetched; return (nFetched == cMediaTypes) ? S_OK : S_FALSE; }
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/libdshowcapture/source/output-filter.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/libdshowcapture/source/output-filter.hpp
Changed
@@ -38,14 +38,14 @@ class OutputPin : public IPin { friend class OutputEnumMediaTypes; - volatile long refCount; + volatile long refCount; - PinOutputInfo outputInfo; - ComPtr<IPin> connectedPin; - OutputFilter *filter; - volatile bool flushing = false; - ComPtr<IMemAllocator> allocator; - size_t bufSize; + PinOutputInfo outputInfo; + ComPtr<IPin> connectedPin; + OutputFilter *filter; + volatile bool flushing = false; + ComPtr<IMemAllocator> allocator; + size_t bufSize; bool IsValidMediaType(const AM_MEDIA_TYPE *pmt) const; @@ -60,7 +60,7 @@ // IPin methods STDMETHODIMP Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt); STDMETHODIMP ReceiveConnection(IPin *connector, - const AM_MEDIA_TYPE *pmt); + const AM_MEDIA_TYPE *pmt); STDMETHODIMP Disconnect(); STDMETHODIMP ConnectedTo(IPin **pPin); STDMETHODIMP ConnectionMediaType(AM_MEDIA_TYPE *pmt); @@ -69,18 +69,17 @@ STDMETHODIMP QueryId(LPWSTR *lpId); STDMETHODIMP QueryAccept(const AM_MEDIA_TYPE *pmt); STDMETHODIMP EnumMediaTypes(IEnumMediaTypes **ppEnum); - STDMETHODIMP QueryInternalConnections(IPin* *apPin, ULONG *nPin); + STDMETHODIMP QueryInternalConnections(IPin **apPin, ULONG *nPin); STDMETHODIMP EndOfStream(); STDMETHODIMP BeginFlush(); STDMETHODIMP EndFlush(); STDMETHODIMP NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, - double dRate); + double dRate); void Send(unsigned char *data[DSHOW_MAX_PLANES], - size_t linesize[DSHOW_MAX_PLANES], - long long timestampStart, - long long timestampEnd); + size_t linesize[DSHOW_MAX_PLANES], long long timestampStart, + long long timestampEnd); void Stop(); }; @@ -88,12 +87,12 @@ class OutputFilter : public IBaseFilter { friend class OutputPin; - volatile long refCount; - FILTER_STATE state; - ComPtr<IFilterGraph> graph; - ComPtr<OutputPin> pin; + volatile long refCount; + FILTER_STATE state; + ComPtr<IFilterGraph> graph; + ComPtr<OutputPin> pin; - ComPtr<IAMFilterMiscFlags> misc; + ComPtr<IAMFilterMiscFlags> misc; public: OutputFilter(const PinOutputInfo &info); @@ -122,20 +121,20 @@ STDMETHODIMP JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName); STDMETHODIMP QueryVendorInfo(LPWSTR *pVendorInfo); - inline OutputPin* GetPin() const {return (OutputPin*)pin;} + inline OutputPin *GetPin() const { return (OutputPin *)pin; } inline void Send(unsigned char *data[DSHOW_MAX_PLANES], - size_t linesize[DSHOW_MAX_PLANES], - long long timestampStart, long long timestampEnd) + size_t linesize[DSHOW_MAX_PLANES], + long long timestampStart, long long timestampEnd) { pin->Send(data, linesize, timestampStart, timestampEnd); } }; class OutputEnumPins : public IEnumPins { - volatile long refCount = 1; - ComPtr<OutputFilter> filter; - UINT curPin; + volatile long refCount = 1; + ComPtr<OutputFilter> filter; + UINT curPin; public: OutputEnumPins(OutputFilter *filter, OutputEnumPins *pEnum); @@ -154,9 +153,9 @@ }; class OutputEnumMediaTypes : public IEnumMediaTypes { - volatile long refCount = 1; - ComPtr<OutputPin> pin; - UINT curMT = 0; + volatile long refCount = 1; + ComPtr<OutputPin> pin; + UINT curMT = 0; public: OutputEnumMediaTypes(OutputPin *pin); @@ -169,11 +168,10 @@ // IEnumMediaTypes STDMETHODIMP Next(ULONG cMediaTypes, AM_MEDIA_TYPE **ppMediaTypes, - ULONG *pcFetched); + ULONG *pcFetched); STDMETHODIMP Skip(ULONG cMediaTypes); STDMETHODIMP Reset(); STDMETHODIMP Clone(IEnumMediaTypes **ppEnum); }; }; /* namespace DShow */ -
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/win-dshow-encoder.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/win-dshow-encoder.cpp
Changed
@@ -8,22 +8,21 @@ using namespace std; struct DShowEncoder { - obs_encoder_t *context; - VideoEncoder encoder; + obs_encoder_t *context; + VideoEncoder encoder; - VideoEncoderConfig config; + VideoEncoderConfig config; - const wchar_t *device; - video_format format; - long long frameInterval; + const wchar_t *device; + video_format format; + long long frameInterval; - bool first = true; - DARRAY(uint8_t) firstPacket; - DARRAY(uint8_t) header; + bool first = true; + DARRAY(uint8_t) firstPacket; + DARRAY(uint8_t) header; inline DShowEncoder(obs_encoder_t *context_, const wchar_t *device_) - : context(context_), - device(device_) + : context(context_), device(device_) { da_init(firstPacket); da_init(header); @@ -39,15 +38,16 @@ inline bool Update(obs_data_t *settings); inline bool Encode(struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet); + struct encoder_packet *packet, + bool *received_packet); }; -static const char *GetC985EncoderName(void*) +static const char *GetC985EncoderName(void *) { return obs_module_text("Encoder.C985"); } -static const char *GetC353EncoderName(void*) +static const char *GetC353EncoderName(void *) { return obs_module_text("Encoder.C353"); } @@ -85,10 +85,10 @@ video_t *video = obs_encoder_video(context); const struct video_output_info *voi = video_output_get_info(video); - int bitrate = (int)obs_data_get_int(settings, "bitrate"); - int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec"); - int width = (int)obs_encoder_get_width(context); - int height = (int)obs_encoder_get_height(context); + int bitrate = (int)obs_data_get_int(settings, "bitrate"); + int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec"); + int width = (int)obs_encoder_get_width(context); + int height = (int)obs_encoder_get_height(context); double aspect = double(width) / double(height); @@ -106,14 +106,14 @@ frameInterval = voi->fps_den * 10000000 / voi->fps_num; - config.fpsNumerator = voi->fps_num; - config.fpsDenominator = voi->fps_den; - config.bitrate = bitrate; - config.keyframeInterval = keyint; - config.cx = width; - config.cy = height; - config.name = id.name; - config.path = id.path; + config.fpsNumerator = voi->fps_num; + config.fpsDenominator = voi->fps_den; + config.bitrate = bitrate; + config.keyframeInterval = keyint; + config.cx = width; + config.cy = height; + config.name = id.name; + config.path = id.path; first = true; da_resize(firstPacket, 0); @@ -123,24 +123,22 @@ DStr encoder_name; dstr_from_wcs(encoder_name, config.name.c_str()); - blog(LOG_DEBUG, "win-dshow-encoder:\n" - "\tencoder: %s\n" - "\twidth: %d\n" - "\theight: %d\n" - "\tfps_num: %d\n" - "\tfps_den: %d", - deviceName->array, - (int)width, - (int)height, - (int)voi->fps_num, - (int)voi->fps_den); + blog(LOG_DEBUG, + "win-dshow-encoder:\n" + "\tencoder: %s\n" + "\twidth: %d\n" + "\theight: %d\n" + "\tfps_num: %d\n" + "\tfps_den: %d", + deviceName->array, (int)width, (int)height, (int)voi->fps_num, + (int)voi->fps_den); return encoder.SetConfig(config); } static bool UpdateDShowEncoder(void *data, obs_data_t *settings) { - DShowEncoder *encoder = reinterpret_cast<DShowEncoder*>(data); + DShowEncoder *encoder = reinterpret_cast<DShowEncoder *>(data); if (!obs_encoder_active(encoder->context)) return encoder->Update(settings); @@ -149,7 +147,8 @@ } static inline void *CreateDShowEncoder(obs_data_t *settings, - obs_encoder_t *context, const wchar_t *device) + obs_encoder_t *context, + const wchar_t *device) { DShowEncoder *encoder = nullptr; @@ -159,7 +158,7 @@ } catch (const char *error) { blog(LOG_ERROR, "Could not create DirectShow encoder '%s': %s", - obs_encoder_get_name(context), error); + obs_encoder_get_name(context), error); } UNUSED_PARAMETER(settings); @@ -178,7 +177,7 @@ static void DestroyDShowEncoder(void *data) { - delete reinterpret_cast<DShowEncoder*>(data); + delete reinterpret_cast<DShowEncoder *>(data); } /* the first packet contains the SPS/PPS (header) NALs, so parse the first @@ -194,7 +193,8 @@ while (nal_end != end) { nal_codestart = nal_start; - while (nal_start < end && !*(nal_start++)); + while (nal_start < end && !*(nal_start++)) + ; if (nal_start == end) break; @@ -207,11 +207,11 @@ if (type == OBS_NAL_SPS || type == OBS_NAL_PPS) { da_push_back_array(header, nal_codestart, - nal_end - nal_codestart); + nal_end - nal_codestart); } else { da_push_back_array(firstPacket, nal_codestart, - nal_end - nal_codestart); + nal_end - nal_codestart); } nal_start = nal_end; @@ -219,7 +219,8 @@ } inline bool DShowEncoder::Encode(struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, + bool *received_packet) { unsigned char *frame_data[DSHOW_MAX_PLANES] = {}; size_t frame_sizes[DSHOW_MAX_PLANES] = {}; @@ -238,18 +239,18 @@ long long actualPTS = frame->pts * frameInterval; - bool success = encoder.Encode(frame_data, frame_sizes, - actualPTS, actualPTS + frameInterval, - dshowPacket, new_packet); + bool success = encoder.Encode(frame_data, frame_sizes, actualPTS, + actualPTS + frameInterval, dshowPacket, + new_packet); if (!success) return false; if (new_packet && !!dshowPacket.data && !!dshowPacket.size) { - packet->data = dshowPacket.data; - packet->size = dshowPacket.size; - packet->type = OBS_ENCODER_VIDEO; - packet->pts = dshowPacket.pts / frameInterval; - packet->dts = dshowPacket.dts / frameInterval; + packet->data = dshowPacket.data; + packet->size = dshowPacket.size; + packet->type = OBS_ENCODER_VIDEO; + packet->pts = dshowPacket.pts / frameInterval; + packet->dts = dshowPacket.dts / frameInterval; packet->keyframe = obs_avc_keyframe(packet->data, packet->size); /* first packet must be parsed in order to retrieve header */ @@ -267,15 +268,15 @@ } static bool DShowEncode(void *data, struct encoder_frame *frame, - struct encoder_packet *packet, bool *received_packet) + struct encoder_packet *packet, bool *received_packet) { - return reinterpret_cast<DShowEncoder*>(data)->Encode(frame, packet, - received_packet); + return reinterpret_cast<DShowEncoder *>(data)->Encode(frame, packet, + received_packet); } static bool GetDShowExtraData(void *data, uint8_t **extra_data, size_t *size) { - DShowEncoder *encoder = reinterpret_cast<DShowEncoder*>(data); + DShowEncoder *encoder = reinterpret_cast<DShowEncoder *>(data); *extra_data = encoder->header.array; *size = encoder->header.num; @@ -286,22 +287,22 @@ static inline bool ValidResolution(uint32_t width, uint32_t height) { return (width == 1280 && height == 720) || - (width == 1024 && height == 768); + (width == 1024 && height == 768); } static void GetDShowVideoInfo(void *data, struct video_scale_info *info) { - DShowEncoder *encoder = reinterpret_cast<DShowEncoder*>(data); + DShowEncoder *encoder = reinterpret_cast<DShowEncoder *>(data); encoder->format = VIDEO_FORMAT_I420; if (info->format == VIDEO_FORMAT_I420 && ValidResolution(info->width, info->height)) return; - info->format = VIDEO_FORMAT_I420; - info->width = info->width; - info->height = info->height; - info->range = VIDEO_RANGE_DEFAULT; + info->format = VIDEO_FORMAT_I420; + info->width = info->width; + info->height = info->height; + info->range = VIDEO_RANGE_DEFAULT; info->colorspace = VIDEO_CS_DEFAULT; double aspect = double(info->width) / double(info->height); @@ -325,7 +326,7 @@ obs_properties_t *ppts = obs_properties_create(); obs_properties_add_int(ppts, "bitrate", obs_module_text("Bitrate"), - 1000, 60000, 1); + 1000, 60000, 1); UNUSED_PARAMETER(data); return ppts; @@ -333,16 +334,16 @@ void RegisterDShowEncoders() { - obs_encoder_info info = {}; - info.type = OBS_ENCODER_VIDEO; - info.codec = "h264"; - info.destroy = DestroyDShowEncoder; - info.encode = DShowEncode; - info.update = UpdateDShowEncoder; - info.get_defaults = GetDShowEncoderDefauts; - info.get_properties = GetDShowEncoderProperties; - info.get_extra_data = GetDShowExtraData; - info.get_video_info = GetDShowVideoInfo; + obs_encoder_info info = {}; + info.type = OBS_ENCODER_VIDEO; + info.codec = "h264"; + info.destroy = DestroyDShowEncoder; + info.encode = DShowEncode; + info.update = UpdateDShowEncoder; + info.get_defaults = GetDShowEncoderDefauts; + info.get_properties = GetDShowEncoderProperties; + info.get_extra_data = GetDShowExtraData; + info.get_video_info = GetDShowVideoInfo; vector<DeviceId> devices; DShow::VideoEncoder::EnumEncoders(devices);
View file
obs-studio-23.2.1.tar.xz/plugins/win-dshow/win-dshow.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-dshow/win-dshow.cpp
Changed
@@ -28,6 +28,8 @@ using namespace std; using namespace DShow; +/* clang-format off */ + /* settings defines that will cause errors if there are typos */ #define VIDEO_DEVICE_ID "video_device_id" #define RES_TYPE "res_type" @@ -73,19 +75,22 @@ #define TEXT_COLOR_SPACE obs_module_text("ColorSpace") #define TEXT_COLOR_DEFAULT obs_module_text("ColorSpace.Default") #define TEXT_COLOR_RANGE obs_module_text("ColorRange") +#define TEXT_RANGE_DEFAULT obs_module_text("ColorRange.Default") #define TEXT_RANGE_PARTIAL obs_module_text("ColorRange.Partial") #define TEXT_RANGE_FULL obs_module_text("ColorRange.Full") #define TEXT_DWNS obs_module_text("DeactivateWhenNotShowing") +/* clang-format on */ + enum ResType { ResType_Preferred, - ResType_Custom + ResType_Custom, }; enum class BufferingType : int64_t { Auto, On, - Off + Off, }; void ffmpeg_log(void *bla, int level, const char *msg, va_list args) @@ -112,28 +117,28 @@ struct ffmpeg_decode decode; public: - inline Decoder() {memset(&decode, 0, sizeof(decode));} - inline ~Decoder() {ffmpeg_decode_free(&decode);} + inline Decoder() { memset(&decode, 0, sizeof(decode)); } + inline ~Decoder() { ffmpeg_decode_free(&decode); } - inline operator ffmpeg_decode*() {return &decode;} - inline ffmpeg_decode *operator->() {return &decode;} + inline operator ffmpeg_decode *() { return &decode; } + inline ffmpeg_decode *operator->() { return &decode; } }; class CriticalSection { CRITICAL_SECTION mutex; public: - inline CriticalSection() {InitializeCriticalSection(&mutex);} - inline ~CriticalSection() {DeleteCriticalSection(&mutex);} + inline CriticalSection() { InitializeCriticalSection(&mutex); } + inline ~CriticalSection() { DeleteCriticalSection(&mutex); } - inline operator CRITICAL_SECTION*() {return &mutex;} + inline operator CRITICAL_SECTION *() { return &mutex; } }; class CriticalScope { CriticalSection &mutex; CriticalScope() = delete; - CriticalScope& operator=(CriticalScope &cs) = delete; + CriticalScope &operator=(CriticalScope &cs) = delete; public: inline CriticalScope(CriticalSection &mutex_) : mutex(mutex_) @@ -141,10 +146,7 @@ EnterCriticalSection(mutex); } - inline ~CriticalScope() - { - LeaveCriticalSection(mutex); - } + inline ~CriticalScope() { LeaveCriticalSection(mutex); } }; enum class Action { @@ -163,19 +165,20 @@ struct DShowInput { obs_source_t *source; - Device device; - bool deactivateWhenNotShowing = false; - bool deviceHasAudio = false; - bool deviceHasSeparateAudioFilter = false; - bool flip = false; - bool active = false; + Device device; + bool deactivateWhenNotShowing = false; + bool deviceHasAudio = false; + bool deviceHasSeparateAudioFilter = false; + bool flip = false; + bool active = false; - Decoder audio_decoder; - Decoder video_decoder; + Decoder audio_decoder; + Decoder video_decoder; - VideoConfig videoConfig; - AudioConfig audioConfig; + VideoConfig videoConfig; + AudioConfig audioConfig; + video_range_type range; obs_source_frame2 frame; obs_source_audio audio; @@ -194,7 +197,8 @@ inline void QueueActivate(obs_data_t *settings) { - bool block = obs_data_get_bool(settings, "synchronous_activate"); + bool block = + obs_data_get_bool(settings, "synchronous_activate"); QueueAction(block ? Action::ActivateBlock : Action::Activate); if (block) { obs_data_erase(settings, "synchronous_activate"); @@ -203,8 +207,7 @@ } inline DShowInput(obs_source_t *source_, obs_data_t *settings) - : source (source_), - device (InitGraph::False) + : source(source_), device(InitGraph::False) { memset(&audio, 0, sizeof(audio)); memset(&frame, 0, sizeof(frame)); @@ -220,8 +223,8 @@ if (!activated_event) throw "Failed to create activated_event"; - thread = CreateThread(nullptr, 0, DShowThread, this, 0, - nullptr); + thread = + CreateThread(nullptr, 0, DShowThread, this, 0, nullptr); if (!thread) throw "Failed to create thread"; @@ -250,17 +253,15 @@ WaitForSingleObject(thread, INFINITE); } - void OnEncodedVideoData(enum AVCodecID id, - unsigned char *data, size_t size, long long ts); - void OnEncodedAudioData(enum AVCodecID id, - unsigned char *data, size_t size, long long ts); + void OnEncodedVideoData(enum AVCodecID id, unsigned char *data, + size_t size, long long ts); + void OnEncodedAudioData(enum AVCodecID id, unsigned char *data, + size_t size, long long ts); - void OnVideoData(const VideoConfig &config, - unsigned char *data, size_t size, - long long startTime, long long endTime); - void OnAudioData(const AudioConfig &config, - unsigned char *data, size_t size, - long long startTime, long long endTime); + void OnVideoData(const VideoConfig &config, unsigned char *data, + size_t size, long long startTime, long long endTime); + void OnAudioData(const AudioConfig &config, unsigned char *data, + size_t size, long long startTime, long long endTime); bool UpdateVideoConfig(obs_data_t *settings); bool UpdateAudioConfig(obs_data_t *settings); @@ -277,7 +278,7 @@ static DWORD CALLBACK DShowThread(LPVOID ptr) { - DShowInput *dshowInput = (DShowInput*)ptr; + DShowInput *dshowInput = (DShowInput *)ptr; os_set_thread_name("win-dshow: DShowThread"); @@ -301,7 +302,7 @@ { while (true) { DWORD ret = MsgWaitForMultipleObjects(1, &semaphore, false, - INFINITE, QS_ALLINPUT); + INFINITE, QS_ALLINPUT); if (ret == (WAIT_OBJECT_0 + 1)) { ProcessMessages(); continue; @@ -320,21 +321,19 @@ switch (action) { case Action::Activate: - case Action::ActivateBlock: - { - bool block = action == Action::ActivateBlock; - - obs_data_t *settings; - settings = obs_source_get_settings(source); - if (!Activate(settings)) { - obs_source_output_video2(source, - nullptr); - } - if (block) - SetEvent(activated_event); - obs_data_release(settings); - break; + case Action::ActivateBlock: { + bool block = action == Action::ActivateBlock; + + obs_data_t *settings; + settings = obs_source_get_settings(source); + if (!Activate(settings)) { + obs_source_output_video2(source, nullptr); } + if (block) + SetEvent(activated_event); + obs_data_release(settings); + break; + } case Action::Deactivate: Deactivate(); @@ -365,10 +364,10 @@ } } -#define FPS_HIGHEST 0LL +#define FPS_HIGHEST 0LL #define FPS_MATCHING -1LL -template <typename T, typename U, typename V> +template<typename T, typename U, typename V> static bool between(T &&lower, U &&value, V &&upper) { return value >= lower && value <= upper; @@ -377,7 +376,7 @@ static bool ResolutionAvailable(const VideoInfo &cap, int cx, int cy) { return between(cap.minCX, cx, cap.maxCX) && - between(cap.minCY, cy, cap.maxCY); + between(cap.minCY, cy, cap.maxCY); } #define DEVICE_INTERVAL_DIFF_LIMIT 20 @@ -385,69 +384,97 @@ static bool FrameRateAvailable(const VideoInfo &cap, long long interval) { return interval == FPS_HIGHEST || interval == FPS_MATCHING || - between(cap.minInterval - DEVICE_INTERVAL_DIFF_LIMIT, - interval, - cap.maxInterval + DEVICE_INTERVAL_DIFF_LIMIT); + between(cap.minInterval - DEVICE_INTERVAL_DIFF_LIMIT, interval, + cap.maxInterval + DEVICE_INTERVAL_DIFF_LIMIT); } static long long FrameRateInterval(const VideoInfo &cap, - long long desired_interval) + long long desired_interval) { - return desired_interval < cap.minInterval ? - cap.minInterval : - min(desired_interval, cap.maxInterval); + return desired_interval < cap.minInterval + ? cap.minInterval + : min(desired_interval, cap.maxInterval); } static inline video_format ConvertVideoFormat(VideoFormat format) { switch (format) { - case VideoFormat::ARGB: return VIDEO_FORMAT_BGRA; - case VideoFormat::XRGB: return VIDEO_FORMAT_BGRX; - case VideoFormat::I420: return VIDEO_FORMAT_I420; - case VideoFormat::YV12: return VIDEO_FORMAT_I420; - case VideoFormat::NV12: return VIDEO_FORMAT_NV12; - case VideoFormat::Y800: return VIDEO_FORMAT_Y800; - case VideoFormat::YVYU: return VIDEO_FORMAT_YVYU; - case VideoFormat::YUY2: return VIDEO_FORMAT_YUY2; - case VideoFormat::UYVY: return VIDEO_FORMAT_UYVY; - case VideoFormat::HDYC: return VIDEO_FORMAT_UYVY; - case VideoFormat::MJPEG: return VIDEO_FORMAT_YUY2; - default: return VIDEO_FORMAT_NONE; + case VideoFormat::ARGB: + return VIDEO_FORMAT_BGRA; + case VideoFormat::XRGB: + return VIDEO_FORMAT_BGRX; + case VideoFormat::I420: + return VIDEO_FORMAT_I420; + case VideoFormat::YV12: + return VIDEO_FORMAT_I420; + case VideoFormat::NV12: + return VIDEO_FORMAT_NV12; + case VideoFormat::Y800: + return VIDEO_FORMAT_Y800; + case VideoFormat::YVYU: + return VIDEO_FORMAT_YVYU; + case VideoFormat::YUY2: + return VIDEO_FORMAT_YUY2; + case VideoFormat::UYVY: + return VIDEO_FORMAT_UYVY; + case VideoFormat::HDYC: + return VIDEO_FORMAT_UYVY; + default: + return VIDEO_FORMAT_NONE; } } static inline audio_format ConvertAudioFormat(AudioFormat format) { switch (format) { - case AudioFormat::Wave16bit: return AUDIO_FORMAT_16BIT; - case AudioFormat::WaveFloat: return AUDIO_FORMAT_FLOAT; - default: return AUDIO_FORMAT_UNKNOWN; + case AudioFormat::Wave16bit: + return AUDIO_FORMAT_16BIT; + case AudioFormat::WaveFloat: + return AUDIO_FORMAT_FLOAT; + default: + return AUDIO_FORMAT_UNKNOWN; } } static inline enum speaker_layout convert_speaker_layout(uint8_t channels) { switch (channels) { - case 0: return SPEAKERS_UNKNOWN; - case 1: return SPEAKERS_MONO; - case 2: return SPEAKERS_STEREO; - case 3: return SPEAKERS_2POINT1; - case 4: return SPEAKERS_4POINT0; - case 5: return SPEAKERS_4POINT1; - case 6: return SPEAKERS_5POINT1; - case 8: return SPEAKERS_7POINT1; - default: return SPEAKERS_UNKNOWN; + case 0: + return SPEAKERS_UNKNOWN; + case 1: + return SPEAKERS_MONO; + case 2: + return SPEAKERS_STEREO; + case 3: + return SPEAKERS_2POINT1; + case 4: + return SPEAKERS_4POINT0; + case 5: + return SPEAKERS_4POINT1; + case 6: + return SPEAKERS_5POINT1; + case 8: + return SPEAKERS_7POINT1; + default: + return SPEAKERS_UNKNOWN; } } //#define LOG_ENCODED_VIDEO_TS 1 //#define LOG_ENCODED_AUDIO_TS 1 -void DShowInput::OnEncodedVideoData(enum AVCodecID id, - unsigned char *data, size_t size, long long ts) +#define MAX_SW_RES_INT (1920 * 1080) + +void DShowInput::OnEncodedVideoData(enum AVCodecID id, unsigned char *data, + size_t size, long long ts) { if (!ffmpeg_decode_valid(video_decoder)) { - if (ffmpeg_decode_init(video_decoder, id) < 0) { + /* Only use MJPEG hardware decoding on resolutions higher + * than 1920x1080. The reason why is because we want to strike + * a reasonable balance between hardware and CPU usage. */ + bool useHW = videoConfig.format != VideoFormat::MJPEG || + (videoConfig.cx * videoConfig.cy) > MAX_SW_RES_INT; + if (ffmpeg_decode_init(video_decoder, id, useHW) < 0) { blog(LOG_WARNING, "Could not initialize video decoder"); return; } @@ -455,7 +482,7 @@ bool got_output; bool success = ffmpeg_decode_video(video_decoder, data, size, &ts, - &frame, &got_output); + range, &frame, &got_output); if (!success) { blog(LOG_WARNING, "Error decoding video"); return; @@ -472,38 +499,43 @@ } } -void DShowInput::OnVideoData(const VideoConfig &config, - unsigned char *data, size_t size, - long long startTime, long long endTime) +void DShowInput::OnVideoData(const VideoConfig &config, unsigned char *data, + size_t size, long long startTime, + long long endTime) { if (videoConfig.format == VideoFormat::H264) { OnEncodedVideoData(AV_CODEC_ID_H264, data, size, startTime); return; } + if (videoConfig.format == VideoFormat::MJPEG) { + OnEncodedVideoData(AV_CODEC_ID_MJPEG, data, size, startTime); + return; + } + const int cx = config.cx; const int cy = config.cy; - frame.timestamp = (uint64_t)startTime * 100; - frame.width = config.cx; - frame.height = config.cy; - frame.format = ConvertVideoFormat(config.format); - frame.flip = (config.format == VideoFormat::XRGB || - config.format == VideoFormat::ARGB); + frame.timestamp = (uint64_t)startTime * 100; + frame.width = config.cx; + frame.height = config.cy; + frame.format = ConvertVideoFormat(config.format); + frame.flip = (config.format == VideoFormat::XRGB || + config.format == VideoFormat::ARGB); if (flip) frame.flip = !frame.flip; if (videoConfig.format == VideoFormat::XRGB || videoConfig.format == VideoFormat::ARGB) { - frame.data[0] = data; + frame.data[0] = data; frame.linesize[0] = cx * 4; } else if (videoConfig.format == VideoFormat::YVYU || - videoConfig.format == VideoFormat::YUY2 || - videoConfig.format == VideoFormat::HDYC || - videoConfig.format == VideoFormat::UYVY) { - frame.data[0] = data; + videoConfig.format == VideoFormat::YUY2 || + videoConfig.format == VideoFormat::HDYC || + videoConfig.format == VideoFormat::UYVY) { + frame.data[0] = data; frame.linesize[0] = cx * 2; } else if (videoConfig.format == VideoFormat::I420) { @@ -543,11 +575,11 @@ UNUSED_PARAMETER(size); } -void DShowInput::OnEncodedAudioData(enum AVCodecID id, - unsigned char *data, size_t size, long long ts) +void DShowInput::OnEncodedAudioData(enum AVCodecID id, unsigned char *data, + size_t size, long long ts) { if (!ffmpeg_decode_valid(audio_decoder)) { - if (ffmpeg_decode_init(audio_decoder, id) < 0) { + if (ffmpeg_decode_init(audio_decoder, id, false) < 0) { blog(LOG_WARNING, "Could not initialize audio decoder"); return; } @@ -556,7 +588,7 @@ bool got_output = false; do { bool success = ffmpeg_decode_audio(audio_decoder, data, size, - &audio, &got_output); + &audio, &got_output); if (!success) { blog(LOG_WARNING, "Error decoding audio"); return; @@ -573,15 +605,15 @@ } ts += int64_t(audio_decoder->frame->nb_samples) * 10000000LL / - int64_t(audio_decoder->frame->sample_rate); + int64_t(audio_decoder->frame->sample_rate); size = 0; data = nullptr; } while (got_output); } -void DShowInput::OnAudioData(const AudioConfig &config, - unsigned char *data, size_t size, - long long startTime, long long endTime) +void DShowInput::OnAudioData(const AudioConfig &config, unsigned char *data, + size_t size, long long startTime, + long long endTime) { size_t block_size; @@ -596,16 +628,16 @@ return; } - audio.speakers = convert_speaker_layout((uint8_t)config.channels); - audio.format = ConvertAudioFormat(config.format); + audio.speakers = convert_speaker_layout((uint8_t)config.channels); + audio.format = ConvertAudioFormat(config.format); audio.samples_per_sec = (uint32_t)config.sampleRate; - audio.data[0] = data; + audio.data[0] = data; block_size = get_audio_bytes_per_channel(audio.format) * - get_audio_channels(audio.speakers); + get_audio_channels(audio.speakers); - audio.frames = (uint32_t)(size / block_size); - audio.timestamp = (uint64_t)startTime * 100; + audio.frames = (uint32_t)(size / block_size); + audio.timestamp = (uint64_t)startTime * 100; if (audio.format != AUDIO_FORMAT_UNKNOWN) obs_source_output_audio(source, &audio); @@ -625,7 +657,7 @@ for (const VideoDevice &curDevice : devices) { if (deviceId.name == curDevice.name && - deviceId.path == curDevice.path) { + deviceId.path == curDevice.path) { device = curDevice; return true; } @@ -643,7 +675,7 @@ static inline bool FormatMatches(VideoFormat left, VideoFormat right) { return left == VideoFormat::Any || right == VideoFormat::Any || - left == right; + left == right; } static inline bool ResolutionValid(string res, int &cx, int &cy) @@ -654,33 +686,31 @@ return ConvertRes(cx, cy, res.c_str()); } -static inline bool CapsMatch(const VideoInfo&) +static inline bool CapsMatch(const VideoInfo &) { return true; } -template <typename ... F> -static bool CapsMatch(const VideoDevice &dev, F ... fs); +template<typename... F> static bool CapsMatch(const VideoDevice &dev, F... fs); -template <typename F, typename ... Fs> -static inline bool CapsMatch(const VideoInfo &info, F&& f, Fs ... fs) +template<typename F, typename... Fs> +static inline bool CapsMatch(const VideoInfo &info, F &&f, Fs... fs) { - return f(info) && CapsMatch(info, fs ...); + return f(info) && CapsMatch(info, fs...); } -template <typename ... F> -static bool CapsMatch(const VideoDevice &dev, F ... fs) +template<typename... F> static bool CapsMatch(const VideoDevice &dev, F... fs) { // no early exit, trigger all side effects. bool match = false; for (const VideoInfo &info : dev.caps) - if (CapsMatch(info, fs ...)) + if (CapsMatch(info, fs...)) match = true; return match; } -static inline bool MatcherMatchVideoFormat(VideoFormat format, - bool &did_match, const VideoInfo &info) +static inline bool MatcherMatchVideoFormat(VideoFormat format, bool &did_match, + const VideoInfo &info) { bool match = FormatMatches(format, info.format); did_match = did_match || match; @@ -688,7 +718,8 @@ } static inline bool MatcherClosestFrameRateSelector(long long interval, - long long &best_match, const VideoInfo &info) + long long &best_match, + const VideoInfo &info) { long long current = FrameRateInterval(info, interval); if (llabs(interval - best_match) > llabs(interval - current)) @@ -729,18 +760,23 @@ }; } #else -#define ResolutionMatcher(cx, cy) \ - [cx, cy](const VideoInfo &info) -> bool \ - { return ResolutionAvailable(info, cx, cy); } -#define FrameRateMatcher(interval) \ - [interval](const VideoInfo &info) -> bool \ - { return FrameRateAvailable(info, interval); } -#define VideoFormatMatcher(format, did_match) \ - [format, &did_match](const VideoInfo &info) mutable -> bool \ - { return MatcherMatchVideoFormat(format, did_match, info); } -#define ClosestFrameRateSelector(interval, best_match) \ - [interval, &best_match](const VideoInfo &info) mutable -> bool \ - { return MatcherClosestFrameRateSelector(interval, best_match, info); } +#define ResolutionMatcher(cx, cy) \ + [cx, cy](const VideoInfo &info) -> bool { \ + return ResolutionAvailable(info, cx, cy); \ + } +#define FrameRateMatcher(interval) \ + [interval](const VideoInfo &info) -> bool { \ + return FrameRateAvailable(info, interval); \ + } +#define VideoFormatMatcher(format, did_match) \ + [format, &did_match](const VideoInfo &info) mutable -> bool { \ + return MatcherMatchVideoFormat(format, did_match, info); \ + } +#define ClosestFrameRateSelector(interval, best_match) \ + [interval, &best_match](const VideoInfo &info) mutable -> bool { \ + return MatcherClosestFrameRateSelector(interval, best_match, \ + info); \ + } #endif static bool ResolutionAvailable(const VideoDevice &dev, int cx, int cy) @@ -749,12 +785,11 @@ } static bool DetermineResolution(int &cx, int &cy, obs_data_t *settings, - VideoDevice dev) + VideoDevice dev) { const char *res = obs_data_get_autoselect_string(settings, RESOLUTION); if (obs_data_has_autoselect_value(settings, RESOLUTION) && - ConvertRes(cx, cy, res) && - ResolutionAvailable(dev, cx, cy)) + ConvertRes(cx, cy, res) && ResolutionAvailable(dev, cx, cy)) return true; res = obs_data_get_string(settings, RESOLUTION); @@ -770,11 +805,16 @@ static long long GetOBSFPS(); -static inline bool IsEncoded(const VideoConfig &config) +static inline bool IsDelayedDevice(const VideoConfig &config) +{ + return config.format > VideoFormat::MJPEG || + wstrstri(config.name.c_str(), L"elgato") != NULL || + wstrstri(config.name.c_str(), L"stream engine") != NULL; +} + +static inline bool IsDecoupled(const VideoConfig &config) { - return config.format >= VideoFormat::MJPEG || - wstrstri(config.name.c_str(), L"elgato") != NULL || - wstrstri(config.name.c_str(), L"stream engine") != NULL; + return wstrstri(config.name.c_str(), L"GV-USB2") != NULL; } inline void DShowInput::SetupBuffering(obs_data_t *settings) @@ -785,11 +825,12 @@ bufType = (BufferingType)obs_data_get_int(settings, BUFFERING_VAL); if (bufType == BufferingType::Auto) - useBuffering = IsEncoded(videoConfig); + useBuffering = IsDelayedDevice(videoConfig); else useBuffering = bufType == BufferingType::On; obs_source_set_async_unbuffered(source, !useBuffering); + obs_source_set_async_decoupled(source, IsDecoupled(videoConfig)); } static DStr GetVideoFormatName(VideoFormat format); @@ -803,7 +844,7 @@ DeviceId id; if (!DecodeDeviceId(id, video_device_id.c_str())) { blog(LOG_WARNING, "%s: DecodeDeviceId failed", - obs_source_get_name(source)); + obs_source_get_name(source)); return false; } @@ -812,7 +853,7 @@ VideoDevice dev; if (!data.GetDevice(dev, video_device_id.c_str())) { blog(LOG_WARNING, "%s: data.GetDevice failed", - obs_source_get_name(source)); + obs_source_get_name(source)); return false; } @@ -826,15 +867,16 @@ string resolution = obs_data_get_string(settings, RESOLUTION); if (!ResolutionValid(resolution, cx, cy)) { blog(LOG_WARNING, "%s: ResolutionValid failed", - obs_source_get_name(source)); + obs_source_get_name(source)); return false; } - has_autosel_val = obs_data_has_autoselect_value(settings, - FRAME_INTERVAL); - interval = has_autosel_val ? - obs_data_get_autoselect_int(settings, FRAME_INTERVAL) : - obs_data_get_int(settings, FRAME_INTERVAL); + has_autosel_val = + obs_data_has_autoselect_value(settings, FRAME_INTERVAL); + interval = has_autosel_val + ? obs_data_get_autoselect_int(settings, + FRAME_INTERVAL) + : obs_data_get_int(settings, FRAME_INTERVAL); if (interval == FPS_MATCHING) interval = GetOBSFPS(); @@ -843,56 +885,45 @@ long long best_interval = numeric_limits<long long>::max(); bool video_format_match = false; - bool caps_match = CapsMatch(dev, ResolutionMatcher(cx, cy), - VideoFormatMatcher(format, video_format_match), - ClosestFrameRateSelector(interval, best_interval), - FrameRateMatcher(interval)); + bool caps_match = CapsMatch( + dev, ResolutionMatcher(cx, cy), + VideoFormatMatcher(format, video_format_match), + ClosestFrameRateSelector(interval, best_interval), + FrameRateMatcher(interval)); if (!caps_match && !video_format_match) { blog(LOG_WARNING, "%s: Video format match failed", - obs_source_get_name(source)); + obs_source_get_name(source)); return false; } interval = best_interval; } - videoConfig.name = id.name.c_str(); - videoConfig.path = id.path.c_str(); + videoConfig.name = id.name.c_str(); + videoConfig.path = id.path.c_str(); videoConfig.useDefaultConfig = resType == ResType_Preferred; - videoConfig.cx = cx; - videoConfig.cy = cy; - videoConfig.frameInterval = interval; - videoConfig.internalFormat = format; + videoConfig.cx = cx; + videoConfig.cy = cy; + videoConfig.frameInterval = interval; + videoConfig.internalFormat = format; deviceHasAudio = dev.audioAttached; deviceHasSeparateAudioFilter = dev.separateAudioFilter; videoConfig.callback = std::bind(&DShowInput::OnVideoData, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4, - placeholders::_5); + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4, + placeholders::_5); - if (videoConfig.internalFormat != VideoFormat::MJPEG) - videoConfig.format = videoConfig.internalFormat; + videoConfig.format = videoConfig.internalFormat; if (!device.SetVideoConfig(&videoConfig)) { blog(LOG_WARNING, "%s: device.SetVideoConfig failed", - obs_source_get_name(source)); + obs_source_get_name(source)); return false; } - if (videoConfig.internalFormat == VideoFormat::MJPEG) { - videoConfig.format = VideoFormat::XRGB; - videoConfig.useDefaultConfig = false; - - if (!device.SetVideoConfig(&videoConfig)) { - blog(LOG_WARNING, "%s: device.SetVideoConfig (XRGB) " - "failed", obs_source_get_name(source)); - return false; - } - } - DStr formatName = GetVideoFormatName(videoConfig.internalFormat); double fps = 0.0; @@ -903,23 +934,21 @@ BPtr<char> name_utf8; BPtr<char> path_utf8; os_wcs_to_utf8_ptr(videoConfig.name.c_str(), videoConfig.name.size(), - &name_utf8); + &name_utf8); os_wcs_to_utf8_ptr(videoConfig.path.c_str(), videoConfig.path.size(), - &path_utf8); + &path_utf8); blog(LOG_INFO, "---------------------------------"); - blog(LOG_INFO, "[DShow Device: '%s'] settings updated: \n" - "\tvideo device: %s\n" - "\tvideo path: %s\n" - "\tresolution: %dx%d\n" - "\tfps: %0.2f (interval: %lld)\n" - "\tformat: %s", - obs_source_get_name(source), - (const char*)name_utf8, - (const char*)path_utf8, - videoConfig.cx, videoConfig.cy, - fps, videoConfig.frameInterval, - formatName->array); + blog(LOG_INFO, + "[DShow Device: '%s'] settings updated: \n" + "\tvideo device: %s\n" + "\tvideo path: %s\n" + "\tresolution: %dx%d\n" + "\tfps: %0.2f (interval: %lld)\n" + "\tformat: %s", + obs_source_get_name(source), (const char *)name_utf8, + (const char *)path_utf8, videoConfig.cx, videoConfig.cy, fps, + videoConfig.frameInterval, formatName->array); SetupBuffering(settings); @@ -929,7 +958,7 @@ bool DShowInput::UpdateAudioConfig(obs_data_t *settings) { string audio_device_id = obs_data_get_string(settings, AUDIO_DEVICE_ID); - bool useCustomAudio = obs_data_get_bool(settings, USE_CUSTOM_AUDIO); + bool useCustomAudio = obs_data_get_bool(settings, USE_CUSTOM_AUDIO); if (useCustomAudio) { DeviceId id; @@ -943,13 +972,14 @@ return true; } - audioConfig.useVideoDevice = !useCustomAudio && !deviceHasSeparateAudioFilter; + audioConfig.useVideoDevice = !useCustomAudio && + !deviceHasSeparateAudioFilter; audioConfig.useSeparateAudioFilter = deviceHasSeparateAudioFilter; audioConfig.callback = std::bind(&DShowInput::OnAudioData, this, - placeholders::_1, placeholders::_2, - placeholders::_3, placeholders::_4, - placeholders::_5); + placeholders::_1, placeholders::_2, + placeholders::_3, placeholders::_4, + placeholders::_5); audioConfig.mode = (AudioMode)obs_data_get_int(settings, AUDIO_OUTPUT_MODE); @@ -960,32 +990,38 @@ BPtr<char> name_utf8; os_wcs_to_utf8_ptr(audioConfig.name.c_str(), audioConfig.name.size(), - &name_utf8); + &name_utf8); blog(LOG_INFO, "\tusing video device audio: %s", - audioConfig.useVideoDevice ? "yes" : "no"); + audioConfig.useVideoDevice ? "yes" : "no"); if (!audioConfig.useVideoDevice) { if (audioConfig.useSeparateAudioFilter) blog(LOG_INFO, "\tseparate audio filter"); else - blog(LOG_INFO, "\taudio device: %s", (const char*)name_utf8); + blog(LOG_INFO, "\taudio device: %s", + (const char *)name_utf8); } const char *mode = ""; switch (audioConfig.mode) { - case AudioMode::Capture: mode = "Capture"; break; - case AudioMode::DirectSound: mode = "DirectSound"; break; - case AudioMode::WaveOut: mode = "WaveOut"; break; + case AudioMode::Capture: + mode = "Capture"; + break; + case AudioMode::DirectSound: + mode = "DirectSound"; + break; + case AudioMode::WaveOut: + mode = "WaveOut"; + break; } - blog(LOG_INFO, "\tsample rate: %d\n" - "\tchannels: %d\n" - "\taudio type: %s", - audioConfig.sampleRate, - audioConfig.channels, - mode); + blog(LOG_INFO, + "\tsample rate: %d\n" + "\tchannels: %d\n" + "\taudio type: %s", + audioConfig.sampleRate, audioConfig.channels, mode); return true; } @@ -998,8 +1034,8 @@ obs_data_release(settings); } -inline enum video_colorspace DShowInput::GetColorSpace( - obs_data_t *settings) const +inline enum video_colorspace +DShowInput::GetColorSpace(obs_data_t *settings) const { const char *space = obs_data_get_string(settings, COLOR_SPACE); @@ -1008,17 +1044,20 @@ else if (astrcmpi(space, "601") == 0) return VIDEO_CS_601; else - return (videoConfig.format == VideoFormat::HDYC) ? - VIDEO_CS_709 : VIDEO_CS_601; + return (videoConfig.format == VideoFormat::HDYC) ? VIDEO_CS_709 + : VIDEO_CS_601; } -inline enum video_range_type DShowInput::GetColorRange( - obs_data_t *settings) const +inline enum video_range_type +DShowInput::GetColorRange(obs_data_t *settings) const { const char *range = obs_data_get_string(settings, COLOR_RANGE); - return astrcmpi(range, "full") == 0 ? - VIDEO_RANGE_FULL : VIDEO_RANGE_PARTIAL; + if (astrcmpi(range, "full") == 0) + return VIDEO_RANGE_FULL; + if (astrcmpi(range, "partial") == 0) + return VIDEO_RANGE_PARTIAL; + return VIDEO_RANGE_DEFAULT; } inline bool DShowInput::Activate(obs_data_t *settings) @@ -1028,31 +1067,35 @@ if (!UpdateVideoConfig(settings)) { blog(LOG_WARNING, "%s: Video configuration failed", - obs_source_get_name(source)); + obs_source_get_name(source)); return false; } if (!UpdateAudioConfig(settings)) - blog(LOG_WARNING, "%s: Audio configuration failed, ignoring " - "audio", obs_source_get_name(source)); + blog(LOG_WARNING, + "%s: Audio configuration failed, ignoring " + "audio", + obs_source_get_name(source)); if (!device.ConnectFilters()) return false; - enum video_colorspace cs = GetColorSpace(settings); - frame.range = GetColorRange(settings); - if (device.Start() != Result::Success) return false; - bool success = video_format_get_parameters( - cs, frame.range, - frame.color_matrix, - frame.color_range_min, - frame.color_range_max); + enum video_colorspace cs = GetColorSpace(settings); + range = GetColorRange(settings); + frame.range = range; + + bool success = video_format_get_parameters(cs, range, + frame.color_matrix, + frame.color_range_min, + frame.color_range_max); if (!success) { - blog(LOG_ERROR, "Failed to get video format parameters for " \ - "video format %u", cs); + blog(LOG_ERROR, + "Failed to get video format parameters for " + "video format %u", + cs); } return true; @@ -1066,7 +1109,7 @@ /* ------------------------------------------------------------------------- */ -static const char *GetDShowInputName(void*) +static const char *GetDShowInputName(void *) { return TEXT_INPUT_NAME; } @@ -1079,7 +1122,7 @@ dshow = new DShowInput(source, settings); } catch (const char *error) { blog(LOG_ERROR, "Could not create device '%s': %s", - obs_source_get_name(source), error); + obs_source_get_name(source), error); } return dshow; @@ -1087,12 +1130,12 @@ static void DestroyDShowInput(void *data) { - delete reinterpret_cast<DShowInput*>(data); + delete reinterpret_cast<DShowInput *>(data); } static void UpdateDShowInput(void *data, obs_data_t *settings) { - DShowInput *input = reinterpret_cast<DShowInput*>(data); + DShowInput *input = reinterpret_cast<DShowInput *>(data); if (input->active) input->QueueActivate(settings); } @@ -1104,9 +1147,9 @@ obs_data_set_default_int(settings, VIDEO_FORMAT, (int)VideoFormat::Any); obs_data_set_default_bool(settings, "active", true); obs_data_set_default_string(settings, COLOR_SPACE, "default"); - obs_data_set_default_string(settings, COLOR_RANGE, "partial"); + obs_data_set_default_string(settings, COLOR_RANGE, "default"); obs_data_set_default_int(settings, AUDIO_OUTPUT_MODE, - (int)AudioMode::Capture); + (int)AudioMode::Capture); } struct Resolution { @@ -1117,8 +1160,8 @@ static void InsertResolution(vector<Resolution> &resolutions, int cx, int cy) { - int bestCY = 0; - size_t idx = 0; + int bestCY = 0; + size_t idx = 0; for (; idx < resolutions.size(); idx++) { const Resolution &res = resolutions[idx]; @@ -1145,8 +1188,8 @@ InsertResolution(resolutions, cap.maxCX, cap.maxCY); } -#define MAKE_DSHOW_FPS(fps) (10000000LL/(fps)) -#define MAKE_DSHOW_FRACTIONAL_FPS(den, num) ((num)*10000000LL/(den)) +#define MAKE_DSHOW_FPS(fps) (10000000LL / (fps)) +#define MAKE_DSHOW_FRACTIONAL_FPS(den, num) ((num)*10000000LL / (den)) static long long GetOBSFPS() { @@ -1159,31 +1202,31 @@ struct FPSFormat { const char *text; - long long interval; + long long interval; }; static const FPSFormat validFPSFormats[] = { - {"60", MAKE_DSHOW_FPS(60)}, + {"60", MAKE_DSHOW_FPS(60)}, {"59.94 NTSC", MAKE_DSHOW_FRACTIONAL_FPS(60000, 1001)}, - {"50", MAKE_DSHOW_FPS(50)}, - {"48 film", MAKE_DSHOW_FRACTIONAL_FPS(48000, 1001)}, - {"40", MAKE_DSHOW_FPS(40)}, - {"30", MAKE_DSHOW_FPS(30)}, + {"50", MAKE_DSHOW_FPS(50)}, + {"48 film", MAKE_DSHOW_FRACTIONAL_FPS(48000, 1001)}, + {"40", MAKE_DSHOW_FPS(40)}, + {"30", MAKE_DSHOW_FPS(30)}, {"29.97 NTSC", MAKE_DSHOW_FRACTIONAL_FPS(30000, 1001)}, - {"25", MAKE_DSHOW_FPS(25)}, - {"24 film", MAKE_DSHOW_FRACTIONAL_FPS(24000, 1001)}, - {"20", MAKE_DSHOW_FPS(20)}, - {"15", MAKE_DSHOW_FPS(15)}, - {"10", MAKE_DSHOW_FPS(10)}, - {"5", MAKE_DSHOW_FPS(5)}, - {"4", MAKE_DSHOW_FPS(4)}, - {"3", MAKE_DSHOW_FPS(3)}, - {"2", MAKE_DSHOW_FPS(2)}, - {"1", MAKE_DSHOW_FPS(1)}, + {"25", MAKE_DSHOW_FPS(25)}, + {"24 film", MAKE_DSHOW_FRACTIONAL_FPS(24000, 1001)}, + {"20", MAKE_DSHOW_FPS(20)}, + {"15", MAKE_DSHOW_FPS(15)}, + {"10", MAKE_DSHOW_FPS(10)}, + {"5", MAKE_DSHOW_FPS(5)}, + {"4", MAKE_DSHOW_FPS(4)}, + {"3", MAKE_DSHOW_FPS(3)}, + {"2", MAKE_DSHOW_FPS(2)}, + {"1", MAKE_DSHOW_FPS(1)}, }; static bool DeviceIntervalChanged(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings); + obs_data_t *settings); static bool TryResolution(VideoDevice &dev, string res) { @@ -1195,16 +1238,16 @@ } static bool SetResolution(obs_properties_t *props, obs_data_t *settings, - string res, bool autoselect=false) + string res, bool autoselect = false) { if (autoselect) obs_data_set_autoselect_string(settings, RESOLUTION, - res.c_str()); + res.c_str()); else obs_data_unset_autoselect_value(settings, RESOLUTION); DeviceIntervalChanged(props, obs_properties_get(props, FRAME_INTERVAL), - settings); + settings); if (!autoselect) obs_data_set_string(settings, LAST_RESOLUTION, res.c_str()); @@ -1212,15 +1255,16 @@ } static bool DeviceResolutionChanged(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { UNUSED_PARAMETER(p); - PropertiesData *data = (PropertiesData*)obs_properties_get_param(props); + PropertiesData *data = + (PropertiesData *)obs_properties_get_param(props); const char *id; VideoDevice device; - id = obs_data_get_string(settings, VIDEO_DEVICE_ID); + id = obs_data_get_string(settings, VIDEO_DEVICE_ID); string res = obs_data_get_string(settings, RESOLUTION); string last_res = obs_data_get_string(settings, LAST_RESOLUTION); @@ -1238,36 +1282,35 @@ struct VideoFormatName { VideoFormat format; - const char *name; + const char *name; }; static const VideoFormatName videoFormatNames[] = { /* autoselect format*/ - {VideoFormat::Any, "VideoFormat.Any"}, + {VideoFormat::Any, "VideoFormat.Any"}, /* raw formats */ - {VideoFormat::ARGB, "ARGB"}, - {VideoFormat::XRGB, "XRGB"}, + {VideoFormat::ARGB, "ARGB"}, + {VideoFormat::XRGB, "XRGB"}, /* planar YUV formats */ - {VideoFormat::I420, "I420"}, - {VideoFormat::NV12, "NV12"}, - {VideoFormat::YV12, "YV12"}, - {VideoFormat::Y800, "Y800"}, + {VideoFormat::I420, "I420"}, + {VideoFormat::NV12, "NV12"}, + {VideoFormat::YV12, "YV12"}, + {VideoFormat::Y800, "Y800"}, /* packed YUV formats */ - {VideoFormat::YVYU, "YVYU"}, - {VideoFormat::YUY2, "YUY2"}, - {VideoFormat::UYVY, "UYVY"}, - {VideoFormat::HDYC, "HDYC"}, + {VideoFormat::YVYU, "YVYU"}, + {VideoFormat::YUY2, "YUY2"}, + {VideoFormat::UYVY, "UYVY"}, + {VideoFormat::HDYC, "HDYC"}, /* encoded formats */ {VideoFormat::MJPEG, "MJPEG"}, - {VideoFormat::H264, "H264"} -}; + {VideoFormat::H264, "H264"}}; static bool ResTypeChanged(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings); + obs_data_t *settings); static size_t AddDevice(obs_property_t *device_list, const string &id) { @@ -1314,12 +1357,13 @@ } static bool DeviceSelectionChanged(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { - PropertiesData *data = (PropertiesData*)obs_properties_get_param(props); + PropertiesData *data = + (PropertiesData *)obs_properties_get_param(props); VideoDevice device; - string id = obs_data_get_string(settings, VIDEO_DEVICE_ID); + string id = obs_data_get_string(settings, VIDEO_DEVICE_ID); string old_id = obs_data_get_string(settings, LAST_VIDEO_DEV_ID); bool device_list_updated = UpdateDeviceList(p, id); @@ -1335,7 +1379,7 @@ obs_property_list_clear(p); for (size_t idx = resolutions.size(); idx > 0; idx--) { - const Resolution &res = resolutions[idx-1]; + const Resolution &res = resolutions[idx - 1]; string strRes; strRes += to_string(res.cx); @@ -1356,9 +1400,9 @@ } static bool VideoConfigClicked(obs_properties_t *props, obs_property_t *p, - void *data) + void *data) { - DShowInput *input = reinterpret_cast<DShowInput*>(data); + DShowInput *input = reinterpret_cast<DShowInput *>(data); input->QueueAction(Action::ConfigVideo); UNUSED_PARAMETER(props); @@ -1378,9 +1422,9 @@ }*/ static bool CrossbarConfigClicked(obs_properties_t *props, obs_property_t *p, - void *data) + void *data) { - DShowInput *input = reinterpret_cast<DShowInput*>(data); + DShowInput *input = reinterpret_cast<DShowInput *>(data); input->QueueAction(Action::ConfigCrossbar1); UNUSED_PARAMETER(props); @@ -1419,7 +1463,7 @@ } static bool AddAudioDevice(obs_property_t *device_list, - const AudioDevice &device) + const AudioDevice &device) { DStr name, path, device_id; @@ -1440,13 +1484,13 @@ static void PropertiesDataDestroy(void *data) { - delete reinterpret_cast<PropertiesData*>(data); + delete reinterpret_cast<PropertiesData *>(data); } static bool ResTypeChanged(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { - int val = (int)obs_data_get_int(settings, RES_TYPE); + int val = (int)obs_data_get_int(settings, RES_TYPE); bool enabled = (val != ResType_Preferred); p = obs_properties_get(props, RESOLUTION); @@ -1495,25 +1539,26 @@ } static void UpdateFPS(VideoDevice &device, VideoFormat format, - long long interval, int cx, int cy, obs_properties_t *props) + long long interval, int cx, int cy, + obs_properties_t *props) { obs_property_t *list = obs_properties_get(props, FRAME_INTERVAL); obs_property_list_clear(list); obs_property_list_add_int(list, TEXT_FPS_MATCHING, FPS_MATCHING); - obs_property_list_add_int(list, TEXT_FPS_HIGHEST, FPS_HIGHEST); + obs_property_list_add_int(list, TEXT_FPS_HIGHEST, FPS_HIGHEST); bool interval_added = interval == FPS_HIGHEST || - interval == FPS_MATCHING; + interval == FPS_MATCHING; for (const FPSFormat &fps_format : validFPSFormats) { bool video_format_match = false; long long format_interval = fps_format.interval; - bool available = CapsMatch(device, - ResolutionMatcher(cx, cy), - VideoFormatMatcher(format, video_format_match), - FrameRateMatcher(format_interval)); + bool available = CapsMatch( + device, ResolutionMatcher(cx, cy), + VideoFormatMatcher(format, video_format_match), + FrameRateMatcher(format_interval)); if (!available && interval != fps_format.interval) continue; @@ -1522,15 +1567,15 @@ interval_added = true; size_t idx = obs_property_list_add_int(list, fps_format.text, - fps_format.interval); + fps_format.interval); obs_property_list_item_disable(list, idx, !available); } if (interval_added) return; - size_t idx = obs_property_list_add_int(list, GetFPSName(interval), - interval); + size_t idx = + obs_property_list_add_int(list, GetFPSName(interval), interval); obs_property_list_item_disable(list, idx, true); } @@ -1549,20 +1594,19 @@ return name; } -static void UpdateVideoFormats(VideoDevice &device, VideoFormat format_, - int cx, int cy, long long interval, obs_properties_t *props) +static void UpdateVideoFormats(VideoDevice &device, VideoFormat format_, int cx, + int cy, long long interval, + obs_properties_t *props) { - set<VideoFormat> formats = { VideoFormat::Any }; - auto format_gatherer = [&formats](const VideoInfo &info) mutable -> bool - { + set<VideoFormat> formats = {VideoFormat::Any}; + auto format_gatherer = + [&formats](const VideoInfo &info) mutable -> bool { formats.insert(info.format); return false; }; - CapsMatch(device, - ResolutionMatcher(cx, cy), - FrameRateMatcher(interval), - format_gatherer); + CapsMatch(device, ResolutionMatcher(cx, cy), FrameRateMatcher(interval), + format_gatherer); obs_property_t *list = obs_properties_get(props, VIDEO_FORMAT); obs_property_list_clear(list); @@ -1577,17 +1621,17 @@ if (format.format == format_) format_added = true; - size_t idx = obs_property_list_add_int(list, - obs_module_text(format.name), - (long long)format.format); + size_t idx = obs_property_list_add_int( + list, obs_module_text(format.name), + (long long)format.format); obs_property_list_item_disable(list, idx, !available); } if (format_added) return; - size_t idx = obs_property_list_add_int(list, - GetVideoFormatName(format_), (long long)format_); + size_t idx = obs_property_list_add_int( + list, GetVideoFormatName(format_), (long long)format_); obs_property_list_item_disable(list, idx, true); } @@ -1620,11 +1664,12 @@ } static bool DeviceIntervalChanged(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { long long val = obs_data_get_int(settings, FRAME_INTERVAL); - PropertiesData *data = (PropertiesData*)obs_properties_get_param(props); + PropertiesData *data = + (PropertiesData *)obs_properties_get_param(props); const char *id = obs_data_get_string(settings, VIDEO_DEVICE_ID); VideoDevice device; @@ -1645,20 +1690,19 @@ if (val == FPS_MATCHING) val = GetOBSFPS(); - VideoFormat format = (VideoFormat)obs_data_get_int(settings, - VIDEO_FORMAT); + VideoFormat format = + (VideoFormat)obs_data_get_int(settings, VIDEO_FORMAT); bool video_format_matches = false; long long best_interval = numeric_limits<long long>::max(); - bool frameRateSupported = CapsMatch(device, - ResolutionMatcher(cx, cy), - VideoFormatMatcher(format, video_format_matches), - ClosestFrameRateSelector(val, best_interval), - FrameRateMatcher(val)); - - if (video_format_matches && - !frameRateSupported && - best_interval != val) { + bool frameRateSupported = + CapsMatch(device, ResolutionMatcher(cx, cy), + VideoFormatMatcher(format, video_format_matches), + ClosestFrameRateSelector(val, best_interval), + FrameRateMatcher(val)); + + if (video_format_matches && !frameRateSupported && + best_interval != val) { long long listed_val = 0; for (const FPSFormat &format : validFPSFormats) { long long diff = llabs(format.interval - best_interval); @@ -1670,7 +1714,7 @@ if (listed_val != val) { obs_data_set_autoselect_int(settings, FRAME_INTERVAL, - listed_val); + listed_val); val = listed_val; } @@ -1713,9 +1757,10 @@ } static bool VideoFormatChanged(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { - PropertiesData *data = (PropertiesData*)obs_properties_get_param(props); + PropertiesData *data = + (PropertiesData *)obs_properties_get_param(props); const char *id = obs_data_get_string(settings, VIDEO_DEVICE_ID); VideoDevice device; @@ -1740,7 +1785,7 @@ } static bool CustomAudioClicked(obs_properties_t *props, obs_property_t *p, - obs_data_t *settings) + obs_data_t *settings) { bool useCustomAudio = obs_data_get_bool(settings, USE_CUSTOM_AUDIO); p = obs_properties_get(props, AUDIO_DEVICE_ID); @@ -1748,10 +1793,9 @@ return true; } -static bool ActivateClicked(obs_properties_t *, obs_property_t *p, - void *data) +static bool ActivateClicked(obs_properties_t *, obs_property_t *p, void *data) { - DShowInput *input = reinterpret_cast<DShowInput*>(data); + DShowInput *input = reinterpret_cast<DShowInput *>(data); if (input->active) { input->SetActive(false); @@ -1766,7 +1810,7 @@ static obs_properties_t *GetDShowProperties(void *obj) { - DShowInput *input = reinterpret_cast<DShowInput*>(obj); + DShowInput *input = reinterpret_cast<DShowInput *>(obj); obs_properties_t *ppts = obs_properties_create(); PropertiesData *data = new PropertiesData; @@ -1774,9 +1818,10 @@ obs_properties_set_param(ppts, data, PropertiesDataDestroy); - obs_property_t *p = obs_properties_add_list(ppts, - VIDEO_DEVICE_ID, TEXT_DEVICE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_property_t *p = obs_properties_add_list(ppts, VIDEO_DEVICE_ID, + TEXT_DEVICE, + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_set_modified_callback(p, DeviceSelectionChanged); @@ -1791,11 +1836,11 @@ } obs_properties_add_button(ppts, "activate", activateText, - ActivateClicked); + ActivateClicked); obs_properties_add_button(ppts, "video_config", TEXT_CONFIG_VIDEO, - VideoConfigClicked); + VideoConfigClicked); obs_properties_add_button(ppts, "xbar_config", TEXT_CONFIG_XBAR, - CrossbarConfigClicked); + CrossbarConfigClicked); obs_properties_add_bool(ppts, DEACTIVATE_WNS, TEXT_DWNS); @@ -1803,7 +1848,7 @@ /* video settings */ p = obs_properties_add_list(ppts, RES_TYPE, TEXT_RES_FPS_TYPE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_set_modified_callback(p, ResTypeChanged); @@ -1811,42 +1856,46 @@ obs_property_list_add_int(p, TEXT_CUSTOM_RES, ResType_Custom); p = obs_properties_add_list(ppts, RESOLUTION, TEXT_RESOLUTION, - OBS_COMBO_TYPE_EDITABLE, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_EDITABLE, + OBS_COMBO_FORMAT_STRING); obs_property_set_modified_callback(p, DeviceResolutionChanged); p = obs_properties_add_list(ppts, FRAME_INTERVAL, "FPS", - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_set_modified_callback(p, DeviceIntervalChanged); p = obs_properties_add_list(ppts, VIDEO_FORMAT, TEXT_VIDEO_FORMAT, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_set_modified_callback(p, VideoFormatChanged); p = obs_properties_add_list(ppts, COLOR_SPACE, TEXT_COLOR_SPACE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); obs_property_list_add_string(p, TEXT_COLOR_DEFAULT, "default"); obs_property_list_add_string(p, "709", "709"); obs_property_list_add_string(p, "601", "601"); p = obs_properties_add_list(ppts, COLOR_RANGE, TEXT_COLOR_RANGE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); + obs_property_list_add_string(p, TEXT_RANGE_DEFAULT, "default"); obs_property_list_add_string(p, TEXT_RANGE_PARTIAL, "partial"); obs_property_list_add_string(p, TEXT_RANGE_FULL, "full"); p = obs_properties_add_list(ppts, BUFFERING_VAL, TEXT_BUFFERING, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_list_add_int(p, TEXT_BUFFERING_AUTO, - (int64_t)BufferingType::Auto); + (int64_t)BufferingType::Auto); obs_property_list_add_int(p, TEXT_BUFFERING_ON, - (int64_t)BufferingType::On); + (int64_t)BufferingType::On); obs_property_list_add_int(p, TEXT_BUFFERING_OFF, - (int64_t)BufferingType::Off); + (int64_t)BufferingType::Off); obs_property_set_long_description(p, - obs_module_text("Buffering.ToolTip")); + obs_module_text("Buffering.ToolTip")); obs_properties_add_bool(ppts, FLIP_IMAGE, TEXT_FLIP_IMAGE); @@ -1856,13 +1905,13 @@ Device::EnumAudioDevices(data->audioDevices); p = obs_properties_add_list(ppts, AUDIO_OUTPUT_MODE, TEXT_AUDIO_MODE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); obs_property_list_add_int(p, TEXT_MODE_CAPTURE, - (int64_t)AudioMode::Capture); + (int64_t)AudioMode::Capture); obs_property_list_add_int(p, TEXT_MODE_DSOUND, - (int64_t)AudioMode::DirectSound); + (int64_t)AudioMode::DirectSound); obs_property_list_add_int(p, TEXT_MODE_WAVEOUT, - (int64_t)AudioMode::WaveOut); + (int64_t)AudioMode::WaveOut); if (!data->audioDevices.size()) return ppts; @@ -1872,7 +1921,8 @@ obs_property_set_modified_callback(p, CustomAudioClicked); p = obs_properties_add_list(ppts, AUDIO_DEVICE_ID, TEXT_AUDIO_DEVICE, - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + OBS_COMBO_TYPE_LIST, + OBS_COMBO_FORMAT_STRING); for (const AudioDevice &device : data->audioDevices) AddAudioDevice(p, device); @@ -1885,10 +1935,18 @@ int obs_type = LOG_DEBUG; switch (type) { - case LogType::Error: obs_type = LOG_ERROR; break; - case LogType::Warning: obs_type = LOG_WARNING; break; - case LogType::Info: obs_type = LOG_INFO; break; - case LogType::Debug: obs_type = LOG_DEBUG; break; + case LogType::Error: + obs_type = LOG_ERROR; + break; + case LogType::Warning: + obs_type = LOG_WARNING; + break; + case LogType::Info: + obs_type = LOG_INFO; + break; + case LogType::Debug: + obs_type = LOG_DEBUG; + break; } DStr dmsg; @@ -1901,7 +1959,7 @@ static void HideDShowInput(void *data) { - DShowInput *input = reinterpret_cast<DShowInput*>(data); + DShowInput *input = reinterpret_cast<DShowInput *>(data); if (input->deactivateWhenNotShowing && input->active) input->QueueAction(Action::Deactivate); @@ -1909,7 +1967,7 @@ static void ShowDShowInput(void *data) { - DShowInput *input = reinterpret_cast<DShowInput*>(data); + DShowInput *input = reinterpret_cast<DShowInput *>(data); if (input->deactivateWhenNotShowing && input->active) input->QueueAction(Action::Activate); @@ -1920,19 +1978,17 @@ SetLogCallback(DShowModuleLogCallback, nullptr); obs_source_info info = {}; - info.id = "dshow_input"; - info.type = OBS_SOURCE_TYPE_INPUT; - info.output_flags = OBS_SOURCE_VIDEO | - OBS_SOURCE_AUDIO | - OBS_SOURCE_ASYNC | - OBS_SOURCE_DO_NOT_DUPLICATE; - info.show = ShowDShowInput; - info.hide = HideDShowInput; - info.get_name = GetDShowInputName; - info.create = CreateDShowInput; - info.destroy = DestroyDShowInput; - info.update = UpdateDShowInput; - info.get_defaults = GetDShowDefaults; - info.get_properties = GetDShowProperties; + info.id = "dshow_input"; + info.type = OBS_SOURCE_TYPE_INPUT; + info.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_AUDIO | + OBS_SOURCE_ASYNC | OBS_SOURCE_DO_NOT_DUPLICATE; + info.show = ShowDShowInput; + info.hide = HideDShowInput; + info.get_name = GetDShowInputName; + info.create = CreateDShowInput; + info.destroy = DestroyDShowInput; + info.update = UpdateDShowInput; + info.get_defaults = GetDShowDefaults; + info.get_properties = GetDShowProperties; obs_register_source(&info); }
View file
obs-studio-24.0.0.tar.xz/plugins/win-ivcam/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-24.0.0.tar.xz/plugins/win-mf/.clang-format
Added
@@ -0,0 +1,3 @@ +Language: Cpp +SortIncludes: false +DisableFormat: true
View file
obs-studio-23.2.1.tar.xz/plugins/win-mf/data/locale/ar-SA.ini -> obs-studio-24.0.0.tar.xz/plugins/win-mf/data/locale/ar-SA.ini
Changed
@@ -1,10 +1,23 @@ Bitrate="معدّل البِت" MF.H264.Encoder="اسم أداة الترميز" +MF.H264.LowLatency="زمن تأخير منخفض (تعطيل إعادة ترتيب الإطارات)" +MF.H264.BFrames="عدد إطارات B المتتابعة" +MF.H264.CustomBufsize="استخدام حجم تخزين مؤَقَت مخصص" +MF.H264.BufferSize="حجم التخزين المؤَقَت" +MF.H264.CustomMaxBitrate="استخدام أعلى معدل نقل مخصص" MF.H264.Bitrate="معدّل البِت" -MF.H264.CBR="CBR (معدل بِت ثابت)" -MF.H264.VBR="VBR (معدل بِت متغير)" +MF.H264.MaxBitrate="أعلى معدل نقل" +MF.H264.KeyframeIntervalSec="الفاصل الزمني بين الإطارات الرئيسية (ثانية, 0=تلقائي)" +MF.H264.RateControl="التحكم بمعدل النقل" +MF.H264.CBR="CBR (معدل نقل ثابت)" +MF.H264.VBR="VBR (معدل نقل متغير)" MF.H264.CQP="CQP (جودة ثابتة)" +MF.H264.MinQP="الحد الأدنى لجودة الصورة (QP)" +MF.H264.MaxQP="الحد الأعلى لجودة الصورة (QP)" +MF.H264.QPI="QP I-Frame" +MF.H264.QPP="QP P-Frame" +MF.H264.QPB="QP B-Frame" MF.H264.Profile="الملف الشخصي" MF.H264.Advanced="متقدم"
View file
obs-studio-23.2.1.tar.xz/plugins/win-mf/data/locale/bg-BG.ini -> obs-studio-24.0.0.tar.xz/plugins/win-mf/data/locale/bg-BG.ini
Changed
@@ -7,4 +7,5 @@ MF.H264.Profile="Профил" MF.H264.Advanced="Разширено" +MF.H264.EncoderHWNVIDIA="Кодиращо ус-тво NVIDIA NVENC H.264 (Media Foundation)"
View file
obs-studio-23.2.1.tar.xz/plugins/win-mf/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/win-mf/data/locale/de-DE.ini
Changed
@@ -1,30 +1,30 @@ MFAACEnc="Media Foundation AAC Kodierer" Bitrate="Bitrate" -MF.H264.EncoderName="Media-Foundation-H264-Kodierer" +MF.H264.EncoderName="Media‐Foundation‐H264‐Kodierer" MF.H264.Encoder="Kodierername" MF.H264.LowLatency="Niedrige Latenz (Deaktiviert Frameneuanordnung)" -MF.H264.BFrames="Konsekutive B-Frameanzahl" +MF.H264.BFrames="Konsekutive B‐Frameanzahl" MF.H264.CustomBufsize="Benutzerdefinierte Puffergröße verwenden" MF.H264.BufferSize="Puffergröße" MF.H264.CustomMaxBitrate="Benutzerdefinierte Max. Bitrate verwenden" MF.H264.Bitrate="Bitrate" MF.H264.MaxBitrate="Max. Bitrate" -MF.H264.KeyframeIntervalSec="Keyframeintervall (Sekunden, 0 – automatisch)" +MF.H264.KeyframeIntervalSec="Keyframeintervall in Sek. (0 = automatisch)" MF.H264.RateControl="Qualitätsregulierungsmethode" MF.H264.CBR="CBR (Konstante Bitrate)" MF.H264.VBR="VBR (Variable Bitrate)" MF.H264.CQP="CQP (Konstante Qualität)" MF.H264.MinQP="Minimum QP" MF.H264.MaxQP="Maximum QP" -MF.H264.QPI="QP-I-Frame" -MF.H264.QPP="QP-P-Frame" -MF.H264.QPB="QP-B-Frame" +MF.H264.QPI="QP‐I‐Frame" +MF.H264.QPP="QP‐P‐Frame" +MF.H264.QPB="QP‐B‐Frame" MF.H264.Profile="Profil" MF.H264.Advanced="Erweitert" -MF.H264.EncoderSWMicrosoft="Microsoft-Software-H.264-Kodierer" -MF.H264.EncoderHWAMD="AMD-Video-Coding-Engine-H.264-Kodierer (Media Foundation)" -MF.H264.EncoderHWIntel="Intel-Quick-Sync-H.264-Kodierer (Media Foundation)" -MF.H264.EncoderHWNVIDIA="NVIDIA-NVENC-H.264-Kodierer (Media Foundation)" +MF.H264.EncoderSWMicrosoft="Microsoft‐Software‐H.264‐Kodierer" +MF.H264.EncoderHWAMD="AMD‐Video‐Coding‐Engine‐H.264‐Kodierer (Media Foundation)" +MF.H264.EncoderHWIntel="Intel‐Quick‐Sync‐H.264‐Kodierer (Media Foundation)" +MF.H264.EncoderHWNVIDIA="NVIDIA‐NVENC‐H.264‐Kodierer (Media Foundation)"
View file
obs-studio-23.2.1.tar.xz/plugins/win-mf/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/win-mf/data/locale/gl-ES.ini
Changed
@@ -1,12 +1,30 @@ -MFAACEnc="Codificador Media Foundation AAC" -Bitrate="Velocidade de bits" +MFAACEnc="Codificador AAC de Media Foundation" +Bitrate="Taxa de bits" MF.H264.EncoderName="Codificador H264 de Media Foundation" MF.H264.Encoder="Nome do codificador" MF.H264.LowLatency="Baixa latencia (desactivar a reorganización de fotogramas)" -MF.H264.Bitrate="Velocidade de bits" +MF.H264.BFrames="Numero de B-Frame consecutivos" +MF.H264.CustomBufsize="Utilizar tamaño personalizado da memoria temporal" +MF.H264.BufferSize="Tamaño da memoria temporal" +MF.H264.CustomMaxBitrate="Usar unha taxa de bits máxima personalizada" +MF.H264.Bitrate="Taxa de bits" +MF.H264.MaxBitrate="Taxa de bits máxima" +MF.H264.KeyframeIntervalSec="Intervalo de fotogramas clave (segundos, 0=auto)" +MF.H264.RateControl="Control da taxa" +MF.H264.CBR="CBR (taxa de bits constante)" +MF.H264.VBR="VBR (taxa de bits variábel)" +MF.H264.CQP="CQP (calidade constante)" +MF.H264.MinQP="QP mínimo" +MF.H264.MaxQP="QP máximo" +MF.H264.QPI="QP I-Frame" +MF.H264.QPP="QP P-Frame" +MF.H264.QPB="QP B-Frame" MF.H264.Profile="Perfil" MF.H264.Advanced="Avanzado" MF.H264.EncoderSWMicrosoft="Codificador H.264 de Microsoft Software" +MF.H264.EncoderHWAMD="Codificador AMD Video Coding Engine H.264 (Media Foundation)" +MF.H264.EncoderHWIntel="Codificador Intel Quick Sync H.264 (Media Foundation)" +MF.H264.EncoderHWNVIDIA="Codificador NVIDIA NVENC H.264 (Media Foundation)"
View file
obs-studio-24.0.0.tar.xz/plugins/win-mf/data/locale/sl-SI.ini
Added
@@ -0,0 +1,30 @@ +MFAACEnc="Kodirnik AAC Media Foundation" +Bitrate="Bitna hitrost" + +MF.H264.EncoderName="Kodirnik H264 Media Foundation" +MF.H264.Encoder="Ime kodirnika" +MF.H264.LowLatency="Nizka zakasnitev (onemogoči prerazporejanje sličic)" +MF.H264.BFrames="Število zaporednih sličic B" +MF.H264.CustomBufsize="Uporabi velikost medpomnilnika po meri" +MF.H264.BufferSize="Velikost medpomnilnika" +MF.H264.CustomMaxBitrate="Uporabi največjo bitno hitrost po meri" +MF.H264.Bitrate="Bitna hitrost" +MF.H264.MaxBitrate="Največja bitna hitrost" +MF.H264.KeyframeIntervalSec="Razmik med ključnimi sličicami (s, 0=samodejno)" +MF.H264.RateControl="Nadzor hitrosti" +MF.H264.CBR="Konstantna bitna hitrost" +MF.H264.VBR="Spremenljiva bitna hitrost" +MF.H264.CQP="CQP (konstantna kakovost)" +MF.H264.MinQP="Najmanjši QP" +MF.H264.MaxQP="Največji QP" +MF.H264.QPI="QP sličic I" +MF.H264.QPP="QP sličic P" +MF.H264.QPB="QP sličic B" +MF.H264.Profile="Profil" +MF.H264.Advanced="Napredno" + +MF.H264.EncoderSWMicrosoft="Microsoftov programski kodirnik H.264" +MF.H264.EncoderHWAMD="Kodirnik H.264 AMD Video Coding Engine (Media Foundation)" +MF.H264.EncoderHWIntel="Kodirnik H.264 Intel Quick Sync (Media Foundation)" +MF.H264.EncoderHWNVIDIA="Kodirnik H.264 NVIDIA NVENC (Media Foundation)" +
View file
obs-studio-23.2.1.tar.xz/plugins/win-wasapi/data/locale/de-DE.ini -> obs-studio-24.0.0.tar.xz/plugins/win-wasapi/data/locale/de-DE.ini
Changed
@@ -2,5 +2,5 @@ AudioOutput="Audioausgabeaufnahme" Device="Gerät" Default="Standard" -UseDeviceTiming="Geräte-Zeitstempel verwenden" +UseDeviceTiming="Geräte‐Zeitstempel verwenden"
View file
obs-studio-23.2.1.tar.xz/plugins/win-wasapi/data/locale/gl-ES.ini -> obs-studio-24.0.0.tar.xz/plugins/win-wasapi/data/locale/gl-ES.ini
Changed
@@ -1,6 +1,6 @@ -AudioInput="Captura de entrada de audio" -AudioOutput="Captura de saída de audio" +AudioInput="Captura de entrada de son" +AudioOutput="Captura de saída de son" Device="Dispositivo" -Default="Predefinido" -UseDeviceTiming="Usar a hora do dispositivo" +Default="Predeterminado" +UseDeviceTiming="Usar a marca de tempo do dispositivo"
View file
obs-studio-23.2.1.tar.xz/plugins/win-wasapi/data/locale/ka-GE.ini -> obs-studio-24.0.0.tar.xz/plugins/win-wasapi/data/locale/ka-GE.ini
Changed
@@ -1,4 +1,4 @@ -AudioInput="შემავალი ხმოვანი სიგნალის ჩაწერა" +AudioInput="შემავალი ხმის ჩაწერა" AudioOutput="გამოტანილი ხმის ჩაწერა" Device="მოწყობილობა" Default="ნაგულისხმევი"
View file
obs-studio-23.2.1.tar.xz/plugins/win-wasapi/data/locale/sl-SI.ini -> obs-studio-24.0.0.tar.xz/plugins/win-wasapi/data/locale/sl-SI.ini
Changed
@@ -1,5 +1,5 @@ -AudioInput="Zajemanje zvoka" -AudioOutput="Izhod zvoka zajemanja" +AudioInput="Zajemanje vhodnega zvoka" +AudioOutput="Zajemanje izhodnega zvoka" Device="Naprava" Default="Privzeto" UseDeviceTiming="Uporabi časovne žige na napravi"
View file
obs-studio-23.2.1.tar.xz/plugins/win-wasapi/enum-wasapi.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-wasapi/enum-wasapi.cpp
Changed
@@ -24,11 +24,12 @@ size_t len = wcslen(nameVar.pwszVal); size_t size; - size = os_wcs_to_utf8(nameVar.pwszVal, len, - nullptr, 0) + 1; + size = os_wcs_to_utf8(nameVar.pwszVal, len, nullptr, + 0) + + 1; device_name.resize(size); - os_wcs_to_utf8(nameVar.pwszVal, len, - &device_name[0], size); + os_wcs_to_utf8(nameVar.pwszVal, len, &device_name[0], + size); } } @@ -43,13 +44,14 @@ HRESULT res; res = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, - __uuidof(IMMDeviceEnumerator), - (void**)enumerator.Assign()); + __uuidof(IMMDeviceEnumerator), + (void **)enumerator.Assign()); if (FAILED(res)) throw HRError("Failed to create enumerator", res); res = enumerator->EnumAudioEndpoints(input ? eCapture : eRender, - DEVICE_STATE_ACTIVE, collection.Assign()); + DEVICE_STATE_ACTIVE, + collection.Assign()); if (FAILED(res)) throw HRError("Failed to enumerate devices", res); @@ -58,10 +60,10 @@ throw HRError("Failed to get device count", res); for (UINT i = 0; i < count; i++) { - ComPtr<IMMDevice> device; + ComPtr<IMMDevice> device; CoTaskMemPtr<WCHAR> w_id; - AudioDeviceInfo info; - size_t len, size; + AudioDeviceInfo info; + size_t len, size; res = collection->Item(i, device.Assign()); if (FAILED(res)) @@ -73,7 +75,7 @@ info.name = GetDeviceName(device); - len = wcslen(w_id); + len = wcslen(w_id); size = os_wcs_to_utf8(w_id, len, nullptr, 0) + 1; info.id.resize(size); os_wcs_to_utf8(w_id, len, &info.id[0], size); @@ -89,8 +91,8 @@ try { GetWASAPIAudioDevices_(devices, input); - } catch (HRError error) { - blog(LOG_WARNING, "[GetWASAPIAudioDevices] %s: %lX", - error.str, error.hr); + } catch (HRError &error) { + blog(LOG_WARNING, "[GetWASAPIAudioDevices] %s: %lX", error.str, + error.hr); } }
View file
obs-studio-23.2.1.tar.xz/plugins/win-wasapi/enum-wasapi.hpp -> obs-studio-24.0.0.tar.xz/plugins/win-wasapi/enum-wasapi.hpp
Changed
@@ -11,12 +11,17 @@ #ifdef DEFINE_PROPERTYKEY #undef DEFINE_PROPERTYKEY #endif + +/* clang-format off */ + #define DEFINE_PROPERTYKEY(id, a, b, c, d, e, f, g, h, i, j, k, l) \ const PROPERTYKEY id = { { a,b,c, { d,e,f,g,h,i,j,k, } }, l }; DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, \ 0xa45c254e, 0xdf1c, 0x4efd, 0x80, \ 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); +/* clang-format on */ + #else #include <functiondiscoverykeys_devpkey.h>
View file
obs-studio-23.2.1.tar.xz/plugins/win-wasapi/plugin-main.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-wasapi/plugin-main.cpp
Changed
@@ -4,7 +4,7 @@ OBS_MODULE_USE_DEFAULT_LOCALE("win-wasapi", "en-US") MODULE_EXPORT const char *obs_module_description(void) { - return "Windows WASAPI audio input/ouput sources"; + return "Windows WASAPI audio input/output sources"; } void RegisterWASAPIInput();
View file
obs-studio-23.2.1.tar.xz/plugins/win-wasapi/win-wasapi.cpp -> obs-studio-24.0.0.tar.xz/plugins/win-wasapi/win-wasapi.cpp
Changed
@@ -11,40 +11,40 @@ using namespace std; -#define OPT_DEVICE_ID "device_id" +#define OPT_DEVICE_ID "device_id" #define OPT_USE_DEVICE_TIMING "use_device_timing" static void GetWASAPIDefaults(obs_data_t *settings); #define OBS_KSAUDIO_SPEAKER_4POINT1 \ - (KSAUDIO_SPEAKER_SURROUND|SPEAKER_LOW_FREQUENCY) + (KSAUDIO_SPEAKER_SURROUND | SPEAKER_LOW_FREQUENCY) class WASAPISource { - ComPtr<IMMDevice> device; - ComPtr<IAudioClient> client; + ComPtr<IMMDevice> device; + ComPtr<IAudioClient> client; ComPtr<IAudioCaptureClient> capture; - ComPtr<IAudioRenderClient> render; + ComPtr<IAudioRenderClient> render; - obs_source_t *source; - string device_id; - string device_name; - bool isInputDevice; - bool useDeviceTiming = false; - bool isDefaultDevice = false; + obs_source_t *source; + string device_id; + string device_name; + bool isInputDevice; + bool useDeviceTiming = false; + bool isDefaultDevice = false; - bool reconnecting = false; - bool previouslyFailed = false; - WinHandle reconnectThread; + bool reconnecting = false; + bool previouslyFailed = false; + WinHandle reconnectThread; - bool active = false; - WinHandle captureThread; + bool active = false; + WinHandle captureThread; - WinHandle stopSignal; - WinHandle receiveSignal; + WinHandle stopSignal; + WinHandle receiveSignal; - speaker_layout speakers; - audio_format format; - uint32_t sampleRate; + speaker_layout speakers; + audio_format format; + uint32_t sampleRate; static DWORD WINAPI ReconnectThread(LPVOID param); static DWORD WINAPI CaptureThread(LPVOID param); @@ -75,9 +75,8 @@ }; WASAPISource::WASAPISource(obs_data_t *settings, obs_source_t *source_, - bool input) - : source (source_), - isInputDevice (input) + bool input) + : source(source_), isInputDevice(input) { UpdateSettings(settings); @@ -95,9 +94,10 @@ inline void WASAPISource::Start() { if (!TryInitialize()) { - blog(LOG_INFO, "[WASAPISource::WASAPISource] " - "Device '%s' not found. Waiting for device", - device_id.c_str()); + blog(LOG_INFO, + "[WASAPISource::WASAPISource] " + "Device '%s' not found. Waiting for device", + device_id.c_str()); Reconnect(); } } @@ -108,7 +108,7 @@ if (active) { blog(LOG_INFO, "WASAPI: Device '%s' Terminated", - device_name.c_str()); + device_name.c_str()); WaitForSingleObject(captureThread, INFINITE); } @@ -125,7 +125,7 @@ void WASAPISource::UpdateSettings(obs_data_t *settings) { - device_id = obs_data_get_string(settings, OPT_DEVICE_ID); + device_id = obs_data_get_string(settings, OPT_DEVICE_ID); useDeviceTiming = obs_data_get_bool(settings, OPT_USE_DEVICE_TIMING); isDefaultDevice = _strcmpi(device_id.c_str(), "default") == 0; } @@ -150,9 +150,9 @@ if (isDefaultDevice) { res = enumerator->GetDefaultAudioEndpoint( - isInputDevice ? eCapture : eRender, - isInputDevice ? eCommunications : eConsole, - device.Assign()); + isInputDevice ? eCapture : eRender, + isInputDevice ? eCommunications : eConsole, + device.Assign()); } else { wchar_t *w_id; os_utf8_to_wcs_ptr(device_id.c_str(), device_id.size(), &w_id); @@ -165,16 +165,16 @@ return SUCCEEDED(res); } -#define BUFFER_TIME_100NS (5*10000000) +#define BUFFER_TIME_100NS (5 * 10000000) void WASAPISource::InitClient() { CoTaskMemPtr<WAVEFORMATEX> wfex; - HRESULT res; - DWORD flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK; + HRESULT res; + DWORD flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK; - res = device->Activate(__uuidof(IAudioClient), CLSCTX_ALL, - nullptr, (void**)client.Assign()); + res = device->Activate(__uuidof(IAudioClient), CLSCTX_ALL, nullptr, + (void **)client.Assign()); if (FAILED(res)) throw HRError("Failed to activate client context", res); @@ -187,9 +187,8 @@ if (!isInputDevice) flags |= AUDCLNT_STREAMFLAGS_LOOPBACK; - res = client->Initialize( - AUDCLNT_SHAREMODE_SHARED, flags, - BUFFER_TIME_100NS, 0, wfex, nullptr); + res = client->Initialize(AUDCLNT_SHAREMODE_SHARED, flags, + BUFFER_TIME_100NS, 0, wfex, nullptr); if (FAILED(res)) throw HRError("Failed to get initialize audio client", res); } @@ -197,13 +196,13 @@ void WASAPISource::InitRender() { CoTaskMemPtr<WAVEFORMATEX> wfex; - HRESULT res; - LPBYTE buffer; - UINT32 frames; - ComPtr<IAudioClient> client; + HRESULT res; + LPBYTE buffer; + UINT32 frames; + ComPtr<IAudioClient> client; - res = device->Activate(__uuidof(IAudioClient), CLSCTX_ALL, - nullptr, (void**)client.Assign()); + res = device->Activate(__uuidof(IAudioClient), CLSCTX_ALL, nullptr, + (void **)client.Assign()); if (FAILED(res)) throw HRError("Failed to activate client context", res); @@ -211,9 +210,8 @@ if (FAILED(res)) throw HRError("Failed to get mix format", res); - res = client->Initialize( - AUDCLNT_SHAREMODE_SHARED, 0, - BUFFER_TIME_100NS, 0, wfex, nullptr); + res = client->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, BUFFER_TIME_100NS, + 0, wfex, nullptr); if (FAILED(res)) throw HRError("Failed to get initialize audio client", res); @@ -226,7 +224,7 @@ throw HRError("Failed to get buffer size", res); res = client->GetService(__uuidof(IAudioRenderClient), - (void**)render.Assign()); + (void **)render.Assign()); if (FAILED(res)) throw HRError("Failed to get render client", res); @@ -234,7 +232,7 @@ if (FAILED(res)) throw HRError("Failed to get buffer", res); - memset(buffer, 0, frames*wfex->nBlockAlign); + memset(buffer, 0, frames * wfex->nBlockAlign); render->ReleaseBuffer(frames, 0); } @@ -242,11 +240,16 @@ static speaker_layout ConvertSpeakerLayout(DWORD layout, WORD channels) { switch (layout) { - case KSAUDIO_SPEAKER_2POINT1: return SPEAKERS_2POINT1; - case KSAUDIO_SPEAKER_SURROUND: return SPEAKERS_4POINT0; - case OBS_KSAUDIO_SPEAKER_4POINT1: return SPEAKERS_4POINT1; - case KSAUDIO_SPEAKER_5POINT1_SURROUND: return SPEAKERS_5POINT1; - case KSAUDIO_SPEAKER_7POINT1_SURROUND: return SPEAKERS_7POINT1; + case KSAUDIO_SPEAKER_2POINT1: + return SPEAKERS_2POINT1; + case KSAUDIO_SPEAKER_SURROUND: + return SPEAKERS_4POINT0; + case OBS_KSAUDIO_SPEAKER_4POINT1: + return SPEAKERS_4POINT1; + case KSAUDIO_SPEAKER_5POINT1_SURROUND: + return SPEAKERS_5POINT1; + case KSAUDIO_SPEAKER_7POINT1_SURROUND: + return SPEAKERS_7POINT1; } return (speaker_layout)channels; @@ -257,20 +260,20 @@ DWORD layout = 0; if (wfex->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { - WAVEFORMATEXTENSIBLE *ext = (WAVEFORMATEXTENSIBLE*)wfex; + WAVEFORMATEXTENSIBLE *ext = (WAVEFORMATEXTENSIBLE *)wfex; layout = ext->dwChannelMask; } /* WASAPI is always float */ sampleRate = wfex->nSamplesPerSec; - format = AUDIO_FORMAT_FLOAT; - speakers = ConvertSpeakerLayout(layout, wfex->nChannels); + format = AUDIO_FORMAT_FLOAT; + speakers = ConvertSpeakerLayout(layout, wfex->nChannels); } void WASAPISource::InitCapture() { HRESULT res = client->GetService(__uuidof(IAudioCaptureClient), - (void**)capture.Assign()); + (void **)capture.Assign()); if (FAILED(res)) throw HRError("Failed to create capture context", res); @@ -278,9 +281,8 @@ if (FAILED(res)) throw HRError("Failed to set event handle", res); - captureThread = CreateThread(nullptr, 0, - WASAPISource::CaptureThread, this, - 0, nullptr); + captureThread = CreateThread(nullptr, 0, WASAPISource::CaptureThread, + this, 0, nullptr); if (!captureThread.Valid()) throw "Failed to create capture thread"; @@ -295,10 +297,9 @@ ComPtr<IMMDeviceEnumerator> enumerator; HRESULT res; - res = CoCreateInstance(__uuidof(MMDeviceEnumerator), - nullptr, CLSCTX_ALL, - __uuidof(IMMDeviceEnumerator), - (void**)enumerator.Assign()); + res = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, + CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), + (void **)enumerator.Assign()); if (FAILED(res)) throw HRError("Failed to create enumerator", res); @@ -308,7 +309,8 @@ device_name = GetDeviceName(device); InitClient(); - if (!isInputDevice) InitRender(); + if (!isInputDevice) + InitRender(); InitCapture(); } @@ -317,23 +319,23 @@ try { Initialize(); - } catch (HRError error) { + } catch (HRError &error) { if (previouslyFailed) return active; blog(LOG_WARNING, "[WASAPISource::TryInitialize]:[%s] %s: %lX", - device_name.empty() ? - device_id.c_str() : device_name.c_str(), - error.str, error.hr); + device_name.empty() ? device_id.c_str() + : device_name.c_str(), + error.str, error.hr); } catch (const char *error) { if (previouslyFailed) return active; blog(LOG_WARNING, "[WASAPISource::TryInitialize]:[%s] %s", - device_name.empty() ? - device_id.c_str() : device_name.c_str(), - error); + device_name.empty() ? device_id.c_str() + : device_name.c_str(), + error); } previouslyFailed = !active; @@ -343,14 +345,14 @@ void WASAPISource::Reconnect() { reconnecting = true; - reconnectThread = CreateThread(nullptr, 0, - WASAPISource::ReconnectThread, this, - 0, nullptr); + reconnectThread = CreateThread( + nullptr, 0, WASAPISource::ReconnectThread, this, 0, nullptr); if (!reconnectThread.Valid()) - blog(LOG_WARNING, "[WASAPISource::Reconnect] " - "Failed to initialize reconnect thread: %lu", - GetLastError()); + blog(LOG_WARNING, + "[WASAPISource::Reconnect] " + "Failed to initialize reconnect thread: %lu", + GetLastError()); } static inline bool WaitForSignal(HANDLE handle, DWORD time) @@ -362,14 +364,16 @@ DWORD WINAPI WASAPISource::ReconnectThread(LPVOID param) { - WASAPISource *source = (WASAPISource*)param; + WASAPISource *source = (WASAPISource *)param; os_set_thread_name("win-wasapi: reconnect thread"); CoInitializeEx(0, COINIT_MULTITHREADED); - obs_monitoring_type type = obs_source_get_monitoring_type(source->source); - obs_source_set_monitoring_type(source->source, OBS_MONITORING_TYPE_NONE); + obs_monitoring_type type = + obs_source_get_monitoring_type(source->source); + obs_source_set_monitoring_type(source->source, + OBS_MONITORING_TYPE_NONE); while (!WaitForSignal(source->stopSignal, RECONNECT_INTERVAL)) { if (source->TryInitialize()) @@ -386,11 +390,11 @@ bool WASAPISource::ProcessCaptureData() { HRESULT res; - LPBYTE buffer; - UINT32 frames; - DWORD flags; - UINT64 pos, ts; - UINT captureSize = 0; + LPBYTE buffer; + UINT32 frames; + DWORD flags; + UINT64 pos, ts; + UINT captureSize = 0; while (true) { res = capture->GetNextPacketSize(&captureSize); @@ -398,9 +402,10 @@ if (FAILED(res)) { if (res != AUDCLNT_E_DEVICE_INVALIDATED) blog(LOG_WARNING, - "[WASAPISource::GetCaptureData]" - " capture->GetNextPacketSize" - " failed: %lX", res); + "[WASAPISource::GetCaptureData]" + " capture->GetNextPacketSize" + " failed: %lX", + res); return false; } @@ -411,24 +416,24 @@ if (FAILED(res)) { if (res != AUDCLNT_E_DEVICE_INVALIDATED) blog(LOG_WARNING, - "[WASAPISource::GetCaptureData]" - " capture->GetBuffer" - " failed: %lX", res); + "[WASAPISource::GetCaptureData]" + " capture->GetBuffer" + " failed: %lX", + res); return false; } obs_source_audio data = {}; - data.data[0] = (const uint8_t*)buffer; - data.frames = (uint32_t)frames; - data.speakers = speakers; - data.samples_per_sec = sampleRate; - data.format = format; - data.timestamp = useDeviceTiming ? - ts*100 : os_gettime_ns(); + data.data[0] = (const uint8_t *)buffer; + data.frames = (uint32_t)frames; + data.speakers = speakers; + data.samples_per_sec = sampleRate; + data.format = format; + data.timestamp = useDeviceTiming ? ts * 100 : os_gettime_ns(); if (!useDeviceTiming) data.timestamp -= (uint64_t)frames * 1000000000ULL / - (uint64_t)sampleRate; + (uint64_t)sampleRate; obs_source_output_audio(source, &data); @@ -439,7 +444,7 @@ } static inline bool WaitForCaptureSignal(DWORD numSignals, const HANDLE *signals, - DWORD duration) + DWORD duration) { DWORD ret; ret = WaitForMultipleObjects(numSignals, signals, false, duration); @@ -449,16 +454,13 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param) { - WASAPISource *source = (WASAPISource*)param; - bool reconnect = false; + WASAPISource *source = (WASAPISource *)param; + bool reconnect = false; /* Output devices don't signal, so just make it check every 10 ms */ - DWORD dur = source->isInputDevice ? RECONNECT_INTERVAL : 10; + DWORD dur = source->isInputDevice ? RECONNECT_INTERVAL : 10; - HANDLE sigs[2] = { - source->receiveSignal, - source->stopSignal - }; + HANDLE sigs[2] = {source->receiveSignal, source->stopSignal}; os_set_thread_name("win-wasapi: capture thread"); @@ -472,11 +474,11 @@ source->client->Stop(); source->captureThread = nullptr; - source->active = false; + source->active = false; if (reconnect) { blog(LOG_INFO, "Device '%s' invalidated. Retrying", - source->device_name.c_str()); + source->device_name.c_str()); source->Reconnect(); } @@ -485,12 +487,12 @@ /* ------------------------------------------------------------------------- */ -static const char *GetWASAPIInputName(void*) +static const char *GetWASAPIInputName(void *) { return obs_module_text("AudioInput"); } -static const char *GetWASAPIOutputName(void*) +static const char *GetWASAPIOutputName(void *) { return obs_module_text("AudioOutput"); } @@ -508,7 +510,7 @@ } static void *CreateWASAPISource(obs_data_t *settings, obs_source_t *source, - bool input) + bool input) { try { return new WASAPISource(settings, source, input); @@ -531,12 +533,12 @@ static void DestroyWASAPISource(void *obj) { - delete static_cast<WASAPISource*>(obj); + delete static_cast<WASAPISource *>(obj); } static void UpdateWASAPISource(void *obj, obs_data_t *settings) { - static_cast<WASAPISource*>(obj)->Update(settings); + static_cast<WASAPISource *>(obj)->Update(settings); } static obs_properties_t *GetWASAPIProperties(bool input) @@ -544,24 +546,24 @@ obs_properties_t *props = obs_properties_create(); vector<AudioDeviceInfo> devices; - obs_property_t *device_prop = obs_properties_add_list(props, - OPT_DEVICE_ID, obs_module_text("Device"), - OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); + obs_property_t *device_prop = obs_properties_add_list( + props, OPT_DEVICE_ID, obs_module_text("Device"), + OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING); GetWASAPIAudioDevices(devices, input); if (devices.size()) - obs_property_list_add_string(device_prop, - obs_module_text("Default"), "default"); + obs_property_list_add_string( + device_prop, obs_module_text("Default"), "default"); for (size_t i = 0; i < devices.size(); i++) { AudioDeviceInfo &device = devices[i]; - obs_property_list_add_string(device_prop, - device.name.c_str(), device.id.c_str()); + obs_property_list_add_string(device_prop, device.name.c_str(), + device.id.c_str()); } obs_properties_add_bool(props, OPT_USE_DEVICE_TIMING, - obs_module_text("UseDeviceTiming")); + obs_module_text("UseDeviceTiming")); return props; } @@ -579,32 +581,30 @@ void RegisterWASAPIInput() { obs_source_info info = {}; - info.id = "wasapi_input_capture"; - info.type = OBS_SOURCE_TYPE_INPUT; - info.output_flags = OBS_SOURCE_AUDIO | - OBS_SOURCE_DO_NOT_DUPLICATE; - info.get_name = GetWASAPIInputName; - info.create = CreateWASAPIInput; - info.destroy = DestroyWASAPISource; - info.update = UpdateWASAPISource; - info.get_defaults = GetWASAPIDefaultsInput; - info.get_properties = GetWASAPIPropertiesInput; + info.id = "wasapi_input_capture"; + info.type = OBS_SOURCE_TYPE_INPUT; + info.output_flags = OBS_SOURCE_AUDIO | OBS_SOURCE_DO_NOT_DUPLICATE; + info.get_name = GetWASAPIInputName; + info.create = CreateWASAPIInput; + info.destroy = DestroyWASAPISource; + info.update = UpdateWASAPISource; + info.get_defaults = GetWASAPIDefaultsInput; + info.get_properties = GetWASAPIPropertiesInput; obs_register_source(&info); } void RegisterWASAPIOutput() { obs_source_info info = {}; - info.id = "wasapi_output_capture"; - info.type = OBS_SOURCE_TYPE_INPUT; - info.output_flags = OBS_SOURCE_AUDIO | - OBS_SOURCE_DO_NOT_DUPLICATE | - OBS_SOURCE_DO_NOT_SELF_MONITOR; - info.get_name = GetWASAPIOutputName; - info.create = CreateWASAPIOutput; - info.destroy = DestroyWASAPISource; - info.update = UpdateWASAPISource; - info.get_defaults = GetWASAPIDefaultsOutput; - info.get_properties = GetWASAPIPropertiesOutput; + info.id = "wasapi_output_capture"; + info.type = OBS_SOURCE_TYPE_INPUT; + info.output_flags = OBS_SOURCE_AUDIO | OBS_SOURCE_DO_NOT_DUPLICATE | + OBS_SOURCE_DO_NOT_SELF_MONITOR; + info.get_name = GetWASAPIOutputName; + info.create = CreateWASAPIOutput; + info.destroy = DestroyWASAPISource; + info.update = UpdateWASAPISource; + info.get_defaults = GetWASAPIDefaultsOutput; + info.get_properties = GetWASAPIPropertiesOutput; obs_register_source(&info); }
View file
obs-studio-23.2.1.tar.xz/test/osx/test.mm -> obs-studio-24.0.0.tar.xz/test/osx/test.mm
Changed
@@ -16,24 +16,23 @@ /* --------------------------------------------------- */ -template <typename T, typename D_T, D_T D> -struct OBSUniqueHandle : std::unique_ptr<T, std::function<D_T>> -{ +template<typename T, typename D_T, D_T D> +struct OBSUniqueHandle : std::unique_ptr<T, std::function<D_T>> { using base = std::unique_ptr<T, std::function<D_T>>; - explicit OBSUniqueHandle(T *obj=nullptr) : base(obj, D) {} - operator T*() { return base::get(); } + explicit OBSUniqueHandle(T *obj = nullptr) : base(obj, D) {} + operator T *() { return base::get(); } }; #define DECLARE_DELETER(x) decltype(x), x -using SourceContext = OBSUniqueHandle<obs_source, - DECLARE_DELETER(obs_source_release)>; +using SourceContext = + OBSUniqueHandle<obs_source, DECLARE_DELETER(obs_source_release)>; -using SceneContext = OBSUniqueHandle<obs_scene, - DECLARE_DELETER(obs_scene_release)>; +using SceneContext = + OBSUniqueHandle<obs_scene, DECLARE_DELETER(obs_scene_release)>; -using DisplayContext = OBSUniqueHandle<obs_display, - DECLARE_DELETER(obs_display_destroy)>; +using DisplayContext = + OBSUniqueHandle<obs_display, DECLARE_DELETER(obs_display_destroy)>; #undef DECLARE_DELETER @@ -45,15 +44,15 @@ throw "Couldn't create OBS"; struct obs_video_info ovi; - ovi.adapter = 0; - ovi.fps_num = 30000; - ovi.fps_den = 1001; + ovi.adapter = 0; + ovi.fps_num = 30000; + ovi.fps_den = 1001; ovi.graphics_module = DL_OPENGL; - ovi.output_format = VIDEO_FORMAT_RGBA; - ovi.base_width = cx; - ovi.base_height = cy; - ovi.output_width = cx; - ovi.output_height = cy; + ovi.output_format = VIDEO_FORMAT_RGBA; + ovi.base_width = cx; + ovi.base_height = cy; + ovi.output_width = cx; + ovi.output_height = cy; if (obs_reset_video(&ovi) != 0) throw "Couldn't initialize video"; @@ -61,12 +60,12 @@ static DisplayContext CreateDisplay(NSView *view) { - gs_init_data info = {}; - info.cx = cx; - info.cy = cy; - info.format = GS_RGBA; - info.zsformat = GS_ZS_NONE; - info.window.view = view; + gs_init_data info = {}; + info.cx = cx; + info.cy = cy; + info.format = GS_RGBA; + info.zsformat = GS_ZS_NONE; + info.window.view = view; return DisplayContext{obs_display_create(&info)}; } @@ -79,8 +78,8 @@ /* ------------------------------------------------------ */ /* create source */ - SourceContext source{obs_source_create("random", "a test source", - nullptr, nullptr)}; + SourceContext source{ + obs_source_create("random", "a test source", nullptr, nullptr)}; if (!source) throw "Couldn't create random test source"; @@ -99,20 +98,19 @@ return scene; } -@interface OBSTest : NSObject<NSApplicationDelegate, NSWindowDelegate> -{ +@interface OBSTest : NSObject <NSApplicationDelegate, NSWindowDelegate> { NSWindow *win; NSView *view; DisplayContext display; SceneContext scene; } -- (void)applicationDidFinishLaunching:(NSNotification*)notification; -- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)app; -- (void)windowWillClose:(NSNotification*)notification; +- (void)applicationDidFinishLaunching:(NSNotification *)notification; +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app; +- (void)windowWillClose:(NSNotification *)notification; @end @implementation OBSTest -- (void)applicationDidFinishLaunching:(NSNotification*)notification +- (void)applicationDidFinishLaunching:(NSNotification *)notification { UNUSED_PARAMETER(notification); @@ -120,9 +118,10 @@ NSRect content_rect = NSMakeRect(0, 0, cx, cy); win = [[NSWindow alloc] initWithContentRect:content_rect - styleMask:NSTitledWindowMask | NSClosableWindowMask - backing:NSBackingStoreBuffered - defer:NO]; + styleMask:NSTitledWindowMask | + NSClosableWindowMask + backing:NSBackingStoreBuffered + defer:NO]; if (!win) throw "Could not create window"; @@ -144,10 +143,12 @@ scene = SetupScene(); - obs_display_add_draw_callback(display.get(), - [](void *, uint32_t, uint32_t) { - obs_render_main_texture(); - }, nullptr); + obs_display_add_draw_callback( + display.get(), + [](void *, uint32_t, uint32_t) { + obs_render_main_texture(); + }, + nullptr); } catch (char const *error) { NSLog(@"%s\n", error); @@ -156,14 +157,14 @@ } } -- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)app +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)app { UNUSED_PARAMETER(app); return YES; } -- (void)windowWillClose:(NSNotification*)notification +- (void)windowWillClose:(NSNotification *)notification { UNUSED_PARAMETER(notification);
View file
obs-studio-23.2.1.tar.xz/test/test-input/sync-async-source.c -> obs-studio-24.0.0.tar.xz/test/test-input/sync-async-source.c
Changed
@@ -5,19 +5,19 @@ struct async_sync_test { obs_source_t *source; - os_event_t *stop_signal; - pthread_t thread; - bool initialized; + os_event_t *stop_signal; + pthread_t thread; + bool initialized; }; /* middle C */ -static const double rate = 261.63/48000.0; +static const double rate = 261.63 / 48000.0; #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 #endif -#define M_PI_X2 M_PI*2 +#define M_PI_X2 M_PI * 2 static const char *ast_getname(void *unused) { @@ -44,7 +44,7 @@ for (y = 0; y < 20; y++) { for (x = 0; x < 20; x++) { - pixels[y*20 + x] = color; + pixels[y * 20 + x] = color; } } } @@ -56,25 +56,25 @@ uint32_t sample_rate = audio_output_get_sample_rate(obs_get_audio()); uint32_t *pixels = bmalloc(20 * 20 * sizeof(uint32_t)); - float *samples = bmalloc(sample_rate * sizeof(float)); + float *samples = bmalloc(sample_rate * sizeof(float)); uint64_t cur_time = os_gettime_ns(); - bool whitelist = false; - double cos_val = 0.0; + bool whitelist = false; + double cos_val = 0.0; uint64_t start_time = cur_time; struct obs_source_frame frame = { - .data = {[0] = (uint8_t*)pixels}, - .linesize = {[0] = 20*4}, - .width = 20, - .height = 20, - .format = VIDEO_FORMAT_BGRX + .data = {[0] = (uint8_t *)pixels}, + .linesize = {[0] = 20 * 4}, + .width = 20, + .height = 20, + .format = VIDEO_FORMAT_BGRX, }; struct obs_source_audio audio = { - .speakers = SPEAKERS_MONO, - .data = {[0] = (uint8_t*)samples}, + .speakers = SPEAKERS_MONO, + .data = {[0] = (uint8_t *)samples}, .samples_per_sec = sample_rate, - .frames = sample_rate, - .format = AUDIO_FORMAT_FLOAT + .frames = sample_rate, + .format = AUDIO_FORMAT_FLOAT, }; while (os_event_try(ast->stop_signal) == EAGAIN) { @@ -133,11 +133,10 @@ } struct obs_source_info async_sync_test = { - .id = "async_sync_test", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_ASYNC_VIDEO | - OBS_SOURCE_AUDIO, - .get_name = ast_getname, - .create = ast_create, - .destroy = ast_destroy, + .id = "async_sync_test", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO, + .get_name = ast_getname, + .create = ast_create, + .destroy = ast_destroy, };
View file
obs-studio-23.2.1.tar.xz/test/test-input/sync-audio-buffering.c -> obs-studio-24.0.0.tar.xz/test/test-input/sync-audio-buffering.c
Changed
@@ -5,29 +5,27 @@ struct buffering_async_sync_test { obs_source_t *source; - os_event_t *stop_signal; - pthread_t thread; - bool initialized; - bool buffer_audio; + os_event_t *stop_signal; + pthread_t thread; + bool initialized; + bool buffer_audio; }; #define CYCLE_COUNT 7 static const double aud_rates[CYCLE_COUNT] = { - 220.00/48000.0, /* A */ - 233.08/48000.0, /* A# */ - 246.94/48000.0, /* B */ - 261.63/48000.0, /* C */ - 277.18/48000.0, /* C# */ - 293.67/48000.0, /* D */ - 311.13/48000.0, /* D# */ + 220.00 / 48000.0, /* A */ + 233.08 / 48000.0, /* A# */ + 246.94 / 48000.0, /* B */ + 261.63 / 48000.0, /* C */ + 277.18 / 48000.0, /* C# */ + 293.67 / 48000.0, /* D */ + 311.13 / 48000.0, /* D# */ }; #define MAKE_COL_CHAN(x, y) (((0xFF / 7) * x) << (y * 8)) #define MAKE_GRAYSCALE(x) \ - (MAKE_COL_CHAN(x, 0) | \ - MAKE_COL_CHAN(x, 1) | \ - MAKE_COL_CHAN(x, 2)) + (MAKE_COL_CHAN(x, 0) | MAKE_COL_CHAN(x, 1) | MAKE_COL_CHAN(x, 2)) static const uint32_t vid_colors[CYCLE_COUNT] = { 0xFF000000, @@ -43,7 +41,7 @@ #define M_PI 3.1415926535897932384626433832795 #endif -#define M_PI_X2 M_PI*2 +#define M_PI_X2 M_PI * 2 static const char *bast_getname(void *unused) { @@ -70,7 +68,7 @@ for (y = 0; y < 20; y++) { for (x = 0; x < 20; x++) { - pixels[y*20 + x] = color; + pixels[y * 20 + x] = color; } } } @@ -82,27 +80,27 @@ uint32_t sample_rate = audio_output_get_sample_rate(obs_get_audio()); uint32_t *pixels = bmalloc(20 * 20 * sizeof(uint32_t)); - float *samples = bmalloc(sample_rate * sizeof(float)); + float *samples = bmalloc(sample_rate * sizeof(float)); uint64_t cur_time = os_gettime_ns(); - int cur_vid_pos = 0; - int cur_aud_pos = 0; - double cos_val = 0.0; + int cur_vid_pos = 0; + int cur_aud_pos = 0; + double cos_val = 0.0; uint64_t start_time = cur_time; - bool audio_buffering_enabled = false; + bool audio_buffering_enabled = false; struct obs_source_frame frame = { - .data = {[0] = (uint8_t*)pixels}, - .linesize = {[0] = 20*4}, - .width = 20, - .height = 20, - .format = VIDEO_FORMAT_BGRX + .data = {[0] = (uint8_t *)pixels}, + .linesize = {[0] = 20 * 4}, + .width = 20, + .height = 20, + .format = VIDEO_FORMAT_BGRX, }; struct obs_source_audio audio = { - .speakers = SPEAKERS_MONO, - .data = {[0] = (uint8_t*)samples}, + .speakers = SPEAKERS_MONO, + .data = {[0] = (uint8_t *)samples}, .samples_per_sec = sample_rate, - .frames = sample_rate / 4, - .format = AUDIO_FORMAT_FLOAT + .frames = sample_rate / 4, + .format = AUDIO_FORMAT_FLOAT, }; while (os_event_try(bast->stop_signal) == EAGAIN) { @@ -123,7 +121,7 @@ * buffering */ frame.timestamp = cur_time - start_time; audio.timestamp = cur_time - start_time - - (audio_buffering_enabled ? 1000000000 : 0); + (audio_buffering_enabled ? 1000000000 : 0); const double rate = aud_rates[cur_aud_pos]; @@ -153,7 +151,7 @@ } static void bast_buffer_audio(void *data, obs_hotkey_id id, - obs_hotkey_t *hotkey, bool pressed) + obs_hotkey_t *hotkey, bool pressed) { struct buffering_async_sync_test *bast = data; @@ -180,7 +178,7 @@ } obs_hotkey_register_source(source, "AudioBufferingSyncTest.Buffer", - "Buffer Audio", bast_buffer_audio, bast); + "Buffer Audio", bast_buffer_audio, bast); bast->initialized = true; @@ -190,11 +188,10 @@ } struct obs_source_info buffering_async_sync_test = { - .id = "buffering_async_sync_test", - .type = OBS_SOURCE_TYPE_INPUT, - .output_flags = OBS_SOURCE_ASYNC_VIDEO | - OBS_SOURCE_AUDIO, - .get_name = bast_getname, - .create = bast_create, - .destroy = bast_destroy, + .id = "buffering_async_sync_test", + .type = OBS_SOURCE_TYPE_INPUT, + .output_flags = OBS_SOURCE_ASYNC_VIDEO | OBS_SOURCE_AUDIO, + .get_name = bast_getname, + .create = bast_create, + .destroy = bast_destroy, };
View file
obs-studio-23.2.1.tar.xz/test/test-input/sync-pair-aud.c -> obs-studio-24.0.0.tar.xz/test/test-input/sync-pair-aud.c
Changed
@@ -5,25 +5,25 @@ #include <obs.h> struct sync_pair_aud { - bool initialized_thread; - pthread_t thread; - os_event_t *event; + bool initialized_thread; + pthread_t thread; + os_event_t *event; obs_source_t *source; }; /* middle C */ -static const double rate = 261.63/48000.0; +static const double rate = 261.63 / 48000.0; #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 #endif -#define M_PI_X2 M_PI*2 +#define M_PI_X2 M_PI * 2 extern uint64_t starting_time; static inline bool whitelist_time(uint64_t ts, uint64_t interval, - uint64_t fps_num, uint64_t fps_den) + uint64_t fps_num, uint64_t fps_den) { if (!starting_time) return false; @@ -53,8 +53,8 @@ last_time = obs_get_video_frame_time(); for (uint64_t i = 0; i < frames; i++) { - uint64_t ts = last_time + - i * 1000000000ULL / sample_rate; + uint64_t ts = + last_time + i * 1000000000ULL / sample_rate; if (whitelist_time(ts, interval, fps_num, fps_den)) { cos_val += rate * M_PI_X2; @@ -68,7 +68,7 @@ } struct obs_source_audio data; - data.data[0] = (uint8_t*)samples; + data.data[0] = (uint8_t *)samples; data.frames = frames; data.speakers = SPEAKERS_MONO; data.samples_per_sec = sample_rate; @@ -106,8 +106,7 @@ } } -static void *sync_pair_aud_create(obs_data_t *settings, - obs_source_t *source) +static void *sync_pair_aud_create(obs_data_t *settings, obs_source_t *source) { struct sync_pair_aud *spa = bzalloc(sizeof(struct sync_pair_aud)); spa->source = source; @@ -128,10 +127,10 @@ } struct obs_source_info sync_audio = { - .id = "sync_audio", - .type = OBS_SOURCE_TYPE_INPUT, + .id = "sync_audio", + .type = OBS_SOURCE_TYPE_INPUT, .output_flags = OBS_SOURCE_AUDIO, - .get_name = sync_pair_aud_getname, - .create = sync_pair_aud_create, - .destroy = sync_pair_aud_destroy, + .get_name = sync_pair_aud_getname, + .create = sync_pair_aud_create, + .destroy = sync_pair_aud_destroy, };
View file
obs-studio-23.2.1.tar.xz/test/test-input/sync-pair-vid.c -> obs-studio-24.0.0.tar.xz/test/test-input/sync-pair-vid.c
Changed
@@ -39,7 +39,7 @@ for (y = 0; y < 32; y++) { for (x = 0; x < 32; x++) { - pixels[y*32 + x] = pixel; + pixels[y * 32 + x] = pixel; } } } @@ -57,11 +57,11 @@ uint8_t *ptr; uint32_t linesize; if (gs_texture_map(spv->white, &ptr, &linesize)) { - fill_texture((uint32_t*)ptr, 0xFFFFFFFF); + fill_texture((uint32_t *)ptr, 0xFFFFFFFF); gs_texture_unmap(spv->white); } if (gs_texture_map(spv->black, &ptr, &linesize)) { - fill_texture((uint32_t*)ptr, 0xFF000000); + fill_texture((uint32_t *)ptr, 0xFF000000); gs_texture_unmap(spv->black); } @@ -71,7 +71,7 @@ } static inline bool whitelist_time(uint64_t ts, uint64_t interval, - uint64_t fps_num, uint64_t fps_den) + uint64_t fps_num, uint64_t fps_den) { if (!starting_time) return false; @@ -120,13 +120,13 @@ } struct obs_source_info sync_video = { - .id = "sync_video", - .type = OBS_SOURCE_TYPE_INPUT, + .id = "sync_video", + .type = OBS_SOURCE_TYPE_INPUT, .output_flags = OBS_SOURCE_VIDEO, - .get_name = sync_pair_vid_getname, - .create = sync_pair_vid_create, - .destroy = sync_pair_vid_destroy, + .get_name = sync_pair_vid_getname, + .create = sync_pair_vid_create, + .destroy = sync_pair_vid_destroy, .video_render = sync_pair_vid_render, - .get_width = sync_pair_vid_size, - .get_height = sync_pair_vid_size, + .get_width = sync_pair_vid_size, + .get_height = sync_pair_vid_size, };
View file
obs-studio-23.2.1.tar.xz/test/test-input/test-filter.c -> obs-studio-24.0.0.tar.xz/test/test-input/test-filter.c
Changed
@@ -53,7 +53,7 @@ struct test_filter *tf = data; if (!obs_source_process_filter_begin(tf->source, GS_RGBA, - OBS_ALLOW_DIRECT_RENDERING)) + OBS_ALLOW_DIRECT_RENDERING)) return; obs_source_process_filter_end(tf->source, tf->whatever, 0, 0); @@ -62,11 +62,11 @@ } struct obs_source_info test_filter = { - .id = "test_filter", - .type = OBS_SOURCE_TYPE_FILTER, + .id = "test_filter", + .type = OBS_SOURCE_TYPE_FILTER, .output_flags = OBS_SOURCE_VIDEO, - .get_name = filter_getname, - .create = filter_create, - .destroy = filter_destroy, - .video_render = filter_render + .get_name = filter_getname, + .create = filter_create, + .destroy = filter_destroy, + .video_render = filter_render, };
View file
obs-studio-23.2.1.tar.xz/test/test-input/test-random.c -> obs-studio-24.0.0.tar.xz/test/test-input/test-random.c
Changed
@@ -5,9 +5,9 @@ struct random_tex { obs_source_t *source; - os_event_t *stop_signal; - pthread_t thread; - bool initialized; + os_event_t *stop_signal; + pthread_t thread; + bool initialized; }; static const char *random_getname(void *unused) @@ -38,28 +38,28 @@ for (y = 0; y < 20; y++) { for (x = 0; x < 20; x++) { uint32_t pixel = 0; - pixel |= (rand()%256); - pixel |= (rand()%256) << 8; - pixel |= (rand()%256) << 16; + pixel |= (rand() % 256); + pixel |= (rand() % 256) << 8; + pixel |= (rand() % 256) << 16; //pixel |= (rand()%256) << 24; //pixel |= 0xFFFFFFFF; - pixels[y*20 + x] = pixel; + pixels[y * 20 + x] = pixel; } } } static void *video_thread(void *data) { - struct random_tex *rt = data; - uint32_t pixels[20*20]; - uint64_t cur_time = os_gettime_ns(); + struct random_tex *rt = data; + uint32_t pixels[20 * 20]; + uint64_t cur_time = os_gettime_ns(); struct obs_source_frame frame = { - .data = {[0] = (uint8_t*)pixels}, - .linesize = {[0] = 20*4}, - .width = 20, - .height = 20, - .format = VIDEO_FORMAT_BGRX + .data = {[0] = (uint8_t *)pixels}, + .linesize = {[0] = 20 * 4}, + .width = 20, + .height = 20, + .format = VIDEO_FORMAT_BGRX, }; while (os_event_try(rt->stop_signal) == EAGAIN) { @@ -98,10 +98,10 @@ } struct obs_source_info test_random = { - .id = "random", - .type = OBS_SOURCE_TYPE_INPUT, + .id = "random", + .type = OBS_SOURCE_TYPE_INPUT, .output_flags = OBS_SOURCE_ASYNC_VIDEO, - .get_name = random_getname, - .create = random_create, - .destroy = random_destroy, + .get_name = random_getname, + .create = random_create, + .destroy = random_destroy, };
View file
obs-studio-23.2.1.tar.xz/test/test-input/test-sinewave.c -> obs-studio-24.0.0.tar.xz/test/test-input/test-sinewave.c
Changed
@@ -5,20 +5,20 @@ #include <obs.h> struct sinewave_data { - bool initialized_thread; - pthread_t thread; - os_event_t *event; + bool initialized_thread; + pthread_t thread; + os_event_t *event; obs_source_t *source; }; /* middle C */ -static const double rate = 261.63/48000.0; +static const double rate = 261.63 / 48000.0; #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 #endif -#define M_PI_X2 M_PI*2 +#define M_PI_X2 M_PI * 2 static void *sinewave_thread(void *pdata) { @@ -38,7 +38,7 @@ cos_val -= M_PI_X2; double wave = cos(cos_val) * 0.5; - bytes[i] = (uint8_t)((wave+1.0)*0.5 * 255.0); + bytes[i] = (uint8_t)((wave + 1.0) * 0.5 * 255.0); } struct obs_source_audio data; @@ -80,8 +80,7 @@ } } -static void *sinewave_create(obs_data_t *settings, - obs_source_t *source) +static void *sinewave_create(obs_data_t *settings, obs_source_t *source) { struct sinewave_data *swd = bzalloc(sizeof(struct sinewave_data)); swd->source = source; @@ -102,10 +101,10 @@ } struct obs_source_info test_sinewave = { - .id = "test_sinewave", - .type = OBS_SOURCE_TYPE_INPUT, + .id = "test_sinewave", + .type = OBS_SOURCE_TYPE_INPUT, .output_flags = OBS_SOURCE_AUDIO, - .get_name = sinewave_getname, - .create = sinewave_create, - .destroy = sinewave_destroy, + .get_name = sinewave_getname, + .create = sinewave_create, + .destroy = sinewave_destroy, };
View file
obs-studio-23.2.1.tar.xz/test/win/test.cpp -> obs-studio-24.0.0.tar.xz/test/win/test.cpp
Changed
@@ -19,8 +19,8 @@ public: inline SourceContext(obs_source_t *source) : source(source) {} - inline ~SourceContext() {obs_source_release(source);} - inline operator obs_source_t*() {return source;} + inline ~SourceContext() { obs_source_release(source); } + inline operator obs_source_t *() { return source; } }; /* --------------------------------------------------- */ @@ -30,8 +30,8 @@ public: inline SceneContext(obs_scene_t *scene) : scene(scene) {} - inline ~SceneContext() {obs_scene_release(scene);} - inline operator obs_scene_t*() {return scene;} + inline ~SceneContext() { obs_scene_release(scene); } + inline operator obs_scene_t *() { return scene; } }; /* --------------------------------------------------- */ @@ -41,14 +41,14 @@ public: inline DisplayContext(obs_display_t *display) : display(display) {} - inline ~DisplayContext() {obs_display_destroy(display);} - inline operator obs_display_t*() {return display;} + inline ~DisplayContext() { obs_display_destroy(display); } + inline operator obs_display_t *() { return display; } }; /* --------------------------------------------------- */ static LRESULT CALLBACK sceneProc(HWND hwnd, UINT message, WPARAM wParam, - LPARAM lParam) + LPARAM lParam) { switch (message) { @@ -86,15 +86,15 @@ throw "Couldn't create OBS"; struct obs_video_info ovi; - ovi.adapter = 0; - ovi.base_width = rc.right; - ovi.base_height = rc.bottom; - ovi.fps_num = 30000; - ovi.fps_den = 1001; + ovi.adapter = 0; + ovi.base_width = rc.right; + ovi.base_height = rc.bottom; + ovi.fps_num = 30000; + ovi.fps_den = 1001; ovi.graphics_module = DL_OPENGL; - ovi.output_format = VIDEO_FORMAT_RGBA; - ovi.output_width = rc.right; - ovi.output_height = rc.bottom; + ovi.output_format = VIDEO_FORMAT_RGBA; + ovi.output_width = rc.right; + ovi.output_height = rc.bottom; if (obs_reset_video(&ovi) != 0) throw "Couldn't initialize video"; @@ -133,17 +133,17 @@ memset(&wc, 0, sizeof(wc)); wc.lpszClassName = TEXT("bla"); wc.hbrBackground = (HBRUSH)COLOR_WINDOW; - wc.hInstance = instance; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.lpfnWndProc = (WNDPROC)sceneProc; + wc.hInstance = instance; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.lpfnWndProc = (WNDPROC)sceneProc; if (!RegisterClass(&wc)) return 0; return CreateWindow(TEXT("bla"), TEXT("bla"), - WS_OVERLAPPEDWINDOW|WS_VISIBLE, - 1920/2 - cx/2, 1080/2 - cy/2, cx, cy, - NULL, NULL, instance, NULL); + WS_OVERLAPPEDWINDOW | WS_VISIBLE, 1920 / 2 - cx / 2, + 1080 / 2 - cy / 2, cx, cy, NULL, NULL, instance, + NULL); } /* --------------------------------------------------- */ @@ -160,7 +160,7 @@ /* --------------------------------------------------- */ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdLine, - int numCmd) + int numCmd) { HWND hwnd = NULL; base_set_log_handler(do_log, nullptr); @@ -180,15 +180,15 @@ /* ------------------------------------------------------ */ /* create source */ - SourceContext source = obs_source_create("random", - "some randon source", NULL, nullptr); + SourceContext source = obs_source_create( + "random", "some randon source", NULL, nullptr); if (!source) throw "Couldn't create random test source"; /* ------------------------------------------------------ */ /* create filter */ - SourceContext filter = obs_source_create("test_filter", - "a nice green filter", NULL, nullptr); + SourceContext filter = obs_source_create( + "test_filter", "a nice green filter", NULL, nullptr); if (!filter) throw "Couldn't create test filter"; obs_source_filter_add(source, filter);
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.