File: GRefPtrGStreamer.h

package info (click to toggle)
webkit2gtk 2.51.3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 477,912 kB
  • sloc: cpp: 3,898,343; javascript: 198,215; ansic: 165,229; python: 50,371; asm: 21,819; ruby: 18,095; perl: 16,953; xml: 4,623; sh: 2,398; yacc: 2,356; java: 2,019; lex: 1,358; pascal: 372; makefile: 197
file content (133 lines) | stat: -rw-r--r-- 6,711 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
 *  Copyright (C) 2011 Igalia S.L
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this library; see the file COPYING.LIB.  If not, write to
 *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301, USA.
 */

#pragma once

#if USE(GSTREAMER)
#include <gst/gst.h>
#include <gst/pbutils/encoding-profile.h>
#include <wtf/glib/GRefPtr.h>

typedef struct _WebKitVideoSink WebKitVideoSink;
struct WebKitWebSrc;
typedef struct _GstBaseSink GstBaseSink;

#if USE(GSTREAMER_GL)
typedef struct _GstGLDisplay GstGLDisplay;
typedef struct _GstGLContext GstGLContext;
typedef struct _GstEGLImage GstEGLImage;
typedef struct _GstGLColorConvert GstGLColorConvert;
#endif

#if USE(GSTREAMER_WEBRTC)
typedef struct _GstPromise GstPromise;
typedef struct _GstWebRTCDTLSTransport GstWebRTCDTLSTransport;
typedef struct _GstWebRTCDataChannel GstWebRTCDataChannel;
typedef struct _GstWebRTCICETransport GstWebRTCICETransport;
typedef struct _GstWebRTCRTPReceiver GstWebRTCRTPReceiver;
typedef struct _GstWebRTCRTPSender GstWebRTCRTPSender;
typedef struct _GstWebRTCRTPTransceiver GstWebRTCRTPTransceiver;
typedef struct _GstRTPHeaderExtension GstRTPHeaderExtension;
typedef struct _GstWebRTCICE GstWebRTCICE;
typedef struct _GstWebRTCICEStream GstWebRTCICEStream;

#endif // USE(GSTREAMER_WEBRTC)

namespace WTF {

WTF_DEFINE_GREF_TRAITS_INLINE(GstMiniObject, gst_mini_object_ref, gst_mini_object_unref)

WTF_DEFINE_GREF_TRAITS_INLINE(GstPlugin, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstElement, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstBaseSink, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstPad, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstPadTemplate, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstTask, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstBus, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstElementFactory, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstBufferPool, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(WebKitVideoSink, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(WebKitWebSrc, gst_object_ref_sink, gst_object_unref, g_object_is_floating)

WTF_DEFINE_GREF_TRAITS_INLINE(GstObject, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstStream, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstStreamCollection, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstClock, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstDeviceMonitor, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstDeviceProvider, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstDevice, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstTracer, gst_object_ref, gst_object_unref, g_object_is_floating)

WTF_DEFINE_GREF_TRAITS_INLINE(GstCaps, gst_caps_ref, gst_caps_unref)
WTF_DEFINE_GREF_TRAITS_INLINE(GstContext, gst_context_ref, gst_context_unref)
WTF_DEFINE_GREF_TRAITS_INLINE(GstBuffer, gst_buffer_ref, gst_buffer_unref)
WTF_DEFINE_GREF_TRAITS_INLINE(GstBufferList, gst_buffer_list_ref, gst_buffer_list_unref)
WTF_DEFINE_GREF_TRAITS_INLINE(GstMemory, gst_memory_ref, gst_memory_unref)
WTF_DEFINE_GREF_TRAITS_INLINE(GstSample, gst_sample_ref, gst_sample_unref)
WTF_DEFINE_GREF_TRAITS_INLINE(GstTagList, gst_tag_list_ref, gst_tag_list_unref)
WTF_DEFINE_GREF_TRAITS_INLINE(GstEvent, gst_event_ref, gst_event_unref)
WTF_DEFINE_GREF_TRAITS_INLINE(GstMessage, gst_message_ref, gst_message_unref)
WTF_DEFINE_GREF_TRAITS_INLINE(GstQuery, gst_query_ref, gst_query_unref)

WTF_DECLARE_GREF_TRAITS(GstEncodingProfile)

#if USE(GSTREAMER_GL)
WTF_DEFINE_GREF_TRAITS_INLINE(GstGLDisplay, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstGLContext, gst_object_ref_sink, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstGLColorConvert, gst_object_ref_sink, gst_object_unref, g_object_is_floating)

WTF_DECLARE_GREF_TRAITS(GstEGLImage)
#endif

#if USE(GSTREAMER_WEBRTC)
WTF_DEFINE_GREF_TRAITS_INLINE(GstWebRTCRTPReceiver, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstWebRTCRTPSender, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstWebRTCRTPTransceiver, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstWebRTCDTLSTransport, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstWebRTCICETransport, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstWebRTCICEStream, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstRTPHeaderExtension, gst_object_ref, gst_object_unref, g_object_is_floating)
WTF_DEFINE_GREF_TRAITS_INLINE(GstWebRTCICE, gst_object_ref, gst_object_unref, g_object_is_floating)

WTF_DEFINE_GREF_TRAITS_INLINE(GstPromise, gst_promise_ref, gst_promise_unref)

#endif // USE(GSTREAMER_WEBRTC)

// GstToc needs to be defined manually because gst_toc_ref() causes a warning if return value is not used.
template<> struct GRefPtrDefaultRefDerefTraits<GstToc> {
    static inline GstToc* refIfNotNull(GstToc* ptr)
    {
        if (ptr) [[likely]]
            return gst_toc_ref(ptr);
        return nullptr;
    }
    static inline void derefIfNotNull(GstToc* ptr)
    {
        if (ptr) [[likely]]
            gst_toc_unref(ptr);
    }
    static inline bool isFloating(GstToc*)
    {
        return false;
    }
};

} // namespace WTF

#endif // USE(GSTREAMER)