1
0
Эх сурвалжийг харах

Rename obs_viewport to obs_view

I felt like the name could cause a bit of confusion with typical
graphics viewports, so I just changed it to view instead.
jp9000 11 жил өмнө
parent
commit
4bc282f5e9

+ 1 - 1
libobs/CMakeLists.txt

@@ -142,7 +142,7 @@ set(libobs_libobs_SOURCES
 	obs-data.c
 	obs-module.c
 	obs-display.c
-	obs-viewport.c
+	obs-view.c
 	obs-scene.c
 	obs-video.c)
 set(libobs_libobs_HEADERS

+ 5 - 5
libobs/obs-internal.h

@@ -52,15 +52,15 @@ extern void free_module(struct obs_module *mod);
 
 
 /* ------------------------------------------------------------------------- */
-/* viewports */
+/* views */
 
-struct obs_viewport {
+struct obs_view {
 	pthread_mutex_t                 channels_mutex;
 	obs_source_t                    channels[MAX_CHANNELS];
 };
 
-extern bool obs_viewport_init(struct obs_viewport *viewport);
-extern void obs_viewport_free(struct obs_viewport *viewport);
+extern bool obs_view_init(struct obs_view *view);
+extern void obs_view_free(struct obs_view *view);
 
 
 /* ------------------------------------------------------------------------- */
@@ -124,7 +124,7 @@ struct obs_core_data {
 	pthread_mutex_t                 outputs_mutex;
 	pthread_mutex_t                 encoders_mutex;
 
-	struct obs_viewport             main_viewport;
+	struct obs_view                 main_view;
 
 	volatile bool                   valid;
 };

+ 1 - 1
libobs/obs-video.c

@@ -88,7 +88,7 @@ static inline void render_main_texture(struct obs_core_video *video,
 	gs_clear(GS_CLEAR_COLOR, &clear_color, 1.0f, 0);
 
 	set_render_size(video->base_width, video->base_height);
-	obs_viewport_render(&obs->data.main_viewport);
+	obs_view_render(&obs->data.main_view);
 
 	video->textures_rendered[cur_texture] = true;
 }

+ 35 - 35
libobs/obs-viewport.c → libobs/obs-view.c

@@ -18,109 +18,109 @@
 #include "obs.h"
 #include "obs-internal.h"
 
-bool obs_viewport_init(struct obs_viewport *viewport)
+bool obs_view_init(struct obs_view *view)
 {
-	pthread_mutex_init_value(&viewport->channels_mutex);
+	pthread_mutex_init_value(&view->channels_mutex);
 
-	if (pthread_mutex_init(&viewport->channels_mutex, NULL) != 0) {
-		blog(LOG_ERROR, "obs_viewport_init: Failed to create mutex");
+	if (pthread_mutex_init(&view->channels_mutex, NULL) != 0) {
+		blog(LOG_ERROR, "obs_view_init: Failed to create mutex");
 		return false;
 	}
 
 	return true;
 }
 
-obs_viewport_t obs_viewport_create(void)
+obs_view_t obs_view_create(void)
 {
-	struct obs_viewport *viewport = bzalloc(sizeof(struct obs_viewport));
+	struct obs_view *view = bzalloc(sizeof(struct obs_view));
 
-	if (!obs_viewport_init(viewport)) {
-		bfree(viewport);
-		viewport = NULL;
+	if (!obs_view_init(view)) {
+		bfree(view);
+		view = NULL;
 	}
 
-	return viewport;
+	return view;
 }
 
-void obs_viewport_free(struct obs_viewport *viewport)
+void obs_view_free(struct obs_view *view)
 {
 	for (size_t i = 0; i < MAX_CHANNELS; i++)
-		obs_source_release(viewport->channels[i]);
+		obs_source_release(view->channels[i]);
 
-	memset(viewport->channels, 0, sizeof(viewport->channels));
-	pthread_mutex_destroy(&viewport->channels_mutex);
+	memset(view->channels, 0, sizeof(view->channels));
+	pthread_mutex_destroy(&view->channels_mutex);
 }
 
-void obs_viewport_destroy(obs_viewport_t viewport)
+void obs_view_destroy(obs_view_t view)
 {
-	if (viewport) {
-		obs_viewport_free(viewport);
-		bfree(viewport);
+	if (view) {
+		obs_view_free(view);
+		bfree(view);
 	}
 }
 
-obs_source_t obs_viewport_getsource(obs_viewport_t viewport, uint32_t channel)
+obs_source_t obs_view_getsource(obs_view_t view, uint32_t channel)
 {
 	obs_source_t source;
 	assert(channel < MAX_CHANNELS);
 
-	if (!viewport) return NULL;
+	if (!view) return NULL;
 	if (channel >= MAX_CHANNELS) return NULL;
 
-	pthread_mutex_lock(&viewport->channels_mutex);
+	pthread_mutex_lock(&view->channels_mutex);
 
-	source = viewport->channels[channel];
+	source = view->channels[channel];
 	if (source)
 		obs_source_addref(source);
 
-	pthread_mutex_unlock(&viewport->channels_mutex);
+	pthread_mutex_unlock(&view->channels_mutex);
 
 	return source;
 }
 
-void obs_viewport_setsource(obs_viewport_t viewport, uint32_t channel,
+void obs_view_setsource(obs_view_t view, uint32_t channel,
 		obs_source_t source)
 {
 	struct obs_source *prev_source;
 
 	assert(channel < MAX_CHANNELS);
 
-	if (!viewport) return;
+	if (!view) return;
 	if (channel >= MAX_CHANNELS) return;
 
-	pthread_mutex_lock(&viewport->channels_mutex);
+	pthread_mutex_lock(&view->channels_mutex);
 
-	prev_source = viewport->channels[channel];
-	viewport->channels[channel] = source;
+	prev_source = view->channels[channel];
+	view->channels[channel] = source;
 
 	if (source)
 		obs_source_addref(source);
 	if (prev_source)
 		obs_source_release(prev_source);
 
-	pthread_mutex_unlock(&viewport->channels_mutex);
+	pthread_mutex_unlock(&view->channels_mutex);
 }
 
-void obs_viewport_render(obs_viewport_t viewport)
+void obs_view_render(obs_view_t view)
 {
-	if (!viewport) return;
+	if (!view) return;
 
-	pthread_mutex_lock(&viewport->channels_mutex);
+	pthread_mutex_lock(&view->channels_mutex);
 
 	for (size_t i = 0; i < MAX_CHANNELS; i++) {
 		struct obs_source *source;
 
-		source = viewport->channels[i];
+		source = view->channels[i];
 
 		if (source) {
 			if (source->removed) {
 				obs_source_release(source);
-				viewport->channels[i] = NULL;
+				view->channels[i] = NULL;
 			} else {
 				obs_source_video_render(source);
 			}
 		}
 	}
 
-	pthread_mutex_unlock(&viewport->channels_mutex);
+	pthread_mutex_unlock(&view->channels_mutex);
 }

+ 10 - 10
libobs/obs.c

@@ -262,7 +262,7 @@ static bool obs_init_data(void)
 		goto fail;
 	if (pthread_mutex_init(&data->encoders_mutex, &attr) != 0)
 		goto fail;
-	if (!obs_viewport_init(&data->main_viewport))
+	if (!obs_view_init(&data->main_view))
 		goto fail;
 
 	data->valid = true;
@@ -279,7 +279,7 @@ static void obs_free_data(void)
 
 	data->valid = false;
 
-	obs_viewport_free(&data->main_viewport);
+	obs_view_free(&data->main_view);
 
 	while (data->outputs.num)
 		obs_output_destroy(data->outputs.array[0]);
@@ -557,7 +557,7 @@ bool obs_add_source(obs_source_t source)
 
 obs_source_t obs_get_output_source(uint32_t channel)
 {
-	return obs_viewport_getsource(&obs->data.main_viewport, channel);
+	return obs_view_getsource(&obs->data.main_view, channel);
 }
 
 void obs_set_output_source(uint32_t channel, obs_source_t source)
@@ -568,12 +568,12 @@ void obs_set_output_source(uint32_t channel, obs_source_t source)
 	if (channel >= MAX_CHANNELS) return;
 
 	struct obs_source *prev_source;
-	struct obs_viewport *viewport = &obs->data.main_viewport;
+	struct obs_view *view = &obs->data.main_view;
 	struct calldata params = {0};
 
-	pthread_mutex_lock(&viewport->channels_mutex);
+	pthread_mutex_lock(&view->channels_mutex);
 
-	prev_source = viewport->channels[channel];
+	prev_source = view->channels[channel];
 
 	calldata_setuint32(&params, "channel", channel);
 	calldata_setptr(&params, "prev_source", prev_source);
@@ -582,14 +582,14 @@ void obs_set_output_source(uint32_t channel, obs_source_t source)
 	calldata_getptr(&params, "source", &source);
 	calldata_free(&params);
 
-	viewport->channels[channel] = source;
+	view->channels[channel] = source;
 
 	if (source)
 		obs_source_addref(source);
 	if (prev_source)
 		obs_source_release(prev_source);
 
-	pthread_mutex_unlock(&viewport->channels_mutex);
+	pthread_mutex_unlock(&view->channels_mutex);
 }
 
 void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t), void *param)
@@ -694,8 +694,8 @@ void obs_resize(uint32_t cx, uint32_t cy)
 	obs_display_resize(&obs->video.main_display, cx, cy);
 }
 
-void obs_render_main_viewport(void)
+void obs_render_main_view(void)
 {
 	if (!obs) return;
-	obs_viewport_render(&obs->data.main_viewport);
+	obs_view_render(&obs->data.main_view);
 }

+ 17 - 17
libobs/obs.h

@@ -33,7 +33,7 @@
 
 /* opaque types */
 struct obs_display;
-struct obs_viewport;
+struct obs_view;
 struct obs_source;
 struct obs_scene;
 struct obs_scene_item;
@@ -42,7 +42,7 @@ struct obs_encoder;
 struct obs_service;
 
 typedef struct obs_display    *obs_display_t;
-typedef struct obs_viewport   *obs_viewport_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;
@@ -335,37 +335,37 @@ EXPORT void obs_remove_draw_callback(
 		void (*draw)(void *param, uint32_t cx, uint32_t cy),
 		void *param);
 
-/** Changes the size of the main viewport */
+/** Changes the size of the main view */
 EXPORT void obs_resize(uint32_t cx, uint32_t cy);
 
-/** Renders the main viewport */
-EXPORT void obs_render_main_viewport(void);
+/** Renders the main view */
+EXPORT void obs_render_main_view(void);
 
 
 /* ------------------------------------------------------------------------- */
-/* Viewport context */
+/* View context */
 
 /**
- * Creates a viewport context.
+ * Creates a view context.
  *
- *   A viewport can be used for things like separate previews, or drawing
+ *   A view can be used for things like separate previews, or drawing
  * sources separately.
  */
-EXPORT obs_viewport_t obs_viewport_create(void);
+EXPORT obs_view_t obs_view_create(void);
 
-/** Destroys this viewport context */
-EXPORT void obs_viewport_destroy(obs_viewport_t viewport);
+/** Destroys this view context */
+EXPORT void obs_view_destroy(obs_view_t view);
 
-/** Sets the source to be used for this viewport context. */
-EXPORT void obs_viewport_setsource(obs_viewport_t viewport, uint32_t channel,
+/** Sets the source to be used for this view context. */
+EXPORT void obs_view_setsource(obs_view_t view, uint32_t channel,
 		obs_source_t source);
 
-/** Gets the source currently in use for this viewport context */
-EXPORT obs_source_t obs_viewport_getsource(obs_viewport_t viewport,
+/** Gets the source currently in use for this view context */
+EXPORT obs_source_t obs_view_getsource(obs_view_t view,
 		uint32_t channel);
 
-/** Renders the sources of this viewport context */
-EXPORT void obs_viewport_render(obs_viewport_t viewport);
+/** Renders the sources of this view context */
+EXPORT void obs_view_render(obs_view_t view);
 
 
 /* ------------------------------------------------------------------------- */

+ 1 - 1
obs/window-basic-main.cpp

@@ -266,7 +266,7 @@ void OBSBasic::ChannelChanged(void *data, calldata_t params)
 
 void OBSBasic::RenderMain(void *data, uint32_t cx, uint32_t cy)
 {
-	obs_render_main_viewport();
+	obs_render_main_view();
 }
 
 /* Main class functions */

+ 1 - 1
vs/2013/libobs/libobs.vcxproj

@@ -102,7 +102,7 @@
     <ClCompile Include="..\..\..\libobs\obs-scene.c" />
     <ClCompile Include="..\..\..\libobs\obs-source.c" />
     <ClCompile Include="..\..\..\libobs\obs-video.c" />
-    <ClCompile Include="..\..\..\libobs\obs-viewport.c" />
+    <ClCompile Include="..\..\..\libobs\obs-view.c" />
     <ClCompile Include="..\..\..\libobs\obs-windows.c" />
     <ClCompile Include="..\..\..\libobs\obs.c" />
     <ClCompile Include="..\..\..\libobs\util\base.c" />

+ 1 - 1
vs/2013/libobs/libobs.vcxproj.filters

@@ -344,7 +344,7 @@
     <ClCompile Include="..\..\..\libobs\obs-properties.c">
       <Filter>libobs\Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\..\libobs\obs-viewport.c">
+    <ClCompile Include="..\..\..\libobs\obs-view.c">
       <Filter>libobs\Source Files</Filter>
     </ClCompile>
   </ItemGroup>