[Bug 788133] Fix problems with GstVideoInfo

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Tue Sep 26 12:53:00 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=788133

Erlend Graff <erlend at pexip.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #360355|0                           |1
        is obsolete|                            |
                 CC|                            |erlend at pexip.com

--- Comment #4 from Erlend Graff <erlend at pexip.com> ---
Created attachment 360440
  --> https://bugzilla.gnome.org/attachment.cgi?id=360440&action=edit
VideoInfo: Override Equals() method.

Thibault: looks good! Had to change the patch for Equals(), since with
opaque=true, the generated code is now a class and not a struct.

I was wondering if it'd make sense to make GstAudioInfo opaque as well, just
for the sake of having similar APIs for the two similar structures? (Before the
opaque-change, the VideoInfo had a Zero attribute that could be used to create
a zero-initialized struct instance, whereas after, a VideoInfo _must_ be
constructed as 'new VideoInfo()'. And the AudioInfo has the same Zero
attribute, which is even used in one of the code examples in the samples/
folder).

In addition, I have a question regarding the code that is generated by the GAPI
codegen for the opaque structure. I noticed that the gtk-sharp gapi-codegen
utility was recently changed to add a `GetFieldOffset()` method. In the case of
VideoInfo, the relevant code looks like this:

    public  unsafe uint GetFieldOffset(string field) {
        return (uint) (instance_offset + (uint)
Marshal.OffsetOf(typeof(Gst.Video.VideoInfo._GstVideoInfoABI), field));
    }

    [StructLayout (LayoutKind.Sequential)]
    public struct _GstVideoInfoABI {
        private IntPtr _finfo;

        private Gst.Video.VideoInterlaceMode interlace_mode;
        private Gst.Video.VideoFlags flags;
        private int width;
        private int height;
        private UIntPtr size;
        private int views;
        private Gst.Video.VideoChromaSite chroma_site;
        private Gst.Video.VideoColorimetry colorimetry;
        private int par_n;
        private int par_d;
        private int fps_n;
        private int fps_d;
        [MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
        private ulong[] Offset;
        [MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
        private int[] Stride;
        [StructLayout(LayoutKind.Explicit)]
        struct __ABI {
            struct __abi{
                private Gst.Video.VideoMultiviewMode multiview_mode;
                private Gst.Video.VideoMultiviewFlags multiview_flags;
                private Gst.Video.VideoFieldOrder field_order;
            }
            [FieldOffset(0)]
            private __abi abi;
            [FieldOffset(0)]
            [MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
            private IntPtr[] _gstGstReserved;
        }
        private __ABI ABI;
    }

However, the `GetFieldOffset()` method isn't used anywhere that I can see,
though. So I was wondering if this is work-in-progress for replacing the use of
the glue DLL to get the structure offsets? :-)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list