Skip to content

Commit 120c1d7

Browse files
i-n-g-oneilcsmith-net
authored andcommitted
Lowlevel align structures (#115)
1 parent f595779 commit 120c1d7

File tree

4 files changed

+41
-24
lines changed

4 files changed

+41
-24
lines changed

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

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,31 @@
2121
import java.util.List;
2222

2323
import com.sun.jna.NativeLong;
24+
import com.sun.jna.Pointer;
2425
import com.sun.jna.Structure;
26+
import static org.freedesktop.gstreamer.lowlevel.GstAPI.GST_PADDING;
2527

28+
/**
29+
* GstPadProbeInfo structure
30+
* @see https://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstpad.h?h=1.8
31+
*/
2632
public class GstPadProbeInfo extends Structure {
27-
public volatile int padProbeType; // GstPadProbeInfo enum constants
28-
public volatile NativeLong id; // id of the probe
29-
public volatile long offset;// offset of pull probe, this field is valid when type contains GST_PAD_PROBE_TYPE_PULL
30-
public volatile int size; // size of pull probe, this field is valid when type contains GST_PAD_PROBE_TYPE_PULL
31-
32-
@Override
33-
protected List<String> getFieldOrder() {
34-
return Arrays.asList(new String[] {
35-
"padProbeType", "id", "offset", "size"
36-
});
37-
}
38-
33+
34+
public volatile int padProbeType; // GstPadProbeInfo enum constants
35+
public volatile NativeLong id; // id of the probe
36+
public volatile Pointer data; // (allow-none): type specific data, check the @type field to know the datatype. This field can be %NULL.
37+
public volatile long offset; // offset of pull probe, this field is valid when type contains GST_PAD_PROBE_TYPE_PULL
38+
public volatile int size; // size of pull probe, this field is valid when type contains GST_PAD_PROBE_TYPE_PULL
3939

40+
/*< private >*/
41+
public volatile Pointer[] _gst_reserved = new Pointer[GST_PADDING];
42+
43+
@Override
44+
protected List<String> getFieldOrder() {
45+
return Arrays.asList(new String[] {
46+
"padProbeType", "id", "data", "offset", "size",
47+
"_gst_reserved"
48+
});
49+
}
4050

4151
}

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
import com.sun.jna.Pointer;
3636

3737
/**
38-
* GstQuery functions
38+
* GstQueryAPI functions and structure
39+
* @see https://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstquery.h?h=1.8
3940
*/
4041
public interface GstQueryAPI extends com.sun.jna.Library {
4142
GstQueryAPI GSTQUERY_API = GstNative.load(GstQueryAPI.class);
@@ -106,18 +107,18 @@ void gst_query_parse_seeking(Query query, Format[] format,
106107

107108
public static final class QueryStruct extends com.sun.jna.Structure {
108109
public volatile GstMiniObjectAPI.MiniObjectStruct mini_object;
110+
111+
/*< public > *//* with COW */
109112
public volatile int type;
110-
public volatile Pointer structure;
111-
public volatile Pointer _gst_reserved;
113+
112114
public QueryStruct(Pointer ptr) {
113115
useMemory(ptr);
114116
}
115117

116118
@Override
117119
protected List<String> getFieldOrder() {
118120
return Arrays.asList(new String[]{
119-
"mini_object", "type", "structure",
120-
"_gst_reserved"
121+
"mini_object", "type"
121122
});
122123
}
123124
}

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,23 @@
2929
import java.util.List;
3030
import org.freedesktop.gstreamer.Buffer;
3131
import org.freedesktop.gstreamer.Caps;
32-
import org.freedesktop.gstreamer.lowlevel.annotations.CallerOwnsReturn;
32+
import org.freedesktop.gstreamer.lowlevel.GstAPI.GstSegmentStruct;
3333

3434
/**
35-
* GstSample functions
35+
* GstSampleAPI functions and structure
36+
* @see https://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstsample.c?h=1.8
3637
*/
3738
public interface GstSampleAPI extends com.sun.jna.Library {
3839
GstSampleAPI GSTMESSAGE_API = GstNative.load(GstSampleAPI.class);
3940

4041
public static final class SampleStruct extends com.sun.jna.Structure {
4142
public volatile MiniObjectStruct mini_object;
42-
public volatile Pointer buffer; // to Buffer
43-
public volatile Pointer caps; // to Caps
44-
public volatile Pointer segment; // to Segment
45-
public volatile Pointer info; // to Strucutre
43+
44+
public volatile Pointer /* GstBuffer* */buffer; // to Buffer
45+
public volatile Pointer /* GstCaps* */ caps; // to Caps
46+
public volatile GstSegmentStruct segment; // Segment
47+
public volatile Pointer /* GstStructure* */ info; // to Strucutre
48+
public volatile Pointer /* GstBufferList* */ buffer_list; // to buffer_list
4649

4750
/**
4851
* Creates a new instance of MessageStruct
@@ -56,7 +59,7 @@ public SampleStruct(Pointer ptr) {
5659
@Override
5760
protected List<String> getFieldOrder() {
5861
return Arrays.asList(new String[]{
59-
"mini_object", "buffer", "caps", "segment", "info"
62+
"mini_object", "buffer", "caps", "segment", "info", "buffer_list"
6063
});
6164
}
6265
}

src/org/freedesktop/gstreamer/lowlevel/README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ structures in the following classes were aligned to 1.8:
1515
- GstElementAPI
1616
- GstEvent
1717
- GstObject
18+
- GstPadProbeInfo
19+
- GstQueryAPI
20+
- GstSampleAPI

0 commit comments

Comments
 (0)