提交 f41bb4b7 编写于 作者: J jp9000

add support for texture_rect texture type in shaders, add new form, clear up a...

add support for texture_rect texture type in shaders, add new form, clear up a few things in the API
上级 eb8c2923
......@@ -211,6 +211,8 @@ void ShaderProcessor::BuildString(string &outputString)
output << "Texture3D";
else if (strref_cmp(&token->str, "texture_cube") == 0)
output << "TextureCube";
else if (strref_cmp(&token->str, "texture_rect") == 0)
throw "texture_rect is not supported in D3D";
else if (strref_cmp(&token->str, "sampler_state") == 0)
output << "SamplerState";
else
......
......@@ -75,6 +75,8 @@ static bool gl_write_type_n(struct gl_shader_parser *glsp,
dstr_cat(&glsp->gl_string, "sampler3D");
else if (cmp_type(type, len, "texture_cube", 12) == 0)
dstr_cat(&glsp->gl_string, "samplerCube");
else if (cmp_type(type, len, "texture_rect", 12) == 0)
dstr_cat(&glsp->gl_string, "sampler2DRect");
else
return false;
......
......@@ -85,6 +85,7 @@ static inline const struct source_info *find_source(struct darray *list,
return NULL;
}
/* internal initialization */
bool obs_source_init(struct obs_source *source, const char *settings,
const struct source_info *info)
{
......@@ -129,12 +130,13 @@ obs_source_t obs_source_create(enum obs_source_type type, const char *name,
case SOURCE_TRANSITION: list = &obs->transition_types.da; break;
case SOURCE_SCENE:
default:
blog(LOG_WARNING, "Tried to create invalid source type");
return NULL;
}
info = find_source(list, name);
if (!info) {
blog(LOG_WARNING, "Source '%s' not found", name);
blog(LOG_WARNING, "Source type '%s' not found", name);
return NULL;
}
......@@ -189,6 +191,7 @@ static void obs_source_destroy(obs_source_t source)
pthread_mutex_destroy(&source->audio_mutex);
pthread_mutex_destroy(&source->video_mutex);
dstr_free(&source->settings);
bfree(source->name);
bfree(source);
}
......@@ -273,6 +276,7 @@ void obs_source_video_tick(obs_source_t source, float seconds)
source->callbacks.video_tick(source->data, seconds);
}
/* maximum "direct" timestamp variance in nanoseconds */
#define MAX_VARIANCE 2000000000ULL
static void source_output_audio_line(obs_source_t source,
......@@ -293,7 +297,7 @@ static void source_output_audio_line(obs_source_t source,
source->timing_adjust = in.timestamp - os_gettime_ns();
/* detects 'directly' set timestamps as long as they're within
* a certain threashold */
* a certain threshold */
if ((source->timing_adjust+MAX_VARIANCE) < MAX_VARIANCE*2)
source->timing_adjust = 0;
}
......@@ -605,7 +609,7 @@ void obs_source_filter_setorder(obs_source_t source, obs_source_t filter,
da_move_item(source->filters, idx, 0);
}
/* reorder filter targets */
/* reorder filter targets, not the nicest way of dealing with things */
for (i = 0; i < source->filters.num; i++) {
obs_source_t next_filter = (i == source->filters.num-1) ?
source : source->filters.array[idx+1];
......@@ -774,6 +778,8 @@ void obs_source_output_audio(obs_source_t source,
if (output) {
pthread_mutex_lock(&source->audio_mutex);
/* wait for video to start before outputting any audio so we
* have a base for sync */
if (!source->timing_set && flags & SOURCE_ASYNC_VIDEO) {
struct audiobuf newbuf;
size_t audio_size = blocksize * output->frames;
......@@ -802,7 +808,7 @@ void obs_source_output_audio(obs_source_t source,
/*
* Ensures that cached frames are displayed on time. If multiple frames
* were cached between renders, then releases the unnecessary frames and uses
* the frame with the closest timing.
* the frame with the closest timing to ensure sync.
*/
struct source_frame *obs_source_getframe(obs_source_t source)
{
......
......@@ -204,33 +204,37 @@ struct obs_source {
volatile int refs;
/* source-specific data */
char *name;
struct dstr settings;
void *data;
struct source_info callbacks;
struct dstr settings;
/* 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;
/* async video and audio */
/* timing (if video is present, is based upon video) */
bool timing_set;
uint64_t timing_adjust;
uint64_t last_frame_timestamp;
uint64_t last_sys_timestamp;
texture_t output_texture;
/* audio */
bool audio_failed;
struct resample_info sample_info;
audio_resampler_t resampler;
audio_line_t audio_line;
DARRAY(struct audiobuf) audio_wait_buffer;
DARRAY(struct source_frame*) video_frames;
DARRAY(struct audiobuf) audio_wait_buffer; /* pending data */
pthread_mutex_t audio_mutex;
pthread_mutex_t video_mutex;
struct filtered_audio audio_data;
size_t audio_storage_size;
/* async video data */
texture_t output_texture;
DARRAY(struct source_frame*) video_frames;
pthread_mutex_t video_mutex;
/* filters */
struct obs_source *filter_parent;
struct obs_source *filter_target;
......
......@@ -738,3 +738,52 @@ OBSBasicSettingsBase::~OBSBasicSettingsBase()
applyButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( OBSBasicSettingsBase::ApplyClicked ), NULL, this );
}
ProjectChooserBase::ProjectChooserBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizer40;
bSizer40 = new wxBoxSizer( wxVERTICAL );
m_staticText22 = new wxStaticText( this, wxID_ANY, _("ProjectChooser.SelectType"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText22->Wrap( -1 );
bSizer40->Add( m_staticText22, 0, wxALL, 5 );
wxBoxSizer* bSizer41;
bSizer41 = new wxBoxSizer( wxVERTICAL );
basicButton = new wxButton( this, wxID_ANY, _("ProjectChooser.Basic"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer41->Add( basicButton, 0, wxALL|wxEXPAND, 5 );
studioButton = new wxButton( this, wxID_ANY, _("ProjectChooser.Studio"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer41->Add( studioButton, 0, wxALL|wxEXPAND, 5 );
exitButton = new wxButton( this, wxID_ANY, _("MainWindow.Exit"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer41->Add( exitButton, 0, wxALL|wxEXPAND, 5 );
bSizer40->Add( bSizer41, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
this->SetSizer( bSizer40 );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ProjectChooserBase::OnClose ) );
basicButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProjectChooserBase::BasicClicked ), NULL, this );
studioButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProjectChooserBase::StudioClicked ), NULL, this );
exitButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProjectChooserBase::ExitClicked ), NULL, this );
}
ProjectChooserBase::~ProjectChooserBase()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( ProjectChooserBase::OnClose ) );
basicButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProjectChooserBase::BasicClicked ), NULL, this );
studioButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProjectChooserBase::StudioClicked ), NULL, this );
exitButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( ProjectChooserBase::ExitClicked ), NULL, this );
}
此差异已折叠。
......@@ -97,6 +97,7 @@ class WindowSubclass;
#define ID_OK 1050
#define ID_CANCEL 1051
#define ID_APPLY 1052
#define ID_PROJECT_CHOOSER 1053
///////////////////////////////////////////////////////////////////////////////
/// Class OBSBasicBase
......@@ -262,4 +263,31 @@ class OBSBasicSettingsBase : public DialogSubclass
};
///////////////////////////////////////////////////////////////////////////////
/// Class ProjectChooserBase
///////////////////////////////////////////////////////////////////////////////
class ProjectChooserBase : public wxDialog
{
private:
protected:
wxStaticText* m_staticText22;
wxButton* basicButton;
wxButton* studioButton;
wxButton* exitButton;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void BasicClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void StudioClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void ExitClicked( wxCommandEvent& event ) { event.Skip(); }
public:
ProjectChooserBase( wxWindow* parent, wxWindowID id = ID_PROJECT_CHOOSER, const wxString& title = _("ProjectChooser"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 445,159 ), long style = wxDEFAULT_DIALOG_STYLE );
~ProjectChooserBase();
};
#endif //__OBSWINDOWS_H__
......@@ -20,6 +20,10 @@
#include "forms/OBSWindows.h"
class OBSBasic : public OBSBasicBase {
void NewProject();
void SaveProject();
void LoadProject();
protected:
virtual void OnClose(wxCloseEvent &event);
virtual void OnMinimize(wxIconizeEvent &event);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册