obs-studio/UI/window-basic-main-outputs.hpp
jp9000 e5d8f345fc UI: Fix screenshots preventing auto-remux
Due to the fact that a global was used on GenerateSpecifiedFilename to
save the remux file name, when a screenshot was made, it would overwrite
the filename being remuxed, because screenshots use the same function to
generate filenames as well.

This solves that problem by removing the global and the changes to
GeneratedSpecifiedFilename, and isolating that to the output handler.

Coincidentally, this bug probably also happened with replay buffers
under certain circumstances.

Fixes obsproject/obs-studio#3497
Closes obsproject/obs-studio#3498
2020-09-26 08:19:27 -07:00

73 lines
2 KiB
C++

#pragma once
#include <string>
class OBSBasic;
struct BasicOutputHandler {
OBSOutput fileOutput;
OBSOutput streamOutput;
OBSOutput replayBuffer;
OBSOutput virtualCam;
bool streamingActive = false;
bool recordingActive = false;
bool delayActive = false;
bool replayBufferActive = false;
bool virtualCamActive = false;
OBSBasic *main;
std::string outputType;
std::string lastError;
std::string lastRecordingPath;
OBSSignal startRecording;
OBSSignal stopRecording;
OBSSignal startReplayBuffer;
OBSSignal stopReplayBuffer;
OBSSignal startStreaming;
OBSSignal stopStreaming;
OBSSignal startVirtualCam;
OBSSignal stopVirtualCam;
OBSSignal streamDelayStarting;
OBSSignal streamStopping;
OBSSignal recordStopping;
OBSSignal replayBufferStopping;
inline BasicOutputHandler(OBSBasic *main_);
virtual ~BasicOutputHandler(){};
virtual bool SetupStreaming(obs_service_t *service) = 0;
virtual bool StartStreaming(obs_service_t *service) = 0;
virtual bool StartRecording() = 0;
virtual bool StartReplayBuffer() { return false; }
virtual bool StartVirtualCam();
virtual void StopStreaming(bool force = false) = 0;
virtual void StopRecording(bool force = false) = 0;
virtual void StopReplayBuffer(bool force = false) { (void)force; }
virtual void StopVirtualCam();
virtual bool StreamingActive() const = 0;
virtual bool RecordingActive() const = 0;
virtual bool ReplayBufferActive() const { return false; }
virtual bool VirtualCamActive() const;
virtual void Update() = 0;
virtual void SetupOutputs() = 0;
inline bool Active() const
{
return streamingActive || recordingActive || delayActive ||
replayBufferActive || virtualCamActive;
}
protected:
bool SetupAutoRemux(const char *&ext);
std::string GetRecordingFilename(const char *path, const char *ext,
bool noSpace, bool overwrite,
const char *format, bool ffmpeg);
};
BasicOutputHandler *CreateSimpleOutputHandler(OBSBasic *main);
BasicOutputHandler *CreateAdvancedOutputHandler(OBSBasic *main);