[retro-gtk] retro-gobject: Remove AvInfo
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] retro-gobject: Remove AvInfo
- Date: Tue, 24 Jan 2017 16:20:48 +0000 (UTC)
commit cd19648ef79ae66aa3471a3fbfef531255b1285b
Author: Adrien Plazas <kekun plazas laposte net>
Date: Tue Jan 24 16:05:30 2017 +0100
retro-gobject: Remove AvInfo
This helps making the public API simpler.
https://bugzilla.gnome.org/show_bug.cgi?id=777489
retro-gobject/av-info.vala | 62 -------------------------------------
retro-gobject/core.vala | 44 +++-----------------------
retro-gobject/retro-environment.c | 20 ++++++++----
3 files changed, 18 insertions(+), 108 deletions(-)
---
diff --git a/retro-gobject/av-info.vala b/retro-gobject/av-info.vala
index 691b752..c5bedd5 100644
--- a/retro-gobject/av-info.vala
+++ b/retro-gobject/av-info.vala
@@ -29,67 +29,5 @@ internal struct SystemAvInfo {
public SystemTiming timing;
}
-/**
- * Stores video geometry and AV timing informations.
- */
-public class AvInfo : Object {
- /**
- * The nominal video width of the game.
- */
- public uint base_width { construct; get; }
-
- /**
- * The nominal video height of the game.
- */
- public uint base_height { construct; get; }
-
- /**
- * The maximum possible width of the game.
- */
- public uint max_width { construct; get; }
-
- /**
- * The maximum possible height of the game.
- */
- public uint max_height { construct; get; }
-
- /**
- * The nominal aspect ratio of the game.
- *
- * A frontend could override this setting if desired.
- */
- public float aspect_ratio { construct; get; }
-
- /**
- * The frames per seconds of the video content.
- */
- public double fps { construct; get; }
-
- /**
- * The sampling rate of the audio.
- */
- public double sample_rate { construct; get; }
-
- internal AvInfo (SystemAvInfo system_av_info) {
- Object (
- base_width: system_av_info.geometry.base_width,
- base_height: system_av_info.geometry.base_height,
- max_width: system_av_info.geometry.max_width,
- max_height: system_av_info.geometry.max_height,
- aspect_ratio: system_av_info.geometry.aspect_ratio,
- fps: system_av_info.timing.fps,
- sample_rate: system_av_info.timing.sample_rate
- );
- }
-
- construct {
- /* If aspect_ratio is <= 0.0, an aspect ratio of
- * base_width / base_height is assumed.
- */
- if (aspect_ratio <= 0)
- aspect_ratio = (float) base_width / base_height;
- }
-}
-
}
diff --git a/retro-gobject/core.vala b/retro-gobject/core.vala
index 5c2ee47..4424051 100644
--- a/retro-gobject/core.vala
+++ b/retro-gobject/core.vala
@@ -144,13 +144,6 @@ public class Core : Object {
*/
public bool support_no_game { internal set; get; default = false; }
- /**
- * Information on audio and video geometry and timings.
- *
- * Can be set by the Core when loading a game.
- */
- public AvInfo av_info { internal set; get; }
-
internal double _frames_per_second;
public double frames_per_second {
get { return _frames_per_second; }
@@ -306,37 +299,6 @@ public class Core : Object {
}
/**
- * Gets information about system audio/video timings and geometry.
- *
- * Can be called only after {@link load_game} has successfully
- * completed.
- *
- * NOTE: The implementation of this function might not initialize every
- * variable if needed.
- * E.g. geometry.aspect_ratio might not be initialized if the core doesn't
- * desire a particular aspect ratio.
- *
- * @param valid whether the av_info is valid or not
- * @return information on the system audio/video timings and geometry
- */
- private void update_av_info (bool valid) {
- push_cb_data ();
- if (valid) {
- SystemAvInfo info;
- module.get_system_av_info (out info);
- av_info = new AvInfo (info);
- _frames_per_second = info.timing.fps;
- notify_property ("frames-per-second");
- aspect_ratio = info.geometry.aspect_ratio;
- sample_rate = info.timing.sample_rate;
- }
- else {
- av_info = null;
- }
- pop_cb_data ();
- }
-
- /**
* Sets device to be used for player 'port'.
*
* @param port the port on wich to connect a device
@@ -438,7 +400,9 @@ public class Core : Object {
push_cb_data ();
game_loaded = module.load_game (game);
- update_av_info (game_loaded);
+ SystemAvInfo info;
+ module.get_system_av_info (out info);
+ set_system_av_info (info);
pop_cb_data ();
return game_loaded;
@@ -516,6 +480,8 @@ public class Core : Object {
// TODO Handle the key event.
}
+
+ private extern void set_system_av_info (SystemAvInfo system_av_info);
}
}
diff --git a/retro-gobject/retro-environment.c b/retro-gobject/retro-environment.c
index 61cb070..f0d31c6 100644
--- a/retro-gobject/retro-environment.c
+++ b/retro-gobject/retro-environment.c
@@ -3,6 +3,8 @@
#include "retro-gobject-internal.h"
#include "libretro-environment.h"
+void retro_core_set_system_av_info (RetroCore *self, RetroSystemAvInfo *system_av_info);
+
typedef struct {
gpointer log;
} RetroLogCallback;
@@ -186,13 +188,7 @@ static gboolean set_support_no_game (RetroCore *self, gboolean *support_no_game)
}
static gboolean set_system_av_info (RetroCore *self, RetroSystemAvInfo *system_av_info) {
- retro_core_set_av_info (self, retro_av_info_new (system_av_info));
- if (self->_frames_per_second != system_av_info->timing.fps) {
- self->_frames_per_second = system_av_info->timing.fps;
- g_object_notify (G_OBJECT (self), "frames-per-second");
- }
- self->aspect_ratio = system_av_info->geometry.aspect_ratio;
- self->sample_rate = system_av_info->timing.sample_rate;
+ retro_core_set_system_av_info (self, system_av_info);
return TRUE;
}
@@ -434,3 +430,13 @@ void retro_core_set_callbacks (RetroCore *self) {
set_input_state (on_input_state);
retro_core_pop_cb_data ();
}
+
+void retro_core_set_system_av_info (RetroCore *self, RetroSystemAvInfo *system_av_info) {
+ if (self->_frames_per_second != system_av_info->timing.fps) {
+ self->_frames_per_second = system_av_info->timing.fps;
+ g_object_notify (G_OBJECT (self), "frames-per-second");
+ }
+ self->aspect_ratio = system_av_info->geometry.aspect_ratio;
+ self->sample_rate = system_av_info->timing.sample_rate;
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]