Skip to content

Commit 1e75e77

Browse files
Merge pull request #64 from gstreamer-java/revert-59-GDate
Revert "gst_date_time_get_type() shall not be associated with GDate"
2 parents 1b12b28 + 3d7a8b2 commit 1e75e77

File tree

4 files changed

+15
-63
lines changed

4 files changed

+15
-63
lines changed
Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/*
2-
* Copyright (c) 2016 Christophe Lafolet
32
* Copyright (c) 2010 Levente Farkas
43
*
54
* This code is free software: you can redistribute it and/or modify it under
@@ -17,20 +16,16 @@
1716

1817
package org.freedesktop.gstreamer;
1918

20-
import static org.freedesktop.gstreamer.lowlevel.GstDateTimeAPI.GSTDATETIME_API;
19+
import com.sun.jna.Pointer;
2120

22-
import org.freedesktop.gstreamer.lowlevel.GType;
2321
import org.freedesktop.gstreamer.lowlevel.NativeObject;
2422

25-
import com.sun.jna.Pointer;
23+
import static org.freedesktop.gstreamer.lowlevel.GstDateTimeAPI.GSTDATETIME_API;
2624

2725
/**
2826
*/
2927
public class DateTime extends NativeObject {
30-
3128
public static final String GTYPE_NAME = "GstDateTime";
32-
public static final GType GTYPE = GSTDATETIME_API.gst_date_time_get_type();
33-
3429

3530
public static DateTime createInstanceLocalEpoch(long secs) {
3631
return new DateTime(GSTDATETIME_API.gst_date_time_new_from_unix_epoch_local_time(secs), false, true);
@@ -39,7 +34,6 @@ public static DateTime createInstanceLocalEpoch(long secs) {
3934
public DateTime(Initializer init) {
4035
super(init);
4136
}
42-
4337
public DateTime(Pointer ptr, boolean needRef, boolean ownsHandle) {
4438
this(initializer(ptr, needRef, ownsHandle));
4539
}
@@ -49,37 +43,4 @@ protected void disposeNativeHandle(Pointer ptr) {
4943
GSTDATETIME_API.gst_date_time_unref(ptr);
5044
}
5145

52-
public int getYear() {
53-
return GSTDATETIME_API.gst_date_time_get_year(handle());
54-
}
55-
56-
public int getMonth() {
57-
return GSTDATETIME_API.gst_date_time_get_month(handle());
58-
}
59-
60-
public int getDay() {
61-
return GSTDATETIME_API.gst_date_time_get_day(handle());
62-
}
63-
64-
public int getHour() {
65-
return GSTDATETIME_API.gst_date_time_get_hour(handle());
66-
}
67-
68-
public int getMinute() {
69-
return GSTDATETIME_API.gst_date_time_get_minute(handle());
70-
}
71-
72-
public int getSecond() {
73-
return GSTDATETIME_API.gst_date_time_get_second(handle());
74-
}
75-
76-
public int getMicrosecond() {
77-
return GSTDATETIME_API.gst_date_time_get_microsecond(handle());
78-
}
79-
80-
@Override
81-
public String toString() {
82-
return "" + getYear() + "-" + getMonth() + "-" + getDay() + " " + getHour() + ":" + getMinute() + ":" + getSecond() + "." + getMicrosecond();
83-
}
84-
8546
}

src/org/freedesktop/gstreamer/TagList.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/*
2-
* Copyright (c) 2016 Christophe Lafolet
32
* Copyright (c) 2014 Tom Greenwood <[email protected]>
43
* Copyright (c) 2007 Wayne Meissner
54
*
@@ -21,8 +20,6 @@
2120
package org.freedesktop.gstreamer;
2221

2322
import static org.freedesktop.gstreamer.lowlevel.GlibAPI.GLIB_API;
24-
import static org.freedesktop.gstreamer.lowlevel.GstTagAPI.GSTTAG_API;
25-
import static org.freedesktop.gstreamer.lowlevel.GstTagListAPI.GSTTAGLIST_API;
2623

2724
import java.util.AbstractList;
2825
import java.util.HashMap;
@@ -31,12 +28,15 @@
3128
import java.util.Map;
3229
import java.util.concurrent.ConcurrentHashMap;
3330

31+
import com.sun.jna.Pointer;
32+
import com.sun.jna.ptr.PointerByReference;
33+
3434
import org.freedesktop.gstreamer.glib.GDate;
3535
import org.freedesktop.gstreamer.lowlevel.GType;
3636
import org.freedesktop.gstreamer.lowlevel.GstTagListAPI;
3737

38-
import com.sun.jna.Pointer;
39-
import com.sun.jna.ptr.PointerByReference;
38+
import static org.freedesktop.gstreamer.lowlevel.GstTagAPI.GSTTAG_API;
39+
import static org.freedesktop.gstreamer.lowlevel.GstTagListAPI.GSTTAGLIST_API;
4040

4141
/**
4242
* List of tags and values used to describe media metadata.
@@ -280,17 +280,6 @@ public Object get(TagList tl, String tag, int index) {
280280
return new GDate(value.getValue(), false, true);
281281
}
282282
});
283-
put(DateTime.GTYPE, new TagGetter() {
284-
public Object get(TagList tl, String tag, int index) {
285-
PointerByReference value = new PointerByReference();
286-
GSTTAGLIST_API.gst_tag_list_get_date_time_index(tl, tag, index, value);
287-
if (value.getValue() == null) {
288-
return null;
289-
}
290-
return new DateTime(value.getValue(), false, true);
291-
}
292-
});
293-
294283
}};
295284
static private final Map<String, GType> tagTypeMap = new ConcurrentHashMap<String, GType>();
296285
}

src/org/freedesktop/gstreamer/glib/GDate.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/*
2-
* Copyright (c) 2016 Christophe Lafolet
32
* Copyright (c) 2007 Wayne Meissner
43
*
54
* This file is part of gstreamer-java.
@@ -19,15 +18,17 @@
1918

2019
package org.freedesktop.gstreamer.glib;
2120

21+
import static org.freedesktop.gstreamer.lowlevel.GstDateTimeAPI.GSTDATETIME_API;
22+
2223
import org.freedesktop.gstreamer.lowlevel.GType;
2324
import org.freedesktop.gstreamer.lowlevel.GlibAPI;
2425
import org.freedesktop.gstreamer.lowlevel.NativeObject;
2526

2627
import com.sun.jna.Pointer;
2728

2829
public class GDate extends NativeObject {
29-
public static final String GTYPE_NAME = "GDate";
30-
public static final GType GTYPE = GType.valueOf(GTYPE_NAME);
30+
// it's by desing GstDate and not GDate see gstreamer source
31+
public static final String GTYPE_NAME = "GstDate";
3132

3233
public static GDate createInstance(int day, int month, int year) {
3334
return new GDate(GlibAPI.GLIB_API.g_date_new_dmy(day, month , year), false, true);
@@ -36,6 +37,8 @@ public static GDate createInstance(int julian_day) {
3637
return new GDate(GlibAPI.GLIB_API.g_date_new_julian(julian_day), false, true);
3738
}
3839

40+
public static final GType GTYPE = GSTDATETIME_API.gst_date_time_get_type();
41+
3942
public GDate(Initializer init) {
4043
super(init);
4144
}

src/org/freedesktop/gstreamer/lowlevel/GlibAPI.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
*/
1919

2020
package org.freedesktop.gstreamer.lowlevel;
21-
import java.util.Arrays;
2221
import java.util.HashMap;
23-
import java.util.List;
2422

2523
import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn;
2624

@@ -29,6 +27,8 @@
2927
import com.sun.jna.NativeLong;
3028
import com.sun.jna.Pointer;
3129
import com.sun.jna.ptr.PointerByReference;
30+
import java.util.Arrays;
31+
import java.util.List;
3232

3333
/**
3434
*
@@ -106,7 +106,6 @@ int g_timeout_add_full(int priority, int interval, GSourceFunc function,
106106
void g_source_remove(int id);
107107
void g_free(Pointer ptr);
108108

109-
// GType g_date_get_type();
110109
Pointer g_date_new();
111110
Pointer g_date_new_dmy(int day, int month, int year);
112111
Pointer g_date_new_julian(int julian_day);

0 commit comments

Comments
 (0)