summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Interop
diff options
context:
space:
mode:
authorsr55 <[email protected]>2015-04-10 22:29:57 +0000
committersr55 <[email protected]>2015-04-10 22:29:57 +0000
commit01487d5277eaadf2da3a483aa1d74198050fba44 (patch)
tree71438b397683b1bb2cdc94fbc6416cbbeb744660 /win/CS/HandBrake.ApplicationServices/Interop
parent9c78da39f3c6947c84c039e1f16497da6020b740 (diff)
WinGui: Add a basic outline of a logging system to allow logging of the JSON and other types of messages.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7084 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Interop')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs8
-rw-r--r--win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs3
2 files changed, 11 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
index 97193c8dd..a97185e19 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
@@ -33,6 +33,8 @@ namespace HandBrake.ApplicationServices.Interop
using HandBrake.ApplicationServices.Interop.Model;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrake.ApplicationServices.Interop.Model.Preview;
+ using HandBrake.ApplicationServices.Services.Logging;
+ using HandBrake.ApplicationServices.Services.Logging.Model;
using Newtonsoft.Json;
@@ -353,6 +355,7 @@ namespace HandBrake.ApplicationServices.Interop
};
string encode = JsonConvert.SerializeObject(encodeObject, Formatting.Indented, settings);
+ LogHelper.LogMessage(new LogMessage(encode, LogMessageType.encodeJson, LogLevel.debug));
HBFunctions.hb_add_json(this.hbHandle, InteropUtilities.ToUtf8PtrFromString(encode));
HBFunctions.hb_start(this.hbHandle);
@@ -458,6 +461,7 @@ namespace HandBrake.ApplicationServices.Interop
{
IntPtr json = HBFunctions.hb_get_state_json(this.hbHandle);
string statusJson = Marshal.PtrToStringAnsi(json);
+ LogHelper.LogMessage(new LogMessage(statusJson, LogMessageType.progressJson, LogLevel.debug));
JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson);
if (state != null && state.State == NativeConstants.HB_STATE_SCANNING)
@@ -478,6 +482,7 @@ namespace HandBrake.ApplicationServices.Interop
{
var jsonMsg = HBFunctions.hb_get_title_set_json(this.hbHandle);
string scanJson = InteropUtilities.ToStringFromUtf8Ptr(jsonMsg);
+ LogHelper.LogMessage(new LogMessage(scanJson, LogMessageType.scanJson, LogLevel.debug));
this.titles = JsonConvert.DeserializeObject<JsonScanObject>(scanJson);
this.featureTitle = this.titles.MainFeature;
@@ -501,6 +506,9 @@ namespace HandBrake.ApplicationServices.Interop
{
IntPtr json = HBFunctions.hb_get_state_json(this.hbHandle);
string statusJson = Marshal.PtrToStringAnsi(json);
+
+ LogHelper.LogMessage(new LogMessage(statusJson, LogMessageType.progressJson, LogLevel.debug));
+
JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson);
if (state != null && state.State == NativeConstants.HB_STATE_WORKING)
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs
index 098646ddd..7a00bb8e9 100644
--- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs
+++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs
@@ -18,6 +18,8 @@ namespace HandBrake.ApplicationServices.Interop
using HandBrake.ApplicationServices.Interop.HbLib;
using HandBrake.ApplicationServices.Interop.Json.Anamorphic;
using HandBrake.ApplicationServices.Interop.Json.Shared;
+ using HandBrake.ApplicationServices.Services.Logging;
+ using HandBrake.ApplicationServices.Services.Logging.Model;
using Newtonsoft.Json;
@@ -303,6 +305,7 @@ namespace HandBrake.ApplicationServices.Interop
public static Geometry GetAnamorphicSize(AnamorphicGeometry anamorphicGeometry)
{
string encode = JsonConvert.SerializeObject(anamorphicGeometry, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
+ LogHelper.LogMessage(new LogMessage(encode, LogMessageType.encodeJson, LogLevel.debug));
IntPtr json = HBFunctions.hb_set_anamorphic_size_json(Marshal.StringToHGlobalAnsi(encode));
string result = Marshal.PtrToStringAnsi(json);
return JsonConvert.DeserializeObject<Geometry>(result);