Skip to content

Commit 1af40e4

Browse files
committed
correct output of double values, e.g. frames per second
1 parent edc3767 commit 1af40e4

File tree

5 files changed

+23
-6
lines changed

5 files changed

+23
-6
lines changed

HISTORY

+3
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,6 @@ VDR Plugin 'dbus2vdr' Revision History
245245

246246
2016-03-09: Version 30
247247
- add timer.ListDetailed
248+
249+
2016-12-11: Version 31
250+
- correct output of "frames per second"

dbus2vdr.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#include "avahi-helper.h"
4040

4141

42-
static const char *VERSION = "30";
42+
static const char *VERSION = "31";
4343
static const char *DESCRIPTION = trNOOP("control vdr via D-Bus");
4444
static const char *MAINMENUENTRY = NULL;
4545

helper.c

+16
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ void cDBusHelper::ToUtf8(cString &text)
6464
}
6565
}
6666

67+
void cDBusHelper::AddKeyDouble(GVariantBuilder *Array, const char *Key, double Value)
68+
{
69+
GVariantBuilder *element = g_variant_builder_new(G_VARIANT_TYPE("(sv)"));
70+
71+
g_variant_builder_add(element, "s", Key);
72+
73+
GVariantBuilder *variant = g_variant_builder_new(G_VARIANT_TYPE("v"));
74+
g_variant_builder_add(variant, "d", Value);
75+
g_variant_builder_add_value(element, g_variant_builder_end(variant));
76+
77+
g_variant_builder_add_value(Array, g_variant_builder_end(element));
78+
79+
g_variant_builder_unref(variant);
80+
g_variant_builder_unref(element);
81+
}
82+
6783
void cDBusHelper::AddKeyValue(GVariantBuilder *Array, const char *Key, const gchar *Type, void **Value)
6884
{
6985
GVariantBuilder *element = g_variant_builder_new(G_VARIANT_TYPE("(sv)"));

helper.h

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class cDBusHelper
1616
static bool IsValidUtf8(const char *text);
1717
static void ToUtf8(cString &text);
1818

19+
static void AddKeyDouble(GVariantBuilder *Array, const char *Key, double Value);
1920
static void AddKeyValue(GVariantBuilder *Array, const char *Key, const gchar *Type, void **Value);
2021
static void SendReply(GDBusMethodInvocation *Invocation, int ReplyCode, const char *ReplyMessage);
2122
};

recording.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class cDBusRecordingsHelper
3333
gboolean b;
3434
guint64 tu64;
3535
int i;
36-
gdouble d;
3736

3837
c = recording->FileName();
3938
if (c != NULL)
@@ -62,8 +61,7 @@ class cDBusRecordingsHelper
6261
cDBusHelper::AddKeyValue(array, "Lifetime", "i", (void**)&i);
6362
i = recording->HierarchyLevels();
6463
cDBusHelper::AddKeyValue(array, "HierarchyLevels", "i", (void**)&i);
65-
d = recording->FramesPerSecond();
66-
cDBusHelper::AddKeyValue(array, "FramesPerSecond", "d", (void**)&d);
64+
cDBusHelper::AddKeyDouble(array, "FramesPerSecond", recording->FramesPerSecond());
6765
i = recording->NumFrames();
6866
cDBusHelper::AddKeyValue(array, "NumFrames", "i", (void**)&i);
6967
i = recording->LengthInSeconds();
@@ -97,8 +95,7 @@ class cDBusRecordingsHelper
9795
c = info->Aux();
9896
if (c != NULL)
9997
cDBusHelper::AddKeyValue(array, "Info/Aux", "s", (void**)&c);
100-
d = info->FramesPerSecond();
101-
cDBusHelper::AddKeyValue(array, "Info/FramesPerSecond", "d", (void**)&d);
98+
cDBusHelper::AddKeyDouble(array, "Info/FramesPerSecond", info->FramesPerSecond());
10299
const cComponents *components = info->Components();
103100
if ((components != NULL) && (components->NumComponents() > 0)) {
104101
for (int comp = 0; comp < components->NumComponents(); comp++) {

0 commit comments

Comments
 (0)