├── InstantReplay.VC.db ├── InstantReplay.cpp ├── InstantReplay.h ├── InstantReplay.vcxproj ├── InstantReplay.vcxproj.filters ├── InstantReplay_callout.cpp ├── InstantReplay_callout.h ├── Makefile ├── README.md ├── audio_io_state.cpp ├── audio_io_state.h ├── en-US.ini ├── moc_InstantReplay_callout.cpp ├── module-entrance.cpp ├── obs-frontend-api └── obs-frontend-api.h ├── qt5old_moc_InstantReplay_callout.cpp └── ui_InstantReplay_callback.h /InstantReplay.VC.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adocilesloth/InstantReplay/6124dd3c1847702a22c67c494107841a58724e1b/InstantReplay.VC.db -------------------------------------------------------------------------------- /InstantReplay.cpp: -------------------------------------------------------------------------------- 1 | /******************************************* 2 | A Docile Sloth 2017 (adocilesloth@gmail.com) 3 | *******************************************/ 4 | #include "InstantReplay.h" 5 | #include "audio_io_state.h" 6 | #include 7 | #include 8 | 9 | //#include 10 | 11 | std::thread replay; 12 | std::atomic doReplay(false); 13 | 14 | obs_hotkey_id id; 15 | 16 | //Sleep function 17 | #ifdef _WIN32 18 | #include 19 | void psleep(unsigned milliseconds) 20 | { 21 | Sleep(milliseconds); 22 | } 23 | #else 24 | #include 25 | 26 | void psleep(unsigned milliseconds) 27 | { 28 | usleep(milliseconds * 1000); // takes microseconds 29 | } 30 | #endif 31 | 32 | void replayThread() 33 | { 34 | while(true) 35 | { 36 | while(!doReplay) 37 | { 38 | psleep(33); 39 | } 40 | 41 | if(get_enabled()) 42 | { 43 | //Pause to allow file to write 44 | int wait = get_wait(); 45 | psleep(wait); 46 | //Get Origin Scene 47 | obs_source_t* original_scene = obs_frontend_get_current_scene(); 48 | if(original_scene == nullptr) 49 | { 50 | return; 51 | } 52 | const char *sceneUsedName = obs_source_get_name(original_scene); 53 | obs_source_release(original_scene); 54 | 55 | //Switch to Replay 56 | obs_source_t* replay_scene = obs_get_source_by_name(get_scene().c_str()); 57 | obs_frontend_set_current_scene(replay_scene); 58 | obs_source_release(replay_scene); 59 | 60 | //wait for transition to end 61 | int pause = get_pause(); 62 | psleep(pause); 63 | 64 | //mute mic and desktop 65 | bool chan1, chan2, chan3, chan4, chan5; 66 | if(get_D_mute()) 67 | { 68 | get_desktop_mute(chan1, chan2); 69 | set_desktop_mute(true); 70 | } 71 | if(get_A_mute()) 72 | { 73 | get_aux_mute(chan3, chan4, chan5); 74 | set_aux_mute(true); 75 | } 76 | 77 | //Wait for replay to finish 78 | int replay_time = get_replay() - (2 * pause); 79 | psleep(replay_time); 80 | 81 | //Switch back to origional scene 82 | original_scene = obs_get_source_by_name(sceneUsedName); 83 | obs_frontend_set_current_scene(original_scene); 84 | obs_source_release(original_scene); 85 | 86 | //allow transition 87 | psleep(pause); 88 | 89 | //unmute mic and desktop 90 | if(get_D_mute()) 91 | { 92 | set_desktop_mute(chan1, chan2); 93 | } 94 | if(get_A_mute()) 95 | { 96 | set_aux_mute(chan3, chan4, chan5); 97 | } 98 | 99 | doReplay = false; 100 | } 101 | } 102 | } 103 | 104 | void replayStartup() 105 | { 106 | replay = std::thread(replayThread); 107 | return; 108 | } 109 | 110 | void instant_replay_hotkey(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey, bool pressed) 111 | { 112 | UNUSED_PARAMETER(id); 113 | UNUSED_PARAMETER(hotkey); 114 | 115 | if(pressed && obs_frontend_replay_buffer_active()) 116 | { 117 | doReplay = true; 118 | } 119 | } 120 | 121 | void instant_replay_save(obs_data_t *save_data, bool saving, void *) 122 | { 123 | if(saving) 124 | { 125 | obs_data_t *obj = obs_data_create(); 126 | obs_data_set_array(obj, "hotkey", obs_hotkey_save(id)); 127 | obs_data_set_obj(save_data, "InstantReplay", obj); 128 | obs_data_release(obj); 129 | } 130 | else 131 | { 132 | id = obs_hotkey_register_frontend("Instat Replay", "Instant Replay", instant_replay_hotkey, NULL); 133 | 134 | obs_data_t *obj = obs_data_get_obj(save_data, "InstantReplay"); 135 | if(!obj) 136 | { 137 | obj = obs_data_create(); 138 | } 139 | obs_hotkey_load(id, obs_data_get_array(obj, "hotkey")); 140 | obs_data_release(obj); 141 | } 142 | } 143 | 144 | void instant_replay_callback(enum obs_frontend_event event, void *private_data) 145 | { 146 | if(event == OBS_FRONTEND_EVENT_EXIT) 147 | { 148 | obs_frontend_save(); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /InstantReplay.h: -------------------------------------------------------------------------------- 1 | /******************************************* 2 | A Docile Sloth 2017 (adocilesloth@gmail.com) 3 | *******************************************/ 4 | #pragma once 5 | #include 6 | #include 7 | #include 8 | 9 | void replayStartup(); 10 | void instant_replay_hotkey(void*, obs_hotkey_id, obs_hotkey_t*, bool); 11 | void instant_replay_save(obs_data_t *save_data, bool saving, void *); 12 | 13 | bool get_enabled(); 14 | int get_wait(); 15 | int get_pause(); 16 | int get_replay(); 17 | std::string get_scene(); 18 | bool get_D_mute(); 19 | bool get_A_mute(); 20 | void replay_callout_init(); 21 | -------------------------------------------------------------------------------- /InstantReplay.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {1FF2275C-0C0C-4EAB-B49B-E7D37D27BEC9} 23 | Win32Proj 24 | InstantReplay 25 | 10.0 26 | 27 | 28 | 29 | DynamicLibrary 30 | true 31 | v143 32 | Unicode 33 | 34 | 35 | DynamicLibrary 36 | false 37 | v143 38 | true 39 | Unicode 40 | 41 | 42 | DynamicLibrary 43 | true 44 | v143 45 | Unicode 46 | 47 | 48 | DynamicLibrary 49 | false 50 | v143 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | 84 | 85 | 86 | 87 | 88 | Level3 89 | Disabled 90 | WIN32;_DEBUG;_WINDOWS;_USRDLL;INSTANTREPLAY_EXPORTS;%(PreprocessorDefinitions) 91 | 92 | 93 | Windows 94 | true 95 | 96 | 97 | 98 | 99 | 100 | 101 | Level3 102 | Disabled 103 | _DEBUG;_WINDOWS;_USRDLL;INSTANTREPLAY_EXPORTS;%(PreprocessorDefinitions) 104 | 105 | 106 | Windows 107 | true 108 | 109 | 110 | 111 | 112 | Level3 113 | 114 | 115 | MaxSpeed 116 | true 117 | true 118 | WIN32;NDEBUG;_WINDOWS;_USRDLL;INSTANTREPLAY_EXPORTS;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_NO_DEBUG;%(PreprocessorDefinitions) 119 | D:\OBS\obs-studio\libobs;D:\OBS\obs-studio\UI\obs-frontend-api;D:\Qt\5.9\msvc2015\include;D:\Qt\5.9\msvc2015\include\QtWidgets;D:\Qt\5.9\msvc2015\include\QtGui;D:\Qt\5.9\msvc2015\include\QtANGLE;D:\Qt\5.9\msvc2015\include\QtCore;D:\Qt\5.9\msvc2015\.\mkspecs\win32-msvc;%(AdditionalIncludeDirectories) 120 | 121 | 122 | Windows 123 | true 124 | true 125 | true 126 | D:\OBS\build32\UI\obs-frontend-api\Release;D:\OBS\build32\libobs\Release;%(AdditionalLibraryDirectories) 127 | obs-frontend-api.lib;obs.lib;D:\Qt\5.9\msvc2015\lib\Qt5Widgets.lib;D:\Qt\5.9\msvc2015\lib\Qt5Gui.lib;D:\Qt\5.9\msvc2015\lib\Qt5Core.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) 128 | 129 | 130 | 131 | 132 | Level3 133 | 134 | 135 | MaxSpeed 136 | true 137 | true 138 | NDEBUG;_WINDOWS;_USRDLL;INSTANTREPLAY_EXPORTS;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_NO_DEBUG;%(PreprocessorDefinitions) 139 | D:\OBS\obs-studio\libobs;D:\OBS\obs-studio\UI\obs-frontend-api;D:\OBS\obs-build-dependencies\windows-deps-2022-08-02-x64\include;D:\OBS\obs-build-dependencies\windows-deps-2022-08-02-x64\include\QtWidgets;D:\OBS\obs-build-dependencies\windows-deps-2022-08-02-x64\include\QtGui;D:\OBS\obs-build-dependencies\windows-deps-2022-08-02-x64\include\QtCore;D:\OBS\obs-build-dependencies\windows-deps-2022-08-02-x64\mkspecs\win32-msvc;%(AdditionalIncludeDirectories) 140 | stdcpp20 141 | -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 142 | 143 | 144 | Windows 145 | true 146 | true 147 | true 148 | D:\OBS\obs-build-dependencies\windows-deps-2022-08-02-x64\lib;D:\OBS\obs-studio\build64\UI\obs-frontend-api\Release;D:\OBS\obs-studio\build64\libobs\Release;%(AdditionalLibraryDirectories) 149 | obs-frontend-api.lib;obs.lib;Qt6Widgets.lib;Qt6Gui.lib;Qt6Core.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /InstantReplay.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | Header Files 43 | 44 | 45 | Header Files 46 | 47 | 48 | -------------------------------------------------------------------------------- /InstantReplay_callout.cpp: -------------------------------------------------------------------------------- 1 | #include "InstantReplay_callout.h" 2 | #include "InstantReplay.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | //#include 8 | #include 9 | 10 | #include 11 | 12 | replayCallout *co; 13 | 14 | bool get_enabled() 15 | { 16 | return co->ui->enableCheck->isChecked(); 17 | } 18 | 19 | int get_wait() 20 | { 21 | return co->ui->waitSpinBox->value() * 1000; 22 | } 23 | 24 | int get_pause() 25 | { 26 | return co->ui->pauseSpinBox->value(); 27 | } 28 | 29 | int get_replay() 30 | { 31 | return co->ui->replaySpinBox->value() * 1000; 32 | } 33 | 34 | std::string get_scene() 35 | { 36 | return co->ui->sceneLineEdit->text().toStdString(); 37 | } 38 | 39 | bool get_D_mute() 40 | { 41 | return co->ui->muteDCheck->isChecked(); 42 | } 43 | 44 | bool get_A_mute() 45 | { 46 | return co->ui->muteACheck->isChecked(); 47 | } 48 | 49 | replayCallout::replayCallout(QWidget *parent) 50 | : QDialog(parent), 51 | ui(new Ui_replayCallout) 52 | { 53 | ui->setupUi(this); 54 | 55 | QObject::connect(ui->closeButton->button(QDialogButtonBox::Close), 56 | SIGNAL(clicked()), this, SLOT(hide())); 57 | } 58 | 59 | void replayCallout::ShowHideDialog() 60 | { 61 | if(!isVisible()) 62 | { 63 | setVisible(true); 64 | } 65 | else 66 | { 67 | setVisible(false); 68 | } 69 | } 70 | 71 | void replayCallout::closeEvent(QCloseEvent* event) 72 | { 73 | obs_frontend_save(); 74 | } 75 | 76 | static void save_replay_callout(obs_data_t *save_data, bool saving, void *) 77 | { 78 | if(saving) 79 | { 80 | obs_data_t *obj = obs_data_create(); 81 | QString qstr; 82 | std::string str; 83 | 84 | obs_data_set_bool(obj, "enable", co->ui->enableCheck->isChecked()); 85 | obs_data_set_int(obj, "wait", co->ui->waitSpinBox->value()); 86 | obs_data_set_int(obj, "pause", co->ui->pauseSpinBox->value()); 87 | obs_data_set_int(obj, "replay", co->ui->replaySpinBox->value()); 88 | qstr = co->ui->sceneLineEdit->text(); 89 | str = qstr.toStdString(); 90 | obs_data_set_string(obj, "scene", str.c_str()); 91 | obs_data_set_bool(obj, "Dmute", co->ui->muteDCheck->isChecked()); 92 | obs_data_set_bool(obj, "Amute", co->ui->muteACheck->isChecked()); 93 | 94 | obs_data_set_obj(save_data, "replayCallout_data", obj); 95 | 96 | obs_data_release(obj); 97 | } 98 | else 99 | { 100 | obs_data_t *obj = obs_data_get_obj(save_data, "replayCallout_data"); 101 | QString qstr; 102 | if(!obj) 103 | { 104 | obj = obs_data_create(); 105 | } 106 | co->ui->enableCheck->setChecked(obs_data_get_bool(obj, "enable")); 107 | co->ui->waitSpinBox->setValue(obs_data_get_int(obj, "wait")); 108 | co->ui->pauseSpinBox->setValue(obs_data_get_int(obj, "pause")); 109 | co->ui->replaySpinBox->setValue(obs_data_get_int(obj, "replay")); 110 | qstr = QString::fromLocal8Bit(obs_data_get_string(obj, "scene")); 111 | co->ui->sceneLineEdit->setText(qstr); 112 | co->ui->muteDCheck->setChecked(obs_data_get_bool(obj, "Dmute")); 113 | co->ui->muteACheck->setChecked(obs_data_get_bool(obj, "Amute")); 114 | 115 | obs_data_release(obj); 116 | } 117 | } 118 | 119 | static void replay_callout_event(enum obs_frontend_event event, void *) 120 | { 121 | if(event == OBS_FRONTEND_EVENT_EXIT) 122 | { 123 | obs_frontend_save(); 124 | } 125 | } 126 | 127 | void replay_callout_init() 128 | { 129 | QAction *action = (QAction*)obs_frontend_add_tools_menu_qaction( 130 | obs_module_text("InstantReplaySettings")); 131 | 132 | obs_frontend_push_ui_translation(obs_module_get_string); 133 | 134 | QMainWindow *window = (QMainWindow*)obs_frontend_get_main_window(); 135 | 136 | co = new replayCallout(window); 137 | 138 | auto cb = []() 139 | { 140 | co->ShowHideDialog(); 141 | }; 142 | 143 | obs_frontend_pop_ui_translation(); 144 | 145 | obs_frontend_add_event_callback(replay_callout_event, nullptr); 146 | obs_frontend_add_save_callback(save_replay_callout, nullptr); 147 | 148 | action->connect(action, &QAction::triggered, cb); 149 | } 150 | -------------------------------------------------------------------------------- /InstantReplay_callout.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | //#include 3 | #include 4 | #include 5 | 6 | #include "ui_InstantReplay_callback.h" 7 | 8 | class QCloseEvent; 9 | 10 | class replayCallout : public QDialog { 11 | Q_OBJECT 12 | 13 | public: 14 | std::unique_ptr ui; 15 | replayCallout(QWidget *parent); 16 | 17 | void closeEvent(QCloseEvent *event) override; 18 | 19 | public slots: 20 | void ShowHideDialog(); 21 | 22 | private: 23 | //Nothing here 24 | }; 25 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #-#-#MODIFY THESE TO MATCH YOUR SYSTEM AND INSTALLATION#-#-# 2 | ifndef OBS_INCLUDE 3 | OBS_INCLUDE = /usr/include/obs 4 | endif 5 | ifndef OBS_API_INCLUDE 6 | OBS_API_INCLUDE = ./obs-frontend-api 7 | endif 8 | ifndef OBS_LIB 9 | OBS_LIB = /usr/lib 10 | endif 11 | ifndef OBS_SHARE 12 | OBS_SHARE = /usr/share/obs 13 | endif 14 | ifndef QT_INCLUDE 15 | QT_INCLUDE = $(HOME)/Qt6/6.2.4/gcc_64/include 16 | endif 17 | ifndef QT_LIB 18 | QT_LIB = $(HOME)/Qt6/6.2.4/gcc_64/lib 19 | endif 20 | #-#-#END MODIFY#-#-# 21 | 22 | CXX = g++ 23 | CXXFLAGS = -g -Wall -std=c++20 -fPIC -DQT_NO_VERSION_TAGGING 24 | 25 | INCLUDE = -I$(OBS_INCLUDE) -I$(OBS_API_INCLUDE) -I$(QT_INCLUDE) 26 | LDFLAGS = -L$(OBS_LIB) -L$(QT_LIB) 27 | LDLIBS_LIB = -lobs -lQt6Widgets -lQt6Gui -lQt6Core 28 | 29 | LIB = InstantReplay.so 30 | LIB_OBJ = module-entrance.o InstantReplay.o InstantReplay_callout.o ui_InstantReplay_callout.o audio_io_state.o 31 | SRC = module-entrance.cpp InstantReplay.cpp InstantReplay_callout.cpp moc_InstantReplay_callout.cpp audio_io_state.cpp 32 | 33 | all: $(LIB) 34 | 35 | #$(LIB): module-entrance.o InstantReplay.o InstantReplay_callout.o ui_InstantReplay_callout.o#$(LIB_OBJ) 36 | $(LIB): $(LIB_OBJ) 37 | $(CXX) -shared $(LDFLAGS) $(LDLIBS_LIB) -o $@ $^ 38 | 39 | module-entrance.o: module-entrance.cpp 40 | $(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $< 41 | 42 | InstantReplay.o: InstantReplay.cpp 43 | $(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $< 44 | 45 | InstantReplay_callout.o: InstantReplay_callout.cpp 46 | $(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $< 47 | 48 | ui_InstantReplay_callout.o: moc_InstantReplay_callout.cpp 49 | $(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $< 50 | 51 | audio_io_state.o: audio_io_state.cpp 52 | $(CXX) $(CXXFLAGS) $(INCLUDE) -c -o $@ $< 53 | 54 | 55 | .PHONY: install 56 | install: 57 | mkdir -p $(HOME)/.config/obs-studio/plugins/InstantReplay/bin/64bit 58 | mkdir -p $(HOME)/.config/obs-studio/plugins/InstantReplay/locale 59 | cp $(LIB) $(HOME)/.config/obs-studio/plugins/InstantReplay/bin/64bit/ 60 | cp en-US.ini $(HOME)/.config/obs-studio/plugins/InstantReplay/locale/ 61 | 62 | .PHONY: clean 63 | clean: 64 | rm ./$(LIB_OBJ) 65 | rm ./$(LIB) 66 | 67 | .PHONY: uninstall 68 | uninstall: 69 | rm -r $(HOME)/.config/obs-studio/plugins/InstantReplay 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Instant Replay 2 | 3 | Plugin to allow Instant Replays 4 | It basically combines the "Automatic Scene Switching" and "Per Scene Volume" 5 | (from OBS Classic) plugins to allow instant replays in live streams. 6 | 7 | **===WINDOWS===** 8 | Windows is built and working for 64bit 9 | 10 | Drag and drop obs-studio folder into C:\Program Files 11 | (or wher ever you have obs-studio installed) 12 | Merge all files down and you should be good to go. 13 | 14 | **===LINUX===** 15 | Dependancies: 16 | OBS (duh) 17 | Qt6 dev 18 | 19 | Clone the git repo: 20 | `git clone https://github.com/adocilesloth/InstantReplay.git` 21 | 22 | cd to where you downloaded the source 23 | 24 | Check the environment PATHS in Makefile 25 | Make sure they match your OBS and Qt6 installations and fix if necessary. 26 | (`OBS_API_INCLUDE` will not need updating as the files are in the git repo) 27 | 28 | Then run: 29 | ``` 30 | make 31 | make install 32 | make clean (optional: if you want to remove the temporary .o and .so files) 33 | ``` 34 | 35 | Ubuntu 22.04 is built and working for 64bit 36 | 37 | Drag and drop obs-studio folder into ~/.config 38 | Merge all files down and you should be goof to go. 39 | 40 | **===MAC===** 41 | Uh, sould work. Probably. Don't have a MAC to test with. 42 | So... 43 | You can try the LINUX instructions. 44 | Let me know if you get it to work! 45 | 46 | **===SETUP===** 47 | Open the settings popup under: 48 | `Tools -> Instant Replay Settings` 49 | 50 | Fill in the below settings: 51 | `Enable` - Enables/disbale the plugins 52 | `Write Pause (s)` - Pause to allow OBS to write the replay file. 53 | OBS can't instantly write a file. ~10 seconds should be okay. 54 | Find something that works for you 55 | `Transition Pause (ms)` - Length of the transition in milliseconds. 56 | If the stinger is at 30fps, multiply the number of 57 | frames by 33. 58 | If the stinger is at 60fps, multiply the number of 59 | frames by 16. 60 | `Replay Length (s)` - Length of the replay in seconds. 61 | OBS does not always write as much replay as you tell it 62 | to so this may need to be a second or two shorter than 63 | the buffer length 64 | `Replay Scene` - Scene to switch to that has the replay source. 65 | `Mute Desktop Audio` - Mute the Desktop Audio channels when replay is playing. 66 | `Mute Mic/AUX` - Mute the Mic/Aux channels when replay is playing. 67 | 68 | Hit "OK" 69 | 70 | Open the Hotkeys under: 71 | `Settings -> Hotkeys` 72 | 73 | Find the `Instant Replay` hotkey 74 | Set it TO THE SAME KEY as you have `Save Replay` under `Replay Buffer` set to. 75 | 76 | Setting up the replay source: 77 | Set your Recording to a constant name (so remove all the % stuff). Makes it 78 | easy to point your replay source to a file that will exist. 79 | Point your Media Source to what your replay will be saved as. 80 | -------------------------------------------------------------------------------- /audio_io_state.cpp: -------------------------------------------------------------------------------- 1 | /******************************************* 2 | A Docile Sloth 2017 (adocilesloth@gmail.com) 3 | *******************************************/ 4 | #include 5 | 6 | //Desktop 7 | bool get_desktop_mute() 8 | { 9 | obs_source_t* sceneUsed = obs_get_output_source(1); 10 | if(sceneUsed) 11 | { 12 | if(obs_source_muted(sceneUsed)) 13 | { 14 | obs_source_release(sceneUsed); 15 | return true; 16 | } 17 | obs_source_release(sceneUsed); 18 | } 19 | sceneUsed = obs_get_output_source(2); 20 | if(sceneUsed) 21 | { 22 | if(obs_source_muted(sceneUsed)) 23 | { 24 | obs_source_release(sceneUsed); 25 | return true; 26 | } 27 | obs_source_release(sceneUsed); 28 | } 29 | return false; 30 | } 31 | 32 | void get_desktop_mute(bool &chan1, bool &chan2) 33 | { 34 | obs_source_t* sceneUsed = obs_get_output_source(1); 35 | if(sceneUsed) 36 | { 37 | chan1 = obs_source_muted(sceneUsed); 38 | obs_source_release(sceneUsed); 39 | } 40 | sceneUsed = obs_get_output_source(2); 41 | if(sceneUsed) 42 | { 43 | chan2 = obs_source_muted(sceneUsed); 44 | obs_source_release(sceneUsed); 45 | } 46 | return; 47 | } 48 | 49 | void toggle_desktop_mute() 50 | { 51 | obs_source_t* sceneUsed = obs_get_output_source(1); 52 | if(sceneUsed) 53 | { 54 | if(obs_source_muted(sceneUsed)) 55 | { 56 | obs_source_set_muted(sceneUsed, false); 57 | } 58 | else 59 | { 60 | obs_source_set_muted(sceneUsed, true); 61 | } 62 | obs_source_release(sceneUsed); 63 | } 64 | sceneUsed = obs_get_output_source(2); 65 | if(sceneUsed) 66 | { 67 | if(obs_source_muted(sceneUsed)) 68 | { 69 | obs_source_set_muted(sceneUsed, false); 70 | } 71 | else 72 | { 73 | obs_source_set_muted(sceneUsed, true); 74 | } 75 | obs_source_release(sceneUsed); 76 | } 77 | return; 78 | } 79 | 80 | void set_desktop_mute(bool chan0) 81 | { 82 | obs_source_t* sceneUsed = obs_get_output_source(1); 83 | if(sceneUsed) 84 | { 85 | obs_source_set_muted(sceneUsed, chan0); 86 | obs_source_release(sceneUsed); 87 | } 88 | sceneUsed = obs_get_output_source(2); 89 | if(sceneUsed) 90 | { 91 | obs_source_set_muted(sceneUsed, chan0); 92 | obs_source_release(sceneUsed); 93 | } 94 | return; 95 | } 96 | 97 | void set_desktop_mute(bool chan1, bool chan2) 98 | { 99 | obs_source_t* sceneUsed = obs_get_output_source(1); 100 | if(sceneUsed) 101 | { 102 | obs_source_set_muted(sceneUsed, chan1); 103 | obs_source_release(sceneUsed); 104 | } 105 | sceneUsed = obs_get_output_source(2); 106 | if(sceneUsed) 107 | { 108 | obs_source_set_muted(sceneUsed, chan2); 109 | obs_source_release(sceneUsed); 110 | } 111 | return; 112 | } 113 | 114 | //Auxillary / Mic 115 | bool get_aux_mute() 116 | { 117 | obs_source_t* sceneUsed = obs_get_output_source(3); 118 | if(sceneUsed) 119 | { 120 | if(obs_source_muted(sceneUsed)) 121 | { 122 | obs_source_release(sceneUsed); 123 | return true; 124 | } 125 | obs_source_release(sceneUsed); 126 | } 127 | sceneUsed = obs_get_output_source(4); 128 | if(sceneUsed) 129 | { 130 | if(obs_source_muted(sceneUsed)) 131 | { 132 | obs_source_release(sceneUsed); 133 | return true; 134 | } 135 | obs_source_release(sceneUsed); 136 | } 137 | sceneUsed = obs_get_output_source(5); 138 | if(sceneUsed) 139 | { 140 | if(obs_source_muted(sceneUsed)) 141 | { 142 | obs_source_release(sceneUsed); 143 | return true; 144 | } 145 | obs_source_release(sceneUsed); 146 | } 147 | return false; 148 | } 149 | 150 | void get_aux_mute(bool &chan3, bool &chan4, bool &chan5) 151 | { 152 | obs_source_t* sceneUsed = obs_get_output_source(3); 153 | if(sceneUsed) 154 | { 155 | chan3 = obs_source_muted(sceneUsed); 156 | obs_source_release(sceneUsed); 157 | } 158 | sceneUsed = obs_get_output_source(4); 159 | if(sceneUsed) 160 | { 161 | chan4 = obs_source_muted(sceneUsed); 162 | obs_source_release(sceneUsed); 163 | } 164 | sceneUsed = obs_get_output_source(5); 165 | if(sceneUsed) 166 | { 167 | chan5 = obs_source_muted(sceneUsed); 168 | obs_source_release(sceneUsed); 169 | } 170 | return; 171 | } 172 | 173 | void toggle_aux_mute() 174 | { 175 | obs_source_t* sceneUsed = obs_get_output_source(3); 176 | if(sceneUsed) 177 | { 178 | if(obs_source_muted(sceneUsed)) 179 | { 180 | obs_source_set_muted(sceneUsed, false); 181 | } 182 | else 183 | { 184 | obs_source_set_muted(sceneUsed, true); 185 | } 186 | obs_source_release(sceneUsed); 187 | } 188 | sceneUsed = obs_get_output_source(4); 189 | if(sceneUsed) 190 | { 191 | if(obs_source_muted(sceneUsed)) 192 | { 193 | obs_source_set_muted(sceneUsed, false); 194 | } 195 | else 196 | { 197 | obs_source_set_muted(sceneUsed, true); 198 | } 199 | obs_source_release(sceneUsed); 200 | } 201 | sceneUsed = obs_get_output_source(5); 202 | if(sceneUsed) 203 | { 204 | if(obs_source_muted(sceneUsed)) 205 | { 206 | obs_source_set_muted(sceneUsed, false); 207 | } 208 | else 209 | { 210 | obs_source_set_muted(sceneUsed, true); 211 | } 212 | obs_source_release(sceneUsed); 213 | } 214 | return; 215 | } 216 | 217 | void set_aux_mute(bool chan0) 218 | { 219 | obs_source_t* sceneUsed = obs_get_output_source(3); 220 | if(sceneUsed) 221 | { 222 | obs_source_set_muted(sceneUsed, chan0); 223 | obs_source_release(sceneUsed); 224 | } 225 | sceneUsed = obs_get_output_source(4); 226 | if(sceneUsed) 227 | { 228 | obs_source_set_muted(sceneUsed, chan0); 229 | obs_source_release(sceneUsed); 230 | } 231 | sceneUsed = obs_get_output_source(5); 232 | if(sceneUsed) 233 | { 234 | obs_source_set_muted(sceneUsed, chan0); 235 | obs_source_release(sceneUsed); 236 | } 237 | return; 238 | } 239 | 240 | void set_aux_mute(bool chan3, bool chan4, bool chan5) 241 | { 242 | obs_source_t* sceneUsed = obs_get_output_source(3); 243 | if(sceneUsed) 244 | { 245 | obs_source_set_muted(sceneUsed, chan3); 246 | obs_source_release(sceneUsed); 247 | } 248 | sceneUsed = obs_get_output_source(4); 249 | if(sceneUsed) 250 | { 251 | obs_source_set_muted(sceneUsed, chan4); 252 | obs_source_release(sceneUsed); 253 | } 254 | sceneUsed = obs_get_output_source(5); 255 | if(sceneUsed) 256 | { 257 | obs_source_set_muted(sceneUsed, chan5); 258 | obs_source_release(sceneUsed); 259 | } 260 | return; 261 | } -------------------------------------------------------------------------------- /audio_io_state.h: -------------------------------------------------------------------------------- 1 | /******************************************* 2 | A Docile Sloth 2017 (adocilesloth@gmail.com) 3 | *******************************************/ 4 | #pragma once 5 | //Desktop 6 | bool get_desktop_mute(); 7 | void get_desktop_mute(bool &chan1, bool &chan2); 8 | void toggle_desktop_mute(); 9 | void set_desktop_mute(bool chan0); 10 | void set_desktop_mute(bool chan1, bool chan2); 11 | 12 | //Auxillary / Mic; 13 | bool get_aux_mute(); 14 | void get_aux_mute(bool &chan3, bool &chan4, bool &chan5); 15 | void toggle_aux_mute(); 16 | void set_aux_mute(bool chan0); 17 | void set_aux_mute(bool chan3, bool chan4, bool chan5); 18 | -------------------------------------------------------------------------------- /en-US.ini: -------------------------------------------------------------------------------- 1 | InstantReplaySettings="Instant Replay Settings" 2 | InstantReplay="Instant Replay" 3 | Enable="Enable" 4 | WritePause="Write Pause (s)" 5 | TransitionPause="Transition Pause (ms)" 6 | ReplayLength="Replay Length (s)" 7 | ReplayScene="Replay Scene" 8 | -------------------------------------------------------------------------------- /moc_InstantReplay_callout.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'InstantReplay_callout.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 68 (Qt 6.3.2) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include 10 | #include "InstantReplay_callout.h" 11 | #include 12 | #include 13 | #if !defined(Q_MOC_OUTPUT_REVISION) 14 | #error "The header file 'InstantReplay_callout.h' doesn't include ." 15 | #elif Q_MOC_OUTPUT_REVISION != 68 16 | #error "This file was generated using the moc from 6.3.2. It" 17 | #error "cannot be used with the include files from this version of Qt." 18 | #error "(The moc has changed too much.)" 19 | #endif 20 | 21 | QT_BEGIN_MOC_NAMESPACE 22 | QT_WARNING_PUSH 23 | QT_WARNING_DISABLE_DEPRECATED 24 | struct qt_meta_stringdata_replayCallout_t { 25 | uint offsetsAndSizes[6]; 26 | char stringdata0[14]; 27 | char stringdata1[15]; 28 | char stringdata2[1]; 29 | }; 30 | #define QT_MOC_LITERAL(ofs, len) \ 31 | uint(sizeof(qt_meta_stringdata_replayCallout_t::offsetsAndSizes) + ofs), len 32 | static const qt_meta_stringdata_replayCallout_t qt_meta_stringdata_replayCallout = { 33 | { 34 | QT_MOC_LITERAL(0, 13), // "replayCallout" 35 | QT_MOC_LITERAL(14, 14), // "ShowHideDialog" 36 | QT_MOC_LITERAL(29, 0) // "" 37 | }, 38 | "replayCallout", 39 | "ShowHideDialog", 40 | "" 41 | }; 42 | #undef QT_MOC_LITERAL 43 | 44 | static const uint qt_meta_data_replayCallout[] = { 45 | 46 | // content: 47 | 10, // revision 48 | 0, // classname 49 | 0, 0, // classinfo 50 | 1, 14, // methods 51 | 0, 0, // properties 52 | 0, 0, // enums/sets 53 | 0, 0, // constructors 54 | 0, // flags 55 | 0, // signalCount 56 | 57 | // slots: name, argc, parameters, tag, flags, initial metatype offsets 58 | 1, 0, 20, 2, 0x0a, 1 /* Public */, 59 | 60 | // slots: parameters 61 | QMetaType::Void, 62 | 63 | 0 // eod 64 | }; 65 | 66 | void replayCallout::qt_static_metacall(QObject* _o, QMetaObject::Call _c, int _id, void** _a) 67 | { 68 | if (_c == QMetaObject::InvokeMetaMethod) { 69 | auto* _t = static_cast(_o); 70 | (void)_t; 71 | switch (_id) { 72 | case 0: _t->ShowHideDialog(); break; 73 | default:; 74 | } 75 | } 76 | (void)_a; 77 | } 78 | 79 | const QMetaObject replayCallout::staticMetaObject = { { 80 | QMetaObject::SuperData::link(), 81 | qt_meta_stringdata_replayCallout.offsetsAndSizes, 82 | qt_meta_data_replayCallout, 83 | qt_static_metacall, 84 | nullptr, 85 | qt_incomplete_metaTypeArray 87 | , QtPrivate::TypeAndForceComplete 88 | 89 | 90 | >, 91 | nullptr 92 | } }; 93 | 94 | 95 | const QMetaObject* replayCallout::metaObject() const 96 | { 97 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 98 | } 99 | 100 | void* replayCallout::qt_metacast(const char* _clname) 101 | { 102 | if (!_clname) return nullptr; 103 | if (!strcmp(_clname, qt_meta_stringdata_replayCallout.stringdata0)) 104 | return static_cast(this); 105 | return QDialog::qt_metacast(_clname); 106 | } 107 | 108 | int replayCallout::qt_metacall(QMetaObject::Call _c, int _id, void** _a) 109 | { 110 | _id = QDialog::qt_metacall(_c, _id, _a); 111 | if (_id < 0) 112 | return _id; 113 | if (_c == QMetaObject::InvokeMetaMethod) { 114 | if (_id < 1) 115 | qt_static_metacall(this, _c, _id, _a); 116 | _id -= 1; 117 | } 118 | else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 119 | if (_id < 1) 120 | *reinterpret_cast(_a[0]) = QMetaType(); 121 | _id -= 1; 122 | } 123 | return _id; 124 | } 125 | QT_WARNING_POP 126 | QT_END_MOC_NAMESPACE -------------------------------------------------------------------------------- /module-entrance.cpp: -------------------------------------------------------------------------------- 1 | /******************************************* 2 | A Docile Sloth 2017 (adocilesloth@gmail.com) 3 | *******************************************/ 4 | #include "InstantReplay.h" 5 | 6 | OBS_DECLARE_MODULE() 7 | OBS_MODULE_USE_DEFAULT_LOCALE("InstantReplay", "en-US") 8 | 9 | bool obs_module_load(void) 10 | { 11 | obs_frontend_add_save_callback(instant_replay_save, nullptr); 12 | replayStartup(); 13 | replay_callout_init(); 14 | return true; 15 | } 16 | 17 | void obs_module_unload(void) 18 | { 19 | return; 20 | } 21 | 22 | const char *obs_module_author(void) 23 | { 24 | return "A Docile Sloth"; 25 | } 26 | 27 | const char *obs_module_name(void) 28 | { 29 | return "Instant Replay"; 30 | } 31 | 32 | const char *obs_module_description(void) 33 | { 34 | return "Scene switching support for instant replays"; 35 | } 36 | -------------------------------------------------------------------------------- /obs-frontend-api/obs-frontend-api.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | struct config_data; 11 | typedef struct config_data config_t; 12 | 13 | struct obs_data; 14 | typedef struct obs_data obs_data_t; 15 | 16 | /* ------------------------------------------------------------------------- */ 17 | 18 | struct obs_frontend_source_list { 19 | DARRAY(obs_source_t*) sources; 20 | }; 21 | 22 | static inline void obs_frontend_source_list_free( 23 | struct obs_frontend_source_list *source_list) 24 | { 25 | size_t num = source_list->sources.num; 26 | for (size_t i = 0; i < num; i++) 27 | obs_source_release(source_list->sources.array[i]); 28 | da_free(source_list->sources); 29 | } 30 | 31 | /* ------------------------------------------------------------------------- */ 32 | 33 | /* NOTE: Functions that return char** string lists are a single allocation of 34 | * memory with pointers to itself. Free with a single call to bfree on the 35 | * base char** pointer. */ 36 | 37 | /* NOTE: User interface should not use typical Qt locale translation methods, 38 | * as the OBS UI bypasses it to use a custom translation implementation. Use 39 | * standard module translation methods, obs_module_text. For text in a Qt 40 | * window, use obs_frontend_push_ui_translation when the text is about to be 41 | * translated, and obs_frontend_pop_ui_translation when translation is 42 | * complete. */ 43 | 44 | EXPORT void *obs_frontend_get_main_window(void); 45 | EXPORT void *obs_frontend_get_main_window_handle(void); 46 | 47 | EXPORT char **obs_frontend_get_scene_names(void); 48 | EXPORT void obs_frontend_get_scenes(struct obs_frontend_source_list *sources); 49 | EXPORT obs_source_t *obs_frontend_get_current_scene(void); 50 | EXPORT void obs_frontend_set_current_scene(obs_source_t *scene); 51 | 52 | EXPORT void obs_frontend_get_transitions( 53 | struct obs_frontend_source_list *sources); 54 | EXPORT obs_source_t *obs_frontend_get_current_transition(void); 55 | EXPORT void obs_frontend_set_current_transition(obs_source_t *transition); 56 | 57 | EXPORT char **obs_frontend_get_scene_collections(void); 58 | EXPORT char *obs_frontend_get_current_scene_collection(void); 59 | EXPORT void obs_frontend_set_current_scene_collection(const char *collection); 60 | 61 | EXPORT char **obs_frontend_get_profiles(void); 62 | EXPORT char *obs_frontend_get_current_profile(void); 63 | EXPORT void obs_frontend_set_current_profile(const char *profile); 64 | 65 | EXPORT void obs_frontend_streaming_start(void); 66 | EXPORT void obs_frontend_streaming_stop(void); 67 | EXPORT bool obs_frontend_streaming_active(void); 68 | 69 | EXPORT void obs_frontend_recording_start(void); 70 | EXPORT void obs_frontend_recording_stop(void); 71 | EXPORT bool obs_frontend_recording_active(void); 72 | 73 | EXPORT void obs_frontend_replay_buffer_start(void); 74 | EXPORT void obs_frontend_replay_buffer_save(void); 75 | EXPORT void obs_frontend_replay_buffer_stop(void); 76 | EXPORT bool obs_frontend_replay_buffer_active(void); 77 | 78 | typedef void (*obs_frontend_cb)(void *private_data); 79 | 80 | EXPORT void *obs_frontend_add_tools_menu_qaction(const char *name); 81 | EXPORT void obs_frontend_add_tools_menu_item(const char *name, 82 | obs_frontend_cb callback, void *private_data); 83 | 84 | enum obs_frontend_event { 85 | OBS_FRONTEND_EVENT_STREAMING_STARTING, 86 | OBS_FRONTEND_EVENT_STREAMING_STARTED, 87 | OBS_FRONTEND_EVENT_STREAMING_STOPPING, 88 | OBS_FRONTEND_EVENT_STREAMING_STOPPED, 89 | OBS_FRONTEND_EVENT_RECORDING_STARTING, 90 | OBS_FRONTEND_EVENT_RECORDING_STARTED, 91 | OBS_FRONTEND_EVENT_RECORDING_STOPPING, 92 | OBS_FRONTEND_EVENT_RECORDING_STOPPED, 93 | OBS_FRONTEND_EVENT_SCENE_CHANGED, 94 | OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED, 95 | OBS_FRONTEND_EVENT_TRANSITION_CHANGED, 96 | OBS_FRONTEND_EVENT_TRANSITION_STOPPED, 97 | OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED, 98 | OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED, 99 | OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED, 100 | OBS_FRONTEND_EVENT_PROFILE_CHANGED, 101 | OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED, 102 | OBS_FRONTEND_EVENT_EXIT, 103 | 104 | OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTING, 105 | OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTED, 106 | OBS_FRONTEND_EVENT_REPLAY_BUFFER_STOPPING, 107 | OBS_FRONTEND_EVENT_REPLAY_BUFFER_STOPPED, 108 | 109 | OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED, 110 | OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED, 111 | OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED 112 | }; 113 | 114 | typedef void (*obs_frontend_event_cb)(enum obs_frontend_event event, 115 | void *private_data); 116 | 117 | EXPORT void obs_frontend_add_event_callback(obs_frontend_event_cb callback, 118 | void *private_data); 119 | EXPORT void obs_frontend_remove_event_callback(obs_frontend_event_cb callback, 120 | void *private_data); 121 | 122 | typedef void (*obs_frontend_save_cb)(obs_data_t *save_data, bool saving, 123 | void *private_data); 124 | 125 | EXPORT void obs_frontend_save(void); 126 | EXPORT void obs_frontend_add_save_callback(obs_frontend_save_cb callback, 127 | void *private_data); 128 | EXPORT void obs_frontend_remove_save_callback(obs_frontend_save_cb callback, 129 | void *private_data); 130 | 131 | EXPORT obs_output_t *obs_frontend_get_streaming_output(void); 132 | EXPORT obs_output_t *obs_frontend_get_recording_output(void); 133 | EXPORT obs_output_t *obs_frontend_get_replay_buffer_output(void); 134 | 135 | EXPORT config_t *obs_frontend_get_profile_config(void); 136 | EXPORT config_t *obs_frontend_get_global_config(void); 137 | 138 | typedef bool (*obs_frontend_translate_ui_cb)(const char *text, 139 | const char **out); 140 | 141 | EXPORT void obs_frontend_push_ui_translation( 142 | obs_frontend_translate_ui_cb translate); 143 | EXPORT void obs_frontend_pop_ui_translation(void); 144 | 145 | EXPORT void obs_frontend_set_streaming_service(obs_service_t *service); 146 | EXPORT obs_service_t* obs_frontend_get_streaming_service(void); 147 | EXPORT void obs_frontend_save_streaming_service(void); 148 | 149 | EXPORT bool obs_frontend_preview_program_mode_active(void); 150 | EXPORT void obs_frontend_set_preview_program_mode(bool enable); 151 | 152 | EXPORT obs_source_t *obs_frontend_get_current_preview_scene(void); 153 | EXPORT void obs_frontend_set_current_preview_scene(obs_source_t *scene); 154 | 155 | /* ------------------------------------------------------------------------- */ 156 | 157 | #ifdef __cplusplus 158 | } 159 | #endif 160 | -------------------------------------------------------------------------------- /qt5old_moc_InstantReplay_callout.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Meta object code from reading C++ file 'InstantReplay_callout.h' 3 | ** 4 | ** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.0) 5 | ** 6 | ** WARNING! All changes made in this file will be lost! 7 | *****************************************************************************/ 8 | 9 | #include "InstantReplay_callout.h" 10 | #include 11 | #include 12 | #if !defined(Q_MOC_OUTPUT_REVISION) 13 | #error "The header file 'InstantReplay_callout.h' doesn't include ." 14 | #elif Q_MOC_OUTPUT_REVISION != 67 15 | #error "This file was generated using the moc from 5.9.0. It" 16 | #error "cannot be used with the include files from this version of Qt." 17 | #error "(The moc has changed too much.)" 18 | #endif 19 | 20 | QT_BEGIN_MOC_NAMESPACE 21 | QT_WARNING_PUSH 22 | QT_WARNING_DISABLE_DEPRECATED 23 | struct qt_meta_stringdata_replayCallout_t { 24 | QByteArrayData data[3]; 25 | char stringdata0[30]; 26 | }; 27 | #define QT_MOC_LITERAL(idx, ofs, len) \ 28 | Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \ 29 | qptrdiff(offsetof(qt_meta_stringdata_replayCallout_t, stringdata0) + ofs \ 30 | - idx * sizeof(QByteArrayData)) \ 31 | ) 32 | static const qt_meta_stringdata_replayCallout_t qt_meta_stringdata_replayCallout = { 33 | { 34 | QT_MOC_LITERAL(0, 0, 13), // "replayCallout" 35 | QT_MOC_LITERAL(1, 14, 14), // "ShowHideDialog" 36 | QT_MOC_LITERAL(2, 29, 0) // "" 37 | 38 | }, 39 | "replayCallout\0ShowHideDialog\0" 40 | }; 41 | #undef QT_MOC_LITERAL 42 | 43 | static const uint qt_meta_data_replayCallout[] = { 44 | 45 | // content: 46 | 7, // revision 47 | 0, // classname 48 | 0, 0, // classinfo 49 | 1, 14, // methods 50 | 0, 0, // properties 51 | 0, 0, // enums/sets 52 | 0, 0, // constructors 53 | 0, // flags 54 | 0, // signalCount 55 | 56 | // slots: name, argc, parameters, tag, flags 57 | 1, 0, 19, 2, 0x0a /* Public */, 58 | 59 | // slots: parameters 60 | QMetaType::Void, 61 | 62 | 0 // eod 63 | }; 64 | 65 | void replayCallout::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a) 66 | { 67 | if (_c == QMetaObject::InvokeMetaMethod) { 68 | replayCallout *_t = static_cast(_o); 69 | Q_UNUSED(_t) 70 | switch (_id) { 71 | case 0: _t->ShowHideDialog(); break; 72 | default: ; 73 | } 74 | } 75 | Q_UNUSED(_a); 76 | } 77 | 78 | const QMetaObject replayCallout::staticMetaObject = { 79 | { &QDialog::staticMetaObject, qt_meta_stringdata_replayCallout.data, 80 | qt_meta_data_replayCallout, qt_static_metacall, nullptr, nullptr} 81 | }; 82 | 83 | 84 | const QMetaObject *replayCallout::metaObject() const 85 | { 86 | return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject; 87 | } 88 | 89 | void *replayCallout::qt_metacast(const char *_clname) 90 | { 91 | if (!_clname) return nullptr; 92 | if (!strcmp(_clname, qt_meta_stringdata_replayCallout.stringdata0)) 93 | return static_cast(const_cast< replayCallout*>(this)); 94 | return QDialog::qt_metacast(_clname); 95 | } 96 | 97 | int replayCallout::qt_metacall(QMetaObject::Call _c, int _id, void **_a) 98 | { 99 | _id = QDialog::qt_metacall(_c, _id, _a); 100 | if (_id < 0) 101 | return _id; 102 | if (_c == QMetaObject::InvokeMetaMethod) { 103 | if (_id < 1) 104 | qt_static_metacall(this, _c, _id, _a); 105 | _id -= 1; 106 | } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { 107 | if (_id < 1) 108 | *reinterpret_cast(_a[0]) = -1; 109 | _id -= 1; 110 | } 111 | return _id; 112 | } 113 | QT_WARNING_POP 114 | QT_END_MOC_NAMESPACE 115 | -------------------------------------------------------------------------------- /ui_InstantReplay_callback.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | //#include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | QT_BEGIN_NAMESPACE 18 | 19 | class Ui_replayCallout 20 | { 21 | public: 22 | QGridLayout *replayLayout; 23 | 24 | QLabel *enableLabel; 25 | QCheckBox *enableCheck; 26 | 27 | QLabel *waitLabel; 28 | QSpinBox *waitSpinBox; 29 | QLabel *pauseLabel; 30 | QSpinBox *pauseSpinBox; 31 | QLabel *replayLabel; 32 | QSpinBox *replaySpinBox; 33 | 34 | QLabel *sceneLabel; 35 | QLineEdit *sceneLineEdit; 36 | QLabel *sourceLabel; 37 | QLineEdit *sourceLineEdit; 38 | 39 | QLabel *muteDLabel; 40 | QCheckBox *muteDCheck; 41 | QLabel *muteALabel; 42 | QCheckBox *muteACheck; 43 | 44 | QDialogButtonBox *closeButton; 45 | 46 | void setupUi(QDialog *replayCallout) 47 | { 48 | if(replayCallout->objectName().isEmpty()) 49 | replayCallout->setObjectName(QStringLiteral("InstantReplay")); 50 | replayCallout->resize(200, 200); 51 | replayLayout = new QGridLayout(replayCallout); 52 | replayLayout->setObjectName(QStringLiteral("replayLayout")); 53 | 54 | enableLabel = new QLabel(replayCallout); 55 | enableLabel->setObjectName(QStringLiteral("enableLabel")); 56 | replayLayout->addWidget(enableLabel, 0, 1, 1, 1); 57 | 58 | enableCheck = new QCheckBox(replayCallout); 59 | enableCheck->setObjectName(QStringLiteral("enableCheck")); 60 | enableCheck->setChecked(false); 61 | replayLayout->addWidget(enableCheck, 0, 2, 1, 1); 62 | 63 | waitLabel = new QLabel(replayCallout); 64 | waitLabel->setObjectName(QStringLiteral("waitLabel")); 65 | replayLayout->addWidget(waitLabel, 1, 1, 1, 1); 66 | 67 | waitSpinBox = new QSpinBox(replayCallout); 68 | waitSpinBox->setObjectName(QStringLiteral("waitSpinBox")); 69 | waitSpinBox->setMinimum(0); 70 | waitSpinBox->setMaximum(60); 71 | waitSpinBox->setValue(10); 72 | replayLayout->addWidget(waitSpinBox, 1, 2, 1, 1); 73 | 74 | pauseLabel = new QLabel(replayCallout); 75 | pauseLabel->setObjectName(QStringLiteral("pauseLabel")); 76 | replayLayout->addWidget(pauseLabel, 2, 1, 1, 1); 77 | 78 | pauseSpinBox = new QSpinBox(replayCallout); 79 | pauseSpinBox->setObjectName(QStringLiteral("pauseSpinBox")); 80 | pauseSpinBox->setMinimum(0); 81 | pauseSpinBox->setMaximum(60000); 82 | pauseSpinBox->setValue(2300); 83 | replayLayout->addWidget(pauseSpinBox, 2, 2, 1, 1); 84 | 85 | replayLabel = new QLabel(replayCallout); 86 | replayLabel->setObjectName(QStringLiteral("replayLabel")); 87 | replayLayout->addWidget(replayLabel, 3, 1, 1, 1); 88 | 89 | replaySpinBox = new QSpinBox(replayCallout); 90 | replaySpinBox->setObjectName(QStringLiteral("replaySpinBox")); 91 | replaySpinBox->setMinimum(0); 92 | replaySpinBox->setMaximum(600); 93 | replaySpinBox->setValue(19); 94 | replayLayout->addWidget(replaySpinBox, 3, 2, 1, 1); 95 | 96 | sceneLabel = new QLabel(replayCallout); 97 | sceneLabel->setObjectName(QStringLiteral("sceneLabel")); 98 | replayLayout->addWidget(sceneLabel, 4, 1, 1, 1); 99 | 100 | sceneLineEdit = new QLineEdit(replayCallout); 101 | sceneLineEdit->setObjectName(QStringLiteral("sceneLineEdit")); 102 | sceneLineEdit->setText("Replay Scene"); 103 | replayLayout->addWidget(sceneLineEdit, 4, 2, 1, 2); 104 | 105 | muteDLabel = new QLabel(replayCallout); 106 | muteDLabel->setObjectName(QStringLiteral("muteDLabel")); 107 | replayLayout->addWidget(muteDLabel, 5, 1, 1, 1); 108 | 109 | muteDCheck = new QCheckBox(replayCallout); 110 | muteDCheck->setObjectName(QStringLiteral("muteDCheck")); 111 | muteDCheck->setChecked(true); 112 | replayLayout->addWidget(muteDCheck, 5, 2, 1, 2); 113 | 114 | muteALabel = new QLabel(replayCallout); 115 | muteALabel->setObjectName(QStringLiteral("muteALabel")); 116 | replayLayout->addWidget(muteALabel, 6, 1, 1, 1); 117 | 118 | muteACheck = new QCheckBox(replayCallout); 119 | muteACheck->setObjectName(QStringLiteral("muteACheck")); 120 | muteACheck->setChecked(true); 121 | replayLayout->addWidget(muteACheck, 6, 2, 1, 2); 122 | 123 | closeButton = new QDialogButtonBox(replayCallout); 124 | closeButton->setObjectName(QStringLiteral("buttonBox")); 125 | closeButton->setStandardButtons(QDialogButtonBox::Close); 126 | replayLayout->addWidget(closeButton, 7, 3, 1, 1); 127 | 128 | retranslateUi(replayCallout); 129 | 130 | QMetaObject::connectSlotsByName(replayCallout); 131 | } 132 | 133 | void retranslateUi(QDialog *replayCallout) 134 | { 135 | replayCallout->setWindowTitle(QApplication::translate("replayCallout", "InstantReplay", Q_NULLPTR)); 136 | enableLabel->setText(QApplication::translate("replayCallout", "Enable", Q_NULLPTR)); 137 | waitLabel->setText(QApplication::translate("replayCallout", "WritePause", Q_NULLPTR)); 138 | pauseLabel->setText(QApplication::translate("replayCallout", "TransitionPause", Q_NULLPTR)); 139 | replayLabel->setText(QApplication::translate("replayCallout", "ReplayLength", Q_NULLPTR)); 140 | sceneLabel->setText(QApplication::translate("replayCallout", "ReplayScene", Q_NULLPTR)); 141 | muteDLabel->setText(QApplication::translate("replayCallout", "MuteDesktop", Q_NULLPTR)); 142 | muteALabel->setText(QApplication::translate("replayCallout", "MuteAux", Q_NULLPTR)); 143 | } 144 | }; 145 | 146 | namespace Ui { 147 | class replayCallout : public Ui_replayCallout {}; 148 | } // namespace Ui 149 | 150 | QT_END_NAMESPACE 151 | --------------------------------------------------------------------------------