0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
obs-studio/obs/window-basic-settings.hpp
jp9000 02a07ea0a0 Add preliminary streaming code for testing
- Add some temporary streaming code using FFmpeg.  FFmpeg itself is not
   very ideal for streaming; lack of direct control of the sockets and
   no framedrop handling means that FFmpeg is definitely not something
   you want to use without wrapper code.  I'd prefer writing my own
   network framework in this particular case just because you give away
   so much control of the network interface.  Wasted an entire day
   trying to go through FFmpeg issues.

   There's just no way FFmpeg should be used for real streaming (at
   least without being patched or submitting some sort of patch, but I'm
   sort of feeling "meh" on that idea)

   I had to end up writing multiple threads just to handle both
   connecting and writing, because av_interleaved_write_frame blocks
   every call, stalling the main encoder thread, and thus also stalling
   draw signals.

 - Add some temporary user interface for streaming settings.  This is
   just temporary for the time being.  It's in the outputs section of
   the basic-mode settings

 - Make it so that dynamic arrays do not free all their data when the
   size just happens to be reduced to 0.  This prevents constant
   reallocation when an array keeps going from 1 item to 0 items.  Also,
   it was bad to become dependent upon that functionality.  You must now
   always explicitly call "free" on it to ensure the data is free, and
   that's how it should be.  Implicit functionality can lead to
   confusion and maintainability issues.
2014-03-10 13:10:35 -07:00

111 lines
2.7 KiB
C++

/******************************************************************************
Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.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/>.
******************************************************************************/
#pragma once
#include <util/util.hpp>
#include <QDialog>
#include <memory>
#include <obs.h>
class OBSBasic;
class QAbstractButton;
class QComboBox;
#include "ui_OBSBasicSettings.h"
class OBSBasicSettings : public QDialog {
Q_OBJECT
private:
OBSBasic *main;
std::unique_ptr<Ui::OBSBasicSettings> ui;
ConfigFile localeIni;
bool generalChanged;
bool outputsChanged;
bool audioChanged;
bool videoChanged;
int pageIndex;
bool loading;
inline bool Changed() const
{
return generalChanged || outputsChanged || audioChanged ||
videoChanged;
}
inline void ClearChanged()
{
generalChanged = false;
outputsChanged = false;
audioChanged = false;
videoChanged = false;
}
void HookWidget(QWidget *widget, const char *signal, const char *slot);
bool QueryChanges();
void LoadGeneralSettings();
void LoadOutputSettings();
void LoadAudioSettings();
void LoadVideoSettings();
void LoadSettings(bool changedOnly);
/* general */
void LoadLanguageList();
/* audio */
void LoadListValues(QComboBox *widget, obs_property_t prop,
const char *configName);
void LoadAudioDevices();
/* video */
void LoadRendererList();
void ResetDownscales(uint32_t cx, uint32_t cy);
void LoadResolutionLists();
void LoadFPSData();
void SaveGeneralSettings();
void SaveOutputSettings();
void SaveAudioSettings();
void SaveVideoSettings();
void SaveSettings();
private slots:
void on_listWidget_itemSelectionChanged();
void on_buttonBox_clicked(QAbstractButton *button);
void on_baseResolution_editTextChanged(const QString &text);
void GeneralChanged();
void AudioChanged();
void AudioChangedRestart();
void OutputsChanged();
void VideoChanged();
void VideoChangedResolution();
void VideoChangedRestart();
protected:
virtual void closeEvent(QCloseEvent *event);
public:
OBSBasicSettings(QWidget *parent);
};